public async Task <ICollection <DetalleCDPDto> > ObtenerRubrosPresupuestalesPorCompromiso(long crp, int pciId) { var detalles = await(from d in _context.CDP join i in _context.RubroPresupuestal on d.RubroPresupuestalId equals i.RubroPresupuestalId join sf in _context.SituacionFondo on d.Detalle9.ToUpper() equals sf.Nombre.ToUpper() join ff in _context.FuenteFinanciacion on d.Detalle8.ToUpper() equals ff.Nombre.ToUpper() join rp in _context.RecursoPresupuestal on d.Detalle10.ToUpper() equals rp.Codigo.ToUpper() join cp in _context.ClavePresupuestalContable on new { d.Crp, d.RubroPresupuestalId, sf.SituacionFondoId, ff.FuenteFinanciacionId, rp.RecursoPresupuestalId, Dependencia = d.Detalle2 } equals new { cp.Crp, cp.RubroPresupuestalId, cp.SituacionFondoId, cp.FuenteFinanciacionId, cp.RecursoPresupuestalId, Dependencia = cp.Dependencia } into ClavePresupuestal from clave in ClavePresupuestal.DefaultIfEmpty() where d.Instancia == (int)TipoDocumento.Compromiso where d.PciId == pciId where d.Crp == crp where d.SaldoActual > 0 select new DetalleCDPDto() { ValorCDP = d.ValorInicial, ValorOP = d.Operacion, ValorTotal = d.ValorTotal, SaldoAct = d.SaldoActual, Dependencia = d.Detalle2, DependenciaDescripcion = d.Detalle2 + " " + (d.Detalle3.Length > 100 ? d.Detalle3.Substring(0, 100) + "..." : d.Detalle3), ClavePresupuestalContableId = clave.ClavePresupuestalContableId, RubroPresupuestal = new RubroPresupuestal() { RubroPresupuestalId = i.RubroPresupuestalId, Identificacion = i.Identificacion, Nombre = i.Nombre, }, CdpDocumento = new CDP() { Detalle8 = d.Detalle8, Detalle9 = d.Detalle9, Detalle10 = d.Detalle10, } }) .Distinct() .OrderBy(x => x.RubroPresupuestal.Identificacion) .ToListAsync(); return(detalles); }
public IClavePresupuestal ObtenerClavePresupuestal() { #region CP - 1 ClavePresupuestal C111_1 = new ClavePresupuestal(LlenarDTO()); UAComposite component111 = LlenarUA("1.1.1", C111_1); ClavePresupuestal C112_1 = new ClavePresupuestal(LlenarDTO()); UAComposite component112 = LlenarUA("1.1.2", C112_1); ClavePresupuestal C121_1 = new ClavePresupuestal(LlenarDTO()); UAComposite component121 = LlenarUA("1.2.1", C121_1); ClavePresupuestal C122_1 = new ClavePresupuestal(LlenarDTO()); UAComposite component122 = LlenarUA("1.2.2", C122_1); UAComposite component11 = LlenarUA("1.1", component111); component11.Agregar(component112); UAComposite component12 = LlenarUA("1.2", component121); component12.Agregar(component122); UAComposite component1 = LlenarUA("1", component11); component1.Agregar(component12); #endregion #region CP - 2 ClavePresupuestal C211_1 = new ClavePresupuestal(LlenarDTO()); UAComposite component211 = LlenarUA("2.1.1", C211_1); ClavePresupuestal C212_1 = new ClavePresupuestal(LlenarDTO()); UAComposite component212 = LlenarUA("2.1.2", C212_1); ClavePresupuestal C221_1 = new ClavePresupuestal(LlenarDTO()); UAComposite component221 = LlenarUA("2.2.1", C221_1); ClavePresupuestal C222_1 = new ClavePresupuestal(LlenarDTO()); UAComposite component222 = LlenarUA("2.2.2", C222_1); UAComposite component21 = LlenarUA("2.1", component211); component21.Agregar(component212); UAComposite component22 = LlenarUA("2.2", component221); component22.Agregar(component222); UAComposite component2 = LlenarUA("2", component21); component2.Agregar(component22); #endregion #region CP - 3 ClavePresupuestal C311_1 = new ClavePresupuestal(LlenarDTO()); UAComposite component31 = LlenarUA("3.1", C311_1); UAComposite component3 = LlenarUA("3", component31); #endregion #region CP - 4 ClavePresupuestal C41_1 = new ClavePresupuestal(LlenarDTO()); UAComposite component4 = LlenarUA("4", C41_1); #endregion UAComposite component = LlenarUA("X", component1); component.Agregar(component2); component.Agregar(component3); component.Agregar(component4); return(component); }
public async Task <ICollection <DetalleCDPDto> > ObtenerRubrosPresupuestalesXNumeroContrato(string numeroContrato) { var detalles = await(from d in _context.CDP join i in _context.RubroPresupuestal on d.RubroPresupuestalId equals i.RubroPresupuestalId join pci in _context.Pci on d.PciId equals pci.PciId join sf in _context.SituacionFondo on d.Detalle9.ToUpper() equals sf.Nombre.ToUpper() join ff in _context.FuenteFinanciacion on d.Detalle8.ToUpper() equals ff.Nombre.ToUpper() join rp in _context.RecursoPresupuestal on d.Detalle10.ToUpper() equals rp.Codigo.ToUpper() join cp in _context.ClavePresupuestalContable on new { d.Crp, d.RubroPresupuestalId, sf.SituacionFondoId, ff.FuenteFinanciacionId, rp.RecursoPresupuestalId, Dependencia = d.Detalle2 } equals new { cp.Crp, cp.RubroPresupuestalId, cp.SituacionFondoId, cp.FuenteFinanciacionId, cp.RecursoPresupuestalId, Dependencia = cp.Dependencia } into ClavePresupuestal from clave in ClavePresupuestal.DefaultIfEmpty() where d.Instancia == (int)TipoDocumento.Compromiso where d.Detalle6.Trim() == numeroContrato // where d.SaldoActual > 0 select new DetalleCDPDto() { ValorCDP = d.ValorInicial, ValorOP = d.Operacion, ValorTotal = d.ValorTotal, SaldoAct = d.SaldoActual, Dependencia = d.Detalle2, DependenciaDescripcion = d.Detalle2 + " " + (d.Detalle3.Length > 100 ? d.Detalle3.Substring(0, 100) + "..." : d.Detalle3), ClavePresupuestalContableId = clave.ClavePresupuestalContableId, IdentificacionPci = pci.Identificacion, Crp = d.Crp, RubroPresupuestal = new RubroPresupuestal() { RubroPresupuestalId = i.RubroPresupuestalId, Identificacion = i.Identificacion, Nombre = i.Nombre, }, CdpDocumento = new CDP() { Detalle8 = d.Detalle8, Detalle9 = d.Detalle9, Detalle10 = d.Detalle10, } }) .Distinct() .OrderBy(x => x.RubroPresupuestal.Identificacion) .ToListAsync(); #region Modificar nombre de rubro if (detalles != null) { string nombre = string.Empty; foreach (var item in detalles) { if (item.RubroPresupuestal != null) { if (item.RubroPresupuestal.Identificacion.Contains("C-")) { string[] words = item.RubroPresupuestal.Nombre.Split('-'); if (words != null && words.Length > 1) { item.RubroPresupuestal.Nombre = _generalInterface.ObtenerCadenaLimitada(words[1], 40); } } else { item.RubroPresupuestal.Nombre = _generalInterface.ObtenerCadenaLimitada(item.RubroPresupuestal.Nombre, 40); } } } } #endregion Modificar nombre de rubro return(detalles); }
public LeafUA(ClavePresupuestal _clavePresupuestal) { this.clavePresupuestal = _clavePresupuestal; }