unit yuyue;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, XPButton, StdCtrls, jpeg, ExtCtrls, DB, ADODB,printers;

type
  TFyuyue = class(TForm)
    Image1: TImage;
    Label2: TLabel;
    Edit1: TEdit;
    XPButton13: TXPButton;
    XPButton4: TXPButton;
    XPButton8: TXPButton;
    XPButton9: TXPButton;
    XPButton10: TXPButton;
    XPButton11: TXPButton;
    XPButton5: TXPButton;
    XPButton6: TXPButton;
    XPButton7: TXPButton;
    XPButton12: TXPButton;
    XPButton1: TXPButton;
    Label1: TLabel;
    XPButton2: TXPButton;
    Timer1: TTimer;
    XPButton3: TXPButton;
    ADOQuery1: TADOQuery;
    procedure XPButton2Click(Sender: TObject);
    procedure XPButton13Click(Sender: TObject);
    procedure XPButton4Click(Sender: TObject);
    procedure XPButton5Click(Sender: TObject);
    procedure XPButton6Click(Sender: TObject);
    procedure XPButton7Click(Sender: TObject);
    procedure XPButton8Click(Sender: TObject);
    procedure XPButton9Click(Sender: TObject);
    procedure XPButton10Click(Sender: TObject);
    procedure XPButton11Click(Sender: TObject);
    procedure XPButton12Click(Sender: TObject);
    procedure Timer1Timer(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure XPButton3Click(Sender: TObject);
    procedure XPButton1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Fyuyue: TFyuyue;

implementation

{$R *.dfm}
uses main;

procedure TFyuyue.XPButton2Click(Sender: TObject);
begin
  edit1.Clear ;
end;

procedure TFyuyue.XPButton13Click(Sender: TObject);
begin
  edit1.Text :=edit1.Text +'0';
end;

procedure TFyuyue.XPButton4Click(Sender: TObject);
begin
edit1.Text :=edit1.Text +'1';
end;

procedure TFyuyue.XPButton5Click(Sender: TObject);
begin
  edit1.Text :=edit1.Text +'2';
end;

procedure TFyuyue.XPButton6Click(Sender: TObject);
begin
  edit1.Text :=edit1.Text +'3';
end;

procedure TFyuyue.XPButton7Click(Sender: TObject);
begin
  edit1.Text :=edit1.Text +'4';
end;

procedure TFyuyue.XPButton8Click(Sender: TObject);
begin
  edit1.Text :=edit1.Text +'5';
end;

procedure TFyuyue.XPButton9Click(Sender: TObject);
begin
  edit1.Text :=edit1.Text +'6';
end;

procedure TFyuyue.XPButton10Click(Sender: TObject);
begin
  edit1.Text :=edit1.Text +'7';
end;

procedure TFyuyue.XPButton11Click(Sender: TObject);
begin
  edit1.Text :=edit1.Text +'8';
end;

procedure TFyuyue.XPButton12Click(Sender: TObject);
begin
  edit1.Text :=edit1.Text +'9';
end;

procedure TFyuyue.Timer1Timer(Sender: TObject);
begin
  timer1.Enabled :=false;
  close;
end;

procedure TFyuyue.FormShow(Sender: TObject);
begin
  timer1.Enabled :=false;
  timer1.Enabled :=true;
end;

procedure TFyuyue.XPButton3Click(Sender: TObject);
begin
  timer1.Enabled :=false;
  close;
end;

procedure TFyuyue.XPButton1Click(Sender: TObject);
var
  Ytime:tdatetime;
  number,yfontname,yfontsize,ytexttype,yfontname,ytextstr:string;
  j,x,y,yfontsize:integer;
begin
if number<>'' then
  begin
    if length(printmodal)<=0 then
      begin
        showmessage('票号格式未设置，请在管理平台中设置！');
        exit;
      end;
    WITH printer DO
    BEGIN
      Begindoc;
      with canvas do
      for j:=0 to length(printmodal)-1 do
        begin
          x:=printmodal[j].P_x;
          y:=printmodal[j].P_Y;
          yfontname:=printmodal[j].P_fontname ;
          yfontsize:=printmodal[j].P_fontsize;
          ytexttype:=trim(printmodal[j].P_texttype);
          ytextstr:=printmodal[j].P_text;
          Font.Size :=yfontsize;
          font.Name :=yfontname;
          if ytexttype='公司名称' then textout(x,y,compname);
          if ytexttype='排队号码' then textout(x,y,'预约号：'+number);
          if ytexttype='业务名称' then textout(x,y,servetypename);
          if ytexttype='取号时间' then textout(x,y,'预约叫号时间：'+datetimetostr(Ytime));
        end;
      enddoc;
    END;
  end;
end;

end.
