protected void gdvinv1_RowInserting(object sender, ASPxDataInsertingEventArgs e) { gdvinv1.DoRowValidation(); var obec = ((BEParameters)Session["InitPar"]); var line = new BEDocumentLine() { ItemCode = Convert.ToString(e.NewValues["ItemCode"]), ItemName = Convert.ToString(e.NewValues["ItemName"]), Quantity = Convert.ToInt32(e.NewValues["Quantity"]), PriceBefDi = Convert.ToDecimal(e.NewValues["PriceBefDi"]), DiscPrcnt = Convert.ToDecimal(e.NewValues["DiscPrcnt"]), Price = Convert.ToDecimal(e.NewValues["Price"]), LineTotal = Convert.ToDecimal(e.NewValues["LineTotal"]), GTotal = Convert.ToDecimal(e.NewValues["GTotal"]), BatchNum = Convert.ToString(e.NewValues["BatchNum"]), WhsCode = obec.WhsCode, U_BF_CodKit = string.Empty, NumInSale = Convert.ToDecimal(e.NewValues["NumInSale"]), OItemCode = Convert.ToString(e.NewValues["OItemCode"]) }; ((List <BEDocumentLine>)Session["inv1"]).Add(line); Set_LineNum(); gdvinv1.JSProperties["cpSubTotal"] = ((List <BEDocumentLine>)Session["inv1"]).Sum(item => Math.Round(item.LineTotal, 2)); gdvinv1.CancelEdit(); e.Cancel = true; gdvinv1.DataSource = ((List <BEDocumentLine>)Session["inv1"]); gdvinv1.DataBind(); }
protected void gdvdln1_RowInserting(object sender, ASPxDataInsertingEventArgs e) { var beNe = new BRDocument(); gdvdln1.DoRowValidation(); var obec = ((BEParameters)Session["InitPar"]); string almacen = ""; /*if (obec.Socied == "BM") * { * if (beNe.getStockAlmacen(Convert.ToString(e.NewValues["ItemCode"])) <= 0) * almacen = "BL010"; * else * almacen = obec.WhsCode; * } * if (obec.Socied == "BT") * {*/ almacen = obec.WhsCode; //} var line = new BEDocumentLine() { ItemCode = Convert.ToString(e.NewValues["ItemCode"]), ItemName = Convert.ToString(e.NewValues["ItemName"]), Quantity = Convert.ToInt32(e.NewValues["Quantity"]), PriceBefDi = Convert.ToDecimal(e.NewValues["PriceBefDi"]), DiscPrcnt = Convert.ToDecimal(e.NewValues["DiscPrcnt"]), Price = Convert.ToDecimal(e.NewValues["Price"]), LineTotal = Convert.ToDecimal(e.NewValues["LineTotal"]), GTotal = Convert.ToDecimal(e.NewValues["GTotal"]), IssueMthd = Convert.ToString(e.NewValues["IssueMthd"]), WhsCode = almacen, U_StoDiBE = Convert.ToDecimal(e.NewValues["U_StoDiBE"]), U_BF_StoDiYo = Convert.ToDecimal(e.NewValues["U_BF_StoDiYo"]), //BL050 = Convert.ToDecimal(e.NewValues["BL050"]), //BL010 = Convert.ToDecimal(e.NewValues["BL010"]), //U_U_BF_CompTot = Convert.ToDecimal(e.NewValues["U_U_BF_CompTot"]), //U_BIZ_DREC = Convert.ToString(e.NewValues["U_BIZ_DREC"]), //U_BIZ_FFAR = Convert.ToString(e.NewValues["U_BIZ_FFAR"]), //U_BIZ_CANT = Convert.ToDecimal(e.NewValues["U_BIZ_CANT"]), //U_BF_FECH_EXPE = DateTime.Today.ToShortDateString(), //U_BF_FECH_VENC = DateTime.Today.AddDays(90).ToShortDateString(), //U_BF_CodKit = string.Empty, OItemCode = Convert.ToString(e.NewValues["OItemCode"]), OnDscOrg = Convert.ToDecimal(e.NewValues["OnDscOrg"]), Serie = Convert.ToString(e.NewValues["Serie"]) //PASAR EL SERIALNUMBER PARA LUEGO HACER EL DATASOURCE AL DETALLE }; line.InDscOrg = (line.OnDscOrg == 0) ? 1 : 0; ((List <BEDocumentLine>)Session["dln1"]).Add(line); //Set_Promotion(); Set_LineNum(); gdvdln1.JSProperties["cpSubTotal"] = ((List <BEDocumentLine>)Session["dln1"]).Sum(item => Math.Round(item.LineTotal, 2)); gdvdln1.CancelEdit(); e.Cancel = true; gdvdln1.DataSource = ((List <BEDocumentLine>)Session["dln1"]); gdvdln1.DataBind(); }
protected void gdvdln1_RowInserting(object sender, ASPxDataInsertingEventArgs e) { var beNe = new BRDocument(); gdvdln1.DoRowValidation(); var obec = ((BEParameters)Session["InitPar"]); string almacen = ""; /*if (obec.Socied == "BM") * { * if (beNe.getStockAlmacen(Convert.ToString(e.NewValues["ItemCode"])) <= 0) * almacen = "BL010"; * else * almacen = obec.WhsCode; * } * if (obec.Socied == "BT") * {*/ almacen = obec.WhsCode; //} var line = new BEDocumentLine() { ItemCode = Convert.ToString(e.NewValues["ItemCode"]), ItemName = Convert.ToString(e.NewValues["ItemName"]), U_GOS_MARCA = Convert.ToString(e.NewValues["U_GOS_MARCA"]), Quantity = Convert.ToInt32(e.NewValues["Quantity"]), WhsCode = almacen, U_StoDiBE = Convert.ToDecimal(e.NewValues["U_StoDiBE"]), U_BF_StoDiYo = Convert.ToDecimal(e.NewValues["U_BF_StoDiYo"]), IssueMthd = Convert.ToString(e.NewValues["IssueMthd"]), TreeType = Convert.ToString(e.NewValues["TreeType"]), OItemCode = Convert.ToString(e.NewValues["OItemCode"]), OnDscOrg = Convert.ToDecimal(e.NewValues["OnDscOrg"]), Serie = Convert.ToString(e.NewValues["Serie"]) //PASAR EL SERIALNUMBER PARA LUEGO HACER EL DATASOURCE AL DETALLE }; line.InDscOrg = (line.OnDscOrg == 0) ? 1 : 0; ((List <BEDocumentLine>)Session["dln1"]).Add(line); //Set_Promotion(); Set_LineNum2(); gdvdln1.CancelEdit(); e.Cancel = true; gdvdln1.DataSource = ((List <BEDocumentLine>)Session["dln1"]); gdvdln1.DataBind(); }
protected void gdvAsiento_RowInserting(object sender, ASPxDataInsertingEventArgs e) { gdvAsiento.DoRowValidation(); var obec = ((BEParameters)Session["InitPar"]); var line = new BEDocumentLine(); line.ShortName = Convert.ToString(e.NewValues["ShortName"]); line.AcctName = Convert.ToString(e.NewValues["AcctName"]); line.Account = Convert.ToString(e.NewValues["Account"]); line.Debit = Convert.ToDecimal(e.NewValues["Debit"]); line.Credit = Convert.ToDecimal(e.NewValues["Credit"]); line.LineMemo = Convert.ToString(e.NewValues["LineMemo"]); line.Ref1d = Convert.ToString(e.NewValues["Ref1d"]); line.Ref2d = Convert.ToString(e.NewValues["Ref2d"]); line.Ref3Line = Convert.ToString(e.NewValues["Ref3Line"]); var x1 = Convert.ToString(e.NewValues["DueDated"]).Substring(0, 10).Split('/'); line.DueDated = x1[1] + "/" + x1[0] + "/" + x1[2]; line.RefDated = Convert.ToString(DateTime.Today); var x2 = Convert.ToString(e.NewValues["TaxDated"]).Substring(0, 10).Split('/'); line.TaxDated = x2[1] + "/" + x2[0] + "/" + x2[2]; line.Projectd = Convert.ToString(e.NewValues["Projectd"]); ((List <BEDocumentLine>)Session["asientoPrinc"]).Add(line); Set_LineNum(); //gdvAsiento.JSProperties["cpSubTotal"] = ((List<BEDocumentLine>)Session["asiento"]).Sum(item => Math.Round(item.LineTotal, 2)); gdvAsiento.CancelEdit(); e.Cancel = true; gdvAsiento.DataSource = ((List <BEDocumentLine>)Session["asientoPrinc"]); gdvAsiento.DataBind(); }
protected void gdvArticulos_CustomCallback(object sender, ASPxGridViewCustomCallbackEventArgs e) { var obec = ((BEParameters)Session["InitPar"]); if (e.Parameters.Contains("ADD")) { var spl = e.Parameters.Split(':'); var line = new BEDocumentLine(); line.ItemCode = spl[1]; line.ItemName = spl[2]; line.Quantity = 1; line.WhsCode = cbbalmacenorigen.Value.ToString(); line.WareHouse = cbbalmacendestino.Value.ToString(); line.IssueMthd = spl[3]; line.Serie = ""; ((List <BEDocumentLine>)Session["wtr1"]).Add(line); } else if (e.Parameters.Contains("GET")) { var _spl = e.Parameters.Split(':'); var obep = new BEParameters() { Socied = obec.Socied, DocEntry = Convert.ToInt32(_spl[1]), }; var obrd = new BRDocument(); var list = obrd.DXP_GET_TRANSTOCK_DETALLE(obep); Session["wtr1"] = list; } else if (e.Parameters.Contains("CLR")) { ((List <BEDocumentLine>)Session["wtr1"]).Clear(); } gdvArticulos.DataSource = ((List <BEDocumentLine>)Session["wtr1"]); gdvArticulos.DataBind(); Set_LineNum(); }
protected void gdvrin1_CustomCallback(object sender, ASPxGridViewCustomCallbackEventArgs e) { var obec = ((BEParameters)Session["InitPar"]); if (e.Parameters.Contains("QK")) { var obep = new BEParameters() { Socied = obec.Socied, CardCode = txtCardCode.Text, PriceList = Convert.ToInt16(cbbListNum.Value), WhsCode = obec.WhsCode, ParValue = e.Parameters.Replace("QK:", "").ToUpper().Replace("K", "").Trim(), ColumnIndex = 0, Sw = 2 }; var obrd = new BRDocument(); var olst = obrd.Get_OSCSP_KITS(obep); var _qtk = (chkKit.Checked) ? Convert.ToInt32(txtQuantityKit.Text) : Convert.ToInt32(txtQKit.Text); olst.ForEach(item => { var line = new BEDocumentLine() { ItemCode = item.ItemCode, ItemName = item.ItemName, Quantity = _qtk, PriceBefDi = item.PriceBefDi, DiscPrcnt = item.DiscPrcnt, Price = item.Price, LineTotal = Convert.ToDecimal(_qtk * item.Price), GTotal = Convert.ToDecimal(_qtk * item.PriceVat), BatchNum = item.BatchNum, WhsCode = obec.WhsCode, U_BF_CodKit = item.U_BF_CodKit }; ((List <BEDocumentLine>)Session["rin1"]).Add(line); }); Set_LineNum(); } else if (e.Parameters.Contains("UPDTPRICE")) { var _spl = e.Parameters.Split(':'); ((List <BEDocumentLine>)Session["rin1"]).Where(i => (i.TreeType == "N" && i.Father == _spl[5])) .ToList().ForEach(item => { item.PriceBefDi = Convert.ToDecimal(_spl[1]); item.Price = Convert.ToDecimal(_spl[2]); item.LineTotal = Convert.ToDecimal(_spl[3]); item.GTotal = Convert.ToDecimal(_spl[4]); item.Quantity = Convert.ToInt32(_spl[6]); }); } else if (e.Parameters.Contains("CLR")) { Session["cnoi"] = null; ocno = new BEDocument(); ((List <BEDocumentLine>)Session["rin1"]).Clear(); } else if (e.Parameters.Contains("LM")) { var band = true; var suprimir = ""; var _spl = e.Parameters.Split(':'); var padre = _spl[1].Split(','); var obep = new BEParameters() { Socied = obec.Socied, ItemCode = Convert.ToString(padre[0]) }; var obrd = new BRDocument(); var olist = obrd.Get_ListdeMateriales(obep); if (olist.Count != 0) { olist.ForEach(item => { obep = new BEParameters() { Socied = obec.Socied, Project = obec.Project, CardCode = "", PriceList = Convert.ToInt16(_spl[2]), WhsCode = item.Warehouse, ParValue = item.Code, ColumnIndex = 0, Sw = 2, Kit = false }; var olst = obrd.Get_OSCSP_OITM_P(obep); var line = new BEDocumentLine(); if (band) { line.ItemCode = padre[0]; line.ItemName = padre[1]; line.PriceBefDi = Convert.ToDecimal(padre[3]); line.Quantity = 1; line.DiscPrcnt = Convert.ToDecimal(padre[4]); line.Price = Convert.ToDecimal(padre[5]); line.LineTotal = Convert.ToDecimal(padre[5]); line.GTotal = Convert.ToDecimal(padre[6]); line.IssueMthd = padre[7]; line.WhsCode = obec.WhsCode; line.TreeType = "S"; line.Father = padre[0]; line.NumInSale = Convert.ToInt32(padre[8]); band = false; suprimir = item.SUPRIMIR_MATERIALES; ((List <BEDocumentLine>)Session["rin1"]).Add(line); Set_LineNum(); } olst.ForEach(a => { var line2 = new BEDocumentLine(); line2.ItemCode = a.ItemCode; line2.ItemName = a.ItemName; line2.PriceBefDi = a.PriceBefDi; line2.Quantity = item.Quantity; line2.DiscPrcnt = a.DiscPrcnt; line2.Price = a.PriceBefDi - ((a.PriceBefDi * a.DiscPrcnt) / 100); line2.LineTotal = item.Quantity * a.Price; line2.GTotal = item.Quantity * a.PriceVat; line2.IssueMthd = a.IssueMthd; line2.WhsCode = obec.WhsCode; line2.TreeType = "I"; line2.Father = padre[0]; line2.NumInSale = item.Quantity; ((List <BEDocumentLine>)Session["rin1"]).Add(line2); Set_LineNum(); }); }); if (suprimir == "N") { ((List <BEDocumentLine>)Session["rin1"]).Where(i => i.TreeType == "S" && i.Father == padre[0]).ToList().ForEach(x => { x.PriceBefDi = Convert.ToDecimal(0.00); x.Price = Convert.ToDecimal(0.00); x.LineTotal = Convert.ToDecimal(0.00); x.GTotal = Convert.ToDecimal(0.00); }); } else if (suprimir == "Y") { ((List <BEDocumentLine>)Session["rin1"]).Where(i => i.TreeType == "I" && i.Father == padre[0]).ToList().ForEach(x => { x.PriceBefDi = Convert.ToDecimal(0.00); x.Price = Convert.ToDecimal(0.00); x.LineTotal = Convert.ToDecimal(0.00); x.GTotal = Convert.ToDecimal(0.00); }); } } else { var line = new BEDocumentLine(); //return; line.ItemCode = padre[0]; line.ItemName = padre[1]; line.PriceBefDi = Convert.ToDecimal(padre[3]); line.Quantity = 1; line.DiscPrcnt = Convert.ToDecimal(padre[4]); line.Price = Convert.ToDecimal(padre[5]); line.LineTotal = Convert.ToDecimal(padre[5]); line.GTotal = Convert.ToDecimal(padre[6]); line.IssueMthd = padre[7]; line.WhsCode = obec.WhsCode; line.TreeType = "N"; line.Father = padre[0]; line.NumInSale = Convert.ToInt32(padre[8]); band = false; //suprimir = item.SUPRIMIR_MATERIALES; ((List <BEDocumentLine>)Session["rin1"]).Add(line); Set_LineNum(); } } else if (e.Parameters.Contains("QTY")) { var _spl = e.Parameters.Split(':'); var band = true; ((List <BEDocumentLine>)Session["rin1"]).Where(i => ((i.TreeType == "I" || i.TreeType == "S" || i.TreeType == "N") && i.Father == _spl[2])) .ToList().ForEach(item => { band = false; if (item.TreeType == "N") { item.Quantity = Convert.ToInt32(_spl[1]); item.LineTotal = item.Quantity * item.Price; item.GTotal = item.LineTotal * Convert.ToDecimal(1.18); } else if (item.TreeType == "S" || item.TreeType == "I") { if (item.TreeType == "S") { item.Quantity = Convert.ToInt32(_spl[1]); item.LineTotal = item.Quantity * item.Price; item.GTotal = item.LineTotal * Convert.ToDecimal(1.18); } else if (item.TreeType == "I") { item.Quantity = Convert.ToInt32(item.NumInSale) * Convert.ToInt32(_spl[1]); item.LineTotal = item.Quantity * item.Price; item.GTotal = item.LineTotal * Convert.ToDecimal(1.18); } } }); if (band) { return; } } else if (e.Parameters.Contains("ADDPRODUCT")) { var _spl = e.Parameters.Split(':'); var obep = new BEParameters(); var obrd = new BRDocument(); var suprimir = ""; obep = new BEParameters() { Socied = obec.Socied, Project = obec.Project, CardCode = "", PriceList = Convert.ToInt16(_spl[2]), WhsCode = obec.WhsCode, ParValue = _spl[1], ColumnIndex = 0, Sw = 2, Kit = false, ItemCode = _spl[1] }; var articulo = obrd.Get_OSCSP_OITM_P(obep); var listamateriales = obrd.Get_ListdeMateriales(obep); if (listamateriales.Count == 0) { articulo.ForEach(item => { var line = new BEDocumentLine(); line.ItemCode = item.ItemCode; line.ItemName = item.ItemName; line.PriceBefDi = Convert.ToDecimal(item.PriceBefDi); line.Quantity = 1; line.DiscPrcnt = Convert.ToDecimal(item.DiscPrcnt); line.Price = Convert.ToDecimal(item.Price); line.LineTotal = Convert.ToDecimal(item.Price); line.GTotal = Convert.ToDecimal(item.PriceVat); line.IssueMthd = item.IssueMthd; line.WhsCode = obec.WhsCode; line.TreeType = "N"; line.Father = item.ItemCode; line.NumInSale = Convert.ToInt32(item.NumInSale); ((List <BEDocumentLine>)Session["rin1"]).Add(line); Set_LineNum(); }); } else { articulo.ForEach(i => { var line = new BEDocumentLine(); line.ItemCode = i.ItemCode; line.ItemName = i.ItemName; line.PriceBefDi = Convert.ToDecimal(i.PriceBefDi); line.Quantity = 1; line.DiscPrcnt = Convert.ToDecimal(i.DiscPrcnt); line.Price = Convert.ToDecimal(i.Price); line.LineTotal = Convert.ToDecimal(i.Price); line.GTotal = Convert.ToDecimal(i.PriceVat); line.IssueMthd = i.IssueMthd; line.WhsCode = obec.WhsCode; line.TreeType = "S"; line.Father = i.ItemCode; line.NumInSale = Convert.ToInt32(i.NumInSale); ((List <BEDocumentLine>)Session["rin1"]).Add(line); Set_LineNum(); listamateriales.ForEach(j => { obep = new BEParameters() { Socied = obec.Socied, Project = obec.Project, CardCode = "", PriceList = Convert.ToInt16(_spl[2]), WhsCode = obec.WhsCode, ParValue = j.Code, ColumnIndex = 0, Sw = 2, Kit = false }; var articulosdelista = obrd.Get_OSCSP_OITM_P(obep); suprimir = j.SUPRIMIR_MATERIALES; articulosdelista.ForEach(a => { var line2 = new BEDocumentLine(); line2.ItemCode = a.ItemCode; line2.ItemName = a.ItemName; line2.PriceBefDi = a.PriceBefDi; line2.Quantity = j.Quantity; line2.DiscPrcnt = a.DiscPrcnt; line2.Price = a.PriceBefDi - ((a.PriceBefDi * a.DiscPrcnt) / 100); line2.LineTotal = j.Quantity * a.Price; line2.GTotal = j.Quantity * a.PriceVat; line2.IssueMthd = a.IssueMthd; line2.WhsCode = obec.WhsCode; line2.TreeType = "I"; line2.Father = i.ItemCode; line2.NumInSale = j.Quantity; ((List <BEDocumentLine>)Session["rin1"]).Add(line2); Set_LineNum(); }); }); if (suprimir == "N") { ((List <BEDocumentLine>)Session["rin1"]).Where(a => (a.TreeType == "S" && a.Father == i.ItemCode)).ToList().ForEach(x => { x.PriceBefDi = Convert.ToDecimal(0.00); x.Price = Convert.ToDecimal(0.00); x.LineTotal = Convert.ToDecimal(0.00); x.GTotal = Convert.ToDecimal(0.00); }); } else if (suprimir == "Y") { ((List <BEDocumentLine>)Session["rin1"]).Where(a => (a.TreeType == "I" && a.Father == i.ItemCode)).ToList().ForEach(x => { x.PriceBefDi = Convert.ToDecimal(0.00); x.Price = Convert.ToDecimal(0.00); x.LineTotal = Convert.ToDecimal(0.00); x.GTotal = Convert.ToDecimal(0.00); }); } }); } } else if (e.Parameters.Contains("SRCH")) { var obep = new BEParameters() { Socied = obec.Socied, DocEntry = Convert.ToInt32(txtDocEntry.Text) }; var obrd = new BRDocument(); Session["rin1"] = obrd.Get_OSCSP_SRCH_RPC1(obep); } gdvrin1.JSProperties["cpSubTotal"] = ((List <BEDocumentLine>)Session["rin1"]).Sum(item => Math.Round(item.LineTotal, 2)); gdvrin1.CancelEdit(); gdvrin1.DataSource = ((List <BEDocumentLine>)Session["rin1"]); gdvrin1.DataBind(); }
protected void gdvinv1_CustomCallback(object sender, ASPxGridViewCustomCallbackEventArgs e) { var obec = ((BEParameters)Session["InitPar"]); if (e.Parameters.Contains("QK")) { var obep = new BEParameters() { Socied = obec.Socied, CardCode = txtCardCode.Text, PriceList = Convert.ToInt16(cbbListNum.Value), WhsCode = obec.WhsCode, ParValue = e.Parameters.Replace("QK:", "").ToUpper().Replace("K", "").Trim(), ColumnIndex = 0, Sw = 2 }; var obrd = new BRDocument(); var olst = obrd.Get_OSCSP_KITS(obep); var _qtk = (chkKit.Checked) ? Convert.ToInt32(txtQuantityKit.Text) : Convert.ToInt32(txtQKit.Text); olst.ForEach(item => { var line = new BEDocumentLine() { ItemCode = item.ItemCode, ItemName = item.ItemName, Quantity = _qtk, PriceBefDi = item.PriceBefDi, DiscPrcnt = item.DiscPrcnt, Price = item.Price, LineTotal = Convert.ToDecimal(_qtk * item.Price), GTotal = Convert.ToDecimal(_qtk * item.PriceVat), BatchNum = item.BatchNum, WhsCode = obec.WhsCode, U_BF_CodKit = item.U_BF_CodKit }; ((List <BEDocumentLine>)Session["inv1"]).Add(line); }); Set_LineNum(); } else if (e.Parameters.Contains("CLR")) { Session["cnoi"] = null; ((List <BEDocumentLine>)Session["inv1"]).Clear(); } else if (e.Parameters.Contains("SRCH")) { var obep = new BEParameters() { Socied = obec.Socied, DocEntry = Convert.ToInt32(txtDocEntry.Text) }; var obrd = new BRDocument(); Session["inv1"] = obrd.Get_OSCSP_SRCH_INV1(obep); } gdvinv1.JSProperties["cpSubTotal"] = ((List <BEDocumentLine>)Session["inv1"]).Sum(item => Math.Round(item.LineTotal, 2)); gdvinv1.CancelEdit(); gdvinv1.DataSource = ((List <BEDocumentLine>)Session["inv1"]); gdvinv1.DataBind(); }
protected void gdvrin1_CustomCallback(object sender, ASPxGridViewCustomCallbackEventArgs e) { var obec = ((BEParameters)Session["InitPar"]); if (e.Parameters.Contains("UPDTPRICE")) { var _spl = e.Parameters.Split(':'); ((List <BEDocumentLine>)Session["rin1"]).Where(i => (i.TreeType == "N" && i.Father == _spl[5])) .ToList().ForEach(item => { item.PriceBefDi = Convert.ToDecimal(_spl[1]); item.Price = Convert.ToDecimal(_spl[2]); item.LineTotal = Convert.ToDecimal(_spl[3]); item.GTotal = Convert.ToDecimal(_spl[4]); item.Quantity = Convert.ToDecimal(_spl[6]); }); } else if (e.Parameters.Contains("CLR")) { Session["cnoi"] = null; ocno = new BEDocument(); ((List <BEDocumentLine>)Session["rin1"]).Clear(); } else if (e.Parameters.Contains("LM")) { var band = true; var suprimir = ""; var _spl = e.Parameters.Split(':'); var padre = _spl[1].Split(','); var obep = new BEParameters() { Socied = obec.Socied, ItemCode = Convert.ToString(padre[0]) }; var obrd = new BRDocument(); var olist = obrd.Get_ListdeMateriales(obep); if (olist.Count != 0) { olist.ForEach(item => { obep = new BEParameters() { Socied = obec.Socied, Project = obec.Project, CardCode = "", PriceList = Convert.ToInt16(_spl[2]), WhsCode = cbbWareHouse.Value.ToString(), ParValue = item.Code, ColumnIndex = 0, Sw = 2, Kit = false, Moneda = cbbDocCur.Value.ToString(), DateIn = Convert.ToDateTime(dteDocDate.Text), Descripcion = "", SerieMaqr = "" }; var olst = obrd.Get_OSCSP_OITM_P(obep); var line = new BEDocumentLine(); if (band) { line.ItemCode = padre[0]; line.ItemName = padre[1]; line.PriceBefDi = Convert.ToDecimal(padre[3]); line.Quantity = 1; line.DiscPrcnt = Convert.ToDecimal(padre[4]); line.Price = Convert.ToDecimal(padre[5]); line.LineTotal = Convert.ToDecimal(padre[5]); line.GTotal = Convert.ToDecimal(padre[6]); line.IssueMthd = padre[7]; line.WhsCode = obec.WhsCode; line.TreeType = "S"; line.Father = padre[0]; line.NumInBuy = Convert.ToInt32(padre[8]); line.ActivoC = padre[9]; line.ActivoS = padre[10]; line.InvntItem = padre[11]; line.LastPurCur = padre[12]; band = false; suprimir = item.SUPRIMIR_MATERIALES; ((List <BEDocumentLine>)Session["rin1"]).Add(line); Set_LineNum(); } olst.ForEach(a => { var line2 = new BEDocumentLine(); line2.ItemCode = a.ItemCode; line2.ItemName = a.ItemName; line2.PriceBefDi = a.PriceBefDi; line2.Quantity = item.Quantity; line2.DiscPrcnt = a.DiscPrcnt; line2.Price = a.PriceBefDi - ((a.PriceBefDi * a.DiscPrcnt) / 100); line2.LineTotal = item.Quantity * a.Price; line2.GTotal = item.Quantity * a.PriceVat; line2.IssueMthd = a.IssueMthd; line2.WhsCode = obec.WhsCode; line2.TreeType = "I"; line2.Father = padre[0]; line2.NumInBuy = item.Quantity; line2.ActivoC = a.ActivoC; line2.ActivoS = a.ActivoS; line2.InvntItem = a.InvntItem; line2.LastPurCur = a.LastPurCur; ((List <BEDocumentLine>)Session["rin1"]).Add(line2); Set_LineNum(); }); }); if (suprimir == "N") { ((List <BEDocumentLine>)Session["rin1"]).Where(i => i.TreeType == "S" && i.Father == padre[0]).ToList().ForEach(x => { x.PriceBefDi = Convert.ToDecimal(0.00); x.Price = Convert.ToDecimal(0.00); x.LineTotal = Convert.ToDecimal(0.00); x.GTotal = Convert.ToDecimal(0.00); }); } else if (suprimir == "Y") { ((List <BEDocumentLine>)Session["rin1"]).Where(i => i.TreeType == "I" && i.Father == padre[0]).ToList().ForEach(x => { x.PriceBefDi = Convert.ToDecimal(0.00); x.Price = Convert.ToDecimal(0.00); x.LineTotal = Convert.ToDecimal(0.00); x.GTotal = Convert.ToDecimal(0.00); }); } } else { var line = new BEDocumentLine(); //return; line.ItemCode = padre[0]; line.ItemName = padre[1]; line.PriceBefDi = Convert.ToDecimal(padre[3]); line.Quantity = 1; line.DiscPrcnt = Convert.ToDecimal(padre[4]); line.Price = Convert.ToDecimal(padre[5]); line.LineTotal = Convert.ToDecimal(padre[5]); line.GTotal = Convert.ToDecimal(padre[6]); line.IssueMthd = padre[7]; line.WhsCode = obec.WhsCode; line.TreeType = "N"; line.Father = padre[0]; line.NumInBuy = Convert.ToInt32(padre[8]); line.ActivoC = padre[9]; line.ActivoS = padre[10]; line.InvntItem = padre[11]; line.LastPurCur = padre[12]; band = false; //suprimir = item.SUPRIMIR_MATERIALES; ((List <BEDocumentLine>)Session["rin1"]).Add(line); Set_LineNum(); } } else if (e.Parameters.Contains("QTY")) { var _spl = e.Parameters.Split(':'); var band = true; ((List <BEDocumentLine>)Session["rin1"]).Where(i => ((i.TreeType == "I" || i.TreeType == "S" || i.TreeType == "N") && i.Father == _spl[2])) .ToList().ForEach(item => { band = false; if (item.TreeType == "N") { item.Quantity = Convert.ToDecimal(_spl[1]); item.LineTotal = item.Quantity * item.Price; item.GTotal = item.LineTotal * Convert.ToDecimal(1.18); } else if (item.TreeType == "S" || item.TreeType == "I") { if (item.TreeType == "S") { item.Quantity = Convert.ToDecimal(_spl[1]); item.LineTotal = item.Quantity * item.Price; item.GTotal = item.LineTotal * Convert.ToDecimal(1.18); } else if (item.TreeType == "I") { item.Quantity = Convert.ToDecimal(item.NumInBuy) * Convert.ToDecimal(_spl[1]); item.LineTotal = item.Quantity * item.Price; item.GTotal = item.LineTotal * Convert.ToDecimal(1.18); } } }); if (band) { return; } } else if (e.Parameters.Contains("ADDPRODUCT")) { var _spl = e.Parameters.Split(':'); var obep = new BEParameters(); var obrd = new BRDocument(); var suprimir = ""; obep = new BEParameters() { Socied = obec.Socied, Project = obec.Project, CardCode = "", PriceList = Convert.ToInt16(_spl[2]), WhsCode = cbbWareHouse.Value.ToString(), ParValue = _spl[1], ColumnIndex = 0, Sw = 2, Kit = false, ItemCode = _spl[1], Moneda = cbbDocCur.Value.ToString(), DateIn = Convert.ToDateTime(dteDocDate.Text), Descripcion = "", SerieMaqr = "" }; var articulo = obrd.Get_OSCSP_OITM_P(obep); var listamateriales = obrd.Get_ListdeMateriales(obep); if (listamateriales.Count == 0) { articulo.ForEach(item => { var line = new BEDocumentLine(); line.ItemCode = item.ItemCode; line.ItemName = item.ItemName; line.PriceBefDi = Convert.ToDecimal(item.PriceBefDi); line.Quantity = 1; line.DiscPrcnt = Convert.ToDecimal(item.DiscPrcnt); line.Price = Convert.ToDecimal(item.Price); line.LineTotal = Convert.ToDecimal(item.Price); line.GTotal = Convert.ToDecimal(item.PriceVat); line.IssueMthd = item.IssueMthd; line.WhsCode = obec.WhsCode; line.TreeType = "N"; line.Father = item.ItemCode; line.NumInBuy = Convert.ToInt32(item.NumInBuy); line.ActivoC = item.ActivoC; line.ActivoS = item.ActivoS; line.InvntItem = item.InvntItem; line.LastPurCur = item.LastPurCur; ((List <BEDocumentLine>)Session["rin1"]).Add(line); Set_LineNum(); }); } else { articulo.ForEach(i => { var line = new BEDocumentLine(); line.ItemCode = i.ItemCode; line.ItemName = i.ItemName; line.PriceBefDi = Convert.ToDecimal(i.PriceBefDi); line.Quantity = 1; line.DiscPrcnt = Convert.ToDecimal(i.DiscPrcnt); line.Price = Convert.ToDecimal(i.Price); line.LineTotal = Convert.ToDecimal(i.Price); line.GTotal = Convert.ToDecimal(i.PriceVat); line.IssueMthd = i.IssueMthd; line.WhsCode = obec.WhsCode; line.TreeType = "S"; line.Father = i.ItemCode; line.NumInBuy = Convert.ToInt32(i.NumInBuy); line.ActivoC = i.ActivoC; line.ActivoS = i.ActivoS; line.InvntItem = i.InvntItem; line.LastPurCur = i.LastPurCur; ((List <BEDocumentLine>)Session["rin1"]).Add(line); Set_LineNum(); listamateriales.ForEach(j => { obep = new BEParameters() { Socied = obec.Socied, Project = obec.Project, CardCode = "", PriceList = Convert.ToInt16(_spl[2]), WhsCode = cbbWareHouse.Value.ToString(), ParValue = j.Code, ColumnIndex = 0, Sw = 2, Kit = false, Moneda = cbbDocCur.Value.ToString(), DateIn = Convert.ToDateTime(dteDocDate.Text), Descripcion = "", SerieMaqr = "" }; var articulosdelista = obrd.Get_OSCSP_OITM_P(obep); suprimir = j.SUPRIMIR_MATERIALES; articulosdelista.ForEach(a => { var line2 = new BEDocumentLine(); line2.ItemCode = a.ItemCode; line2.ItemName = a.ItemName; line2.PriceBefDi = a.PriceBefDi; line2.Quantity = j.Quantity; line2.DiscPrcnt = a.DiscPrcnt; line2.Price = a.PriceBefDi - ((a.PriceBefDi * a.DiscPrcnt) / 100); line2.LineTotal = j.Quantity * a.Price; line2.GTotal = j.Quantity * a.PriceVat; line2.IssueMthd = a.IssueMthd; line2.WhsCode = obec.WhsCode; line2.TreeType = "I"; line2.Father = i.ItemCode; line2.NumInBuy = j.Quantity; line2.ActivoC = a.ActivoC; line2.ActivoS = a.ActivoS; line2.InvntItem = a.InvntItem; line2.LastPurCur = a.LastPurCur; ((List <BEDocumentLine>)Session["rin1"]).Add(line2); Set_LineNum(); }); }); if (suprimir == "N") { ((List <BEDocumentLine>)Session["rin1"]).Where(a => (a.TreeType == "S" && a.Father == i.ItemCode)).ToList().ForEach(x => { x.PriceBefDi = Convert.ToDecimal(0.00); x.Price = Convert.ToDecimal(0.00); x.LineTotal = Convert.ToDecimal(0.00); x.GTotal = Convert.ToDecimal(0.00); }); } else if (suprimir == "Y") { ((List <BEDocumentLine>)Session["rin1"]).Where(a => (a.TreeType == "I" && a.Father == i.ItemCode)).ToList().ForEach(x => { x.PriceBefDi = Convert.ToDecimal(0.00); x.Price = Convert.ToDecimal(0.00); x.LineTotal = Convert.ToDecimal(0.00); x.GTotal = Convert.ToDecimal(0.00); }); } }); } } else if (e.Parameters.Contains("SRCH")) { var obep = new BEParameters() { Socied = obec.Socied, DocEntry = Convert.ToInt32(txtDocEntry.Text) }; var obrd = new BRDocument(); Session["rin1"] = obrd.Get_OSCSP_SRCH_RPC1(obep); } gdvrin1.JSProperties["cpSubTotal"] = ((List <BEDocumentLine>)Session["rin1"]).Sum(item => Math.Round(item.LineTotal, 2)); gdvrin1.CancelEdit(); gdvrin1.DataSource = ((List <BEDocumentLine>)Session["rin1"]); gdvrin1.DataBind(); }