Kovu's terrasco.net
 Autologin
 KESR - Kovu's ESR Reader Library
 
KESR is a library for reading ESR record files (*.v11), typically delivered by swiss post and banks to track pay-in slip payments done by customers. It decodes, returns and checks the data provided with these files, allowing you to convert said data for your own bookkeeping matters.
 
Author: Markus Fumagalli "Kovu"
 Size: 41 Kb 
Type: *.tar 
 
Jul 24 2010 
19:02:18 
 
click here for downloading this file
Code:
  
  #############################################
  #                                           #
  #        Kovu's ESR Reader  v1.0.0          #
  #       Functions / Class Reference         #
  #                                           #
  # (c) Markus Fumagalli "Kovu", terrasco.net #
  #               July 16 2010                #
  #                                           #
  #############################################
  
  
  1) SUPPORTED FILE TYPES
     
     *.v11              (Swiss ESR [VESR, BESR] Record Data)
     
  
  2) CELL REFERENCE
     
     ESR record type 3 produces the following record tables:
     
           ['total'][x]
                       ['type']               transaction type
                       ['sort_key']           sort key
                       ['amount']             total amount
                       ['transactions']       number of transactions
                       ['date']               date of total
                       ['esr_taxes']          total ESR taxes
                       ['esr+_taxes']         total ESR+ taxes
                       ['spare']              not used
                       ['notion']             + (positive) / - (negative)
     
     ['transaction'][x]
                       ['type']               transaction type
                       ['reference']          reference number
                       ['amount']             amount
                       ['po_reference']       input reference (office)
                       ['po_date']            input date (office)
                       ['pr_date']            processing date
                       ['ta_date']            transaction date
                       ['mf_number']          microfilm number
                       ['reject_code']        reject code
                       ['spare']              not used
                       ['esr_taxes']          ESR taxes
                       ['notion']             + (positive) / - (negative)
                       ['esr_type']           identified ESR type
     
     
     ESR record type 4 produces the following record tables:
     
           ['total'][x]
                       ['code']               transaction code
                       ['type']               transaction type
                       ['origin']             origin
                       ['delivery']           delivery type
                       ['sort_key']           sort key
                       ['amt_code_iso']       money code (CHF/EUR) for amount
                       ['amount']             total amount
                       ['transactions']       number of transactions
                       ['date']               date of total
                       ['esr_code_iso']       money code (CHF/EUR) for ESR taxes
                       ['esr_taxes']          total ESR taxes
                       ['spare']              not used
                       ['notion']             + (positive) / - (negative)
                       ['money']              identified money code (CHF/EUR)
     
     ['transaction'][x]
                       ['code']               transaction code
                       ['type']               transaction type
                       ['origin']             origin
                       ['delivery']           delivery type
                       ['reference']          reference number
                       ['amt_code_iso']       money code (CHF/EUR) for amount
                       ['amount']             amount
                       ['po_reference']       input reference (office)
                       ['po_date']            input date (office)
                       ['pr_date']            processing date
                       ['ta_date']            transaction date
                       ['reject_code']        reject code
                       ['esr_code_iso']       money code (CHF/EUR) for ESR taxes
                       ['esr_taxes']          ESR taxes
                       ['spare']              not used
                       ['notion']             + (positive) / - (negative)
                       ['money']              identified money code (CHF/EUR)
                       ['esr_type']           identified ESR type
     
  
  3) CLASS REFERENCE
     
     ==========================================
     ¦ $kesr = new KESR($path, $record_type); ¦
     ==========================================
     
     Opens ESR record file at $path with the specified $record_type (which defaults
     to '3', and also accepts type '4').
     
     
     =========================
     ¦ $kesr -> CheckTable() ¦
     =========================
     
     Checks if the table isn't corrupted. Returns true if everything is ok, false if
     not. This should be executed after every file you load into a KESR object.
     
     
     ============================
     ¦ $kesr -> GetLastRecord() ¦
     ============================
     
     Returns the key number of the last record or false on failure.
     
     
     =========================
     ¦ $kesr -> GetClients() ¦
     =========================
     
     Returns the client numbers of records stored in the file or false on failure.
     
     
     ==============================
     ¦ $kesr -> GetRecordNumber() ¦
     ==============================
     
     Returns the key number of the currently selected record or false on failure.
     
     
     =========================================
     ¦ $kesr -> SelectClient($client_number) ¦
     =========================================
     
     Selects a client. Returns true on success or false on fail.
     
     
     ================================
     ¦ $kesr -> SelectRecord($nrow) ¦
     ================================
     
     Selects a record from the currently selected client data. Returns true on 
     success or false on fail.
     
     
     ===============================
     ¦ $kesr -> SelectCell($ncell) ¦
     ===============================
     
     Selects a data cell from the currently selected record. Returns true on
     success or false on fail.
     
     
     =============================
     ¦ $kesr -> GotoNextRecord() ¦
     =============================
     
     Selects next record stored in the client data. Returns true on success or
     false on fail.
     
     
     =================================
     ¦ $kesr -> GotoPreviousRecord() ¦
     =================================
     
     Selects previous record stored in the client data. Returns true on success or
     false on fail.
     
     
     ====================================
     ¦ $kesr -> GetValue($ncell, $nrow) ¦
     ====================================
     
     Returns a value of the currently selected cell in a record. $ncell and $nrow 
     are optional and allow to select a cell or record directly. Returns false on
     failure.
     
     
     =============================
     ¦ $kesr -> GetTotalRecord() ¦
     =============================
     
     Returns the currently selected client's total record as array or false on
     failure.
     
     
     =============================
     ¦ $kesr -> GetRecord($nrow) ¦
     =============================
     
     Returns the currently selected record of a client as array. $nrow is optional
     and allows to select a record directly.
     
     
     ============================
     ¦ $kesr -> GetAllRecords() ¦
     ============================
     
     Resorts and returns the full ESR records table as array or returns false on 
     failure.
     
     
     =================================
     ¦ $kesr -> GetAllTotalRecords() ¦
     =================================
     
     Resorts and returns the full total records table as array or returns false on 
     failure.
     
     
     =========================
     ¦ $kesr -> CheckTotal() ¦
     =========================
     
     Compares the sums of every client's records with the corresponding total record.
     Returns true if those records are ok or false if not.