src-db/database/model/functions/C_INVOICE_POST.xml
changeset 35324 f56c59c75e26
parent 34953 03d8fd2a8cca
equal deleted inserted replaced
35323:7f68f19b9b80 35324:f56c59c75e26
   790             Description=COALESCE(TO_CHAR(Description), '') || ' (*R* -> ' || v_RDocumentNo || ')',
   790             Description=COALESCE(TO_CHAR(Description), '') || ' (*R* -> ' || v_RDocumentNo || ')',
   791             DocAction='--',
   791             DocAction='--',
   792             Processed='Y',
   792             Processed='Y',
   793             Updated=now()
   793             Updated=now()
   794         WHERE C_Invoice_ID=v_Record_ID;
   794         WHERE C_Invoice_ID=v_Record_ID;
       
   795         -- Update M_Inout isCompletelyInvoiced flag as No when voiding the invoice.
       
   796         UPDATE M_InOut
       
   797         SET iscompletelyinvoiced = 'N'
       
   798         WHERE iscompletelyinvoiced = 'Y'
       
   799           AND EXISTS (SELECT 1 FROM M_INOUTLINE l
       
   800                       LEFT JOIN c_invoiceline il ON l.m_inoutline_id = il.m_inoutline_id
       
   801                       WHERE il.c_invoice_id = v_Record_ID
       
   802                         AND l.M_InOut_ID = M_InOut.M_InOut_ID);
   795         -- Update reversal invoice dates
   803         -- Update reversal invoice dates
   796         IF (v_voiddate_inv IS NOT NULL) THEN
   804         IF (v_voiddate_inv IS NOT NULL) THEN
   797           UPDATE C_INVOICE SET DateInvoiced = v_voiddate_inv WHERE C_Invoice_ID=v_RInvoice_ID;
   805           UPDATE C_INVOICE SET DateInvoiced = v_voiddate_inv WHERE C_Invoice_ID=v_RInvoice_ID;
   798         END IF;
   806         END IF;
   799         IF (v_voiddate_acct IS NOT NULL) THEN
   807         IF (v_voiddate_acct IS NOT NULL) THEN