public new static IAgenteHipatiaList GetAgentes(EntidadInfo entidad) { IAgenteHipatiaList lista = new IAgenteHipatiaList(new List <IAgenteHipatia>()); if (entidad.Tipo == typeof(Cliente).Name) { ClienteList list = ClienteList.GetList(false); foreach (ClienteInfo obj in list) { if (entidad.Agentes.GetItemByProperty("Oid", obj.Oid) == null) { lista.Add(obj); } } } else if (entidad.Tipo == typeof(Charge).Name) { ChargeList list = ChargeList.GetList(false); foreach (ChargeInfo obj in list) { if (entidad.Agentes.GetItemByProperty("Oid", obj.Oid) == null) { lista.Add(obj); } } } else if (entidad.Tipo == typeof(OutputInvoice).Name) { OutputInvoiceList list = OutputInvoiceList.GetList(false); foreach (OutputInvoiceInfo obj in list) { if (entidad.Agentes.GetItemByProperty("Oid", obj.Oid) == null) { lista.Add(obj); } } } else { throw new iQException("No se ha encontrado el tipo de entidad " + entidad.Tipo); } return(lista); }
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(); } } }