A quick function that will allow you to verify if a specific vendor has any pending transaction(s).
Function vendor_pnding_transactions();
&VENDOR = VENDOR_ID;
SQLExec("select 'X' from ps_voucher a, ps_pymnt_vchr_xref b where a.voucher_id = b.voucher_id and a.business_unit = b.business_unit and a.vendor_id = :1 and a.entry_status in ('P', 'R')and a.close_status = 'O' and b.pymnt_selct_status in ('N', 'D', 'R')", &VENDOR, &EXISTS);
If All(&EXISTS) Then
Error Messagebox(0,"",0,0,("Vendor has pending transaction(s).");
End-If;
End-Function;
&VENDOR = VENDOR_ID;
SQLExec("select 'X' from ps_voucher a, ps_pymnt_vchr_xref b where a.voucher_id = b.voucher_id and a.business_unit = b.business_unit and a.vendor_id = :1 and a.entry_status in ('P', 'R')and a.close_status = 'O' and b.pymnt_selct_status in ('N', 'D', 'R')", &VENDOR, &EXISTS);
If All(&EXISTS) Then
Error Messagebox(0,"",0,0,("Vendor has pending transaction(s).");
End-If;
End-Function;
pymnt_selct_status:
D: Negative Voucher Sum
N: Not Selected for Payment
R: Requested for Payment