Example #1
0
        private void XCONTA_Rpt020_rpt_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
        {
            xrLfecha.Text   = DateTime.Now.ToString();
            xrLusuario.Text = param.IdUsuario;
            try
            {
                string                    msg   = "";
                XCONTA_Rpt020_Bus         Bus   = new XCONTA_Rpt020_Bus();
                List <XCONTA_Rpt020_Info> lista = new List <XCONTA_Rpt020_Info>();

                int      IdEmpresa         = 0;
                int      IdNivel_a_mostrar = 0;
                DateTime FechaIni;
                DateTime FechaFin;
                string   IdCentroCosto       = "";
                int      IdPuntoCargo        = 0;
                int      IdPuntoCargo_Grupo  = 0;
                bool     Mostrar_Reg_en_cero = false;
                bool     Mostrar_CC          = false;

                IdEmpresa = Convert.ToInt32(PIdEmpresa.Value);
                FechaIni  = Convert.ToDateTime(PFechaIni.Value);
                FechaFin  = Convert.ToDateTime(PFechaFin.Value);

                IdPuntoCargo       = Convert.ToInt32(PIdPunto_Cargo.Value);
                IdPuntoCargo_Grupo = Convert.ToInt32(PIdPunto_Cargo_Grupo.Value);

                IdCentroCosto       = Convert.ToString(PIdCentroCosto.Value);
                IdNivel_a_mostrar   = Convert.ToInt32(PIdNivel_a_mostrar.Value);
                Mostrar_Reg_en_cero = Convert.ToBoolean(PMostrar_Reg_en_cero.Value);
                Mostrar_CC          = Convert.ToBoolean(P_Mostrar_CC.Value);


                lista = Bus.consultar_data(IdEmpresa, FechaIni, FechaFin, IdCentroCosto,
                                           IdNivel_a_mostrar, IdPuntoCargo_Grupo, IdPuntoCargo, Mostrar_Reg_en_cero, Mostrar_CC, true, param.IdUsuario, ref msg);

                if (lista.Count == 0)
                {
                    xrLmensaje.Visible = true;
                    xrLmensaje.Text    = "No hay datos encontrados para estos filtros";
                }
                else
                {
                    xrLmensaje.Visible = false;
                }


                this.DataSource = lista.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_Rpt020_rpt_BeforePrint", ex.Message), ex)
                      {
                          EntityType = typeof(XCONTA_Rpt020_rpt)
                      };
            }
        }
Example #2
0
        private void btnCargarReporte_Click(object sender, EventArgs e)
        {
            try
            {
                splashScreenManager.ShowWaitForm();//Inicio splash

                string            msg = "";
                XCONTA_Rpt020_Bus Bus = new XCONTA_Rpt020_Bus();


                int IdEmpresa           = 0;
                int IdNivel_a_mostrar   = 0;
                int IdPunto_cargo_grupo = 0;
                int IdPunto_cargo       = 0;

                DateTime FechaIni;
                DateTime FechaFin;

                string IdCentroCosto         = "";
                string Nom_centro_Costo      = "";
                string Nom_Punto_Cargo_Grupo = "";
                string Nom_Punto_Cargo       = "";



                IdEmpresa = param.IdEmpresa;
                FechaIni  = dtpFechaDesde.Value;
                FechaFin  = dtpFechaHasta.Value;

                IdCentroCosto     = cmb_centro_costo.EditValue == null ? "" : cmb_centro_costo.EditValue.ToString();
                Nom_centro_Costo  = cmb_centro_costo.Text;
                IdNivel_a_mostrar = (int)cmb_nivel.SelectedValue;

                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;


                lista = Bus.consultar_data(IdEmpresa, FechaIni, FechaFin, IdCentroCosto, IdNivel_a_mostrar,
                                           IdPunto_cargo_grupo, IdPunto_cargo, chkMostrar_Reg_Cero.Checked, chkMostrar_CC.Checked, true, param.IdUsuario, ref msg);


                gc_balance.DataSource = lista;
                gc_balance.RefreshDataSource();



                string Titulo = "";
                Titulo = "BALANCE GENERAL \n";
                Titulo = Titulo + " " + cmb_Mostrar_a.Text + ":" + ((cmb_Mostrar_a.Text == "Por periodo") ? cmb_Periodo.Text : "") + "\n";
                Titulo = Titulo + " Desde:" + dtpFechaDesde.Value.ToShortDateString() + "  Hasta:" + dtpFechaHasta.Value.ToShortDateString() + "\n";

                if (IdCentroCosto != "")
                {
                    Titulo = Titulo + " Centro Costo:" + "[" + IdCentroCosto + "] - " + Nom_centro_Costo + "\n";
                }

                if (IdPunto_cargo_grupo > 0)
                {
                    Titulo = Titulo + " Grupo:" + Nom_Punto_Cargo_Grupo + "\n";
                }

                if (IdPunto_cargo > 0)
                {
                    Titulo = Titulo + " Punto Cargo:" + Nom_Punto_Cargo + "\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.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }