Example #1
0
 private void LLenarGridComisionXEmpleado()
 {
     try
     {
         if (!string.IsNullOrEmpty(this.txtNumFactura.Text.Trim()))
         {
             Comision Datos = new Comision {
                 Conexion = Comun.Conexion, NombreEmpleado = this.txtNumFactura.Text.Trim()
             };
             Comision_Negocio CN        = new Comision_Negocio();
             List <Comision>  Lista     = CN.ObtenerComisionesXEmpleado(Datos);
             BindingSource    DatosGrid = new BindingSource();
             DatosGrid.DataSource = Lista;
             this.dgvReglasEmpleado.AutoGenerateColumns = false;
             this.dgvReglasEmpleado.DataSource          = DatosGrid;
         }
         else
         {
             MessageBox.Show("Ingrese un nombre. ", Comun.Sistema, MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 private void CargarGridComisiones()
 {
     try
     {
         Sucursal DatosSuc = this.ObtenerSucursalCombo();
         if (this.dtpFechaInicio.Value <= this.dtpFechaFin.Value && !string.IsNullOrEmpty(DatosSuc.IDSucursal))
         {
             Comision Datos = new Comision {
                 FechaInicio = this.dtpFechaInicio.Value, FechaFin = this.dtpFechaFin.Value, Conexion = Comun.Conexion, IDSucursal = DatosSuc.IDSucursal
             };
             Comision_Negocio CN = new Comision_Negocio();
             CN.ObtenerComisionesXRango(Datos);
             this.dgvComisionesXEmpleado.AutoGenerateColumns = false;
             this.dgvComisionesXEmpleado.DataSource          = Datos.TablaDatos;
         }
         else
         {
             this.dgvComisionesXEmpleado.DataSource = new DataTable();
         }
         FechaInicio = this.dtpFechaInicio.Value;
         FechaFin    = this.dtpFechaFin.Value;
         IDSucursal  = DatosSuc.IDSucursal;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #3
0
 private void LLenarGridComisionXIDCategoria()
 {
     try
     {
         CategoriasPuesto Aux = this.ObtenerCategoriaSeleccionada();
         //if (!string.IsNullOrEmpty(Aux.IDCategoria))
         //{
         Comision Datos = new Comision {
             Conexion = Comun.Conexion, IDCategoria = Aux.IDCategoria
         };
         Comision_Negocio CN        = new Comision_Negocio();
         List <Comision>  Lista     = CN.ObtenerComisionesXIDCategoria(Datos);
         BindingSource    DatosGrid = new BindingSource();
         DatosGrid.DataSource = Lista;
         this.dgvReglasCategoria.AutoGenerateColumns = false;
         this.dgvReglasCategoria.DataSource          = DatosGrid;
         //}
         //else
         //{
         //    MessageBox.Show("Debe seleccionar una categoría. ", Comun.Sistema, MessageBoxButtons.OK, MessageBoxIcon.Warning);
         //}
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 private void btnGuardar_Click(object sender, EventArgs e)
 {
     try
     {
         this.txtMensajeError.Visible = false;
         List <Error> Errores = this.ValidarDatos();
         if (Errores.Count == 0)
         {
             Comision         Datos = this.ObtenerDatos();
             Comision_Negocio CN    = new Comision_Negocio();
             CN.AResumenComision(Datos);
             if (Datos.Completado)
             {
                 this.DialogResult = DialogResult.OK;
             }
             else
             {
                 MessageBox.Show("Ocurrió un error. Intente nuevamente. Si el problema persiste, contacte a Soporte Técnico. Código del Error: " + Datos.Resultado, Comun.Sistema, MessageBoxButtons.OK, MessageBoxIcon.Warning);
             }
         }
         else
         {
             this.MostrarMensajeError(Errores);
         }
     }
     catch (Exception ex)
     {
         LogError.AddExcFileTxt(ex, "frmNuevoResumenComision ~ btnGuardar_Click");
         MessageBox.Show(Comun.MensajeError, Comun.Sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Example #5
0
 private void btnEliminar_Click(object sender, EventArgs e)
 {
     try
     {
         int Row = -1;
         if (this.tcCompras.SelectedIndex == 0)
         {
             if (this.dgvReglasCategoria.SelectedRows.Count == 1)
             {
                 Row = this.dgvReglasCategoria.Rows.GetFirstRow(DataGridViewElementStates.Selected);
             }
         }
         else
         {
             if (this.dgvReglasEmpleado.SelectedRows.Count == 1)
             {
                 Row = this.dgvReglasEmpleado.Rows.GetFirstRow(DataGridViewElementStates.Selected);
             }
         }
         if (Row != -1)
         {
             DialogResult Resultado;
             if (this.tcCompras.SelectedIndex == 0)
             {
                 Resultado = MessageBox.Show("¿Está seguro de eliminar la regla?", Comun.Sistema, MessageBoxButtons.YesNo, MessageBoxIcon.Question);
             }
             else
             {
                 Resultado = MessageBox.Show("¿Está seguro de eliminar la regla? Tenga en cuenta que la regla no le pertenece al empleado.", Comun.Sistema, MessageBoxButtons.YesNo, MessageBoxIcon.Question);
             }
             if (Resultado == DialogResult.Yes)
             {
                 Comision Datos = this.ObtenerDatosGridCategoria(Row);
                 Datos.Conexion  = Comun.Conexion;
                 Datos.IDUsuario = Comun.IDUsuario;
                 Comision_Negocio CN = new Comision_Negocio();
                 CN.EliminarReglasComision(Datos);
                 if (Datos.Completado)
                 {
                     MessageBox.Show("Datos guardados correctamente.", Comun.Sistema, MessageBoxButtons.OK, MessageBoxIcon.Information);
                     this.IniciarDatosBusqueda();
                 }
                 else
                 {
                     MessageBox.Show(Comun.MensajeError, Comun.Sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
                 }
             }
         }
         else
         {
             MessageBox.Show("Seleccione un registro.", Comun.Sistema, MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
     }
     catch (Exception ex)
     {
         LogError.AddExcFileTxt(ex, "frmReglasComisiones ~ btnCancelar_Click");
         MessageBox.Show(Comun.MensajeError, Comun.Sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
        private void GenerarReporteComisiones()
        {
            try
            {
                reportViewer1.SetDisplayMode(DisplayMode.PrintLayout);
                reportViewer1.ZoomMode    = ZoomMode.Percent;
                reportViewer1.ZoomPercent = 100;
                reportViewer1.LocalReport.DataSources.Clear();
                Comision Datos = new Comision {
                    IDResumenComision = this.ID, Conexion = Comun.Conexion
                };
                Comision_Negocio CN = new Comision_Negocio();
                CN.ObtenerReporteComisiones(Datos);
                if (Datos.Completado)
                {
                    List <Comision> Lista01 = Datos.ListaComisiones;
                    List <Comision> Lista02 = Datos.ListaTiposComision;
                    reportViewer1.LocalReport.EnableExternalImages = true;
                    ReportParameter[] Parametros = new ReportParameter[8];
                    Parametros[0] = new ReportParameter("Empresa", Comun.NombreComercial);
                    Parametros[1] = new ReportParameter("Eslogan", Comun.Eslogan);
                    if (File.Exists(@"Resources\Documents\" + Comun.UrlLogo.ToLower()))
                    {
                        string Aux = new Uri(Path.Combine(System.Windows.Forms.Application.StartupPath, @"Resources\Documents\" + Comun.UrlLogo.ToLower())).AbsoluteUri;
                        Parametros[2] = new ReportParameter("UrlLogo", new Uri(Path.Combine(System.Windows.Forms.Application.StartupPath, @"Resources\Documents\" + Comun.UrlLogo.ToLower())).AbsoluteUri);
                    }
                    else
                    {
                        Parametros[2] = new ReportParameter("UrlLogo", new Uri(Path.Combine(System.Windows.Forms.Application.StartupPath, @"Resources\Documents\Default.jpg")).AbsoluteUri);
                    }
                    Parametros[3] = new ReportParameter("Direccion", Comun.DomicilioFiscal);
                    Parametros[4] = new ReportParameter("TituloReporte", "HOJA DE COMISIONES SEMANALES");
                    Parametros[5] = new ReportParameter("FechaInicio", Datos.FechaInicio.ToShortDateString());
                    Parametros[6] = new ReportParameter("FechaFin", Datos.FechaFin.ToShortDateString());
                    Parametros[7] = new ReportParameter("Sucursal", Datos.IDSucursal);

                    this.reportViewer1.LocalReport.ReportEmbeddedResource = "StephManager.Informes.HojaComisiones.rdlc";
                    reportViewer1.LocalReport.SetParameters(Parametros);
                    reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("Comisiones", Lista01));
                    reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("TiposComisiones", Lista02));
                    this.reportViewer1.RefreshReport();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #7
0
 private void LlenarComboCatTipoComision()
 {
     try
     {
         Comision DatosAux = new Comision {
             Conexion = Comun.Conexion, IncluirSelect = true
         };
         Comision_Negocio CN = new Comision_Negocio();
         this.cmbTipoComision.DataSource    = CN.ObtenerComboTipoComision(DatosAux);
         this.cmbTipoComision.DisplayMember = "TipoComisionDesc";
         this.cmbTipoComision.ValueMember   = "IDTipoComision";
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 private void CargarGridResumenComisionesBusq()
 {
     try
     {
         Comision Datos = new Comision {
             BuscarTodos = false, Conexion = Comun.Conexion, Folio = this.txtBusqueda.Text.Trim()
         };
         Comision_Negocio CN = new Comision_Negocio();
         CN.ObtenerResumenComisionesBusq(Datos);
         this.dgvComisiones.AutoGenerateColumns = false;
         this.dgvComisiones.DataSource          = Datos.TablaDatos;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #9
0
 private void btnGuardar_Click(object sender, EventArgs e)
 {
     try
     {
         List <Error> Errores = this.ValidarDatos();
         if (Errores.Count == 0)
         {
             Comision         Datos = this.ObtenerDatos();
             Comision_Negocio UN    = new Comision_Negocio();
             UN.ACReglasComision(Datos);
             if (Datos.Completado)
             {
                 MessageBox.Show("Datos guardados correctamente.", Comun.Sistema, MessageBoxButtons.OK, MessageBoxIcon.Information);
                 this.DialogResult = DialogResult.OK;
             }
             else
             {
                 if (Datos.Resultado == 0)
                 {
                     MessageBox.Show("La regla de comisiones ya existe", Comun.Sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
                 }
                 else
                 {
                     MessageBox.Show(Comun.MensajeError, Comun.Sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
                 }
             }
         }
         else
         {
             this.MostrarMensajeError(Errores);
         }
     }
     catch (Exception ex)
     {
         LogError.AddExcFileTxt(ex, "frmNuevaReglaComision ~ btnGuardar_Click");
         MessageBox.Show(Comun.MensajeError, Comun.Sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }