protected void NewRemito_Click(object sender, EventArgs e) { Data2.Class.Struct_Remito R = new Data2.Class.Struct_Remito(Conversion.ObtenerLocal(UserId)); R.set_SUPPLIER(int.Parse(cmb_Providers.SelectedValue)); Session.Add(RemitoString, R); redirectome(); }
protected void cmb_Providers_SelectedIndexChanged(object sender, EventArgs e) { Data2.Class.Struct_Remito R = Session[RemitoString] as Data2.Class.Struct_Remito; R.set_SUPPLIER(int.Parse(cmb_Providers.SelectedValue)); Session.Remove(RemitoString); Session.Add(RemitoString, R); }
private void agregararticulo(string idart, string cant) { int idarticulo = int.Parse(idart); Data2.Class.Struct_Remito R = ObtenerRemito(); R.AddArticle(idarticulo, cant); R.ListaArticulos[R.ListaArticulos.Count - 1].setCANT(cant); Session.Remove(RemitoString); Session.Add(RemitoString, R); redirectome(); }
Data2.Class.Struct_Remito ObtenerRemito() { if (Session[RemitoString] != null) { Data2.Class.Struct_Remito R = Session[RemitoString] as Data2.Class.Struct_Remito; return(R); } else { return(null); } }
void LoadProviders() { if (!IsPostBack) { DataTable DT = Data2.Connection.D_Supplier.Get_AllShort(Conversion.ObtenerLocal(UserId)); cmb_Providers.Items.Clear(); if (DT != null && DT.Rows.Count > 0) { foreach (DataRow D in DT.Rows) { string nombreproveedor = D["Nombre"].ToString(); if (nombreproveedor == "") { nombreproveedor = D["NombreFantasía"].ToString(); } System.Web.UI.WebControls.ListItem LI = new System.Web.UI.WebControls.ListItem(nombreproveedor, D["Id"].ToString()); cmb_Providers.Items.Add(LI); } } if (ObtenerRemito() != null && ObtenerRemito().get_SUPPLIER() != null) { int selectedindex = 0; Data2.Class.Struct_Remito SR = ObtenerRemito(); for (int a = 0; a < cmb_Providers.Items.Count; a++) { if (ObtenerRemito().get_SUPPLIER().Id.ToString() == cmb_Providers.Items[a].Value) { selectedindex = a; break; } } cmb_Providers.SelectedIndex = selectedindex; } } else { if (ObtenerRemito() != null && ObtenerRemito().get_SUPPLIER() != null) { if (cmb_Providers.SelectedValue != ObtenerRemito().get_SUPPLIER().Id.ToString()) { Data2.Class.Struct_Remito SR = ObtenerRemito(); SR.ListaArticulos.Clear(); SR.set_SUPPLIER(int.Parse(cmb_Providers.SelectedValue)); } } } }
protected void btnAceptarFactura_Click(object sender, EventArgs e) { Data2.Class.Struct_Remito Remito = ObtenerRemito(); if (Remito != null) { Data2.Statics.Log.ADD(txt_numeroremito.Text, this); Remito.NUMEROREMITO = txt_numeroremito.Text; if (Remito.SaveRemito()) { Session.Remove(RemitoString); redirectome(); } else { redirectome(); } } }
private void borrarart(string delart) { if (ObtenerRemito() != null) { Data2.Class.Struct_Remito R = Session[RemitoString] as Data2.Class.Struct_Remito; foreach (Data2.Class.Struct_DetalleRemito ART in R.ListaArticulos) { if (ART.P.Id.ToString() == delart) { R.ListaArticulos.Remove(ART); Session.Remove(RemitoString); Session.Add(RemitoString, R); break; } } redirectome(); } }
void CargarGrilla() { decimal total = 0; tb_Detalle.ClientIDMode = System.Web.UI.ClientIDMode.Static; if (ObtenerRemito() != null && ObtenerRemito().ListaArticulos != null && ObtenerRemito().ListaArticulos.Count > 0) { bool alternatecolorow = false; Data2.Class.Struct_Remito R = Session[RemitoString] as Data2.Class.Struct_Remito; for (int a = 0; a < R.ListaArticulos.Count; a++) { string classnamerow = ""; HtmlGenericControl TR = new HtmlGenericControl("tr"); // fila HtmlGenericControl td_borrar = new HtmlGenericControl("td"); HtmlGenericControl td_detalle = new HtmlGenericControl("td"); HtmlGenericControl td_cantidad = new HtmlGenericControl("td"); HtmlGenericControl td_precio = new HtmlGenericControl("td"); HtmlGenericControl td_total = new HtmlGenericControl("td"); if (alternatecolorow == true) { alternatecolorow = false; classnamerow = "metroparline"; } else { alternatecolorow = true; classnamerow = "metroimparline"; } classnamerow = classnamerow + " animationline"; TR.Attributes.Add("class", classnamerow); td_borrar.InnerText = "Borrar Art."; td_borrar.Attributes.Add("class", "BorrarArtButton"); td_borrar.Attributes.Add("onclick", "BorrarArt('" + R.ListaArticulos[a].P.Id + "');"); td_detalle.InnerText = R.ListaArticulos[a].P.Descripcion; td_detalle.Attributes.Add("class", "descripcionarticulo"); decimal cant = 0; if (R.ListaArticulos[a].IsDecimal == true) { td_cantidad.InnerText = R.ListaArticulos[a].CANTDEC.ToString(); cant = R.ListaArticulos[a].CANTDEC; } else { td_cantidad.InnerText = R.ListaArticulos[a].CANTINT.ToString(); cant = Data2.Statics.Conversion.GetDecimal(R.ListaArticulos[a].CANTINT.ToString()); } td_precio.InnerText = R.ListaArticulos[a].P.PrecioCompra.ToString(); total = total + (cant * R.ListaArticulos[a].P.PrecioCompra); td_total.InnerText = (cant * R.ListaArticulos[a].P.PrecioCompra).ToString(); TR.Controls.Add(td_borrar); TR.Controls.Add(td_detalle); TR.Controls.Add(td_cantidad); TR.Controls.Add(td_precio); TR.Controls.Add(td_total); tb_Detalle.Controls.Add(TR); } HtmlGenericControl TR_rowtotal = new HtmlGenericControl("tr"); TR_rowtotal.Attributes.Add("class", "colorpiedefactura"); HtmlGenericControl TD_total = new HtmlGenericControl("td"); HtmlGenericControl TD_totalmonto = new HtmlGenericControl("td"); TD_total.Attributes.Add("class", "labelpiedefactura"); TD_total.Attributes.Add("colspan", "4"); TD_total.InnerText = "Total:"; TD_totalmonto.InnerText = total.ToString(); TD_totalmonto.Attributes.Add("class", "labelpiedefactura"); TR_rowtotal.Controls.Add(TD_total); TR_rowtotal.Controls.Add(TD_totalmonto); tb_Detalle.Controls.Add(TR_rowtotal); } }