public List <ProformaDetalle> BuildProformaFromModeloAsTemplate(CentroCostos cc, int anio, Int64 idTipoProforma, Int64 idTipoCaptura) { DataRow dataRow = _queryExecuter.ExecuteQueryUniqueresult( "select modelo_negocio_id,modelo_negocio_flujo_id from centro_costo where id=" + cc.id); Int64 idModeloAproformar = -1; Int64 tipoCaptura = idTipoCaptura; if (tipoCaptura == TipoCapturaContable) { idModeloAproformar = ToInt64(dataRow["modelo_negocio_id"]); } else if (tipoCaptura == TipoCapturaFlujo) { idModeloAproformar = ToInt64(dataRow["modelo_negocio_flujo_id"]); } if (idModeloAproformar == -1) { throw new ArgumentException( "No se pudo determinar el modelo con el que se proformara. El tipo de captura recibido fue " + tipoCaptura); } List <Rubros> rubroses = GetRubrosFromModeloId(idModeloAproformar, false); List <ProformaDetalle> detallesAniosAnteriores = new List <ProformaDetalle>(); detallesAniosAnteriores = new ProformaDetalleDataAccessLayer().GetAcumuladoAnteriores(cc.id, cc.empresa_id, idModeloAproformar, cc.proyecto_id, anio, idTipoCaptura); List <ProformaDetalle> detallesAniosPosteriores = new ProformaDetalleDataAccessLayer().GetEjercicioPosterior(anio, cc.id, idModeloAproformar, idTipoCaptura, idTipoProforma); List <ProformaDetalle> proformaDetalles = buildProformaFromTemplate(rubroses, cc.id, anio, idTipoProforma, idTipoCaptura); //--> se colocan los anios posteriores manageAniosAnteriores(proformaDetalles, detallesAniosAnteriores); foreach (ProformaDetalle detalle in proformaDetalles) { foreach (ProformaDetalle posterior in detallesAniosPosteriores) { if (detalle.rubro_id == posterior.rubro_id) { detalle.anios_posteriores_resultado = posterior.anios_posteriores_resultado; } } } return(proformaDetalles); }