What is left to invoice customers' remaining sales orders
And decide the transactions as per date/second, find out whether any invoice of our customer is unmarked, and if unmarked then it has to be marked.
{
public void checkRecordMarked(InvoiceId _invoice, LedgerJournalTrans _ledgerJournalTrans,AccountNum _accountNum)
{
custvendopentransmanager manager;
CustTransOpen custTransOpen;
CustTrans custTrans;
//To mark particular invoice based on Acc num
select custTransOpen where custTransOpen.AccountNum ==_accountNum
join custTrans where custTrans.Invoice == _invoice
&& custTrans.RecId == custTransOpen.RefRecId
&& custTrans.AccountNum == custTransOpen.AccountNum;
if(custTransOpen)
{
//To check transaction line which we want to settle
manager = custvendopentransmanager::construct(_ledgerJournalTrans);
manager.updateTransMarked(custTransOpen,true);
Info(/Marked/);
}
{
tender Tender;
Ledgerjournaltrans ledgerjournaltrans;
Custinvoicejour custinvoicejour;
select firstonly InvoiceId from custinvoicejour where custinvoicejour.SalesId == Tender.Salesid;
if (xtsTender)
{
While select * from Ledgerjournaltrans where ledgerjournaltrans.JournalNum == Tender.PaymentJournalNum
{
this.checkRecordMarked(custinvoicejour.InvoiceId, Ledgerjournaltrans, Tender.AccountNum);
}
}
else
{
info(/Payment journal is not created for the sales order./);
}
}
public void MarkOpenTransaction()
{
SalesTable salesTable;
CustTable custTable;
CustInvoiceJour custInvoiceJour;
CustTransOpen custTransOpen;
CustTrans custTrans;
Tender sTender;
LedgerJournalTrans ledgerJournalTrans;
//select firstonly RecId, CustAccount, SalesId from salesTable join Tender
// where salesTable.SalesId == Tender.SalesId && Tender.SalesId == '';
if (salesTable)
{
select firstonly RecId, InvoiceId, InvoiceDate, InvoiceAmount
from custInvoiceJour
order by custInvoiceJour.InvoiceDate desc
where custInvoiceJour.SalesId == salesTable.SalesId;
{
select count(RecId) from custTransOpen
where custTransOpen.RefRecId == custInvoiceJour.RecId;
{
select firstonly custTable
where custTable.AccountNum == salesTable.CustAccount;
{
select firstonly custTrans
where custTrans.Invoice == custInvoiceJour.InvoiceId
&& custTrans.AccountNum == custTable.AccountNum;
{
while select Tender
where Tender.SalesId == salesTable.SalesId
{
while select ledgerJournalTrans
where ledgerJournalTrans.JournalNum == Tender.PaymentJournalNum
{
// custInvoiceJour.InvoiceId, ledgerJournalTrans.JournalNum, Tender.AccountNum));
}
}
}
}
}
else
{
info(/No invoice found for the specified SalesId./);
}
}