project QadFinancials > class BCInvoice > method GetDetailsFromBankRefCode
Description
Retrieves the date and the amount from the passed in code - either the manual code or the optical code from the barcode. Also returns manual code format.
Parameters
| icCode | input | character | Code which contains data such as date and amount |
| otDate | output | date | |
| odAmount | output | decimal | |
| ocTransformCode | output | character | Returns the transformed bank reference code - optical to manual |
| oiReturnStatus | output | integer | Return status of the method. |
Internal usage
unused
program code (program1/bcinvoice.p)
if LENGTH(icCode,"CHARACTER") = 44 then
do:
assign vcTransformString = trim(substring(icCode,1,4,"CHARACTER")).
<M-73 run CalcBarcodeCheckDigit
(input trim(substring(icCode,1,4,'CHARACTER')) + trim(substring(icCode,20,5,'CHARACTER')) + '0' (icCode),
output vcCheckDigit (ocCheckDigit),
output viFcReturnSuper (oiReturnStatus)) in BCInvoice>
if viFcReturnSuper <> 0 then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0 then return.
assign vcTransformString = vcTransformString + trim(substring(icCode,20,5,"CHARACTER")) + vcCheckDigit.
<M-15 run CalcBarcodeCheckDigit
(input trim(substring(icCode,25,10,'CHARACTER')) + '0' (icCode),
output vcCheckDigit (ocCheckDigit),
output viFcReturnSuper (oiReturnStatus)) in BCInvoice>
if viFcReturnSuper <> 0 then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0 then return.
assign vcTransformString = vcTransformString + trim(substring(icCode,25,10,"CHARACTER")) + vcCheckDigit.
<M-84 run CalcBarcodeCheckDigit
(input trim(substring(icCode,35,10,'CHARACTER')) + '0' (icCode),
output vcCheckDigit (ocCheckDigit),
output viFcReturnSuper (oiReturnStatus)) in BCInvoice>
if viFcReturnSuper <> 0 then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0 then return.
assign vcTransformString = vcTransformString + substring(icCode,35,10,"CHARACTER") + vcCheckDigit +
substring(icCode,5,1,"CHARACTER") + substring(icCode,6,14,"CHARACTER").
assign ocTransformCode = vcTransformString.
end.
else do:
assign ocTransformCode = icCode.
end.
/*****************************/
/* currently we are retrieving only the amount from the
passed in code and we are assuming 2 decimal points.
the amount is stored in the last 10 digits of the code
*/
assign
viStartIdx = LENGTH(ocTransformCode, "CHARACTER")
vcDecimalString = substring(ocTransformCode, viStartIdx - 9 , 8, "CHARACTER":U)
vcDecimalString1 = substring(ocTransformCode, viStartIdx - 1 , -1, "CHARACTER":U)
odAmount = Decimal(vcDecimalString + '.' + vcDecimalString1) no-error.
if error-status:error
then assign odAmount = 0.