protected void BtnMdlMargen_Click(object sender, EventArgs e) { double Valor; string ValStr = hdnvarslidermargen.Value.Replace(".", ","); if (double.TryParse(ValStr, out Valor)) { Cotizacion.UpdateRow row; row = new Cotizacion.UpdateRow(ID, "MARGEN", Valor); if (row.Actualizado) { Cot = new Cotizacion.GetRowInfo(ID, TOKEN, true); FillTablaDetalleyTotales(ID, true, Cot.MARGEN); GastosGrales(Cot); Descuento(Cot); Margen(Cot); } else { } } else { } }
protected void LinkbtnObs_Click(object sender, EventArgs e) { if (TxtObservacion.Enabled) { Cotizacion.UpdateRow row = new Cotizacion.UpdateRow(ID, "OBSERVA", TxtObservacion.Text); if (row.Actualizado) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "myalert", "alert('Información actualizada');", true); TxtObservacion.Enabled = false; LinkbtnObs.Text = "Editar"; } } else { TxtObservacion.Enabled = true; LinkbtnObs.Text = "Actualizar"; } }
protected void LinkBtnOtrosCostos_Click(object sender, EventArgs e) { if (PanelOtrosCosto.Visible) { //hay que hacer el update del costo double otros; PanelOtrosCosto.Visible = false; LinkBtnOtrosCostos.Text = "Editar Otros Costos"; if (double.TryParse(TxtOtrosCostos.Text, out otros)) { LblOtrosCostos.Visible = true; LblOtrosCostos.Text = "Otros Costos: " + otros.ToString("C0", CultureInfo.CurrentCulture); Cotizacion.UpdateRow row = new Cotizacion.UpdateRow(ID, "OTROSCOST", otros); if (row.Actualizado) { Cot = new Cotizacion.GetRowInfo(ID, TOKEN, true); double Subtotal = otros + Cot.COSTDIR + Cot.COSTMO + Cot.BENECONOM + Cot.GASTOSGEN; Updatetotales(); FillTablaTotales(otros, Cot.GASTOSGEN, Subtotal, Cot.DSCTOPORC); OTRosCostos(Cot); Descuento(Cot); Margen(Cot); } else { } } else { //mensaje de error formato de numeros } } else { PanelOtrosCosto.Visible = true; LinkBtnOtrosCostos.Text = "Actualizar"; LblOtrosCostos.Visible = false; } }
protected void BtnMdlDscto_Click(object sender, EventArgs e) { double Valor; string ValStr = HdnVarsliderdscto.Value.Replace(".", ","); if (double.TryParse(ValStr, out Valor)) { Cotizacion.UpdateRow row; row = new Cotizacion.UpdateRow(ID, "DSCTOPORC", Valor); if (row.Actualizado) { Cot = new Cotizacion.GetRowInfo(ID, TOKEN, true); double costos = Cot.COSTMO + Cot.COSTDIR + Cot.OTROSCOST + Cot.GASTOSGEN + Cot.BENECONOM; GetDescuento descuento = new GetDescuento(Valor, costos); row = new Cotizacion.UpdateRow(ID, "DSCTO", descuento.Descuento); Cot.DSCTOPORC = Valor; Cot.DSCTO = descuento.Descuento; double NetoTotal = descuento.Resultado; row = new Cotizacion.UpdateRow(ID, "NETO", NetoTotal); Cot.NETO = NetoTotal; double IvaTotal = Math.Round(NetoTotal * 0.19, 0); row = new Cotizacion.UpdateRow(ID, "IVA", IvaTotal); Cot.IVA = IvaTotal; double brutoTotal = NetoTotal + IvaTotal; row = new Cotizacion.UpdateRow(ID, "BRUTO", brutoTotal); Cot.BRUTO = brutoTotal; FillTablaDetalleyTotales(ID, true, Cot.MARGEN); GastosGrales(Cot); Descuento(Cot); Margen(Cot); } else { } } else { } }
protected void LinkBtnGGral_Click(object sender, EventArgs e) { if (PanelGgral.Visible) { double gastos; PanelGgral.Visible = false; LinkBtnGGral.Text = "Editar gastos generales"; if (double.TryParse(TxtGGral.Text, out gastos)) { LblGGral.Visible = true; LblGGral.Text = "Gastos generales" + gastos.ToString("C0", CultureInfo.CurrentCulture); Cotizacion.UpdateRow row = new Cotizacion.UpdateRow(ID, "GASTOSGEN", gastos); if (row.Actualizado) { Cot = new Cotizacion.GetRowInfo(ID, TOKEN, true); Updatetotales(); double Subtotal = Cot.OTROSCOST + Cot.COSTDIR + Cot.COSTMO + Cot.BENECONOM + gastos; FillTablaTotales(Cot.OTROSCOST, gastos, Subtotal, Cot.DSCTOPORC); GastosGrales(Cot); Descuento(Cot); Margen(Cot); } else { } } else { } } else { PanelGgral.Visible = true; LinkBtnGGral.Text = "Actualizar"; LblGGral.Visible = false; } }
protected void LinkValidez_Click(object sender, EventArgs e) { if (LinkValidez.Text == "Cambiar") { LinkValidez.Text = "Actualizar"; TxtValidez.Enabled = true; } else { TxtValidez.Enabled = false; LinkValidez.Text = "Cambiar"; //hacer el update de la fecha DateTime date; if (DateTime.TryParse(TxtValidez.Text, out date)) { Cotizacion.UpdateRow update = new Cotizacion.UpdateRow(ID, "VALIDEZ", date); } else { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "myalert", "alert('Error al actualizar la fecha.');", true); } } }