private void GenerarReporteMes()
 {
     try
     {
         DataTable datos = Cache.ReporteF_Mes((cmbMes.SelectedIndex + 1).ToString(), txbAnio.Text.ToString());
         int       filas = datos.Rows.Count;
         if (filas > 0)
         {
             ReporteMes reporte = new ReporteMes();
             reporte.SetDataSource(datos);
             reporte.SetParameterValue("pOpcionReporte", "REPORTE DE VENTAS PARA EL MES DE " + cmbMes.SelectedItem.ToString().ToUpper() + ", AÑO " + txbAnio.Text.ToString());
             reporte.SetParameterValue("pEmpleado", _Sesion.Informacion.Empleado);
             reporte.SetParameterValue("pFecha", DateTime.Now);
             reporte.SetParameterValue("pTotalDias", filas.ToString());
             crvFacturaDetalle.ReportSource = reporte;
         }
         else
         {
             MessageBox.Show("Datos no encontrados !", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
     }
     catch (Exception e)
     {
         MessageBox.Show("Excepcion reporte: " + e.ToString(), "Excepcion", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Exemple #2
0
        public async Task <IActionResult> Crear([FromBody] ReporteViewModel model)
        {
            try
            {
                foreach (var det in model.registros)
                {
                    var imp = _context.ReportesMes
                              .Include(i => i.impresora)
                              .FirstOrDefault(i => i.impresoraidimpresora == det.impresora.idimpresora && i.month == (det.month - 1) && i.year == det.year);

                    if (imp == null)
                    {
                        return(NotFound());
                    }

                    ReporteMes reporte = new ReporteMes
                    {
                        idreporte            = det.idreporte,
                        contador109          = det.contador109,
                        contador124          = det.contador124,
                        contador102          = det.contador102,
                        vpbyn                = det.contador109 - imp.contador109,
                        vpcolor              = det.contador124 - imp.contador124,
                        year                 = det.year,
                        month                = det.month,
                        impresoraidimpresora = det.impresora.idimpresora
                    };
                    _context.ReportesMes.Add(reporte);
                }
                await _context.SaveChangesAsync();
            }
            catch (Exception ex)
            {
                return(BadRequest(ex));
            }

            return(Ok());
        }