private void XBAN_FJ_Rpt003_Rpt_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e) { try { int IdEmpresa = Convert.ToInt32(this.IdEmpresa.Value); DateTime fi = Convert.ToDateTime(this.FechaInicio.Value); DateTime ff = Convert.ToDateTime(this.FechaFin.Value); lista = bus.Get_List_FlujoEreso(IdEmpresa, fi, ff); var Consulta = (from s in lista select s.tc_TipoCbte).Distinct(); double Total = lista.Sum(v => v.cb_Valor); foreach (var item in Consulta) { XBAN_FJ_Rpt003_Info info = new XBAN_FJ_Rpt003_Info(); double Subtotal = lista.Where(v => v.tc_TipoCbte == item.ToString()).Sum(v => v.cb_Valor); lista.Where(v => v.tc_TipoCbte == item.ToString()).ToList().ForEach(x => x.cb_total = Subtotal); info.cb_Valor = Subtotal; info.tc_TipoCbte = item; info.Porcentaje = Subtotal / Total; lista_Imprimir.Add(info); } this.DataSource = lista_Imprimir; } catch (Exception ex) { } }
public List <XBAN_FJ_Rpt003_Info> Get_List_FlujoEreso(int idEmpresa, DateTime fi, DateTime ff) { try { try { List <XBAN_FJ_Rpt003_Info> Lista = new List <XBAN_FJ_Rpt003_Info>(); Cbt = empresaData.Get_Info_Empresa(idEmpresa); DateTime FechaI = Convert.ToDateTime(fi.ToShortDateString()); DateTime FechaF = Convert.ToDateTime(ff.ToShortDateString()); using (EntitiesBancos_Rpt_Fj Context = new EntitiesBancos_Rpt_Fj()) { var lst = (from q in Context.spBAN_Rpt001(idEmpresa, FechaI, FechaF) select q); foreach (var item in lst) { XBAN_FJ_Rpt003_Info Info = new XBAN_FJ_Rpt003_Info(); Info.IdEmpresa = item.IdEmpresa; Info.tc_TipoCbte = item.tc_TipoCbte; Info.cb_Valor = Convert.ToDouble(item.cb_Valor); Info.em_nombre = Cbt.em_nombre; Info.em_logo = Cbt.em_logo; Lista.Add(Info); } } return(Lista); } catch (DbEntityValidationException exv) { string mensaje = ""; mensaje = exv.ToString(); tb_sis_Log_Error_Vzen_Data oDataLog = new tb_sis_Log_Error_Vzen_Data(); tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(exv.ToString(), "", mensaje, "", "", "", "", "", DateTime.Now); oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje); throw new Exception(mensaje); } } catch (Exception ex) { string mensaje = ""; mensaje = ex.ToString(); tb_sis_Log_Error_Vzen_Data oDataLog = new tb_sis_Log_Error_Vzen_Data(); tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", mensaje, "", "", "", "", "", DateTime.Now); oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje); throw new Exception(mensaje); } }