home *** CD-ROM | disk | FTP | other *** search
- unit Rep;
-
- interface
-
- uses
- Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
- vivrep20, ComCtrls, Db, DBTables;
-
- type
- TRepForm = class(TForm)
- VividReport: TVividReport;
- VRPrintProgress: TVRPrintProgress;
- VRPreview: TVRPreview;
- VRPage1: TVRPage;
- VRPage2: TVRPage;
- VRBand1: TVRBand;
- VRBand2: TVRBand;
- VRBand3: TVRBand;
- VRBand4: TVRBand;
- VRBand5: TVRBand;
- TargetLabel: TVRLabel;
- FromLabel: TVRLabel;
- BarcodeLabel: TVRLabel;
- LogoLabel: TVRLabel;
- BrandLabel: TVRLabel;
- PrnTable: TTable;
- PrnSource: TDataSource;
- PrnTableContact: TStringField;
- PrnTableCompany: TStringField;
- PrnTableAddress: TStringField;
- PrnTableCity: TStringField;
- PrnTableState: TStringField;
- PrnTableZip: TStringField;
- PrnTableCountry: TStringField;
- PrnTableTarget: TStringField;
-
- procedure PrnTableTargetGetText(Sender: TField; var Text: String; DisplayText: Boolean);
- procedure VividReportBeginPrint(Sender: TObject; var APrint: TBeforeAction);
- procedure VRPage2BeforePrint(Sender: TObject; var APrint: TBeforeAction);
- private
- { Private declarations }
- public
- { Public declarations }
- constructor Create (AOwner: TComponent); override;
- end;
-
- var
- RepForm: TRepForm;
-
- implementation
-
- uses Main;
-
- {$R *.DFM}
-
- constructor TRepForm.Create (AOwner: TComponent);
- begin
- inherited Create (AOwner);
- PrnTable.Active:= true;
- end;
-
- procedure TRepForm.PrnTableTargetGetText(Sender: TField; var Text: String; DisplayText: Boolean);
- begin
- Text := PrnTableContact.AsString + #13#10 + PrnTableCompany.AsString + #13#10 +
- PrnTableAddress.AsString + #13#10 +
- PrnTableCity.AsString + ', ' + PrnTableState.AsString + ' ' +
- PrnTableZip.AsString + #13#10 + PrnTableCountry.AsString;
- end;
-
- procedure TRepForm.VividReportBeginPrint(Sender: TObject; var APrint: TBeforeAction);
- begin
- (FromLabel.Data as TAbsString).Value := MainForm.FromEdit.Lines.Text;
- (LogoLabel.Data as TAbsPicture).Picture := MainForm.LogoImage.Picture;
- end;
-
- procedure TRepForm.VRPage2BeforePrint(Sender: TObject; var APrint: TBeforeAction);
- var
- BarText: string;
- I: Integer;
- begin
- BarText := PrnTableZip.AsString;
-
- I := 1;
- while I <= Length (BarText) do
- begin
- if IsDelimiter ('0123456789',BarText,I) then Inc (I)
- else Delete (BarText,I,1);
- end;
-
- if (Length (BarText) = 5) or (Length (BarText) = 9) then
- begin
- (BarcodeLabel.Data as TAbsBarCode).Code.Text := BarText;
- (BarcodeLabel.Data as TAbsBarCode).ModuleUHeight := 3.3;
- end else (BarcodeLabel.Data as TAbsBarCode).ModuleUHeight := 0;
-
- end;
-
- end.
-