Ejemplo n.º 1
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);
        }
Ejemplo n.º 2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (IsReadyToSave())
            {
                string sqlForExecute = string.Empty;
                try
                {
                    string habilitado = DataUtil.GetString(cbEstado.SelectedItem) == "SI" ? "1" : "0";

                    sqlForExecute = "UPDATE mesa SET " +
                                    "Mesa_descripcion = '" + txtDescripcion.Text.Trim().Replace("'", "''") + "'" +
                                    ", Mesa_habilitado = '" + habilitado + "'" +
                                    ", Fecha_actualizacion = '" + DateTime.Now + "'" +
                                    ", Actualizado_por = '" + AppConstant.EmployeeInfo.Codigo + "'" +
                                    " WHERE Mesa_id = " + mesaID;


                    if (DataUtil.Update(sqlForExecute))
                    {
                        MessageBox.Show("Registro grabado correctamente", "Informacion", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        DialogResult = DialogResult.OK;
                        this.Close();
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Error en Grabar: " + ex.Message);
                }
            }
        }
Ejemplo n.º 3
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);
            }
        }
Ejemplo n.º 4
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);
        }
Ejemplo n.º 5
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);
        }
Ejemplo n.º 6
0
        private void frmCustomerOrderSplit_Load(object sender, EventArgs e)
        {
            lblEmployee.Text = AppConstant.EmployeeInfo.Apellidos + ", " + AppConstant.EmployeeInfo.Nombres;
            if (tipoVentaView.Equals(AppConstant.TipoVenta.Salon))
            {
                DataSet dsMesaInfo = DataUtil.FillDataSet("SELECT Pedido_id FROM mesa WHERE mesa_id = " + mesaIDView + "", "mesa");
                pedidoIDView = DataUtil.GetInt(dsMesaInfo.Tables[0].Rows[0], "Pedido_id");
            }
            else
            {
                lblTipo.Visible = false;
                lblMesa.Visible = false;
            }
            GetTurnInfo(0);

            if (pedidoIDView != 0)
            {
                lblCuentaOrigen.Text = DataUtil.GetString(pedidoIDView);
                DataSet dsPedidoInfo = DataUtil.FillDataSet("SELECT last_line, Tipo_venta, turno_id, Atendido_por FROM pedido WHERE pedido_id = " + pedidoIDView + "", "pedido");

                tipoVentaView = DataUtil.GetString(dsPedidoInfo.Tables[0].Rows[0], "Tipo_venta");
                if (tipoVentaView != AppConstant.TipoVenta.Salon)
                {
                    lblTipo.Visible = false;
                    lblMesa.Visible = false;
                }
                ViewOrder();
                GetTurnInfo(DataUtil.GetInt(dsPedidoInfo.Tables[0].Rows[0], "turno_id"));
                GetEmployee(DataUtil.GetInt(dsPedidoInfo.Tables[0].Rows[0], "Atendido_por"));
            }

            lblTipo.Text      = tipoMesaView;
            lblMesa.Text      = mesaIDView;
            lblTipoOrden.Text = tipoVentaView;
        }
Ejemplo n.º 7
0
        private void GetOrders()
        {
            if (pedidoEstado.Equals(AppConstant.PedidoEstado.Anulado))
            {
                Anulados();
            }
            if (pedidoEstado.Equals(AppConstant.PedidoEstado.NotaVenta))
            {
                NotaVenta();
            }
            if (pedidoEstado.Equals(AppConstant.PedidoEstado.Atendiendo))
            {
                OrdenCobrar();
            }

            if (dsSearch != null)
            {
                dgwResult.DataSource = dsSearch;
                dgwResult.DataMember = "pedido";
                lblNo.Text           = DataUtil.GetString(dsSearch.Tables[0].Rows.Count);
            }
            else
            {
                lblNo.Text = "0";
            }
        }
Ejemplo n.º 8
0
        private void GetCustomerValues()
        {
            string stringSQL = "c.cliente_id AS Codigo, " +
                               "c.Tipo_documento AS [Tipo documento], " +
                               "c.Documento, " +
                               "IIf(c.Tipo_documento='RUC',c.cliente_apellidos,c.cliente_apellidos+', '+c.cliente_nombres) AS Cliente," +
                               "c.Cliente_direccion AS Direccion, " +
                               "c.Telefono_casa AS [Telefono fijo], " +
                               "c.Telefono_celular AS Celular, " +
                               "c.Telefono_trabajo AS [Telefono trabajo], " +
                               "c.Email_principal AS [Email Principal]," +
                               "c.Comentario, " +
                               "c.Fecha_creacion AS [Fecha creacion], " +
                               "cr.Apellidos_empleado+', '+cr.Nombres_empleado AS [Creado por]," +
                               "c.Fecha_actualizacion AS [Fecha actualizacion]," +
                               "up.Apellidos_empleado+', '+up.Nombres_empleado AS [Actualizado por]" +
                               "  FROM (cliente AS c LEFT JOIN empleado AS cr ON c.creado_por=cr.codigo_empleado)" +
                               "  LEFT JOIN empleado AS up ON c.actualizado_por=up.codigo_empleado";

            DataSet dsSearch = DataUtil.FillDataSet("SELECT " + stringSQL + " WHERE c.cliente_id = " + lblCodigoCliente.Text.Trim() + " ORDER BY c.cliente_apellidos", "cliente");

            if (dsSearch.Tables[0].Rows.Count == 1)
            {
                txtNumeroCliente.Text = DataUtil.GetString(dsSearch.Tables[0].Rows[0], "Cliente");
                lblCodigoCliente.Text = DataUtil.GetString(dsSearch.Tables[0].Rows[0], "Codigo");
                lblNombreCliente.Text = DataUtil.GetString(dsSearch.Tables[0].Rows[0], "Telefono fijo");
                txtDireccion.Text     = DataUtil.GetString(dsSearch.Tables[0].Rows[0], "Direccion");
            }
        }
Ejemplo n.º 9
0
        private void GetOrders()
        {
            this.dgwCuenta.Rows.Clear();

            string stringSQL = "SELECT " +
                               "p.Pedido_id AS Codigo, " +
                               "p.Turno_id AS Turno, " +
                               "IIf(c.Tipo_documento='RUC',c.cliente_apellidos,c.cliente_apellidos+', '+c.cliente_nombres) AS Cliente," +
                               "c.Telefono_casa, " +
                               "c.Cliente_direccion, " +
                               "p.Tipo_venta," +
                               "DatePart('h',p.fecha_pedido) AS Hora," +
                               "DatePart('n',p.fecha_pedido) AS Minutos" +
                               "  FROM (pedido AS p LEFT JOIN cliente AS c ON p.cliente_id=c.cliente_id)" +
                               " WHERE (p.tipo_venta = 'DELIVERY' OR p.tipo_venta = 'RECOGER')" +
                               "   AND p.Estado = 'A'" +
                               " ORDER BY p.fecha_pedido";

            DataSet dsPedidoInfo = DataUtil.FillDataSet(stringSQL, "pedido");

            foreach (DataRow pedidoRow in dsPedidoInfo.Tables["pedido"].Rows)
            {
                string horaPedido = DataUtil.GetString(pedidoRow["Hora"]) + " : " + DataUtil.GetString(pedidoRow["Minutos"]);

                string[] row = { DataUtil.GetString(pedidoRow["Codigo"]),
                                 DataUtil.GetString(pedidoRow["Turno"]),
                                 horaPedido,
                                 DataUtil.GetString(pedidoRow["Cliente"]),
                                 DataUtil.GetString(pedidoRow["Telefono_casa"]),
                                 DataUtil.GetString(pedidoRow["Tipo_venta"]),
                                 DataUtil.GetString(pedidoRow["Cliente_direccion"]), };
                dgwCuenta.Rows.Add(row);
            }
        }
Ejemplo n.º 10
0
        private void frmQuickButtons_Load(object sender, EventArgs e)
        {
            lblBoton.Text = botonId;
            lblTipo.Text  = tipo;
            string sWhere = "producto_categoria_id = " + categoriaId + "";

            lblCategoria.Text    = DataUtil.FindSingleRow("producto_categoria", "Producto_categoria_descripcion", sWhere);
            sWhere               = "producto_sub_categoria_id = " + subCategoriaId + "";
            lblSubCategoria.Text = DataUtil.FindSingleRow("producto_sub_categoria", "Producto_sub_categoria_descripcion", sWhere);

            if (adding)
            {
                btnSaveEdit.Enabled     = false;
                btnDisassociate.Visible = false;
            }
            else
            {
                DataSet mainDataSet = DataUtil.FillDataSet("SELECT * FROM " + tableName + " WHERE " + formWhereField + " = " + botonId + " AND producto_sub_categoria_id = " + subCategoriaId + "", tableName);
                txtDescripcion.Text = DataUtil.GetString(mainDataSet.Tables[0].Rows[0], "Boton_descripcion");
                txtRuta.Text        = DataUtil.GetString(mainDataSet.Tables[0].Rows[0], "Boton_ruta_imagen");
                sWhere           = "Producto_id = " + DataUtil.GetString(mainDataSet.Tables[0].Rows[0], "Producto_id") + "";
                txtProducto.Text = DataUtil.FindSingleRow("Producto", "Producto_descripcion", sWhere);

                txtProducto.ReadOnly    = true;
                btnSaveEdit.Enabled     = true;
                btnDisassociate.Visible = true;
                btnAssociate.Visible    = false;
            }
        }
Ejemplo n.º 11
0
        private void CargarTurnoOrdenesPagadas(int turnoId)
        {
            decimal montoTotal  = 0;
            DataSet dsVentaInfo = DataUtil.FillDataSet("SELECT v.tipo_pago," +
                                                       "       e.Estacion_descripcion," +
                                                       "       e.estacion_id," +
                                                       "       count(*) AS numero," +
                                                       "       SUM(v.Monto_total) AS total" +
                                                       " FROM (venta AS v LEFT JOIN estacion AS e ON v.estacion_id = e.estacion_id)" +
                                                       " WHERE v.turno_id = " + turnoId + "" +
                                                       " GROUP BY v.tipo_pago, e.Estacion_descripcion, e.estacion_id" +
                                                       " ORDER BY e.estacion_id", "venta");

            foreach (DataRow ventaRow in dsVentaInfo.Tables["venta"].Rows)
            {
                string[] row = { DataUtil.GetString(ventaRow["Estacion_descripcion"]),
                                 DataUtil.GetString(ventaRow["tipo_pago"]),
                                 DataUtil.GetString(ventaRow["numero"]),
                                 DataUtil.GetString(ventaRow["total"]),
                                 DataUtil.GetString(ventaRow["estacion_id"]) };
                dgwCuentas.Rows.Add(row);
                string descripcion = DataUtil.GetString(ventaRow["Estacion_descripcion"]) + "/" +
                                     DataUtil.GetString(ventaRow["tipo_pago"]) + " = " +
                                     DataUtil.GetString(ventaRow["numero"]);
                InsertarValoresReporte(descripcion, DataUtil.GetString(ventaRow["total"]));
                montoTotal = montoTotal + DataUtil.GetDecimal(ventaRow["total"]);
            }
            txtDetalleTotal.Text = montoTotal.ToString(DataUtil.Format.Decimals);
            InsertarValoresReporte("Detalle de Ordenes Total:", montoTotal.ToString(DataUtil.Format.Decimals));
            InsertarValoresReporte(string.Empty, string.Empty);
        }
Ejemplo n.º 12
0
        public static void GetTurnInfo(int turnoId)
        {
            DataSet dsConfig = null;

            if (turnoId.Equals(0))
            {
                dsConfig = DataUtil.FillDataSet(DataBaseQuerys.Turno(0, 0, false), "turno");
            }
            else
            {
                dsConfig = DataUtil.FillDataSet(DataBaseQuerys.Turno(turnoId, 0, false), "turno");
            }

            if (dsConfig.Tables[0].Rows.Count > 0)
            {
                AppConstant.Turno.Codigo    = DataUtil.GetString(dsConfig.Tables[0].Rows[0], "Turno_id");
                AppConstant.Turno.FechaHora = DataUtil.GetString(dsConfig.Tables[0].Rows[0], "Fecha_apertura");
                AppConstant.Turno.Estado    = DataUtil.GetString(dsConfig.Tables[0].Rows[0], "Estado");
            }
            else
            {
                AppConstant.Turno.Codigo    = string.Empty;
                AppConstant.Turno.FechaHora = string.Empty;
                AppConstant.Turno.Estado    = string.Empty;
            }
        }
Ejemplo n.º 13
0
        private void dgwResult_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex == -1)
            {
                return;
            }
            if ((dgwResult.Rows.Count > 0) && (dgwResult.CurrentRow.Cells[1].Value != null))
            {
                //0.Codigo
                //1.Producto
                //2.Tipo producto
                //3.Categoria
                //4.Sub Categoria
                //5.Proveedor
                //6.Precio proveedor
                //7.Margen de ganancia
                //8.Precio final
                //9.Stock actual
                //10.Fecha creacion
                //11.Creado por
                //12.Fecha actualizacion
                //13.Actualizado por
                //14.Descripcion Corta

                AppConstant.Product.ProductoCodigo           = DataUtil.GetString(dgwResult.CurrentRow.Cells[0].Value);
                AppConstant.Product.ProductoDescription      = DataUtil.GetString(dgwResult.CurrentRow.Cells[1].Value);
                AppConstant.Product.ProductoPrecio           = DataUtil.GetString(dgwResult.CurrentRow.Cells[8].Value);
                AppConstant.Product.ProductoPrecioProveedor  = DataUtil.GetString(dgwResult.CurrentRow.Cells[6].Value);
                AppConstant.Product.ProductoDescriptionCorta = string.Empty;
                AppConstant.Product.ProductoDescriptionCorta = DataUtil.GetString(dgwResult.CurrentRow.Cells[14].Value);
                Close();
            }
        }
Ejemplo n.º 14
0
        private void CategoriasCarouselDataBinding_Load()
        {
            rcCategorias.ItemDataBound           += new ItemDataBoundEventHandler(rcCategorias_ItemDataBound);
            rcCategorias.NewCarouselItemCreating += new NewCarouselItemCreatingEventHandler(rcCategorias_NewCarouselItemCreating);

            // Create a generic list of Feature objects and bind it
            List <CategoriasFeatures> products = new List <CategoriasFeatures>();

            DataSet dsCategorias = DataUtil.FillDataSet(DataBaseQuerys.ProductoCategoriaActivos(true), "producto_categoria");

            if (dsCategorias.Tables["producto_categoria"].Rows.Count > 0)
            {
                foreach (DataRow categoriaRow in dsCategorias.Tables["producto_categoria"].Rows)
                {
                    string categoriaDesc = DataUtil.GetString(categoriaRow["Producto_categoria_descripcion"]);
                    if (categoriaDesc.Length > 12)
                    {
                        categoriaDesc = categoriaDesc.Remove(12);
                    }
                    int categoriaID = DataUtil.GetInt(categoriaRow["Producto_categoria_id"]);
                    products.Add(new CategoriasFeatures(categoriaID, categoriaDesc));
                }
            }
            rcCategorias.DataSource = products;
        }
Ejemplo n.º 15
0
        private void SubCategoriasCarouselDataBinding_Load(int categoriaID)
        {
            if (categoriaID != 0)
            {
                if (categoriaIdSelected != categoriaID)
                {
                    tcAdicionales.Visible                    = false;
                    tcProductos.Visible                      = false;
                    categoriaIdSelected                      = categoriaID;
                    rcSubCategorias.ItemDataBound           += new ItemDataBoundEventHandler(rcSubCategorias_ItemDataBound);
                    rcSubCategorias.NewCarouselItemCreating += new NewCarouselItemCreatingEventHandler(rcSubCategorias_NewCarouselItemCreating);

                    // Create a generic list of Feature objects and bind it
                    List <SubCategoriasFeatures> sub_products = new List <SubCategoriasFeatures>();

                    DataSet dsSubCategorias = DataUtil.FillDataSet(DataBaseQuerys.ProductoSubCategoriaActivos(true, categoriaID.ToString()), "producto_sub_categoria");
                    if (dsSubCategorias.Tables["producto_sub_categoria"].Rows.Count > 0)
                    {
                        foreach (DataRow subCategoriaRow in dsSubCategorias.Tables["producto_sub_categoria"].Rows)
                        {
                            string subCategoriaDesc = DataUtil.GetString(subCategoriaRow["Producto_sub_categoria_descripcion"]);
                            if (subCategoriaDesc.Length > 12)
                            {
                                subCategoriaDesc = subCategoriaDesc.Remove(12);
                            }
                            int subCategoriaID = DataUtil.GetInt(subCategoriaRow["Producto_sub_categoria_id"]);
                            sub_products.Add(new SubCategoriasFeatures(subCategoriaID, subCategoriaDesc));
                        }
                    }
                    rcSubCategorias.DataSource = sub_products;
                }
            }
        }
Ejemplo n.º 16
0
        private void btnCancelOrder_Click(object sender, EventArgs e)
        {
            if (pedidoID != 0)
            {
                var result = MessageBox.Show(@"Desea anular esta orden?", @"Anular Orden", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (result == DialogResult.Yes)
                {
                    var frmCustomerOrderCancelForm = new frmCustomerOrderCancel();
                    frmCustomerOrderCancelForm.mesaID   = DataUtil.GetInt(mesaID);
                    frmCustomerOrderCancelForm.pedidoID = pedidoID;
                    frmCustomerOrderCancelForm.ShowDialog();

                    var sWhere    = "pedido_id = " + DataUtil.GetString(pedidoID) + "";
                    var newEstado = DataUtil.GetString(DataUtil.FindSingleRow("pedido", "Estado", sWhere));
                    if (newEstado.Equals(AppConstant.PedidoEstado.Anulado))
                    {
                        Close();
                    }
                }
            }
            else
            {
                MessageBox.Show(@"Debe agregar una Orden.", @"Informacion", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Ejemplo n.º 17
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;
            }
        }
Ejemplo n.º 18
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);
         }
     }
 }
Ejemplo n.º 19
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (txtCantidad.Text.Trim() != string.Empty && txtProducto.Text.Trim() != string.Empty)
            {
                if (DataUtil.GetInt(txtCantidad.Text) >= 0)
                {
                    txtCantidad.Text = "1";
                }

                bool isExiste = false;
                if (sender.ToString() != "ADICIONAL")
                {
                    isExiste = ExistRecord(txtCodigoProducto.Text, DataUtil.GetInt(txtCantidad.Text));
                }

                if (!isExiste)
                {
                    lineGrid = lineGrid + 1;
                    string[] row = { DataUtil.GetString(lineGrid),
                                     txtCodigoProducto.Text,
                                     txtProducto.Text,
                                     txtCantidad.Text, };
                    dgwOrden.Rows.Add(row);

                    txtCodigoProducto.Text = string.Empty;
                    txtProducto.Text       = string.Empty;
                    txtCantidad.Text       = "1";
                    txtPrecioUnitario.Text = string.Empty;
                }
            }
            else
            {
                MessageBox.Show("Debe ingresar el Producto y la cantidad.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 20
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);
     }
 }
Ejemplo n.º 21
0
        private void checkBox1_Click(object sender, EventArgs e)
        {
            CheckBox       cb         = sender as CheckBox;
            frmTableConfig configForm = new frmTableConfig();

            configForm.mesaID     = cb.Tag.ToString();
            configForm.enableMesa = "NO";
            if (cb.Checked)
            {
                configForm.enableMesa = "SI";
            }
            DialogResult result = configForm.ShowDialog();

            if (result == DialogResult.OK)
            {
                DataSet dsMesaInfo = DataUtil.FillDataSet(DataBaseQuerys.Mesa(DataUtil.GetInt(cb.Tag)), "mesa");
                cb.Text    = DataUtil.GetString(dsMesaInfo.Tables[0].Rows[0], "Mesa_descripcion");
                cb.Checked = DataUtil.GetBool(dsMesaInfo.Tables[0].Rows[0], "Mesa_habilitado");
            }
            else
            {
                if (cb.Checked)
                {
                    cb.Checked = false;
                }
                else
                {
                    cb.Checked = true;
                }
            }
        }
Ejemplo n.º 22
0
        private void GetTurnInfo()
        {
            if (TurnoIDValue == 0)
            {
                if (AppConstant.Turno.Codigo != string.Empty)
                {
                    lblTurno.Text      = AppConstant.Turno.Codigo;
                    lblTurnoFecha.Text = AppConstant.Turno.FechaHora;
                }
                else
                {
                    lblTurno.Text      = string.Empty;
                    lblTurnoFecha.Text = string.Empty;
                }
            }
            else
            {
                DataSet dsConfig = DataUtil.FillDataSet(DataBaseQuerys.Turno(TurnoIDValue, 0, true), "turno");

                if (dsConfig.Tables[0].Rows.Count > 0)
                {
                    lblTurno.Text          = DataUtil.GetString(dsConfig.Tables[0].Rows[0], "Turno_id");
                    lblTurnoFecha.Text     = DataUtil.GetString(dsConfig.Tables[0].Rows[0], "Fecha_apertura");
                    lblCierreLabel.Visible = true;
                    lblCierreValue.Visible = true;
                    lblCierreValue.Text    = DataUtil.GetString(dsConfig.Tables[0].Rows[0], "Fecha_cierre");
                }
                else
                {
                    lblTurno.Text      = string.Empty;
                    lblTurnoFecha.Text = string.Empty;
                }
            }
        }
Ejemplo n.º 23
0
        private void frmOutStock_Load(object sender, EventArgs e)
        {
            string searchWhere = "AND p.Alerta_fuera_stock = '1' AND p.Cantidad_actual <= p.Cantidad_fuera_stock";
            string stringSQL   = "p.Producto_id AS Codigo, " +
                                 "p.Producto_descripcion AS [Producto], " +
                                 "p.Producto_tipo AS [Tipo producto], " +
                                 "pc.Producto_categoria_descripcion AS Categoria," +
                                 "pv.Proveedor_nombre AS Proveedor," +
                                 "p.Precio_proveedor AS [Precio proveedor]," +
                                 "p.Margen_ganancia AS [Margen de ganancia], " +
                                 "p.Precio_final AS [Precio final], " +
                                 "p.Cantidad_actual AS [Stock actual]," +
                                 "p.Fecha_creacion AS [Fecha creacion], " +
                                 "cr.Apellidos_empleado+', '+cr.Nombres_empleado AS [Creado por]," +
                                 "p.Fecha_actualizacion AS [Fecha actualizacion]," +
                                 "up.Apellidos_empleado+', '+up.Nombres_empleado AS [Actualizado por]  " +
                                 " FROM (((producto AS p LEFT JOIN empleado AS cr ON p.creado_por=cr.codigo_empleado)  " +
                                 " LEFT JOIN empleado AS up ON p.actualizado_por=up.codigo_empleado)" +
                                 " LEFT JOIN producto_categoria AS pc ON p.Producto_categoria_id=pc.Producto_categoria_id)" +
                                 " LEFT JOIN proveedor AS pv ON p.Proveedor_id = pv.Proveedor_id";

            DataSet dsSearch = DataUtil.FillDataSet("SELECT " + stringSQL + " WHERE p.Producto_id <> -1 " + searchWhere + "  ORDER BY p.Producto_descripcion", "producto");

            dgwResult.DataSource = dsSearch;
            dgwResult.DataMember = "producto";
            lblNo.Text           = DataUtil.GetString(dsSearch.Tables[0].Rows.Count);
        }
Ejemplo n.º 24
0
        private void GetMesaInfo()
        {
            var dsMesaInfo = DataUtil.FillDataSet(DataBaseQuerys.Mesa(DataUtil.GetInt(mesaID)), "mesa");

            if (dsMesaInfo.Tables[0].Rows.Count > 0)
            {
                if (DataUtil.GetString(DataUtil.GetString(dsMesaInfo.Tables[0].Rows[0], "mesa_tipo")).Equals("BAR"))
                {
                    tipoMesa = "Bar :";
                }
                else
                {
                    tipoMesa = "Mesa :";
                }

                mesaDesc = DataUtil.GetString(dsMesaInfo.Tables[0].Rows[0], "Mesa_descripcion");
                if (pedidoID == 0)
                {
                    pedidoID = DataUtil.GetInt(dsMesaInfo.Tables[0].Rows[0], "Pedido_id");
                }

                lblTipoMesa.Visible = true;
                lblMesaDesc.Visible = true;
                lblTipoMesa.Text    = tipoMesa;
                lblMesaDesc.Text    = mesaDesc;
            }
        }
Ejemplo n.º 25
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);
        }
Ejemplo n.º 26
0
        private void frmChangeTable_Load(object sender, EventArgs e)
        {
            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.Visible = false;
                        }
                    }
                }
            }
        }
Ejemplo n.º 27
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();
                }
            }
        }
Ejemplo n.º 28
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);
            }
        }
Ejemplo n.º 29
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (IsReadyToSave())
            {
                string sqlForExecute = string.Empty;
                try
                {
                    string categoriaWhere = "Producto_categoria_descripcion = '" + DataUtil.GetString(cbCategoria.SelectedItem) + "'";

                    if (adding)
                    {
                        sqlForExecute = "INSERT INTO " + tableName + " (" +
                                        formWhereField + "," +
                                        "Producto_sub_categoria_descripcion," +
                                        "Producto_categoria_id," +
                                        "Estado," +
                                        "Fecha_creacion," +
                                        "Creado_por," +
                                        "Fecha_actualizacion," +
                                        "Actualizado_por)" +
                                        " VALUES (" +
                                        DataUtil.GetNewId(tableName) + "," +
                                        "'" + txtDescripcion.Text.Trim() + "'," +
                                        "'" + DataUtil.FindSingleRow("producto_categoria", "Producto_categoria_id", categoriaWhere) + "'," +
                                        "'" + cbEstado.SelectedItem + "'," +
                                        "'" + DateTime.Now + "'," +
                                        "'" + AppConstant.EmployeeInfo.Codigo + "'," +
                                        "'" + DateTime.Now + "'," +
                                        "'" + AppConstant.EmployeeInfo.Codigo + "'" +
                                        ")";
                    }
                    else
                    {
                        sqlForExecute = "UPDATE " + tableName + " SET " +
                                        "  Producto_sub_categoria_descripcion = '" + txtDescripcion.Text.Trim() + "'" +
                                        ", Producto_categoria_id = '" + DataUtil.FindSingleRow("producto_categoria", "Producto_categoria_id", categoriaWhere) + "'" +
                                        ", Estado = '" + cbEstado.SelectedItem + "'" +
                                        ", Fecha_actualizacion = '" + DateTime.Now + "'" +
                                        ", Actualizado_por = '" + AppConstant.EmployeeInfo.Codigo + "'" +
                                        " 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);
                }
            }
        }
Ejemplo n.º 30
0
 private void SetButton(Button button, int categoriaID, string categoriaDesc)
 {
     if (DataUtil.GetString(button.Tag) == string.Empty)
     {
         button.Tag     = categoriaID;
         button.Text    = categoriaDesc;
         button.Visible = true;
     }
 }