Esempio 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);
        }
Esempio n. 2
0
        /// <summary>
        /// Create PO for Vendor
        /// </summary>
        /// <param name="C_BPartner_ID">vendor</param>
        /// <param name="so">sales order</param>
        /// <returns>MOrder</returns>
        public MOrder CreatePOForVendor(int C_BPartner_ID, MOrder so)
        {
            MOrder po = new MOrder(GetCtx(), 0, Get_TrxName());

            po.SetClientOrg(so.GetAD_Client_ID(), so.GetAD_Org_ID());
            po.SetRef_Order_ID(so.GetC_Order_ID());
            po.SetIsSOTrx(false);
            po.SetC_DocTypeTarget_ID();
            //
            po.SetDescription(so.GetDescription());
            po.SetPOReference(so.GetDocumentNo());
            po.SetPriorityRule(so.GetPriorityRule());
            po.SetSalesRep_ID(so.GetSalesRep_ID());
            po.SetM_Warehouse_ID(so.GetM_Warehouse_ID());
            //	Set Vendor
            MBPartner vendor = new MBPartner(GetCtx(), C_BPartner_ID, Get_TrxName());

            po.SetBPartner(vendor);
            //	Drop Ship
            po.SetIsDropShip(so.IsDropShip());
            if (so.IsDropShip())
            {
                po.SetShip_BPartner_ID(so.GetC_BPartner_ID());
                po.SetShip_Location_ID(so.GetC_BPartner_Location_ID());
                po.SetShip_User_ID(so.GetAD_User_ID());
            }
            //	References
            po.SetC_Activity_ID(so.GetC_Activity_ID());
            po.SetC_Campaign_ID(so.GetC_Campaign_ID());
            po.SetC_Project_ID(so.GetC_Project_ID());
            po.SetUser1_ID(so.GetUser1_ID());
            po.SetUser2_ID(so.GetUser2_ID());
            //
            po.Save();
            return(po);
        }
Esempio n. 3
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);
        }
Esempio n. 4
0
        public JsonResult GetOrder(string param)
        {
            string retError = "";
            string retJSON  = "";

            if (Session["ctx"] != null)
            {
                VAdvantage.Utility.Ctx ctx = Session["ctx"] as Ctx;
                string[] paramValue        = param.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);


                Dictionary <String, String> retDic = new Dictionary <string, string>();
                // Reset Orig Shipment



                retDic["C_BParter_ID"]           = order.GetC_BPartner_ID().ToString();
                retDic["C_BPartner_Location_ID"] = order.GetC_BPartner_Location_ID().ToString();
                retDic["Bill_BPartner_ID"]       = order.GetBill_BPartner_ID().ToString();
                retDic["Bill_Location_ID"]       = order.GetBill_Location_ID().ToString();

                if (order.GetAD_User_ID() != 0)
                {
                    retDic["AD_User_ID"] = order.GetAD_User_ID().ToString();
                }

                if (order.GetBill_User_ID() != 0)
                {
                    retDic["Bill_User_ID"] = order.GetBill_User_ID().ToString();
                }

                //if (ctx.IsSOTrx(WindowNo))
                //  retDic["M_ReturnPolicy_ID"]= bpartner.getM_ReturnPolicy_ID();
                //else
                //   retDic["M_ReturnPolicy_ID"]= bpartner.getPO_ReturnPolicy_ID();

                //retDic["DateOrdered", order.GetDateOrdered());
                retDic["M_PriceList_ID"]   = order.GetM_PriceList_ID().ToString();
                retDic["PaymentRule"]      = order.GetPaymentRule();
                retDic["C_PaymentTerm_ID"] = order.GetC_PaymentTerm_ID().ToString();
                //mTab.setValue ("DeliveryRule", X_C_Order.DELIVERYRULE_Manual);

                retDic["Bill_Location_ID"] = order.GetBill_Location_ID().ToString();
                retDic["InvoiceRule"]      = order.GetInvoiceRule();
                retDic["PaymentRule"]      = order.GetPaymentRule();
                retDic["DeliveryViaRule"]  = order.GetDeliveryViaRule();
                retDic["FreightCostRule"]  = order.GetFreightCostRule();
                //retlst.Add(retValue);

                //retVal.Add(notReserved);


                retJSON = JsonConvert.SerializeObject(retDic);
            }
            else
            {
                retError = "Session Expired";
            }
            return(Json(new { result = retJSON, error = retError }, JsonRequestBehavior.AllowGet));
        }