TextBuffer textBuffer = new TextBuffer();
FileNameFilter Filter = ["CSV file", "*.csv"];
FileName FileName;
#WinAPI
LedgerJournalTrans LocLedgerJournalTrans, TxtLedgerJournalTrans;
;
super();
FileName = winapi::getSaveFileName(infolog.hWnd(), filter, @"c:\...\desktop", "Save as CSV file","csv","Create Payment Permata");
if(!FileName)
return ;
while select sum(AmountCurDebit), LedgerDimension, OffsetLedgerDimension, CurrencyCode, PaymentMethod, TransDate, BankAccountId, JournalNum
from LocLedgerJournalTrans
Group by LedgerDimension, OffsetLedgerDimension, CurrencyCode, PaymentMethod, TransDate, BankAccountId, JournalNum
order by LineNum
where LocLedgerJournalTrans.JournalNum == LedgerJournalTrans.JournalNum
&& LocLedgerJournalTrans.accounttype == LedgerJournalACType::Vend
{
textBuffer.appendText(strfmt("%1,", VendBankAccount::findByVendAccount(DimensionStorage::ledgerDimension2AccountNum(LocLedgerJournalTrans.LedgerDimension)).AccountID));
textBuffer.appendText(strfmt("%1,", ""));
textBuffer.appendText(strfmt("%1,", ""));
if(LocLedgerJournalTrans.PaymentMethod != PaymentMethod::OVB)
{
textBuffer.appendText(strfmt("%1,", VendBankAccount::findByVendAccount(DimensionStorage::ledgerDimension2AccountNum(LocLedgerJournalTrans.LedgerDimension)).RegistrationNum));
}
else
{
textBuffer.appendText(strfmt("%1,", ""));
}
textBuffer.appendText(strfmt("%1,", VendBankAccount::findByVendAccount(DimensionStorage::ledgerDimension2AccountNum(LocLedgerJournalTrans.LedgerDimension)).Name));
// fixing
textBuffer.appendText(strfmt("%1,", VendBankAccount::findByVendAccount(DimensionStorage::ledgerDimension2AccountNum(LocLedgerJournalTrans.LedgerDimension)).AccountNum));
// end fixing
textBuffer.appendText(strfmt("%1,", LocLedgerJournalTrans.CurrencyCode));
//textBuffer.appendText(strfmt("%1,", any2real(num2str0((LocLedgerJournalTrans.AmountCurDebit), 0, 0, 1,0)))); //real2int(LocLedgerJournalTrans.AmountCurDebit)));
//textBuffer.appendText(strfmt("%1,", LocLedgerJournalTrans.AmountCurDebit));
textBuffer.appendText(strfmt("%1,",Num2Str(LocLedgerJournalTrans.AmountCurDebit, 0, 99, DecimalSeparator::Auto, ThousandSeparator::None)));
info(strfmt("%1,", any2real(num2str0((LocLedgerJournalTrans.AmountCurDebit), 0, 0, 1,0))));
select firstFast txt from
TxtLedgerJournalTrans
where TxtLedgerJournalTrans.JournalNum == LocLedgerJournalTrans.JournalNum
&& TxtLedgerJournalTrans.LedgerDimension == LocLedgerJournalTrans.LedgerDimension;
textBuffer.appendText(strfmt("%1,", strReplace(TxtLedgerJournalTrans.txt, ",", "")));
textBuffer.appendText(strfmt("%1,", ''));
textBuffer.appendText(strfmt("%1,", vendtable::find(VendBankAccount::findByVendAccount(DimensionStorage::ledgerDimension2AccountNum(LocLedgerJournalTrans.LedgerDimension)).VendAccount).Email));
textBuffer.appendText(strfmt("%1,", LocLedgerJournalTrans.PaymentMethod));
textBuffer.appendText(strfmt("%1,", "0"));
textBuffer.appendText(strfmt("%1,", "0"));
textBuffer.appendText(strfmt("%1,", ""));
textBuffer.appendText(strfmt("%1,", ""));
textBuffer.appendText(strfmt("%1,", ""));
textBuffer.appendText(strfmt("%1,", ""));
textBuffer.appendText(strfmt("%1,", ""));
textBuffer.appendText(strfmt("%1,", ""));
textBuffer.appendText(strfmt("%1,", "PT XXX"));
textBuffer.appendText(strfmt("%1,", BankAccountTable::find(DimensionStorage::ledgerDimension2AccountNum(LocLedgerJournalTrans.OffsetLedgerDimension)).AccountNum));
textBuffer.appendText(strfmt("%1,", BankAccountTable::find(DimensionStorage::ledgerDimension2AccountNum(LocLedgerJournalTrans.OffsetLedgerDimension)).CurrencyCode));
textBuffer.appendText(strfmt("%1,", ""));
textBuffer.appendText(strfmt("%1,", ""));
textBuffer.appendText(strfmt("%1,", "Jakarta"));
textBuffer.appendText(strfmt("%1,", ""));
textBuffer.appendText(strfmt("%1,", ""));
textBuffer.appendText(strfmt("%1,", ""));
textBuffer.appendText(strfmt("%1,", ""));
textBuffer.appendText(strfmt("%1,", ""));
/*if(vendtable::find(VendBankAccount::findByVendAccount(DimensionStorage::ledgerDimension2AccountNum(LedgerJournalTrans.LedgerDimension)).VendAccount).name() like '*Bpk*)
{
textBuffer.appendText(strfmt("%1,", "1"));
}
else
{
if(vendtable::find(VendBankAccount::findByVendAccount(DimensionStorage::ledgerDimension2AccountNum(LedgerJournalTrans.LedgerDimension)).VendAccount).name() like '*Ibu*)
{
textBuffer.appendText(strfmt("%1,", "1"));
}
else
{
textBuffer.appendText(strfmt("%1,", "2"));
}
}*/
textBuffer.appendText(strfmt("%1,", "2"));
textBuffer.appendText(strfmt("%1,", ""));
textBuffer.appendText("\n");//next row
}
if (textBuffer.toFile(FileName))
{
info( strfmt("File Generated as %1.Total %2 Lines",FileName,textBuffer.numLines()));
winapi::shellExecute(FileName);
}
}