Exemple #1
0
        public async Task <ActionResult <TiquetViewModel> > PostTiquete([FromBody] TiquetInputModel tiqueteModel)
        {
            Tiquet tiquet = new Tiquet()
            {
                PersonaId = tiqueteModel.PersonaId,
                RutaId    = tiqueteModel.RutaId
            };

            _context.Add(tiquet);
            await _context.SaveChangesAsync();

            return(new TiquetViewModel(tiquet));
        }
 public TiquetViewModel(Tiquet tiquet)
 {
     Id        = tiquet.Id;
     PersonaId = tiquet.PersonaId;
     RutaId    = tiquet.RutaId;
     if (tiquet.Ruta != null)
     {
         Ruta = new RutaViewModel(tiquet.Ruta);
     }
     if (tiquet.Persona != null)
     {
         Persona = new PersonaViewModel(tiquet.Persona);
     }
 }
Exemple #3
0
        private void btnVenta_Click(object sender, RoutedEventArgs e)
        {
            Vale vale = new Vale();

            vale.Fecha          = txbVentaFecha.Text;
            vale.Folio          = txbVentaFolio.Text;
            vale.NombreCliente  = cmbVentaCliente.SelectedItem as Cliente;
            vale.NombreEmpleado = cmbVentaEmpleado.SelectedItem as Usuario;
            float total = 0;

            //double iva = 0.16;
            foreach (Venta item in venta)
            {
                total        += item.Total;
                txbTotal.Text = total.ToString();

                //vale.Total = txbTotal.Text;
                //ActualizarTablaVales();
            }
            vale.Total = total.ToString();
            if (manejadorVales.Agregar(vale))
            {
                ActualizarTablaVales();
            }
            if (venta.Count == 0)
            {
                MessageBox.Show("No tiene ningun producto en la lista", "venta", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
            //vale.Total = txbTotal.Text;
            //ActualizarTablaVales();
            MessageBox.Show("La Venta Es:.....\nTotal " + total.ToString(), "venta", MessageBoxButton.OK, MessageBoxImage.Information);
            Tiquet reporte = new Tiquet(txbVentaFolio.Text + ".poo");

            vale.Total = txbTotal.Text;
            ActualizarTablaVales();
            string an = "";

            an = string.Format("FARMACIA\nFecha:{0}\nFolio:{1}\nCliente:{2}\nEmpleado:{3}\n", txbVentaFecha.Text, txbVentaFolio.Text, cmbVentaCliente.Text, cmbVentaEmpleado.Text);
            string al = "";

            foreach (Venta item in venta)
            {
                al += string.Format("producto:{0}\nCategoria:{1}\nPrecio:{2}\nCantidad:{3}\nTotal a Pagar:{4}\n", item.Producto, item.Categoria, item.Costo, item.cantidad, item.Total);
            }
            string san = string.Format("SubTotal:{0}\nTotal:{1}", total.ToString(), (total + (total)));

            reporte.Guardar(an + al + san);
            vale.Total = txbTotal.Text;

            //vale.Total = total.ToString();

            ActualizarTablaVales();
            MessageBox.Show("El Reporte esta listo" + txbVentaFolio + ".poo", "Reporte", MessageBoxButton.OK, MessageBoxImage.Information);

            //vale.Total = txbTotal.Text;
            //ActualizarTablaVales();
            txbVentaFolio.Clear();
            PonerBotonesVentaEdicion(true);

            Ventaa(false);
            HabilitarVentaCajas(true);
            CargarVenta();
            txbVentaCantidadProductos.Clear();
            venta = new List <Venta>();
            dtgVenta.ItemsSource = null;
            //vale.Total = txbTotal.Text;
            //ActualizarTablaVales();
        }