public ReportClass GetWorkDeliveryList(OutputDeliveryList list, ExpedienteList expedients)
        {
            if (list.Count == 0)
            {
                return(null);
            }

            OutputDeliveryListRpt doc = new OutputDeliveryListRpt();

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

            foreach (OutputDeliveryInfo item in list)
            {
                pList.Add(OutputDeliveryPrint.New(item, expedients.GetItem(item.OidHolder)));
            }

            doc.SetDataSource(pList);

            FormatHeader(doc);

            ((TextObject)doc.Section2.ReportObjects["IDHolder_LB"]).Text          = Library.Store.Resources.Labels.WORK_ID;
            ((TextObject)doc.Section2.ReportObjects["Holder_LB"]).Text            = Library.Store.Resources.Labels.WORK;
            doc.Section2.ReportObjects["NFactura_LB"].ObjectFormat.EnableSuppress = true;

            return(doc);
        }
        public ExpedienteSelectForm(Form parent, ExpedienteList list, moleQule.Store.Structs.ETipoExpediente expedientType)
            : base(true, parent, list, expedientType)
        {
            InitializeComponent();
            _view_mode = molView.Select;

            _action_result = DialogResult.Cancel;
        }
        public WorkSelectForm(Form parent, ExpedienteList list)
            : base(parent, list, moleQule.Store.Structs.ETipoExpediente.Work)
        {
            InitializeComponent();
            _view_mode = molView.Select;

            _action_result = DialogResult.Cancel;
        }
        public override void PrintList()
        {
            PgMng.Reset(3, 1, Face.Resources.Messages.LOADING_DATA, this);
            ExpedientReportMng reportMng = new ExpedientReportMng(AppContext.ActiveSchema, this.Text, FilterValues);

            PgMng.Grow(Face.Resources.Messages.BUILDING_REPORT);
            ExpedienteAlListRpt report = reportMng.GetAlListReport(ExpedienteList.GetList((IList <ExpedientInfo>)Datos.List));

            PgMng.FillUp();
            ShowReport(report);
        }
예제 #5
0
        protected virtual void SelectExpedientAction()
        {
            ExpedienteList list = ExpedienteList.GetList(moleQule.Store.Structs.ETipoExpediente.Work, false);
            WorkSelectForm form = new WorkSelectForm(this, list);

            if (form.ShowDialog(this) == DialogResult.OK)
            {
                SetExpediente((ExpedientInfo)form.Selected);
                RefreshLines();
            }
        }
        protected void ShowStandardReport(Library.Store.QueryConditions conditions)
        {
            ExpedientInfo expediente_ini = Rango_RB.Checked ? _expediente_ini : null;
            ExpedientInfo expediente_fin = Rango_RB.Checked ? _expediente_fin : null;

            ExpedientReportMng reportMng = new ExpedientReportMng(AppContext.ActiveSchema, this.Text, GetFilterValues());

            if (PorExpediente_RB.Checked)
            {
                MovimientosStockListPorExpedienteRpt rpt = null;

                if (TodosExpediente_RB.Checked)
                {
                    rpt = reportMng.GetMovimientosStockListAgrupado(ExpedienteList.GetList(conditions.TipoExpediente, false), conditions.Producto, SerieInfo.New(conditions.Serie.Oid), _report_filter, _report_format);
                }
                else if (Seleccion_RB.Checked)
                {
                    rpt = reportMng.GetMovimientosStockListAgrupado(ExpedientInfo.Get(conditions.Expedient.Oid, false), conditions.Producto, SerieInfo.New(conditions.Serie.Oid), _report_filter, _report_format, false);
                }
                else if (Rango_RB.Checked)
                {
                    rpt = reportMng.GetMovimientosStockListAgrupado(ExpedienteList.GetListByRango(expediente_ini, expediente_fin, false), conditions.Producto, SerieInfo.New(conditions.Serie.Oid), _report_filter, _report_format);
                }

                PgMng.FillUp();

                ShowReport(rpt);
            }
            else if (PorProducto_RB.Checked)
            {
                StockList stocks = null;

                if (TodosExpediente_RB.Checked)
                {
                    stocks = StockList.GetReportList(conditions, null, null, _report_filter.SoloStock, false);
                }
                else if (Seleccion_RB.Checked)
                {
                    stocks = StockList.GetReportList(conditions, null, null, _report_filter.SoloStock, false);
                }
                else if (Rango_RB.Checked)
                {
                    stocks = StockList.GetReportList(conditions, expediente_ini, expediente_fin, _report_filter.SoloStock, false);
                }

                StockLineListRpt rpt = reportMng.GetStockLineList(stocks, _report_filter, _report_format);

                PgMng.FillUp();

                ShowReport(rpt);
            }
        }
        public override void DeleteObject(long oid)
        {
            ExpedientInfo exp = ExpedientInfo.Get(oid, false);

            exp.LoadChilds(typeof(Batch), false, true);
            if (exp.Partidas.Count > 0)
            {
                MessageBox.Show("El expediente tiene productos asociados",
                                moleQule.Face.Resources.Labels.ADVISE_TITLE,
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Warning);

                _action_result = DialogResult.Ignore;
                return;
            }

            exp.LoadChilds(typeof(Maquinaria), false, true);
            if (exp.Maquinarias != null && exp.Maquinarias.Count > 0)
            {
                MessageBox.Show("El expediente tiene maquinas asociadas",
                                moleQule.Face.Resources.Labels.ADVISE_TITLE,
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Warning);

                _action_result = DialogResult.Ignore;
                return;
            }

            Expedient.Delete(oid);
            _action_result = DialogResult.OK;

            ExpedienteList cache = Cache.Instance.Get(typeof(ExpedienteList)) as ExpedienteList;

            if (cache != null)
            {
                cache.RemoveItem(oid);
            }

            //Se eliminan todos los formularios de ese objeto
            foreach (EntityDriverForm form in _list_active_form)
            {
                if (form is ItemMngBaseForm)
                {
                    if (((ItemMngBaseForm)form).Oid == oid)
                    {
                        form.Dispose();
                        break;
                    }
                }
            }
        }
        public override void UpdateList()
        {
            switch (_current_action)
            {
            case molAction.Add:
            case molAction.Copy:
                if (_entity == null)
                {
                    return;
                }
                List.AddItem(_entity.GetInfo(false));
                if (FilterType == IFilterType.Filter)
                {
                    ExpedienteList listA = ExpedienteList.GetList(_filter_results);
                    listA.AddItem(_entity.GetInfo(false));
                    _filter_results = listA.GetSortedList();
                }
                break;

            case molAction.Edit:
            case molAction.Lock:
            case molAction.Unlock:
                if (_entity == null)
                {
                    return;
                }
                ActiveItem.CopyFrom(_entity);
                break;

            case molAction.Delete:
                if (ActiveItem == null)
                {
                    return;
                }
                List.RemoveItem(ActiveOID);
                if (FilterType == IFilterType.Filter)
                {
                    ExpedienteList listD = ExpedienteList.GetList(_filter_results);
                    listD.RemoveItem(ActiveOID);
                    _filter_results = listD.GetSortedList();
                }
                break;
            }

            RefreshSources();
            if (_entity != null)
            {
                Select(_entity.Oid);
            }
            _entity = null;
        }
        protected override void SaveAction()
        {
            _action_result = SaveObject() ? DialogResult.OK : DialogResult.Ignore;

            if (_action_result == DialogResult.OK)
            {
                //Actualizamos la cache
                ExpedienteList cache = Cache.Instance.Get(typeof(ExpedienteList)) as ExpedienteList;
                if (cache != null)
                {
                    cache.Change(_entity.Oid, _entity.GetInfo(false), true);
                }
            }
        }
        public ExpedienteMngForm(bool isModal, Form parent, ExpedienteList list, moleQule.Store.Structs.ETipoExpediente t)
            : base(isModal, parent, list)
        {
            InitializeComponent();
            SetView();

            // Parche para poder abrir el formulario en modo diseño y no perder la configuracion de columnas
            DatosLocal_BS    = Datos;
            Tabla.DataSource = DatosLocal_BS;

            SetMainDataGridView(Tabla);
            Datos.DataSource = ExpedienteList.NewList().GetSortedList();
            SortProperty     = Codigo.DataPropertyName;
            SortDirection    = ListSortDirection.Descending;

            _tipo_expediente = t;
        }
        protected override void RefreshMainData()
        {
            PgMng.Grow(string.Empty, "Expedient");

            _selectedOid = ActiveOID;

            switch (DataType)
            {
            case EntityMngFormTypeData.Default:
                List = ExpedienteList.GetList(_tipo_expediente, false);
                break;

            case EntityMngFormTypeData.ByParameter:
                _sorted_list = List.GetSortedList();
                break;
            }
            PgMng.Grow(string.Empty, "Expedients");
        }
        public override void PrintList()
        {
            PgMng.Reset(4, 1, Face.Resources.Messages.LOADING_DATA, this);

            OutputDeliveryReportMng reportMng = new OutputDeliveryReportMng(AppContext.ActiveSchema, this.Text, this.FilterValues);

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

            ExpedienteList work = ExpedienteList.GetList(ETipoExpediente.Work, false);

            PgMng.Grow();

            ReportClass report = reportMng.GetWorkDeliveryList(OutputDeliveryList.GetList(Datos.DataSource as IList <OutputDeliveryInfo>),
                                                               work);

            PgMng.FillUp();

            ShowReport(report);
        }
        protected override void SelectLineExpedientAction()
        {
            if (_entity.EHolderType == ETipoEntidad.WorkReport)
            {
                return;
            }

            if (Lines_BS.Current == null)
            {
                return;
            }

            OutputDeliveryLine item = Lines_BS.Current as OutputDeliveryLine;

            if (item.OidPartida != 0)
            {
                ProgressInfoMng.ShowInfo(Resources.Messages.DELIVERY_LINE_EXPEDIENT_WARNING);
                return;
            }

            ExpedienteList expedientes = ExpedienteList.GetListByStockProducto(item.GetInfo(false));

            ExpedienteSelectForm form = new ExpedienteSelectForm(this, expedientes);

            if (form.ShowDialog(this) == DialogResult.OK)
            {
                ExpedientInfo source = (ExpedientInfo)form.Selected;

                if (source.StockKilos < item.CantidadKilos)
                {
                    PgMng.ShowErrorException(Resources.Messages.STOCK_INSUFICIENTE + " " + source.StockKilos.ToString());
                    return;
                }

                item.OidExpediente = source.Oid;
                item.Expediente    = source.Codigo;

                AddCacheItem(source);
            }
        }
예제 #14
0
        /// <summary>
        /// Asigna el objeto principal al origen de datos
        /// <returns>void</returns>
        /// </summary>
        public override void RefreshSecondaryData()
        {
            switch (_familia.ETipoFamilia)
            {
            case ETipoFamilia.Todas:
                _expedientes = ExpedienteList.GetList(moleQule.Store.Structs.ETipoExpediente.Todos, true);
                break;

            case ETipoFamilia.Ganado:
                _expedientes = ExpedienteList.GetList(moleQule.Store.Structs.ETipoExpediente.Ganado, true);
                break;

            case ETipoFamilia.Maquinaria:
                _expedientes = ExpedienteList.GetList(moleQule.Store.Structs.ETipoExpediente.Maquinaria, true);
                break;

            case ETipoFamilia.Alimentacion:
                _expedientes = ExpedienteList.GetList(moleQule.Store.Structs.ETipoExpediente.Alimentacion, true);
                break;
            }

            _almacen = ExpedientInfo.GetAlmacen(true);
        }
예제 #15
0
        protected override void LoadWorks(bool reload = false)
        {
            if (_works == null || reload)
            {
                PgMng.Reset(2 + _entity.Relations.Count, 1, Face.Resources.Messages.LOADING_DATA, this);
                try
                {
                    _works = ExpedienteList.GetList(_entity.Relations, false);
                    Works_BS.DataSource = _works;

                    PgMng.Grow(string.Empty);

                    foreach (ExpedientInfo work in _works)
                    {
                        work.LoadChilds(typeof(Expense), false, false);
                        PgMng.Grow(string.Empty);
                    }
                }
                finally
                {
                    PgMng.FillUp();
                }
            }
        }
 public ExpedienteMaquinariaMngForm(Form parent, ExpedienteList list, string title)
     : base(parent, moleQule.Store.Structs.ETipoExpediente.Maquinaria, list)
 {
     this.Text = title;
 }
        protected override void PrintAction()
        {
            PgMng.Reset(5, 1, Face.Resources.Messages.RETRIEVING_DATA, this);

            Library.Invoice.QueryConditions conditions = new Library.Invoice.QueryConditions();

            conditions.Cliente   = TodosCliente_CkB.Checked ? null : _cliente;
            conditions.Serie     = TodosSerie_CkB.Checked ? null : _serie;
            conditions.MedioPago = MedioPago_CB.SelectedValue != null ? (EMedioPago)(long)MedioPago_CB.SelectedValue : EMedioPago.Todos;
            conditions.FechaIni  = FInicial_DTP.Checked ? FInicial_DTP.Value : DateTime.MinValue;
            conditions.FechaFin  = FFinal_DTP.Checked ? FFinal_DTP.Value : DateTime.MaxValue;

            string filter = GetFilterValues();

            PgMng.Grow();

            OutputInvoiceList in_invoices = OutputInvoiceList.GetList(conditions, false);

            PgMng.Grow();
            ProductList products = ProductList.GetList(false);

            PgMng.Grow();
            ExpedienteList expedients = ExpedienteList.GetList(false);

            PgMng.FillUp();

            PgMng.Reset(in_invoices.Count + 2, 1, Face.Resources.Messages.RETRIEVING_DATA, this);

            Dictionary <long, ClientProductList> client_products = new Dictionary <long, ClientProductList>();

            foreach (OutputInvoiceInfo in_invoice in in_invoices)
            {
                in_invoice.LoadChilds(typeof(OutputInvoiceLine), false);

                decimal invoice_cost = 0;

                foreach (OutputInvoiceLineInfo line in in_invoice.ConceptoFacturas)
                {
                    ProductInfo product = products.GetItem(line.OidProducto);

                    if (product.BeneficioCero)
                    {
                        if (!client_products.ContainsKey(in_invoice.OidCliente))
                        {
                            client_products.Add(in_invoice.OidCliente, ClientProductList.GetByClientList(in_invoice.OidCliente, false));
#if TRACE
                            AppControllerBase.AppControler.Timer.Record("Productos del Cliente");
#endif
                        }
                        ProductoClienteInfo product_client = client_products[in_invoice.OidCliente].GetByProducto(line.OidProducto);

                        if (product_client != null)
                        {
                            invoice_cost += product_client.PrecioCompra;
                        }
                        else
                        {
                            invoice_cost += line.Subtotal;
                        }
                    }
                    else
                    {
                        if (line.OidPartida != 0)
                        {
                            ExpedientInfo expedient = expedients.GetItem(line.OidExpediente);

                            if (expedient != null)
                            {
                                if (expedient.Partidas == null)
                                {
                                    expedient.LoadExpenses(Estimated_CB.Checked);
#if TRACE
                                    AppControllerBase.AppControler.Timer.Record("Gastos del Expediente");
#endif
                                }

                                BatchInfo batch = expedient.Partidas.GetItem(line.OidPartida);
                                invoice_cost += line.CantidadKilos * batch.CosteNetoKg;
                            }
                            else
                            {
                                invoice_cost += line.CantidadKilos * product.PrecioCompra;
                            }
                        }
                        else
                        {
                            invoice_cost += (product != null) ? line.CantidadKilos * product.PrecioCompra : 0;
                        }
                    }
                }

                in_invoice.PrecioCoste = invoice_cost;
                in_invoice.Beneficio   = Decimal.Round(in_invoice.BaseImponible - in_invoice.PrecioCoste, 2);
                in_invoice.PBeneficio  = in_invoice.PrecioCoste != 0 ? Decimal.Round(((in_invoice.BaseImponible - in_invoice.PrecioCoste) * 100) / in_invoice.PrecioCoste, 2) : 0;

                PgMng.Grow();
            }

            client_products.Clear();

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

            OutputInvoiceReportMng reportMng = new OutputInvoiceReportMng(AppContext.ActiveSchema, this.Text, filter);
            ReportClass            rpt       = reportMng.GetBenefitsReport(in_invoices);
            PgMng.FillUp();

            ShowReport(rpt);

            _action_result = DialogResult.Ignore;
        }
        public virtual void ExportCharges()
        {
            Charges charges2 = null;

            try
            {
                _invoice_conditions.Orders.Clear();
                _invoice_conditions.Orders.NewOrder("Vencimiento", System.ComponentModel.ListSortDirection.Ascending, typeof(Charge));

                ChargeList cobros = ChargeList.GetList(_invoice_conditions, true);
                //Hacen falta todas porque un cobro puede estar asociado a una factura que no este en las condiciones del filtro
                _invoices = OutputInvoiceList.GetList(false);
                _clients  = (_clients == null) ? ClienteList.GetList(false) : _clients;

                _expedients = ExpedienteList.GetList(false);

                foreach (ChargeInfo item in cobros)
                {
                    if (item.EEstado == EEstado.Anulado)
                    {
                        continue;
                    }

                    LineaRegistro lr = _registry.LineaRegistros.NewItem(_registry, item);

                    switch (item.ETipoCobro)
                    {
                    case ETipoCobro.Cliente:
                    {
                        BuildChargeAccountingEntry(item, lr);
                        BuildFinalcialCashBookChargeAccountingEntry(item);
                    }
                    break;

                    case ETipoCobro.REA:
                    {
                        BuildREAChargeAccountingEntry(item, lr);
                    }
                    break;
                    }

                    _accounting_entry++;
                }

                //Cambiamos el estado de las cobros contabilizados
                charges2 = Charges.GetList(_invoice_conditions, false);
                FinancialCashList efectos = FinancialCashList.GetList(false);

                foreach (Charge item in charges2)
                {
                    if (item.EEstado == EEstado.Anulado)
                    {
                        continue;
                    }

                    if (item.EEstado != EEstado.Exportado)
                    {
                        if (item.EEstadoCobro == EEstado.Charged)
                        {
                            if (item.EMedioPago != EMedioPago.Cheque &&
                                item.EMedioPago != EMedioPago.Pagare)
                            {
                                item.EEstado = EEstado.Exportado;
                            }
                            else
                            {
                                FinancialCashInfo efecto = efectos.GetItemByCobro(item.Oid);
                                if (efecto != null && efecto.EEstadoCobro == EEstado.Charged)
                                {
                                    item.EEstado = EEstado.Exportado;
                                }
                            }
                        }
                    }
                }

                charges2.Save();
            }
            catch (iQException ex)
            {
                _registry = null;
                throw ex;
            }
            catch (Exception ex)
            {
                _registry = null;
                throw ex;
            }
            finally
            {
                if (charges2 != null)
                {
                    charges2.CloseSession();
                }
            }
        }
        protected void ShowStoreFileReport(Library.Store.QueryConditions conditions)
        {
            ExpedientInfo expediente_ini = Rango_RB.Checked ? _expediente_ini : null;
            ExpedientInfo expediente_fin = Rango_RB.Checked ? _expediente_fin : null;

            if (PorExpediente_RB.Checked)
            {
                ExpedientReportMng reportMng = new ExpedientReportMng(AppContext.ActiveSchema, this.Text, GetFilterValues());

                MovimientosStockListPorExpedienteRpt rpt = null;

                if (TodosExpediente_RB.Checked)
                {
                    rpt = reportMng.GetMovimientosStockListAgrupado(ExpedienteList.GetList(conditions.TipoExpediente, false), conditions.Producto, SerieInfo.New(conditions.Serie.Oid), _report_filter, _report_format);
                }
                else if (Seleccion_RB.Checked)
                {
                    rpt = reportMng.GetMovimientosStockListAgrupado(ExpedientInfo.Get(conditions.Expedient.Oid, false), conditions.Producto, SerieInfo.New(conditions.Serie.Oid), _report_filter, _report_format, false);
                }
                else if (Rango_RB.Checked)
                {
                    rpt = reportMng.GetMovimientosStockListAgrupado(ExpedienteList.GetListByRango(expediente_ini, expediente_fin, false), conditions.Producto, SerieInfo.New(conditions.Serie.Oid), _report_filter, _report_format);
                }

                PgMng.FillUp();

                ShowReport(rpt);
            }
            else if (PorProducto_RB.Checked)
            {
                StoreReportMng reportMng = new StoreReportMng(AppContext.ActiveSchema, this.Text, GetFilterValues());

                StockList stocks = null;

                if (TodosExpediente_RB.Checked)
                {
                    stocks = StockList.GetReportList(conditions, null, null, _report_filter.SoloStock, false);
                }
                else if (Seleccion_RB.Checked)
                {
                    stocks = StockList.GetReportList(conditions, null, null, _report_filter.SoloStock, false);
                }
                else if (Rango_RB.Checked)
                {
                    stocks = StockList.GetReportList(conditions, expediente_ini, expediente_fin, _report_filter.SoloStock, false);
                }

                stocks.FillPurchasePrices();

                string stock_purchase_price_type = string.Empty;

                if (LastPurchasePrice_RB.Checked)
                {
                    stock_purchase_price_type = "Last";
                }
                else if (AveragePrice_RB.Checked)
                {
                    stock_purchase_price_type = "Average";
                }

                StoreFileRpt rpt = reportMng.GetStoreFile(stocks
                                                          , _report_filter
                                                          , _report_format
                                                          , StoreFileKg_RB.Checked
                                                          , stock_purchase_price_type);

                PgMng.FillUp();

                ShowReport(rpt);
            }
        }
 public WorkSelectForm(Form parent)
     : this(parent, ExpedienteList.GetList(moleQule.Store.Structs.ETipoExpediente.Work, false))
 {
 }
        public virtual void ExportGrants()
        {
            REAExpedients reas2 = null;

            //LineasFomento fomentos2 = null;

            try
            {
                //AYUDAS REA

                _store_conditions.Orders.Clear();
                _store_conditions.Orders.NewOrder("Fecha", System.ComponentModel.ListSortDirection.Ascending, typeof(REAExpedient));

                ExpedienteREAList reas = ExpedienteREAList.GetList(_store_conditions, true);
                _expedients = ExpedienteList.GetList(false);

                foreach (ExpedienteREAInfo item in reas)
                {
                    if (item.EEstado == EEstado.Anulado)
                    {
                        continue;
                    }
                    if (item.EEstado == EEstado.Desestimado)
                    {
                        continue;
                    }

                    LineaRegistro lr = _registry.LineaRegistros.NewItem(_registry, item);

                    BuildREAGrantAccountingEntry(item, lr);

                    _accounting_entry++;
                }

                //Cambiamos el estado de las ayudas contabilizadas
                reas2 = REAExpedients.GetList(_store_conditions, false);

                foreach (REAExpedient item in reas2)
                {
                    if (item.EEstado == EEstado.Anulado)
                    {
                        continue;
                    }
                    if (item.EEstado == EEstado.Desestimado)
                    {
                        continue;
                    }

                    if (item.EEstado != EEstado.Exportado)
                    {
                        item.EEstado = EEstado.Exportado;
                    }
                }

                reas2.Save();

                //AYUDAS FOMENTO

                /*LineaFomentoList fomentos = LineaFomentoList.GetList(_store_conditions, true);
                 *
                 * foreach (LineaFomentoInfo item in fomentos)
                 * {
                 *      if (item.EEstado == EEstado.Anulado) continue;
                 *      if (item.EEstado == EEstado.Desestimado) continue;
                 *
                 *      LineaRegistro lr = _registro.LineaRegistros.NewItem(_registro, item);
                 *
                 *      BuildAsientoAyudaFomento(item, lr);
                 *
                 *      _asiento++;
                 * }
                 *
                 * //Cambiamos el estado de las cobros contabilizados
                 * fomentos2 = LineasFomento.GetList(_store_conditions, false);
                 *
                 * foreach (LineaFomento item in fomentos2)
                 * {
                 *      if (item.EEstado == EEstado.Anulado) continue;
                 *      if (item.EEstado == EEstado.Desestimado) continue;
                 *
                 *      if (item.EEstado != EEstado.Exportado) item.EEstado = EEstado.Exportado;
                 * }
                 *
                 * fomentos2.Save();*/
            }
            catch (Exception ex)
            {
                _registry = null;
                throw ex;
            }
            finally
            {
                if (reas2 != null)
                {
                    reas2.CloseSession();
                }
                //if (fomentos2 != null) fomentos2.CloseSession();
            }
        }
        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 ExpedienteMngForm(moleQule.Store.Structs.ETipoExpediente t, ExpedienteList list)
     : this(false, null, list, t)
 {
 }
 public ExpedienteMngForm(Form parent, moleQule.Store.Structs.ETipoExpediente t, ExpedienteList list)
     : this(false, parent, list, t)
 {
 }
 public ExpedienteAlimentacionMngForm(Form parent, ExpedienteList list, string title)
     : base(parent, moleQule.Store.Structs.ETipoExpediente.Alimentacion, list)
 {
     this.Text = title;
 }
 public ExpedienteSelectForm(Form parent, ExpedienteList list)
     : this(parent, list, moleQule.Store.Structs.ETipoExpediente.Todos)
 {
 }
 public ExpedienteGanadoMngForm(Form parent, ExpedienteList list, string title)
     : base(parent, moleQule.Store.Structs.ETipoExpediente.Ganado, list)
 {
     this.Text = title;
 }
        protected override void PrintAction()
        {
            try
            {
                PgMng.Reset(6, 1, Face.Resources.Messages.RETRIEVING_DATA, this);

                if (FFacturaIni_DTP.Checked)
                {
                    _report_filter.fecha_fac_inicio = FFacturaIni_DTP.Value;
                }
                else
                {
                    _report_filter.fecha_fac_inicio = DateTime.MinValue;
                }

                if (FFacturaFin_DTP.Checked)
                {
                    _report_filter.fecha_fac_final = FFacturaFin_DTP.Value;
                }
                else
                {
                    _report_filter.fecha_fac_final = DateTime.MaxValue;
                }

                if (FPagoIni_DTP.Checked)
                {
                    _report_filter.fecha_pago_inicio = FPagoIni_DTP.Value;
                }
                else
                {
                    _report_filter.fecha_pago_inicio = DateTime.MinValue;
                }

                if (FPagoFin_DTP.Checked)
                {
                    _report_filter.fecha_pago_final = FPagoFin_DTP.Value;
                }
                else
                {
                    _report_filter.fecha_pago_final = DateTime.MaxValue;
                }

                if (FPrevisionIni_DTP.Checked)
                {
                    _report_filter.prevision_ini = FPrevisionIni_DTP.Value;
                }
                else
                {
                    _report_filter.prevision_ini = DateTime.MinValue;
                }

                if (FPrevisionFin_DTP.Checked)
                {
                    _report_filter.prevision_fin = FPrevisionFin_DTP.Value;
                }
                else
                {
                    _report_filter.prevision_fin = DateTime.MaxValue;
                }

                _report_filter.exp_final       = string.Empty;
                _report_filter.exp_inicial     = string.Empty;
                _report_filter.tipo            = (EPagos)(long)TipoFactura_CB.SelectedValue;
                _report_filter.tipo_informe    = (ETipoInforme)(long)TipoAcreedor_CB.SelectedValue;
                _report_filter.tipo_expediente = (moleQule.Store.Structs.ETipoExpediente)(long) TipoExpediente_CB.SelectedValue;

                ReportFormat format = new ReportFormat();
                format.Vista = (Resumido_RB.Checked) ? EReportVista.Resumido : EReportVista.Detallado;

                string filtro = GetFilterValues();
                PgMng.Grow();

                ExpedienteList expedients = ExpedienteList.GetList(_report_filter.tipo_expediente, false);
                PgMng.Grow();

                InputInvoiceList invoices = InputInvoiceList.GetListByDate(_report_filter.fecha_fac_inicio, _report_filter.fecha_fac_final, false);
                PgMng.Grow();

                PaymentSummaryList summaries = PaymentSummaryList.GetPendientesList();
                PgMng.Grow(Face.Resources.Messages.BUILDING_REPORT);

                PaymentReportMng  reportMng = new PaymentReportMng(AppContext.ActiveSchema, this.Text, filtro);
                PaymentsReportRpt rpt       = reportMng.GetInformeControlPagosReport(invoices, expedients, summaries, _report_filter, format);
                PgMng.FillUp();

                ShowReport(rpt);

                _action_result = DialogResult.Ignore;
            }
            catch (Exception ex)
            {
                PgMng.FillUp();
                throw ex;
            }
        }