Ejemplo n.º 1
0
        /// <summary>
        /// GetOrder
        /// </summary>
        /// <param name="ctx"></param>
        /// <param name="fields"></param>
        /// <returns></returns>
        public Dictionary <String, String> GetOrder(Ctx ctx, string fields)
        {
            string[] paramValue = fields.ToString().Split(',');
            int      C_Order_ID;

            //Assign parameter value
            C_Order_ID = Util.GetValueOfInt(paramValue[0].ToString());
            MOrder order = new MOrder(ctx, C_Order_ID, null);
            // End Assign parameter value

            Dictionary <String, String> retDic = new Dictionary <string, string>();

            // Reset Orig Shipment
            retDic["C_BPartner_ID"]          = Util.GetValueOfString(order.GetC_BPartner_ID());
            retDic["C_BPartner_Location_ID"] = Util.GetValueOfString(order.GetC_BPartner_Location_ID());
            retDic["Bill_BPartner_ID"]       = Util.GetValueOfString(order.GetBill_BPartner_ID());
            retDic["Bill_Location_ID"]       = Util.GetValueOfString(order.GetBill_Location_ID());
            if (order.GetAD_User_ID() != 0)
            {
                retDic["AD_User_ID"] = Util.GetValueOfString(order.GetAD_User_ID());
            }
            if (order.GetBill_User_ID() != 0)
            {
                retDic["Bill_User_ID"] = Util.GetValueOfString(order.GetBill_User_ID());
            }
            retDic["M_PriceList_ID"]   = Util.GetValueOfString(order.GetM_PriceList_ID());
            retDic["PaymentRule"]      = order.GetPaymentRule();
            retDic["C_PaymentTerm_ID"] = Util.GetValueOfString(order.GetC_PaymentTerm_ID());
            //mTab.setValue ("DeliveryRule", X_C_Order.DELIVERYRULE_Manual);
            retDic["Bill_Location_ID"] = Util.GetValueOfString(order.GetBill_Location_ID());
            retDic["InvoiceRule"]      = order.GetInvoiceRule();
            retDic["PaymentRule"]      = order.GetPaymentRule();
            retDic["DeliveryViaRule"]  = order.GetDeliveryViaRule();
            retDic["FreightCostRule"]  = order.GetFreightCostRule();
            retDic["ID"]              = Util.GetValueOfString(order.Get_ID());
            retDic["DateOrdered"]     = Util.GetValueOfString(order.GetDateOrdered());
            retDic["POReference"]     = order.GetPOReference();
            retDic["AD_Org_ID"]       = Util.GetValueOfString(order.GetAD_Org_ID());
            retDic["DeliveryRule"]    = order.GetDeliveryRule();
            retDic["DeliveryViaRule"] = order.GetDeliveryViaRule();
            retDic["M_Shipper_ID"]    = Util.GetValueOfString(order.GetM_Shipper_ID());
            retDic["FreightAmt"]      = Util.GetValueOfString(order.GetFreightAmt());
            retDic["AD_OrgTrx_ID"]    = Util.GetValueOfString(order.GetAD_OrgTrx_ID());
            retDic["C_Activity_ID"]   = Util.GetValueOfString(order.GetC_Activity_ID());
            retDic["C_Campaign_ID"]   = Util.GetValueOfString(order.GetC_Campaign_ID());
            retDic["C_Project_ID"]    = Util.GetValueOfString(order.GetC_Project_ID());
            retDic["User1_ID"]        = Util.GetValueOfString(order.GetUser1_ID());
            retDic["User2_ID"]        = Util.GetValueOfString(order.GetUser2_ID());
            retDic["M_Warehouse_ID"]  = Util.GetValueOfString(order.GetM_Warehouse_ID());
            retDic["Orig_Order_ID"]   = Util.GetValueOfString(order.GetOrig_Order_ID());
            retDic["Orig_InOut_ID"]   = Util.GetValueOfString(order.GetOrig_InOut_ID());
            return(retDic);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// GetOrder
        /// </summary>
        /// <param name="ctx"></param>
        /// <param name="fields"></param>
        /// <returns></returns>
        public Dictionary <String, object> GetOrder(Ctx ctx, string fields)
        {
            string[] paramValue = fields.ToString().Split(',');
            int      C_Order_ID;

            //Assign parameter value
            C_Order_ID = Util.GetValueOfInt(paramValue[0].ToString());
            MOrder order = new MOrder(ctx, C_Order_ID, null);
            // End Assign parameter value

            Dictionary <String, object> retDic = new Dictionary <string, object>();

            // Reset Orig Shipment
            retDic["C_BPartner_ID"]          = Util.GetValueOfString(order.GetC_BPartner_ID());
            retDic["C_BPartner_Location_ID"] = Util.GetValueOfString(order.GetC_BPartner_Location_ID());
            retDic["Bill_BPartner_ID"]       = Util.GetValueOfString(order.GetBill_BPartner_ID());
            retDic["Bill_Location_ID"]       = Util.GetValueOfString(order.GetBill_Location_ID());
            if (order.GetAD_User_ID() != 0)
            {
                retDic["AD_User_ID"] = Util.GetValueOfString(order.GetAD_User_ID());
            }
            if (order.GetBill_User_ID() != 0)
            {
                retDic["Bill_User_ID"] = Util.GetValueOfString(order.GetBill_User_ID());
            }
            retDic["M_PriceList_ID"]   = Util.GetValueOfString(order.GetM_PriceList_ID());
            retDic["PaymentRule"]      = order.GetPaymentRule();
            retDic["C_PaymentTerm_ID"] = Util.GetValueOfString(order.GetC_PaymentTerm_ID());
            //mTab.setValue ("DeliveryRule", X_C_Order.DELIVERYRULE_Manual);
            retDic["Bill_Location_ID"] = Util.GetValueOfString(order.GetBill_Location_ID());
            retDic["InvoiceRule"]      = order.GetInvoiceRule();
            retDic["PaymentRule"]      = order.GetPaymentRule();
            retDic["DeliveryViaRule"]  = order.GetDeliveryViaRule();
            retDic["FreightCostRule"]  = order.GetFreightCostRule();
            retDic["ID"] = Util.GetValueOfString(order.Get_ID());
            //retDic["DateOrdered"] = Convert.ToDateTime(order.GetDateOrdered()).ToLocalTime().ToUniversalTime();
            retDic["DateOrdered"]     = DateTime.SpecifyKind(order.GetDateOrdered().Value, DateTimeKind.Utc);
            retDic["DateAcct"]        = Util.GetValueOfString(order.GetDateAcct());
            retDic["POReference"]     = order.GetPOReference();
            retDic["AD_Org_ID"]       = Util.GetValueOfString(order.GetAD_Org_ID());
            retDic["DeliveryRule"]    = order.GetDeliveryRule();
            retDic["DeliveryViaRule"] = order.GetDeliveryViaRule();
            retDic["M_Shipper_ID"]    = Util.GetValueOfString(order.GetM_Shipper_ID());
            retDic["FreightAmt"]      = Util.GetValueOfString(order.GetFreightAmt());
            retDic["AD_OrgTrx_ID"]    = Util.GetValueOfString(order.GetAD_OrgTrx_ID());
            retDic["C_Activity_ID"]   = Util.GetValueOfString(order.GetC_Activity_ID());
            retDic["C_Campaign_ID"]   = Util.GetValueOfString(order.GetC_Campaign_ID());
            retDic["C_Project_ID"]    = Util.GetValueOfString(order.GetC_Project_ID());
            retDic["User1_ID"]        = Util.GetValueOfString(order.GetUser1_ID());
            retDic["User2_ID"]        = Util.GetValueOfString(order.GetUser2_ID());
            retDic["M_Warehouse_ID"]  = Util.GetValueOfString(order.GetM_Warehouse_ID());
            retDic["Orig_Order_ID"]   = Util.GetValueOfString(order.GetOrig_Order_ID());
            retDic["Orig_InOut_ID"]   = Util.GetValueOfString(order.GetOrig_InOut_ID());
            //Added By Amit
            retDic["IsSOTrx"]                = Util.GetValueOfString(order.IsSOTrx());
            retDic["IsReturnTrx"]            = Util.GetValueOfString(order.IsReturnTrx());
            retDic["C_Payment_ID"]           = Util.GetValueOfString(order.GetPaymentMethod());
            retDic["VA009_PaymentMethod_ID"] = Util.GetValueOfString(order.GetVA009_PaymentMethod_ID());
            retDic["SalesRep_ID"]            = Util.GetValueOfString(order.GetSalesRep_ID());
            retDic["C_ProjectRef_ID"]        = Util.GetValueOfString(order.GetC_ProjectRef_ID());
            retDic["PriorityRule"]           = Util.GetValueOfString(order.GetPriorityRule());


            if (order.GetC_Currency_ID() != 0)
            {
                retDic["C_Currency_ID"] = Util.GetValueOfString(order.GetC_Currency_ID());
            }
            else
            {
                retDic["C_Currency_ID"] = "0";
            }
            //End
            // added by vivek on 09/10/2017 advised by pradeep to set drop ship checkbox value
            retDic["IsDropShip"] = Util.GetValueOfBool(order.IsDropShip()) ? "Y" : "N";

            // Added by Bharat on 30 Jan 2018 to set Inco Term from Order

            if (order.Get_ColumnIndex("C_IncoTerm_ID") > 0)
            {
                retDic["C_IncoTerm_ID"] = Util.GetValueOfString(order.GetC_IncoTerm_ID());
            }

            if (Env.IsModuleInstalled("VA077_"))
            {
                retDic["VA077_HistoricContractDate"]   = Util.GetValueOfString(order.Get_Value("VA077_HistoricContractDate"));
                retDic["VA077_ChangeStartDate"]        = Util.GetValueOfString(order.Get_Value("VA077_ChangeStartDate"));
                retDic["VA077_ContractCPStartDate"]    = Util.GetValueOfString(order.Get_Value("VA077_ContractCPStartDate"));
                retDic["VA077_ContractCPEndDate"]      = Util.GetValueOfString(order.Get_Value("VA077_ContractCPEndDate"));
                retDic["VA077_PartialAmtCatchUp"]      = Util.GetValueOfString(order.Get_Value("VA077_PartialAmtCatchUp"));
                retDic["VA077_OldAnnualContractTotal"] = Util.GetValueOfString(order.Get_Value("VA077_OldAnnualContractTotal"));
                retDic["VA077_AdditionalAnnualCharge"] = Util.GetValueOfString(order.Get_Value("VA077_AdditionalAnnualCharge"));
                retDic["VA077_NewAnnualContractTotal"] = Util.GetValueOfString(order.Get_Value("VA077_NewAnnualContractTotal"));
                retDic["VA077_SalesCoWorker"]          = Util.GetValueOfString(order.Get_Value("VA077_SalesCoWorker"));
                retDic["VA077_SalesCoWorkerPer"]       = Util.GetValueOfString(order.Get_Value("VA077_SalesCoWorkerPer"));
                retDic["VA077_TotalMarginAmt"]         = Util.GetValueOfString(order.Get_Value("VA077_TotalMarginAmt"));
                retDic["VA077_TotalPurchaseAmt"]       = Util.GetValueOfString(order.Get_Value("VA077_TotalPurchaseAmt"));
                retDic["VA077_TotalSalesAmt"]          = Util.GetValueOfString(order.Get_Value("VA077_TotalSalesAmt"));
                retDic["VA077_MarginPercent"]          = Util.GetValueOfString(order.Get_Value("VA077_MarginPercent"));
            }

            return(retDic);
        }