
Hi,
I just want to ask. how to validate if the parameters has data or empty? I tried using If else statement but it doesn't pass through the code. please see the code below.
CustAccount and CostCenter are the parameters where I am passing the data. I just want to clarify if my code is correct if there is no data in cost center it doesn't go through....
while select ledgerJournalTrans where
LedgerJournaltrans.RecId == custvendpdcregister.LedgerJournalTrans
{
CashCollectionTmp.PDCCollectionEWT += ledgerJournalTrans.AmountCurCredit;
}
}
if(!custAccount)
{
while select custtrans where
custtrans.transdate >= fromdate &&
custtrans.transdate <= todate &&
custtrans.transtype == ledgertranstype::payment &&
custtrans.paymmode != "cwt"
//&&
//(((custtrans.accountnum == custaccount ||
//custtrans.accountnum == "")||
//(custtrans.accountnum != custaccount ||
//custtrans.accountnum !="")))
{
if(!costcenter)
{
while select subledgervouchergeneraljournalentry where
subledgervouchergeneraljournalentry.voucher == custtrans.voucher
join generaljournalentry where
generaljournalentry.recid == subledgervouchergeneraljournalentry.generaljournalentry
{
while select generaljournalaccountentry where
generaljournalaccountentry.generaljournalentry == generaljournalentry.recid &&
generaljournalaccountentry.iscredit == noyes::yes &&
generaljournalaccountentry.postingtype == ledgerpostingtype::custbalance
{
if(custtrans.paymmode != 'cwt')
{
cashcollectiontmp.ledgeraccount = substr(generaljournalaccountentry.ledgeraccount,13,3);
cashcollectiontmp.accountnum = costcenter;
cashcollectiontmp.customername = "1";//custtable::find(custtrans.accountnum).name(); //customer name
cashcollectiontmp.paymreference = custtrans.paymreference; //paym reference
cashcollectiontmp.transdate = custtrans.transdate; //collection date
cashcollectiontmp.amountcur = abs(custtrans.amountcur); // collected amount
cashcollectiontmp.companybankaccountid = custtrans.companybankaccountid; //number 17: bank issuing code (b20)
cashcollectiontmp.docnum = custtrans.documentnum; //number 15: document num
cashcollectiontmp.companybankaccountid1 = custtrans.companybankaccountid; //issuing bank
cashcollectiontmp.netamount = abs(custtrans.amountcur);
cashcollectiontmp.checkdate = custtrans.transdate;
cashcollectiontmp.insert();
}
}
}
}
else
{
while select subledgervouchergeneraljournalentry where
subledgervouchergeneraljournalentry.voucher == custtrans.voucher
join generaljournalentry where
generaljournalentry.recid == subledgervouchergeneraljournalentry.generaljournalentry
{
while select generalJournalAccountEntry where
generalJournalAccountEntry.LedgerAccount like '*' + costCenter &&
generalJournalAccountEntry.GeneralJournalEntry == generalJournalEntry.RecId &&
generalJournalAccountEntry.IsCredit == NoYes::Yes &&
generalJournalAccountEntry.PostingType == LedgerPostingType::CustBalance
{
if(custtrans.PaymMode != 'cwt')
{
CashCollectionTmp.LedgerAccount = subStr(generalJournalAccountEntry.LedgerAccount,13,3);
CashCollectionTmp.AccountNum = costCenter;
CashCollectionTmp.CustomerName = "2";//CustTable::find(custtrans.AccountNum).name(); //Customer Name
CashCollectionTmp.PaymReference = custtrans.PaymReference; //Paym Reference
CashCollectionTmp.TransDate = custtrans.TransDate; //Collection Date
CashCollectionTmp.AmountCur = abs(custtrans.AmountCur); // Collected Amount
CashCollectionTmp.CompanyBankAccountId = custtrans.CompanyBankAccountId; //Number 17: Bank Issuing Code (B20)
CashCollectionTmp.DocNum = custtrans.DocumentNum; //Number 15: Document Num
CashCollectionTmp.CompanyBankAccountId1 = custtrans.CompanyBankAccountId; //Issuing Bank
cashcollectiontmp.NetAmount = abs(custtrans.AmountCur);
CashCollectionTmp.CheckDate = custtrans.TransDate;
CashCollectionTmp.insert();
}
}
}
}
}
}
*This post is locked for comments
I have the same question (0)