예제 #1
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);
            }
        }
예제 #2
0
 private void NewProduct()
 {
     if (createSpecial)
     {
         txtDescripcion.Text = productoNombre;
         if (tipo_quickButton != string.Empty)
         {
             cbTipoProducto.SelectedItem = tipo_quickButton;
             cbTipoProducto.Enabled      = false;
         }
         if (categoria_quickButton != string.Empty)
         {
             string sWhere = "producto_categoria_id = " + categoria_quickButton + "";
             cbCategoria.SelectedItem = DataUtil.FindSingleRow("producto_categoria", "Producto_categoria_descripcion", sWhere);
             cbCategoria.Enabled      = false;
         }
         if (subcategoria_quickButton != string.Empty)
         {
             string sWhere = "producto_sub_categoria_id = " + subcategoria_quickButton + "";
             cbSubCategoria.SelectedItem = DataUtil.FindSingleRow("producto_sub_categoria", "Producto_sub_categoria_descripcion", sWhere);
             cbSubCategoria.Enabled      = false;
             btnAddCategoria.Visible     = false;
         }
     }
     else
     {
         cbTipoProducto.SelectedIndex = 0;
     }
     lblRUC.Text           = string.Empty;
     lblTelefono.Text      = string.Empty;
     lblVendor.Text        = string.Empty;
     cbEstado.SelectedItem = AppConstant.RegistroEstado.Activo;
     tcProducto.TabPages.Remove(tpReceta);
     tcProducto.TabPages.Remove(tpPaquete);
 }
예제 #3
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;
            }
        }
예제 #4
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);
            }
        }
예제 #5
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);
                }
            }
        }
예제 #6
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);
        }
예제 #7
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;
            }
        }
예제 #8
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);
        }
예제 #9
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);
 }
예제 #10
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);
 }
예제 #11
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);
 }
예제 #12
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);
            }
        }
예제 #13
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);
 }
예제 #14
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);
 }
예제 #15
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);
            }
        }
예제 #16
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);
            }
        }
예제 #17
0
 private void btnNewOrder_Click(object sender, EventArgs e)
 {
     btnViewOrder.Visible   = true;
     btnNewOrder.Visible    = false;
     btnCreateOrder.Visible = true;
     btnReprint.Visible     = false;
     dgwCuenta.Rows.Clear();
     if (pedidoID != 0)
     {
         string sWhere = "pedido_id = " + DataUtil.GetString(pedidoID) + "";
         lineGrid = DataUtil.GetInt(DataUtil.FindSingleRow("pedido", "last_line", sWhere));
     }
     else
     {
         lineGrid = 0;
     }
 }
예제 #18
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);
        }
예제 #19
0
        protected override bool ExistRecord()
        {
            int recordCount = 0;

            recordCount = DataUtil.GetInt(DataUtil.FindSingleRow("Venta_detalle", "Count(*)", "codigo_producto = " + txtCodigo.Text + ""));
            recordCount = recordCount + DataUtil.GetInt(DataUtil.FindSingleRow("pedido_detalle", "Count(*)", "codigo_producto = " + txtCodigo.Text + ""));
            recordCount = recordCount + DataUtil.GetInt(DataUtil.FindSingleRow("producto_boton", "Count(*)", "producto_id = " + txtCodigo.Text + ""));
            if (recordCount > 0)
            {
                MessageBox.Show("No se puede borrar el producto esta asociado a un boton del menu o tiene ordenes asociadas.", "Borrar", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return(false);
            }
            else
            {
                return(true);
            }
        }
예제 #20
0
        private void BindDataFields()
        {
            DataUtil.FillComboBoxValues(cbCajero.Items, "SELECT Apellidos_empleado + ', ' + Nombres_empleado AS Nombre, Codigo_empleado FROM empleado WHERE Cargo = 'CAJERO' ORDER BY Apellidos_empleado", null);

            mainDataSet = DataUtil.FillDataSet(DataBaseQuerys.FillMainDataSet(tableName, formWhereField, formId, string.Empty), tableName);
            if (mainDataSet.Tables[0].Rows.Count > 0)
            {
                txtCodigo.Text        = DataUtil.GetString(mainDataSet.Tables[0].Rows[0], formWhereField);
                txtDescripcion.Text   = DataUtil.GetString(mainDataSet.Tables[0].Rows[0], "Estacion_descripcion");
                cbEstado.SelectedItem = oldEstado = DataUtil.GetString(mainDataSet.Tables[0].Rows[0], "estado");

                var sWhere = "Codigo_empleado = " + DataUtil.GetString(mainDataSet.Tables[0].Rows[0], "Persona_asignada") + "";
                cbCajero.Text = DataUtil.FindSingleRow("empleado", "Apellidos_empleado + ', ' + Nombres_empleado AS Nombre", sWhere);
            }
            else
            {
                cbEstado.SelectedItem = AppConstant.RegistroEstado.Activo;
            }
        }
예제 #21
0
        private void BindDataFields()
        {
            DataUtil.FillComboBox(cbCategoria.Items, DataBaseQuerys.ProductoCategoriaActivos(false), null);
            mainDataSet = DataUtil.FillDataSet(DataBaseQuerys.FillMainDataSet(tableName, formWhereField, formId, string.Empty), tableName);

            if (mainDataSet.Tables[0].Rows.Count > 0)
            {
                txtCodigo.Text        = DataUtil.GetString(mainDataSet.Tables[0].Rows[0], formWhereField);
                txtDescripcion.Text   = DataUtil.GetString(mainDataSet.Tables[0].Rows[0], "Producto_sub_categoria_descripcion");
                cbEstado.SelectedItem = DataUtil.GetString(mainDataSet.Tables[0].Rows[0], "estado");

                string sWhere = "producto_categoria_id = " + DataUtil.GetString(mainDataSet.Tables[0].Rows[0], "producto_categoria_id") + "";
                cbCategoria.SelectedItem = DataUtil.FindSingleRow("producto_categoria", "Producto_categoria_descripcion", sWhere);
            }
            else
            {
                cbEstado.SelectedItem = AppConstant.RegistroEstado.Activo;
            }
        }
예제 #22
0
        protected override void DeleteData()
        {
            DialogResult result = MessageBox.Show(@"Está seguro de cerrar el turno actual?", @"Cerrar", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (result == DialogResult.Yes)
            {
                int ordenesAbiertas = DataUtil.GetInt(DataUtil.FindSingleRow("pedido", "Count(*)", "Estado = 'A' AND turno_id = " + txtCodigo.Text + ""));
                if (ordenesAbiertas > 0)
                {
                    MessageBox.Show(@"No se puede cerrar el turno tiene " + ordenesAbiertas + @" Ordenes pendientes de pago.", @"Ordenes Abiertas", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    frmCloseTurn frmCloseTurnForm = new frmCloseTurn();
                    frmCloseTurnForm.ShowDialog();
                    if (AppConstant.Turno.Codigo.Equals(string.Empty))
                    {
                        this.Close();
                    }
                }
            }
        }
예제 #23
0
        private bool VerificarDuplicados()
        {
            if (txtDocumento.Text != string.Empty)
            {
                string sWhere = "Proveedor_ruc = '" + txtDocumento.Text + "'";
                if (DataUtil.GetInt(DataUtil.FindSingleRow(tableName, "Count(*)", sWhere)) > 0)
                {
                    MessageBox.Show(@"El documento ya existe.", @"Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return(false);
                }
            }

            if (txtNombre.Text != string.Empty)
            {
                string sWhere = "Proveedor_nombre = '" + txtNombre.Text + "'";
                if (DataUtil.GetInt(DataUtil.FindSingleRow(tableName, "Count(*)", sWhere)) > 0)
                {
                    MessageBox.Show(@"La Razon Social ya existe.", @"Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return(false);
                }
            }
            return(true);
        }
예제 #24
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            if (radmccbTurno.Text == string.Empty)
            {
                MessageBox.Show(@"Debe seleccionar un turno.", @"Informacion", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                var waiting = new ShowWaitingBox("Procesando...", "Procesando informacion por favor espere..");
                waiting.Start();
                btnSearch.Enabled = false;
                btnClose.Enabled  = false;
                btnVerProductosVendidos.Enabled = false;
                IniValues();
                switch (DataUtil.GetString(cbTipoVentas.SelectedItem))
                {
                case "TODAS":
                    Venta();
                    PorCobrar();
                    break;

                case "POR COBRAR":
                    PorCobrar();
                    break;

                case "COBRADAS":
                    Venta();
                    break;
                }
                txtOrdenesAbiertas.Text         = DataUtil.FindSingleRow("pedido", "Count(*)", "Estado = 'A'" + BuildWherePedido());
                txtOrdenesPagadas.Text          = DataUtil.FindSingleRow("pedido", "Count(*)", "Estado = 'F'" + BuildWherePedido());
                btnSearch.Enabled               = true;
                btnVerProductosVendidos.Enabled = true;
                btnClose.Enabled = true;
                waiting.Stop();
            }
        }
예제 #25
0
 private bool VerificarDuplicados()
 {
     if (txtDocumento.Text != string.Empty)
     {
         string sWhere = "Documento = '" + txtDocumento.Text + "'";
         if (DataUtil.GetInt(DataUtil.FindSingleRow(tableName, "Count(*)", sWhere)) > 0)
         {
             MessageBox.Show("El documento ya existe.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
             return(false);
         }
     }
     if (cbTipo.SelectedItem.Equals("RUC"))
     {
         if (txtApellidos.Text != string.Empty)
         {
             string sWhere = "Cliente_apellidos = '" + txtApellidos.Text.Replace("'", "''") + "'";
             if (DataUtil.GetInt(DataUtil.FindSingleRow(tableName, "Count(*)", sWhere)) > 0)
             {
                 MessageBox.Show("La Razon Social ya existe.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 return(false);
             }
         }
     }
     else
     {
         if (txtApellidos.Text != string.Empty && txtNombres.Text != string.Empty)
         {
             string sWhere = "Cliente_apellidos = '" + txtApellidos.Text.Replace("'", "''") + "' AND Cliente_nombres = '" + txtNombres.Text.Replace("'", "''") + "'";
             if (DataUtil.GetInt(DataUtil.FindSingleRow(tableName, "Count(*)", sWhere)) > 0)
             {
                 MessageBox.Show("Los Applidos y Nombres ya existe.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 return(false);
             }
         }
     }
     return(true);
 }
예제 #26
0
        private void frmProductSearch_Load(object sender, EventArgs e)
        {
            btnAdd.Visible    = DataBaseQuerys.GetAccess(13, AppConstant.EmployeeInfo.Codigo, AppConstant.AccessoTipos.Nuevo);
            btnModify.Visible = DataBaseQuerys.GetAccess(13, AppConstant.EmployeeInfo.Codigo, AppConstant.AccessoTipos.Edicion);

            DataUtil.FillComboBox(cbCategoria.Items, DataBaseQuerys.ProductoCategoriaActivos(false), string.Empty);
            DataUtil.FillComboBox(cbSubCategoria.Items, DataBaseQuerys.ProductoSubCategoriaActivos(false, string.Empty), string.Empty);
            lblNo.Text = @"0";
            if (dsSearchProd != null)
            {
                cbCategoria.SelectedItem    = string.Empty;
                cbSubCategoria.SelectedItem = string.Empty;
                cbTipo.SelectedItem         = string.Empty;
                txtDescripcion.Text         = descriptionSearch;
                dgwResult.DataSource        = dsSearchProd;
                dgwResult.DataMember        = "producto";
                dgwResult.Columns[1].Width  = 300;
                lblNo.Text = DataUtil.GetString(dsSearchProd.Tables[0].Rows.Count);

                if (tipoSearch != string.Empty)
                {
                    cbTipo.SelectedItem = tipoSearch;
                    cbTipo.Enabled      = false;
                    btnClean.Visible    = false;
                }
                if (categoriaIdSearch != string.Empty)
                {
                    string sWhere = "producto_categoria_id = " + categoriaIdSearch + "";
                    cbCategoria.SelectedItem = DataUtil.FindSingleRow("producto_categoria", "Producto_categoria_descripcion", sWhere);
                    sWhere = "producto_sub_categoria_id = " + subCategoriaIdSearch + "";
                    cbSubCategoria.SelectedItem = DataUtil.FindSingleRow("producto_sub_categoria", "Producto_sub_categoria_descripcion", sWhere);
                    cbCategoria.Enabled         = false;
                    cbSubCategoria.Enabled      = false;
                    btnClean.Visible            = false;
                }
            }
        }
예제 #27
0
 private void btnAddProduct_Click(object sender, EventArgs e)
 {
     if (btnCreateOrder.Visible == true)
     {
         var frmTakeOrderForm = new frmTakeOrder();
         frmTakeOrderForm.ShowDialog();
         if (DataUtil.dgvTemporal != null)
         {
             foreach (DataGridViewRow row in DataUtil.dgvTemporal.Rows)
             {
                 txtCodigoProducto.Text = DataUtil.GetString(row.Cells[gridProdCodigo].Value);
                 txtProducto.Text       = DataUtil.FindSingleRow("producto", "Producto_descripcion", "Producto_id = " + DataUtil.GetString(row.Cells[gridProdCodigo].Value) + "");
                 txtPrecioUnitario.Text = DataUtil.FindSingleRow("producto", "Precio_final", "Producto_id = " + DataUtil.GetString(row.Cells[gridProdCodigo].Value) + "");
                 txtCantidad.Text       = DataUtil.GetString(row.Cells[gridCantidad].Value);
                 btnAdd_Click(null, null);
             }
             DataUtil.dgvTemporal = null;
         }
     }
     else
     {
         MessageBox.Show(@"Debe crear una nueva orden.", @"Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
예제 #28
0
 private bool VerificarDuplicados()
 {
     if (txtDescripcion.Text != string.Empty)
     {
         string sWhere = "Boton_descripcion = '" + txtDescripcion.Text.Replace("'", "''") + "' AND Producto_sub_categoria_id = " + subCategoriaId + "";
         if (DataUtil.GetInt(DataUtil.FindSingleRow(tableName, "Count(*)", sWhere)) > 0)
         {
             MessageBox.Show("El boton ya existe.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
             txtProducto.Focus();
             return(false);
         }
     }
     if (txtCodigo.Text != string.Empty)
     {
         string sWhere = "producto_id = " + txtCodigo.Text + "";
         if (DataUtil.GetInt(DataUtil.FindSingleRow(tableName, "Count(*)", sWhere)) > 0)
         {
             MessageBox.Show("El producto ya fue asignado.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
             txtProducto.Focus();
             return(false);
         }
     }
     return(true);
 }
예제 #29
0
        private void btnCambiarMesa_Click(object sender, EventArgs e)
        {
            if (pedidoID != 0)
            {
                frmChangeTable frmChangeTableForm = new frmChangeTable();
                frmChangeTableForm.mesa     = mesaID;
                frmChangeTableForm.pedidoID = DataUtil.GetString(pedidoID);
                frmChangeTableForm.ShowDialog();

                string sWhere    = "pedido_id = " + DataUtil.GetString(pedidoID) + "";
                string newMesaId = DataUtil.FindSingleRow("pedido", "mesa_id", sWhere);
                tipoVenta = DataUtil.FindSingleRow("pedido", "Tipo_venta", sWhere);
                if (newMesaId != mesaID)
                {
                    lblTipoOrden.Text = tipoVenta;
                    mesaID            = newMesaId;
                    GetMesaInfo();
                }
            }
            else
            {
                MessageBox.Show(@"Debe agregar una Orden.", @"Informacion", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
예제 #30
0
 private void btnNotaVenta_Click(object sender, EventArgs e)
 {
     if (pedidoID != 0)
     {
         DialogResult result = MessageBox.Show(@"Desea generar una nota de venta con esta orden?", @"Nota Venta", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
         if (result == DialogResult.Yes)
         {
             var frmCustomerOrderSaleNoteForm = new frmCustomerOrderSaleNote();
             frmCustomerOrderSaleNoteForm.mesaID   = DataUtil.GetInt(mesaID);
             frmCustomerOrderSaleNoteForm.pedidoID = pedidoID;
             frmCustomerOrderSaleNoteForm.ShowDialog();
             string sWhere    = "pedido_id = " + DataUtil.GetString(pedidoID) + "";
             string newEstado = DataUtil.GetString(DataUtil.FindSingleRow("pedido", "Estado", sWhere));
             if (newEstado.Equals("N"))
             {
                 this.Close();
             }
         }
     }
     else
     {
         MessageBox.Show(@"Debe agregar una Orden.", @"Informacion", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }