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 filtro = GetFilterValues();

            PgMng.Grow();

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

            PgMng.Grow();
            CobroFacturaList cobros = CobroFacturaList.GetList(conditions);

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

            CobroReportMng   reportMng = new CobroReportMng(AppContext.ActiveSchema, this.Text, filtro);
            InformeCobrosRpt rpt       = reportMng.GetInformeCobrosReport(cobros, facturas);

            PgMng.FillUp();

            ShowReport(rpt);

            _action_result = DialogResult.Ignore;
        }
Ejemplo n.º 2
0
        public void OutputInvoiceListHasItems()
        {
            OutputInvoiceList list = null;

            list = OutputInvoiceList.GetList(2014, false);
            Assert.IsTrue(list.Count > 0);
        }
Ejemplo n.º 3
0
        public void OutputInvoiceListNotIsNull()
        {
            OutputInvoiceList list = null;

            list = OutputInvoiceList.GetList(2015, false);
            Assert.IsNotNull(list);
            Assert.AreEqual(list.Count, 0);
        }
Ejemplo n.º 4
0
        protected virtual void PrintPendienteListAction()
        {
            OutputInvoiceReportMng reportMng = new OutputInvoiceReportMng(AppContext.ActiveSchema, Resources.Labels.FACTURA_PENDIENTES, "Cliente = " + Entity.Nombre);

            ReportClass report = reportMng.GetListReport(OutputInvoiceList.GetList(Datos_FPendientes.DataSource as IList <OutputInvoiceInfo>),
                                                         SerieList.GetList(false));

            ShowReport(report);
        }
Ejemplo n.º 5
0
        public void OutputInvoiceListHasItemsOnlyFromASerie()
        {
            OutputInvoiceList list       = null;
            QueryConditions   conditions = new QueryConditions {
                Serie = SerieInfo.New(1)
            };

            list = OutputInvoiceList.GetList(conditions, false);
            Assert.IsNull(list.FirstOrDefault(x => x.OidSerie != conditions.Serie.Oid));
        }
Ejemplo n.º 6
0
        public void OutputInvoiceListHasItemsOnlyFromAClient()
        {
            OutputInvoiceList list       = null;
            QueryConditions   conditions = new QueryConditions {
                Cliente = ClienteInfo.New(1)
            };

            list = OutputInvoiceList.GetList(conditions, false);
            Assert.IsNull(list.FirstOrDefault(x => x.OidCliente != conditions.Cliente.Oid));
        }
        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)
                {
                    OutputInvoiceList listA = OutputInvoiceList.GetList((SortedBindingList <OutputInvoiceInfo>)_filter_results);
                    listA.AddItem(_entity.GetInfo(false));
                    _filter_results = listA.GetSortedList();
                }
                break;

            case molAction.Edit:
            case molAction.ChangeStateContabilizado:
            case molAction.ChangeStateEmitido:
            case molAction.Unlock:
            case molAction.PrintDetail:
            case molAction.ExportPDF:
            case molAction.EmailPDF:
                if (_entity == null)
                {
                    return;
                }
                ActiveItem.CopyFrom(_entity);
                break;

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

            RefreshSources();
            if (_entity != null)
            {
                Select(_entity.Oid);
            }
            _entity = null;
        }
Ejemplo n.º 8
0
        protected virtual void SetUnlinkedGridValues(string grid_name)
        {
            SortedBindingList <OutputInvoiceInfo> sorted_facturas = Datos_Facturas.DataSource as SortedBindingList <OutputInvoiceInfo>;

            if (sorted_facturas != null)
            {
                OutputInvoiceList facturas = OutputInvoiceList.GetList(sorted_facturas);
                facturas.UpdateCobroValues(_entity);
            }
            UpdateAsignado();
        }
        protected override void RefreshMainData()
        {
            PgMng.Grow(string.Empty, "FacturaMngForm::RefreshMainData INI");

            _selectedOid = ActiveOID;

            switch (DataType)
            {
            case EntityMngFormTypeData.Default:
                switch (_tipo)
                {
                case ETipoFacturas.Todas:
                    if (Library.Common.ModulePrincipal.GetUseActiveYear())
                    {
                        List = OutputInvoiceList.GetList(Library.Common.ModulePrincipal.GetActiveYear().Year, false);
                    }
                    else
                    {
                        List = OutputInvoiceList.GetList(false);
                    }
                    break;

                case ETipoFacturas.Cobradas:
                    if (Library.Common.ModulePrincipal.GetUseActiveYear())
                    {
                        List = OutputInvoiceList.GetCobradasList(Library.Common.ModulePrincipal.GetActiveYear().Year, false);
                    }
                    else
                    {
                        List = OutputInvoiceList.GetCobradasList(false);
                    }
                    break;

                case ETipoFacturas.Pendientes:
                    if (Library.Common.ModulePrincipal.GetUseActiveYear())
                    {
                        List = OutputInvoiceList.GetNoCobradasList(Library.Common.ModulePrincipal.GetActiveYear().Year, false);
                    }
                    else
                    {
                        List = OutputInvoiceList.GetNoCobradasList(false);
                    }
                    break;
                }
                break;

            case EntityMngFormTypeData.ByParameter:
                _sorted_list = List.GetSortedList();
                break;
            }

            PgMng.Grow(string.Empty, "FacturaMngForm::RefreshMainData END");
        }
Ejemplo n.º 10
0
        public static OutputInvoiceListViewModel Get()
        {
            OutputInvoiceListViewModel list = new OutputInvoiceListViewModel();

            OutputInvoiceList sourceList = OutputInvoiceList.GetList();

            foreach (OutputInvoiceInfo item in sourceList)
            {
                list.Add(OutputInvoiceViewModel.New(item));
            }

            return(list);
        }
        public override void PrintList()
        {
            PgMng.Reset(3, 1, Face.Resources.Messages.LOADING_DATA, this);

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

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

            ReportClass report = reportMng.GetListReport(OutputInvoiceList.GetList(Datos.DataSource as IList <OutputInvoiceInfo>),
                                                         SerieList.GetList(false));

            PgMng.FillUp();

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