コード例 #1
0
 private void cmdBuscar_Click(object sender, EventArgs e)
 {
     if (!txtTiquete.Text.Equals(""))
     {
         venta = cp.consultarVentaExpo(long.Parse(txtTiquete.Text));
         if (venta != null)
         {
             txtCliente.Text = venta.Cliente;
             txtPlaca.Text = venta.Placa;
         }
         else
         {
             MessageBox.Show("Venta no existe", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
 }
コード例 #2
0
ファイル: VentasDAO.cs プロジェクト: jlsarmientoh/EstacionDB
        public List<VentaVO> consultarVentasAgrupadas(DateTime fecha1, DateTime fecha2)
        {
            List<VentaVO> ventas = new List<VentaVO>();
            try
            {
                string sqlQuery = "Select v.Fecha, v.Nit, sum(v.Total), v.ModoPago From EstacionDB.VO.VentaVO v Where Fecha Between :Fecha1 And :Fecha2 Group By v.Fecha, v.Nit, v.ModoPago";
                IQuery query = ConnectionHelper.getCurrentSession(Utilidades.Utilidades.configExpo).CreateQuery(sqlQuery);
                query.SetParameter("Fecha1", fecha1);
                query.SetParameter("Fecha2", fecha2);
                IList tmp = query.List();

                foreach (object[] venta in tmp)
                {
                   VentaVO v = new VentaVO();
                   v.Fecha = DateTime.Parse(venta[0].ToString());
                   v.Nit = venta[1].ToString();
                   v.Total = double.Parse(venta[2].ToString());
                   v.ModoPago = long.Parse(venta[3].ToString());
                   ventas.Add(v);
                }

                ConnectionHelper.CloseSession();

                return ventas;
            }
            catch (System.Exception ex)
            {
                ConnectionHelper.CloseSession();
                throw new EstacionDBException("Error al leer la información de la vista Ventas.", ex);

            }
        }
コード例 #3
0
ファイル: VentasDAO.cs プロジェクト: jlsarmientoh/EstacionDB
        public int guardarVenta(VentaVO venta)
        {
            int rows = 0;
            ITransaction tx = null;
            try
            {
                ISession session = ConnectionHelper.getCurrentSession(Utilidades.Utilidades.configExpo);
                tx = session.BeginTransaction();

                if (venta.Tiquete != 0)
                {
                    session.Update(venta);
                }
                else
                {
                    session.Save(venta);
                }

                tx.Commit();
                rows++;

                ConnectionHelper.CloseSession();

                return rows;

            }
            catch (System.Exception ex)
            {
                if (tx != null)
                {
                    tx.Rollback();
                }
                ConnectionHelper.CloseSession();
                throw new EstacionDBException("Error al leer la información de la tabla ventas.", ex);
            }
        }
コード例 #4
0
 public int guardarVenta(VentaVO venta)
 {
     try
     {
         return getVentasDAO().guardarVenta(venta);
     }
     catch (EstacionDBException ex)
     {
         throw new PersistenciaException("Error en la actualizacion de las ventas en DB app.", ex);
     }
 }
コード例 #5
0
        private void cmdGuardar_Click(object sender, EventArgs e)
        {
            String resumen = "";
            resumen = "Resumen del cierre:\n\n" +
                "\tCreditos:\t\t\t$ " + String.Format("{0,10:#,0.00}", totalCredito) + "\n" +
                "\tEfectivo:\t\t\t$ " + String.Format("{0,10:#,0.00}", totalEfectivo) + "\n" +
                "\tSodexho:\t\t\t$ " + String.Format("{0,10:#,0.00}", totalSodexo) + "\n" +
                "\tBig Pass:\t\t\t$ " + String.Format("{0,10:#,0.00}", totalBigPass) + "\n" +
                "\tTarjetas:\t\t\t$ " + String.Format("{0,10:#,0.00}", totalTarjetas) + "\n" +
                "\tTarjeta Plus:\t\t$ " + String.Format("{0,10:#,0.00}", totalPlus) + "\n" +
                "\tTicket Prom:\t\t$ " + String.Format("{0,10:#,0.00}", totalTicketTronik) + "\n" +
                "\tOtros:\t\t\t$ " + String.Format("{0,10:#,0.00}", totalOtros) + "\n" +
                "TOTAL:\t\t\t$ " + String.Format("{0,10:#,0.00}", totalVentas) + "\n\n" +
                "¿Desea continuar con el cierre?\n";
            DialogResult res = MessageBox.Show(resumen, "Resumen del cierre", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
            if (res == DialogResult.Yes)
            {
                DateTime fecha = new DateTime(fechaDesdePicker.Value.Year, fechaDesdePicker.Value.Month, fechaDesdePicker.Value.Day);
                this.UseWaitCursor = true;
                CierreVentasVO cierre = new CierreVentasVO();
                cierre.CodEmpleado = long.Parse(cboEmpleados.SelectedValue.ToString());
                cierre.Isla = long.Parse(txtIsla.Text.Trim());
                cierre.Turno = long.Parse(txtTurno.Text.Trim());
                cierre.Efectivo = totalEfectivo;
                cierre.Creditos = totalCredito;
                cierre.Sodexo = totalSodexo;
                cierre.BigPass = totalBigPass;
                cierre.Tarjetas = totalTarjetas;
                cierre.TarjetaPlus = totalPlus;
                cierre.Otros = totalOtros;
                cierre.TicketTronik = totalTicketTronik;
                cierre.TotalVentas = totalVentas;
                cierre.Fecha = fechaDesdePicker.Value;

                if (cp.existeCierre(cierre.CodEmpleado, cierre.Turno, cierre.Isla, fecha, fecha) == 0)
                {

                    int rows = 0;
                    int rowsTurno = 0;

                    rows = cp.guardarCierre(cierre);

                    if (rows > 0)
                    {

                        System.Collections.IList tmpVentas = ventaVOBindingSource.List;
                        VentaVO[] ventas = new VentaVO[tmpVentas.Count];
                        tmpVentas.CopyTo(ventas, 0);
                        ventasExportar = new List<VentaVO>(ventas);

                        rows = cp.guardarVentasDia(ventasExportar);
                        rowsTurno = cp.guardarProductosTurno(productosTurno);
                        MessageBox.Show("Se guardaron (" + rows + ") ventas en este cierre", "Resultado del cierre ", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        totalEfectivo = 0;
                        totalOtros = 0;
                        totalSodexo = 0;
                        totalBigPass = 0;
                        totalCredito = 0;
                        totalTarjetas = 0;
                        totalPlus = 0;
                        totalTicketTronik = 0;
                        totalVentas = 0;
                        totalConsumos = 0;

                        restaurarCampos();
                    }
                    else
                    {
                        MessageBox.Show("No se pudo registrar el cierre", "Resultado del cierre ", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else
                {
                    MessageBox.Show("Ya se ha realizado cierre para la fecha seleccionada", "Resultado del cierre ", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }

                UseWaitCursor = false;
            }
        }