예제 #1
0
        public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            RelPrevCustos rpt = new RelPrevCustos();

            rpt.Site = this.Site;
            return(rpt);
        }
예제 #2
0
        private void BtnImprimir_Click(object sender, EventArgs e)
        {
            if (int.Parse(LstFilial.SelectedValue.ToString()) == 0)
            {
                MessageBox.Show("Favor Informar a Filial", "Alerta", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            string sSQL = "SELECT T5.Fantasia AS Filial,T4.Departamento,T4.Responsavel,T3.Grupo,T2.Custo,T1.* FROM PREVCUSTOS T1 " +
                          " LEFT JOIN CentroCusto T2 ON (T1.ID_CUSTO=T2.Id_Custo)" +
                          " LEFT JOIN GrupoCCusto T3 ON (T3.Id_GrpCusto=T2.Id_GrpCusto)" +
                          " LEFT JOIN Departamentos T4 ON (T4.Id_Departamento=T1.Id_Departamento)" +
                          " LEFT JOIN Empresa_Filial T5 ON (T5.Id_Filial=T1.ID_FILIAL)" +
                          " WHERE T1.ANO=" + TxtAno.Value.ToString();

            if (int.Parse(LstDepart.SelectedValue.ToString()) > 0)
            {
                sSQL = sSQL + " AND T1.ID_Departamento=" + LstDepart.SelectedValue.ToString();
            }

            if (int.Parse(LstCusto.SelectedValue.ToString()) > 0)
            {
                sSQL = sSQL + " AND T1.ID_Custo=" + LstCusto.SelectedValue.ToString();
            }

            sSQL = sSQL + " ORDER BY T4.Departamento,T3.Grupo,T2.Custo";

            BtnImprimir.Enabled = false;
            FrmRelatorios FrmRel = new FrmRelatorios();

            Relatorios.RelPrevCustos Rel001 = new Relatorios.RelPrevCustos();
            DataSet TabRel = new DataSet();

            TabRel = Controle.ConsultaTabela(sSQL);
            Rel001.SetDataSource(TabRel.Tables[0]);
            FrmRel.cryRepRelatorio.ReportSource = Rel001;
            ((CrystalDecisions.CrystalReports.Engine.TextObject)(Rel001.Section2.ReportObjects["LblFilial"])).Text  = LstFilial.Text.Trim();
            ((CrystalDecisions.CrystalReports.Engine.TextObject)(Rel001.Section2.ReportObjects["LblPeriodo"])).Text = "Ano:" + TxtAno.Value.ToString();
            FrmRel.ShowDialog();
            BtnImprimir.Enabled = true;
        }