Exemplo n.º 1
0
 private void ReportCashierLogForm_Load(object sender, EventArgs e)
 {
     DataSet dsTempReport = new DataSet();
     try
     {
         string appPath = "";
         appPath = Directory.GetCurrentDirectory() + "\\" + globalConstants.CashierLogXML;
         dsTempReport.ReadXml(@appPath);
         //prepare report for preview                
         ReportCashierLog rptXMLReport = new ReportCashierLog();
         CrystalDecisions.CrystalReports.Engine.TextObject txtReportHeader1, txtReportHeader2;
         txtReportHeader1 = rptXMLReport.ReportDefinition.ReportObjects["NamaTokoLabel"] as TextObject;
         txtReportHeader2 = rptXMLReport.ReportDefinition.ReportObjects["InfoTokoLabel"] as TextObject;
         //baca database untuk nama toko
         String nama, alamat, telepon, email;
         if (!gutil.loadinfotoko(2, out nama, out alamat, out telepon, out email))
         {
             //reset default opsi = 1
             if (!gutil.loadinfotoko(1, out nama, out alamat, out telepon, out email))
             {
                 nama = "TOKO DEFAULT";
                 alamat = "ALAMAT DEFAULT";
                 telepon = "0271-XXXXXXX";
                 email = "*****@*****.**";
             }
         }
         txtReportHeader1.Text = nama;
         txtReportHeader2.Text = alamat + Environment.NewLine + telepon + Environment.NewLine + email;
         rptXMLReport.Database.Tables[0].SetDataSource(dsTempReport.Tables[0]);
         crystalReportViewer1.ReportSource = rptXMLReport;
         crystalReportViewer1.Refresh();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Exemplo n.º 2
0
 public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() {
     ReportCashierLog rpt = new ReportCashierLog();
     rpt.Site = this.Site;
     return rpt;
 }