Esempio n. 1
0
        private void btneliminarsucursal_Click(object sender, EventArgs e)
        {
            if (this.txtCodSucur.Text == "")
            {
                MessageBox.Show("Debe llenar el campo Codigo o elija un registro de la tabla");
            }
            else if (this.txtNombreSucur.Text == "")
            {
                MessageBox.Show("Debe llenar el campo Nombre o elija un registro de la tabla");
            }
            else
            {
                sucursal sucu = new sucursal(txtCodSucur.Text, txtNombreSucur.Text);
                //Lineas de codigos en comun para todos los metodos.
                opcionesdb opciones = new opcionesdb();
                String     NomTabla = "Sucursal";
                Hashtable  crit     = new Hashtable();

                //Lineas con detalles especificos por metodo.
                crit.Add("CodigoSucursal", sucu.Codigosucursal.ToString());
                crit.Add("Nombre", sucu.Nombre.ToString());

                opciones.EliminarRegistro(NomTabla, crit);
                //    MessageBox.Show("Sucursal Eliminada Satisfactoriamente'¡¡¡¡¡");
                cargarSucursales();
            }
        }
Esempio n. 2
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.");
            }
        }
Esempio n. 3
0
        public sucursal[] obtenerSucursales()
        {
            //Lineas de codigos en comun para todos los metodos.
            opcionesdb opciones = new opcionesdb();
            String     NomTabla = "sucursal";
            //Lineas con detalles especificos por metodo.

            DataTable tab = new DataTable();

            tab = opciones.ObtenerTodasTuplas(NomTabla);
            int tamanio = tab.Rows.Count;


            sucursal[] coleccionSucursales = new sucursal[tamanio];

            for (int j = 0; j < tamanio; j++)
            {
                DataRow  row   = tab.Rows[j];
                sucursal sucur = new sucursal(row["CodigoSucursal"].ToString(), row["nombre"].ToString());
                coleccionSucursales[j] = sucur;
            }
            return(coleccionSucursales);
        }
Esempio n. 4
0
        private void btnRegistrar_Click(object sender, EventArgs e)
        {
            Hashtable[] vistaCompra = new Hashtable[1];

            if (validar())
            {
                compra compr = new compra();
                //  proveedor prov = new proveedor(radDropDownList1.SelectedItem.Value.ToString(), radDropDownList1.SelectedItem.DisplayValue.ToString());
                sucursal[] arraySucursales = new sucursal[1];
                arraySucursales[0] = new sucursal(radDropDownList2.SelectedItem.Value.ToString(), radDropDownList2.SelectedItem.DisplayValue.ToString());
                //   arraySucursales[0].Codigosucursal = radDropDownList2.SelectedItem.Value.ToString();
                //   arraySucursales[0].Nombre = radDropDownList2.SelectedItem.DisplayValue.ToString();
                proveedor[] arrayProveedores = new proveedor[1];
                arrayProveedores[0] = new proveedor(radDropDownList1.SelectedItem.Value.ToString(), radDropDownList1.SelectedItem.DisplayValue.ToString());
                //   arrayProveedores[0].CodigoProveedor = radDropDownList1.SelectedItem.Value.ToString();
                //   arrayProveedores[0].Nombre = radDropDownList1.SelectedItem.DisplayValue.ToString();

                compr.Sucursal  = arraySucursales;
                compr.Proveedor = arrayProveedores;
                compr.NDoc1     = txtNumDoc.Text;
                int f = 0;

                for (int t = 0; t < radGridView1.Rows.Count; t++)
                {
                    f = f + System.Convert.ToInt32(this.radGridView1.Rows[t].Cells[3].Value);
                }

                inventario[] inventar = new inventario[radGridView1.Rows.Count];
                int          cantidad = 0;
                //  MessageBox.Show("variable radGridView1.Rows.Count = " + radGridView1.Rows.Count);
                for (int t = 0; t < radGridView1.Rows.Count; t++)
                {
                    cantidad = System.Convert.ToInt32(this.radGridView1.Rows[t].Cells[3].Value);
                    producto[] arrayProduc = new producto[cantidad];
                    //      MessageBox.Show("variable cantidad = " + cantidad);
                    for (int i = 0; i < cantidad; i++)
                    {
                        //          MessageBox.Show("variable i = " + i + "   variable t = " + t);
                        arrayProduc[i]             = new producto(this.radGridView1.Rows[t].Cells[0].Value + "", this.radGridView1.Rows[t].Cells[1].Value + "");
                        arrayProduc[i].CodigoBarra = this.radGridView1.Rows[t].Cells[0].Value + "";
                        arrayProduc[i].Nombre      = this.radGridView1.Rows[t].Cells[1].Value + "";
                    }
                    //inventario invet = new inventario();
                    //invet.Producto = arrayProduc
                    inventar[t]          = new inventario();
                    inventar[t].Producto = arrayProduc;
                    //               precio preci = new precio();
                    //               preci.Monto = System.Convert.ToDouble(this.radGridView1.Rows[t].Cells[2].Value);
                    //               invet.Costo = System.Convert.ToDouble(this.radGridView1.Rows[t].Cells[2].Value);
                    inventar[t].Costo = System.Convert.ToDouble(this.radGridView1.Rows[t].Cells[2].Value);


                    fila = new rowGridView[cantidadTiposPrecios];
                    for (int i = 0; i < cantidadTiposPrecios; i++)
                    {
                        fila[i]        = new rowGridView();
                        fila[i].Cells0 = radGridView2.Rows[i].Cells[0].Value + "";
                    }



                    int numColumnas = this.radGridView1.Columns.Count;
                    for (int tr = 0; tr < numColumnas - 4; tr++)
                    {
                        fila[tr].Cells1 = radGridView1.Rows[t].Cells[4 + tr].Value + "";
                        //    f = f + System.Convert.ToInt32(this.radGridView1.Rows[t].Cells[4+tr].Value);
                    }
                    inventar[t].Filasprecios1 = fila;
                }
                compr.Productos = inventar;
                String fech = Convert.ToString(radDateTimePicker1.Value);

                compr.Fecha = radDateTimePicker1.Value;

                //            compr.Fecha = fech.Substring(0, 10);
                compr.calcularTotal();
                compr.registrarCompra();

                this.radGridView1.MasterTemplate.Rows.Clear();
                labelMsjExito.Text = "Venta registrada exitosamente.";

                //Limpiar los texbox.
                txtCosto.Text    = "";
                radTextBox3.Text = "";
                //txtCantidad.Text = "";
                radTextBox1.Text = "";
                txtTotal.Text    = "";
                radTextBox1.Focus();
                vistaCompra = compr.VistaCompra;

                vistaPreviaCompras vista = new vistaPreviaCompras(vistaCompra);
                vista.Show();
            }
            else
            {
                MessageBox.Show("Verifique que todos los campos obligatorios esten llenados.");
            }
        }
Esempio n. 5
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");
            }
        }