{
public int getCountLines(LedgerJournalId _journalNum)
{
LedgerJournalTrans ledgerJournalTrans;
int recordCount;
where ledgerJournalTrans.JournalNum == _journalNum;
recordCount = ledgerJournalTrans.RecId;
}
{
int voucherLineCount;
Voucher vouchercount;
;
group by Voucher
where ledgerJournalTrans.JournalNum == _journalNum
voucherLineCount +=1;
}
return voucherLineCount;
public int getLastFileNo(LedgerJournalId _journalNum)
{
ledgerJournalTrans ledgerJournalTransrec;
;
order by ledgerJournalTransrec.JournalNum desc
where ledgerJournalTransrec.JournalNum ==_journalNum;
}
public recid getLastRecId(LedgerJournalId _journalNum)
{
ledgerJournalTrans ledgerJournalTransrec;
;
order by ledgerJournalTransrec.JournalNum desc
where ledgerJournalTransrec.JournalNum ==_journalNum;
}
void output()
{
container line;
container lastLineRecords;
LedgerJournalTrans ledgerJournalTrans,localLedgerJournalTrans,ledgerJournalTransrec;
BankAccountTable bankAccountTable;
VendTable vendTable;
VendBankAccount vendBankAccount;
Address Address;
DirPartyTable DirPartyTable;
DirPartyAddressRelationship dirPartyAddressRelationship;
DirPartyAddressRelationshipMapping dirPartyAddressRelationshipMapping;
Amount totalAmt;
str strformat8,strformat9;
str transactionTypeDRCR;
AmountCurDebit curDebit,curCredit;
int linesNoCount, counter,noLines,CountVoucher,LastFileNo;
RecId lastRecId;
;
ledgerJournalTransrec = custVendPaym.ledgerJournalTrans();
ledgerJournalTrans = custVendPaym.ledgerJournalTrans();
vendTable = custVendPaym.custVendTable();
where vendBankAccount.VendAccount == vendTable.AccountNum
&& vendBankAccount.PHIBankFile == NoYes::Yes;
outer join dirPartyAddressRelationship where dirPartyAddressRelationship.PartyId == DirPartyTable.PartyId
join dirPartyAddressRelationshipMapping where dirPartyAddressRelationshipMapping.PartyAddressRelationshipRecId == dirPartyAddressRelationship.RecId
join Address where Address.RecId== dirPartyAddressRelationshipMapping.AddressRecId &&
Address.type== AddressType::Payment;
totalAmt = abs(localLedgerJournalTrans.AmountCurCredit - localLedgerJournalTrans.AmountCurDebit);
if(ledgerJournalTrans.AmountCurDebit>0)
{
curDebit = ledgerJournalTrans.AmountCurDebit;
transactionTypeDRCR = '02';
else
{
curDebit = ledgerJournalTrans.AmountCurCredit;
transactionTypeDRCR = '01';
}
enum2str(ledgerJournalTrans.PHIReleaseMode),VendTable.PHIBankLocationCode,vendTable.Name,vendBankAccount.AccountNum,ledgerJournalTrans.Txt,' ',Address.Street,Address.City,Address.State,Address.ZipCode];
file.writeExp(line);*/ //commted by pankaj
//linesNoCount=0;
linesNoCount = ledgerjournaltable::find(ledgerJournalTrans.JournalNum).numOfLines();
/* select firstfast * from ledgerJournalTransrec
order by ledgerJournalTransrec.JournalNum desc
where ledgerJournalTransrec.JournalNum == ledgerJournalTrans.JournalNum ;*/
lastRecId = this.getLastRecId(ledgerJournalTrans.JournalNum);
noLines = this.getCountLines(ledgerJournalTrans.JournalNum);
{
this.Output_Invoice();
}
else
{*/
line= ['TR',ledgerJournalTrans.Voucher,strformat8,vendTable.CountryRegionId,vendBankAccount.AccountID,vendBankAccount.AccountNum,
curDebit,ledgerJournalTrans.currencyCode,
ledgerJournalTrans.PaymMode,transactionTypeDRCR,'01',bankAccountTable.AccountNum,bankAccountTable.Name,ledgerJournalTrans.Txt,' ',Address.Street,Address.City,Address.State,Address.ZipCode];
counter++;
file.writeExp(line);
/*
if(ledgerJournalTrans.SettleVoucher==SettlementType::SelectedTransact)
{
this.Output_Invoice();
}*/
///
//linesNoCount =linesNoCount+ 1;
linesNoCount =linesNoCount;
counter = conLen(line);
// if(ledgerJournalTrans.LineNum >=linesNoCount)
// if(LedgerJournalTrans::lastLineNum(ledgerJournalTrans.JournalNum) >= counter )
// if( counter >= 2)
if(ledgerJournalTrans.RecId == lastRecId )
{
CountVoucher = this.getCountVoucher(ledgerJournalTrans.JournalNum);
lastLineRecords = conNull();
lastLineRecords= ['FT',noLines,CountVoucher,totalAmt];
file.writeExp(lastLineRecords);
//line = conNull();
}
info(Strfmt('%1',linesNoCount));
info(Strfmt('%1',lastRecId));
counter = conLen(line);
info(strFmt("Number of records: %1", counter));*/
void output_header()
{
container line;
ledgerJOurnalTrans ledgerJournalTrans,localLedgerJournalTrans;
Amount totalAmt;
str strformat8,strformat9;
int LastFileNo;
;
ledgerJournalTrans = custVendPaym.ledgerJournalTrans();
LastFileNo = this.getLastFileNo(ledgerJournalTrans.JournalNum);
select sum(AmountCurDebit),sum(amountCurCredit) from localLedgerJournalTrans where localLedgerJournalTrans.JournalNum==ledgerJournalTrans.JournalNum;
totalAmt = localLedgerJournalTrans.AmountCurCredit + localLedgerJournalTrans.AmountCurDebit;
if(!LedgerJournalTrans.FileCreated)
{
strformat8 = date2str(today(),321,DateDay::Digits2,DateSeparator::None,DateMonth::Digits2,DateSeparator::None,DateYear::Digits4);
}
else
{
strformat8 = date2str(LedgerJournalTrans.FileCreated,321,DateDay::Digits2,DateSeparator::None,DateMonth::Digits2,DateSeparator::None,DateYear::Digits4);
}
strformat9 = strFmt(time2str(timeNow(), TimeSeparator::Space, TimeFormat::Hour24));
strformat9 = strAlpha(strformat9);
// line=['FH',ledgerJournalTrans.AccountNum,strformat8,strformat9,'01100'];//num2str(totalAmt,1,2,1,0)];//stralpha function to remove space
line=['FH',ledgerJournalTrans.AccountNum,strformat8,strformat9,LastFileNo+1];
file.writeExp(line);
}
void Output_Invoice()
{
container line;
ledgerJournalTrans ledgerJournalTrans,ledgerJournalTransLine,localLedgerJournalTrans;
bankAccountTable bankAccountTable;
vendTable vendTable;
VendTrans VendTrans;
VendTransOpen VendTransOpen;
specTrans specTrans;
Amount LocalAmount;
CustVendOpenTransManager manager;
VendBankAccount vendBankAccount;
Address Address;
DirPartyTable DirPartyTable;
DirPartyAddressRelationship dirPartyAddressRelationship;
DirPartyAddressRelationshipMapping dirPartyAddressRelationshipMapping;
Amount totalAmt;
AmountCurDebit curDebit,curCredit;
int linesNo;
str transactionTypeDRCR;
;
ledgerJournalTrans = custVendPaym.ledgerJournalTrans();
bankAccountTable = custVendPaym.bankAccountTable();
vendTable = custVendPaym.custVendTable();
exists join specTrans where specTrans.RefCompany==VendTransOpen.dataAreaId
&& specTrans.RefTableId==VendTransOpen.TableId
&& SpecTrans.RefRecId==VendTransOpen.RecId
{
if(manager.getTransMarked(VendTransOpen))
{
select VendTrans where vendTrans.AccountNum==VendTable.AccountNum && vendtrans.RecId==VendTransOpen.RefRecId;
localAmount=abs(vendTransOpen.AmountCur);
line=['ITR',ledgerJournalTrans.Voucher,VendTrans.Invoice,num2str(localAmount,1,2,0,0),'0',num2str(localAmount,1,2,0,0),vendTrans.Txt];
file.writeExp(line);
}
}*/ // commeted by pankaj
where vendBankAccount.VendAccount == vendTable.AccountNum
&& vendBankAccount.PHIBankFile == NoYes::Yes;
outer join dirPartyAddressRelationship where dirPartyAddressRelationship.PartyId == DirPartyTable.PartyId
join dirPartyAddressRelationshipMapping where dirPartyAddressRelationshipMapping.PartyAddressRelationshipRecId == dirPartyAddressRelationship.RecId
join Address where Address.RecId== dirPartyAddressRelationshipMapping.AddressRecId &&
Address.type== AddressType::Payment;
strformat8 = date2str(ledgerJournalTrans.TransDate,321,DateDay::Digits2,DateSeparator::None,DateMonth::Digits2,DateSeparator::None,DateYear::Digits4);
while select ledgerJournalTransLine where ledgerJournalTransLine.JournalNum == ledgerJournalTrans.JournalNum
{
if(ledgerJournalTrans.AmountCurDebit>0)
{
curDebit=0;
curDebit = ledgerJournalTrans.AmountCurDebit;
transactionTypeDRCR = '02';
else
{
curDebit=0;
curDebit = ledgerJournalTrans.AmountCurCredit;
transactionTypeDRCR = '01';
}
line= ['TR',ledgerJournalTrans.Voucher,strformat8,Address.CountryRegionId,vendBankAccount.AccountID,vendBankAccount.AccountNum,
curDebit,ledgerJournalTrans.currencyCode,
ledgerJournalTrans.PaymMode,transactionTypeDRCR,'01',bankAccountTable.AccountID,bankAccountTable.Name,ledgerJournalTrans.Txt,' ',Address.Street,Address.City,Address.State,Address.ZipCode];
file.writeExp(line);
}
{
int lenAdd,remComma1,rem;
str printAdd,y;
;
lenAdd = strlen(_address);
y = _address;
printAdd = _address;
for(rem = 1; rem <=lenAdd; rem++)
{
remComma1 = strfind(y,' ',rem,1);
if(remComma1 >0)
{
printAdd = strdel(y,remComma1,1);
printAdd = strins(printAdd,' ',remComma1);
y = printAdd;
remComma1 = 0;
}
}
printAdd = strRTrim(printAdd);
return printAdd;
}
-------------------------------------------------------------------------------------------------------
{
}
public void close()
{
;// super();
}
public classId custVendOutPaymRecordRootClassId()
{
return classnum(PHIVendPaymRecord_Text_PH_New);
}
boolean _forceOnClient)
{
DialogRunbase dialog;
;
return dialog;
}
{
return 'Payment text format-PH - New';
}
void open()
{
PhiBankFileSeries PhiBankFileSeries;
#LocalCodePage
;
filepath= WinAPI::browseForFolderDialog("@PHI4626","@PHI4627",true);
phiBankFileSeries=phiBankFileSeries::find();
PhiBankFileSeries.write();
filename=filepath+ '\\'+'PHP'+date2str(systemdateget(),123,2,0,2,0,2)+int2str(PhiBankFileSeries::find().PHISerialNumber)+'.txt';
file = CustVendOutPaym::newFile(filename, #cp_1252);
if (!file || file.status() != IO_Status::Ok)
{
throw error(
strfmt("@SYS19312", filename));
}
file.outFieldDelimiter(',');
file.outRecordDelimiter('\r\n');
}
{
return true;
}