Hi all,
i tested by using 1 journal that have 2 invoices.however, it will give output as 2 invoice but second invoice is same information with first invoice. i know my looping is wrong but i dont know how to fix it already. i use debugger, it loop at the underline code below,but when it loop for second invoice, it not return the correct value as it only copy the first invoice value.
protected container outputPaymAdvice(VendOutPaymRecord _clsVendOutPaymRecord, container gconRecord)
{
#define.space(' ')
VendPaymModeTable tblPaymMode;
LedgerJournalTable tblLedgerJournalTable;
LedgerJournalTrans tblLedgerJournalTrans;
VendTrans vendTrans;
str strRecord;
str strFileRef;
BankAccountTable tblBank;
SpecTrans tblSpecTrans,tblSpecTransCheck;
str strFileName = "";
;
tblPaymMode = VendPaymModeTable::find(_clsVendOutPaymRecord.parmCustVendPaym().ledgerJournalTrans().PaymMode);
tblBank = _clsVendOutPaymRecord.parmCustVendPaym().bankAccountTable();
tblLedgerJournalTrans = _clsVendOutPaymRecord.parmCustVendPaym().ledgerJournalTrans();
select tblSpecTransCheck
where tblSpecTransCheck.SpecTableId == tblLedgerJournalTrans.TableId &&
tblSpecTransCheck.SpecRecId == tblLedgerJournalTrans.RecId &&
tblSpecTransCheck.SpecCompany == tblLedgerJournalTrans.Company;
if(tblSpecTransCheck)
{
while select tblSpecTrans
where tblSpecTrans.SpecTableId == tblLedgerJournalTrans.TableId &&
tblSpecTrans.SpecRecId == tblLedgerJournalTrans.RecId &&
tblSpecTransCheck.SpecCompany == tblLedgerJournalTrans.Company
if (tblSpecTrans.vendTrans().Invoice)//for Payment Advice fix format
{
//1: RECORD TYPE. Format: 9(1) Range: 1-1 Mandatory: Y Remark : Payment Advice fix format
strRecord += strLFix("3", 1) ;
//2: Spacing Line. Format: X(20). Range: 2-4. Mandatory: Y.
strRecord += strupr(strrep(#space,2));
//3: Invoice no. Format: x(20). Range: 4-24. Mandatory: Y.
strRecord += strLFix(tblSpecTrans.vendTrans().Invoice, 20);
//4: Invoice Date. Format: 9(8). Range: 24-32. Mandatory: N.
strRecord += SKMY_BankIntgrUtilUOB_ANT::convertDate2str(tblSpecTrans.vendTrans().TransDate);
//5: Invoice Amount. Format: 9(9)V9(2). Range: 32-43. Mandatory: N.
strRecord += SKMY_BankIntgrUtilUOB_ANT::real2NumChar(-tblSpecTrans.Balance01, 11, true);
//6: Gross Amount. Format: 9(9)V9(2). Range: 43-20. Mandatory: N.
strRecord += strupr(strrep(#space,11));
//7: Discount. Format: 9(9)V9(2). Range: 54-20. Mandatory: N.
strRecord += strupr(strrep(#space,4));
//8: Positive or Negetive sign. Format: x(1). Range: 58-59. Mandatory: Y.
if (-tblSpecTrans.Balance01 >= 0)
{
strRecord += strLFix("+", 1);
}
else if (-tblSpecTrans.Balance01 < 0)
{
strRecord += strLFix("-", 1);
}
//9: Item code. Format: x(30). Range: 59-89. Mandatory: N.
strRecord += strupr(strrep(#space,30));
//10: Item description line 1. Format: x(35). Range: 89-124. Mandatory: N.
strRecord += strupr(strrep(#space,35));
//11: Item description line 2. Format: x(35). Range: 124-159. Mandatory:N.
strRecord += strupr(strrep(#space,35));
//12: Item description line 3. Format: x(35). Range: 159-194. Mandatory: N.
strRecord += strupr(strrep(#space,35));
//13: Filler Format: x(1609). Range: 194-1609. Mandatory: Blanks
//strRecord += strupr(strrep(#space,1609));
gconRecord = conins(gconRecord, conlen(gconRecord) + 1, strRecord);
}
}
else
{
//1: RECORD TYPE. Format: x(1) Range: 1-2 Mandatory: Y Remark : Payment Advice Freetext
strRecord = strLFix("4", 1) ;
//2: Spacing Line. Format: 9(2). Range: 2-4. Mandatory: Y.
strRecord += strupr(strrep(#space,2));
//3: Payment Advice Details. Format: x(105). Range: 4-109. Mandatory: Y.
strRecord += strLFix(tblLedgerJournalTrans.txt, 105);
//4: Filler Format: x(1694). Range: 109-1803. Mandatory: Blanks
//strRecord += strupr(strrep(#space,1609));
gconRecord = conins(gconRecord, conlen(gconRecord) + 1, strRecord);
}
return gconRecord;
}