Ejemplo n.º 1
0
        protected override void SetUnlinkedGridValues(Control control)
        {
            SortedBindingList <NominaInfo> nominas = Datos_Lineas.DataSource as SortedBindingList <NominaInfo>;
            PayrollList list = PayrollList.GetList(nominas);

            if (nominas != null)
            {
                list.UpdatePagoValues(_entity);
            }
            Datos_Lineas.DataSource = list.GetSortedList();
            UpdateAllocated();
        }
        public override void UpdateList()
        {
            switch (_current_action)
            {
            case molAction.Add:
                if (_entity == null)
                {
                    return;
                }
                List.AddItem(_entity.GetInfo(false));
                if (FilterType == IFilterType.Filter)
                {
                    PayrollList listA = PayrollList.GetList(_filter_results);
                    listA.AddItem(_entity.GetInfo(false));
                    _filter_results = listA.GetSortedList();
                }
                break;

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

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

            RefreshSources();
            if (_entity != null)
            {
                Select(_entity.Oid);
            }
            _entity = null;
        }
        protected override void RefreshMainData()
        {
            PgMng.Grow(string.Empty, "Payroll");

            long oid = ActiveOID;

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

            case EntityMngFormTypeData.ByParameter:
                _sorted_list = List.GetSortedList();
                break;
            }
            PgMng.Grow(string.Empty, "Lista de Nominas");
        }
        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();
                }
            }
        }