private void XCONTA_Rpt007_Rpt_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e) { try { XCONTA_Rpt007_Bus BusRpt = new XCONTA_Rpt007_Bus(); List <XCONTA_Rpt007_Info> ListaRpt = new List <XCONTA_Rpt007_Info>(); DateTime FechaIni, FechaFin; int idEmpresa = 0; bool Mostrar_Cero = false; int IdPunto_Cargo = 0; int IdPunto_Cargo_Grupo = 0; string IdCentroCosto = ""; bool Mostrar_CC = false; idEmpresa = Convert.ToInt32(this.PIdEmpresa.Value); FechaIni = Convert.ToDateTime(this.PFechaIni.Value); FechaFin = Convert.ToDateTime(this.PFechaFin.Value); Mostrar_Cero = Convert.ToBoolean(this.PMostrar_Reg_en_cero.Value); IdPunto_Cargo = Convert.ToInt32(this.PIdPunto_Cargo.Value); IdPunto_Cargo_Grupo = Convert.ToInt32(this.PIdPunto_Cargo_Grupo.Value); IdCentroCosto = Convert.ToString(this.PIdCentroCosto.Value); Mostrar_CC = Convert.ToBoolean(this.P_MostrarCC.Value); ListaRpt = BusRpt.Get_List_Reporte(idEmpresa, FechaIni, FechaFin, IdCentroCosto, IdPunto_Cargo_Grupo, IdPunto_Cargo, Mostrar_Cero, Mostrar_CC, param.IdUsuario); this.DataSource = ListaRpt.ToArray(); } catch (Exception ex) { Log_Error_bus.Log_Error(ex.ToString()); Core.Erp.Info.Log_Exception.LoggingManager.Logger.Log(Core.Erp.Info.Log_Exception.LoggingCategory.Error, ex.Message); throw new Core.Erp.Info.Log_Exception.DalException(string.Format("", "XCONTA_Rpt007_rpt_BeforePrint", ex.Message), ex) { EntityType = typeof(XCONTA_Rpt007_Rpt) }; } }
private void btnCargarReporte_Click(object sender, EventArgs e) { try { splashScreenManager.ShowWaitForm();//Inicio splash XCONTA_Rpt007_Bus Bus = new XCONTA_Rpt007_Bus(); List <XCONTA_Rpt007_Info> lista = new List <XCONTA_Rpt007_Info>(); string IdCentroCosto = ""; string Nom_centro_Costo = ""; string Nom_Punto_Cargo_Grupo = ""; string Nom_Punto_Cargo = ""; int IdPunto_cargo_grupo = 0; int IdPunto_cargo = 0; int IdEmpresa = 0; DateTime FechaCorte, FechaInicio; IdEmpresa = param.IdEmpresa; FechaCorte = dtpFechaHasta.Value; FechaInicio = dt_FechaDesde.Value; IdPunto_cargo_grupo = uCct_Pto_Cargo_Grupo.Get_Id_grupo(); Nom_Punto_Cargo_Grupo = (uCct_Pto_Cargo_Grupo.Get_info_grupo() == null) ? "" : uCct_Pto_Cargo_Grupo.Get_info_grupo().nom_punto_cargo_grupo; IdPunto_cargo = uCct_Pto_Cargo_Grupo.Get_Id_punto_cargo(); Nom_Punto_Cargo = (uCct_Pto_Cargo_Grupo.Get_info_punto_cargo() == null) ? "" : uCct_Pto_Cargo_Grupo.Get_info_punto_cargo().nom_punto_cargo; IdCentroCosto = cmb_centro_costo.EditValue == null ? "" : cmb_centro_costo.EditValue.ToString(); Nom_centro_Costo = cmb_centro_costo.Text; lista = Bus.Get_List_Reporte(IdEmpresa, FechaInicio, FechaCorte, IdCentroCosto, IdPunto_cargo_grupo, IdPunto_cargo, chkMostrar_Cero.Checked, chkMostrarCC.Checked, param.IdUsuario); gc_balance_comp.DataSource = lista; string Titulo = ""; Titulo = "BALANCE DE COMPROBACION \n\n"; Titulo = Titulo + "Desde:" + dt_FechaDesde.Value.ToShortDateString() + " hasta: " + dtpFechaHasta.Value.ToShortDateString() + "\n\n"; if (IdCentroCosto != "") { Titulo = Titulo + "Centro Costo:" + "[" + IdCentroCosto + "] - " + Nom_centro_Costo + "\n\n"; } if (IdPunto_cargo_grupo > 0) { Titulo = Titulo + "Grupo:" + Nom_Punto_Cargo_Grupo + "\n\n"; } if (IdPunto_cargo > 0) { Titulo = Titulo + "Punto Cargo:" + Nom_Punto_Cargo + "\n\n"; } gw_balance_comp.ViewCaption = Titulo; splashScreenManager.CloseWaitForm();//terminar splash } catch (Exception ex) { splashScreenManager.CloseWaitForm(); Log_Error_bus.Log_Error(ex.ToString()); MessageBox.Show(ex.Message, param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error); } }