unit fmuDemo;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  ExtCtrls, StdCtrls, ComCtrls,
  //
  untUtil,
  untType,
  xObj;

type

  { TfmDemo }

  TfmDemo = class(TForm)
    btnClose: TButton;
    Example1: TButton;
    Example2: TButton;
    Example3: TButton;
    Bevel1: TBevel;
    imgLogo: TImage;
    imgHand: TImage;
    btnShowProperties: TButton;
    chbDeviceEnabled: TCheckBox;
    chbShowOnStart: TCheckBox;
    pnlDemoDescription: TPanel;
    lblDemoDescription: TLabel;
    lblDemo: TLabel;
    ImgFwl: TImage;
    Example4: TButton;
    procedure btnCloseClick(Sender: TObject);
    procedure Example1Click(Sender: TObject);
    procedure Example2Click(Sender: TObject);
    procedure Example3Click(Sender: TObject);
    procedure btnShowPropertiesClick(Sender: TObject);
    procedure chbDeviceEnabledClick(Sender: TObject);
    procedure Example4Click(Sender: TObject);
  private
    FDriver: TObjX;
    fSaveRaiseException: Boolean;
    procedure PerformInitTask;
    procedure UpdateControls;
  public
    procedure ClearProps;
    procedure Init(ADriver: TObjX; AFont: TFont; AShowOnStart: Boolean);
    procedure Done(var AShowOnStart: Boolean);
    property Driver: TObjX read FDriver;
  end;

procedure ExecuteDemoDialog(ADriver: TObjX; AShowMessage: Boolean; AFont: TFont; var AShowOnStart: Boolean);

implementation

{$R *.DFM}

procedure ExecuteDemoDialog(ADriver: TObjX; AShowMessage: Boolean; AFont: TFont; var AShowOnStart: Boolean);
var
  fm: TfmDemo;
begin
  fm := TfmDemo.Create(nil);
  try
    with fm do
    begin
      Init(ADriver, AFont, AShowOnStart);
      ShowModal;
      Done(AShowOnStart);
    end;

  finally
    fm.Free;
  end;
end;

procedure TfmDemo.Init(ADriver: TObjX;  AFont: TFont; AShowOnStart: Boolean);
begin
  FDriver := ADriver;
  Font := AFont;
  FDriver.ControlInterface.RaiseException := True;
  chbShowOnStart.Checked := AShowOnStart;
  fSaveRaiseException := FDriver.ControlInterface.RaiseException;
  try
    FDriver.ControlInterface.DeviceEnabled := True
  except
    {}
  end;
  ClearProps;
  UpdateControls;
end;

procedure TfmDemo.Done(var AShowOnStart: Boolean);
begin
  ClearProps;
  AShowOnStart := chbShowOnStart.Checked;
end;

procedure TfmDemo.ClearProps;
var
  V: OleVariant;
begin
  V := FDriver.ControlInterface;
  V.ClearTask;
  V.ResetPrintSettings;
  V.RaiseException := fSaveRaiseException;
end;

procedure TfmDemo.btnCloseClick(Sender: TObject);
begin
  Close;
end;

procedure TfmDemo.PerformInitTask;
var
  V: OleVariant;
begin
  V := FDriver.ControlInterface;
  V.ClearTask;
  V.Copies := 1;
  V.BackgroundPrint := False;
  V.ShowProgress := True;
  V.ResetPrintSettings;
end;

procedure TfmDemo.Example1Click(Sender: TObject);
//   ()
var
  str: String;
  I, J: Integer;
  fnLogo, fnHand: String;
  V: OleVariant;
begin
  PerformInitTask;
  V := FDriver.ControlInterface;
  str := '';
  V.ClearTask;
  //     
  V.FontDblHeight := True;
  //     
  V.FontDblWidth := True;
  //    
  V.FontNegative := True;
  //       
  I := round((V.CapCharCount - 17)/2);
  J := round(int((V.CapCharCount - 17)/2));
  str := stringofchar(' ', I) + string(' !') + stringofchar(' ',j);
  //       
  V.Caption := str;
  V.AddText;
  //        
  V.FontDblHeight:= False;
  V.FontDblWidth:= False;
  V.FontNegative:= False;
  //      ,  ,  
  V.Caption := ' ';
  V.AddText;
  //  :    
  fnLogo := GenerateTempPictureFileName;
  V.FileName := fnLogo;
  //     
  V.Alignment := 0;
  imgLogo.Picture.SaveToFile(V.FileName); //'atollogo.bmp';
  //    
  V.AddPicture;
  //     
  V.Alignment := 2;
  //        
  V.TextNewLine := False;
  //  
  V.Caption := ' Web- : ';
  V.AddText;
  //   
  V.FontUnderLine := True;
  //   
  V.FontBold := True;
  //  
  V.Caption := 'www.atol.ru';
  V.AddText;
  //   
  V.FontBold := False;
  //       
  V.TextNewLine := True;
  //   
  V.FontUnderLine := False;
  //  
  V.Caption :='    ';
  V.AddText;
  //   
  V.TextNewLine := False;
  V.Caption := ' : ';
  V.AddText;
  V.FontUnderLine := True;
  V.FontBold := True;
  V.Caption := 'info@atol.ru';
  V.AddText;
  V.FontBold := False;
  V.TextNewLine := True;
  V.FontUnderLine := False;
  V.Caption := '   ';
  V.AddText;
  V.TextNewLine := False;
  V.Caption := ' : ';
  V.AddText;
  V.TextNewLine := True;
  V.FontUnderLine := True;
  V.FontBold := True;
  V.Caption := 'support@atol.ru';
  V.AddText;
  V.FontBold := False;
  V.FontUnderLine := False;
  V.caption := ' ';
  V.Addtext;
  V.FontDblHeight := True;
  V.FontDblWidth := True;
  V.TextNewLine := False;
  //     
  V.Alignment := 0;
  V.Caption := '';
  V.AddText;
  V.TextNewLine := True;
  V.FontBold := True;
  V.FontDblWidth := False;
  V.Caption := ' :   ';
  V.AddText;
  V.FontDblHeight := False;
  V.FontBold := False;
  //     
  str:=V.Version;
  //   
  V.Caption := '  : ' + str;
  V.AddText;
  //   
  str:=V.ServerVersion;
  V.Caption := ' c  : ' + str;
  V.AddText;
  V.Caption := ' ';
  V.Addtext;
  //      
  str := '';
  For i := 1 to V.CapCharCount do
  str := str + '=';
  V.caption := str;
  V.Addtext;
  V.caption := ' ';
  V.Addtext;
  //    
  V.Alignment := 1;
  V.Caption := '   :';
  V.FontDblWidth := True;
  V.FontDblHeight := False;
  V.AddText;

  V.Caption := 'www.atol.ru';
  V.FontDblHeight := True;
  V.FontUnderLine := True;
  V.AddText;
  fnHand := GenerateTempPictureFileName;
  V.FileName := fnHand;
  imgHand.Picture.SaveToFile(V.FileName); //'hand.bmp';
  V.AddPicture;
  V.FontDblHeight := False;
  V.FontUnderLine := False;
  V.caption := ' ';
  V.Addtext;
  V.caption := str;
  V.FontDblWidth := False;
  V.Addtext;
  V.FeedValue := 4;
  V.AddFeed;
  if V.CapCutFull or V.CapCutPart then V.AddCut;

  DeleteFile(fnLogo);
  DeleteFile(fnHand);

  V.PrintTask;
end;

procedure TfmDemo.Example2Click(Sender: TObject);
//    ,    
var
  i, k, j: Integer;
  str, str1, str2: String;
  fnLogo, fnHand: String;
  V: OleVariant;
begin
  PerformInitTask;
  V := FDriver.ControlInterface;

  // ,     ,   
  if V.CapFontDblWidth then V.FontDblWidth:= True;
  //   ,   
  if V.CapFontNegative then V.FontNegative := True;
  //      
  str1 := ' ' + V.DeviceDescription;
  j := length(str1);
  str := '';
  i := round((V.CapCharCount - j)/2);
  k := round(int((V.CapCharCount - j)/2));
  str := stringofchar(' ', i) + str1+stringofchar(' ', k);
  V.Caption := str;
  V.Alignment := 1;
  V.AddText;
  //      ,    
  if V.CapFontDblWidth then V.FontDblWidth := False;
  if V.CapFontNegative then V.FontNegative := False;
  V.Caption := ' :';
  V.AddText;
  //      LPT,   
  if V.CapPortLPT then
  begin
     V.Caption := ' LPT-.';
     V.AddText;
  end;
  //    COM
  if V.CapPortCOM then
  begin
     V.Caption := ' COM-.';
     V.AddText;
  end;
  V.Caption := '  :';
  V.AddText;
  str :='';
  //         
  str1 := V.CapBaudRateList;
  For i := 1 to length(str1) do
  begin
     if str1[i]<>';' then str := str+str1[i]
     else
     begin
      str2 := BaudrateToStr[IntToEnumBaudRate(StrToInt(str))];
      {if str = '3' then str2 := '1200 ' else
        if str = '4' then str2 := '2400 ' else
          if str = '5' then str2 := '4800 ' else
            if str = '7' then str2 := '9600 ' else
              if str = '10' then str2 := '19200 ' ;}
      V.Caption := ' ' + str + ' - ' + str2;
      V.AddText;
      str := '';
     end;
  end;
  //     
  if V.CapFeed then
  begin
     V.Caption := '.';
     V.AddText;
  end;
  //  
  if V.CapFeedBiDirectional then
  begin
     V.Caption := ' .';
     V.AddText;
  end;
  // 
  if V.CapCutFull then
  begin
     V.Caption := ' .';
     V.AddText;
  end;
  //   
  if V.CapCutPart then
  begin
     V.Caption := ' .';
     V.AddText;
  end;
  //       
  if V.CapDrawer then
  begin
     V.Caption := '   .';
     V.AddText;
  end;
  //     
  if V.CapBeep then
  begin
     if V.CapFontNegative then	V.FontNegative := True;
     V.Caption := ' .';
     V.AddText;
     if V.CapFontNegative then V.FontNegative := False;
     V.AddBeep;
  end;
  //      
  str := inttostr(V.CapColorCount);
  V.Caption := '  : ' + str;
  V.AddText;
  //     
  str:=inttostr(V.CapFontCount);
  V.Caption := '  : '+str;
  V.AddText;
  //   
  for i := 0 to (V.CapFontCount-1) do
  begin
     //      ,    6
     if I = 6 then
     begin
       V.FontIndex := i;
       V.Caption := ' ...';
       V.AddText;
       break;
     end;

     V.FontIndex := i;
     V.Caption := '  ' + inttostr(i);
     V.AddText;
     //        
     str := V.CapCharCount;
     V.Caption := '      - ' + str;
     V.AddText;
  end;
  V.FontIndex := 0;
  //       ,     
  if (V.CapSlipClamp) or (V.CapSlipRelease) or (V.CapSlipFeedBackward) or (V.CapSlipFeedForward) then
  begin
    V.Caption := '    :';
    V.AddText;
  end;
  //   :  
  if V.CapSlipClamp then
  begin
     V.Caption := ' .';
     V.AddText;
  end;
  //  
  if V.CapSlipRelease then
  begin
     V.Caption := ' .';
     V.AddText;
  end;
  //      
  if V.CapSlipFeedBackward then
  begin
     V.Caption := '    .';
     V.AddText;
  end;
  //      
  if V.CapSlipFeedForward then
  begin
     V.Caption := '    .';
     V.AddText;
  end;
  // ????????????????????  ,     
  //     :   
  if V.CapStationReceipt then
  begin
     V.Caption := '   .';
     V.AddText;
  end;
  //    
  if V.CapStationJournal then
  begin
     V.Caption := '   .';
     V.AddText;
  end;
  //   
  if V.CapStationSlip then
  begin
     V.Caption := '  .';
     V.AddText;
  end;
  //      -
  if V.CapPicture then
  begin
    //     
    i := V.CapCharCount;
    str := stringofchar('=', i);
    V.Caption := str;
    V.AddText;
    //  
    V.Alignment := 1;
    if V.CapFontNegative then	V.FontNegative := true;
    V.Caption := ' :';
    V.AddText;
    if V.CapFontNegative then	V.FontNegative := false;
    //  
    fnLogo := GenerateTempPictureFileName;
    V.FileName := fnLogo;
    imgLogo.Picture.SaveToFile(V.FileName); //'Logo.bmp';
    V.AddPicture;
    //   
    str := inttostr(V.CapPictureWidth);
    V.Caption := '   - ' + str + ' ';
    V.AddText;
    //  
    V.Caption := '   -';
    V.AddText;
    V.Caption := 'EAN-8';
    V.AddText;
    // EAN-8
    V.Caption := '12345670';
    // ,        -
    V.BarCodeControlCode := true;
    // ,       -
    V.BarCodePrintText := true;
    //   -
    V.BarCodeHeight := 229;
    // ,    EAN  UPC 
    V.BarCodeType := 0;
    //  -
    V.AddBarCode;
    V.Caption := 'EAN-13';
    V.AddText;
    //  EAN-13
    V.Caption := '1234567890128';
    V.AddBarCode;
    V.Caption := 'UPC';
    V.AddText;
    //  UPC
    V.Caption := '123456789012';
    V.AddBarCode;
    V.Caption := 'Code 39';
    V.AddText;
    //  CODE 39
    V.Caption := '456F-.';
    // ,       Code 39
    V.BarCodeType := 1;
    V.AddBarcode;

    V.Caption := '   -';
    V.AddText;
    V.Caption := ' ';
    V.AddText;
    fnHand := GenerateTempPictureFileName;
    V.FileName := fnHand;
    imgHand.Picture.SaveToFile(V.FileName); //'hand.bmp';
    // ,    
    V.Rotation := 0;
    V.AddPicture;
    V.Caption := '  90 ';
    V.AddText;
    //    90    
    V.Rotation := 1;
    V.AddPicture;
    V.Caption := '  180 ';
    V.AddText;
    //   180 
    V.Rotation := 2;
    V.AddPicture;
    V.Caption := '  270 ';
    V.AddText;
    //   270 
    V.Rotation := 3;
    V.AddPicture;
    V.Caption := ' ';
    V.AddText;

    V.Rotation := 0;
    V.Alignment := 0;
  end;

  V.Alignment := 1;
  i:=V.CapCharCount;
  V.Caption := stringofchar('=',i);
  V.AddText;
  V.Caption := '  :';
  V.AddText;
  //      
  if V.CapLineSpacing then
  begin
     V.LineSpacing := 30;
     V.Caption := '  .';
     V.AddText;
     V.LineSpacing := 80;
     V.Caption := '  .';
     V.AddText;
     V.LineSpacing := 40;
  end;
  //   
  if V.CapFontBold then
  begin
     V.Caption := ' ';
     V.FontBold := true;
     V.AddText;
     V.FontBold := false;
  end;
  //  
  if V.CapFontItalic then
  begin
     V.Caption := '.';
     V.FontItalic := True;
     V.AddText;
     V.FontItalic := false;
  end;
  //  
  if V.CapFontDblHeight then
  begin
     V.Caption := '  .';
     V.FontDblHeight := true;
     V.AddText;
     V.FontDblHeight := false;
  end;
  //  
  if V.CapFontDblWidth then
  begin
     V.Caption := ' .';
     V.FontDblWidth := True;
     V.AddText;
     V.FontDblWidth := false;
  end;
  // 
  if V.CapFontOverLine then
  begin
     V.Caption := '.';
     V.FontOverLine := true;
     V.AddText;
     V.FontOverLine := false;
  end;
  // 
  if V.CapFontUnderLine then
  begin
     V.Caption := '.';
     V.FontUnderLine := true;
     V.AddText;
     V.FontUnderLine := false;
  end;
  // 
  if V.CapFontNegative then
  begin
    V.Caption := '.';
    V.FontNegative := true;
    V.AddText;
    V.FontNegative := false;
  end;
  //   
  if V.CapTextUpSideDown then
  begin
     V.Caption := ' .';
     V.TextUpSideDown := true;
     V.AddText;
     V.TextUpSideDown := false;
  end;
  //   
  if V.CapZeroSlashed then
  begin
     V.Caption := '  (0)';
     V.ZeroSlashed := true;
     V.AddText;
     V.ZeroSlashed := false;
  end;
  //        ()
  V.Caption := '   ';
  if V.CapFontBold then V.FontBold := true;
  if V.CapFontDblHeight then V.FontDblHeight := true;
  if V.CapFontDblWidth then V.FontDblWidth := true;
  if V.CapFontOverLine then V.FontOverLine := true;
  if V.CapFontUnderLine then V.FontUnderLine := true;
  if V.CapTextUpSideDown then V.TextUpSideDown := true;
  V.AddText;
  //  
  if V.CapFontBold then V.FontBold := false;
  if V.CapFontDblHeight then V.FontDblHeight := false;
  if V.CapFontDblWidth then V.FontDblWidth := false;
  if V.CapFontOverLine then V.FontOverLine := false;
  if V.CapFontUnderLine then V.FontUnderLine := false;
  if V.CapTextUpSideDown then V.TextUpSideDown := false;
  V.Caption := ' ,   -';
  V.AddText;
  V.Caption := '  ';
  V.alignment := 2;
  V.AddText;
  V.Caption := ' ';
  V.alignment := 1;
  V.AddText;
  V.Caption := '  ';
  V.alignment := 0;
  V.AddText;
  V.Caption := '  :';
  V.addtext;
  //     
  if length(V.CapCharRotationList)=0 then
  begin
     V.Caption := ' ';
     V.AddText;
  end
  else
  begin
    str:=V.CapCharRotationList;
    for i := 1 to length(str)do
    begin
      case str[i] of
      '1' : begin
              V.CharRotation := 1;
              V.Caption := ' 90 ';
              V.Addtext;
            end;
      '2' : begin
              V.CharRotation := 2;
              V.Caption := ' 180 ';
              V.Addtext;
            end;
      '3' : begin
              V.CharRotation := 3;
              V.Caption := ' 270 ';
              V.Addtext;
            end;
      end;
      V.CharRotation := 0;
    end;
  end;

  V.FeedValue := 8;
  V.AddFeed;
  if V.CapCutFull or V.CapCutPart then V.AddCut;

  DeleteFile(fnLogo);
  DeleteFile(fnHand);         

  V.PrintTask;
end;

procedure TfmDemo.Example3Click(Sender: TObject);
//  
var
  I: Integer;
  V: OleVariant;
begin
  PerformInitTask;
  V := FDriver.ControlInterface;

  //  
  i := V.CapCharCount;
  V.Caption := stringofchar('=', i);
  V.AddText;
  //    , ,    
  V.Alignment := 1;
  V.FontDblHeight := True;
  V.FontDblWidth := True;
  V.FontBold := true;
  V.Caption := '  000033';
  V.AddText;
  //  
  V.Alignment := 0;
  V.FontDblHeight := false;
  V.FontDblWidth := false;
  V.FontBold := false;
  V.Caption := stringofchar('=',i);
  V.AddText;
  //          ( )
  V.TextNewLine := false;
  V.Caption := ' : ';
  V.AddText;
  V.TextNewLine := true;
  V.FontBold := true;
  V.Caption := '  ';
  V.AddText;

  V.FontBold := false;
  V.TextNewLine := false;
  V.Caption := '     : ';
  V.AddText;
  V.TextNewLine := true;
  V.FontBold := true;
  V.Caption := ' 10   2';
  V.AddText;
  V.FontBold := false;
  V.TextNewLine := false;
  V.Caption := '     : ';
  V.AddText;
  V.TextNewLine := false;
  V.FontBold := true;
  V.Caption := '06.09.02';
  V.AddText;
  V.FontBold := false;
  V.Caption := '     : ';
  V.AddText;
  V.FontBold := true;
  V.Caption := '19:17:32';
  V.TextNewLine := true;
  V.AddText;
  V.FontBold := false;
  V.Caption := stringofchar('=',i);
  V.AddText;
  //        ,   
  V.FontBold := true;
  V.Caption := '   ';
  V.AddText;
  V.Alignment := 2;
  V.Caption := '     -         ';
  V.AddText;
  V.FontBold := false;
  V.Caption := stringofchar('=',i);
  V.AddText;
  //           
  V.Alignment := 0;
  V.Caption := ' ';
  V.AddText;
  V.Alignment := 2;
  V.Caption := '54.00  *   7.000   =    378.00';
  V.AddText;
  V.Alignment := 0;
  V.Caption := '  ';
  V.AddText;
  V.Alignment := 2;
  V.Caption := '63.00  *   7.000   =    441.00';
  V.AddText;
  V.Alignment := 0;
  V.Caption := ' ';
  V.AddText;
  V.Alignment := 2;
  V.Caption := '63.00  *   8.000   =    504.00';
  V.AddText;
  V.Alignment := 0;
  V.Caption := '  ';
  V.AddText;
  V.Alignment := 2;
  V.Caption := '68.00  *   4.000   =    272.00';
  V.AddText;
  V.Alignment := 0;
  V.Caption := '  ';
  V.AddText;
  V.Alignment := 2;
  V.Caption := '58.00  *   7.000   =    406.00';
  V.AddText;
  V.Caption := stringofchar('=',i);
  V.AddText;
  V.FontDblHeight := true;
  V.FontBold := true;
  V.Alignment := 2;
  V.Caption := '   :      2 001.00';
  V.AddText;
  V.Caption := '   :        210.00';
  V.AddText;
  V.Caption := '   :      1 791.00';
  V.AddText;
  V.FontBold := false;
  V.FontDblHeight := false;
  V.Caption := stringofchar('=',i);
  V.AddText;

  V.FeedValue := 4;
  V.AddFeed;
  if V.CapCutFull or V.CapCutPart then V.AddCut;

  V.PrintTask;
end;

procedure TfmDemo.Example4Click(Sender: TObject);
//  
var
  I: Integer;
  V: OleVariant;
  fnLogo, fnFwl: String;
begin
  PerformInitTask;
  V := FDriver.ControlInterface;
  //
  V.FontIndex := 0;
  i := V.CapCharCount;
  V.Caption := StringOfChar('*',i);
  V.AddText;
  //  :    
  V.Alignment := 0;
  V.AutoSize := False;
  fnLogo := GenerateTempPictureFileName;
  V.FileName := fnLogo;
  imgLogo.Picture.SaveToFile(V.FileName); //'atollogo.bmp';
  V.AddPicture;
  //
  V.Alignment := 1;
  V.Caption := '-';
  V.AddText;
  V.Caption := StringOfChar('*',i);
  V.AddText;
  V.Caption := '  ';
  V.AddText;
  V.Caption := ' ';
  V.AddText;
  //  :    
  V.AutoSize := True;
  fnFwl := GenerateTempPictureFileName;
  V.FileName := fnFwl;
  imgFwl.Picture.SaveToFile(V.FileName); //'Artimida-011.bmp';
  V.AddPicture;
  //
  V.Caption := ' ';
  V.AddText;
  V.FontDblHeight := True;
  V.Alignment := 0;
  i := V.CapCharCount;
  V.Caption := ':'+StringOfChar(' ',i-7-12)+' ..';
  V.AddText;
  V.LineSpacing := V.LineSpacing*3;
  V.Caption := ' :'+StringOfChar(' ',i-7-8)+'00003421';
  V.AddText;
  V.FontDblHeight := False;
  V.LineSpacing := V.LineSpacing/3;
  V.FontBold := True;
  V.FontUnderLine := True;
  V.Caption := '';
  V.AddText;
  V.FontBold := False;
  V.FontUnderLine := False;
  V.Caption := '     -3';
  V.AddText;
  V.Alignment := 2;
  V.Caption := '2.000 X   75,00   =150,00.';
  V.AddText;
  V.Alignment :=0;
  V.Caption := '     ';
  V.AddText;
  V.Alignment := 2;
  V.Caption := '1.000 X   80,00    =80,00.';
  V.AddText;
  V.Alignment :=0;
  V.Caption := '      25 ';
  V.AddText;
  V.Alignment := 2;
  V.Caption := '1.000 X  360,00   =360,00.';
  V.AddText;
  V.Alignment :=0;
  V.Caption := '    750 ';
  V.AddText;
  V.Alignment := 2;
  V.Caption := '1.000 X   60,00    =60,00.';
  V.AddText;
  V.Alignment := 0;
  V.FeedValue := 1;
  V.AddFeed;
  V.FontDblHeight := True;
  V.FontDblWidth := True;
  V.FontNegative := True;
  V.FontBold := True;
  i := V.CapCharCount;
  V.LineSpacing := V.LineSpacing*2;
  V.Caption := ' '+StringOfChar(' ',i-5-9)+'=650,00.';
  V.AddText;
  V.FontNegative := False;
  V.FontDblHeight := False;
  V.FontBold := False;
  V.LineSpacing := V.LineSpacing/2;
  V.Caption := ' '+StringOfChar(' ',i-10-9)+'=700,00.';
  V.AddText;
  i := V.CapCharCount;
  V.Caption := ' '+StringOfChar(' ',i-6-8)+'=50,00.';
  V.AddText;
  V.FontDblWidth := False;
{  Prn.FeedValue := 1;
  Prn.AddFeed;}
  V.Caption := ' ';
  V.AddText;
  i := V.CapCharCount;
  V.Caption := StringOfChar('=',i);
  V.AddText;
  V.Caption := '  0038'+StringOfChar(' ',i-15-25)+':27-09-02  16:01';
  V.AddText;
  V.Caption := StringOfChar('=',i);
  V.AddText;
  V.FeedValue := 1;
  V.AddFeed;
  V.Alignment := 1;
  V.BarcodeType := 1;
//  Prn.BarcodeControlCode :=False;
  V.BarcodeHeight := 200;
  V.BarcodePrintText := True;
  V.Caption := '16010038270902093';
  V.AddBarcode;
{  Prn.FeedValue := 1;
  Prn.AddFeed;}
  V.Caption := ' ';
  V.AddText;
  V.Caption := StringOfChar('*',i);
  V.AddText;
  V.FontDblWidth := True;
  V.FontUnderLine := True;
  V.Alignment := 1;
  V.Caption := 'www.atol.ru';
  V.AddText;
  If V.CapCutPart then
  begin
    V.CutValue := 4;
    V.AddCut;
  end;

  DeleteFile(fnLogo);
  DeleteFile(fnFwl);
  V.PrintTask;
end;

procedure TfmDemo.UpdateControls;
var
  V: OleVariant;
begin
  V := FDriver.ControlInterface;
  SafeSetChecked(chbDeviceEnabled, V.DeviceEnabled);
  if V.DeviceEnabled then
  begin
    lblDemo.Visible := True;
    lblDemoDescription.Visible := V.IsDemo;
    if V.IsDemo then lblDemo.Caption := '   ' else lblDemo.Caption := '  -  ';
  end
  else
  begin
    lblDemo.Visible := False;
    lblDemoDescription.Visible := False;
  end;
end;

procedure TfmDemo.btnShowPropertiesClick(Sender: TObject);
begin
  try
    FDriver.ControlInterface.ShowProperties;
  finally
    UpdateControls;
  end;
end;

procedure TfmDemo.chbDeviceEnabledClick(Sender: TObject);
begin
  try
    FDriver.ControlInterface.DeviceEnabled := chbDeviceEnabled.Checked;
  finally
    UpdateControls;
  end;
end;

end.
