public bool SetProductQty1(int recordID, string keyColName, List <string> product, List <string> attribute, List <string> qty, List <string> oline_ID, List <string> locID, int LocToID, List <string> AssetID, int lineID, VAdvantage.Utility.Ctx ctx) { if (keyColName.ToUpper().Trim() == "M_MOVEMENT_ID") { MMovement inv = new MMovement(ctx, recordID, null); for (int i = 0; i < product.Count; i++) { MMovementLine invline = new MMovementLine(ctx, lineID, null); invline.SetAD_Client_ID(inv.GetAD_Client_ID()); invline.SetAD_Org_ID(inv.GetAD_Org_ID()); invline.SetM_Locator_ID(Util.GetValueOfInt(locID[i])); invline.SetM_LocatorTo_ID(LocToID); invline.SetM_Product_ID(Util.GetValueOfInt(product[i])); invline.SetMovementQty(Util.GetValueOfDecimal(qty[i])); invline.SetM_Movement_ID(recordID); if (Util.GetValueOfInt(AssetID[i]) > 0) { invline.SetA_Asset_ID(Util.GetValueOfInt(AssetID[i])); } if (Util.GetValueOfInt(oline_ID[i]) > 0) { invline.SetM_RequisitionLine_ID(Util.GetValueOfInt(oline_ID[i])); } if (Util.GetValueOfInt(attribute[i]) != 0) { invline.SetM_AttributeSetInstance_ID(Util.GetValueOfInt(attribute[i])); } if (!invline.Save()) { } } } else if (keyColName.ToUpper().Trim() == "M_INVENTORY_ID") { MInventory inv = new MInventory(ctx, recordID, null); for (int i = 0; i < product.Count; i++) { MInventoryLine invline = new MInventoryLine(ctx, lineID, null); invline.SetAD_Client_ID(inv.GetAD_Client_ID()); invline.SetAD_Org_ID(inv.GetAD_Org_ID()); invline.SetM_Product_ID(Util.GetValueOfInt(product[i])); invline.SetQtyInternalUse(Util.GetValueOfDecimal(qty[i])); invline.SetC_Charge_ID(Util.GetValueOfInt(AssetID[i])); invline.SetM_Inventory_ID(recordID); invline.SetIsInternalUse(true); invline.SetM_RequisitionLine_ID(Util.GetValueOfInt(oline_ID[i])); if (Util.GetValueOfInt(attribute[i]) != 0) { invline.SetM_AttributeSetInstance_ID(Util.GetValueOfInt(attribute[i])); } else { invline.SetM_AttributeSetInstance_ID(0); } if (!invline.Save()) { } } } return(true); }
public bool SetProductQty(int recordID, string keyColName, List <string> product, List <string> attribute, List <string> qty, List <string> qtybook, List <string> oline_ID, int ordID, List <string> locID, int lineID, VAdvantage.Utility.Ctx ctx) { if (keyColName.ToUpper().Trim() == "C_ORDER_ID") { MOrder ord = new MOrder(ctx, recordID, null); for (int i = 0; i < product.Count; i++) { MOrderLine oline = new MOrderLine(ctx, lineID, null); oline.SetAD_Client_ID(ord.GetAD_Client_ID()); oline.SetAD_Org_ID(ord.GetAD_Org_ID()); oline.SetM_Product_ID(Util.GetValueOfInt(product[i])); oline.SetQty(Util.GetValueOfDecimal(qty[i])); oline.SetC_Order_ID(recordID); if (Util.GetValueOfInt(attribute[i]) != 0) { oline.SetM_AttributeSetInstance_ID(Util.GetValueOfInt(attribute[i])); } if (!ord.IsSOTrx()) { MProduct pro = new MProduct(ctx, oline.GetM_Product_ID(), null); String qryUom = "SELECT vdr.C_UOM_ID FROM M_Product p LEFT JOIN M_Product_Po vdr ON p.M_Product_ID= vdr.M_Product_ID WHERE p.M_Product_ID=" + oline.GetM_Product_ID() + " AND vdr.C_BPartner_ID = " + ord.GetC_BPartner_ID(); int uom = Util.GetValueOfInt(DB.ExecuteScalar(qryUom)); if (pro.GetC_UOM_ID() != 0) { if (pro.GetC_UOM_ID() != uom && uom != 0) { decimal?Res = Util.GetValueOfDecimal(DB.ExecuteScalar("SELECT trunc(multiplyrate,4) FROM C_UOM_Conversion WHERE C_UOM_ID = " + pro.GetC_UOM_ID() + " AND C_UOM_To_ID = " + uom + " AND M_Product_ID= " + oline.GetM_Product_ID() + " AND IsActive='Y'")); if (Res > 0) { oline.SetQtyEntered(oline.GetQtyEntered() * Res); //OrdQty = MUOMConversion.ConvertProductTo(GetCtx(), _M_Product_ID, UOM, OrdQty); } else { decimal?res = Util.GetValueOfDecimal(DB.ExecuteScalar("SELECT trunc(multiplyrate,4) FROM C_UOM_Conversion WHERE C_UOM_ID = " + pro.GetC_UOM_ID() + " AND C_UOM_To_ID = " + uom + " AND IsActive='Y'")); if (res > 0) { oline.SetQtyEntered(oline.GetQtyEntered() * res); //OrdQty = MUOMConversion.Convert(GetCtx(), prdUOM, UOM, OrdQty); } } oline.SetC_UOM_ID(uom); } else { oline.SetC_UOM_ID(pro.GetC_UOM_ID()); } } } if (!oline.Save()) { } } } else if (keyColName.ToUpper().Trim() == "C_INVOICE_ID") { MInvoice inv = new MInvoice(ctx, recordID, null); for (int i = 0; i < product.Count; i++) { MInvoiceLine invline = new MInvoiceLine(ctx, lineID, null); invline.SetAD_Client_ID(inv.GetAD_Client_ID()); invline.SetAD_Org_ID(inv.GetAD_Org_ID()); invline.SetM_Product_ID(Util.GetValueOfInt(product[i])); invline.SetQty(Util.GetValueOfDecimal(qty[i])); invline.SetC_Invoice_ID(recordID); if (Util.GetValueOfInt(attribute[i]) != 0) { invline.SetM_AttributeSetInstance_ID(Util.GetValueOfInt(attribute[i])); } if (!inv.IsSOTrx()) { MProduct pro = new MProduct(ctx, invline.GetM_Product_ID(), null); String qryUom = "SELECT vdr.C_UOM_ID FROM M_Product p LEFT JOIN M_Product_Po vdr ON p.M_Product_ID= vdr.M_Product_ID WHERE p.M_Product_ID=" + invline.GetM_Product_ID() + " AND vdr.C_BPartner_ID = " + inv.GetC_BPartner_ID(); int uom = Util.GetValueOfInt(DB.ExecuteScalar(qryUom)); if (pro.GetC_UOM_ID() != 0) { if (pro.GetC_UOM_ID() != uom && uom != 0) { decimal?Res = Util.GetValueOfDecimal(DB.ExecuteScalar("SELECT trunc(multiplyrate,4) FROM C_UOM_Conversion WHERE C_UOM_ID = " + pro.GetC_UOM_ID() + " AND C_UOM_To_ID = " + uom + " AND M_Product_ID= " + invline.GetM_Product_ID() + " AND IsActive='Y'")); if (Res > 0) { invline.SetQtyEntered(invline.GetQtyEntered() * Res); //OrdQty = MUOMConversion.ConvertProductTo(GetCtx(), _M_Product_ID, UOM, OrdQty); } else { decimal?res = Util.GetValueOfDecimal(DB.ExecuteScalar("SELECT trunc(multiplyrate,4) FROM C_UOM_Conversion WHERE C_UOM_ID = " + pro.GetC_UOM_ID() + " AND C_UOM_To_ID = " + uom + " AND IsActive='Y'")); if (res > 0) { invline.SetQtyEntered(invline.GetQtyEntered() * res); //OrdQty = MUOMConversion.Convert(GetCtx(), prdUOM, UOM, OrdQty); } } invline.SetC_UOM_ID(uom); } else { invline.SetC_UOM_ID(pro.GetC_UOM_ID()); } } } if (!invline.Save()) { } } } else if (keyColName.ToUpper().Trim() == "M_INOUT_ID") { MInOut inv = new MInOut(ctx, recordID, null); if (ordID > 0) { inv.SetC_Order_ID(ordID); } if (inv.Save()) { for (int i = 0; i < product.Count; i++) { MInOutLine ioline = new MInOutLine(ctx, lineID, null); ioline.SetAD_Client_ID(inv.GetAD_Client_ID()); ioline.SetAD_Org_ID(inv.GetAD_Org_ID()); ioline.SetM_Product_ID(Util.GetValueOfInt(product[i])); ioline.SetQty(Util.GetValueOfDecimal(qty[i])); ioline.SetM_InOut_ID(recordID); ioline.SetC_OrderLine_ID(Util.GetValueOfInt(oline_ID[i])); ioline.SetM_Locator_ID(Util.GetValueOfInt(locID[i])); if (Util.GetValueOfInt(attribute[i]) != 0) { ioline.SetM_AttributeSetInstance_ID(Util.GetValueOfInt(attribute[i])); } if (!inv.IsSOTrx()) { MProduct pro = new MProduct(ctx, ioline.GetM_Product_ID(), null); String qryUom = "SELECT vdr.C_UOM_ID FROM M_Product p LEFT JOIN M_Product_Po vdr ON p.M_Product_ID= vdr.M_Product_ID WHERE p.M_Product_ID=" + ioline.GetM_Product_ID() + " AND vdr.C_BPartner_ID = " + inv.GetC_BPartner_ID(); int uom = Util.GetValueOfInt(DB.ExecuteScalar(qryUom)); if (pro.GetC_UOM_ID() != 0) { if (pro.GetC_UOM_ID() != uom && uom != 0) { decimal?Res = Util.GetValueOfDecimal(DB.ExecuteScalar("SELECT trunc(multiplyrate,4) FROM C_UOM_Conversion WHERE C_UOM_ID = " + pro.GetC_UOM_ID() + " AND C_UOM_To_ID = " + uom + " AND M_Product_ID= " + ioline.GetM_Product_ID() + " AND IsActive='Y'")); if (Res > 0) { ioline.SetQtyEntered(ioline.GetQtyEntered() * Res); //OrdQty = MUOMConversion.ConvertProductTo(GetCtx(), _M_Product_ID, UOM, OrdQty); } else { decimal?res = Util.GetValueOfDecimal(DB.ExecuteScalar("SELECT trunc(multiplyrate,4) FROM C_UOM_Conversion WHERE C_UOM_ID = " + pro.GetC_UOM_ID() + " AND C_UOM_To_ID = " + uom + " AND IsActive='Y'")); if (res > 0) { ioline.SetQtyEntered(ioline.GetQtyEntered() * res); //OrdQty = MUOMConversion.Convert(GetCtx(), prdUOM, UOM, OrdQty); } } ioline.SetC_UOM_ID(uom); } else { ioline.SetC_UOM_ID(pro.GetC_UOM_ID()); } } } if (!ioline.Save()) { } } } } else if (keyColName.ToUpper().Trim() == "M_PACKAGE_ID") { MPackage pkg = new MPackage(ctx, recordID, null); for (int i = 0; i < product.Count; i++) { MPackageLine mline = new MPackageLine(ctx, lineID, null); mline.SetAD_Client_ID(pkg.GetAD_Client_ID()); mline.SetAD_Org_ID(pkg.GetAD_Org_ID()); mline.SetM_Product_ID(Util.GetValueOfInt(product[i])); mline.SetQty(Util.GetValueOfDecimal(qty[i])); if (Util.GetValueOfInt(oline_ID[i]) > 0) { mline.SetM_MovementLine_ID(Util.GetValueOfInt(oline_ID[i])); MMovementLine mov = new MMovementLine(ctx, Util.GetValueOfInt(oline_ID[i]), null); mline.SetDTD001_TotalQty(mov.GetMovementQty()); } if (Util.GetValueOfInt(attribute[i]) != 0) { mline.SetM_AttributeSetInstance_ID(Util.GetValueOfInt(attribute[i])); } mline.SetM_Package_ID(recordID); if (!mline.Save()) { } } } else if (keyColName.ToUpper().Trim() == "M_INVENTORY_ID") { MInventory inv = new MInventory(ctx, recordID, null); for (int i = 0; i < product.Count; i++) { MInventoryLine invline = new MInventoryLine(ctx, lineID, null); invline.SetAD_Client_ID(inv.GetAD_Client_ID()); invline.SetAD_Org_ID(inv.GetAD_Org_ID()); invline.SetM_Locator_ID(Util.GetValueOfInt(locID[i])); invline.SetM_Product_ID(Util.GetValueOfInt(product[i])); invline.SetQtyCount(Util.GetValueOfDecimal(qty[i])); invline.SetQtyBook(Util.GetValueOfDecimal(qtybook[i])); invline.SetAsOnDateCount(Util.GetValueOfDecimal(qty[i])); invline.SetOpeningStock(Util.GetValueOfDecimal(qtybook[i])); invline.SetM_Inventory_ID(recordID); if (Util.GetValueOfInt(attribute[i]) != 0) { invline.SetM_AttributeSetInstance_ID(Util.GetValueOfInt(attribute[i])); } else { invline.SetM_AttributeSetInstance_ID(0); } if (!invline.Save()) { } } } return(true); }
public InfoColumn[] GetInfoColumns(VAdvantage.Utility.Ctx ctx) { if (s_productLayout != null) { return(s_productLayout); } // s_headerPriceList = Msg.Translate(ctx, "M_PriceList_Version_ID"); s_headerWarehouse = Msg.Translate(ctx, "M_Warehouse_ID"); // Euro 13 MClient client = MClient.Get(ctx); if ("FRIE".Equals(client.GetValue())) { InfoColumn[] frieLayout = { new InfoColumn(Msg.Translate(ctx, "M_Product_ID"), "M_Product_ID", true, "p.M_Product_ID", DisplayType.ID).Seq(10), new InfoColumn(Msg.Translate(ctx, "Name"), "Name", true, "p.Name", DisplayType.String).Seq(20), new InfoColumn(Msg.Translate(ctx, "QtyEntered"), "QtyEntered", false, "0 as QtyEntered", DisplayType.Quantity).Seq(30), new InfoColumn(Msg.Translate(ctx, "QtyAvailable"), "QtyAvailable", true, "bomQtyAvailable(p.M_Product_ID,w.M_Warehouse_ID,0) AS QtyAvailable", DisplayType.Quantity).Seq(40), new InfoColumn(s_headerPriceList, "M_PriceList_Version_ID", true, "plv.Name", DisplayType.Amount).Seq(50), new InfoColumn(s_headerWarehouse, "M_Warehouse_ID", true, "w.Name", DisplayType.String).Seq(60), new InfoColumn(Msg.Translate(ctx, "PriceList"), "PriceList", true, "bomPriceList(p.M_Product_ID, pr.M_PriceList_Version_ID) AS PriceList", DisplayType.Amount).Seq(70), new InfoColumn(Msg.Translate(ctx, "PriceStd"), "PriceStd", true, "bomPriceStd(p.M_Product_ID, pr.M_PriceList_Version_ID) AS PriceStd", DisplayType.Amount).Seq(80), new InfoColumn("Einzel MWSt", "", true, "pr.PriceStd * 1.19", DisplayType.Amount).Seq(90), new InfoColumn("Einzel kompl", "", true, "(pr.PriceStd+13) * 1.19", DisplayType.Amount).Seq(100), new InfoColumn("Satz kompl", "", true, "((pr.PriceStd+13) * 1.19) * 4", DisplayType.Amount).Seq(110), new InfoColumn(Msg.Translate(ctx, "QtyOnHand"), "QtyOnHand", true, "bomQtyOnHand(p.M_Product_ID,w.M_Warehouse_ID,0) AS QtyOnHand", DisplayType.Quantity).Seq(120), new InfoColumn(Msg.Translate(ctx, "QtyReserved"), "QtyReserved", true, "bomQtyReserved(p.M_Product_ID,w.M_Warehouse_ID,0) AS QtyReserved", DisplayType.Quantity).Seq(130), new InfoColumn(Msg.Translate(ctx, "QtyOrdered"), "QtyOrdered", true, "bomQtyOrdered(p.M_Product_ID,w.M_Warehouse_ID,0) AS QtyOrdered", DisplayType.Quantity).Seq(140), new InfoColumn(Msg.Translate(ctx, "Discontinued").Substring(0, 1), "Discontinued", true, "p.Discontinued", DisplayType.YesNo).Seq(150), new InfoColumn(Msg.Translate(ctx, "SalesMargin"), "SalesMargin", true, "bomPriceStd(p.M_Product_ID, pr.M_PriceList_Version_ID)-bomPriceLimit(p.M_Product_ID, pr.M_PriceList_Version_ID) AS Margin", DisplayType.Amount).Seq(160), new InfoColumn(Msg.Translate(ctx, "PriceLimit"), "PriceLimit", true, "bomPriceLimit(p.M_Product_ID, pr.M_PriceList_Version_ID) AS PriceLimit", DisplayType.Amount).Seq(170), new InfoColumn(Msg.Translate(ctx, "IsInstanceAttribute"), "IsInstanceAttribute", true, "pa.IsInstanceAttribute", DisplayType.YesNo).Seq(180), new InfoColumn(Msg.Translate(ctx, "GuranteeDays"), "GuranteeDays", true, "Sysdate+p.GuaranteeDays as GuranteeDays", DisplayType.Date).Seq(190) //new InfoColumn(Msg.Translate(ctx, "Quantity"), "0 as Quantity" , typeof(Boolean)).Seq(180) }; INDEX_NAME = 1; INDEX_PATTRIBUTE = frieLayout.Length - 1; // last item s_productLayout = frieLayout; return(s_productLayout); } if (s_productLayout == null) { List <InfoColumn> list = new List <InfoColumn>(); list.Add(new InfoColumn(Msg.Translate(ctx, "M_Product_ID"), "M_Product_ID", true, "p.M_Product_ID", DisplayType.ID).Seq(10)); //list.Add(new InfoColumn(Msg.Translate(ctx, "SelectProduct"),"SelectProduct",true, "'N'", DisplayType.YesNo).Seq(20)); list.Add(new InfoColumn(Msg.Translate(ctx, "Discontinued"), "Discontinued", true, "p.Discontinued", DisplayType.YesNo).Seq(30)); list.Add(new InfoColumn(Msg.Translate(ctx, "Value"), "Value", true, "p.Value", DisplayType.String).Seq(40)); list.Add(new InfoColumn(Msg.Translate(ctx, "Name"), "Name", true, "p.Name", DisplayType.String).Seq(50)); list.Add(new InfoColumn(Msg.Translate(ctx, "QtyEntered"), "QtyEntered", false, "0 as QtyEntered", DisplayType.Quantity).Seq(80)); list.Add(new InfoColumn(Msg.Translate(ctx, "QtyAvailable"), "QtyAvailable", true, "bomQtyAvailable(p.M_Product_ID,w.M_Warehouse_ID,0) AS QtyAvailable", DisplayType.Quantity).Seq(90)); //} list.Add(new InfoColumn(s_headerPriceList, "PriceListVersion", true, "plv.Name as PriceListVersion", DisplayType.String).Seq(100)); list.Add(new InfoColumn(s_headerWarehouse, "Warehouse", true, "w.Name as Warehouse", DisplayType.String).Seq(110)); Tuple <String, String, String> mInfo = null; if (Env.HasModulePrefix("VAPRC_", out mInfo)) { Tuple <String, String, String> aInfo = null; if (Env.HasModulePrefix("ED011_", out aInfo)) { list.Add(new InfoColumn(Msg.Translate(ctx, "PriceList"), "PriceList", true, "bomPriceListUom(p.M_Product_ID, pr.M_PriceList_Version_ID,pr.M_AttriButeSetInstance_ID,pr.C_UOM_ID) AS PriceList", DisplayType.Amount).Seq(120)); list.Add(new InfoColumn(Msg.Translate(ctx, "PriceStd"), "PriceStd", true, "bomPriceStdUom(p.M_Product_ID, pr.M_PriceList_Version_ID,pr.M_AttriButeSetInstance_ID,pr.C_UOM_ID) AS PriceStd", DisplayType.Amount).Seq(130)); } else { list.Add(new InfoColumn(Msg.Translate(ctx, "PriceList"), "PriceList", true, "bomPriceListAttr(p.M_Product_ID, pr.M_PriceList_Version_ID,pr.M_AttriButeSetInstance_ID) AS PriceList", DisplayType.Amount).Seq(120)); list.Add(new InfoColumn(Msg.Translate(ctx, "PriceStd"), "PriceStd", true, "bomPriceStdAttr(p.M_Product_ID, pr.M_PriceList_Version_ID,pr.M_AttriButeSetInstance_ID) AS PriceStd", DisplayType.Amount).Seq(130)); } } else { list.Add(new InfoColumn(Msg.Translate(ctx, "PriceList"), "PriceList", true, "bomPriceList(p.M_Product_ID, pr.M_PriceList_Version_ID) AS PriceList", DisplayType.Amount).Seq(120)); list.Add(new InfoColumn(Msg.Translate(ctx, "PriceStd"), "PriceStd", true, "bomPriceStd(p.M_Product_ID, pr.M_PriceList_Version_ID) AS PriceStd", DisplayType.Amount).Seq(130)); } list.Add(new InfoColumn(Msg.Translate(ctx, "QtyOnHand"), "QtyOnHand", true, "bomQtyOnHand(p.M_Product_ID,w.M_Warehouse_ID,0) AS QtyOnHand", DisplayType.Quantity).Seq(140)); list.Add(new InfoColumn(Msg.Translate(ctx, "QtyReserved"), "QtyReserved", true, "bomQtyReserved(p.M_Product_ID,w.M_Warehouse_ID,0) AS QtyReserved", DisplayType.Quantity).Seq(150)); list.Add(new InfoColumn(Msg.Translate(ctx, "QtyOrdered"), "QtyOrdered", true, "bomQtyOrdered(p.M_Product_ID,w.M_Warehouse_ID,0) AS QtyOrdered", DisplayType.Quantity).Seq(160)); //} if (isConferm) //IsUnconfirmed()) { list.Add(new InfoColumn(Msg.Translate(ctx, "QtyUnconfirmed"), "QtyUnconfirmed", true, "(SELECT SUM(c.TargetQty) FROM M_InOutLineConfirm c INNER JOIN M_InOutLine il ON (c.M_InOutLine_ID=il.M_InOutLine_ID) INNER JOIN M_InOut i ON (il.M_InOut_ID=i.M_InOut_ID) WHERE c.Processed='N' AND i.M_Warehouse_ID=w.M_Warehouse_ID AND il.M_Product_ID=p.M_Product_ID) AS QtyUnconfirmed", DisplayType.Quantity).Seq(170)); list.Add(new InfoColumn(Msg.Translate(ctx, "QtyUnconfirmedMove"), "QtyUnconfirmedMove", true, "(SELECT SUM(c.TargetQty) FROM M_MovementLineConfirm c INNER JOIN M_MovementLine ml ON (c.M_MovementLine_ID=ml.M_MovementLine_ID) INNER JOIN M_Locator l ON (ml.M_LocatorTo_ID=l.M_Locator_ID) WHERE c.Processed='N' AND l.M_Warehouse_ID=w.M_Warehouse_ID AND ml.M_Product_ID=p.M_Product_ID) AS QtyUnconfirmedMove", DisplayType.Quantity).Seq(180)); } if (Env.HasModulePrefix("VAPRC_", out mInfo)) { Tuple <String, String, String> aInfo = null; if (Env.HasModulePrefix("ED011_", out aInfo)) { list.Add(new InfoColumn(Msg.Translate(ctx, "SalesMargin"), "SalesMargin", true, "bomPriceStdUom(p.M_Product_ID, pr.M_PriceList_Version_ID,pr.M_AttriButeSetInstance_ID,pr.C_UOM_ID)-bomPriceLimitUom(p.M_Product_ID, pr.M_PriceList_Version_ID,pr.M_AttriButeSetInstance_ID,pr.C_UOM_ID) AS Margin", DisplayType.Amount).Seq(190)); list.Add(new InfoColumn(Msg.Translate(ctx, "PriceLimit"), "PriceLimit", true, "bomPriceLimitUom(p.M_Product_ID, pr.M_PriceList_Version_ID,pr.M_AttriButeSetInstance_ID,pr.C_UOM_ID) AS PriceLimit", DisplayType.Amount).Seq(200)); } else { list.Add(new InfoColumn(Msg.Translate(ctx, "SalesMargin"), "SalesMargin", true, "bomPriceStdAttr(p.M_Product_ID, pr.M_PriceList_Version_ID,pr.M_AttriButeSetInstance_ID)-bomPriceLimitAttr(p.M_Product_ID, pr.M_PriceList_Version_ID,pr.M_AttriButeSetInstance_ID) AS Margin", DisplayType.Amount).Seq(190)); list.Add(new InfoColumn(Msg.Translate(ctx, "PriceLimit"), "PriceLimit", true, "bomPriceLimitAttr(p.M_Product_ID, pr.M_PriceList_Version_ID,pr.M_AttriButeSetInstance_ID) AS PriceLimit", DisplayType.Amount).Seq(200)); } } else { list.Add(new InfoColumn(Msg.Translate(ctx, "SalesMargin"), "SalesMargin", true, "bomPriceStd(p.M_Product_ID, pr.M_PriceList_Version_ID)-bomPriceLimit(p.M_Product_ID, pr.M_PriceList_Version_ID) AS Margin", DisplayType.Amount).Seq(190)); list.Add(new InfoColumn(Msg.Translate(ctx, "PriceLimit"), "PriceLimit", true, "bomPriceLimit(p.M_Product_ID, pr.M_PriceList_Version_ID) AS PriceLimit", DisplayType.Amount).Seq(200)); } list.Add(new InfoColumn(Msg.Translate(ctx, "IsInstanceAttribute"), "IsInstanceAttribute", true, "pa.IsInstanceAttribute", DisplayType.YesNo).Seq(210)); list.Add(new InfoColumn(Msg.Translate(ctx, "GuranteeDays"), "GuranteeDays", true, "Sysdate+p.GuaranteeDays as GuranteeDays", DisplayType.Date).Seq(220)); s_productLayout = new InfoColumn[list.Count]; s_productLayout = list.ToArray(); INDEX_NAME = 3; INDEX_PATTRIBUTE = s_productLayout.Length - 1; // last item } return(s_productLayout); }
/// <summary> /// Prepare - e.g., get Parameters. /// </summary> protected override void Prepare() { ProcessInfoParameter[] para = GetParameter(); foreach (ProcessInfoParameter element in para) { String name = element.GetParameterName(); if (element.GetParameter() == null) { ; } else if (name.Equals("AD_Language")) { _AD_Language = (String)element.GetParameter(); } else if (name.Equals("AD_Table_ID")) { _AD_Table_ID = element.GetParameterAsInt(); } else { log.Log(Level.SEVERE, "Unknown Parameter: " + name); } } _record_ID = GetRecord_ID(); IDataReader dr = DB.ExecuteReader(@" SELECT AD_ModuleInfo_ID,Name,Prefix,VersionId,versionNo FROM AD_ModuleInfo WHERE AD_ModuleInfo_ID = (SELECT AD_ModuleInfo_ID FROM AD_Module_DB_Schema WHERE AD_Module_DB_Schema_ID =" + _record_ID + ")"); string Module_Name = "", versionId, versionNo = ""; try { if (dr.Read()) { //AD_ModuleInfo_ID = Util.GetValueOfInt(dr[0]); Module_Name = dr[1].ToString().Trim();// .Replace(' ', '_'); _prefix = dr[2].ToString(); versionId = dr[3].ToString(); if (string.IsNullOrEmpty(versionId)) { versionId = "1000"; } versionNo = dr[4].ToString(); if (string.IsNullOrEmpty(versionNo)) { versionNo = "1.0.0.0"; } } dr.Close(); } catch { if (dr != null) { dr.Close(); dr = null; } } _Directory = System.IO.Path.Combine(System.Web.Hosting.HostingEnvironment.ApplicationPhysicalPath, _prefix, Module_Name + "_" + versionNo + " \\Translations", _AD_Language); _ctx = GetCtx(); } // prepare
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)); }
// Change GSI Barcode public JsonResult GetASIID(string fields) { string retError = ""; string retJSON = ""; if (Session["ctx"] != null) { VAdvantage.Utility.Ctx ctx = Session["ctx"] as Ctx; MInOutModel objInOut = new MInOutModel(); PAttributesModel pMod = new PAttributesModel(); string[] vals = null; int M_Product_ID = 0; int windowNo = 0; string attrCode = ""; if (fields != null) { vals = fields.Split(','); M_Product_ID = Util.GetValueOfInt(vals[1]); windowNo = Util.GetValueOfInt(vals[2]); attrCode = Util.GetValueOfString(vals[0]); } AttributeInstance aIns = null; string lotNo = ""; int M_AttributeSetInstance_ID = 0; try { if (attrCode.IndexOf("(10)") > 0) { lotNo = attrCode.Substring(attrCode.IndexOf("(10)")).Replace("(10)", ""); if (lotNo.IndexOf("(17)") > 0) { lotNo = lotNo.Substring(0, lotNo.IndexOf("(17)")); } } string expDate = ""; if (attrCode.IndexOf("(17)") > 0) { expDate = attrCode.Substring(attrCode.IndexOf("(17)")).Replace("(17)", ""); if (expDate.IndexOf("(10)") > 0) { expDate = expDate.Substring(0, expDate.IndexOf("(10)")); } } //DateTime.ParseExact(expDate, "yyMMdd", CultureInfo.InvariantCulture, DateTimeStyles.None); DateTime?dTime = null; if (expDate != null && expDate != "") { expDate = DateTime.ParseExact(expDate, "yyMMdd", CultureInfo.InvariantCulture, DateTimeStyles.None).ToShortDateString(); } else { expDate = ""; } aIns = pMod.SaveAttributeMR(0, lotNo, "", expDate, attrCode, false, 0, M_Product_ID, 0, null, ctx); M_AttributeSetInstance_ID = aIns.M_AttributeSetInstance_ID; } catch (Exception ex) { M_AttributeSetInstance_ID = 0; aIns = null; } retJSON = Util.GetValueOfString(M_AttributeSetInstance_ID); } return(Json(retJSON, JsonRequestBehavior.AllowGet)); }
public JsonResult GetProductPricing(string fields) { string retError = ""; string retJSON = ""; if (Session["ctx"] != null) { VAdvantage.Utility.Ctx ctx = Session["ctx"] as Ctx; string[] paramValue = fields.Split(','); int M_Product_ID, C_BPartner_ID, M_PriceList_ID, M_PriceList_Version_ID; decimal Qty; bool isSOTrx; //Assign parameter value M_Product_ID = Util.GetValueOfInt(paramValue[0].ToString()); C_BPartner_ID = Util.GetValueOfInt(paramValue[1].ToString()); Qty = Util.GetValueOfDecimal(paramValue[2].ToString()); isSOTrx = Util.GetValueOfBool(paramValue[3].ToString()); M_PriceList_ID = Util.GetValueOfInt(paramValue[4].ToString()); M_PriceList_Version_ID = Util.GetValueOfInt(paramValue[5].ToString()); DateTime orderDate = System.Convert.ToDateTime(paramValue[6].ToString()); //End Assign parameter value MProductPricing pp = new MProductPricing(ctx.GetAD_Client_ID(), ctx.GetAD_Org_ID(), M_Product_ID, C_BPartner_ID, Qty, isSOTrx); //var M_PriceList_ID = ctx.GetContextAsInt(WindowNo, "M_PriceList_ID"); pp.SetM_PriceList_ID(M_PriceList_ID); /** PLV is only accurate if PL selected in header */ //var M_PriceList_Version_ID = ctx.GetContextAsInt(WindowNo, "M_PriceList_Version_ID"); pp.SetM_PriceList_Version_ID(M_PriceList_Version_ID); //var orderDate = System.Convert.ToDateTime(mTab.getValue("DateOrdered")); pp.SetPriceDate(orderDate); //Get product stock MProduct product = MProduct.Get(ctx, M_Product_ID); VIS.DataContracts.ProductDataOut objInfo = new VIS.DataContracts.ProductDataOut { PriceList = pp.GetPriceList(), PriceLimit = pp.GetPriceLimit(), PriceActual = pp.GetPriceStd(), PriceEntered = pp.GetPriceStd(), PriceStd = pp.GetPriceStd(), C_Currency_ID = System.Convert.ToInt32(pp.GetC_Currency_ID()), Discount = pp.GetDiscount(), C_UOM_ID = System.Convert.ToInt32(pp.GetC_UOM_ID()), //QtyOrdered= mTab.GetValue("QtyEntered")); EnforcePriceLimit = pp.IsEnforcePriceLimit(), DiscountSchema = pp.IsDiscountSchema(), IsStocked = product.IsStocked() }; product = null; pp = null; retJSON = JsonConvert.SerializeObject(objInfo); } else { retError = "Session Expired"; } return(Json(new { result = retJSON, error = retError }, JsonRequestBehavior.AllowGet)); }
public bool UpdateCategory(Int32 id, String Name, String Value, String Producttype, String matPolicy, String Desc, Int32 attrSet, Int32 taxcat, Int32 assetGrp, Boolean Consumable, Int32 image_ID, VAdvantage.Utility.Ctx ctx) { VAdvantage.Model.MProductCategory pcat = new VAdvantage.Model.MProductCategory(ctx, id, null); pcat.SetName(Name); pcat.SetValue(Value); pcat.SetProductType(Producttype); pcat.SetMMPolicy(matPolicy); pcat.SetDescription(Desc); pcat.SetM_AttributeSet_ID(attrSet); pcat.SetC_TaxCategory_ID(taxcat); pcat.SetA_Asset_Group_ID(assetGrp); pcat.SetAD_Image_ID(image_ID); Tuple <String, String, String> mInfo = null; if (Env.HasModulePrefix("DTD001_", out mInfo)) { pcat.SetDTD001_IsConsumable(Consumable); } if (pcat.Save()) { return(true); } return(false); }