Exemplo n.º 1
0
        public void registrar()
        {
            if (validar())
            {
                sucursal[] arraySucursales = new sucursal[1];
                arraySucursales[0] = new sucursal(radDropDownList2.SelectedItem.Value.ToString(), radDropDownList2.SelectedItem.DisplayValue.ToString());

                ventas     vent  = new ventas();
                precio     pre   = new precio();
                inventario inven = new inventario();
                producto[] pro   = new producto[radGridView3.Rows.Count];
                vent.asignarCantidad(radGridView3.Rows.Count);
                for (int t = 0; t < radGridView3.Rows.Count; t++)
                {
                    //  MessageBox.Show("valor de t = "+t);
                    pro[t]            = new producto(radGridView3.Rows[t].Cells[0].Value.ToString(), radGridView3.Rows[t].Cells[2].Value.ToString());
                    inven.Correlativo = System.Convert.ToInt32(radGridView3.Rows[t].Cells[5].Value.ToString());

                    pre.Monto      = System.Convert.ToDouble(radGridView3.Rows[t].Cells[3].Value.ToString());
                    inven.Precios  = pre;
                    inven.Costo    = System.Convert.ToDouble(radGridView3.Rows[t].Cells[4].Value);
                    inven.Producto = pro;

                    vent.agregarProducto(inven, System.Convert.ToDouble(radGridView3.Rows[t].Cells[2].Value.ToString()));
                    //                MessageBox.Show("Precios: " + inven.Precios.Monto.ToString());
                }
                vent.Sucursales = arraySucursales;
                String fech = Convert.ToString(radDateTimePicker1.Value);

                vent.Fecha = radDateTimePicker1.Value;
                //vent.Comentario = txtComentario.Text;
                vent.TipoVenta = radDropDownList1.SelectedItem.DisplayValue.ToString();
                vent.calcularTotal();
                vent.registrarVenta();
                this.radGridView2.MasterTemplate.Rows.Clear();
                this.radGridView1.MasterTemplate.Rows.Clear();
                this.radGridView3.MasterTemplate.Rows.Clear();
                //                labelMsjExito.Text = "Venta registrada exitosamente.";

                //Limpiar los texbox.
                txtPrecio.Text      = "";
                radTextBox3.Text    = "";
                txtCorrelativo.Text = "";
                radTextBox1.Text    = "";
                txtTotal.Text       = "";
                radTextBox1.Focus();
                //            MessageBox.Show(inven.Precios.Monto.ToString());
                //            MessageBox.Show(inven.Producto[1].Nombre);
                //            MessageBox.Show(inven.Producto[2].Nombre);

                // inven.
            }
            else
            {
                MessageBox.Show("Verifique que todos los campos obligatorios esten llenados.");
            }
        }
Exemplo n.º 2
0
        private void radButton3_Click(object sender, EventArgs e)
        {
            int tipoVen = System.Convert.ToInt32(radDropDownList1.SelectedItem.Value.ToString());

            if (tipoVen == 1)
            {
                //               MessageBox.Show("Borrador");
                radPanel1.Visible = false;
                radPanel2.Visible = true;

                this.radGridView4.MasterTemplate.Rows.Clear();
                for (int i = 0; i < radGridView3.Rows.Count; i++)
                {
                    radGridView4.Rows.AddNew();
                    int f = radGridView4.Rows.Count;
                    this.radGridView4.Rows[f - 1].Cells[0].Value = this.radGridView3.Rows[f - 1].Cells[0].Value;
                    this.radGridView4.Rows[f - 1].Cells[1].Value = this.radGridView3.Rows[f - 1].Cells[1].Value;
                    //Subtotal
                    this.radGridView4.Rows[f - 1].Cells[2].Value = this.radGridView3.Rows[f - 1].Cells[4].Value;
                    //
                    this.radGridView4.Rows[f - 1].Cells[3].Value = this.radGridView3.Rows[f - 1].Cells[2].Value;
                    this.radGridView4.Rows[f - 1].Cells[4].Value = this.radGridView3.Rows[f - 1].Cells[3].Value;
                    this.radGridView4.Rows[f - 1].Cells[5].Value = this.radGridView3.Rows[f - 1].Cells[5].Value;
                    radTextBox4.Text = radTextBox2.Text;
                }
            }
            else if (tipoVen == 2)
            {
                atrasPanel2();
                llenarRadGridView3();
                String total = radTextBox2.Text;

                //**
                sucursal[] arraySucursales = new sucursal[1];
                arraySucursales[0] = new sucursal(radDropDownList2.SelectedItem.Value.ToString(), radDropDownList2.SelectedItem.DisplayValue.ToString());

                ventas     vent  = new ventas();
                precio     pre   = new precio();
                inventario inven = new inventario();
                producto[] pro   = new producto[radGridView3.Rows.Count];
                vent.asignarCantidad(radGridView3.Rows.Count);
                for (int t = 0; t < radGridView3.Rows.Count; t++)
                {
                    //  MessageBox.Show("valor de t = "+t);
                    pro[t]            = new producto(radGridView3.Rows[t].Cells[0].Value.ToString(), radGridView3.Rows[t].Cells[2].Value.ToString());
                    inven.Correlativo = System.Convert.ToInt32(radGridView3.Rows[t].Cells[5].Value.ToString());

                    pre.Monto      = System.Convert.ToDouble(radGridView3.Rows[t].Cells[3].Value.ToString());
                    inven.Precios  = pre;
                    inven.Costo    = System.Convert.ToDouble(radGridView3.Rows[t].Cells[4].Value);
                    inven.Producto = pro;



                    vent.agregarProducto(inven, System.Convert.ToDouble(radGridView3.Rows[t].Cells[3].Value.ToString()));
                    //                MessageBox.Show("Precios: " + inven.Precios.Monto.ToString());
                }
                vent.Sucursales = arraySucursales;
                String fech = Convert.ToString(radDateTimePicker1.Value);

                vent.Fecha = radDateTimePicker1.Value;
                //vent.Comentario = txtComentario.Text;
                vent.TipoVenta = radDropDownList1.SelectedItem.DisplayValue.ToString();
                vent.calcularTotal();
                //**


                facturarVenta fac = new facturarVenta(GridView, total, vent);
                fac.Show();

                //               MessageBox.Show("Facturacion");
                //    registrar();
            }
            else
            {
                //               MessageBox.Show("Credito Fiscal");
            }
        }