how to get the invoice number from vendtrans table

hi everyone, i’m currently doing a Manager’s Check Form[Report], and i need to get the invoice number of every marked transaction under settlement in the the payment journal of Account Payable module…i used to get the invoice number when the settled amount have withholding tax because it is the same invoice number with the taxwithholdtrans. however when the settled amount has no withholding tax i need to get the invoice number from the vendtrans table…

i dont know how to join the spectrans and vendtransopen to vendtrans and ledgerjournaltrans table.

i tried joining ledgerjournaltrans and vendtrans but i think it’s not enough to join the two table only.

I hope anyone could help me…thank you in advance…^.^

Hi,

Try this it will work…

static void VendTrans(Args _args)
{
spectrans s;
vendtransopen v;
;

while select v
join s
where v.dataAreaId == s.RefCompany
&& v.TableId == s.RefTableId
&& v.RecId == s.RefRecId
{
Info(VendTrans::find(v.RefRecId).Invoice);
}

}