Example #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["acceder"] == null)
     {
         Response.Redirect("frmLogin.aspx");
     }
     else
     {
         if (!this.IsPostBack)
         {
             txtSearch.Focus();
             if (venta.TodaslasVentas().Rows.Count > 0)
             {
                 Gridview_Paciente.DataSource = venta.TodaslasVentas();
                 Gridview_Paciente.DataBind();
             }
             else
             {
                 string script = @"<script type='text/javascript'>
                 alert('No hay ventas registradas!');                
                 </script>";
                 ScriptManager.RegisterStartupScript(this, typeof(Page), "alerta", script, false);
             }
         }
     }
 }
Example #2
0
        protected void Gridview_Paciente_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            Gridview_Paciente.DataSource = venta.VentaPendiente2(txtSearch.Text.Trim());
            Gridview_Paciente.PageIndex  = e.NewPageIndex;
            Gridview_Paciente.DataBind();
            string script = @"<script type='text/javascript'>
                        document.getElementById('cabecera').style.display = 'none';
                        document.getElementById('titulo1').style.display = 'none';
                        </script>";

            ScriptManager.RegisterStartupScript(this, typeof(Page), "alerta", script, false);
        }
Example #3
0
 protected void Gridview_Paciente_PageIndexChanging(object sender, GridViewPageEventArgs e)
 {
     try
     {
         Gridview_Paciente.DataSource = venta.TodaslasVentas2(txtSearch.Text.Trim());
         Gridview_Paciente.PageIndex  = e.NewPageIndex;
         Gridview_Paciente.DataBind();
     }
     catch
     {
     }
 }
Example #4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["acceder"] == null)
     {
         Response.Redirect("frmLogin.aspx");
     }
     else
     {
         if (!this.IsPostBack)
         {
             txtSearch.Focus();
             try
             {
                 tblInicio = venta.VentaPendiente();
                 if (tblInicio.Rows.Count > 0)
                 {
                     Gridview_Paciente.DataSource = tblInicio;
                     Gridview_Paciente.DataBind();
                     string script = @"<script type='text/javascript'>
                 document.getElementById('titulo1').style.display = 'block';
                 </script>";
                     ScriptManager.RegisterStartupScript(this, typeof(Page), "alerta", script, false);
                 }
                 else
                 {
                     string script = @"<script type='text/javascript'>
                 document.getElementById('titulo1').style.display = 'none';
                 alert('No hay ventas nuevas sin terminar');
                 </script>";
                     ScriptManager.RegisterStartupScript(this, typeof(Page), "alerta", script, false);
                 }
                 //else
                 //{
                 //    string script = @"<script type='text/javascript'>
                 //alert('No hay ventas nuevas sin terminar');
                 //</script>";
                 //    ScriptManager.RegisterStartupScript(this, typeof(Page), "alerta", script, false);
                 //}
             }
             catch
             {
             }
         }
     }
 }
Example #5
0
        protected void InvisButton_Click(object sender, EventArgs e)
        {
            Gridview_Paciente.DataSource = venta.VentaPendiente2(txtSearch.Text.Trim());
            Gridview_Paciente.DataBind();

            if (Gridview_Paciente.Rows.Count > 0)
            {
                string script = @"<script type='text/javascript'>
                        document.getElementById('cabecera').style.display = 'none';
                        document.getElementById('titulo1').style.display = 'block';
                        </script>";
                ScriptManager.RegisterStartupScript(this, typeof(Page), "alerta", script, false);
            }
            else
            {
                string script = @"<script type='text/javascript'>
                        document.getElementById('cabecera').style.display = 'none';
                        document.getElementById('titulo1').style.display = 'none';
                        </script>";
                ScriptManager.RegisterStartupScript(this, typeof(Page), "alerta", script, false);
            }
        }
Example #6
0
        protected void btn_factura_Click(object sender, EventArgs e)
        {
            try
            {
                double abono = 0;
                double total = Convert.ToDouble(lbl_total.InnerText);
                double extra = 0;
                if (txt_extra.Value != "")
                {
                    extra = Convert.ToDouble(txt_extra.Value);
                }
                if (txt_abono.Value != "")
                {
                    abono = Convert.ToDouble(txt_abono.Value);
                }
                double totalFinal = total + extra;
                double saldo      = totalFinal - abono;
                if (abono > totalFinal)
                {
                    string scripts = @"<script type='text/javascript'>
                    alert('El abono no puede ser mayor al total de la venta!');
                    document.getElementById('cabecera').style.display = 'block';
                    </script>";
                    ScriptManager.RegisterStartupScript(this, typeof(Page), "alerta", scripts, false);
                    txt_abono.Value = "";
                    txt_abono.Focus();
                }
                else
                {
                    String   codigo  = "";
                    String   fecha2  = "";
                    String   detalle = "";
                    DateTime date    = DateTime.Now;
                    String   date2   = date.ToString("yyyy-MM-dd HH:mm:ss");
                    for (int i = 0; i <= limite; i++)
                    {
                        DateTime fecha = Convert.ToDateTime(tabla1.Rows[i][1]);
                        fecha2    = fecha.ToString("yyyy-MM-dd HH:mm:ss");
                        codigo    = venta.CodigoExpedienteTratamiento(fecha2);
                        vector[i] = codigo;
                        detalle   = detalle + tabla1.Rows[i][0] + " | ";
                    }
                    venta.AgregarVenta(cedula, date2, detalle, totalFinal.ToString(), saldo.ToString());
                    // Si el queda saldo pendiente, se agrega la venta como un abono
                    if (abono < totalFinal & abono > 0)
                    {
                        String codigoVenta = venta.UltimaVenta();
                        venta.AgregarAbono(codigoVenta, txt_abono.Value, date2);
                    }

                    // Asigna valor de true a los tratamientos que ya se pagaron
                    for (int i = 0; i <= limite; i++)
                    {
                        venta.TerminarVenta(vector[i]);
                    }
                    txt_abono.Value = "";
                    txt_extra.Value = "";
                    string script = @"<script type='text/javascript'>
                    alert('La venta se registró correctamente!');
                    </script>";
                    ScriptManager.RegisterStartupScript(this, typeof(Page), "alerta", script, false);
                    Gridview_Paciente.DataSource = venta.VentaPendiente();
                    Gridview_Paciente.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);
            }
        }
Example #7
0
 protected void InvisButton_Click(object sender, EventArgs e)
 {
     Gridview_Paciente.DataSource = venta.TodaslasVentas2(txtSearch.Text.Trim());
     Gridview_Paciente.DataBind();
 }