src-db/database/model/functions/C_INVOICE_ACCTGEN.xml
changeset 799 fef2c5e2feb7
parent 798 4994e5a604bb
child 800 1ad8094b366f
--- a/src-db/database/model/functions/C_INVOICE_ACCTGEN.xml	Wed Apr 30 10:48:47 2008 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,150 +0,0 @@
-<?xml version="1.0"?>
-  <database name="FUNCTION C_INVOICE_ACCTGEN">
-    <function name="C_INVOICE_ACCTGEN" type="NULL">
-      <parameter name="p_pinstance_id" type="NUMERIC" mode="in">
-        <default/>
-      </parameter>
-      <parameter name="p_invoice_id" type="NUMERIC" mode="in">
-        <default><![CDATA[NULL]]></default>
-      </parameter>
-      <body><![CDATA[/*************************************************************************
-  * The contents of this file are subject to the Compiere Public
-  * License 1.1 ("License"); You may not use this file except in
-  * compliance with the License. You may obtain a copy of the License in
-  * the legal folder of your Openbravo installation.
-  * Software distributed under the License is distributed on an
-  * "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
-  * implied. See the License for the specific language governing rights
-  * and limitations under the License.
-  * The Original Code is  Compiere  ERP &  Business Solution
-  * The Initial Developer of the Original Code is Jorg Janke and ComPiere, Inc.
-  * Portions created by Jorg Janke are Copyright (C) 1999-2001 Jorg Janke,
-  * parts created by ComPiere are Copyright (C) ComPiere, Inc.;
-  * All Rights Reserved.
-  * Contributor(s): Openbravo SL
-  * Contributions are Copyright (C) 2001-2008 Openbravo, S.L.
-  *
-  * Specifically, this derivative work is based upon the following Compiere
-  * file and version.
-  *************************************************************************
-  * Create Account postings for Invoices
-  */
-  -- Logistice
-  v_ResultStr VARCHAR2(2000):='';
-  v_Message VARCHAR2(2000):='';
-  v_Record_ID NUMBER;
-  -- Parameter
-  TYPE RECORD IS REF CURSOR;
-    Cur_Parameter RECORD;
-    --
-    Cur_AcctSchema RECORD;
-    Cur_Invoice RECORD;
-    /* CURSOR Cur_InvoiceLine (ID NUMBER) IS
-    SELECT *
-    FROM C_InvoiceLine
-    WHERE C_Invoice_ID = ID;
-    CURSOR Cur_InvoiceTax (ID NUMBER) IS
-    SELECT *
-    FROM C_InvoiceTax
-    WHERE C_Invoice_ID = ID;*/
-  BEGIN
-    IF(p_PInstance_ID IS NOT NULL) THEN
-      --  Update AD_PInstance
-      DBMS_OUTPUT.PUT_LINE('Updating PInstance - Processing ' || p_PInstance_ID) ;
-      v_ResultStr:='PInstanceNotFound';
-      AD_UPDATE_PINSTANCE(p_PInstance_ID, NULL, 'Y', NULL, NULL) ;
-      -- Get Parameters
-      v_ResultStr:='ReadingParameters';
-      FOR Cur_Parameter IN
-        (SELECT i.Record_ID,
-          p.ParameterName,
-          p.P_String,
-          p.P_Number,
-          p.P_Date
-        FROM AD_PInstance i
-        LEFT JOIN AD_PInstance_Para p
-          ON i.AD_PInstance_ID=p.AD_PInstance_ID
-        WHERE i.AD_PInstance_ID=p_PInstance_ID
-        ORDER BY p.SeqNo
-        )
-      LOOP
-        v_Record_ID:=Cur_Parameter.Record_ID;
-      END LOOP; -- Get Parameter
-    ELSE
-      v_Record_ID:=p_Invoice_ID;
-    END IF;
-    DBMS_OUTPUT.PUT_LINE('  Record_ID=' || v_Record_ID) ;
-  BEGIN --BODY
-    -- Process all invoices
-    FOR Cur_Invoice IN
-      (SELECT *
-      FROM C_Invoice
-      WHERE IsTransferred='N'
-        AND(v_Record_ID IS NULL
-        OR C_Invoice_ID=v_Record_ID) FOR UPDATE
-      )
-    LOOP
-      -- for all accounting schema
-      FOR Cur_AcctSchema IN
-        (SELECT *
-        FROM C_AcctSchema
-        WHERE C_AcctSchema_ID=
-          (SELECT C_AcctSchema1_ID
-          FROM AD_ClientInfo
-          WHERE AD_Client_ID=Cur_Invoice.AD_Client_ID
-          )
-          OR C_AcctSchema_ID=
-          (SELECT C_AcctSchema2_ID
-          FROM AD_ClientInfo
-          WHERE Acct2_Active='Y'
-            AND AD_Client_ID=Cur_Invoice.AD_Client_ID
-          )
-          OR C_AcctSchema_ID=
-          (SELECT C_AcctSchema3_ID
-          FROM AD_ClientInfo
-          WHERE Acct3_Active='Y'
-            AND AD_Client_ID=Cur_Invoice.AD_Client_ID
-          )
-        )
-      LOOP
-        NULL;
-      END LOOP; -- For all accounting schema
-    END LOOP; -- Process all invoices
-    --<<FINISH_PROCESS>>
-    IF(p_PInstance_ID IS NOT NULL) THEN
-      --  Update AD_PInstance
-      DBMS_OUTPUT.PUT_LINE('Updating PInstance - Finished ' || v_Message) ;
-      AD_UPDATE_PINSTANCE(p_PInstance_ID, NULL, 'N', 1, v_Message) ;
-    END IF;
-    RETURN;
-  END; --BODY
-EXCEPTION
-WHEN OTHERS THEN
-  v_ResultStr:= '@ERROR=' || SQLERRM;
-  DBMS_OUTPUT.PUT_LINE(v_ResultStr) ;
-  ROLLBACK;
-  IF(p_PInstance_ID IS NOT NULL) THEN
-    AD_UPDATE_PINSTANCE(p_PInstance_ID, NULL, 'N', 0, v_ResultStr) ;
-  ELSE
-    DECLARE
-      v_Code NUMBER:=SQLCODE;
-    BEGIN
-      INSERT
-      INTO DBA_ErrorLog
-        (
-          DBA_ErrorLog_ID, Created, Code,
-          Msg, Info
-        )
-        VALUES
-        (
-          DBA_ErrorLog_Seq.NextVal, now(), v_Code,
-          v_ResultStr, 'C_Invoice_Acct'
-        )
-        ;
-    END;
-  END IF;
-  RETURN;
-END C_INVOICE_ACCTGEN
-]]></body>
-    </function>
-  </database>