/// <summary> /// Get Distribution for combination /// </summary> /// <param name="acct">account (ValidCombination)</param> /// <param name="PostingType">only posting type</param> /// <param name="C_DocType_ID">only document type</param> /// <returns>array of distributions</returns> public static MDistribution[] Get(MAccount acct, String PostingType, int C_DocType_ID) { return(Get(acct.GetCtx(), acct.GetC_AcctSchema_ID(), PostingType, C_DocType_ID, acct.GetAD_Org_ID(), acct.GetAccount_ID(), acct.GetM_Product_ID(), acct.GetC_BPartner_ID(), acct.GetC_Project_ID(), acct.GetC_Campaign_ID(), acct.GetC_Activity_ID(), acct.GetAD_OrgTrx_ID(), acct.GetC_SalesRegion_ID(), acct.GetC_LocTo_ID(), acct.GetC_LocFrom_ID(), acct.GetUser1_ID(), acct.GetUser2_ID())); } // get
/** Fill Accounting Dimensions from line combination **/ private void fillDimensionsFromCombination() { if (GetC_ValidCombination_ID() > 0) { MAccount combi = new MAccount(GetCtx(), GetC_ValidCombination_ID(), Get_TrxName()); if (Get_ColumnIndex("Account_ID") > 0) { Set_Value("Account_ID", combi.GetAccount_ID() > 0 ? combi.GetAccount_ID() : 0); } if (Get_ColumnIndex("C_SubAcct_ID") > 0) { Set_Value("C_SubAcct_ID", combi.GetC_SubAcct_ID() > 0 ? combi.GetC_SubAcct_ID() : 0); } if (Get_ColumnIndex("M_Product_ID") > 0) { Set_Value("M_Product_ID", combi.GetM_Product_ID() > 0 ? combi.GetM_Product_ID() : 0); } if (Get_ColumnIndex("C_BPartner_ID") > 0) { Set_Value("C_BPartner_ID", combi.GetC_BPartner_ID() > 0 ? combi.GetC_BPartner_ID() : 0); } if (Get_ColumnIndex("AD_OrgTrx_ID") > 0) { Set_Value("AD_OrgTrx_ID", combi.GetAD_OrgTrx_ID() > 0 ? combi.GetAD_OrgTrx_ID() : 0); } if (Get_ColumnIndex("AD_Org_ID") > 0) { Set_Value("AD_Org_ID", combi.GetAD_Org_ID() > 0 ? combi.GetAD_Org_ID() : 0); } if (Get_ColumnIndex("C_LocFrom_ID") > 0) { Set_Value("C_LocFrom_ID", combi.GetC_LocFrom_ID() > 0 ? combi.GetC_LocFrom_ID() : 0); } if (Get_ColumnIndex("C_LocTo_ID") > 0) { Set_Value("C_LocTo_ID", combi.GetC_LocTo_ID() > 0 ? combi.GetC_LocTo_ID() : 0); } if (Get_ColumnIndex("C_SalesRegion_ID") > 0) { Set_Value("C_SalesRegion_ID", combi.GetC_SalesRegion_ID() > 0 ? combi.GetC_SalesRegion_ID() : 0); } if (Get_ColumnIndex("C_Project_ID") > 0) { Set_Value("C_Project_ID", combi.GetC_Project_ID() > 0 ? combi.GetC_Project_ID() : 0); } if (Get_ColumnIndex("C_Campaign_ID") > 0) { Set_Value("C_Campaign_ID", combi.GetC_Campaign_ID() > 0 ? combi.GetC_Campaign_ID() : 0); } if (Get_ColumnIndex("C_Activity_ID") > 0) { Set_Value("C_Activity_ID", combi.GetC_Activity_ID() > 0 ? combi.GetC_Activity_ID() : 0); } if (Get_ColumnIndex("User1_ID") > 0) { Set_Value("User1_ID", combi.GetUser1_ID() > 0 ? combi.GetUser1_ID() : 0); } if (Get_ColumnIndex("User2_ID") > 0) { Set_Value("User2_ID", combi.GetUser2_ID() > 0 ? combi.GetUser2_ID() : 0); } } }
} // setAccount /// <summary> /// Get Account Combination based on Account and Overwrite /// </summary> /// <returns>account</returns> public MAccount GetAccount() { MAccount acct = MAccount.Get(GetCtx(), _account.GetAD_Client_ID(), IsOverwriteOrg() && GetOrg_ID() != 0 ? GetOrg_ID() : _account.GetAD_Org_ID(), _account.GetC_AcctSchema_ID(), IsOverwriteAcct() && GetAccount_ID() != 0 ? GetAccount_ID() : _account.GetAccount_ID(), _account.GetC_SubAcct_ID(), // IsOverwriteProduct() ? GetM_Product_ID() : _account.GetM_Product_ID(), IsOverwriteBPartner() ? GetC_BPartner_ID() : _account.GetC_BPartner_ID(), IsOverwriteOrgTrx() ? GetAD_OrgTrx_ID() : _account.GetAD_OrgTrx_ID(), IsOverwriteLocFrom() ? GetC_LocFrom_ID() : _account.GetC_LocFrom_ID(), IsOverwriteLocTo() ? GetC_LocTo_ID() : _account.GetC_LocTo_ID(), IsOverwriteSalesRegion() ? GetC_SalesRegion_ID() : _account.GetC_SalesRegion_ID(), IsOverwriteProject() ? GetC_Project_ID() : _account.GetC_Project_ID(), IsOverwriteCampaign() ? GetC_Campaign_ID() : _account.GetC_Campaign_ID(), IsOverwriteActivity() ? GetC_Activity_ID() : _account.GetC_Activity_ID(), IsOverwriteUser1() ? GetUser1_ID() : _account.GetUser1_ID(), IsOverwriteUser2() ? GetUser2_ID() : _account.GetUser2_ID(), _account.GetUserElement1_ID(), _account.GetUserElement2_ID()); return(acct); } // setAccount
/** Fill Accounting Dimensions from line combination **/ private void fillDimensionsFromCombination() { if (GetC_ValidCombination_ID() > 0) { MAccount combi = new MAccount(GetCtx(), GetC_ValidCombination_ID(), Get_TrxName()); if (Get_ColumnIndex("Account_ID") > 0) { Set_Value("Account_ID", combi.GetAccount_ID() > 0 ? combi.GetAccount_ID() : 0); } if (Get_ColumnIndex("C_SubAcct_ID") > 0) { Set_Value("C_SubAcct_ID", combi.GetC_SubAcct_ID() > 0 ? combi.GetC_SubAcct_ID() : 0); } // setting null in business partner and product search control because if set 0 then it shows <0> in controls.-Mohit-11 May 2020 if (Get_ColumnIndex("M_Product_ID") > 0) { if (combi.GetM_Product_ID() > 0) { Set_Value("M_Product_ID", combi.GetM_Product_ID()); } } if (Get_ColumnIndex("C_BPartner_ID") > 0) { if (combi.GetC_BPartner_ID() > 0) { Set_Value("C_BPartner_ID", combi.GetC_BPartner_ID()); } } if (Get_ColumnIndex("AD_OrgTrx_ID") > 0) { Set_Value("AD_OrgTrx_ID", combi.GetAD_OrgTrx_ID() > 0 ? combi.GetAD_OrgTrx_ID() : 0); } if (Get_ColumnIndex("AD_Org_ID") > 0) { Set_Value("AD_Org_ID", combi.GetAD_Org_ID() > 0 ? combi.GetAD_Org_ID() : 0); } if (Get_ColumnIndex("C_LocFrom_ID") > 0) { Set_Value("C_LocFrom_ID", combi.GetC_LocFrom_ID() > 0 ? combi.GetC_LocFrom_ID() : 0); } if (Get_ColumnIndex("C_LocTo_ID") > 0) { Set_Value("C_LocTo_ID", combi.GetC_LocTo_ID() > 0 ? combi.GetC_LocTo_ID() : 0); } if (Get_ColumnIndex("C_SalesRegion_ID") > 0) { Set_Value("C_SalesRegion_ID", combi.GetC_SalesRegion_ID() > 0 ? combi.GetC_SalesRegion_ID() : 0); } if (Get_ColumnIndex("C_Project_ID") > 0) { Set_Value("C_Project_ID", combi.GetC_Project_ID() > 0 ? combi.GetC_Project_ID() : 0); } if (Get_ColumnIndex("C_Campaign_ID") > 0) { Set_Value("C_Campaign_ID", combi.GetC_Campaign_ID() > 0 ? combi.GetC_Campaign_ID() : 0); } if (Get_ColumnIndex("C_Activity_ID") > 0) { Set_Value("C_Activity_ID", combi.GetC_Activity_ID() > 0 ? combi.GetC_Activity_ID() : 0); } if (Get_ColumnIndex("User1_ID") > 0) { Set_Value("User1_ID", combi.GetUser1_ID() > 0 ? combi.GetUser1_ID() : 0); } if (Get_ColumnIndex("User2_ID") > 0) { Set_Value("User2_ID", combi.GetUser2_ID() > 0 ? combi.GetUser2_ID() : 0); } } }