コード例 #1
0
        private void EditProduct()
        {
            string sWhere = string.Empty;

            txtCodigo.Text        = DataUtil.GetString(mainDataSet.Tables[0].Rows[0], formWhereField);
            txtDescripcion.Text   = DataUtil.GetString(mainDataSet.Tables[0].Rows[0], "Presentacion_descripcion");
            cbEstado.SelectedItem = DataUtil.GetString(mainDataSet.Tables[0].Rows[0], "estado");

            sWhere = "Insumo_grupo_id = " + DataUtil.GetString(mainDataSet.Tables[0].Rows[0], "Insumo_grupo_id") + "";
            cbGrupo.SelectedItem = DataUtil.FindSingleRow("Insumo_grupo", "Insumo_grupo_descripcion", sWhere);

            if (DataUtil.GetString(mainDataSet.Tables[0].Rows[0], "Insumo_base_id") != string.Empty)
            {
                sWhere = "Insumo_id = " + DataUtil.GetString(mainDataSet.Tables[0].Rows[0], "Insumo_base_id") + "";
                cbInsumoBase.SelectedItem = DataUtil.FindSingleRow("Insumo", "Insumo_descripcion", sWhere);
            }

            txtUltimoCosto.Text       = DataUtil.GetDouble(mainDataSet.Tables[0].Rows[0], "Ultimo_costo").ToString(DataUtil.Format.Decimals);
            txtCostoPromedio.Text     = DataUtil.GetDouble(mainDataSet.Tables[0].Rows[0], "Costo_promedio").ToString(DataUtil.Format.Decimals);
            txtIGV.Text               = DataUtil.GetDouble(mainDataSet.Tables[0].Rows[0], "IGV").ToString(DataUtil.Format.Decimals);
            txtCostoImpuesto.Text     = DataUtil.GetDouble(mainDataSet.Tables[0].Rows[0], "Costo_impuesto").ToString(DataUtil.Format.Decimals);
            txtRendimiento.Text       = DataUtil.GetInt(mainDataSet.Tables[0].Rows[0], "Rendimiento_valor").ToString(DataUtil.Format.Decimals);
            txtRendimientoUnidad.Text = DataUtil.GetInt(mainDataSet.Tables[0].Rows[0], "Rendimiento_unidad").ToString();

            if (DataUtil.GetString(mainDataSet.Tables[0].Rows[0], "Proveedor_id") != string.Empty)
            {
                sWhere = "Proveedor_id = " + DataUtil.GetString(mainDataSet.Tables[0].Rows[0], "Proveedor_id") + "";
                cbProveedor.SelectedItem = DataUtil.FindSingleRow("proveedor", "Proveedor_nombre", sWhere);
            }
        }
コード例 #2
0
        private void FillGrid()
        {
            string commandSQL = string.Empty;
            double importe    = 0;

            this.dgwResult.Rows.Clear();

            commandSQL = "SELECT t.Turno_id AS [Turno Code], e.Estacion_descripcion AS [Estacion], m.Tipo_movimiento AS [Tipo Movimiento], m.Concepto, m.Importe, m.Fecha_Creacion AS [Realizado el] " +
                         "  FROM (movimientos AS m LEFT JOIN turno AS t ON m.turno_id=t.turno_id) " +
                         "  LEFT JOIN estacion AS e ON m.estacion_id=e.estacion_id WHERE movimiento_id <> 0 " + BuildWhere() + " ORDER BY Movimiento_id";

            DataSet dsMovimientosInfo = DataUtil.FillDataSet(commandSQL, "movimientos");

            foreach (DataRow movimientosRow in dsMovimientosInfo.Tables["movimientos"].Rows)
            {
                importe = importe + DataUtil.GetDouble(movimientosRow["Importe"]);
                string[] row = { DataUtil.GetString(movimientosRow["Turno Code"]),
                                 DataUtil.GetString(movimientosRow["Estacion"]),
                                 DataUtil.GetString(movimientosRow["Tipo Movimiento"]),
                                 DataUtil.GetString(movimientosRow["Concepto"]),
                                 DataUtil.GetString(movimientosRow["Importe"]),
                                 DataUtil.GetString(movimientosRow["Realizado el"]) };
                dgwResult.Rows.Add(row);
            }
            txtTotal.Text = importe.ToString(DataUtil.Format.Decimals);
            lblNo.Text    = DataUtil.GetString(dsMovimientosInfo.Tables[0].Rows.Count);
        }
コード例 #3
0
 private void btnBorrar_Click(object sender, EventArgs e)
 {
     if (txtLinea.Text.Trim() != string.Empty)
     {
         DialogResult result = MessageBox.Show(@"Está seguro de eliminar la linea " + txtLinea.Text + @" ?", @"Eliminar", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
         if (result == DialogResult.Yes)
         {
             for (int i = 0; i < dgwCuenta.RowCount; i++)
             {
                 if (DataUtil.GetString(dgwCuenta.Rows[i].Cells["LINEA"].Value) == txtLinea.Text)
                 {
                     CalculoMontoInicial(DataUtil.GetDouble(dgwCuenta.Rows[i].Cells["MONTO_INICIAL"].Value), false);
                     this.dgwCuenta.Rows.RemoveAt(i);
                     txtLinea.Text = string.Empty;
                     break;
                 }
             }
         }
     }
     else
     {
         txtLinea.Focus();
         MessageBox.Show(@"Seleccionar la linea a borrar.", @"Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
コード例 #4
0
        private bool PasarProducto(int cuentaNumber)
        {
            bool result = false;
            DataGridViewSelectedRowCollection Seleccionados = dgwCuenta.SelectedRows;

            foreach (DataGridViewRow item in Seleccionados)
            {
                DataSet dsProducto = DataUtil.FillDataSet(DataBaseQuerys.Producto(item.Cells["CODIGO"].Value.ToString(), string.Empty, string.Empty, string.Empty), "producto");
                txtCodigoProducto.Text  = item.Cells["CODIGO"].Value.ToString();
                txtProducto.Text        = DataUtil.GetString(dsProducto.Tables[0].Rows[0], "Producto_descripcion");
                txtPrecioUnitario.Text  = DataUtil.GetString(dsProducto.Tables[0].Rows[0], "Precio_final");
                txtPrecioProveedor.Text = DataUtil.GetString(dsProducto.Tables[0].Rows[0], "Precio_proveedor");
                txtCantidad.Text        = item.Cells["CANTIDAD"].Value.ToString();
                txtDescuento.Text       = item.Cells["DESCUENTO"].Value.ToString();
                AddDetail(cuentaNumber);

                subTotal0        = CalculoMontos(DataUtil.GetDouble(dgwCuenta.Rows[item.Index].Cells["PRECIO_FINAL"].Value), false, subTotal0);
                txtSubTotal.Text = subTotal0.ToString(DataUtil.Format.Decimals);
                this.dgwCuenta.Rows.RemoveAt(item.Index);
                result = true;
            }

            if (result == false)
            {
                MessageBox.Show("Se debe seleccionar al menos 1 producto a divir.", "Informacion", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

            return(result);
        }
コード例 #5
0
 private void CalculoMargen()
 {
     try
     {
         double precioFinal      = DataUtil.GetDouble(txtPrecioFinal.Text);
         double precioProoveedor = DataUtil.GetDouble(txtPrecioProveedor.Text);
         if (precioFinal > 0 && precioProoveedor > 0)
         {
             try
             {
                 double calculo = ((precioFinal - precioProoveedor) / precioProoveedor) * 100;
                 txtMargen.Text = DataUtil.GetDouble(calculo).ToString(DataUtil.Format.Decimals);
             }
             catch (Exception ex)
             {
                 MessageBox.Show("Error en Calculo del Margen :" + ex.Message);
             }
         }
         else
         {
             MessageBox.Show("Debe ingresar el precio final y el precio proveedor.");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Error en Calculo del Margen :" + ex.Message);
     }
 }
コード例 #6
0
 private void CalculoPrecioFinalEspecial()
 {
     try
     {
         double margen        = DataUtil.GetDouble(txtMargen.Text);
         double precioPublico = DataUtil.GetDouble(txtPrecioPublico.Text);
         if (margen > 0 && precioPublico > 0)
         {
             try
             {
                 double calculo = (precioPublico / (1 + (DataUtil.GetDouble(AppConstant.GeneralInfo.IGV) / 100)));
                 txtPrecioFinal.Text = DataUtil.GetDouble(calculo).ToString(DataUtil.Format.Decimals);
                 CalculoPrecioProveedor();
             }
             catch (Exception ex)
             {
                 MessageBox.Show("Error en Calculo del Precio :" + ex.Message);
             }
         }
         else
         {
             MessageBox.Show("Debe ingresar el margen y el precio proveedor.");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Error en Calculo del Precio :" + ex.Message);
     }
 }
コード例 #7
0
        private void btnAddCargo_Click(object sender, EventArgs e)
        {
            if (IsReadyToSaveFirst())
            {
                int    movimientoID   = DataUtil.GetNewId("movimientos");
                string tipoMovimiento = "RETIRO";
                if (rbtnDeposito.ToggleState == Telerik.WinControls.Enumerations.ToggleState.On)
                {
                    totalDeposito  = totalDeposito + DataUtil.GetDouble(txtImporte.Text);
                    tipoMovimiento = "DEPOSITO";
                }
                else
                {
                    totalRetiro = totalRetiro + DataUtil.GetDouble(txtImporte.Text);
                }

                string sqlForExecute = "INSERT INTO movimientos (" +
                                       "Movimiento_id," +
                                       "Turno_id," +
                                       "Estacion_id," +
                                       "Tipo_movimiento," +
                                       "Concepto," +
                                       "Referencia," +
                                       "Importe," +
                                       "Fecha_creacion," +
                                       "Creado_por)" +
                                       " VALUES (" +
                                       movimientoID + "," +
                                       "" + lblTurno.Text + "," +
                                       "" + ((System.Web.UI.WebControls.ListItem)(cbEstacion.SelectedItem)).Value + "," +
                                       "'" + tipoMovimiento + "'," +
                                       "'" + txtConcepto.Text.Trim() + "'," +
                                       "'" + txtReferencia.Text.Trim() + "'," +
                                       "'" + DataUtil.GetDouble(txtImporte.Text) + "'," +
                                       "'" + DateTime.Now + "'," +
                                       "'" + AppConstant.EmployeeInfo.Codigo + "'" +
                                       ")";

                if (DataUtil.Update(sqlForExecute))
                {
                    totalGeneral      = totalRetiro + totalDeposito;
                    txtDepositro.Text = totalDeposito.ToString(DataUtil.Format.Decimals);
                    txtRetiro.Text    = totalRetiro.ToString(DataUtil.Format.Decimals);
                    txtTotal.Text     = totalGeneral.ToString(DataUtil.Format.Decimals);

                    string[] row = { DataUtil.GetString(movimientoID),
                                     DataUtil.GetString(tipoMovimiento),
                                     DataUtil.GetString(txtConcepto.Text.Trim()),
                                     DataUtil.GetCurrency(txtImporte.Text),
                                     DataUtil.GetString(DateTime.Now) };
                    dgwCuenta.Rows.Add(row);
                    txtConcepto.Text   = string.Empty;
                    txtReferencia.Text = string.Empty;
                    txtImporte.Text    = string.Empty;
                    MessageBox.Show("Registro grabado correctamente", "Informacion", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    txtConcepto.Focus();
                }
            }
        }
コード例 #8
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);
            }
        }
コード例 #9
0
        private void btnClose_Click(object sender, EventArgs e)
        {
            if (txtMargen.Text != string.Empty && txtMargen.Text != "NAN")
            {
                AppConstant.Product.PrecioProveedor = DataUtil.GetDouble(txtPrecioProveedor.Text);
                AppConstant.Product.PrecioFinal     = DataUtil.GetDouble(txtPrecioFinal.Text);
                AppConstant.Product.Margen          = DataUtil.GetDouble(txtMargen.Text);
            }

            this.Close();
        }
コード例 #10
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);
            }
        }
コード例 #11
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);
            }
        }
コード例 #12
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);
         }
     }
 }
コード例 #13
0
        private void btnAddCargo_Click(object sender, EventArgs e)
        {
            if (cbEstacion.SelectedItem != null && txtMontoInicial.Text.Trim() != string.Empty)
            {
                if (!ExisteEstacion(((System.Web.UI.WebControls.ListItem)(cbEstacion.SelectedItem)).Text))
                {
                    lineGrid = lineGrid + 1;
                    string[] row = { DataUtil.GetString(lineGrid),
                                     ((System.Web.UI.WebControls.ListItem)(cbEstacion.SelectedItem)).Text,
                                     txtMontoInicial.Text,
                                     ((System.Web.UI.WebControls.ListItem)(cbEstacion.SelectedItem)).Value };
                    dgwCuenta.Rows.Add(row);
                    CalculoMontoInicial(DataUtil.GetDouble(txtMontoInicial.Text), true);

                    if (!adding)
                    {
                        sqlForExecute = "UPDATE " + tableName + " SET Fondo_inicial_total = " + txtFondoInicialTotal.Text + "" +
                                        " WHERE " + formWhereField + " = " + txtCodigo.Text;

                        DataUtil.Update(sqlForExecute);

                        sqlForExecute = "INSERT INTO Turno_Estacion (" +
                                        "Turno_id," +
                                        "Estacion_id," +
                                        "Linea," +
                                        "Fondo_inicial)" +
                                        " VALUES (" +
                                        txtCodigo.Text + "," +
                                        ((System.Web.UI.WebControls.ListItem)(cbEstacion.SelectedItem)).Value + "," +
                                        "'" + DataUtil.GetString(lineGrid) + "'," +
                                        "" + txtMontoInicial.Text + "" +
                                        ")";
                        DataUtil.UpdateThrow(sqlForExecute);
                    }
                    cbEstacion.Text      = string.Empty;
                    txtMontoInicial.Text = AppConstant.GeneralInfo.MontoCaja;

                    cbEstacion.Focus();
                }
            }
            else
            {
                cbEstacion.Focus();
                MessageBox.Show(@"Debe ingresar la estacion y el monto inicial.", @"Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #14
0
 private void CalculoCostoImpuesto()
 {
     if (txtUltimoCosto.Text != string.Empty && txtIGV.Text != string.Empty)
     {
         try
         {
             double subTotal     = DataUtil.GetDouble(txtUltimoCosto.Text);
             double igvValue     = (subTotal * (DataUtil.GetDouble(txtIGV.Text) / 100));
             double totalGeneral = subTotal + igvValue;
             txtCostoImpuesto.Text = totalGeneral.ToString(DataUtil.Format.Decimals);
         }
         catch (Exception ex)
         {
             MessageBox.Show("Error en Calculo :" + ex.Message);
         }
     }
 }
コード例 #15
0
        private void FillGrid()
        {
            var commandSQL = string.Empty;

            totalGeneral  = 0;
            totalRetiro   = 0;
            totalDeposito = 0;

            dgwCuenta.Rows.Clear();
            if (cbEstacion.SelectedItem.ToString() != string.Empty)
            {
                commandSQL = DataBaseQuerys.Movimientos(DataUtil.GetInt(lblTurno.Text),
                                                        DataUtil.GetInt(((System.Web.UI.WebControls.ListItem)(cbEstacion.SelectedItem)).Value));
            }
            else
            {
                commandSQL = DataBaseQuerys.Movimientos(DataUtil.GetInt(lblTurno.Text), 0);
            }

            var dsMovimientosInfo = DataUtil.FillDataSet(commandSQL, "movimientos");

            foreach (DataRow movimientosRow in dsMovimientosInfo.Tables["movimientos"].Rows)
            {
                if (DataUtil.GetString(movimientosRow["Tipo_movimiento"]) == "DEPOSITO")
                {
                    totalDeposito = totalDeposito + DataUtil.GetDouble(movimientosRow["Importe"]);
                }
                else
                {
                    totalRetiro = totalRetiro + DataUtil.GetDouble(movimientosRow["Importe"]);
                }

                totalGeneral = totalRetiro + totalDeposito;

                string[] row = { DataUtil.GetString(movimientosRow["Movimiento_id"]),
                                 DataUtil.GetString(movimientosRow["Tipo_movimiento"]),
                                 DataUtil.GetString(movimientosRow["Concepto"]),
                                 DataUtil.GetString(movimientosRow["Importe"]),
                                 DataUtil.GetString(movimientosRow["Fecha_creacion"]) };
                dgwCuenta.Rows.Add(row);
            }
            txtDepositro.Text = totalDeposito.ToString(DataUtil.Format.Decimals);
            txtRetiro.Text    = totalRetiro.ToString(DataUtil.Format.Decimals);
            txtTotal.Text     = totalGeneral.ToString(DataUtil.Format.Decimals);
        }
コード例 #16
0
        private void BindDataFields()
        {
            txtMontoInicial.Text = AppConstant.GeneralInfo.MontoCaja;
            mainDataSet          = DataUtil.FillDataSet(DataBaseQuerys.FillMainDataSet(tableName, formWhereField, formId, string.Empty), tableName);

            DataUtil.FillComboBoxValues(cbEstacion.Items, "SELECT Estacion_descripcion, Estacion_id FROM Estacion WHERE Estado = '" + AppConstant.RegistroEstado.Activo + "' ORDER BY Estacion_descripcion", null);

            if (mainDataSet.Tables[0].Rows.Count > 0)
            {
                txtCodigo.Text        = DataUtil.GetString(mainDataSet.Tables[0].Rows[0], formWhereField);
                cbEstado.SelectedItem = DataUtil.GetString(mainDataSet.Tables[0].Rows[0], "estado");
                subTotal = DataUtil.GetDouble(mainDataSet.Tables[0].Rows[0], "Fondo_inicial_total");
                txtFondoInicialTotal.Text = DataUtil.GetString(mainDataSet.Tables[0].Rows[0], "Fondo_inicial_total");
                txtVentaTotal.Text        = DataUtil.GetString(mainDataSet.Tables[0].Rows[0], "Venta_total");
                txtOrdenes.Text           = DataUtil.GetString(mainDataSet.Tables[0].Rows[0], "Orden");

                if (DataUtil.GetDateTime(mainDataSet.Tables[0].Rows[0], "Fecha_apertura") != DateTime.MinValue)
                {
                    lblFechaApetura.Visible = true;
                    dtpFechaApetura.Visible = true;
                    dtpFechaApetura.Value   = DataUtil.GetDateTime(mainDataSet.Tables[0].Rows[0], "Fecha_apertura");
                }
                if (DataUtil.GetDateTime(mainDataSet.Tables[0].Rows[0], "Fecha_cierre") != DateTime.MinValue)
                {
                    lblFechaCierre.Visible = true;
                    dtpFechaCierre.Visible = true;
                    dtpFechaCierre.Value   = DataUtil.GetDateTime(mainDataSet.Tables[0].Rows[0], "Fecha_cierre");
                }
                if (DataUtil.GetString(mainDataSet.Tables[0].Rows[0], "estado").Equals("CERRADO"))
                {
                    btnDelete.Enabled    = false;
                    gbEstaciones.Enabled = false;
                    btnDetalle.Visible   = true;
                }
                CargarTurnoEstacion(DataUtil.GetInt(txtCodigo.Text));
                btnBorrar.Enabled = false;
                btnSave.Enabled   = false;
            }
            else
            {
                cbEstado.SelectedItem = "ABIERTO";
            }
        }
コード例 #17
0
 private void btnPagar_Click(object sender, EventArgs e)
 {
     if (DataBaseQuerys.GetAccess(31, AppConstant.EmployeeInfo.Codigo, AppConstant.AccessoTipos.Accesso))
     {
         if (ValidarCajero())
         {
             if (DataUtil.GetDouble(txtTotalGeneralCopy.Text) != 0)
             {
                 if (pedidoID != 0)
                 {
                     DialogResult result = MessageBox.Show(@"Desea proceder a pagar esta orden?", @"Pagar", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                     if (result == DialogResult.Yes)
                     {
                         AppConstant.Order.PedidoID        = DataUtil.GetString(pedidoID);
                         AppConstant.Order.OrdenDiaID      = DataUtil.GetString(ordenDiaID);
                         AppConstant.Order.MesaID          = mesaID;
                         AppConstant.Order.MesaDescripcion = mesaDesc;
                         AppConstant.Order.MesaTipo        = tipoMesa;
                         AppConstant.Order.TipoVenta       = tipoVenta;
                         if (lblOrdenOrigenValue.Visible)
                         {
                             AppConstant.Order.PedidoOrigenID = lblOrdenOrigenValue.Text;
                         }
                         Close();
                     }
                 }
                 else
                 {
                     MessageBox.Show(@"Debe agregar una Orden.", @"Informacion", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                 }
             }
             else
             {
                 txtProducto.Focus();
                 MessageBox.Show(@"Debe tener algun producto a pagar.", @"Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
     }
     else
     {
         MessageBox.Show(@"No tiene permisos para ingresar a esta opcion.", @"Permisos", MessageBoxButtons.OK, MessageBoxIcon.Stop);
     }
 }
コード例 #18
0
        private void CalculoMontos(double monto, bool sumar, double descuento)
        {
            if (sumar)
            {
                subTotal       = subTotal + monto;
                totalDescuento = totalDescuento + descuento;
            }
            else
            {
                subTotal       = subTotal - monto;
                totalDescuento = totalDescuento - descuento;
            }
            var igvValue     = (subTotal * (DataUtil.GetDouble(AppConstant.GeneralInfo.IGV) / 100));
            var totalGeneral = subTotal + igvValue - totalDescuento;

            txtSubTotalCopy.Text       = subTotal.ToString(DataUtil.Format.Decimals);
            txtTotalDescuentoCopy.Text = totalDescuento.ToString(DataUtil.Format.Decimals);
            txtIGVCopy.Text            = igvValue.ToString(DataUtil.Format.Decimals);
            txtTotalGeneralCopy.Text   = totalGeneral.ToString(DataUtil.Format.Decimals);
        }
コード例 #19
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (isRecordSelected())
            {
                DialogResult diagResult = MessageBox.Show("Está seguro de eliminar el movimiento seleccionado?", "Eliminar", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (diagResult == DialogResult.Yes)
                {
                    DataGridViewSelectedRowCollection Seleccionados = dgwCuenta.SelectedRows;
                    foreach (DataGridViewRow item in Seleccionados)
                    {
                        if (DataUtil.Update("DELETE FROM movimientos WHERE Movimiento_id = " + item.Cells["MOVIMIENTO_ID"].Value.ToString() + ""))
                        {
                            if (DataUtil.GetString(item.Cells["Tipo_movimiento"].Value) == "DEPOSITO")
                            {
                                totalDeposito = totalDeposito - DataUtil.GetDouble(item.Cells["ImporteNeto"].Value);
                            }
                            else
                            {
                                totalRetiro = totalRetiro - DataUtil.GetDouble(item.Cells["ImporteNeto"].Value);
                            }

                            totalGeneral      = totalRetiro + totalDeposito;
                            txtDepositro.Text = totalDeposito.ToString(DataUtil.Format.Decimals);
                            txtRetiro.Text    = totalRetiro.ToString(DataUtil.Format.Decimals);
                            txtTotal.Text     = totalGeneral.ToString(DataUtil.Format.Decimals);

                            this.dgwCuenta.Rows.RemoveAt(item.Index);
                        }
                    }
                }
            }
            else
            {
                MessageBox.Show("Seleccione un registro", "Informacion", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
コード例 #20
0
        private bool IsReadyToSaveFont()
        {
            bool valueResult = true;

            epFontDetailBar.SetError(txtFontDetailBar, string.Empty);
            epFontHeaderBar.SetError(txtFontHeaderBar, string.Empty);
            epFontDetail.SetError(txtFontDetailCocina, string.Empty);
            epFontHeader.SetError(txtFontHeaderCocina, string.Empty);

            double fontDetailBar = DataUtil.GetDouble(txtFontDetailBar.Text);
            double fontHeaderBar = DataUtil.GetDouble(txtFontHeaderBar.Text);
            double fontDetail    = DataUtil.GetDouble(txtFontDetailCocina.Text);
            double fontHeader    = DataUtil.GetDouble(txtFontHeaderCocina.Text);

            if (fontDetailBar > 12 || fontDetailBar < 1)
            {
                valueResult = false;
                epFontDetailBar.SetError(txtFontDetailBar, "El tamaño de letra de los detalles (Bar/Cocina) tiene que ser mayor a 0 y menor que 12");
            }
            if (fontHeaderBar > 12 || fontHeaderBar < 1)
            {
                valueResult = false;
                epFontHeaderBar.SetError(txtFontHeaderBar, "El tamaño de letra de la cabezera (Bar/Cocina) tiene que ser mayor a 0 y menor que 12");
            }
            if (fontDetail > 12 || fontDetail < 1)
            {
                valueResult = false;
                epFontDetail.SetError(txtFontDetailCocina, "El tamaño de letra de los detalles tiene que ser mayor a 0 y menor que 12");
            }
            if (fontHeader > 12 || fontHeader < 1)
            {
                valueResult = false;
                epFontHeader.SetError(txtFontHeaderCocina, "El tamaño de letra de la cabezera tiene que ser mayor a 0 y menor que 12");
            }
            return(valueResult);
        }
コード例 #21
0
        private void AddDetail(int cuentaNumber)
        {
            int    lineGrid     = 0;
            double calculoMonto = 0;

            if (txtDescuento.Text.Trim() != string.Empty)
            {
                calculoMonto = (DataUtil.GetDouble(txtPrecioUnitario.Text) * (1 - DataUtil.GetDouble(txtDescuento.Text) / 100)) * DataUtil.GetInt(txtCantidad.Text);
            }
            else
            {
                calculoMonto = (DataUtil.GetDouble(txtPrecioUnitario.Text) * DataUtil.GetInt(txtCantidad.Text));
            }

            switch (cuentaNumber)
            {
            case 0:
                lineGrid0 = lineGrid0 + 1;
                lineGrid  = lineGrid0;
                break;

            case 1:
                lineGrid1 = lineGrid1 + 1;
                lineGrid  = lineGrid1;
                break;

            case 2:
                lineGrid2 = lineGrid2 + 1;
                lineGrid  = lineGrid2;
                break;

            case 3:
                lineGrid3 = lineGrid3 + 1;
                lineGrid  = lineGrid3;
                break;
            }
            string[] row = { DataUtil.GetString(lineGrid),
                             txtCodigoProducto.Text,
                             txtCantidad.Text,
                             txtProducto.Text,
                             txtDescuento.Text,
                             DataUtil.GetString(calculoMonto).ToString() };

            switch (cuentaNumber)
            {
            case 0:
                subTotal0 = CalculoMontos(calculoMonto, true, subTotal0);
                dgwCuenta.Rows.Add(row);
                txtSubTotal.Text = subTotal0.ToString(DataUtil.Format.Decimals);
                break;

            case 1:
                subTotal1 = CalculoMontos(calculoMonto, true, subTotal1);
                dgwCuenta1.Rows.Add(row);
                txtSubTotal1.Text = subTotal1.ToString(DataUtil.Format.Decimals);
                break;

            case 2:
                subTotal2 = CalculoMontos(calculoMonto, true, subTotal2);
                dgwCuenta2.Rows.Add(row);
                txtSubTotal2.Text = subTotal2.ToString(DataUtil.Format.Decimals);
                break;

            case 3:
                subTotal3 = CalculoMontos(calculoMonto, true, subTotal3);
                dgwCuenta3.Rows.Add(row);
                txtSubTotal3.Text = subTotal3.ToString(DataUtil.Format.Decimals);
                break;
            }


            txtCodigoProducto.Text  = string.Empty;
            txtProducto.Text        = string.Empty;
            txtCantidad.Text        = "1";
            txtDescuento.Text       = string.Empty;
            txtPrecioUnitario.Text  = string.Empty;
            txtPrecioProveedor.Text = string.Empty;
        }
コード例 #22
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);
        }
コード例 #23
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);
        }
コード例 #24
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (IsReadyToSave() && IsReadyToSaveFont())
            {
                try
                {
                    var valueAnulaciones      = "0";
                    var valueNotaVenta        = "0";
                    var valueDividirCuentas   = "0";
                    var valueCambioMesero     = "0";
                    var valueReImpresiones    = "0";
                    var valueCambioMesa       = "0";
                    var valueContrasenaSalir  = "0";
                    var valueEliminarProducto = "0";

                    var valuePreviewBar      = "0";
                    var valuePreviewCocina   = "0";
                    var valuePreviewBoletas  = "0";
                    var valuePreviewRecibos  = "0";
                    var valuePreviewReportes = "0";

                    var valueBarTexto    = "0";
                    var valueCocinaTexto = "0";

                    var valueMostrarIgvBoleta = "0";

                    if (cbAnulaciones.Checked)
                    {
                        valueAnulaciones = "1";
                    }
                    if (cbNotaVenta.Checked)
                    {
                        valueNotaVenta = "1";
                    }
                    if (cbDividirCuentas.Checked)
                    {
                        valueDividirCuentas = "1";
                    }
                    if (cbCambioMesero.Checked)
                    {
                        valueCambioMesero = "1";
                    }
                    if (cbReImpresiones.Checked)
                    {
                        valueReImpresiones = "1";
                    }
                    if (cbCambioMesa.Checked)
                    {
                        valueCambioMesa = "1";
                    }
                    if (cbContrasenaSalir.Checked)
                    {
                        valueContrasenaSalir = "1";
                    }
                    if (cbEliminarProducto.Checked)
                    {
                        valueEliminarProducto = "1";
                    }


                    if (cbPreviewBar.Checked)
                    {
                        valuePreviewBar = "1";
                    }
                    if (cbPreviewCocina.Checked)
                    {
                        valuePreviewCocina = "1";
                    }
                    if (cbPreviewBoletas.Checked)
                    {
                        valuePreviewBoletas = "1";
                    }
                    if (cbPreviewRecibos.Checked)
                    {
                        valuePreviewRecibos = "1";
                    }
                    if (cbPreviewReportes.Checked)
                    {
                        valuePreviewReportes = "1";
                    }

                    if (cbBarTexto.Checked)
                    {
                        valueBarTexto = "1";
                    }
                    if (cbCocinaTexto.Checked)
                    {
                        valueCocinaTexto = "1";
                    }

                    if (cbMostrarIGVBoletas.Checked)
                    {
                        valueMostrarIgvBoleta = "1";
                    }

                    var sqlForExecute = "UPDATE Impresora SET " +
                                        " Font_header = '" + DataUtil.GetDouble(txtFontHeaderBar.Text) + "'" +
                                        ", Font_detail = '" + DataUtil.GetDouble(txtFontDetailBar.Text) + "'" +
                                        ", Ruta = '" + cbBar.Text + "'" +
                                        ", Preview = '" + valuePreviewBar + "'" +
                                        ", Texto = '" + valueBarTexto + "'" +
                                        " WHERE tipo = 'B'";
                    DataUtil.Update(sqlForExecute);

                    sqlForExecute = "UPDATE Impresora SET " +
                                    " Font_header = '" + DataUtil.GetDouble(txtFontHeaderCocina.Text) + "'" +
                                    ", Font_detail = '" + DataUtil.GetDouble(txtFontDetailCocina.Text) + "'" +
                                    ", Ruta = '" + cbCocina.Text + "'" +
                                    ", Preview = '" + valuePreviewCocina + "'" +
                                    ", Texto = '" + valueCocinaTexto + "'" +
                                    " WHERE tipo = 'C'";
                    DataUtil.Update(sqlForExecute);

                    sqlForExecute = "UPDATE Impresora SET " +
                                    " Font_header = '" + DataUtil.GetDouble(txtFontHeaderBoletas.Text) + "'" +
                                    ", Font_detail = '" + DataUtil.GetDouble(txtFontDetailBoletas.Text) + "'" +
                                    ", Ruta = '" + cbBoletas.Text + "'" +
                                    ", Preview = '" + valuePreviewBoletas + "'" +
                                    " WHERE tipo = 'L'";
                    DataUtil.Update(sqlForExecute);

                    sqlForExecute = "UPDATE Impresora SET " +
                                    " Font_header = '" + DataUtil.GetDouble(txtFontHeaderRecibos.Text) + "'" +
                                    ", Font_detail = '" + DataUtil.GetDouble(txtFontDetailRecibos.Text) + "'" +
                                    ", Ruta = '" + cbRecibos.Text + "'" +
                                    ", Preview = '" + valuePreviewRecibos + "'" +
                                    " WHERE tipo = 'R'";
                    DataUtil.Update(sqlForExecute);

                    sqlForExecute = "UPDATE Impresora SET " +
                                    " Font_header = '" + DataUtil.GetDouble(txtFontHeaderReportes.Text) + "'" +
                                    ", Font_detail = '" + DataUtil.GetDouble(txtFontDetailReportes.Text) + "'" +
                                    ", Ruta = '" + cbReportes.Text + "'" +
                                    ", Preview = '" + valuePreviewReportes + "'" +
                                    " WHERE tipo = 'P'";
                    DataUtil.Update(sqlForExecute);

                    sqlForExecute = "UPDATE configuracion_general SET " +
                                    "  Nombre_compania = '" + txtCompania.Text.Trim().Replace("'", "''") + "'" +
                                    ", Razon_social = '" + txtRazonSocial.Text.Trim().Replace("'", "''") + "'" +
                                    ", Documento_compania = '" + txtRUC.Text.Trim() + "'" +
                                    ", Telefono1_compania = '" + txtTelefono.Text.Trim() + "'" +
                                    ", Telefono2_compania = '" + txtFax.Text.Trim() + "'" +
                                    ", Telefono3_compania = '" + txtMobile.Text.Trim() + "'" +
                                    ", Direccion_compania = '" + txtDireccion.Text.Trim().Replace("'", "''") + "'" +
                                    ", Direccion_fiscal = '" + txtDireccionFiscal.Text.Trim().Replace("'", "''") + "'" +
                                    ", Mensaje_recibo_1 = '" + txtLinea1.Text.Trim().Replace("'", "''") + "'" +
                                    ", Mensaje_recibo_2 = '" + txtLinea2.Text.Trim().Replace("'", "''") + "'" +
                                    ", Mensaje_recibo_3 = '" + txtLinea3.Text.Trim().Replace("'", "''") + "'" +
                                    ", Ruta_logo_compania = '" + txtLogo.Text.Trim().Replace("'", "''") + "'" +
                                    ", Departamento = '" + txtDepartamento.Text.Trim().Replace("'", "''") + "'" +
                                    ", Provincia = '" + txtProvincia.Text.Trim().Replace("'", "''") + "'" +
                                    ", Urbanizacion = '" + txtUrbanizacion.Text.Trim().Replace("'", "''") + "'" +
                                    ", Codigo_Postal = '" + txtCodigoPostal.Text.Trim().Replace("'", "''") + "'" +
                                    ", Alegra_Usuario = '" + txtAlegraUsuario.Text.Trim().Replace("'", "''") + "'" +
                                    ", Alegra_Token = '" + txtAlegraToken.Text.Trim().Replace("'", "''") + "'" +
                                    ", Email_compania = '" + txtEmail.Text.Trim().Replace("'", "''") + "'" +
                                    ", Web_compania = '" + txtWeb.Text.Trim().Replace("'", "''") + "'" +
                                    ", IGV = '" + txtIGV.Text.Trim() + "'" +
                                    ", Monto_caja = '" + DataUtil.GetCurrency(txtCaja.Text) + "'" +
                                    ", Fecha_actualizacion = '" + DateTime.Now + "'" +
                                    ", Actualizado_por = '" + AppConstant.EmployeeInfo.Codigo + "'" +
                                    ", Ultima_boleta = '" + txtBoleta.Text.Trim() + "'" +
                                    ", Ultima_factura = '" + txtFactura.Text.Trim() + "'" +
                                    ", Prefijo_Boleta = '" + txtPrefijoBoleta.Text.Trim() + "'" +
                                    ", Prefijo_Factura = '" + txtPrefijoFactura.Text.Trim() + "'" +
                                    ", Ultima_Nota_Credito = '" + txtNotaCredito.Text.Trim() + "'" +
                                    ", Ultima_Nota_Debito = '" + txtNotaDebito.Text.Trim() + "'" +
                                    ", Prefijo_Nota_Credito = '" + txtPrefijoNotaCredito.Text.Trim() + "'" +
                                    ", Prefijo_Nota_Debito = '" + txtPrefijoNotaDebito.Text.Trim() + "'" +
                                    ", Contrasena_Anulaciones = '" + valueAnulaciones + "'" +
                                    ", Contrasena_NotaVenta = '" + valueNotaVenta + "'" +
                                    ", Contrasena_DividirCuenta = '" + valueDividirCuentas + "'" +
                                    ", Contrasena_CambioMesero = '" + valueCambioMesero + "'" +
                                    ", Contrasena_ReImpresiones = '" + valueReImpresiones + "'" +
                                    ", Contrasena_CambioMesa = '" + valueCambioMesa + "'" +
                                    ", Contrasena_Salir = '" + valueContrasenaSalir + "'" +
                                    ", Contrasena_EliminarProducto = '" + valueEliminarProducto + "'" +
                                    ", Mostrar_IGV_Boleta = '" + valueMostrarIgvBoleta + "'";


                    if (!DataUtil.Update(sqlForExecute))
                    {
                        return;
                    }
                    MessageBox.Show(@"Registro grabado correctamente", @"Informacion", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    DialogResult = DialogResult.OK;
                    Close();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(@"Error en Grabar: " + ex.Message);
                }
            }
        }