今天一笔付款需要撤销,但是撤销的复选框是灰色的。
这笔付款对应一张预付款发票,一张标准发票。
因为预付款发票曾经做过核销,核销另外两笔标准发票,并且也撤销核销过,且没有创建会计科目。
所以在撤销付款的时候,是无法对这个进行撤销的。
下面SQL只要有记录,就无法撤销核销。
SELECT *
FROM ap_invoice_distributions_all aid_prepay,
ap_invoice_payments_all aip,
ap_invoices_all ai_prepay,
ap_invoice_distributions_all aid,
ap_invoice_distributions_all aidp
WHERE aip.check_id = 246319
AND aip.invoice_id = ai_prepay.invoice_id
AND ai_prepay.invoice_type_lookup_code = 'PREPAYMENT'
AND aid_prepay.invoice_id = ai_prepay.invoice_id
AND aid_prepay.invoice_distribution_id = aid.prepay_distribution_id
AND aid.invoice_id = aidp.invoice_id
AND aid.invoice_line_number = aidp.invoice_line_number
AND aid.parent_reversal_id = aidp.invoice_distribution_id
AND aid.prepay_distribution_id = aidp.prepay_distribution_id
AND aid.prepay_distribution_id IS NOT NULL
AND aid.parent_reversal_id IS NOT NULL
AND aid.amount > 0
AND nvl(aid.posted_flag, 'N') = 'N'
AND nvl(aidp.posted_flag, 'N') = 'Y';