Hello Guys..!
Here I'm sharing code for Settle Vendor Invoice/Payment through X++
Code:
-----------
static void VendorSettlement(Args _args)
{
VendTable vendTable;
VendTrans invVendTrans, payVendTrans;
SpecTransManager manager;
CustVendTransData custVendTransData;
;
vendTable = VendTable::find("12345");
// Find the oldest unsettled invoice
select firstonly invVendTrans order by TransDate asc
where invVendTrans.AccountNum == vendTable.AccountNum &&
invVendTrans.TransType == LedgerTransType::Purch &&
!invVendTrans.closed;
// Find the oldest unsettled payment
select firstonly payVendTrans order by TransDate asc
where payVendTrans.AccountNum == vendTable.AccountNum &&
payVendTrans.TransType == LedgerTransType::Payment &&
!payVendTrans.closed;
ttsbegin;
// Create an object of the CustVendTransData class with the invoice transaction as parameter
custVendTransData = CustVendTransData::construct(invVendTrans);
// Mark it for settlement
custVendTransData.markForSettlement(vendTable);
// Create an object of the CustVendTransData class with the payment transaction as parameter
custVendTransData = CustVendTransData::construct(payVendTrans);
//mark it for settlement
custVendTransData.markForSettlement(vendTable);
ttscommit;
// Settle all marked transactions
if(VendTrans::settleTransact(vendTable, null, true,SettleDatePrinc::DaysDate, systemdateget()))
info("Transactions settled");
}
@Rahul Talasila
Here I'm sharing code for Settle Vendor Invoice/Payment through X++
Code:
-----------
static void VendorSettlement(Args _args)
{
VendTable vendTable;
VendTrans invVendTrans, payVendTrans;
SpecTransManager manager;
CustVendTransData custVendTransData;
;
vendTable = VendTable::find("12345");
// Find the oldest unsettled invoice
select firstonly invVendTrans order by TransDate asc
where invVendTrans.AccountNum == vendTable.AccountNum &&
invVendTrans.TransType == LedgerTransType::Purch &&
!invVendTrans.closed;
// Find the oldest unsettled payment
select firstonly payVendTrans order by TransDate asc
where payVendTrans.AccountNum == vendTable.AccountNum &&
payVendTrans.TransType == LedgerTransType::Payment &&
!payVendTrans.closed;
ttsbegin;
// Create an object of the CustVendTransData class with the invoice transaction as parameter
custVendTransData = CustVendTransData::construct(invVendTrans);
// Mark it for settlement
custVendTransData.markForSettlement(vendTable);
// Create an object of the CustVendTransData class with the payment transaction as parameter
custVendTransData = CustVendTransData::construct(payVendTrans);
//mark it for settlement
custVendTransData.markForSettlement(vendTable);
ttscommit;
// Settle all marked transactions
if(VendTrans::settleTransact(vendTable, null, true,SettleDatePrinc::DaysDate, systemdateget()))
info("Transactions settled");
}
@Rahul Talasila
The code runs but does not do the update, probably u left out this step
ReplyDeleteI have same problem code runs but can't mark settlement. Can you share me the missing setps
ReplyDeleteare you getting any error ?
DeleteHi Rahul,
DeleteI have a scenario where I mark the vendor open transactions via x++ and update amount to settle column. Then I post PO invoice via x++. Then I need to settle partial payment (value given in update settlement amount)against the posted invoice. The method you posted completely settles payment against invoice, where as I want to settle partial payment. Plz share the sample code.
Thanks
Anamika
Hi
ReplyDeleteis this code used with d365fo or just for ax 2012
This code should work for D365 as well
Delete정보이용료(콘텐츠이용료)는 소액결제 진행방법과는 다르게 휴대폰 사용자가 직접 어플을 본인읜 휴대폰에 다운받고, 콘텐츠를 구매하여 매입자에게 판매하는 방식인데, 어렵다고 생각 되어도 직접 해보시면 실제로 소액결제 현금화 보다 훨씬 간단하다고 느끼실 겁니다. 정보이용료 현금화
ReplyDelete