public void InputInvoiceListHasItems()
        {
            InputInvoiceList list = null;

            list = InputInvoiceList.GetList(ETipoAcreedor.Todos, 2014, false);
            Assert.IsTrue(list.Count > 0);
        }
        public void InputInvoiceListNotIsNull()
        {
            InputInvoiceList list = null;

            list = InputInvoiceList.GetList(ETipoAcreedor.Todos, 2014, false);
            Assert.IsNotNull(list);
        }
        public void InputInvoiceListHasItemsOnlyFromASerie()
        {
            InputInvoiceList list       = null;
            QueryConditions  conditions = new QueryConditions {
                Serie = SerieInfo.New(1)
            };

            list = InputInvoiceList.GetList(conditions, false);
            Assert.IsNull(list.FirstOrDefault(x => x.OidSerie != conditions.Serie.Oid));
        }
        public void InputInvoiceListHasItemsOnlyFromAClient()
        {
            InputInvoiceList list       = null;
            QueryConditions  conditions = new QueryConditions {
                Acreedor = ProviderBaseInfo.New(1, ETipoAcreedor.Proveedor)
            };

            list = InputInvoiceList.GetList(conditions, false);
            Assert.IsNull(list.FirstOrDefault(x => x.OidAcreedor != conditions.Acreedor.Oid));
        }
Пример #5
0
        protected virtual void SetUnlinkedGridValues(Control control)
        {
            SortedBindingList <InputInvoiceInfo> invoices = Datos_Lineas.DataSource as SortedBindingList <InputInvoiceInfo>;
            InputInvoiceList list = InputInvoiceList.GetList(invoices);

            if (invoices != null)
            {
                list.UpdatePagoValues(_entity);
            }
            Datos_Lineas.DataSource = list.GetSortedList();
            UpdateAllocated();
        }
Пример #6
0
        protected override void RefreshMainData()
        {
            PgMng.Grow(string.Empty, "InputInvoiceMngForm::RefreshMainData INI");

            _selectedOid = ActiveOID;

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

                case ETipoFacturas.Pagadas:
                    if (moleQule.Common.ModulePrincipal.GetUseActiveYear())
                    {
                        List = InputInvoiceList.GetPagadasList(ETipoAcreedor.Todos, moleQule.Common.ModulePrincipal.GetActiveYear().Year, false);
                    }
                    else
                    {
                        List = InputInvoiceList.GetPagadasList(false);
                    }
                    break;

                case ETipoFacturas.Pendientes:
                    if (moleQule.Common.ModulePrincipal.GetUseActiveYear())
                    {
                        List = InputInvoiceList.GetPendientesList(ETipoAcreedor.Todos, moleQule.Common.ModulePrincipal.GetActiveYear().Year, false);
                    }
                    else
                    {
                        List = InputInvoiceList.GetPendientesList(false);
                    }
                    break;
                }
                break;

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

            PgMng.Grow(string.Empty, "InputInvoiceMngForm::RefreshMainData END");
        }
        public static InputInvoiceListViewModel Get()
        {
            InputInvoiceListViewModel list = new InputInvoiceListViewModel();

            InputInvoiceList sourceList = InputInvoiceList.GetList();

            foreach (InputInvoiceInfo item in sourceList)
            {
                list.Add(InputInvoiceViewModel.New(item));
            }

            return(list);
        }
Пример #8
0
        public override void UpdateList()
        {
            switch (_current_action)
            {
            case molAction.Add:
                if (_entity == null)
                {
                    return;
                }
                List.AddItem(_entity.GetInfo(false));
                if (FilterType == IFilterType.Filter)
                {
                    InputInvoiceList listA = InputInvoiceList.GetList(_filter_results);
                    listA.AddItem(_entity.GetInfo(false));
                    _filter_results = listA.GetSortedList();
                }
                break;

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

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

            RefreshSources();
            if (_entity != null)
            {
                Select(_entity.Oid);
            }
            _entity = null;
        }
Пример #9
0
        public override void PrintList()
        {
            PgMng.Reset(3, 1, Face.Resources.Messages.LOADING_DATA, this);

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

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

            InputInvoiceListRpt report = reportMng.GetListReport(InputInvoiceList.GetList(Datos.DataSource as IList <InputInvoiceInfo>),
                                                                 ProviderBaseList.GetList(false));

            PgMng.FillUp();

            ShowReport(report);
        }
        public virtual void ExportPayments()
        {
            Payments payments2 = null;

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

                PaymentList payments = PaymentList.GetOrderedByFechaList(_store_conditions, true);

                //if (pagos.Count == 0) return; // throw new iQException(Library.Resources.Messages.NO_RESULTS);

                //Hacen falta todas porque un pago puede estar asociado a una factura que no este en las condiciones del filtro
                _input_invoices = InputInvoiceList.GetList(false);
                _providers      = (_providers == null) ? ProviderBaseList.GetList(false) : _providers;
                _employees      = (_employees == null) ? EmployeeList.GetList(false) : _employees;
                _expense_types  = (_expense_types == null) ? TipoGastoList.GetList(false) : _expense_types;
                _payrolls       = (_payrolls == null) ? PayrollList.GetList(false) : _payrolls;

                foreach (PaymentInfo item in payments)
                {
                    if (item.EEstado == EEstado.Anulado)
                    {
                        continue;
                    }

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

                    switch (item.ETipoPago)
                    {
                    case ETipoPago.Factura:
                    {
                        BuildInvoicePaymentAccountingEntry(item, lr);
                        BuildFinancialCashBookPaymentAccountingEntry(item);
                    }
                    break;

                    case ETipoPago.Nomina:
                    {
                        BuildPayrollPaymentAccountingEntry(item, lr);
                    }
                    break;

                    case ETipoPago.Gasto:
                    {
                        BuildExpensePaymentAccountingEntry(item, lr);
                    }
                    break;

                    case ETipoPago.ExtractoTarjeta:
                    {
                        BuildCreditCardStatementPaymentAccountingEntry(item, lr);
                    }
                    break;
                    }

                    _accounting_entry++;
                }

                //Cambiamos el estado de los pagos contabilizados
                payments2 = Payments.GetList(_store_conditions, false);

                foreach (Payment item in payments2)
                {
                    if (item.EEstado == EEstado.Anulado)
                    {
                        continue;
                    }

                    if (item.EEstado != EEstado.Exportado)
                    {
                        /*if (item.EEstadoPago == EEstado.Pagado)*/ item.EEstado = EEstado.Exportado;
                    }
                }

                payments2.Save();
            }
            catch (iQException ex)
            {
                _registry = null;
                throw ex;
            }
            catch (Exception ex)
            {
                _registry = null;
                throw ex;
            }
            finally
            {
                if (payments2 != null)
                {
                    payments2.CloseSession();
                }
            }
        }
        public virtual void ExportInputInvoices()
        {
            InputInvoices invoices = null;

            try
            {
                _store_conditions.Orders.Clear();
                _store_conditions.Orders.NewOrder("Acreedor", System.ComponentModel.ListSortDirection.Ascending, typeof(InputInvoice));
                _store_conditions.Orders.NewOrder("Fecha", System.ComponentModel.ListSortDirection.Ascending, typeof(InputInvoice));

                _input_invoices = InputInvoiceList.GetList(_store_conditions, true);
                _providers      = (_providers == null) ? ProviderBaseList.GetList(false) : _providers;

                foreach (InputInvoiceInfo item in _input_invoices)
                {
                    LineaRegistro lr = _registry.LineaRegistros.NewItem(_registry, item);

                    BuildInputInvoiceAccountingEntry(item, lr);
                    BuildTaxBookSoportadoAccountingEntry(item);

                    _accounting_entry++;
                }

                //Cambiamos el estado de las facturas contabilizadas
                invoices = InputInvoices.GetList(_store_conditions, false);

                foreach (InputInvoice item in invoices)
                {
                    item.LoadChilds(typeof(InputInvoiceLine), false);
                }

                foreach (InputInvoice item in invoices)
                {
                    if (item.EEstado == EEstado.Anulado)
                    {
                        continue;
                    }

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

                invoices.Save();
            }
            catch (iQException ex)
            {
                _registry = null;
                throw ex;
            }
            catch (Exception ex)
            {
                _registry = null;
                throw ex;
            }
            finally
            {
                if (invoices != null)
                {
                    invoices.CloseSession();
                }
            }
        }