Exemplo n.º 1
0
        private void solicitarProducto(object sender, EventArgs e)
        {
            Control aki = (Control)sender;
            Label   lbl = (Label)aki;

            int id = int.Parse(lbl.Name.ToString());

            NegocioProducto neg = new NegocioProducto();
            Producto        pro = neg.buscarProducto(id);

            TabPage tab    = tcCuentas.SelectedTab;
            string  nombre = tab.Name.ToString();

            Control[] ctl = tab.Controls.Find("dgv" + nombre, false);

            DataGridView dgv = (DataGridView)ctl[0];

            dgv.Rows.Add(pro._descripcion, pro._nombre, "1", pro._precio, pro._precio, "");

            calcularTotal(tab);
        }
Exemplo n.º 2
0
        private void ImprimirComanda()
        {
            NegocioComanda            negco    = new NegocioComanda();
            NegocioCuenta             negcu    = new NegocioCuenta();
            NegocioCuenta_Producto    negcupro = new NegocioCuenta_Producto();
            NegocioProducto           negpro   = new NegocioProducto();
            NegocioPedido             negpe    = new NegocioPedido();
            NegocioMesa               negme    = new NegocioMesa();
            NegocioIngredientes       negIng   = new NegocioIngredientes();
            NegocioLista_Ingredientes negLista = new NegocioLista_Ingredientes();
            NegocioBodegaCentral      negBod   = new NegocioBodegaCentral();



            ArrayList cuentas = negcu.getCuentaxMesa(int.Parse(e));

            foreach (Cuenta item in cuentas)
            {
                ArrayList cuenta_productos = negcupro.getCuenta_ProductoxCuenta1(item._ID_Cuenta);

                Pedido pe = negpe.buscarPedidoxMesa(int.Parse(e));

                Comanda co = new Comanda();
                co._ID_Comanda = we;
                co._Pedido     = pe._ID_Pedido;
                int empezar = 0;
                foreach (Cuenta_Producto item2 in cuenta_productos)
                {
                    Producto pro = negpro.buscarProducto(item2._producto);
                    if (empezar == 0)
                    {
                        co._detalle += " Nom Cuenta | producto | observacion | cantidad \n ";
                        empezar++;
                    }
                    co._detalle += " " + item._nombre + " | " + pro._nombre + " | " + item2._observacion + " | " + item2._cantidad + "\n ";

                    item2._expirada = 2;
                    negcupro.modificarCuenta_Producto(item2);

                    ArrayList listaingredientes = negLista.getLista_IngredientesxProducto(pro._ID_Producto);

                    foreach (Lista_Ingredientes lis in listaingredientes)
                    {
                        Bodega_Central bodega = negBod.buscarBodegaCentralxIngrediente(lis._ingrediente);

                        bodega._cantidad -= lis._cantidad;

                        negBod.modificarBodegaCentral(bodega);
                    }
                }

                co._expirada = 1;
                negco.insertarComanda(co);
            }



            Pedido pde = negpe.buscarPedidoxMesa(int.Parse(e));

            ArrayList coma = negco.getComandaxpedido(pde._ID_Pedido);

            if (coma.Count != 0)
            {
                string detailsamostrar = "";

                foreach (Comanda it in coma)
                {
                    detailsamostrar += it._detalle + "\n";
                    it._expirada     = 2;
                    negco.modificarComanda(it);
                }
                ArrayList aimp = new ArrayList();
                aimp.Add(detailsamostrar);
                MessageBox.Show(detailsamostrar);
                Pagar.Imprimir(aimp);
            }
        }
Exemplo n.º 3
0
        private void agregarCuenta(string nombre, int idcuenta)
        {
            string cuentanueva = nombre;

            if (cuentanueva != null || cuentanueva != "")
            {
                DataGridView       dg = new DataGridView();
                DataGridViewColumn re = new DataGridViewTextBoxColumn();
                re.Name       = "Column1" + cuentanueva;
                re.HeaderText = "Descripcion";
                re.ReadOnly   = true;
                DataGridViewColumn re1 = new DataGridViewTextBoxColumn();
                re1.Name       = "Column2" + cuentanueva;
                re1.HeaderText = "Producto";
                re1.Visible    = true;
                re1.ReadOnly   = true;
                DataGridViewColumn re2 = new DataGridViewTextBoxColumn();
                re2.Name       = "Column3" + cuentanueva;
                re2.HeaderText = "Cantidad";
                re2.ReadOnly   = true;
                DataGridViewColumn re3 = new DataGridViewTextBoxColumn();
                re3.Name       = "Column4" + cuentanueva;
                re3.HeaderText = "Valor";
                re3.ReadOnly   = true;
                DataGridViewColumn re4 = new DataGridViewTextBoxColumn();
                re4.Name       = "Column5" + cuentanueva;
                re4.HeaderText = "Total";
                re4.ReadOnly   = true;
                DataGridViewColumn re5 = new DataGridViewTextBoxColumn();
                re5.Name       = "Column6" + cuentanueva;
                re5.HeaderText = "Observacion";
                re5.ReadOnly   = true;
                DataGridViewColumn re6 = new DataGridViewCheckBoxColumn();
                re6.Name       = "Column7" + cuentanueva;
                re6.HeaderText = "Estado";
                dg.Name        = "dgv" + cuentanueva;
                dg.Columns.Add(re);
                dg.Columns.Add(re1);
                dg.Columns.Add(re2);
                dg.Columns.Add(re3);
                dg.Columns.Add(re4);
                dg.Columns.Add(re5);
                dg.Columns.Add(re6);
                dg.Height                = 217;
                dg.Width                 = 655;
                dg.AllowUserToAddRows    = false;
                dg.AllowUserToDeleteRows = false;
                dg.BackgroundColor       = Color.Silver;
                dg.Location              = new System.Drawing.Point(6, 6);


                Label lb = new Label();
                lb.Name     = "lbl7" + cuentanueva;
                lb.Text     = "Total a Pagar: ";
                lb.Location = new System.Drawing.Point(489, 247);
                lb.AutoSize = true;
                Label lb2 = new Label();
                lb2.Text     = "$ Monto Total ";
                lb2.Location = new System.Drawing.Point(583, 247);
                lb2.AutoSize = true;
                lb2.Name     = "lbl6" + cuentanueva;


                TabPage tab = new TabPage();
                tab.Text = cuentanueva;
                tab.Name = cuentanueva;
                tab.Controls.Add(dg);
                tab.Controls.Add(lb);
                tab.Controls.Add(lb2);
                tab.BackColor = Color.Silver;

                tcCuentas.Controls.Add(tab);

                NegocioCuenta_Producto cp = new NegocioCuenta_Producto();
                mostrar2 = cp.getCuenta_ProductoxCuenta1(idcuenta).GetEnumerator();

                while (mostrar2.MoveNext())
                {
                    Cuenta_Producto cli2 = (Cuenta_Producto)mostrar2.Current;

                    NegocioProducto neg = new NegocioProducto();
                    Producto        pro = neg.buscarProducto(cli2._producto);

                    string nombreTab = tab.Name.ToString();

                    Control[] ctl = tab.Controls.Find("dgv" + nombreTab, false);

                    DataGridView dgv = (DataGridView)ctl[0];

                    dgv.Rows.Add(pro._descripcion, pro._nombre, cli2._cantidad, pro._precio, cli2._cantidad * pro._precio, "");

                    calcularTotal(tab);
                }
            }
        }