src-db/database/model/functions/C_COMMISSION_COPY.xml
changeset 1605 8a0fe0193bef
parent 785 8dba91261590
child 6701 690d2af86089
equal deleted inserted replaced
1604:a1c518e6ed93 1605:8a0fe0193bef
     1 <?xml version="1.0"?>
     1 <?xml version="1.0"?>
     2   <database name="FUNCTION C_COMMISSION_COPY">
     2   <database name="FUNCTION C_COMMISSION_COPY">
     3     <function name="C_COMMISSION_COPY" type="NULL">
     3     <function name="C_COMMISSION_COPY" type="NULL">
     4       <parameter name="p_pinstance_id" type="NUMERIC" mode="in">
     4       <parameter name="p_pinstance_id" type="VARCHAR" mode="in">
     5         <default/>
     5         <default/>
     6       </parameter>
     6       </parameter>
     7       <body><![CDATA[/*************************************************************************
     7       <body><![CDATA[/*************************************************************************
     8   * The contents of this file are subject to the Compiere Public
     8   * The contents of this file are subject to the Compiere Public
     9   * License 1.1 ("License"); You may not use this file except in
     9   * License 1.1 ("License"); You may not use this file except in
    30   * Description:
    30   * Description:
    31   ************************************************************************/
    31   ************************************************************************/
    32   -- Logistice
    32   -- Logistice
    33   v_ResultStr VARCHAR2(2000):='';
    33   v_ResultStr VARCHAR2(2000):='';
    34   v_Message VARCHAR2(2000):='';
    34   v_Message VARCHAR2(2000):='';
    35   v_Record_ID NUMBER;
    35   v_Record_ID VARCHAR2(32);
    36   -- Parameter
    36   -- Parameter
    37   TYPE RECORD IS REF CURSOR;
    37   TYPE RECORD IS REF CURSOR;
    38     Cur_Parameter RECORD;
    38     Cur_Parameter RECORD;
    39     -- Parameter Variables
    39     -- Parameter Variables
    40     p_C_Commission_ID NUMBER;
    40     p_C_Commission_ID VARCHAR2(32);
    41   BEGIN
    41   BEGIN
    42     --  Update AD_PInstance
    42     --  Update AD_PInstance
    43     DBMS_OUTPUT.PUT_LINE('Updating PInstance - Processing ' || p_PInstance_ID) ;
    43     DBMS_OUTPUT.PUT_LINE('Updating PInstance - Processing ' || p_PInstance_ID) ;
    44     v_ResultStr:='PInstanceNotFound';
    44     v_ResultStr:='PInstanceNotFound';
    45     AD_UPDATE_PINSTANCE(p_PInstance_ID, NULL, 'Y', NULL, NULL) ;
    45     AD_UPDATE_PINSTANCE(p_PInstance_ID, NULL, 'Y', NULL, NULL) ;
    59       ORDER BY p.SeqNo
    59       ORDER BY p.SeqNo
    60       )
    60       )
    61     LOOP
    61     LOOP
    62       v_Record_ID:=Cur_Parameter.Record_ID;
    62       v_Record_ID:=Cur_Parameter.Record_ID;
    63       IF(Cur_Parameter.ParameterName='C_Commission_ID') THEN
    63       IF(Cur_Parameter.ParameterName='C_Commission_ID') THEN
    64         p_C_Commission_ID:=Cur_Parameter.P_Number;
    64         p_C_Commission_ID:=Cur_Parameter.P_String;
    65         DBMS_OUTPUT.PUT_LINE('  C_Commission_ID=' || p_C_Commission_ID) ;
    65         DBMS_OUTPUT.PUT_LINE('  C_Commission_ID=' || p_C_Commission_ID) ;
    66       ELSE
    66       ELSE
    67         DBMS_OUTPUT.PUT_LINE('*** Unknown Parameter=' || Cur_Parameter.ParameterName) ;
    67         DBMS_OUTPUT.PUT_LINE('*** Unknown Parameter=' || Cur_Parameter.ParameterName) ;
    68       END IF;
    68       END IF;
    69     END LOOP; -- Get Parameter
    69     END LOOP; -- Get Parameter
    70     DBMS_OUTPUT.PUT_LINE('  Record_ID=' || v_Record_ID) ;
    70     DBMS_OUTPUT.PUT_LINE('  Record_ID=' || v_Record_ID) ;
    71     -- Copy Lines from p_C_Commission_ID to Record_ID
    71     -- Copy Lines from p_C_Commission_ID to Record_ID
    72     DECLARE
    72     DECLARE
    73       CUR_Commission RECORD;
    73       CUR_Commission RECORD;
    74       v_NextNo NUMBER;
    74       v_NextNo VARCHAR2(32);
    75     BEGIN
    75     BEGIN
    76       FOR CUR_Commission IN
    76       FOR CUR_Commission IN
    77         (SELECT *
    77         (SELECT *
    78         FROM C_CommissionLine
    78         FROM C_CommissionLine
    79         WHERE C_Commission_ID=p_C_Commission_ID
    79         WHERE C_Commission_ID=p_C_Commission_ID
   102           VALUES
   102           VALUES
   103           (
   103           (
   104             v_NextNo, v_Record_ID,
   104             v_NextNo, v_Record_ID,
   105             CUR_Commission.AD_Client_ID, CUR_Commission.AD_Org_ID,
   105             CUR_Commission.AD_Client_ID, CUR_Commission.AD_Org_ID,
   106              'Y', now(),
   106              'Y', now(),
   107             0, now(),
   107             '0', now(),
   108             0, CUR_Commission.Line,
   108             '0', CUR_Commission.Line,
   109             CUR_Commission.Description, CUR_Commission.AmtSubtract,
   109             CUR_Commission.Description, CUR_Commission.AmtSubtract,
   110             CUR_Commission.AmtMultiplier, CUR_Commission.QtySubtract,
   110             CUR_Commission.AmtMultiplier, CUR_Commission.QtySubtract,
   111             CUR_Commission.QtyMultiplier, CUR_Commission.IsPositiveOnly,
   111             CUR_Commission.QtyMultiplier, CUR_Commission.IsPositiveOnly,
   112             CUR_Commission.M_Product_Category_ID, CUR_Commission.M_Product_ID,
   112             CUR_Commission.M_Product_Category_ID, CUR_Commission.M_Product_ID,
   113             CUR_Commission.C_BP_Group_ID, CUR_Commission.C_BPartner_ID,
   113             CUR_Commission.C_BP_Group_ID, CUR_Commission.C_BPartner_ID,