Below class to update VendTrans Custom Field TestRefId from Sales Order Via PurchTable
Here you can get Join for VendTrans and VendInvoiceJour
class VendTransTestRefIdUpdate
{
public static void main(Args args)
{
VendTrans vendTrans;
VendInvoiceJour vendInvocieJour;
ttsbegin ;
while select forupdate vendTrans join PurchId from vendInvocieJour
where vendTrans.Voucher == vendInvocieJour.LedgerVoucher && vendTrans.AccountNum == vendInvocieJour.InvoiceAccount && vendTrans.TransDate == vendInvocieJour.InvoiceDate && vendTrans.TestRefId==0
{
InterCompanyPurchSalesReference interCompanyPurchSalesReference;
select firstonly interCompanyPurchSalesReference where interCompanyPurchSalesReference.PurchId == vendInvocieJour.PurchId;
SalesTable salesTable = SalesTable::find(interCompanyPurchSalesReference.SalesId);
if (vendTrans.TestRefId==0)
{
vendTrans.TestRefId= TestRefTable::find(salesTable.TestRefTable).RecId;
vendTrans.update();
}
}
ttscommit ;
}
Comments
Post a Comment