示例#1
0
        private void buscarUltimaVenta()
        {
            ventaAlxMayor2 = procesar.buscarUltimaVenta();
            if (ventaAlxMayor2 != null)
            {
                numFact = Convert.ToInt32(ventaAlxMayor2.IdVentaMayor) + 1;
            }
            else
            {
                numFact = 1;
            }

            lblNumFact.Text = numFact.ToString();
        }
示例#2
0
 private void btnRegistrarVenta_Click(object sender, EventArgs e)
 {
     if (txtPago.Text != "" && cbCliente.SelectedIndex != 0)
     {
         try
         {
             DO.Modapie.VentaAlxMayor ventaAlxMayor;
             ClientePorMayor          clientePorMayor;
             InventarioAlxMayor       inventarioAlxMayor;
             DescripcionVentaAlxMayor descripcionVentaAlxMayor;
             List <int> listaVenta = obtenerDatosDGV();
             bool       pago       = estadoVenta();
             clientePorMayor = procesar.buscarClienteAlxMayor(cbCliente.Text);
             ventaAlxMayor   = new DO.Modapie.VentaAlxMayor
             {
                 IdClienteMayor = clientePorMayor.idCliente,
                 IdEmpleado     = cbEmpleado.Text,
                 Total          = Convert.ToDouble(txtTotal.Text),
                 Estado         = pago,
                 SaldoPendiente = Convert.ToDouble(txtTotal.Text) - Convert.ToDouble(txtPago.Text),
                 TotalAbonado   = Convert.ToDouble(txtPago.Text),
                 UltimoAbono    = Convert.ToDouble(txtPago.Text),
                 FechaVenta     = DateTime.Now
             };
             procesar.InsertarVentaAlxMayor(ventaAlxMayor);
             int cantidadLista = listaVenta.Count;
             int Lote;
             for (int i = 0; i < cantidadLista; i++)
             {
                 Lote = listaVenta[i];
                 inventarioAlxMayor       = procesar.obtenerLote(Lote);
                 descripcionVentaAlxMayor = new DescripcionVentaAlxMayor
                 {
                     IdVentaMayor = Convert.ToInt32(lblNumFact.Text),
                     IdProducto   = inventarioAlxMayor.IdLote1,
                     Total        = inventarioAlxMayor.TotalImpuestos1
                 };
                 procesar.InsertarDescripcionVentaAlxMayor(descripcionVentaAlxMayor);
             }
             MessageBox.Show("Venta Registrada");
             cargarEnLimpio();
         }
         catch (Exception ee)
         {
             MessageBox.Show("No se pudo registrar la venta");
         }
         try
         {
             FacturaVentasAlxMayor form = new FacturaVentasAlxMayor();
             ReportDocument        oRep = new ReportDocument();
             oRep.Load(Application.StartupPath + "/Reportes/FacturalAlxMayor.rpt");
             form.crystalReportViewer1.ReportSource = oRep;
             form.Show();
         }
         catch (Exception ee)
         {
             MessageBox.Show("No se puede mostrar la factura en este momento");
         }
     }
     else
     {
         MessageBox.Show("No se digitó el pago");
     }
 }