home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1997 May / Pcwk0597.iso / delphi / cbsuite.lzh / SU1SRC.ZIP / REPDEM02.PAS < prev    next >
Pascal/Delphi Source File  |  1996-12-01  |  2KB  |  74 lines

  1. unit Repdem02;
  2.  
  3. interface
  4.  
  5. uses
  6.   SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  7.   StdCtrls, Forms, DBCtrls, DB, DBGrids, Buttons, DBTables, Grids,
  8.   ExtCtrls, Printers,  CB_Types, PrnGridR, CB_MFunc;
  9.  
  10. type
  11.   Tdem02form = class(TForm)
  12.     DBGrid1: TDBGrid;
  13.     Panel1: TPanel;
  14.     DataSource1: TDataSource;
  15.     Panel2: TPanel;
  16.     Query1: TQuery;
  17.     Query1CustNo: TFloatField;
  18.     Query1Company: TStringField;
  19.     Query1Country: TStringField;
  20.     Query1Phone: TStringField;
  21.     Query1Contact: TStringField;
  22.     Previews: TBitBtn;
  23.     Exit: TBitBtn;
  24.     Preview: TBitBtn;
  25.     Query1LastInvoiceDate: TDateTimeField;
  26.     Memo1: TMemo;
  27.     PrintGridReport1: TPrintGridReport;
  28.     procedure FormCreate(Sender: TObject);
  29.     procedure PreviewClick(Sender: TObject);
  30.     procedure PreviewsClick(Sender: TObject);
  31.     procedure ExitClick(Sender: TObject);
  32.   private
  33.     { private declarations }
  34.   public
  35.   end;
  36.  
  37. var
  38.   dem02form: Tdem02form;
  39.  
  40. implementation
  41.  
  42. {$R *.DFM}
  43.  
  44. procedure Tdem02form.FormCreate(Sender: TObject);
  45. begin
  46.   Query1.Open;
  47.   PrintGridReport1.Orientation := Portrait;
  48.  
  49.   { When printing subtotals - Use field COUNTRY }
  50.   PrintGridReport1.SetSubTotalField(1, 'COUNTRY','Country');
  51.   PrintGridReport1.SetPrintTotal('CustNo', False);
  52.  
  53. end;
  54.  
  55. procedure Tdem02form.PreviewClick(Sender: TObject);
  56. begin
  57.     PrintGridReport1.PrintSubTotals := False;
  58.    PrintGridReport1.GridLines := True;
  59.     PrintGridReport1.Execute;
  60. end;
  61.  
  62. procedure Tdem02form.PreviewsClick(Sender: TObject);
  63. begin
  64.     PrintGridReport1.PrintSubTotals := True;
  65.     PrintGridReport1.Execute;
  66. end;
  67.  
  68. procedure Tdem02form.ExitClick(Sender: TObject);
  69. begin
  70.     Close;
  71. end;
  72.  
  73. end.
  74.