예제 #1
0
        public override void PrintList()
        {
            PgMng.Reset(3, 1, Face.Resources.Messages.LOADING_DATA, this);
            ExpenseReportMng reportMng = new ExpenseReportMng(AppContext.ActiveSchema, this.Text, FilterValues);

            PgMng.Grow(Face.Resources.Messages.BUILDING_REPORT);
            ExpenseListRpt report = reportMng.GetListReport(ExpenseList.GetList((IList <ExpenseInfo>)Datos.List));

            PgMng.FillUp();
            ShowReport(report);
        }
        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;
        }