{*******************************************************} { } { Responsive Software http://www.responsive.co.nz } { } { Copyright (c) 2003-2006 Responsive Software Limited } { } {*******************************************************} unit GraphReportUnit; interface uses Windows, SysUtils, Messages, Classes, Graphics, Controls, StdCtrls, ExtCtrls, Forms, QuickRpt, QRCtrls, DatabaseObjects, Utilities, GeneralUtilities, TeeProcs, TeEngine, Chart, DbChart, QRTEE; type TGraphReport = class(TQuickRep) TitleBand1: TQRBand; PageFooterBand1: TQRBand; CompanyNameQRLabel: TQRLabel; QRShape1: TQRShape; QRLabel4: TQRLabel; QRShape3: TQRShape; ReportFooterQRLabel: TQRLabel; QRShape2: TQRShape; CompanyQRLabel: TQRLabel; PeriodQRLabel: TQRLabel; DateQRLabel: TQRLabel; QRDBChart1: TQRDBChart; QRChart: TQRChart; procedure QuickRepBeforePrint(Sender: TCustomQuickRep; var PrintReport: Boolean); procedure QuickRepAfterPreview(Sender: TObject); private public CompanyId : int64; UseBeginPeriod : boolean; BeginPeriodDate : TDateTime; UseEndPeriod : boolean; EndPeriodDate : TDateTime; end; var GraphReport: TGraphReport; implementation uses Globals, DatabaseManager; {$R *.DFM} procedure TGraphReport.QuickRepBeforePrint(Sender: TCustomQuickRep; var PrintReport: Boolean); begin QuickReportOpen := true; ReportFooterQRLabel.Caption := ReportFooterString; CompanyNameQRLabel.Caption := GlobalConfiguration.CompanyName; if CompanyId = 0 then CompanyQRLabel.Caption := '' else CompanyQRLabel.Caption := 'Company :- ' + CompanyName(CompanyId); DateQRLabel.Caption := 'Printed on :- ' + FormatDate(Date); if (not UseBeginPeriod) and (not UseEndPeriod) then PeriodQRLabel.Caption := 'Period :- All entries' else if (UseBeginPeriod) and (not UseEndPeriod) then PeriodQRLabel.Caption := 'Period :- Beginning ' + FormatDate(BeginPeriodDate) else if (not UseBeginPeriod) and (UseEndPeriod) then PeriodQRLabel.Caption := 'Period :- Ending ' + FormatDate(EndPeriodDate) else PeriodQRLabel.Caption := 'Period :- ' + FormatDate(BeginPeriodDate) + ' to ' + FormatDate(EndPeriodDate); QRChart.Chart.Title.Visible := false; QRChart.Chart.AxisVisible := false; QRChart.Chart.View3D := false; QRChart.Chart.Legend.Visible := false; QRChart.Chart.Frame.Visible := false; QRChart.Chart.BevelOuter := bvNone; QRChart.Chart.AllowZoom := false; DisplayGraph( TChart(QRChart.Chart), CompanyId, UseBeginPeriod, BeginPeriodDate, UseEndPeriod, EndPeriodDate, true, true); end; procedure TGraphReport.QuickRepAfterPreview(Sender: TObject); begin QuickReportOpen := false; end; end.