Ejemplo n.º 1
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.º 2
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.º 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 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.º 5
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.º 6
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.º 7
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.º 8
0
        private string BuildWhere()
        {
            string campoFecha  = string.Empty;
            string searchWhere = string.Empty;

            if (txtCuenta.Text.Trim() != string.Empty)
            {
                searchWhere = " AND p.pedido_id = " + DataUtil.GetInt(txtCuenta.Text.Trim()) + "";
            }
            if (txtCuentaPadre.Text.Trim() != string.Empty)
            {
                searchWhere = " AND p.Pedido_origen_id = " + DataUtil.GetInt(txtCuentaPadre.Text.Trim()) + "";
            }
            if (!cbAll.Checked)
            {
                if (pedidoEstado.Equals(AppConstant.PedidoEstado.Atendiendo))
                {
                    campoFecha = "p.Fecha_Pedido";
                }
                else
                {
                    campoFecha = "p.Fecha_anulacion";
                }

                searchWhere = searchWhere + " AND " + campoFecha + " >#" + dtpFechaInicio.Value.AddDays(-1).ToShortDateString() + " 23:59#";
                searchWhere = searchWhere + " AND " + campoFecha + " <#" + dtpFechaFin.Value.AddDays(1).ToShortDateString() + " 00:00#";
            }
            if (radmccbTurno.Text != string.Empty)
            {
                searchWhere = searchWhere + " AND p.Turno_id = " + radmccbTurno.EditorControl.Rows[radmccbTurno.SelectedIndex].Cells["Turno_id"].Value + "";
            }
            return(searchWhere);
        }
Ejemplo n.º 9
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.º 10
0
        private void btnDetalle_Click(object sender, EventArgs e)
        {
            frmCloseTurn frmCloseTurnForm = new frmCloseTurn();

            frmCloseTurnForm.TurnoIDValue = DataUtil.GetInt(txtCodigo.Text);
            frmCloseTurnForm.ShowDialog();
        }
Ejemplo n.º 11
0
        private void btnSubCategoria_Click(object sender, EventArgs e)
        {
            LimpiarTabPage(tabPageSubCategorias, true, false);
            Button btn = sender as Button;

            subCategoriaTextSelected = btn.Text;
            btn.BackColor            = Color.LightSteelBlue;
            GetSubCategoriaProducts(DataUtil.GetInt(btn.Tag));
        }
Ejemplo n.º 12
0
        private void frmCustomerOrderView_Load(object sender, EventArgs e)
        {
            if (ventaIdParam > 0)
            {
                label4.Visible     = true;
                lblVentaNo.Visible = true;
                lblVentaNo.Text    = DataUtil.GetString(ventaIdParam);
            }
            lblEmployee.Text = AppConstant.EmployeeInfo.Apellidos + @", " + AppConstant.EmployeeInfo.Nombres;
            GetTurnInfo(0);

            Text = Text + @" - Pedido No.: " + pedidoID;

            var dsPedidoInfo = DataUtil.FillDataSet("SELECT last_line, Tipo_venta, turno_id, Atendido_por, Fecha_anulacion, Comentarios, Estado FROM pedido WHERE pedido_id = " + pedidoID + "", "pedido");

            tipoVenta = DataUtil.GetString(dsPedidoInfo.Tables[0].Rows[0], "Tipo_venta");
            ViewOrder();
            GetTurnInfo(DataUtil.GetInt(dsPedidoInfo.Tables[0].Rows[0], "turno_id"));
            GetEmployee(DataUtil.GetInt(dsPedidoInfo.Tables[0].Rows[0], "Atendido_por"));

            lblFechaAnulacion.Text = DataUtil.GetString(dsPedidoInfo.Tables[0].Rows[0], "Fecha_anulacion");
            txtComentarios.Text    = DataUtil.GetString(dsPedidoInfo.Tables[0].Rows[0], "Comentarios");

            if (DataUtil.GetString(dsPedidoInfo.Tables[0].Rows[0], "Estado") == AppConstant.PedidoEstado.Anulado)
            {
                lblEstado.Text     = @"ANULADO";
                lblTipoMotivo.Text = @"Motivos de la anulacion :";
                lblFecha.Text      = @"Fecha de la anulacion :";
            }
            else if (DataUtil.GetString(dsPedidoInfo.Tables[0].Rows[0], "Estado") == AppConstant.PedidoEstado.NotaVenta)
            {
                lblEstado.Text     = @"NOTA DE VENTA";
                lblTipoMotivo.Text = @"Motivos de la Nota de Venta :";
                lblFecha.Text      = @"Fecha de la Nota de Venta :";
            }
            else if (DataUtil.GetString(dsPedidoInfo.Tables[0].Rows[0], "Estado") == AppConstant.PedidoEstado.Facturado)
            {
                lblEstado.Text         = @"FACTURADO";
                lblTipoMotivo.Visible  = false;
                lblFecha.Visible       = false;
                txtComentarios.Visible = false;
            }

            lblTipoOrden.Text = tipoVenta;
            if (pedidoOrigenView != string.Empty)
            {
                lblOrdenOrigen.Visible      = true;
                lblOrdenOrigenValue.Visible = true;
                lblOrdenOrigenValue.Text    = pedidoOrigenView;
                lblFecha.Visible            = false;
                lblFechaAnulacion.Visible   = false;
                lblTipoMotivo.Visible       = false;
                txtComentarios.Visible      = false;
            }
        }
Ejemplo n.º 13
0
        protected override bool ExistRecord()
        {
            var recordCount = DataUtil.GetInt(DataUtil.FindSingleRow("turno_estacion", "Count(*)", "estacion_id = " + txtCodigo.Text + ""));

            if (recordCount > 0)
            {
                MessageBox.Show(@"No se puede borrar la estacion, tiene " + recordCount + @" turnos asociados.", @"Borrar", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return(false);
            }
            return(true);
        }
Ejemplo n.º 14
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);
            }
        }
Ejemplo n.º 15
0
        protected override bool ExistRecord()
        {
            var recordCount = DataUtil.GetInt(DataUtil.FindSingleRow("venta", "Count(*)", "atendido_por = " + txtCodigo.Text + ""));

            recordCount = recordCount + DataUtil.GetInt(DataUtil.FindSingleRow("pedido", "Count(*)", "atendido_por = " + txtCodigo.Text + ""));
            if (recordCount > 0)
            {
                MessageBox.Show(@"No se puede borrar el empleado tiene ventas y ordenes asociadas.", @"Borrar", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return(false);
            }
            return(true);
        }
Ejemplo n.º 16
0
        private void frmTableConfig_Load(object sender, EventArgs e)
        {
            DataSet dsMesaInfo = DataUtil.FillDataSet(DataBaseQuerys.Mesa(DataUtil.GetInt(mesaID)), "mesa");

            txtDescripcion.Text = DataUtil.GetString(dsMesaInfo.Tables[0].Rows[0], "Mesa_descripcion");
            if (txtDescripcion.Text.Equals("CONFIG. MESA") || txtDescripcion.Equals("CONFIG. BAR"))
            {
                txtDescripcion.Text = string.Empty;
            }
            lblTipo.Text          = DataUtil.GetString(dsMesaInfo.Tables[0].Rows[0], "Mesa_tipo");
            cbEstado.SelectedItem = enableMesa;
        }
Ejemplo n.º 17
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], "Producto_descripcion");
            txtDescripcionCorta.Text    = DataUtil.GetString(mainDataSet.Tables[0].Rows[0], "Producto_descripcion_corta");
            cbTipoProducto.SelectedItem = DataUtil.GetString(mainDataSet.Tables[0].Rows[0], "Producto_tipo");
            cbEstado.SelectedItem       = oldEstado = DataUtil.GetString(mainDataSet.Tables[0].Rows[0], "estado");

            sWhere = "producto_categoria_id = " + DataUtil.GetString(mainDataSet.Tables[0].Rows[0], "producto_categoria_id") + "";
            cbCategoria.SelectedItem = DataUtil.FindSingleRow("producto_categoria", "Producto_categoria_descripcion", sWhere);

            if (DataUtil.GetString(mainDataSet.Tables[0].Rows[0], "producto_sub_categoria_id") != string.Empty)
            {
                sWhere = "producto_sub_categoria_id = " + DataUtil.GetString(mainDataSet.Tables[0].Rows[0], "producto_sub_categoria_id") + "";
                cbSubCategoria.SelectedItem = DataUtil.FindSingleRow("producto_sub_categoria", "Producto_sub_categoria_descripcion", sWhere);
            }

            txtPrecioProveedor.Text = DataUtil.GetDouble(mainDataSet.Tables[0].Rows[0], "Precio_proveedor").ToString(DataUtil.Format.Decimals);
            txtMargen.Text          = DataUtil.GetDouble(mainDataSet.Tables[0].Rows[0], "Margen_ganancia").ToString(DataUtil.Format.Decimals);
            txtPrecioFinal.Text     = DataUtil.GetDouble(mainDataSet.Tables[0].Rows[0], "Precio_final").ToString(DataUtil.Format.Decimals);
            CalculoPrecioPublico();
            txtStock.Text      = DataUtil.GetInt(mainDataSet.Tables[0].Rows[0], "Cantidad_actual").ToString();
            txtStockAlert.Text = DataUtil.GetInt(mainDataSet.Tables[0].Rows[0], "Cantidad_fuera_stock").ToString();

            if (DataUtil.GetString(mainDataSet.Tables[0].Rows[0], "Alerta_fuera_stock").Equals("1"))
            {
                cbStock.Checked = true;
            }

            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);
            }
            else
            {
                lblRUC.Text      = string.Empty;
                lblTelefono.Text = string.Empty;
                lblVendor.Text   = string.Empty;
            }

            if (DataUtil.GetString(cbTipoProducto.SelectedItem) != AppConstant.TipoProducto.Personalizado)
            {
                tcProducto.TabPages.Remove(tpReceta);
                tcProducto.TabPages.Remove(tpPaquete);
            }
            if (DataUtil.GetString(cbTipoProducto.SelectedItem).Equals(AppConstant.TipoProducto.Adicional))
            {
                lblNota.Visible = true;
            }
        }
Ejemplo n.º 18
0
 private bool VerificarDuplicados()
 {
     if (txtDescripcion.Text != string.Empty)
     {
         string sWhere = "Insumo_grupo_clasificacion_descripcion = '" + txtDescripcion.Text.Trim().Replace("'", "''") + "'";
         if (DataUtil.GetInt(DataUtil.FindSingleRow(tableName, "Count(*)", sWhere)) > 0)
         {
             MessageBox.Show("La Clasificación '" + txtDescripcion.Text.Trim() + "' ya existe.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
             return(false);
         }
     }
     return(true);
 }
Ejemplo n.º 19
0
 private bool VerificarDuplicados()
 {
     if (txtDescripcion.Text != string.Empty)
     {
         var sWhere = "Estacion_descripcion = '" + txtDescripcion.Text.Replace("'", "''") + "'";
         if (DataUtil.GetInt(DataUtil.FindSingleRow(tableName, "Count(*)", sWhere)) > 0)
         {
             MessageBox.Show(@"La estacion ya existe.", @"Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
             return(false);
         }
     }
     return(true);
 }
Ejemplo n.º 20
0
 private bool VerificarDuplicados()
 {
     if (IsReadyToSaveFirst())
     {
         string categoriaWhere = "Producto_categoria_descripcion = '" + DataUtil.GetString(cbCategoria.SelectedItem) + "'";
         string sWhere         = "Producto_sub_categoria_descripcion = '" + txtDescripcion.Text.Trim().Replace("'", "''") + "' AND Producto_categoria_id = " + DataUtil.FindSingleRow("producto_categoria", "Producto_categoria_id", categoriaWhere) + "";
         if (DataUtil.GetInt(DataUtil.FindSingleRow(tableName, "Count(*)", sWhere)) > 0)
         {
             MessageBox.Show("La sub categoria '" + txtDescripcion.Text.Trim() + "' ya existe.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
             return(false);
         }
     }
     return(true);
 }
Ejemplo n.º 21
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))
     {
         var frmCustomerOrderViewForm = new frmCustomerOrderView();
         frmCustomerOrderViewForm.pedidoID     = DataUtil.GetInt(dgwResult.CurrentRow.Cells[1].Value);
         frmCustomerOrderViewForm.ventaIdParam = DataUtil.GetInt(dgwResult.CurrentRow.Cells[0].Value);
         frmCustomerOrderViewForm.ShowDialog();
     }
 }
Ejemplo n.º 22
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);
            }
        }
Ejemplo n.º 23
0
 private bool VerificarAsignacion()
 {
     if (cbCajero.SelectedItem != null)
     {
         var sWhere = "[Persona_asignada] = " + ((System.Web.UI.WebControls.ListItem)(cbCajero.SelectedItem)).Value + "";
         if (DataUtil.GetInt(DataUtil.FindSingleRow(tableName, "Count(*)", sWhere)) > 0)
         {
             MessageBox.Show(@"El cajero ya tiene una estacion asignada.", @"Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
             return(false);
         }
         return(true);
     }
     MessageBox.Show(@"Por favor ingresar Cajero a Asignar.", @"Informacion", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     return(false);
 }
Ejemplo n.º 24
0
        protected override bool ExistRecord()
        {
            int recordCount = 0;

            recordCount = DataUtil.GetInt(DataUtil.FindSingleRow("Insumo_grupo", "Count(*)", "Insumo_grupo_clasificacion_id = " + txtCodigo.Text + ""));
            if (recordCount > 0)
            {
                MessageBox.Show("No se puede borrar la clasificación, tiene Grupos de Insumos asociados.", "Borrar", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return(false);
            }
            else
            {
                return(true);
            }
        }
Ejemplo n.º 25
0
 private bool VerificarPassword()
 {
     if (txtPassword.Text != string.Empty)
     {
         var sWhere = "[password] = '" + txtPassword.Text + "'";
         if (DataUtil.GetInt(DataUtil.FindSingleRow(tableName, "Count(*)", sWhere)) > 0)
         {
             MessageBox.Show(@"El password no es valido.", @"Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
             return(false);
         }
         return(true);
     }
     MessageBox.Show(@"Por favor ingresar su Contraseña.", @"Informacion", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     return(false);
 }
Ejemplo n.º 26
0
        protected override bool ExistRecord()
        {
            int recordCount = 0;

            recordCount = DataUtil.GetInt(DataUtil.FindSingleRow("Insumo_Presentacion", "Count(*)", "Presentacion_id = " + txtCodigo.Text + ""));
            if (recordCount > 0)
            {
                MessageBox.Show("No se puede borrar la presentacion esta asociado a insumos.", "Borrar", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return(false);
            }
            else
            {
                return(true);
            }
        }
Ejemplo n.º 27
0
        protected override bool ExistRecord()
        {
            int recordCount = 0;

            recordCount = DataUtil.GetInt(DataUtil.FindSingleRow("producto", "Count(*)", "Producto_sub_categoria_id = " + txtCodigo.Text + ""));
            if (recordCount > 0)
            {
                MessageBox.Show("No se puede borrar la sub categoria, tiene " + recordCount + " productos asociados.", "Borrar", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return(false);
            }
            else
            {
                return(true);
            }
        }
Ejemplo n.º 28
0
        private void CargarTurnoEstacion(int turnoId)
        {
            string  sqlCommand          = "SELECT turno_estacion.*, Estacion.Estacion_descripcion FROM Estacion INNER JOIN turno_estacion ON Estacion.Estacion_id = turno_estacion.Estacion_id WHERE turno_id = " + turnoId + " order by Linea";
            DataSet dsTurnoEstacionInfo = DataUtil.FillDataSet(sqlCommand, "turno_estacion");

            foreach (DataRow turnoEstacionRow in dsTurnoEstacionInfo.Tables["turno_estacion"].Rows)
            {
                string[] row = { DataUtil.GetString(turnoEstacionRow["Linea"]),
                                 DataUtil.GetString(turnoEstacionRow["Estacion_Descripcion"]),
                                 DataUtil.GetString(turnoEstacionRow["Fondo_inicial"]),
                                 DataUtil.GetString(turnoEstacionRow["Estacion_id"]) };
                dgwCuenta.Rows.Add(row);
                lineGrid = DataUtil.GetInt(turnoEstacionRow["Linea"]);
            }
        }
Ejemplo n.º 29
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show(@"Está seguro de abrir el turno?", @"Abrir", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (result == DialogResult.Yes)
            {
                if (IsReadyToSave())
                {
                    try
                    {
                        if (adding)
                        {
                            txtCodigo.Text = DataUtil.GetString(DataUtil.GetNewId(tableName));

                            sqlForExecute = "INSERT INTO " + tableName + " (" +
                                            formWhereField + "," +
                                            "Estado," +
                                            "Fondo_inicial_total," +
                                            "Venta_total," +
                                            "Fecha_apertura," +
                                            "Aperturado_por)" +
                                            " VALUES (" +
                                            txtCodigo.Text + "," +
                                            "'ABIERTO'," +
                                            "" + txtFondoInicialTotal.Text + "," +
                                            "'0.00'," +
                                            "'" + DateTime.Now + "'," +
                                            "'" + AppConstant.EmployeeInfo.Codigo + "'" +
                                            ")";
                        }

                        if (DataUtil.Update(sqlForExecute))
                        {
                            AgregarTurnoEstacion(DataUtil.GetInt(txtCodigo.Text));
                            if (adding)
                            {
                                this.Close();
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("Error en Grabar: " + ex.Message + "  " + sqlForExecute);
                    }
                }
            }
        }
Ejemplo n.º 30
0
        private bool CanInactivate()
        {
            bool result = false;

            if (DataUtil.GetString(cbEstado.SelectedItem) == AppConstant.RegistroEstado.Inactivo)
            {
                if (DataUtil.GetString(cbEstado.SelectedItem) != oldEstado)
                {
                    int recordCount = DataUtil.GetInt(DataUtil.FindSingleRow("producto_boton", "Count(*)", "producto_id = " + txtCodigo.Text + ""));
                    if (recordCount > 0)
                    {
                        result = true;
                    }
                }
            }
            return(result);
        }