Ejemplo n.º 1
0
        public void MostrarDetalles()
        {
            if (radGridView1.Rows.Count > 0)
            {
                detalleborrador detalle  = new detalleborrador(listSucursal.SelectedValue.ToString());
                opcionesdb      opcion   = new opcionesdb();
                String          NomTabla = "DetalleVenta";
                Hashtable       crit     = new Hashtable();
                Hashtable       reg      = new Hashtable();

                //Obtener Id de Venta
                int    fila = System.Convert.ToInt32(radGridView1.MasterGridViewInfo.CurrentIndex.ToString());
                String id   = radGridView1.Rows[fila].Cells[0].Value.ToString();
                //MessageBox.Show(id);

                //obtenerdetalle
                //Lineas con detalles especificos por metodo.
                reg.Add("CodigoBarra", "CodigoBarra");
                reg.Add("Correlativo", "Correlativo");
                reg.Add("PrecioReal", "PrecioReal");
                reg.Add("PrecioVenta", "PrecioVenta");

                crit.Add("NVenta", id);

                DataTable tabla = opcion.BuscarRegistro(NomTabla, crit, reg);
                detalle.DesabilitarFact();
                detalle.llenarDetalle(tabla);
                detalle.Show();
            }
        }
Ejemplo n.º 2
0
        public producto obtener(String CodBarra)
        {
            //Lineas de codigos en comun para todos los metodos.
            opcionesdb opciones = new opcionesdb();
            String     NomTabla = "productos";
            Hashtable  crit     = new Hashtable();
            Hashtable  reg      = new Hashtable();

            //Lineas con detalles especificos por metodo.
            crit.Add("CodigoBarra", CodBarra);
            reg.Add("CodigoBarra", "CodigoBarra");
            reg.Add("nombre", "nombre");

            DataTable tab = new DataTable();

            tab = opciones.BuscarRegistro(NomTabla, crit, reg);
            producto pro = new producto("", "");

            if (tab.Rows.Count > 0)
            {
                DataRow row = tab.Rows[0];
                pro = new producto(row["CodigoBarra"].ToString(), row["nombre"].ToString());
                //   MessageBox.Show(row["nombre"].ToString());
                return(pro);
            }
            else
            {
                return(pro);
            }
        }
Ejemplo n.º 3
0
        public void cargarFacturasBorrador(String sucursal)
        {
            this.radGridView1.MasterTemplate.Rows.Clear();
            opcionesdb opcione  = new opcionesdb();
            String     NomTabla = "Ventas";
            Hashtable  crit     = new Hashtable();
            Hashtable  reg      = new Hashtable();

            //Lineas con detalles especificos por metodo.
            reg.Add("NVentas", "NVentas");
            reg.Add("Fecha", "Fecha");
            reg.Add("TotalReal", "TotalReal");

            crit.Add("TipoVenta", "Borrador");
            crit.Add("CodigoSucursal", sucursal);

            DataTable tabla = opcione.BuscarRegistro(NomTabla, crit, reg);


            DataRow row;

            for (int f = 0; f < tabla.Rows.Count; f++)
            {
                row = tabla.Rows[f];
                radGridView1.Rows.AddNew();
                int x = radGridView1.Rows.Count;
                this.radGridView1.Rows[x - 1].Cells[0].Value = row["Nventas"].ToString();
                this.radGridView1.Rows[x - 1].Cells[1].Value = row["Fecha"].ToString();
                this.radGridView1.Rows[x - 1].Cells[2].Value = row["TotalReal"].ToString();
            }
        }
Ejemplo n.º 4
0
        public void totalVentas()
        {
            //Lineas de codigos en comun para todos los metodos.
            opcionesdb opciones = new opcionesdb();
            String     NomTabla = "ventas";
            Hashtable  crit     = new Hashtable();
            Hashtable  reg      = new Hashtable();

            //Lineas con detalles especificos por metodo.
            crit.Add("MONTH(Fecha)", radDropDownList3.SelectedItem.Value.ToString());
            crit.Add("YEAR(Fecha)", txtAnio.Text);
            crit.Add("CodigoSucursal", radDropDownList2.SelectedItem.Value.ToString());

            reg.Add("TotalVenta", "TotalVenta");
            reg.Add("Utilidad", "Utilidad");

            DataTable tab = new DataTable();

            tab = opciones.BuscarRegistro(NomTabla, crit, reg);
            double total    = 0.0;
            double utilidad = 0.0;

            for (int i = 0; i < tab.Rows.Count; i++)
            {
                DataRow row = tab.Rows[i];
                total    = total + System.Convert.ToDouble(row["TotalVenta"].ToString());
                utilidad = utilidad + System.Convert.ToDouble(row["Utilidad"].ToString());
            }
            txtVentasMes.Text = Decimal.Round(System.Convert.ToDecimal(total), 2) + "";
            txtUtilidad.Text  = Decimal.Round(System.Convert.ToDecimal(utilidad), 2) + "";
        }
Ejemplo n.º 5
0
        public void Ventaconsumidor()
        {
            opcionesdb opciones = new opcionesdb();
            String     NomTabla = "Ventas";
            Hashtable  crit     = new Hashtable();

            Hashtable reg = new Hashtable();

            crit.Add("MONTH(Fecha)", MesList.SelectedItem.Value.ToString());
            crit.Add("YEAR(Fecha)", AnyoBox.Text);
            crit.Add("CodigoSucursal", SucursalList.SelectedItem.Value.ToString());


            crit.Add("TipoVenta", "FACTURA");
            reg.Add("Gravado", "Gravado");
            reg.Add("Fecha", "Fecha");
            reg.Add("IVA", "IVA");
            reg.Add("PagoACuenta", "PagoACuenta");
            reg.Add("Renta", "Renta");
            reg.Add("Utilidad", "Utilidad");


            DataTable tab = new DataTable();

            tab = opciones.BuscarRegistro(NomTabla, crit, reg);
            double total           = 0.00;
            double TotalIva        = 0.00;
            double TotalPagoCuenta = 0.00;
            double Rentax          = 0.00;
            double UtilidadFinal   = 0.00;

            try
            {
                for (int i = 0; i < tab.Rows.Count; i++)
                {
                    DataRow row = tab.Rows[i];
                    total           = total + System.Convert.ToDouble(row["Gravado"].ToString());
                    TotalIva        = TotalIva + System.Convert.ToDouble(row["IVA"].ToString());
                    TotalPagoCuenta = TotalPagoCuenta + System.Convert.ToDouble(row["PagoACuenta"].ToString());
                    Rentax          = Rentax + System.Convert.ToDouble(row["Renta"].ToString());
                    UtilidadFinal  += System.Convert.ToDouble(row["Utilidad"].ToString());
                }
                TxtFinal.Text      = Decimal.Round(System.Convert.ToDecimal(total), 2) + "";
                TxtVentaIva.Text   = Decimal.Round(System.Convert.ToDecimal(TotalIva), 2) + "";
                TxtPagoCuenta.Text = Decimal.Round(System.Convert.ToDecimal(TotalPagoCuenta), 2) + "  ";
                TxtRenta.Text      = Decimal.Round(System.Convert.ToDecimal(Rentax), 2) + "";
                TxtUtilidad.Text   = Decimal.Round(System.Convert.ToDecimal(UtilidadFinal), 2) + "  ";
            }
            catch (Exception ex)
            {
                RadMessageBox.SetThemeName("TelerikMetroBlue");
                Telerik.WinControls.RadMessageBox.Show("Tuplas de la tabla Ventas tienen un valor de NULL " + ex.HResult + "\n Revice la base de Datos");
            }
        }
Ejemplo n.º 6
0
        public void ObtenerTodos()
        {
            detalleborrador detalle = new detalleborrador(listSucursal.SelectedValue.ToString());
            int             filas   = radGridView3.Rows.Count;
            rowGridView     grid    = new rowGridView();
            DataTable       todos   = new DataTable();
            String          ids;
            opcionesdb      opcion   = new opcionesdb();
            String          NomTabla = "DetalleVenta";
            Hashtable       crit     = new Hashtable();
            Hashtable       reg      = new Hashtable();

            //Obtener Id de Venta
            //  int fila = System.Convert.ToInt32(radGridView1.MasterGridViewInfo.CurrentIndex.ToString());
            //  String id = radGridView1.Rows[fila].Cells[0].Value.ToString();
            //MessageBox.Show(id);

            //obtenerdetalle
            //Lineas con detalles especificos por metodo.
            reg.Add("CodigoBarra", "CodigoBarra");
            reg.Add("Correlativo", "Correlativo");
            reg.Add("PrecioReal", "PrecioReal");
            reg.Add("PrecioVenta", "PrecioVenta");

            for (int f = 0; f < filas; f++)
            {
                ids = radGridView3.Rows[f].Cells[0].Value.ToString();
                crit.Add("NVenta", ids);

                DataTable tabla = opcion.BuscarRegistro(NomTabla, crit, reg);
                todos = tabla.Clone();
                for (int a = 0; a < tabla.Rows.Count; a++)
                {
                    todos.ImportRow(tabla.Rows[a]);
                }


                detalle.llenarDetalle(todos);
                tabla.Clear();
                crit.Clear();
            }

            detalle.HabilitarFact();
            detalle.Show();
        }
Ejemplo n.º 7
0
        public void CreditoCompra()
        {
            opcionesdb opciones = new opcionesdb();
            String     NomTabla = "Compras";
            Hashtable  crit     = new Hashtable();
            Hashtable  reg      = new Hashtable();

            crit.Add("MONTH(Fecha)", MesList.SelectedItem.Value.ToString());
            crit.Add("YEAR(Fecha)", AnyoBox.Text);
            crit.Add("CodigoSucursal", SucursalList.SelectedItem.Value.ToString());


            crit.Add("TipoCompra", 1);
            reg.Add("Gravado", "Gravado");
            reg.Add("Fecha", "Fecha");
            reg.Add("IVA", "IVA");
            reg.Add("Percepcion", "Percepcion");


            DataTable tab = new DataTable();

            tab = opciones.BuscarRegistro(NomTabla, crit, reg);
            double total           = 0.00;
            double TotalIva        = 0.00;
            double TotalPercepcion = 0.00;

            try
            {
                for (int i = 0; i < tab.Rows.Count; i++)
                {
                    DataRow row = tab.Rows[i];
                    total            = total + System.Convert.ToDouble(row["Gravado"].ToString());
                    TotalIva         = TotalIva + System.Convert.ToDouble(row["IVA"].ToString());
                    TotalPercepcion += System.Convert.ToDouble(row["Percepcion"].ToString());
                }
                Creditotxt.Text    = Decimal.Round(System.Convert.ToDecimal(total), 2) + "";
                TxtIva.Text        = Decimal.Round(System.Convert.ToDecimal(TotalIva), 2) + "";
                TxtPercepcion.Text = Decimal.Round(System.Convert.ToDecimal(TotalPercepcion), 2) + "  ";
            }
            catch (Exception ex)
            {
                RadMessageBox.SetThemeName("TelerikMetroBlue");
                Telerik.WinControls.RadMessageBox.Show("Tuplas de la tabla Compras tienen un valor de NULL " + ex.HResult + "\n Revice la base de Datos");
            }
        }
Ejemplo n.º 8
0
        public String ObtenerNventa()
        {
            String     Nventa;
            opcionesdb opcion    = new opcionesdb();
            String     NomTabla2 = "Ventas";
            Hashtable  crit      = new Hashtable();
            Hashtable  reg       = new Hashtable();

            reg.Add("NVentas", "NVentas");
            crit.Add("Numero", Convert.ToString(ven.NVenta));

            DataTable tabla = opcion.BuscarRegistro(NomTabla2, crit, reg);


            Nventa = tabla.Rows[0]["NVentas"].ToString();
            //  MessageBox.Show(Nventa);
            return(Nventa);
        }
Ejemplo n.º 9
0
        private void btnBuscar_Click(object sender, EventArgs e)
        {
            this.radGridView2.MasterTemplate.Rows.Clear();
            opcionesdb opciones = new opcionesdb();
            String     NomTabla = "inventario";
            Hashtable  crit     = new Hashtable();
            Hashtable  reg      = new Hashtable();

            //Lineas con detalles especificos por metodo.
            crit.Add("CodigoBarra", radTextBox1.Text);
            crit.Add("correlativo", txtCorrelativo.Text);

            reg.Add("CodigoBarra", "CodigoBarra");
            reg.Add("Correlativo", "Correlativo");
            reg.Add("Gravado", "Gravado");
            DataTable tab = new DataTable();

            tab = opciones.BuscarRegistro(NomTabla, crit, reg);
            producto pro = new producto("", "");

            if (tab.Rows.Count > 0)
            {
                DataRow row = tab.Rows[0];

                Hashtable crity = new Hashtable();
                Hashtable regy  = new Hashtable();
                //Lineas con detalles especificos por metodo.
                //  MessageBox.Show(" Codigo Barra:  "+row["CodigoBarra"].ToString() + "");

                crity.Add("CodigoBarra", row["CodigoBarra"].ToString());

                regy.Add("CodigoBarra", "CodigoBarra");
                regy.Add("nombre", "nombre");

                costoProductoTemporal = System.Convert.ToDouble(row["Gravado"]);
                DataTable tabr = new DataTable();
                tabr = opciones.BuscarRegistro("productos", crity, regy);

                DataRow rowre = tabr.Rows[0];
                pro = new producto(rowre["CodigoBarra"].ToString(), rowre["nombre"].ToString());
                radTextBox3.Text = pro.Nombre;
            }
            else
            {
                MessageBox.Show("No hay producto con ese correlativo y codigo de Barra");
            }

            //---------------------------------------------

            Hashtable critt = new Hashtable();
            Hashtable regt  = new Hashtable();

            //Lineas con detalles especificos por metodo.
            critt.Add("CodigoBarra", radTextBox1.Text);
            critt.Add("correlativo", txtCorrelativo.Text);

            regt.Add("CodigoBarra", "CodigoBarra");
            regt.Add("Correlativo", "Correlativo");
            regt.Add("Gravado", "Gravado");
            regt.Add("TipoPrecio", "TipoPrecio");


            DataTable tabt = new DataTable();

            tabt = opciones.BuscarRegistro("precios", critt, regt);
            // MessageBox.Show("fuera DEL TIPO DE PRECIO, tamaño de la tabla: "+tabt.Rows.Count);
            for (int y = 0; y < tabt.Rows.Count; y++)
            {
                //     MessageBox.Show("DENTRO DEL TIPO DE PRECIO");
                DataRow rowt = tabt.Rows[y];
                radGridView2.Rows.AddNew();
                int f = radGridView2.Rows.Count;
                this.radGridView2.Rows[f - 1].Cells[0].Value = rowt["TipoPrecio"];
                this.radGridView2.Rows[f - 1].Cells[1].Value = Decimal.Round(System.Convert.ToDecimal(rowt["Gravado"]), 2);
            }



            //---------------------------------------------
        }
Ejemplo n.º 10
0
        public void AgregarTotales()
        {
            opcionesdb opciones    = new opcionesdb();
            String     NomTabla    = "Totales";
            String     TablaVentas = "Ventas";
            Hashtable  crit        = new Hashtable();
            Hashtable  Modificar   = new Hashtable();
            Hashtable  Actualizar  = new Hashtable();
            Hashtable  reg         = new Hashtable();

            crit.Add("MONTH(Fecha)", MesList.SelectedItem.Value.ToString());
            crit.Add("YEAR(Fecha)", AnyoBox.Text);
            crit.Add("CodigoSucursal", SucursalList.SelectedItem.Value.ToString());



            reg.Add("TotalReal", "TotalReal");
            DataTable tab = new DataTable();

            tab = opciones.BuscarRegistro(TablaVentas, crit, reg);

            double Realtotal = 0.00;

            String TotalRealx = "";

            try
            {
                for (int i = 0; i < tab.Rows.Count; i++)
                {
                    DataRow row = tab.Rows[i];

                    Realtotal = Realtotal + System.Convert.ToDouble(row["TotalReal"].ToString());

                    TotalRealx = Decimal.Round(System.Convert.ToDecimal(Realtotal), 2) + "";
                }
            }
            catch (Exception ex)
            {
                RadMessageBox.SetThemeName("TelerikMetroBlue");
                Telerik.WinControls.RadMessageBox.Show("Tuplas de la tabla Ventas tienen un valor de NULL " + ex.HResult + "\n Revice la base de Datos");
            }

            Modificar.Add("Anio", AnyoBox.Text);
            Modificar.Add("Mes", MesList.SelectedItem.Value.ToString());
            Modificar.Add("CodigoSucursal", SucursalList.SelectedItem.Value.ToString());
            Modificar.Add("TotalReal", TotalRealx);
            Modificar.Add("TotalGravado", TxtFinal.Text);
            Modificar.Add("Iva", TxtVentaIva.Text);
            Modificar.Add("Renta", TxtRenta.Text);
            Modificar.Add("PagoAcuenta", TxtPagoCuenta.Text);
            Modificar.Add("Utilidad", TxtUtilidad.Text);

            // parameto para Actualizar tuplas
            Actualizar.Add("Anio", AnyoBox.Text);
            Actualizar.Add("Mes", MesList.SelectedItem.Value.ToString());
            Actualizar.Add("CodigoSucursal", SucursalList.SelectedItem.Value.ToString());


            opciones.InsertarATabla(NomTabla, Modificar);

            opciones.ModificarRegistro(NomTabla, Actualizar, Modificar);
        }
Ejemplo n.º 11
0
        public void mostrar()
        {
            for (int i = 0; i < vistaCompras.Length; i++)
            {
                Hashtable vistaComp = vistaCompras[i];
                foreach (DictionaryEntry r in vistaComp)
                {
//                        MessageBox.Show("Codigo de Barra:  " + r.Value + " Correlativo:   " + r.Key);
                    string   s     = r.Key + "";
                    string[] words = s.Split('*');
                    //    MessageBox.Show("Codigo de Barra: " + words[1] + "  Correlativo: " + words[0]);
                    radGridView1.Rows.AddNew();
                    int f = radGridView1.Rows.Count;
                    this.radGridView1.Rows[f - 1].Cells[0].Value = words[1];
                    this.radGridView1.Rows[f - 1].Cells[1].Value = words[0];
                    //------------------------------
                    opcionesdb opciones = new opcionesdb();
                    String     NomTabla = "inventario";
                    Hashtable  crit     = new Hashtable();
                    Hashtable  reg      = new Hashtable();
                    //Lineas con detalles especificos por metodo.
                    crit.Add("CodigoBarra", words[1]);
                    crit.Add("correlativo", words[0]);

                    reg.Add("CodigoBarra", "CodigoBarra");
                    reg.Add("Correlativo", "Correlativo");
                    reg.Add("Gravado", "Gravado");
                    DataTable tab = new DataTable();
                    tab = opciones.BuscarRegistro(NomTabla, crit, reg);
                    producto pro = new producto("", "");
                    if (tab.Rows.Count > 0)
                    {
                        DataRow row = tab.Rows[0];

                        Hashtable crity = new Hashtable();
                        Hashtable regy  = new Hashtable();
                        //Lineas con detalles especificos por metodo.
                        //  MessageBox.Show(" Codigo Barra:  "+row["CodigoBarra"].ToString() + "");

                        crity.Add("CodigoBarra", row["CodigoBarra"].ToString());

                        regy.Add("CodigoBarra", "CodigoBarra");
                        regy.Add("nombre", "nombre");

                        //   costoProductoTemporal = System.Convert.ToDouble(row["Gravado"]);
                        this.radGridView1.Rows[f - 1].Cells[3].Value = System.Convert.ToDouble(row["Gravado"]);
                        DataTable tabr = new DataTable();
                        tabr = opciones.BuscarRegistro("productos", crity, regy);

                        DataRow rowre = tabr.Rows[0];
                        pro = new producto(rowre["CodigoBarra"].ToString(), rowre["nombre"].ToString());
                        //radTextBox3.Text = pro.Nombre;
                        this.radGridView1.Rows[f - 1].Cells[2].Value = pro.Nombre;
                    }
                    else
                    {
                        MessageBox.Show("No hay producto con ese correlativo y codigo de Barra");
                    }

                    //---------------------------------------------

                    Hashtable critt = new Hashtable();
                    Hashtable regt  = new Hashtable();
                    //Lineas con detalles especificos por metodo.
                    critt.Add("CodigoBarra", words[1]);
                    critt.Add("correlativo", words[0]);

                    regt.Add("CodigoBarra", "CodigoBarra");
                    regt.Add("Correlativo", "Correlativo");
                    regt.Add("Gravado", "Gravado");
                    regt.Add("TipoPrecio", "TipoPrecio");


                    DataTable tabt = new DataTable();
                    tabt = opciones.BuscarRegistro("precios", critt, regt);
                    // MessageBox.Show("fuera DEL TIPO DE PRECIO, tamaño de la tabla: "+tabt.Rows.Count);


                    for (int y = 0; y < tabt.Rows.Count; y++)
                    {
                        //     MessageBox.Show("DENTRO DEL TIPO DE PRECIO");
                        DataRow rowt = tabt.Rows[y];
                        //  radGridView2.Rows.AddNew();                           P.V.Minimo
//                            int f = radGridView2.Rows.Count;
//                          this.radGridView2.Rows[f - 1].Cells[0].Value = rowt["TipoPrecio"];
                        if (radGridView1.Columns.Count != (4 + tabt.Rows.Count))
                        {
                            radGridView1.Columns.Add("P.V." + rowt["TipoPrecio"] + "", "P.V." + rowt["TipoPrecio"] + "");
                            radGridView1.Columns[radGridView1.Columns.Count - 1].Width = 80;
                        }


                        this.radGridView1.Rows[f - 1].Cells[4 + y].Value = Decimal.Round(System.Convert.ToDecimal(rowt["Gravado"]), 2);

//                            this.radGridView2.Rows[f - 1].Cells[1].Value = Decimal.Round(System.Convert.ToDecimal(rowt["Gravado"]), 2);
                    }


                    //------------------------------
//                        this.radGridView1.Rows[f - 1].Cells[2].Value = txtCosto.Text;
//                        this.radGridView1.Rows[f - 1].Cells[3].Value = txtCantidad.Text;
                }
            }
        }