protected void btn_factura_Click(object sender, EventArgs e) { try { if (txt_abono.Value == "") { string scripts = @"<script type='text/javascript'> alert('Para guardar un abono tiene que digitar un monto!'); document.getElementById('cabecera').style.display = 'block'; document.getElementById('seccionAbono').style.display = 'block'; </script>"; ScriptManager.RegisterStartupScript(this, typeof(Page), "alerta", scripts, false); txt_abono.Focus(); } else { DateTime date = DateTime.Now; String date2 = date.ToString("yyyy-MM-dd"); Double abono = Convert.ToDouble(txt_abono.Value); if (abono > saldoVenta) { string scripts = @"<script type='text/javascript'> alert('El monto del abono no puede ser mayor al saldo pendiente!'); document.getElementById('cabecera').style.display = 'block'; </script>"; ScriptManager.RegisterStartupScript(this, typeof(Page), "alerta", scripts, false); txt_abono.Value = ""; txt_abono.Focus(); } else { if (abono == saldoVenta) { cuenta.ActualizarSaldo(codigoVenta, 0); cuenta.AgregarAbono(codigoVenta, abono.ToString(), date2); } else { cuenta.ActualizarSaldo(codigoVenta, saldoVenta - abono); cuenta.AgregarAbono(codigoVenta, abono.ToString(), date2); } string script = @"<script type='text/javascript'> alert('El abono se registró correctamente!'); </script>"; ScriptManager.RegisterStartupScript(this, typeof(Page), "alerta", script, false); Gridview_CxC.DataSource = cuenta.CuentaXCobrar(); Gridview_CxC.DataBind(); txt_abono.Value = ""; } } } catch { string scripts = @"<script type='text/javascript'> alert('No se pudo realizar la operación!'); </script>"; ScriptManager.RegisterStartupScript(this, typeof(Page), "alerta", scripts, false); } }
protected void Page_Load(object sender, EventArgs e) { if (Session["acceder"] == null) { Response.Redirect("frmLogin.aspx"); } else { if (!this.IsPostBack) { txtSearch.Focus(); try { if (cuenta.CuentaXCobrar().Rows.Count == 0) { string scripts = @"<script type='text/javascript'> alert('No hay cuentas por cobrar'); </script>"; ScriptManager.RegisterStartupScript(this, typeof(Page), "alerta", scripts, false); } else { string scripts = @"<script type='text/javascript'> document.getElementById('presentar').style.display = 'block'; </script>"; ScriptManager.RegisterStartupScript(this, typeof(Page), "alerta", scripts, false); Gridview_CxC.DataSource = cuenta.CuentaXCobrar(); Gridview_CxC.DataBind(); } } catch { string scripts = @"<script type='text/javascript'> alert('No se pudo realizar la operación!'); </script>"; ScriptManager.RegisterStartupScript(this, typeof(Page), "alerta", scripts, false); } } } }
protected void Gridview_CxC_PageIndexChanging(object sender, GridViewPageEventArgs e) { Gridview_CxC.DataSource = cuenta.CuentaXCobrar2(txtSearch.Text.Trim()); Gridview_CxC.PageIndex = e.NewPageIndex; Gridview_CxC.DataBind(); }
protected void InvisButton_Click(object sender, EventArgs e) { Gridview_CxC.DataSource = cuenta.CuentaXCobrar2(txtSearch.Text.Trim()); Gridview_CxC.DataBind(); }