示例#1
0
        private void bunifuThinButton21_Click(object sender, EventArgs e)
        {
            if (cmb1.Text == "" || comboBox1.Text == "")
            {
                MessageBox.Show("los datos no pueden ir vacios");
            }
            else
            {
                string h;
                if (label4.Text == "Cliente - Nombres y apellidos" || txt4.Text == "")
                {
                    h = "1";
                }
                else
                {
                    h = txt4.Text;
                }

                string        a       = DateTime.Now.ToString("dd/MM/yyyy");
                Lgestionventa factura = new Lgestionventa();
                string        c       = factura.nfactura(Convert.ToString(a), Iva.Text, "1", Compra.Text, "2", "123456789", h);

                if (c == "1")
                {
                    for (f = 0; f < dgv1.Rows.Count; f++)
                    {
                        Lgestionventa detalles = new Lgestionventa();
                        detalles.detallesv(dgv1.Rows[f].Cells[0].Value.ToString(), label2.Text, dgv1.Rows[f].Cells[3].Value.ToString(), dgv1.Rows[f].Cells[4].Value.ToString(), dgv1.Rows[f].Cells[2].Value.ToString());
                    }
                    MessageBox.Show("factura de venta exitosa");
                    dgv1.Rows.Clear();
                }
            }
        }
示例#2
0
        private void bunifuThinButton21_Click(object sender, EventArgs e)
        {
            if (cmb1.Text == "" || comboBox1.Text == "")
            {
                MessageBox.Show("los datos no pueden ir vacios");
            }
            else
            {
                string h;
                if (label4.Text == "Cliente - Nombres y apellidos" || txt4.Text == "")
                {
                    h = "1";
                }
                else
                {
                    h = txt4.Text;
                }

                Lgestioncliente reg        = new Lgestioncliente();
                string          registrado = reg.d(nombre);
                string          a          = DateTime.Now.ToString("dd/MM/yyyy");
                Lgestionventa   factura    = new Lgestionventa();
                string          c          = factura.nfactura(a.ToString(), Iva.Text, cantidadvendida.ToString(), Compra.Text, "2", registrado, h);

                if (c == "1")
                {
                    for (f = 0; f < dgv1.Rows.Count; f++)
                    {
                        Lgestionventa detalles = new Lgestionventa();
                        detalles.detallesv(dgv1.Rows[f].Cells[0].Value.ToString(), label2.Text, dgv1.Rows[f].Cells[3].Value.ToString(), dgv1.Rows[f].Cells[4].Value.ToString(), dgv1.Rows[f].Cells[2].Value.ToString());
                    }
                    MessageBox.Show("factura de venta exitosa");
                    numericUpDown1.Value = 0;
                    dgv1.Rows.Clear();
                    Iva.Text    = "0";
                    Compra.Text = "0";
                }


                //reportes
                ConjuntoDaros            datos   = new ConjuntoDaros();
                ConjuntoDaros.FacturaRow columna = datos.Factura.NewFacturaRow();

                columna.Cantidad   = cantidadvendida.ToString();
                columna.Fecha      = DateTime.Now.ToString();
                columna.IvaTotal   = Compra.Text;
                columna.TotalValor = Iva.Text;
                columna.Usuario    = registrado;
                datos.Factura.Rows.Add(columna);

                //llenado de detalles

                for (int n = 0; n < dgv1.Rows.Count; n++)
                {
                    ConjuntoDaros.DetallesRow columna1 = datos.Detalles.NewDetallesRow();
                    columna1.CodFactura       = label2.Text;
                    columna1.Nproducto        = dgv1.Rows[n].Cells[1].Value.ToString();
                    columna1.UnidadesVendidas = dgv1.Rows[n].Cells[4].Value.ToString();
                    columna1.ValorIva         = dgv1.Rows[n].Cells[2].Value.ToString();
                    columna1.ValorUnidad      = dgv1.Rows[n].Cells[3].Value.ToString();
                    columna1.TotalProducto    = dgv1.Rows[n].Cells[5].Value.ToString();
                    datos.Detalles.Rows.Add(columna1);
                }

                Form1 mostrar = new Form1();
                mostrar.Nuevo = datos;
                mostrar.Show();
            }
        }