private void button3_Click(object sender, EventArgs e)
        {//inicio boton confirmar venta
            string rpta        = "";
            string rptaFactura = "";

            if (dataVentas.Rows.Count > 0)
            {
                for (int i = 0; i < dataVentas.Rows.Count; i++)
                {
                    Decimal SumaIgv = 0; Decimal SumaSubTotal = 0;
                    if (Convert.ToString(dataVentas.Rows[i].Cells[2].Value) != "")
                    {
                        //SumaIgv += Convert.ToDecimal(dataVentas.Rows[i].Cells[6].Value);
                        //SumaSubTotal += Convert.ToDecimal(dataVentas.Rows[i].Cells[4].Value);
                        //GuardarDetalleVenta(
                        //Convert.ToInt32(lblNumeroFactura.Text),
                        //Convert.ToInt32(dataListadoProductos.Rows[i].Cells[0].Value),
                        //Convert.ToDecimal(dataListadoProductos.Rows[i].Cells[4].Value),
                        //Convert.ToInt32(txtCantidadProducto),
                        //Convert.ToString(dataListadoProductos.Rows[i].Cells[2].Value)
                        //);
                        rpta = NDetalle.Insertar(500, Convert.ToInt32(lblNumeroFactura.Text), Convert.ToInt32(dataVentas.Rows[i].Cells[0].Value), Convert.ToDecimal(dataVentas.Rows[i].Cells[3].Value), Convert.ToInt32(dataVentas.Rows[i].Cells[1].Value));
                        //MessageBox.Show("Contiene Datos." + rpta +  "Precio: " + dataVentas.Rows[i].Cells[3].Value + "Cantidad de productos:" + dataVentas.Rows[i].Cells[1].Value);

                        if (rpta.Equals("OK"))
                        {//inicio if rpta
                         //MessageBox.Show("Se insertó correctamente el registro.");
                        }

                        else
                        {
                            MessageBox.Show("No se cargó la venta de los productos, pongase en contacto con el Adminisrador de base de datos de Procesamiento de Datos.");
                        }
                    }
                }

                rptaFactura = NFactura.Insertar(500, Convert.ToInt32(this.txtIdentificador.Text), "12/10/2005", Convert.ToDecimal(this.lblTotal.Text), Convert.ToInt32(this.lblNumeroFactura.Text), 1, 1, 1, 1);
                if (rptaFactura.Equals("OK"))
                {
                    MessageBox.Show("Se realizó correctamente la venta.");
                    LimpiarVenta();
                }

                else
                {
                    MessageBox.Show("No se cargó la venta, pongase en contacto con el Administrador de base de datos de Procesamiento de Datos.");
                }
            }
        }//fin boton confirmar venta
Ejemplo n.º 2
0
        private void cboComprobante_SelectedIndexChanged(object sender, EventArgs e)
        {
            string codigo         = NBoleta.GenerarCodigoBoleta();
            string codigo_factura = NFactura.GenerarCodigoFactura();

            if (cboComprobante.Text.Equals("Factura"))
            {
                lblRazonSocial.Visible = true;
                lblRuc.Visible         = true;
                txtRazonSocial.Visible = true;
                txtRuc.Visible         = true;
                txtCorrelativo.Text    = codigo_factura;
            }
            else
            {
                lblRazonSocial.Visible = false;
                lblRuc.Visible         = false;
                txtRazonSocial.Visible = false;
                txtRuc.Visible         = false;

                txtCorrelativo.Text = codigo;
            }
            txtSerie.Text = "0001";
        }
Ejemplo n.º 3
0
        public Form1()
        {
            InitializeComponent();



            var listTextBox = new List <TextBox>();

            listTextBox.Add(textBoxNit);
            listTextBox.Add(textBoxNombre);
            listTextBox.Add(textBoxCodigoProducto);
            listTextBox.Add(textBoxNombreProducto);
            listTextBox.Add(textBoxPrecio);
            listTextBox.Add(textBoxCantidad);
            listTextBox.Add(textBoxSubTotal);
            listTextBox.Add(textBoxIva);
            listTextBox.Add(textBoxTotal);
            listTextBox.Add(textBoxNroFactura);

            var listButton = new List <Button>();

            listButton.Add(buttonBuscarCliente);
            listButton.Add(buttonBuscarProducto);
            listButton.Add(buttonAgregar);
            listButton.Add(buttonFinalizar);

            var listLabel = new List <Label>();

            listLabel.Add(labelMensaje);



            encabezadoFactura = new NFactura(listTextBox, dataGridViewFactura, listButton, listLabel, timerGeneraFact);

            textBoxNroFactura.Text = encabezadoFactura.NumeroFactura().ToString();
        }
Ejemplo n.º 4
0
 private void BuscarNombre()
 {
     //this.dataListado.DataSource = NFactura.BuscarNombre(this.txtNombreCliente.Text);
     this.dataListado.DataSource = NFactura.BusquedaAvanzada(this.txtNombreCliente.Text, Convert.ToString(this.dateFechaDesde.Value).Substring(0, 10), Convert.ToString(this.dateFechaHasta.Value).Substring(0, 10));
 }
Ejemplo n.º 5
0
 private void Mostrar()
 {
     this.dataListado.DataSource = NFactura.Mostrar();
 }
Ejemplo n.º 6
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(txtSerie.Text) && string.IsNullOrEmpty(txtCorrelativo.Text))
                {
                    epVenta.SetError(txtSerie, "verifica el numero de serie - para poder hacer la venta");
                    epVenta.SetError(txtCorrelativo, "verifica el numero de correlativo - para poder hacer la venta");
                }
                else if (string.IsNullOrEmpty(txtCliente.Text) && idCliente == 0)
                {
                    epVenta.SetError(txtCliente, "Campo vacio - buscar por DNI al cliente o agregar nuevo para hacer la venta");
                }
                else if (dgvDetalleventa.Rows.Count == 0)
                {
                    MessageBox.Show("Caja de productos vacio - ingrese al menos un producto para realizar la venta", "Sistema veterinaria", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    epVenta.SetError(btnBuscarArticulo, "Buscar articulo a vender");
                }
                else
                {
                    if (_isNew)
                    {
                        int ultimo_id = NVenta.Insertar(
                            cboComprobante.SelectedIndex, cboComprobante.Text, txtSerie.Text.Trim(), txtCorrelativo.Text.Trim(),
                            idCliente, txtRazonSocial.Text.Trim(), txtRuc.Text.Trim(),
                            Convert.ToDecimal(txtSubTotal.Text.Trim()), Convert.ToDecimal(txtIGV.Text.Trim()), Convert.ToDecimal(txtTotal.Text.Trim()), idUsuario
                            );
                        int numFilas = dgvDetalleventa.Rows.Count;
                        for (int i = 0; i < numFilas; i++)
                        {
                            int     idventa   = ultimo_id;
                            int     iddia     = Convert.ToInt32(dgvDetalleventa.Rows[i].Cells[7].Value.ToString());
                            int     cantidad  = Convert.ToInt32(dgvDetalleventa.Rows[i].Cells[2].Value.ToString());
                            decimal precio    = Convert.ToDecimal(dgvDetalleventa.Rows[i].Cells[3].Value.ToString());
                            decimal descuento = Convert.ToDecimal(dgvDetalleventa.Rows[i].Cells[4].Value.ToString());

                            bool rpta = NDetalleVenta.Insertar(
                                idventa, iddia, cantidad, precio, descuento
                                );
                        }
                        IdVenta = ultimo_id;
                        if (cboComprobante.Text == "Factura")
                        {
                            bool rpta = NFactura.insertarFactura(txtSerie.Text.Trim(), txtCorrelativo.Text.Trim(), IdVenta);
                        }
                        else
                        {
                            bool rpta = NBoleta.insertarBoleta(txtSerie.Text.Trim(), txtCorrelativo.Text.Trim(), IdVenta);
                        }

                        mensajeYes("Venta registrado correctamente");
                        LimpiarVenta();
                        objNV.ListarDataGridViewVenta(frmListVenta.MyFormListVenta.dgvVenta);
                        string codigo = NBoleta.GenerarCodigoBoleta();
                        txtSerie.Text       = "0001";
                        txtCorrelativo.Text = codigo;
                        btnFacturar.Enabled = true;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error ....!!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                throw;
            }
        }