src-db/database/model/triggers/C_PROJECT_TRG.xml
changeset 1605 8a0fe0193bef
parent 1067 4a05c922c488
child 1929 ad0353d93b0f
equal deleted inserted replaced
1604:a1c518e6ed93 1605:8a0fe0193bef
    27     * Title: Project new record
    27     * Title: Project new record
    28     * Description:
    28     * Description:
    29     *  - create default accounts
    29     *  - create default accounts
    30     *  - create treenode
    30     *  - create treenode
    31     ************************************************************************/
    31     ************************************************************************/
    32     v_Tree_ID NUMBER;
    32     v_Tree_ID VARCHAR2(32);
    33   v_Parent_ID NUMBER;
    33   v_Parent_ID VARCHAR2(32);
    34   --
    34   --
    35   TYPE RECORD IS REF CURSOR;
    35   TYPE RECORD IS REF CURSOR;
    36     Cur_Defaults RECORD;
    36     Cur_Defaults RECORD;
    37 BEGIN
    37 BEGIN
    38   IF (INSERTING) THEN
    38   IF (INSERTING) THEN
    51     LOOP
    51     LOOP
    52       --  Account
    52       --  Account
    53       INSERT
    53       INSERT
    54       INTO C_Project_Acct
    54       INTO C_Project_Acct
    55         (
    55         (
    56           C_Project_ID, C_AcctSchema_ID, AD_Client_ID,
    56           C_Project_Acct_Id, C_Project_ID, C_AcctSchema_ID, AD_Client_ID,
    57           AD_Org_ID, IsActive, Created,
    57           AD_Org_ID, IsActive, Created,
    58           CreatedBy, Updated, UpdatedBy,
    58           CreatedBy, Updated, UpdatedBy,
    59           PJ_Asset_Acct, PJ_WIP_Acct
    59           PJ_Asset_Acct, PJ_WIP_Acct
    60         )
    60         )
    61         VALUES
    61         VALUES
    62         (
    62         (
    63           :new.C_Project_ID, Cur_Defaults.C_AcctSchema_ID, :new.AD_Client_ID,
    63           get_uuid(), :new.C_Project_ID, Cur_Defaults.C_AcctSchema_ID, :new.AD_Client_ID,
    64           :new.AD_ORG_ID,  'Y', now(),
    64           :new.AD_ORG_ID,  'Y', now(),
    65           :new.CreatedBy, now(), :new.UpdatedBy,
    65           :new.CreatedBy, now(), :new.UpdatedBy,
    66           Cur_Defaults.PJ_Asset_Acct, Cur_Defaults.PJ_WIP_Acct
    66           Cur_Defaults.PJ_Asset_Acct, Cur_Defaults.PJ_WIP_Acct
    67         )
    67         )
    68         ;
    68         ;
    81     --  DBMS_OUTPUT.PUT_LINE('Tree='||xTree_ID||'  Node='||:new.C_Project_ID||'  Parent='||xParent_ID);
    81     --  DBMS_OUTPUT.PUT_LINE('Tree='||xTree_ID||'  Node='||:new.C_Project_ID||'  Parent='||xParent_ID);
    82     --  Insert into TreeNode
    82     --  Insert into TreeNode
    83     INSERT
    83     INSERT
    84     INTO AD_TreeNode
    84     INTO AD_TreeNode
    85       (
    85       (
    86         AD_Client_ID, AD_Org_ID, IsActive,
    86         AD_TreeNode_ID, AD_Client_ID, AD_Org_ID, IsActive,
    87         Created, CreatedBy, Updated,
    87         Created, CreatedBy, Updated,
    88         UpdatedBy, AD_Tree_ID, Node_ID,
    88         UpdatedBy, AD_Tree_ID, Node_ID,
    89         Parent_ID, SeqNo
    89         Parent_ID, SeqNo
    90       )
    90       )
    91       VALUES
    91       VALUES
    92       (
    92       (
    93         :new.AD_Client_ID, :new.AD_Org_ID, :new.IsActive,
    93         get_uuid(), :new.AD_Client_ID, :new.AD_Org_ID, :new.IsActive,
    94         :new.Created, :new.CreatedBy, :new.Updated,
    94         :new.Created, :new.CreatedBy, :new.Updated,
    95         :new.UpdatedBy, v_Tree_ID, :new.C_Project_ID,
    95         :new.UpdatedBy, v_Tree_ID, :new.C_Project_ID,
    96         v_Parent_ID,(
    96         v_Parent_ID,(
    97         CASE :new.IsSummary
    97         CASE :new.IsSummary
    98           WHEN 'Y'
    98           WHEN 'Y'