private void FormatReport(ExpensesReportRpt rpt, ReportFilter filter, ReportFormat format)
        {
            switch (format.Vista)
            {
            case EReportVista.Agrupado:
            {
                rpt.HeaderListado.SectionFormat.EnableSuppress = true;
                rpt.DetailListado.SectionFormat.EnableSuppress = true;
            }
            break;

            case EReportVista.ListaCompleta:
            {
                rpt.HeaderExpediente.SectionFormat.EnableSuppress      = true;
                rpt.HeaderGrupoExpediente.SectionFormat.EnableSuppress = true;
                rpt.DetailExpediente.SectionFormat.EnableSuppress      = true;
                rpt.FooterExpediente.SectionFormat.EnableSuppress      = true;
            }
            break;
            }
        }
        protected override void PrintAction()
        {
            PgMng.Reset(4, 1, Face.Resources.Messages.RETRIEVING_DATA, this);

            if (Seleccion_RB.Checked && (_expediente == null))
            {
                return;
            }
            if (Rango_RB.Checked && ((_expediente_ini == null) || (_expediente_fin == null)))
            {
                return;
            }

            Library.Store.QueryConditions conditions = new Library.Store.QueryConditions
            {
                Expedient      = Seleccion_RB.Checked ? _expediente : null,
                TipoExpediente = TodosExpediente_RB.Checked ? (moleQule.Store.Structs.ETipoExpediente)(long) TipoExpediente_CB.SelectedValue : moleQule.Store.Structs.ETipoExpediente.Todos,
                FechaIni       = FInicial_DTP.Checked ? FInicial_DTP.Value : DateTime.MinValue,
                FechaFin       = FFinal_DTP.Checked ? FFinal_DTP.Value : DateTime.MaxValue,
                CategoriaGasto = ECategoriaGasto.Expediente,
                TipoAcreedor   = new ETipoAcreedor[1] {
                    (ETipoAcreedor)(long)TipoAcreedor_CB.SelectedValue
                },
            };

            ExpedientInfo expediente_ini = Rango_RB.Checked ? _expediente_ini : null;
            ExpedientInfo expediente_fin = Rango_RB.Checked ? _expediente_fin : null;

            _filter.SoloIncompletos = Incompletos_CkB.Checked;

            ReportFormat format = new ReportFormat();

            if (Agrupado_RB.Checked)
            {
                format.Vista = EReportVista.Agrupado;
            }
            else if (Lista_RB.Checked)
            {
                format.Vista = EReportVista.ListaCompleta;
            }
            else if (Resumido_RB.Checked)
            {
                format.Vista = EReportVista.Resumido;
            }

            string filtro = GetFilterValues();

            PgMng.Grow();

            ExpenseList           gastos      = null;
            ExpedienteList        expedientes = null;
            InputDeliveryLineList conceptos   = null;

            if (TodosExpediente_RB.Checked)
            {
                if (format.Vista == EReportVista.Resumido)
                {
                    gastos = ExpenseList.GetByFacturaExpedienteList(conditions, null, null);
                }
                else
                {
                    gastos = ExpenseList.GetList(conditions, null, null);
                }
                expedientes = ExpedienteList.GetList(conditions, null, null);
                conceptos   = InputDeliveryLineList.GetByExpedienteList(conditions, null, null);
            }
            else if (Seleccion_RB.Checked)
            {
                if (format.Vista == EReportVista.Resumido)
                {
                    gastos = ExpenseList.GetByFacturaExpedienteList(conditions, null, null);
                }
                else
                {
                    gastos = ExpenseList.GetList(conditions, null, null);
                }
                expedientes = ExpedienteList.GetList(conditions, null, null);
                conceptos   = InputDeliveryLineList.GetByExpedienteList(conditions, null, null);
            }
            else if (Rango_RB.Checked)
            {
                if (format.Vista == EReportVista.Resumido)
                {
                    gastos = ExpenseList.GetByFacturaExpedienteList(conditions, expediente_ini, expediente_fin);
                }
                else
                {
                    gastos = ExpenseList.GetList(conditions, expediente_ini, expediente_fin);
                }
                expedientes = ExpedienteList.GetList(conditions, expediente_ini, expediente_fin);
                conceptos   = InputDeliveryLineList.GetByExpedienteList(conditions, expediente_ini, expediente_fin);
            }

            PgMng.Grow(Face.Resources.Messages.BUILDING_REPORT);

            ExpenseReportMng reportMng = new ExpenseReportMng(AppContext.ActiveSchema, this.Text, filtro);

            if (format.Vista == EReportVista.Resumido)
            {
                ExpensesReportVerticalRpt rpt = reportMng.GetInformeGastoVerticalListReport(gastos, expedientes, _filter, conceptos);
                PgMng.FillUp();

                ShowReport(rpt);
            }
            else
            {
                ExpensesReportRpt rpt = reportMng.GetInformeGastoListReport(gastos, expedientes, _filter, format);
                PgMng.FillUp();

                ShowReport(rpt);
            }

            _action_result = DialogResult.Ignore;
        }
        public ExpensesReportRpt GetInformeGastoListReport(ExpenseList list,
                                                           ExpedienteList expedients,
                                                           ReportFilter filter,
                                                           ReportFormat format)
        {
            if (list == null)
            {
                return(null);
            }

            ExpensesReportRpt doc = new ExpensesReportRpt();

            List <GastoPrint> pList = new List <GastoPrint>();

            //long oid_exp = 0;

            foreach (ExpenseInfo item in list)
            {
                if (filter.SoloIncompletos)
                {
                    if (list.ExpedienteIsComplete(item.OidExpediente))
                    {
                        continue;
                    }
                }

                pList.Add(GastoPrint.New(item));

                //if ((oid_exp != item.OidExpediente) && (item.OidExpediente != 0))
                //{
                //    oid_exp = item.OidExpediente;

                //    ExpedienteInfo expediente = expedientes.GetItem(item.OidExpediente);

                //    CheckGasto(ECategoriaGasto.GeneralesExpediente, ETipoAcreedor.Naviera, expediente, list, pList);
                //    CheckGasto(ECategoriaGasto.GeneralesExpediente, ETipoAcreedor.Despachante, expediente, list, pList);
                //    CheckGasto(ECategoriaGasto.GeneralesExpediente, ETipoAcreedor.TransportistaOrigen, expediente, list, pList);
                //    CheckGasto(ECategoriaGasto.GeneralesExpediente, ETipoAcreedor.TransportistaDestino, expediente, list, pList);
                //    CheckGasto(ECategoriaGasto.Stock, ETipoAcreedor.Proveedor, expediente, list, pList);
                //}
            }

            //foreach (ExpedienteInfo item in expedientes)
            //{
            //    if (!list.ExistsExpediente(item.Oid))
            //    {
            //        CheckGasto(ECategoriaGasto.GeneralesExpediente, ETipoAcreedor.Naviera, item, list, pList);
            //        CheckGasto(ECategoriaGasto.GeneralesExpediente, ETipoAcreedor.Despachante, item, list, pList);
            //        CheckGasto(ECategoriaGasto.GeneralesExpediente, ETipoAcreedor.TransportistaOrigen, item, list, pList);
            //        CheckGasto(ECategoriaGasto.GeneralesExpediente, ETipoAcreedor.TransportistaDestino, item, list, pList);
            //        CheckGasto(ECategoriaGasto.Stock, ETipoAcreedor.Proveedor, item, list, pList);
            //    }
            //}

            doc.SetDataSource(pList);

            FormatHeader(doc);
            FormatReport(doc, filter, format);

            return(doc);
        }