Esempio n. 1
0
        protected void saveToTickets(object sender, EventArgs e)
        {
            string queryInv = "";

            string query = "select * from Tabla_Catalogo_TicketTemp";
            Helpers h = new Helpers();
            var oneTemp = new Tabla_Catalogo_Ticket();
            var lTemporal = h.GetAllParametized(query, oneTemp);
            string queryInsert = "insert into Tabla_Catalogo_Ticket (No_Tiket, Id_Medicamento, NombreMedicamento, RazonSocial, Costo, Fecha) values (@No_Tiket, @Id_Medicamento, @NombreMedicamento, @RazonSocial, @Costo, @Fecha)";
            var oneT = new Tabla_Catalogo_TicketDTO();
            string queryLast = "SELECT TOP 1 No_Tiket FROM Tabla_Catalogo_Ticket ORDER BY No_Tiket DESC";
            var lIdTemplate = h.GetAllParametized(queryLast, oneT);
            if (lIdTemplate.Count == 0)
            {
                oneT.No_Tiket = 0;
            }
            else
            {
                oneT.No_Tiket = lIdTemplate[0].No_Tiket + 1;
            }
            foreach (var y in lTemporal)
            {
                var oneTemplate = new Tabla_Catalogo_TicketDTO();
                oneTemplate.Id_Medicamento = y.Id_Medicamento;
                oneTemplate.No_Tiket = oneT.No_Tiket;
                oneTemplate.NombreMedicamento = y.NombreMedicamento;
                oneTemplate.RazonSocial = "";
                oneTemplate.Costo = y.Costo;

                oneTemplate.Fecha = DateTime.Now;

                h.ExecuteNonQueryParam(queryInsert, oneTemplate);

                queryInv = "update Tabla_Catalogo_ProductosFarmacia set Existencias = Existencias - 1 where Id_Productos = "+y.Id_Medicamento+"";
                h.ExecuteNonQueryParam(queryInv, oneTemp);
            }

               // string script = "AlertaGuardar();";
               // ScriptManager.RegisterStartupScript(this, GetType(), "ServerControlScript", script, true);
            borrar();
            loadTemporal();
            ticket();

            if (CheckboxFacturar.Checked == true)
            {
                Response.Redirect("Facturar.aspx?No_Tiket="+oneT.No_Tiket);
            }
            return;
        }
Esempio n. 2
0
 public void ticket()
 {
     Helpers h = new Helpers();
     var oneT = new Tabla_Catalogo_TicketDTO();
     string queryLast = "SELECT TOP 1 No_Tiket FROM Tabla_Catalogo_Ticket ORDER BY No_Tiket DESC";
     var lIdTemplate = h.GetAllParametized(queryLast, oneT);
     lblTicket.Text = (lIdTemplate[0].No_Tiket + 1).ToString();
 }