Payment Error - Payment Duplicate where invoice already paid
v7,v6
For a creditor payment in error where the payment is for an invoice that is already paid. update "Payment_Main" PM set PM."Status" = 11, "Err_Type" = 0 where exists (select * from "Payment_Items" PI join "Inw_Goods_Main" IGM on IGM."Ref_Number" = PI."Ing_Num" where PI."Pmt_Num" = PM."Ref_Number" and IGM."Pay_This_Run" = 0) and "Err_Type" > 0 and PM."Status" not in (11,9)