コード例 #1
0
        private void GetOrderById(string pedidoId, ListBox lbObject)
        {
            DataSet dsPedidoDetalleInfo = DataUtil.FillDataSet(DataBaseQuerys.PedidoCocina(DataUtil.GetInt(pedidoId)), "pedido_detalle");

            foreach (DataRow pedidoDetalleRow in dsPedidoDetalleInfo.Tables["pedido_detalle"].Rows)
            {
                lbObject.Items.Add(DataUtil.GetString(pedidoDetalleRow["Pedido_cantidad"]) + " " +
                                   DataUtil.GetString(pedidoDetalleRow["Descripcion_Producto"]));
            }
        }
コード例 #2
0
        private void GetButtonInfo(Button boton, int productoSubCategoriaID)
        {
            DataSet dsMesaInfo = DataUtil.FillDataSet(DataBaseQuerys.ProductoBoton(DataUtil.GetString(boton.Tag), DataUtil.GetString(productoSubCategoriaID)), "producto_boton");

            if (dsMesaInfo.Tables[0].Rows.Count > 0)
            {
                boton.Text      = DataUtil.GetString(dsMesaInfo.Tables[0].Rows[0], "Boton_descripcion");
                boton.BackColor = Color.LightSteelBlue;
                try
                {
                    if (DataUtil.GetString(dsMesaInfo.Tables[0].Rows[0], "Boton_ruta_imagen") != string.Empty)
                    {
                        boton.Image = Image.FromFile(DataUtil.GetString(dsMesaInfo.Tables[0].Rows[0], "Boton_ruta_imagen"));
                    }
                    else
                    {
                        boton.Image = null;
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Error al cargar imagen: " + ex.Message);
                }
            }
            else
            {
                boton.Text      = "PRODUCTO";
                boton.Image     = null;
                boton.BackColor = Color.Transparent;
            }
        }
コード例 #3
0
        private void SetButtonInfo(string tipo, object sender, EventArgs e)
        {
            if (sender is Button)
            {
                Button btn = sender as Button;

                DataSet dsBoton = DataUtil.FillDataSet(DataBaseQuerys.ProductoBoton(DataUtil.GetString(btn.Tag), DataUtil.GetString(subCategoriaIdSelected)), "producto_boton");
                if (dsBoton.Tables[0].Rows.Count.Equals(1))
                {
                    if (!productoPedido)
                    {
                        frmQuickButtons frmQuickButtonsForm = new frmQuickButtons();
                        frmQuickButtonsForm.categoriaId    = categoriaIdSelected.ToString();
                        frmQuickButtonsForm.subCategoriaId = subCategoriaIdSelected.ToString();
                        frmQuickButtonsForm.botonId        = DataUtil.GetString(btn.Tag);
                        frmQuickButtonsForm.tipo           = tipo;
                        frmQuickButtonsForm.adding         = false;
                        frmQuickButtonsForm.ShowDialog();
                        GetButtonInfo(btn, subCategoriaIdSelected);
                    }
                    else
                    {
                        DataSet dsProducto = DataUtil.FillDataSet(DataBaseQuerys.Producto(DataUtil.GetString(dsBoton.Tables[0].Rows[0], "Producto_id"),
                                                                                          string.Empty,
                                                                                          string.Empty,
                                                                                          string.Empty), "producto");
                        AppConstant.ProductButtonSelected.ProductoId          = DataUtil.GetString(dsBoton.Tables[0].Rows[0], "Producto_id");
                        AppConstant.ProductButtonSelected.ProductoDescripcion = DataUtil.GetString(dsProducto.Tables[0].Rows[0], "Producto_descripcion");
                        AppConstant.ProductButtonSelected.PrecioFinal         = DataUtil.GetString(dsProducto.Tables[0].Rows[0], "Precio_final");
                        AppConstant.ProductButtonSelected.PrecioProveedor     = DataUtil.GetString(dsProducto.Tables[0].Rows[0], "Precio_proveedor");
                        this.Close();
                    }
                }
                else if (dsBoton.Tables[0].Rows.Count.Equals(0))
                {
                    DialogResult result = MessageBox.Show("Desea asignar un producto al boton?", "Asignar Producto", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    if (result == DialogResult.Yes)
                    {
                        frmQuickButtons frmQuickButtonsForm = new frmQuickButtons();
                        frmQuickButtonsForm.categoriaId    = categoriaIdSelected.ToString();
                        frmQuickButtonsForm.subCategoriaId = subCategoriaIdSelected.ToString();
                        frmQuickButtonsForm.botonId        = DataUtil.GetString(btn.Tag);
                        frmQuickButtonsForm.tipo           = tipo;
                        frmQuickButtonsForm.ShowDialog();
                        GetButtonInfo(btn, subCategoriaIdSelected);
                    }
                }
            }
        }
コード例 #4
0
        private void CargarSubCategorias(int productoCategoriaID)
        {
            if (productoCategoriaID != 0)
            {
                if (categoriaIdSelected != productoCategoriaID)
                {
                    categoriaIdSelected = productoCategoriaID;

                    LimpiarTabPage(tabPageSubCategorias, false, false);
                    string  sqlCommand      = "SELECT TOP " + maxSubCategorias + " * FROM producto_sub_categoria WHERE Producto_categoria_id = " + productoCategoriaID + " ORDER BY Producto_sub_categoria_id";
                    DataSet dsSubCategorias = DataUtil.FillDataSet(sqlCommand, "producto_sub_categoria");
                    int     rowCount        = dsSubCategorias.Tables["producto_sub_categoria"].Rows.Count;
                    if (rowCount == maxSubCategorias)
                    {
                        btnSiguienteSubCategoria.Enabled = true;
                    }
                    if (rowCount > 0)
                    {
                        int countButton = 1;
                        foreach (DataRow subCategoriaRow in dsSubCategorias.Tables["producto_sub_categoria"].Rows)
                        {
                            string subCategoriaDesc = DataUtil.GetString(subCategoriaRow["Producto_sub_categoria_descripcion"]);
                            int    subCategoriaID   = DataUtil.GetInt(subCategoriaRow["Producto_sub_categoria_id"]);

                            if (countButton == 1)
                            {
                                SetButton(btnSubCategotia1, subCategoriaID, subCategoriaDesc);
                            }
                            if (countButton == 2)
                            {
                                SetButton(btnSubCategotia2, subCategoriaID, subCategoriaDesc);
                            }
                            if (countButton == 3)
                            {
                                SetButton(btnSubCategotia3, subCategoriaID, subCategoriaDesc);
                            }
                            if (countButton == 4)
                            {
                                SetButton(btnSubCategotia4, subCategoriaID, subCategoriaDesc);
                            }
                            if (countButton == 5)
                            {
                                SetButton(btnSubCategotia5, subCategoriaID, subCategoriaDesc);
                            }
                            if (countButton == 6)
                            {
                                SetButton(btnSubCategotia6, subCategoriaID, subCategoriaDesc);
                            }
                            if (countButton == 7)
                            {
                                SetButton(btnSubCategotia7, subCategoriaID, subCategoriaDesc);
                            }
                            if (countButton == 8)
                            {
                                SetButton(btnSubCategotia8, subCategoriaID, subCategoriaDesc);
                            }
                            if (countButton == 9)
                            {
                                SetButton(btnSubCategotia9, subCategoriaID, subCategoriaDesc);
                            }
                            if (countButton == 10)
                            {
                                SetButton(btnSubCategotia10, subCategoriaID, subCategoriaDesc);
                            }
                            if (countButton == 11)
                            {
                                SetButton(btnSubCategotia11, subCategoriaID, subCategoriaDesc);
                            }
                            if (countButton == 12)
                            {
                                SetButton(btnSubCategotia12, subCategoriaID, subCategoriaDesc);
                            }
                            if (countButton == 13)
                            {
                                SetButton(btnSubCategotia13, subCategoriaID, subCategoriaDesc);
                            }
                            if (countButton == 14)
                            {
                                SetButton(btnSubCategotia14, subCategoriaID, subCategoriaDesc);
                            }
                            if (countButton == 15)
                            {
                                SetButton(btnSubCategotia15, subCategoriaID, subCategoriaDesc);
                            }
                            if (countButton == 16)
                            {
                                SetButton(btnSubCategotia16, subCategoriaID, subCategoriaDesc);
                            }
                            if (countButton == 17)
                            {
                                SetButton(btnSubCategotia17, subCategoriaID, subCategoriaDesc);
                            }
                            if (countButton == 18)
                            {
                                SetButton(btnSubCategotia18, subCategoriaID, subCategoriaDesc);
                            }
                            if (countButton == 19)
                            {
                                SetButton(btnSubCategotia19, subCategoriaID, subCategoriaDesc);
                            }
                            if (countButton == 20)
                            {
                                SetButton(btnSubCategotia20, subCategoriaID, subCategoriaDesc);
                            }

                            countButton++;
                        }
                    }
                }
            }
        }
コード例 #5
0
        private void CargarCategorias()
        {
            DataSet dsCategorias = DataUtil.FillDataSet("SELECT TOP " + maxCategorias + " * FROM producto_categoria ORDER BY Producto_categoria_id", "producto_categoria");
            int     rowCount     = dsCategorias.Tables["producto_categoria"].Rows.Count;

            if (rowCount == maxCategorias)
            {
                btnSiguienteCategoria.Enabled = true;
            }
            if (rowCount > 0)
            {
                int countButton = 1;
                foreach (DataRow categoriaRow in dsCategorias.Tables["producto_categoria"].Rows)
                {
                    string categoriaDesc = DataUtil.GetString(categoriaRow["Producto_categoria_descripcion"]);
                    int    categoriaID   = DataUtil.GetInt(categoriaRow["Producto_categoria_id"]);

                    if (countButton == 1)
                    {
                        SetButton(btnCategotia1, categoriaID, categoriaDesc);
                    }
                    if (countButton == 2)
                    {
                        SetButton(btnCategotia2, categoriaID, categoriaDesc);
                    }
                    if (countButton == 3)
                    {
                        SetButton(btnCategotia3, categoriaID, categoriaDesc);
                    }
                    if (countButton == 4)
                    {
                        SetButton(btnCategotia4, categoriaID, categoriaDesc);
                    }
                    if (countButton == 5)
                    {
                        SetButton(btnCategotia5, categoriaID, categoriaDesc);
                    }
                    if (countButton == 6)
                    {
                        SetButton(btnCategotia6, categoriaID, categoriaDesc);
                    }
                    if (countButton == 7)
                    {
                        SetButton(btnCategotia7, categoriaID, categoriaDesc);
                    }
                    if (countButton == 8)
                    {
                        SetButton(btnCategotia8, categoriaID, categoriaDesc);
                    }
                    if (countButton == 9)
                    {
                        SetButton(btnCategotia9, categoriaID, categoriaDesc);
                    }

                    countButton++;
                }
                //ADICIONAL
                if (countButton == 1)
                {
                    SetButton(btnCategotia1, 0, "ADICIONAL");
                }
                if (countButton == 2)
                {
                    SetButton(btnCategotia2, 0, "ADICIONAL");
                }
                if (countButton == 3)
                {
                    SetButton(btnCategotia3, 0, "ADICIONAL");
                }
                if (countButton == 4)
                {
                    SetButton(btnCategotia4, 0, "ADICIONAL");
                }
                if (countButton == 5)
                {
                    SetButton(btnCategotia5, 0, "ADICIONAL");
                }
                if (countButton == 6)
                {
                    SetButton(btnCategotia6, 0, "ADICIONAL");
                }
                if (countButton == 7)
                {
                    SetButton(btnCategotia7, 0, "ADICIONAL");
                }
                if (countButton == 8)
                {
                    SetButton(btnCategotia8, 0, "ADICIONAL");
                }
                if (countButton == 9)
                {
                    SetButton(btnCategotia9, 0, "ADICIONAL");
                }
            }
        }
コード例 #6
0
        private void Venta()
        {
            stringSQL = "vd.precio_final," +
                        "prd.Producto_categoria_id " +
                        " FROM ((venta_detalle AS vd" +
                        " LEFT JOIN producto AS prd ON vd.Codigo_Producto = prd.producto_id)" +
                        " LEFT JOIN venta AS v ON vd.venta_id = v.venta_id) " +
                        "WHERE v.venta_id <> 0";

            stringSQL = stringSQL + BuildWhereVenta();

            dsSearch = DataUtil.FillDataSet("SELECT " + stringSQL + "", "venta_detalle");

            foreach (DataRow searchRow in dsSearch.Tables["venta_detalle"].Rows)
            {
                switch (DataUtil.GetString(searchRow["Producto_categoria_id"]))
                {
                case AppConstant.ProductoCategoriaDelSistema.Bebidas:
                    ventaBebidas = ventaBebidas + DataUtil.GetDouble(searchRow["precio_final"]);
                    break;

                case AppConstant.ProductoCategoriaDelSistema.Entradas:
                case AppConstant.ProductoCategoriaDelSistema.PlatosPrincipales:
                case AppConstant.ProductoCategoriaDelSistema.Postres:
                    ventaAlimentos = ventaAlimentos + DataUtil.GetDouble(searchRow["precio_final"]);
                    break;

                default:
                    ventaOtros = ventaOtros + DataUtil.GetDouble(searchRow["precio_final"]);
                    break;
                }
            }
            txtVentaBedidas.Text   = ventaBebidas.ToString(DataUtil.Format.Decimals);
            txtVentaAlimentos.Text = ventaAlimentos.ToString(DataUtil.Format.Decimals);
            txtVentaOtros.Text     = ventaOtros.ToString(DataUtil.Format.Decimals);
            ventaSubTotal          = ventaBebidas + ventaAlimentos + ventaOtros;
            txtVentaSubtotal.Text  = ventaSubTotal.ToString(DataUtil.Format.Decimals);

            stringSQL = "venta_documento_tipo," +
                        "IGV_Total, " +
                        "Monto_Total, " +
                        "Monto_descuento, " +
                        "Tipo_pago, " +
                        "Tipo_venta " +
                        " FROM venta " +
                        "WHERE venta_id <> 0";

            stringSQL = stringSQL + BuildWhereVenta();

            dsSearch = DataUtil.FillDataSet("SELECT " + stringSQL + "", "venta");

            foreach (DataRow searchRow in dsSearch.Tables["venta"].Rows)
            {
                ventaDescuentos = ventaDescuentos + DataUtil.GetDouble(searchRow["Monto_descuento"]);
                ventaIGV        = ventaIGV + DataUtil.GetDouble(searchRow["IGV_Total"]);
                ventaConIGV     = ventaConIGV + DataUtil.GetDouble(searchRow["Monto_Total"]);

                switch (DataUtil.GetString(searchRow["Tipo_venta"]))
                {
                case AppConstant.TipoVenta.Salon:
                    ventaSalon = ventaSalon + DataUtil.GetDouble(searchRow["Monto_Total"]);
                    break;

                case AppConstant.TipoVenta.Rapida:
                    ventaRapido = ventaRapido + DataUtil.GetDouble(searchRow["Monto_Total"]);
                    break;

                case AppConstant.TipoVenta.Delivery:
                    ventaDelivery = ventaDelivery + DataUtil.GetDouble(searchRow["Monto_Total"]);
                    break;
                }

                switch (DataUtil.GetString(searchRow["Tipo_pago"]))
                {
                case AppConstant.TipoPago.Contado:
                    ventaContado = ventaContado + DataUtil.GetDouble(searchRow["Monto_Total"]);
                    break;

                case AppConstant.TipoPago.TarjetaCredito:
                    ventaTarjeta = ventaTarjeta + DataUtil.GetDouble(searchRow["Monto_Total"]);
                    break;

                case AppConstant.TipoPago.Cheque:
                    ventaCheque = ventaCheque + DataUtil.GetDouble(searchRow["Monto_Total"]);
                    break;
                }
            }
            txtVentaDescuentos.Text = ventaDescuentos.ToString(DataUtil.Format.Decimals);
            ventaTotal          = ventaSubTotal - ventaDescuentos;
            txtVentaTotal.Text  = ventaTotal.ToString(DataUtil.Format.Decimals);
            txtVentaIGV.Text    = ventaIGV.ToString(DataUtil.Format.Decimals);
            txtVentaConIGV.Text = ventaConIGV.ToString(DataUtil.Format.Decimals);

            txtVentaSalon.Text        = ventaSalon.ToString(DataUtil.Format.Decimals);
            txtVentaRapida.Text       = ventaRapido.ToString(DataUtil.Format.Decimals);
            txtVentaDelivery.Text     = ventaDelivery.ToString(DataUtil.Format.Decimals);
            ventaTotalPorTipo         = ventaSalon + ventaRapido + ventaDelivery;
            txtVentaTotalPorTipo.Text = ventaTotalPorTipo.ToString(DataUtil.Format.Decimals);

            txtVentaContado.Text        = ventaContado.ToString(DataUtil.Format.Decimals);
            txtVentaTarjetaCredito.Text = ventaTarjeta.ToString(DataUtil.Format.Decimals);
            txtVentaCheque.Text         = ventaCheque.ToString(DataUtil.Format.Decimals);
        }
コード例 #7
0
 private bool VerificarDuplicados()
 {
     if (IsReadyToSaveFirst())
     {
         string categoriaWhere = "Producto_categoria_descripcion = '" + DataUtil.GetString(cbCategoria.SelectedItem) + "'";
         string sWhere         = "Producto_sub_categoria_descripcion = '" + txtDescripcion.Text.Trim().Replace("'", "''") + "' AND Producto_categoria_id = " + DataUtil.FindSingleRow("producto_categoria", "Producto_categoria_id", categoriaWhere) + "";
         if (DataUtil.GetInt(DataUtil.FindSingleRow(tableName, "Count(*)", sWhere)) > 0)
         {
             MessageBox.Show("La sub categoria '" + txtDescripcion.Text.Trim() + "' ya existe.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
             return(false);
         }
     }
     return(true);
 }
コード例 #8
0
        private void txtProducto_Leave(object sender, EventArgs e)
        {
            if (txtCodigo.Text == string.Empty)
            {
                DataSet dsSearch = null;
                if (!txtProducto.ReadOnly)
                {
                    txtCodigo.Text = string.Empty;

                    if (txtProducto.Text != string.Empty)
                    {
                        string stringSQL = DataBaseQuerys.ProductoSearch();

                        if (txtProducto.Text.Trim() != "*")
                        {
                            dsSearch = DataUtil.FillDataSet("SELECT " + stringSQL + " WHERE p.Producto_tipo = '" + tipo + "' AND p.Producto_categoria_id = " + categoriaId + " AND p.Producto_sub_categoria_id = " + subCategoriaId + " AND p.Estado = '" + AppConstant.RegistroEstado.Activo + "' AND  p.Producto_descripcion like '%" + txtProducto.Text.Trim().Replace("'", "''") + "%' ORDER BY p.Producto_descripcion", "producto");
                        }
                        else
                        {
                            dsSearch = DataUtil.FillDataSet("SELECT " + stringSQL + " WHERE p.Producto_tipo = '" + tipo + "' AND p.Producto_categoria_id = " + categoriaId + " AND p.Producto_sub_categoria_id = " + subCategoriaId + " AND p.Estado = '" + AppConstant.RegistroEstado.Activo + "' ORDER BY p.Producto_descripcion", "producto");
                        }

                        if (dsSearch.Tables[0].Rows.Count == 1)
                        {
                            txtProducto.Text    = DataUtil.GetString(dsSearch.Tables[0].Rows[0], "Producto");
                            txtDescripcion.Text = DataUtil.GetString(dsSearch.Tables[0].Rows[0], "Descripcion Corta");
                            txtCodigo.Text      = DataUtil.GetString(dsSearch.Tables[0].Rows[0], "Codigo");
                        }
                        else if (dsSearch.Tables[0].Rows.Count > 1)
                        {
                            frmProductSearch frmProductSearchForm = new frmProductSearch();
                            frmProductSearchForm.descriptionSearch    = txtProducto.Text;
                            frmProductSearchForm.dsSearchProd         = dsSearch;
                            frmProductSearchForm.tipoSearch           = tipo;
                            frmProductSearchForm.categoriaIdSearch    = categoriaId;
                            frmProductSearchForm.subCategoriaIdSearch = subCategoriaId;
                            frmProductSearchForm.ShowDialog();
                            SetProductValues();
                        }
                        else
                        {
                            DialogResult result = MessageBox.Show("No existe el producto. Desea crear uno nuevo?", "Producto", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                            if (result == DialogResult.Yes)
                            {
                                frmProduct frmProductAdd = new frmProduct();
                                frmProductAdd.adding                   = true;
                                frmProductAdd.createSpecial            = true;
                                frmProductAdd.productoNombre           = txtProducto.Text.Trim();
                                frmProductAdd.formTitle                = "Producto - Agregar";
                                frmProductAdd.tipo_quickButton         = tipo;
                                frmProductAdd.categoria_quickButton    = categoriaId;
                                frmProductAdd.subcategoria_quickButton = subCategoriaId;
                                frmProductAdd.ShowDialog();
                                SetProductValues();
                            }
                            else
                            {
                                txtProducto.Focus();
                            }
                        }
                    }
                }
            }
            else
            {
            }
        }
コード例 #9
0
        private void ProceedOpen()
        {
            if ((dgwResult.Rows.Count > 0) && (dgwResult.CurrentRow.Cells[0].Value != null))
            {
                // Obtener el ID seleccionado
                string valueID = DataUtil.GetString(dgwResult.CurrentRow.Cells[0].Value);

                switch (tableNameBrowser)
                {
                case "empleado":
                    frmEmployee frmEmployeeEdit = new frmEmployee();
                    frmEmployeeEdit.adding    = false;
                    frmEmployeeEdit.formTitle = "Empleados - Modificar";
                    frmEmployeeEdit.formId    = valueID;
                    frmEmployeeEdit.ShowDialog();
                    break;

                case "cliente":
                    frmCustomer frmCustomerEdit = new frmCustomer();
                    frmCustomerEdit.adding    = false;
                    frmCustomerEdit.formTitle = "Clientes - Modificar";
                    frmCustomerEdit.formId    = valueID;
                    frmCustomerEdit.ShowDialog();
                    break;

                case "producto":
                    frmProduct frmProductEdit = new frmProduct();
                    frmProductEdit.adding    = false;
                    frmProductEdit.formTitle = "Producto - Modificar";
                    frmProductEdit.formId    = valueID;
                    frmProductEdit.ShowDialog();
                    break;

                case "producto_categoria":
                    frmProductCategory frmProductCategoryEdit = new frmProductCategory();
                    frmProductCategoryEdit.adding    = false;
                    frmProductCategoryEdit.formTitle = "Producto Categoria - Modificar";
                    frmProductCategoryEdit.formId    = valueID;
                    frmProductCategoryEdit.ShowDialog();
                    break;

                case "producto_sub_categoria":
                    frmProductSubCategory frmProductSubCategoryEdit = new frmProductSubCategory();
                    frmProductSubCategoryEdit.adding    = false;
                    frmProductSubCategoryEdit.formTitle = "Producto Sub Categoria - Modificar";
                    frmProductSubCategoryEdit.formId    = valueID;
                    frmProductSubCategoryEdit.ShowDialog();
                    break;

                case "proveedor":
                    frmSupplier frmSupplierEdit = new frmSupplier();
                    frmSupplierEdit.adding    = false;
                    frmSupplierEdit.formTitle = "Proveedor - Modificar";
                    frmSupplierEdit.formId    = valueID;
                    frmSupplierEdit.ShowDialog();
                    break;

                case "estacion":
                    frmStation frmStationEdit = new frmStation();
                    frmStationEdit.adding    = false;
                    frmStationEdit.formTitle = "Estacion de Trabajo - Modificar";
                    frmStationEdit.formId    = valueID;
                    frmStationEdit.ShowDialog();
                    break;

                case "turno":
                    frmTurn frmTurnEdit = new frmTurn();
                    frmTurnEdit.adding    = false;
                    frmTurnEdit.formTitle = "Turno - Modificar";
                    frmTurnEdit.formId    = valueID;
                    frmTurnEdit.ShowDialog();
                    break;

                case "Insumo_grupo_clasificacion":
                    frmInsumoGroupClassification frmInsumoGroupClassificationEdit = new frmInsumoGroupClassification();
                    frmInsumoGroupClassificationEdit.adding    = false;
                    frmInsumoGroupClassificationEdit.formTitle = "Clasificación de grupos de insumos - Modificar";
                    frmInsumoGroupClassificationEdit.formId    = valueID;
                    frmInsumoGroupClassificationEdit.ShowDialog();
                    break;

                case "Insumo_grupo":
                    frmInsumoGroup frmInsumoGroupEdit = new frmInsumoGroup();
                    frmInsumoGroupEdit.adding    = false;
                    frmInsumoGroupEdit.formTitle = "Grupos de insumos - Modificar";
                    frmInsumoGroupEdit.formId    = valueID;
                    frmInsumoGroupEdit.ShowDialog();
                    break;

                case "Presentacion_Insumo":
                    frmInsumoPresentacion frmInsumoPresentacionEdit = new frmInsumoPresentacion();
                    frmInsumoPresentacionEdit.adding    = false;
                    frmInsumoPresentacionEdit.formTitle = "Presentaciones de insumos - Modificar";
                    frmInsumoPresentacionEdit.formId    = valueID;
                    frmInsumoPresentacionEdit.ShowDialog();
                    break;
                }
                AfterSearch();
            }
            else
            {
                MessageBox.Show("No se seleccionó ningún elemento, o no existen elementos a seleccionar!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
コード例 #10
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (IsReadyToSave())
            {
                string sqlForExecute = string.Empty;
                try
                {
                    string grupoWhere     = "Insumo_grupo_descripcion = '" + DataUtil.GetString(cbGrupo.SelectedItem) + "'";
                    string insumoWhere    = "Insumo_descripcion = '" + DataUtil.GetString(cbInsumoBase.SelectedItem) + "'";
                    string proveedorWhere = "Proveedor_nombre = '" + DataUtil.GetString(cbProveedor.SelectedItem) + "'";
                    string proveedorValue = "null";
                    string insumoValue    = "null";

                    if (DataUtil.GetString(cbProveedor.SelectedItem) != string.Empty)
                    {
                        proveedorValue = DataUtil.FindSingleRow("proveedor", "Proveedor_id", proveedorWhere);
                    }

                    if (DataUtil.GetString(cbInsumoBase.SelectedItem) != string.Empty)
                    {
                        insumoValue = DataUtil.FindSingleRow("insumo", "Insumo_id", proveedorWhere);
                    }


                    if (adding)
                    {
                        txtCodigo.Text = DataUtil.GetString(DataUtil.GetNewId(tableName));

                        if (DataUtil.GetString(cbProveedor.SelectedItem) != string.Empty)
                        {
                            proveedorValue = "'" + proveedorValue + "',";
                        }
                        else
                        {
                            proveedorValue = "" + proveedorValue + ",";
                        }

                        if (DataUtil.GetString(cbInsumoBase.SelectedItem) != string.Empty)
                        {
                            insumoValue = "'" + insumoValue + "',";
                        }
                        else
                        {
                            insumoValue = "" + insumoValue + ",";
                        }

                        sqlForExecute = "INSERT INTO " + tableName + " (" +
                                        formWhereField + "," +
                                        "Insumo_grupo_id," +
                                        "Presentacion_descripcion," +
                                        "Ultimo_costo," +
                                        "Costo_promedio," +
                                        "IGV," +
                                        "Costo_impuesto," +
                                        "Proveedor_id," +
                                        "Insumo_base_id," +
                                        "Rendimiento_valor," +
                                        "Rendimiento_unidad," +
                                        "Fecha_creacion," +
                                        "Creado_por," +
                                        "Fecha_actualizacion," +
                                        "Actualizado_por," +
                                        "Estado)" +
                                        " VALUES (" +
                                        txtCodigo.Text + "," +
                                        "'" + DataUtil.FindSingleRow("Insumo_grupo", "Insumo_grupo_id", grupoWhere) + "'," +
                                        "'" + txtDescripcion.Text.Replace("'", "''") + "'," +
                                        "'" + txtUltimoCosto.Text.Trim() + "'," +
                                        "'" + txtCostoPromedio.Text.Trim() + "'," +
                                        "'" + txtIGV.Text.Trim() + "'," +
                                        "'" + txtCostoImpuesto.Text.Trim() + "'," +
                                        proveedorValue +
                                        insumoValue +
                                        "'" + txtRendimiento.Text.Trim() + "'," +
                                        "'" + txtRendimientoUnidad.Text.Trim() + "'," +
                                        "'" + DateTime.Now + "'," +
                                        "'" + AppConstant.EmployeeInfo.Codigo + "'," +
                                        "'" + DateTime.Now + "'," +
                                        "'" + AppConstant.EmployeeInfo.Codigo + "'," +
                                        "'" + cbEstado.SelectedItem + "'" +
                                        ")";
                    }
                    else
                    {
                        if (DataUtil.GetString(cbProveedor.SelectedItem) != string.Empty)
                        {
                            proveedorValue = ", Proveedor_id = '" + proveedorValue + "'";
                        }
                        else
                        {
                            proveedorValue = ", Proveedor_id = " + proveedorValue + "";
                        }

                        if (DataUtil.GetString(cbInsumoBase.SelectedItem) != string.Empty)
                        {
                            insumoValue = ", Insumo_base_id = '" + insumoValue + "'";
                        }
                        else
                        {
                            insumoValue = ", Insumo_base_id = " + insumoValue + "";
                        }

                        sqlForExecute = "UPDATE " + tableName + " SET " +
                                        " Insumo_grupo_id = '" + DataUtil.FindSingleRow("Insumo_grupo", "Insumo_grupo_id", grupoWhere) + "'" +
                                        ",Presentacion_descripcion = '" + txtDescripcion.Text.Trim().Replace("'", "''") + "'" +
                                        ",Ultimo_costo = '" + txtUltimoCosto.Text.Trim() + "'" +
                                        ",Costo_promedio = '" + txtCostoPromedio.Text.Trim() + "'" +
                                        ",IGV = '" + txtIGV.Text.Trim() + "'" +
                                        ",Costo_impuesto = '" + txtCostoImpuesto.Text.Trim() + "'" +
                                        proveedorValue +
                                        insumoValue +
                                        ",Rendimiento_valor = '" + txtRendimiento.Text.Trim() + "'" +
                                        ",Rendimiento_unidad = '" + txtRendimientoUnidad.Text.Trim() + "'" +
                                        ", Fecha_actualizacion = '" + DateTime.Now + "'" +
                                        ", Actualizado_por = '" + AppConstant.EmployeeInfo.Codigo + "'" +
                                        ", Estado = '" + cbEstado.SelectedItem + "'" +
                                        " WHERE " + formWhereField + " = " + txtCodigo.Text;
                    }

                    if (DataUtil.Update(sqlForExecute))
                    {
                        MessageBox.Show("Registro grabado correctamente", "Informacion", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        if (adding)
                        {
                            this.Close();
                        }
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Error en Grabar: " + ex.Message);
                }
            }
        }
コード例 #11
0
        private void cbGrupo_SelectedValueChanged(object sender, EventArgs e)
        {
            cbInsumoBase.SelectedItem = string.Empty;
            string categoriaWhere = "Insumo_grupo_descripcion = '" + DataUtil.GetString(cbGrupo.SelectedItem) + "'";

            DataUtil.FillComboBox(cbInsumoBase.Items, DataBaseQuerys.InsumosActivos(false, DataUtil.FindSingleRow("Insumo_grupo", "Insumo_grupo_id", categoriaWhere)), null);
        }
コード例 #12
0
 private bool VerificarDuplicados()
 {
     if (IsReadyToSaveFirst())
     {
         string  grupoWhere = "Insumo_grupo_descripcion = '" + DataUtil.GetString(cbGrupo.SelectedItem) + "'";
         DataSet dsSearch   = DataUtil.FillDataSet(DataBaseQuerys.PresentacionInsumo(string.Empty,
                                                                                     DataUtil.FindSingleRow("Insumo_grupo", "Insumo_grupo_id", grupoWhere),
                                                                                     txtDescripcion.Text.Trim().Replace("'", "''")), "Presentacion_Insumo");
         if (dsSearch.Tables[0].Rows.Count > 0)
         {
             MessageBox.Show("La presentacion '" + txtDescripcion.Text.Trim() + "' ya existe.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
             return(false);
         }
         return(true);
     }
     else
     {
         return(false);
     }
 }
コード例 #13
0
        private void LoadButtons()
        {
            foreach (Control button in this.Controls)
            {
                if (button is Button)
                {
                    Button mesa = button as Button;

                    if (mesa.Tag != null)
                    {
                        DataSet dsMesaInfo = DataUtil.FillDataSet(DataBaseQuerys.Mesa(DataUtil.GetInt(mesa.Tag)), "mesa");
                        mesa.Text    = DataUtil.GetString(dsMesaInfo.Tables[0].Rows[0], "Mesa_descripcion");
                        mesa.Visible = DataUtil.GetBool(dsMesaInfo.Tables[0].Rows[0], "Mesa_habilitado");
                        if (DataUtil.GetString(dsMesaInfo.Tables[0].Rows[0], "Mesa_estado").Equals("LIBRE"))
                        {
                            mesa.Image = RestautantResource.Mesa;
                        }
                        else
                        {
                            mesa.Image = RestautantResource.MesaOcupada;
                        }
                    }
                }
            }
        }
コード例 #14
0
        private void GetOrders()
        {
            ClearObjects();
            btnSiguiente.Enabled = false;

            string stringSQL = "p.Pedido_id, " +
                               "p.Mesa_id," +
                               "p.Fecha_Pedido, " +
                               "p.Turno_id, " +
                               "p.Orden_turno, " +
                               "up.Apellidos_empleado+', '+up.Nombres_empleado AS Mozo, " +
                               "p.Tipo_venta" +
                               " FROM ((pedido AS p LEFT JOIN empleado AS up ON p.Atendido_por = up.codigo_empleado) " +
                               " LEFT JOIN cliente AS c ON p.Cliente_id = c.Cliente_id) ";

            DataSet dsSearch = new DataSet();

            if (currentLastPedidoId == 0)
            {
                dsSearch = DataUtil.FillDataSet("SELECT TOP 6 " + stringSQL + " WHERE p.Estado = 'A' ORDER BY p.Fecha_Pedido", "pedido");
            }
            else
            {
                dsSearch = DataUtil.FillDataSet("SELECT TOP 6 " + stringSQL + " WHERE p.Estado = 'A' AND p.Pedido_id > " + currentLastPedidoId + " ORDER BY p.Fecha_Pedido", "pedido");
            }

            lastPedidoId = 0;
            if (dsSearch.Tables[0].Rows.Count > 0)
            {
                int count = 0;
                foreach (DataRow row in dsSearch.Tables[0].Rows)
                {
                    count++;
                    DateTime fechaPedido = DataUtil.GetDateTime(row["Fecha_Pedido"]);
                    DateTime fechaActual = DateTime.Now;

                    string pedidoId = DataUtil.GetString(row["Pedido_id"]);
                    string order    = "Order #: " + DataUtil.GetString(row["Pedido_id"]) + " - Mesa #: " + DataUtil.GetString(row["Mesa_id"]) + " - " + DataUtil.GetString(row["Tipo_venta"]);
                    string mozo     = "Mozo :" + DataUtil.GetString(row["Mozo"]);
                    string tiempo   = "Tiempo Transcurrido: " + Math.Truncate(fechaActual.Subtract(fechaPedido).TotalMinutes);

                    switch (count)
                    {
                    case 1:
                        txtOrder1.Text  = order;
                        txtMesero1.Text = mozo;
                        txtTiempo1.Text = tiempo;
                        lblOrder1.Text  = pedidoId;
                        GetOrderById(pedidoId, lb1);
                        break;

                    case 2:
                        txtOrder2.Text  = order;
                        txtMesero2.Text = mozo;
                        txtTiempo2.Text = tiempo;
                        lblOrder2.Text  = pedidoId;
                        GetOrderById(pedidoId, lb2);
                        break;

                    case 3:
                        txtOrder3.Text  = order;
                        txtMesero3.Text = mozo;
                        txtTiempo3.Text = tiempo;
                        lblOrder3.Text  = pedidoId;
                        GetOrderById(pedidoId, lb3);
                        break;

                    case 4:
                        txtOrder4.Text  = order;
                        txtMesero4.Text = mozo;
                        txtTiempo4.Text = tiempo;
                        lblOrder4.Text  = pedidoId;
                        GetOrderById(pedidoId, lb4);
                        break;

                    case 5:
                        txtOrder5.Text  = order;
                        txtMesero5.Text = mozo;
                        txtTiempo5.Text = tiempo;
                        lblOrder5.Text  = pedidoId;
                        GetOrderById(pedidoId, lb5);
                        break;

                    case 6:
                        txtOrder6.Text  = order;
                        txtMesero6.Text = mozo;
                        txtTiempo6.Text = tiempo;
                        lblOrder6.Text  = pedidoId;
                        GetOrderById(pedidoId, lb6);
                        lastPedidoId         = DataUtil.GetInt(pedidoId);
                        btnSiguiente.Enabled = true;
                        break;
                    }
                }
            }
            else
            {
                currentLastPedidoId = 0;
            }
        }
コード例 #15
0
        private bool ExistenOrdenesAsociadas()
        {
            var result   = false;
            var dsPedido = DataUtil.FillDataSet(DataBaseQuerys.FillMainDataSet("pedido", "Pedido_origen_id", DataUtil.GetString(pedidoID), string.Empty), "pedido");

            if (dsPedido.Tables[0].Rows.Count > 0)
            {
                result = true;
            }
            return(result);
        }
コード例 #16
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            string sqlFill = string.Empty;

            if (IsReadyToSearch())
            {
                if (cbField.SelectedIndex.Equals(0) || cbField.SelectedIndex.Equals(-1))
                {
                    sqlFill = "SELECT " + selectSQL + " FROM " + tablesJoinsBrowser + "";
                }
                else
                {
                    sqlFill = "SELECT " + selectSQL + " FROM " + tablesJoinsBrowser + " WHERE " + cbField.SelectedItem + " like '%" + txtValue.Text.Trim() + "%'";
                }


                if (cbCategoria.SelectedItem != null)
                {
                    if (sqlFill.Contains("WHERE"))
                    {
                        sqlFill = sqlFill + " AND pc.Producto_categoria_descripcion = '" + DataUtil.GetString(cbCategoria.SelectedItem) + "'";
                    }
                    else
                    {
                        sqlFill = sqlFill + " WHERE pc.Producto_categoria_descripcion = '" + DataUtil.GetString(cbCategoria.SelectedItem) + "'";
                    }
                }

                if (cbSubCategoria.SelectedItem != null)
                {
                    if (sqlFill.Contains("WHERE"))
                    {
                        sqlFill = sqlFill + " AND psc.Producto_sub_categoria_descripcion = '" + DataUtil.GetString(cbSubCategoria.SelectedItem) + "'";
                    }
                    else
                    {
                        sqlFill = sqlFill + " WHERE psc.Producto_sub_categoria_descripcion = '" + DataUtil.GetString(cbSubCategoria.SelectedItem) + "'";
                    }
                }

                searchSQL = sqlFill;
                DataSet dsSearch = DataUtil.FillDataSet(sqlFill, tableNameBrowser);
                dgwResult.DataSource = dsSearch;
                dgwResult.DataMember = tableNameBrowser;

                if (dsSearch.Tables[0].Rows.Count > 0)
                {
                    lblNo.Text = DataUtil.GetString(dsSearch.Tables[0].Rows.Count);
                }
                else
                {
                    lblNo.Text = "0";
                    MessageBox.Show("No se encontro ningún registro.", "Informacion", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }
コード例 #17
0
        private void PrintDocuments(int pedidoIdPrint, int rePrint)
        {
            string  sqlUpdate;
            var     reportViewerForm = new ReportViewer();
            DataSet dsResult         = null;

            bool printCocina   = false;
            bool printBar      = false;
            bool printCocinaOk = false;
            bool printBarOk    = false;

            if (cbCocina.Checked)
            {
                dsResult = DataUtil.FillDataSet(DataBaseQuerys.ReporteCocina(pedidoIdPrint, rePrint), "pedido_detalle");
                if (dsResult.Tables[0].Rows.Count > 0)
                {
                    if (AppConstant.GeneralInfo.Impresora.Cocina != string.Empty)
                    {
                        if (AppConstant.GeneralInfo.PrintText.Cocina)
                        {
                            PrintByText.printDocument(AppConstant.GeneralInfo.Impresora.Cocina, dsResult, "C");
                        }
                        else
                        {
                            reportViewerForm.dsReport        = dsResult;
                            reportViewerForm.reporteName     = AppConstant.Reportes.Cocina;
                            reportViewerForm.tableNameReport = "pedido_detalle";
                            reportViewerForm.printerName     = string.Empty;

                            reportViewerForm.printerName = AppConstant.GeneralInfo.Impresora.Cocina;
                            reportViewerForm.ShowDialog();
                        }
                        printCocina = true;
                    }
                    else
                    {
                        MessageBox.Show(@"La impresora de la cocina no esta configurada.", @"Informacion", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }

                    sqlUpdate = "UPDATE pedido_detalle SET Impreso = 1 WHERE Codigo_Producto IN (SELECT Producto_id FROM Producto WHERE Producto_categoria_id <> 3) AND pedido_id = " + pedidoIdPrint + "";
                    DataUtil.UpdateThrow(sqlUpdate);
                }
                else
                {
                    if (rePrint == 1)
                    {
                        MessageBox.Show(@"No existen nuevos productos o productos modificados.", @"Informacion", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
            }
            if (cbBar.Checked)
            {
                if (printCocina)
                {
                    var diagResult = MessageBox.Show(@"Imprimio Correctamente el ticket de Cocina?", @"Impresion", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    if (diagResult == DialogResult.Yes)
                    {
                        printCocinaOk = true;
                    }
                }
                else
                {
                    printCocinaOk = true;
                }

                if (printCocinaOk)
                {
                    dsResult = DataUtil.FillDataSet(DataBaseQuerys.ReporteBar(pedidoIdPrint, rePrint), "pedido_detalle");
                    if (dsResult.Tables[0].Rows.Count > 0)
                    {
                        if (AppConstant.GeneralInfo.Impresora.Bar != string.Empty)
                        {
                            if (AppConstant.GeneralInfo.PrintText.Bar)
                            {
                                PrintByText.printDocument(AppConstant.GeneralInfo.Impresora.Bar, dsResult, "B");
                            }
                            else
                            {
                                reportViewerForm.dsReport        = dsResult;
                                reportViewerForm.reporteName     = AppConstant.Reportes.Bar;
                                reportViewerForm.tableNameReport = "pedido_detalle";
                                reportViewerForm.printerName     = string.Empty;

                                reportViewerForm.printerName = AppConstant.GeneralInfo.Impresora.Bar;
                                reportViewerForm.ShowDialog();
                            }

                            printBar = true;
                        }
                        else
                        {
                            MessageBox.Show(@"La impresora del Bar no esta configurada.", @"Informacion", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }

                        sqlUpdate = "UPDATE pedido_detalle SET Impreso = 1 WHERE Codigo_Producto IN (SELECT Producto_id FROM Producto WHERE Producto_categoria_id = 3) AND pedido_id = " + pedidoIdPrint + "";
                        DataUtil.UpdateThrow(sqlUpdate);
                    }
                    else
                    {
                        if (rePrint == 1)
                        {
                            MessageBox.Show(@"No existen nuevos productos o productos modificados.", @"Informacion", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                    }
                }
            }
        }
コード例 #18
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (btnCreateOrder.Visible)
            {
                if (txtCantidad.Text.Trim() != string.Empty && txtProducto.Text.Trim() != string.Empty)
                {
                    double calculoMonto;
                    double descuentoMonto = 0;
                    if (txtDescuento.Text.Trim() != string.Empty)
                    {
                        calculoMonto = Math.Round((DataUtil.GetDouble(txtPrecioUnitario.Text) * (1 - DataUtil.GetDouble(txtDescuento.Text) / 100)) * DataUtil.GetInt(txtCantidad.Text), 2);
                        var totalSinDescuento = Math.Round((DataUtil.GetDouble(txtPrecioUnitario.Text) * DataUtil.GetInt(txtCantidad.Text)), 2);
                        descuentoMonto = Math.Round(totalSinDescuento - calculoMonto, 2);
                    }
                    else
                    {
                        calculoMonto = Math.Round((DataUtil.GetDouble(txtPrecioUnitario.Text) * DataUtil.GetInt(txtCantidad.Text)), 2);
                    }

                    var montoIgv = Math.Round((calculoMonto * 1.18), 1);

                    lineGrid = lineGrid + 1;
                    string[] row =
                    {
                        DataUtil.GetString(lineGrid),
                        txtCodigoProducto.Text,
                        txtProducto.Text,
                        txtCantidad.Text,
                        txtDescuento.Text,
                        DataUtil.GetString(calculoMonto),
                        txtPrecioUnitario.Text,
                        txtProductoPrecioProveedor.Text,
                        DataUtil.GetString(montoIgv),
                        DataUtil.GetString(descuentoMonto)
                    };
                    dgwCuenta.Rows.Add(row);
                    CalculoMontos(calculoMonto, true, descuentoMonto);

                    txtCodigoProducto.Text          = string.Empty;
                    txtProducto.Text                = string.Empty;
                    txtCantidad.Text                = @"1";
                    txtDescuento.Text               = string.Empty;
                    txtPrecioUnitario.Text          = string.Empty;
                    txtProductoPrecioProveedor.Text = string.Empty;

                    txtProducto.Focus();
                }
                else
                {
                    txtProducto.Focus();
                    MessageBox.Show(@"Debe ingresar el Producto y la cantidad.", @"Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                MessageBox.Show(@"Debe crear una nueva orden.", @"Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #19
0
        private void PorCobrar()
        {
            double ventaBebidas_Cobrar   = 0;
            double ventaAlimentos_Cobrar = 0;
            double ventaOtros_Cobrar     = 0;
            double ventaSubTotal_Cobrar  = 0;
            double ventaIGV_Cobrar       = 0;
            double ventaConIGV_Cobrar    = 0;

            stringSQL = "       Producto.Producto_categoria_id," +
                        "       Pedido_detalle.Descuento AS Pedido_Descuento," +
                        "       Producto.Precio_final AS Producto_precio " +
                        "  FROM Producto " +
                        " INNER JOIN (Pedido " +
                        " INNER JOIN Pedido_detalle ON Pedido.Pedido_id = Pedido_detalle.Pedido_id) " +
                        "                           ON Producto.Producto_id = Pedido_detalle.Codigo_Producto" +
                        " WHERE Pedido.pedido_id <> 0";

            stringSQL = stringSQL + BuildWherePedidoPorCobrar();
            dsSearch  = DataUtil.FillDataSet("SELECT " + stringSQL + "", "Pedido_detalle");

            foreach (DataRow searchRow in dsSearch.Tables["Pedido_detalle"].Rows)
            {
                ventaDescuentos = ventaDescuentos + DataUtil.GetDouble(searchRow["Pedido_Descuento"]);

                switch (DataUtil.GetString(searchRow["Producto_categoria_id"]))
                {
                case AppConstant.ProductoCategoriaDelSistema.Bebidas:
                    ventaBebidas_Cobrar = ventaBebidas_Cobrar + DataUtil.GetDouble(searchRow["Producto_precio"]);
                    break;

                case AppConstant.ProductoCategoriaDelSistema.Entradas:
                case AppConstant.ProductoCategoriaDelSistema.PlatosPrincipales:
                case AppConstant.ProductoCategoriaDelSistema.Postres:
                    ventaAlimentos_Cobrar = ventaAlimentos_Cobrar + DataUtil.GetDouble(searchRow["Producto_precio"]);
                    break;

                default:
                    ventaOtros_Cobrar = ventaOtros_Cobrar + DataUtil.GetDouble(searchRow["Producto_precio"]);
                    break;
                }
            }
            ventaSubTotal_Cobrar = ventaBebidas_Cobrar + ventaAlimentos_Cobrar + ventaOtros_Cobrar;
            ventaBebidas         = ventaBebidas + ventaBebidas_Cobrar;
            ventaAlimentos       = ventaAlimentos + ventaAlimentos_Cobrar;
            ventaOtros           = ventaOtros + ventaOtros_Cobrar;


            txtVentaBedidas.Text   = ventaBebidas.ToString(DataUtil.Format.Decimals);
            txtVentaAlimentos.Text = ventaAlimentos.ToString(DataUtil.Format.Decimals);
            txtVentaOtros.Text     = ventaOtros.ToString(DataUtil.Format.Decimals);
            ventaSubTotal          = ventaBebidas + ventaAlimentos + ventaOtros;
            txtVentaSubtotal.Text  = ventaSubTotal.ToString(DataUtil.Format.Decimals);

            txtVentaDescuentos.Text = ventaDescuentos.ToString(DataUtil.Format.Decimals);
            ventaTotal         = ventaSubTotal - ventaDescuentos;
            txtVentaTotal.Text = ventaTotal.ToString(DataUtil.Format.Decimals);

            ventaIGV_Cobrar  = (ventaSubTotal_Cobrar * (DataUtil.GetDouble(AppConstant.GeneralInfo.IGV) / 100));
            ventaIGV         = ventaIGV + ventaIGV_Cobrar;
            txtVentaIGV.Text = ventaIGV.ToString(DataUtil.Format.Decimals);

            ventaConIGV_Cobrar  = ventaIGV_Cobrar + ventaSubTotal_Cobrar;
            ventaConIGV         = ventaConIGV + ventaConIGV_Cobrar;
            txtVentaConIGV.Text = ventaConIGV.ToString(DataUtil.Format.Decimals);

            stringSQL = "       Pedido.Tipo_venta, " +
                        "       SUM(Producto.Precio_final) AS Monto_Total " +
                        "  FROM Producto " +
                        " INNER JOIN (Pedido " +
                        " INNER JOIN Pedido_detalle ON Pedido.Pedido_id = Pedido_detalle.Pedido_id) " +
                        "                           ON Producto.Producto_id = Pedido_detalle.Codigo_Producto" +
                        " WHERE Pedido.pedido_id <> 0";

            stringSQL = stringSQL + BuildWherePedidoPorCobrar();
            stringSQL = stringSQL + " GROUP BY Pedido.Tipo_venta";
            dsSearch  = DataUtil.FillDataSet("SELECT " + stringSQL + "", "Pedido_detalle");

            foreach (DataRow searchRow in dsSearch.Tables["Pedido_detalle"].Rows)
            {
                switch (DataUtil.GetString(searchRow["Tipo_venta"]))
                {
                case AppConstant.TipoVenta.Salon:
                    ventaSalon = ventaSalon + DataUtil.GetDouble(searchRow["Monto_Total"]);
                    break;

                case AppConstant.TipoVenta.Rapida:
                    ventaRapido = ventaRapido + DataUtil.GetDouble(searchRow["Monto_Total"]);
                    break;

                case AppConstant.TipoVenta.Delivery:
                    ventaDelivery = ventaDelivery + DataUtil.GetDouble(searchRow["Monto_Total"]);
                    break;
                }
            }

            txtVentaSalon.Text        = ventaSalon.ToString(DataUtil.Format.Decimals);
            txtVentaRapida.Text       = ventaRapido.ToString(DataUtil.Format.Decimals);
            txtVentaDelivery.Text     = ventaDelivery.ToString(DataUtil.Format.Decimals);
            ventaTotalPorTipo         = ventaSalon + ventaRapido + ventaDelivery;
            txtVentaTotalPorTipo.Text = ventaTotalPorTipo.ToString(DataUtil.Format.Decimals);

            txtVentaContado.Text        = ventaContado.ToString(DataUtil.Format.Decimals);
            txtVentaTarjetaCredito.Text = ventaTarjeta.ToString(DataUtil.Format.Decimals);
            txtVentaCheque.Text         = ventaCheque.ToString(DataUtil.Format.Decimals);
        }
コード例 #20
0
        private void btnViewOrder_Click(object sender, EventArgs e)
        {
            dgwCuenta.Rows.Clear();
            subTotal       = 0;
            totalDescuento = 0;

            btnViewOrder.Visible   = false;
            btnNewOrder.Visible    = true;
            btnCreateOrder.Visible = false;

            var dsPedidoDetalleInfo = DataUtil.FillDataSet(DataBaseQuerys.FillMainDataSet("pedido_detalle", "pedido_id", DataUtil.GetString(pedidoID), string.Empty), "pedido_detalle");

            foreach (DataRow pedidoDetalleRow in dsPedidoDetalleInfo.Tables["pedido_detalle"].Rows)
            {
                var dsProducto = DataUtil.FillDataSet(DataBaseQuerys.Producto(DataUtil.GetString(pedidoDetalleRow["Codigo_Producto"]), string.Empty,
                                                                              string.Empty, string.Empty), "producto");
                var precioUnitario  = DataUtil.GetDouble(dsProducto.Tables[0].Rows[0], "Precio_final");
                var precioProveedor = DataUtil.GetDouble(dsProducto.Tables[0].Rows[0], "Precio_proveedor");
                var descuento       = DataUtil.GetDouble(pedidoDetalleRow["Descuento"]);
                var cantidad        = DataUtil.GetInt(pedidoDetalleRow["Cantidad"]);

                double calculoMonto;
                double descuentoMonto = 0;
                if (Math.Abs(descuento) > 0)
                {
                    calculoMonto = Math.Round((precioUnitario * (1 - descuento / 100)) * cantidad, 2);
                    var totalSinDescuento = Math.Round(precioUnitario * cantidad, 2);
                    descuentoMonto = Math.Round(totalSinDescuento - calculoMonto, 2);
                }
                else
                {
                    calculoMonto = precioUnitario * cantidad;
                }

                var montoIgv = Math.Round((calculoMonto * 1.18), 1);

                string[] row =
                {
                    DataUtil.GetString(pedidoDetalleRow["Linea"]),
                    DataUtil.GetString(pedidoDetalleRow["Codigo_Producto"]),
                    DataUtil.GetString(pedidoDetalleRow["Descripcion_Producto"]),
                    DataUtil.GetString(pedidoDetalleRow["Cantidad"]),
                    DataUtil.GetString(pedidoDetalleRow["Descuento"]),
                    DataUtil.GetString(calculoMonto),
                    DataUtil.GetString(precioUnitario),
                    DataUtil.GetString(precioProveedor),
                    DataUtil.GetString(montoIgv),
                    DataUtil.GetString(descuentoMonto)
                };
                dgwCuenta.Rows.Add(row);
                CalculoMontos(calculoMonto, true, descuentoMonto);
            }
        }
コード例 #21
0
        public static DialogResult InputBox(string title, string promptText, string tableName, string fieldName, string fieldRef, ref string value, bool validateKey, bool showDialog)
        {
            DialogResult dialogResult = DialogResult.OK;

            if (showDialog)
            {
                Form    form         = new Form();
                Label   label        = new Label();
                TextBox textBox      = new TextBox();
                Button  buttonOk     = new Button();
                Button  buttonCancel = new Button();

                form.Text  = title;
                label.Text = promptText;
                if (validateKey)
                {
                    textBox.PasswordChar = '*';
                }
                textBox.Text = value;

                buttonOk.Text             = "OK";
                buttonCancel.Text         = "Cancel";
                buttonOk.DialogResult     = DialogResult.OK;
                buttonCancel.DialogResult = DialogResult.Cancel;

                label.SetBounds(9, 20, 372, 13);
                textBox.SetBounds(12, 36, 372, 20);
                textBox.CharacterCasing = CharacterCasing.Upper;
                buttonOk.SetBounds(228, 72, 75, 23);
                buttonCancel.SetBounds(309, 72, 75, 23);

                label.AutoSize      = true;
                textBox.Anchor      = textBox.Anchor | AnchorStyles.Right;
                buttonOk.Anchor     = AnchorStyles.Bottom | AnchorStyles.Right;
                buttonCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;

                form.ClientSize = new Size(396, 107);
                form.Controls.AddRange(new Control[] { label, textBox, buttonOk, buttonCancel });
                form.ClientSize      = new Size(Math.Max(300, label.Right + 10), form.ClientSize.Height);
                form.FormBorderStyle = FormBorderStyle.FixedDialog;
                form.StartPosition   = FormStartPosition.CenterScreen;
                form.MinimizeBox     = false;
                form.MaximizeBox     = false;
                form.AcceptButton    = buttonOk;
                form.CancelButton    = buttonCancel;

                dialogResult = form.ShowDialog();
                value        = textBox.Text.Trim();

                if (validateKey)
                {
                    if (value != string.Empty)
                    {
                        string sWhere = "codigo_empleado = " + fieldRef + " AND " + fieldName + " = '" + value + "'";
                        if (DataUtil.FindSingleRow(tableName, fieldName, sWhere) == string.Empty)
                        {
                            MessageBox.Show("El password es incorrecto.", "Informacion", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            dialogResult = DialogResult.Cancel;
                        }
                    }
                    else
                    {
                        dialogResult = DialogResult.Cancel;
                    }
                }
                else
                {
                    if (value != string.Empty)
                    {
                        string sWhere = fieldName + " = '" + value + "'";
                        if (DataUtil.FindSingleRow(tableName, fieldName, sWhere) != string.Empty)
                        {
                            MessageBox.Show("El registro ya existe en la base de datos.", "Informacion", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }
                        else
                        {
                            try
                            {
                                string sqlInsert = string.Empty;
                                if (tableName.Equals("cliente_email"))
                                {
                                    sqlInsert = "INSERT INTO " + tableName + " (" +
                                                fieldName + "," +
                                                "cliente_id)" +
                                                " VALUES (" +
                                                "'" + DataUtil.GetString(value) + "'," +
                                                fieldRef + ")";
                                }
                                else
                                {
                                    sqlInsert = "INSERT INTO " + tableName + " (" +
                                                fieldName + ")" +
                                                " VALUES (" +
                                                "'" + DataUtil.GetString(value) + "')";
                                }
                                if (DataUtil.Update(sqlInsert))
                                {
                                    MessageBox.Show("Registro grabado correctamente", "Informacion", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                }
                            }
                            catch (Exception ex)
                            {
                                MessageBox.Show("Error en Grabar: " + ex.Message);
                            }
                        }
                    }
                    else
                    {
                        dialogResult = DialogResult.Cancel;
                    }
                }
            }
            return(dialogResult);
        }
コード例 #22
0
        private void btnCreateOrder_Click(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show(@"Desea proceder a crear esta orden?", @"Crear", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (result == DialogResult.Yes)
            {
                if (IsReadyToSave())
                {
                    try
                    {
                        string sqlForExecute;
                        if (pedidoID.Equals(0))
                        {
                            pedidoID              = DataUtil.GetNewId("pedido");
                            ordenDiaID            = DataUtil.GetOrderByTurn(DataUtil.GetInt(lblTurno.Text));
                            Text                  = Text + @": " + pedidoID;
                            lblOrderDiaNo.Text    = DataUtil.GetString(ordenDiaID);
                            lblOrderDia.Visible   = true;
                            lblOrderDiaNo.Visible = true;

                            string clienteIDValue = "null";
                            if (clienteID != string.Empty)
                            {
                                clienteIDValue = clienteID;
                            }

                            string mesaIDValue = "null";
                            if (mesaID != string.Empty)
                            {
                                mesaIDValue = mesaID;
                            }

                            sqlForExecute = "INSERT INTO pedido (" +
                                            "Pedido_id," +
                                            "Mesa_id," +
                                            "Turno_id," +
                                            "Fecha_Pedido," +
                                            "Atendido_por," +
                                            "Estado," +
                                            "Tipo_venta," +
                                            "Cliente_id," +
                                            "Orden_turno)" +
                                            " VALUES (" +
                                            pedidoID + "," +
                                            "" + mesaIDValue + "," +
                                            "" + lblTurno.Text + "," +
                                            "'" + DateTime.Now + "'," +
                                            "" + radmccbEmpleado.EditorControl.Rows[radmccbEmpleado.SelectedIndex].Cells["Codigo_empleado"].Value + "," +
                                            "'A'," +
                                            "'" + tipoVenta + "'," +
                                            "" + clienteIDValue + "," +
                                            "" + ordenDiaID + "" +
                                            ")";

                            DataUtil.UpdateThrow(sqlForExecute);
                        }

                        foreach (DataGridViewRow row in dgwCuenta.Rows)
                        {
                            string descuentoValue = DataUtil.GetString(row.Cells[gridDescuento].Value);
                            if (descuentoValue.Equals(string.Empty))
                            {
                                descuentoValue = "null";
                            }

                            sqlForExecute = "INSERT INTO pedido_detalle (" +
                                            "Pedido_detalle_id," +
                                            "Pedido_id," +
                                            "Linea," +
                                            "Codigo_Producto," +
                                            "Descripcion_Producto," +
                                            "Descuento," +
                                            "Cantidad," +
                                            "Impreso)" +
                                            " VALUES (" +
                                            DataUtil.GetNewId("pedido_detalle") + "," +
                                            pedidoID + "," +
                                            "'" + DataUtil.GetString(row.Cells[gridLineaNumero].Value) + "'," +
                                            "" + DataUtil.GetString(row.Cells[gridProdCodigo].Value) + "," +
                                            "'" + DataUtil.GetString(row.Cells[gridProdDescripcion].Value).Replace("'", "''") + "'," +
                                            "" + descuentoValue + "," +
                                            "'" + DataUtil.GetString(row.Cells[gridCantidad].Value) + "'," +
                                            "0" +
                                            ")";
                            DataUtil.UpdateThrow(sqlForExecute);
                        }

                        if (mesaID != string.Empty)
                        {
                            sqlForExecute = "UPDATE mesa SET " +
                                            " Mesa_estado = 'OCUPADA'," +
                                            " Pedido_id = " + pedidoID + "" +
                                            " WHERE Mesa_id = " + mesaID;
                            DataUtil.UpdateThrow(sqlForExecute);
                        }

                        sqlForExecute = "UPDATE pedido SET " +
                                        "  Last_Line = " + lineGrid + "" +
                                        ", Fecha_actualizacion = '" + DateTime.Now + "'" +
                                        ", Actualizado_por = '" + radmccbEmpleado.EditorControl.Rows[radmccbEmpleado.SelectedIndex].Cells["Codigo_empleado"].Value + "'" +
                                        " WHERE Pedido_id = " + pedidoID;
                        DataUtil.UpdateThrow(sqlForExecute);


                        PrintDocuments(pedidoID, 0);
                        btnReprint.Visible     = true;
                        btnCreateOrder.Visible = false;
                        MessageBox.Show(@"Orden agregada correctamente.", @"Informacion", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        btnNewOrder.Visible     = true;
                        radmccbEmpleado.Enabled = false;
                        ShowButtonsOrder(true);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(@"Error en Grabar: " + ex.Message);
                    }
                }
            }
        }
コード例 #23
0
 private void SetButtonInfo(string tipo, object sender, EventArgs e)
 {
     if (sender is Button)
     {
         Button  btn     = sender as Button;
         DataSet dsBoton = DataUtil.FillDataSet(DataBaseQuerys.ProductoBoton(DataUtil.GetString(btn.Tag), DataUtil.GetString(subCategoriaIdSelected)), "producto_boton");
         if (dsBoton.Tables[0].Rows.Count.Equals(0))
         {
             DialogResult result = MessageBox.Show("Desea asignar un producto al boton?", "Asignar Producto", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
             if (result == DialogResult.Yes)
             {
                 frmQuickButtons frmQuickButtonsForm = new frmQuickButtons();
                 frmQuickButtonsForm.categoriaId    = categoriaIdSelected.ToString();
                 frmQuickButtonsForm.subCategoriaId = subCategoriaIdSelected.ToString();
                 frmQuickButtonsForm.botonId        = DataUtil.GetString(btn.Tag);
                 frmQuickButtonsForm.tipo           = tipo;
                 frmQuickButtonsForm.ShowDialog();
                 GetButtonInfo(btn, subCategoriaIdSelected);
             }
         }
         else
         {
             DataSet dsProducto = DataUtil.FillDataSet(DataBaseQuerys.Producto(DataUtil.GetString(dsBoton.Tables[0].Rows[0], "Producto_id"), string.Empty, string.Empty, string.Empty), "producto");
             txtCodigoProducto.Text = DataUtil.GetString(dsBoton.Tables[0].Rows[0], "Producto_id");
             txtProducto.Text       = DataUtil.GetString(dsProducto.Tables[0].Rows[0], "Producto_descripcion");
             txtPrecioUnitario.Text = DataUtil.GetString(dsProducto.Tables[0].Rows[0], "Precio_final");
             this.btnAdd_Click(tipo, null);
         }
     }
 }
コード例 #24
0
        private void frmCustomerOrder_Load(object sender, EventArgs e)
        {
            FillEmpleadoCombo();
            if (tipoVenta.Equals(AppConstant.TipoVenta.Salon))
            {
                GetMesaInfo();
                btnCambiarMesa.Visible = true;
                lblTipoMesa.Visible    = true;
                lblMesaDesc.Visible    = true;
            }
            else
            {
                btnCambiarMesa.Visible = false;
                lblTipoMesa.Visible    = false;
                lblMesaDesc.Visible    = false;
            }
            GetTurnInfo(0);

            if (pedidoID != 0)
            {
                var dsPedidoInfo = DataUtil.FillDataSet("SELECT last_line, Tipo_venta, turno_id, Atendido_por, Pedido_origen_id, mesa_id, Cliente_id, Orden_turno " +
                                                        " FROM pedido WHERE pedido_id = " + pedidoID + "", "pedido");
                lineGrid   = DataUtil.GetInt(dsPedidoInfo.Tables[0].Rows[0], "last_line");
                tipoVenta  = DataUtil.GetString(dsPedidoInfo.Tables[0].Rows[0], "Tipo_venta");
                clienteID  = DataUtil.GetString(dsPedidoInfo.Tables[0].Rows[0], "Cliente_id");
                ordenDiaID = DataUtil.GetInt(dsPedidoInfo.Tables[0].Rows[0], "Orden_turno");
                GetCustomerInfo();
                lblTipoOrden.Text = tipoVenta;
                if (tipoVenta != AppConstant.TipoVenta.Salon)
                {
                    btnCambiarMesa.Visible = false;
                    lblTipoMesa.Visible    = false;
                    lblMesaDesc.Visible    = false;
                }
                else
                {
                    mesaID = DataUtil.GetString(dsPedidoInfo.Tables[0].Rows[0], "mesa_id");
                    GetMesaInfo();
                    btnCambiarMesa.Visible = true;
                    lblTipoMesa.Visible    = true;
                    lblMesaDesc.Visible    = true;
                }
                btnViewOrder_Click(null, null);
                ShowButtonsOrder(true);
                GetTurnInfo(DataUtil.GetInt(dsPedidoInfo.Tables[0].Rows[0], "turno_id"));
                GetEmployee(DataUtil.GetInt(dsPedidoInfo.Tables[0].Rows[0], "Atendido_por"));

                if (DataUtil.GetString(dsPedidoInfo.Tables[0].Rows[0], "Pedido_origen_id") != string.Empty)
                {
                    lblOrdenOrigen.Visible      = true;
                    lblOrdenOrigenValue.Visible = true;
                    lblOrdenOrigenValue.Text    = DataUtil.GetString(dsPedidoInfo.Tables[0].Rows[0], "Pedido_origen_id");
                    btnSepararCuenta.Visible    = false;
                    btnNotaVenta.Visible        = false;
                    btnCancelOrder.Visible      = false;
                    btnCambiarMesa.Visible      = false;
                }

                if (ExistenOrdenesAsociadas())
                {
                    btnVerCuentasAsociadas.Visible = true;
                }
            }
            else
            {
                if (tipoVenta != string.Empty)
                {
                    lblTipoOrden.Text = tipoVenta;
                }
                btnViewOrder.Visible = false;
                btnReprint.Visible   = false;
                ShowButtonsOrder(false);
                if (AppConstant.EmployeeInfo.Cargo != AppConstant.EmpleadoCargo.Mozo)
                {
                    radmccbEmpleado.Enabled = true;
                }
                radmccbEmpleado.Text          = AppConstant.EmployeeInfo.Apellidos + @", " + AppConstant.EmployeeInfo.Nombres;
                radmccbEmpleado.SelectedValue = AppConstant.EmployeeInfo.Apellidos + ", " + AppConstant.EmployeeInfo.Nombres;
            }
            GetCustomerInfo();
            txtProducto.Focus();
            Text = Text + @": " + pedidoID;
            lblOrderDiaNo.Text    = DataUtil.GetString(ordenDiaID);
            lblOrderDia.Visible   = true;
            lblOrderDiaNo.Visible = true;
            lblIGVCopy.Text       = @"IGV (" + AppConstant.GeneralInfo.IGV + @" %)";
        }
コード例 #25
0
 private void btnCalcular_Click(object sender, EventArgs e)
 {
     if (IsReadyToSave())
     {
         try
         {
             double calculo = ((DataUtil.GetDouble(txtPrecioFinal.Text) - DataUtil.GetDouble(txtPrecioProveedor.Text)) / DataUtil.GetDouble(txtPrecioProveedor.Text)) * 100;
             txtMargen.Text = DataUtil.GetDouble(calculo).ToString(DataUtil.Format.Decimals);
         }
         catch (Exception ex)
         {
             MessageBox.Show("Error en Calculo :" + ex.Message);
         }
     }
 }
コード例 #26
0
 private void btnAddProduct_Click(object sender, EventArgs e)
 {
     if (btnCreateOrder.Visible == true)
     {
         var frmTakeOrderForm = new frmTakeOrder();
         frmTakeOrderForm.ShowDialog();
         if (DataUtil.dgvTemporal != null)
         {
             foreach (DataGridViewRow row in DataUtil.dgvTemporal.Rows)
             {
                 txtCodigoProducto.Text = DataUtil.GetString(row.Cells[gridProdCodigo].Value);
                 txtProducto.Text       = DataUtil.FindSingleRow("producto", "Producto_descripcion", "Producto_id = " + DataUtil.GetString(row.Cells[gridProdCodigo].Value) + "");
                 txtPrecioUnitario.Text = DataUtil.FindSingleRow("producto", "Precio_final", "Producto_id = " + DataUtil.GetString(row.Cells[gridProdCodigo].Value) + "");
                 txtCantidad.Text       = DataUtil.GetString(row.Cells[gridCantidad].Value);
                 btnAdd_Click(null, null);
             }
             DataUtil.dgvTemporal = null;
         }
     }
     else
     {
         MessageBox.Show(@"Debe crear una nueva orden.", @"Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
コード例 #27
0
 void SubCategoriasCarouselDataBinding_Click(object sender, EventArgs e)
 {
     subCategoriaTextSelected = (sender as RadButtonElement).Text.ToString();
     GetSubCategoriaProducts(DataUtil.GetInt((sender as RadButtonElement).Tag));
 }
コード例 #28
0
        private void btnBorrar_Click(object sender, EventArgs e)
        {
            var refValue = string.Empty;

            if (txtLinea.Text.Trim() != string.Empty)
            {
                var result = MessageBox.Show(@"Está seguro de eliminar la linea " + txtLinea.Text + @" ?", @"Eliminar", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                if (result == DialogResult.Yes)
                {
                    if (btnCreateOrder.Visible)
                    {
                        for (int i = 0; i < dgwCuenta.RowCount; i++)
                        {
                            if (DataUtil.GetString(dgwCuenta.Rows[i].Cells[gridLineaNumero].Value) == txtLinea.Text)
                            {
                                CalculoMontos(DataUtil.GetDouble(dgwCuenta.Rows[i].Cells[gridPrecio].Value), false, DataUtil.GetDouble(dgwCuenta.Rows[i].Cells[gridDescuentoMonto].Value));
                                dgwCuenta.Rows.RemoveAt(i);
                                txtLinea.Text = string.Empty;
                                break;
                            }
                        }
                    }
                    else
                    {
                        if (frmInputBox.InputBox("Ingresar codigo de autorizacion", "Codigo", "empleado", "password", "1", ref refValue, true, AppConstant.GeneralInfo.PasswordEliminarProducto) == DialogResult.OK)
                        {
                            for (int i = 0; i < dgwCuenta.RowCount; i++)
                            {
                                if (DataUtil.GetString(dgwCuenta.Rows[i].Cells[gridLineaNumero].Value) == txtLinea.Text)
                                {
                                    CalculoMontos(DataUtil.GetDouble(dgwCuenta.Rows[i].Cells[gridPrecio].Value), false, DataUtil.GetDouble(dgwCuenta.Rows[i].Cells[gridDescuentoMonto].Value));
                                    SaveProductDeleted(txtLinea.Text,
                                                       DataUtil.GetInt(dgwCuenta.Rows[i].Cells[gridProdCodigo].Value),
                                                       DataUtil.GetString(dgwCuenta.Rows[i].Cells[gridProdDescripcion].Value));
                                    dgwCuenta.Rows.RemoveAt(i);
                                    txtLinea.Text = string.Empty;
                                    break;
                                }
                            }
                        }
                    }
                }
            }
            else
            {
                MessageBox.Show(@"Seleccionar la linea a borrar.", @"Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #29
0
        private void cbCategoria_SelectedIndexChanged(object sender, EventArgs e)
        {
            cbSubCategoria.SelectedItem = string.Empty;
            var categoriaWhere = "Producto_categoria_descripcion = '" + DataUtil.GetString(cbCategoria.SelectedItem) + "'";

            DataUtil.FillComboBox(cbSubCategoria.Items, DataBaseQuerys.ProductoSubCategoriaActivos(false, DataUtil.FindSingleRow("producto_categoria", "Producto_categoria_id", categoriaWhere)), null);
        }
コード例 #30
0
        private void ViewOrder()
        {
            dgwCuenta.Rows.Clear();
            var dsPedidoDetalleInfo = DataUtil.FillDataSet(DataBaseQuerys.FillMainDataSet("pedido_detalle", "pedido_id", DataUtil.GetString(pedidoID), string.Empty), "pedido_detalle");

            foreach (DataRow pedidoDetalleRow in dsPedidoDetalleInfo.Tables["pedido_detalle"].Rows)
            {
                string[] row = { DataUtil.GetString(pedidoDetalleRow["Linea"]),
                                 DataUtil.GetString(pedidoDetalleRow["Codigo_Producto"]),
                                 DataUtil.GetString(pedidoDetalleRow["Descripcion_Producto"]),
                                 DataUtil.GetString(pedidoDetalleRow["Cantidad"]),
                                 DataUtil.GetString(pedidoDetalleRow["Descuento"]), };
                dgwCuenta.Rows.Add(row);
            }
        }