CustTrans invCustTrans;
CustTrans payCustTrans;
CustTable custTable;
AccountNum invoiceaccount;
/* 0a. Nomor invoice dan nomor payment harus sudah diketahui
dan di-input pada saat pembuatan jurnalnya
*/
/* 1. Pilih dulu invoice nya, kalo perlu gunakan where AccountNum*/
invoiceaccount = [Kode Customer];
custTable = CustTable::find(invoiceaccount);
Select firstonly invCustTrans
order by TransDate asc
where invCustTrans.Invoice == [InvoiceNumber]
&& invCustTrans.TransType == LedgerTransType::Sales;
if(invCustTrans) /* 2.Cek bila ada data invoice*/
{
//info('invoice '+invCustTrans.Invoice);
/* 3.Lakukan marking Invoicenya*/
custVendTransData = CustVendTransData::construct(invCustTrans);
custVendTransData.markForSettlement(CustTable);
/* 4.Pilih payment nya*/
ttsbegin;
while select payCustTrans
order by TransDate asc
where payCustTrans.DocumentNum == [PaymentNumber]
&& payCustTrans.TransType == 0
&& payCustTrans.AccountNum == invCustTrans.AccountNum
{
//info('Payment no '+[PaymentNumber]);
/* 5.Lakukan marking paymentnya*/
custVendTransData = CustVendTransData::construct(payCustTrans);
custVendTransData.markForSettlement(CustTable);
PaymentDate = [PaymentDate];
}
ttscommit;
/* 6. Proses Settlement nya */
/* SettleDatePrinc::SelectDate, tgl settle diinput (ditentukan) manual */
CustTrans::settleTransact(custTable, null, true,SettleDatePrinc::SelectDate, PaymentDate);
}
No comments:
Post a Comment