Example #1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            var frmCustomerAdd = new frmCustomer();

            frmCustomerAdd.adding    = true;
            frmCustomerAdd.formTitle = "Cliente - Agregar";
            if (ExtraWhere != string.Empty)
            {
                frmCustomerAdd.CustomerRUC = true;
            }
            frmCustomerAdd.ShowDialog();
        }
Example #2
0
 private void btnEdit_Click(object sender, EventArgs e)
 {
     if (lblCodigoCliente.Text.Trim() != string.Empty)
     {
         var frmCustomerEdit = new frmCustomer();
         frmCustomerEdit.adding    = false;
         frmCustomerEdit.formTitle = "Cliente - Modificar";
         frmCustomerEdit.formId    = lblCodigoCliente.Text;
         frmCustomerEdit.ShowDialog();
         GetCustomerValues();
     }
     else
     {
         txtNumeroCliente.Focus();
         MessageBox.Show(@"Debe ingresar un cliente valido.", @"Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Example #3
0
 private void btnModify_Click(object sender, EventArgs e)
 {
     if (dgwResult.CurrentRow != null && ((dgwResult.Rows.Count > 0) && (dgwResult.CurrentRow.Cells[0].Value != null)))
     {
         // Obtener el ID seleccionado
         string valueId         = DataUtil.GetString(dgwResult.CurrentRow.Cells[0].Value);
         var    frmCustomerEdit = new frmCustomer();
         frmCustomerEdit.adding    = false;
         frmCustomerEdit.formTitle = "Cliente - Modificar";
         frmCustomerEdit.formId    = valueId;
         frmCustomerEdit.ShowDialog();
         SearchRecords();
     }
     else
     {
         MessageBox.Show(@"No se seleccionó ningún elemento, o no existen elementos a seleccionar!", @"Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }
Example #4
0
        private void ProceedOpen()
        {
            if ((dgwResult.Rows.Count > 0) && (dgwResult.CurrentRow.Cells[0].Value != null))
            {
                // Obtener el ID seleccionado
                string valueID = DataUtil.GetString(dgwResult.CurrentRow.Cells[0].Value);

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

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

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

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

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

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

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

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

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

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

                case "Presentacion_Insumo":
                    frmInsumoPresentacion frmInsumoPresentacionEdit = new frmInsumoPresentacion();
                    frmInsumoPresentacionEdit.adding    = false;
                    frmInsumoPresentacionEdit.formTitle = "Presentaciones de insumos - Modificar";
                    frmInsumoPresentacionEdit.formId    = valueID;
                    frmInsumoPresentacionEdit.ShowDialog();
                    break;
                }
                AfterSearch();
            }
            else
            {
                MessageBox.Show("No se seleccionó ningún elemento, o no existen elementos a seleccionar!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Example #5
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            switch (tableNameBrowser)
            {
            case "empleado":
                frmEmployee frmEmployeeAdd = new frmEmployee();
                frmEmployeeAdd.adding    = true;
                frmEmployeeAdd.formTitle = "Empleados - Agregar";
                frmEmployeeAdd.ShowDialog();
                break;

            case "cliente":
                frmCustomer frmCustomerAdd = new frmCustomer();
                frmCustomerAdd.adding    = true;
                frmCustomerAdd.formTitle = "Clientes - Agregar";
                frmCustomerAdd.ShowDialog();
                break;

            case "producto":
                frmProduct frmProductAdd = new frmProduct();
                frmProductAdd.adding    = true;
                frmProductAdd.formTitle = "Producto - Agregar";
                frmProductAdd.ShowDialog();
                break;

            case "producto_categoria":
                frmProductCategory frmProductCategoryAdd = new frmProductCategory();
                frmProductCategoryAdd.adding    = true;
                frmProductCategoryAdd.formTitle = "Producto Categoria - Agregar";
                frmProductCategoryAdd.ShowDialog();
                break;

            case "producto_sub_categoria":
                frmProductSubCategory frmProductSubCategoryAdd = new frmProductSubCategory();
                frmProductSubCategoryAdd.adding    = true;
                frmProductSubCategoryAdd.formTitle = "Producto Sub Categoria - Agregar";
                frmProductSubCategoryAdd.ShowDialog();
                break;

            case "proveedor":
                frmSupplier frmSupplierAdd = new frmSupplier();
                frmSupplierAdd.adding    = true;
                frmSupplierAdd.formTitle = "Proveedor - Agregar";
                frmSupplierAdd.ShowDialog();
                break;

            case "estacion":
                frmStation frmStationAdd = new frmStation();
                frmStationAdd.adding    = true;
                frmStationAdd.formTitle = "Estacion de Trabajo - Agregar";
                frmStationAdd.ShowDialog();
                break;

            case "turno":
                frmTurn frmTurnAdd = new frmTurn();
                frmTurnAdd.adding    = true;
                frmTurnAdd.formTitle = "Turno - Agregar";
                frmTurnAdd.ShowDialog();
                break;

            case "Insumo_grupo_clasificacion":
                frmInsumoGroupClassification frmInsumoGroupClassificationAdd = new frmInsumoGroupClassification();
                frmInsumoGroupClassificationAdd.adding    = true;
                frmInsumoGroupClassificationAdd.formTitle = "Clasificación de grupos de insumos - Agregar";
                frmInsumoGroupClassificationAdd.ShowDialog();
                break;

            case "Insumo_grupo":
                frmInsumoGroup frmInsumoGroupAdd = new frmInsumoGroup();
                frmInsumoGroupAdd.adding    = true;
                frmInsumoGroupAdd.formTitle = "Grupos de insumos - Agregar";
                frmInsumoGroupAdd.ShowDialog();
                break;

            case "Presentacion_Insumo":
                frmInsumoPresentacion frmInsumoPresentacionAdd = new frmInsumoPresentacion();
                frmInsumoPresentacionAdd.adding    = true;
                frmInsumoPresentacionAdd.formTitle = "Presentaciones de insumos - Agregar";
                frmInsumoPresentacionAdd.ShowDialog();
                break;
            }
            BindDataGrid();
        }
Example #6
0
        private void txtCliente_Leave(object sender, EventArgs e)
        {
            lblCodigoCliente.Text = string.Empty;
            lblNombreCliente.Text = string.Empty;
            txtDireccion.Text     = string.Empty;

            if (txtNumeroCliente.Text != string.Empty)
            {
                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.Telefono_casa like '%" + txtNumeroCliente.Text.Trim() + "%' ORDER BY c.cliente_apellidos", "cliente");
                if (dsSearch.Tables[0].Rows.Count == 1)
                {
                    txtNumeroCliente.Text = DataUtil.GetString(dsSearch.Tables[0].Rows[0], "Telefono fijo");
                    lblCodigoCliente.Text = DataUtil.GetString(dsSearch.Tables[0].Rows[0], "Codigo");
                    lblNombreCliente.Text = DataUtil.GetString(dsSearch.Tables[0].Rows[0], "Cliente");
                    txtDireccion.Text     = DataUtil.GetString(dsSearch.Tables[0].Rows[0], "Direccion");
                }
                else if (dsSearch.Tables[0].Rows.Count > 1)
                {
                    var frmCustomerSearchForm = new frmCustomerSearch();
                    frmCustomerSearchForm.NumberoTelefonoSearch = txtNumeroCliente.Text;
                    frmCustomerSearchForm.DsSearchCliente       = dsSearch;
                    frmCustomerSearchForm.ShowDialog();
                    SetCustomerValues();
                }
                else
                {
                    DialogResult result = MessageBox.Show(@"No existe el cliente. Desea crear el cliente?", @"Cliente", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    if (result == DialogResult.Yes)
                    {
                        var frmCustomerAdd = new frmCustomer();
                        frmCustomerAdd.adding                = true;
                        frmCustomerAdd.CreateSpecial         = true;
                        frmCustomerAdd.ClienteNumeroTelefono = txtNumeroCliente.Text.Trim();
                        frmCustomerAdd.formTitle             = "Cliente - Agregar";
                        frmCustomerAdd.ShowDialog();
                        SetCustomerValues();
                    }
                    else
                    {
                        txtNumeroCliente.Text = string.Empty;
                        txtNumeroCliente.Focus();
                    }
                }
            }
        }