untZhuzhou.pas
上传用户:wysk38707
上传日期:2007-06-18
资源大小:801k
文件大小:21k
源码类别:

交通/航空行业

开发平台:

Delphi

  1. unit untZhuzhou;
  2. interface
  3. uses
  4.   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  5.   Dialogs, StdCtrls, ExtCtrls, Buttons, jpeg, ComCtrls, Menus,main, DB,
  6.   DBTables, Grids, DBGrids, DBCtrls, Spin, Mask;
  7. type
  8.   Tfrmzhuzhou = class(TForm)
  9.     PageControl1: TPageControl;
  10.     TabSheet1: TTabSheet;
  11.     TabSheet2: TTabSheet;
  12.     Image1: TImage;
  13.     BitBtn1: TBitBtn;
  14.     BitBtn2: TBitBtn;
  15.     BitBtn3: TBitBtn;
  16.     BitBtn4: TBitBtn;
  17.     BitBtn5: TBitBtn;
  18.     BitBtn6: TBitBtn;
  19.     BitBtn7: TBitBtn;
  20.     Panel1: TPanel;
  21.     Label1: TLabel;
  22.     Button1: TButton;
  23.     Label2: TLabel;
  24.     Label3: TLabel;
  25.     Label4: TLabel;
  26.     Button2: TButton;
  27.     BitBtn8: TBitBtn;
  28.     GroupBox1: TGroupBox;
  29.     ListBox1: TListBox;
  30.     BitBtn9: TBitBtn;
  31.     GroupBox2: TGroupBox;
  32.     BitBtn11: TBitBtn;
  33.     GroupBox3: TGroupBox;
  34.     GroupBox4: TGroupBox;
  35.     BitBtn12: TBitBtn;
  36.     Label5: TLabel;
  37.     Label6: TLabel;
  38.     Label7: TLabel;
  39.     Label8: TLabel;
  40.     Label9: TLabel;
  41.     Label10: TLabel;
  42.     Label11: TLabel;
  43.     Label12: TLabel;
  44.     Label13: TLabel;
  45.     Label14: TLabel;
  46.     Label15: TLabel;
  47.     Label16: TLabel;
  48.     Label17: TLabel;
  49.     Label18: TLabel;
  50.     PopupMenu1: TPopupMenu;
  51.     N1: TMenuItem;
  52.     N2: TMenuItem;
  53.     N3: TMenuItem;
  54.     N4: TMenuItem;
  55.     N5: TMenuItem;
  56.     N6: TMenuItem;
  57.     N7: TMenuItem;
  58.     N8: TMenuItem;
  59.     GroupBox5: TGroupBox;
  60.     ListBox2: TListBox;
  61.     Label19: TLabel;
  62.     BitBtn13: TBitBtn;
  63.     BitBtn14: TBitBtn;
  64.     Memo4: TMemo;
  65.     GroupBox6: TGroupBox;
  66.     Button3: TButton;
  67.     Label20: TLabel;
  68.     Edit1: TEdit;
  69.     GroupBox7: TGroupBox;
  70.     GroupBox9: TGroupBox;
  71.     BitBtn15: TBitBtn;
  72.     PopupMenu2: TPopupMenu;
  73.     N9: TMenuItem;
  74.     N10: TMenuItem;
  75.     N11: TMenuItem;
  76.     N12: TMenuItem;
  77.     ListBox3: TListBox;
  78.     ListBox4: TListBox;
  79.     ListBox5: TListBox;
  80.     N13: TMenuItem;
  81.     qstation: TQuery;
  82.     qtrain: TQuery;
  83.     qticket: TQuery;
  84.     BitBtn16: TBitBtn;
  85.     BitBtn10: TBitBtn;
  86.     BitBtn17: TBitBtn;
  87.     BitBtn18: TBitBtn;
  88.     BitBtn19: TBitBtn;
  89.     BitBtn20: TBitBtn;
  90.     DataSource1: TDataSource;
  91.     DBGrid1: TDBGrid;
  92.     DBNavigator1: TDBNavigator;
  93.     Table1: TTable;
  94.     Label21: TLabel;
  95.     MaskEdit1: TMaskEdit;
  96.     Label22: TLabel;
  97.     SpinEdit1: TSpinEdit;
  98.     Button4: TButton;
  99.     ComboBox1: TComboBox;
  100.     Label23: TLabel;
  101.     procedure BitBtn12Click(Sender: TObject);
  102.     procedure N9Click(Sender: TObject);
  103.     procedure N10Click(Sender: TObject);
  104.     procedure N12Click(Sender: TObject);
  105.     //procedure Button1Click(Sender: TObject);
  106.     //procedure Button2Click(Sender: TObject);
  107.     procedure BitBtn1MouseUp(Sender: TObject; Button: TMouseButton;
  108.       Shift: TShiftState; X, Y: Integer);
  109.     //procedure BitBtn1Click(Sender: TObject);
  110.     procedure BitBtn7MouseUp(Sender: TObject; Button: TMouseButton;
  111.       Shift: TShiftState; X, Y: Integer);
  112.     procedure BitBtn6MouseUp(Sender: TObject; Button: TMouseButton;
  113.       Shift: TShiftState; X, Y: Integer);
  114.     procedure BitBtn5MouseUp(Sender: TObject; Button: TMouseButton;
  115.       Shift: TShiftState; X, Y: Integer);
  116.     procedure BitBtn4MouseUp(Sender: TObject; Button: TMouseButton;
  117.       Shift: TShiftState; X, Y: Integer);
  118.     procedure BitBtn3MouseUp(Sender: TObject; Button: TMouseButton;
  119.       Shift: TShiftState; X, Y: Integer);
  120.     procedure BitBtn2MouseUp(Sender: TObject; Button: TMouseButton;
  121.       Shift: TShiftState; X, Y: Integer);
  122.     procedure N1Click(Sender: TObject);
  123.     procedure Button1Click(Sender: TObject);
  124.     procedure Button2Click(Sender: TObject);
  125.     procedure N3Click(Sender: TObject);
  126.     procedure N5Click(Sender: TObject);
  127.     procedure N6Click(Sender: TObject);
  128.     procedure N13Click(Sender: TObject);
  129.     procedure FormCreate(Sender: TObject);
  130.     procedure FormClose(Sender: TObject; var Action: TCloseAction);
  131.     procedure BitBtn16Click(Sender: TObject);
  132.     procedure BitBtn17Click(Sender: TObject);
  133.     procedure Label2DblClick(Sender: TObject);
  134.     procedure Label4DblClick(Sender: TObject);
  135.     procedure BitBtn8Click(Sender: TObject);
  136.     procedure BitBtn9Click(Sender: TObject);
  137.     procedure BitBtn11Click(Sender: TObject);
  138.     procedure BitBtn10Click(Sender: TObject);
  139.     procedure N2Click(Sender: TObject);
  140.     procedure N8Click(Sender: TObject);
  141.     procedure BitBtn18Click(Sender: TObject);
  142.     procedure Button4Click(Sender: TObject);
  143.     procedure BitBtn19Click(Sender: TObject);
  144.     procedure BitBtn15Click(Sender: TObject);
  145.     procedure BitBtn20Click(Sender: TObject);
  146.     procedure BitBtn13Click(Sender: TObject);
  147.     procedure Button3Click(Sender: TObject);
  148.     procedure TabSheet2Show(Sender: TObject);
  149.     procedure qtrainBeforeDelete(DataSet: TDataSet);
  150.   private
  151.     { Private declarations }
  152.   public
  153.     { Public declarations }
  154.   end;
  155. var
  156.   frmzhuzhou: Tfrmzhuzhou;
  157.   //variants for interface design
  158.   stationName:string;
  159.   //startName:string;
  160.   //desName:string;
  161.   startpoint:string;
  162.   despoint:string;
  163.   //variants for inner class
  164.   stationclass:Cstation;
  165.   ticketclass:Cticket;
  166.   trainclass:Ctrain;
  167.   tickets:ticketRec;
  168.   ackNo:word;
  169. implementation
  170. {$R *.dfm}
  171. uses
  172.     untchangsha,untchengdu,untchongqing,untbeijing,untwuhan,untguangzhou;
  173. procedure Tfrmzhuzhou.BitBtn12Click(Sender: TObject);
  174. begin
  175.     //if(messageDlg('确定要退出!', mtConfirmation,[mbOKCancel], 0)=mrOK)then
  176.     BitBtn16Click(nil);
  177. end;
  178. procedure Tfrmzhuzhou.N9Click(Sender: TObject);
  179. begin
  180.     if((listBox3.itemIndex>=0) and (Label4.Caption<>listbox3.Items[listBox3.itemIndex]))then
  181.         begin
  182.             Label2.Caption:=listbox3.Items[listBox3.itemIndex];
  183.             startpoint:=Label2.Caption;
  184.         end
  185. end;
  186. procedure Tfrmzhuzhou.N10Click(Sender: TObject);
  187. begin
  188.     if((listBox3.itemIndex>=0) and (Label2.Caption<>listbox3.Items[listBox3.itemIndex]))then
  189.         begin
  190.             Label4.Caption:=listbox3.Items[listBox3.itemIndex];
  191.             despoint:=Label4.Caption;
  192.         end;
  193. end;
  194. procedure Tfrmzhuzhou.N12Click(Sender: TObject);
  195. begin
  196.     listbox3.Items.Delete(listbox3.ItemIndex)
  197. end;
  198. procedure Tfrmzhuzhou.BitBtn1MouseUp(Sender: TObject; Button: TMouseButton;
  199.   Shift: TShiftState; X, Y: Integer);
  200. begin
  201.     if(button=mbRight)then
  202.         begin
  203.     stationName:=(Sender as TBitbtn).Caption;
  204.     popupMenu1.Popup((Sender as tbitbtn).left+X,(Sender as tbitbtn).top+Y);
  205.         end;
  206. end;
  207. procedure Tfrmzhuzhou.BitBtn7MouseUp(Sender: TObject; Button: TMouseButton;
  208.   Shift: TShiftState; X, Y: Integer);
  209. begin
  210.     if(button=mbRight)then
  211.         begin
  212.     stationName:=(Sender as TBitbtn).Caption;
  213.     popupMenu1.Popup((Sender as tbitbtn).left+X,(Sender as tbitbtn).top+Y);
  214.         end;
  215. end;
  216. procedure Tfrmzhuzhou.BitBtn6MouseUp(Sender: TObject; Button: TMouseButton;
  217.   Shift: TShiftState; X, Y: Integer);
  218. begin
  219.     if(button=mbRight)then
  220.         begin
  221.     stationName:=(Sender as TBitbtn).Caption;
  222.     popupMenu1.Popup((Sender as tbitbtn).left+X,(Sender as tbitbtn).top+Y);
  223.         end;
  224. end;
  225. procedure Tfrmzhuzhou.BitBtn5MouseUp(Sender: TObject; Button: TMouseButton;
  226.   Shift: TShiftState; X, Y: Integer);
  227. begin
  228.     if(button=mbRight)then
  229.         begin
  230.     stationName:=(Sender as TBitbtn).Caption;
  231.     popupMenu1.Popup((Sender as tbitbtn).left+X,(Sender as tbitbtn).top+Y);
  232.         end;
  233. end;
  234. procedure Tfrmzhuzhou.BitBtn4MouseUp(Sender: TObject; Button: TMouseButton;
  235.   Shift: TShiftState; X, Y: Integer);
  236. begin
  237.     if(button=mbRight)then
  238.         begin
  239.     stationName:=(Sender as TBitbtn).Caption;
  240.     popupMenu1.Popup((Sender as tbitbtn).left+X,(Sender as tbitbtn).top+Y);
  241.         end;
  242. end;
  243. procedure Tfrmzhuzhou.BitBtn3MouseUp(Sender: TObject; Button: TMouseButton;
  244.   Shift: TShiftState; X, Y: Integer);
  245. begin
  246.     if(button=mbRight)then
  247.         begin
  248.     stationName:=(Sender as TBitbtn).Caption;
  249.     popupMenu1.Popup((Sender as tbitbtn).left+X,(Sender as tbitbtn).top+Y);
  250.         end;
  251. end;
  252. procedure Tfrmzhuzhou.BitBtn2MouseUp(Sender: TObject; Button: TMouseButton;
  253.   Shift: TShiftState; X, Y: Integer);
  254. begin
  255.     if(button=mbRight)then
  256.         begin
  257.     stationName:=(Sender as TBitbtn).Caption;
  258.     popupMenu1.Popup((Sender as tbitbtn).left+X,(Sender as tbitbtn).top+Y);
  259.         end;
  260. end;
  261. procedure Tfrmzhuzhou.N1Click(Sender: TObject);
  262. var
  263.     i:integer;
  264.     Flag:boolean;
  265. begin
  266.     //first we judge whether it has been in listBox3
  267.     Flag:=True;
  268.     //showmessage(inttostr(listBox3.Items.Count));
  269.     if(listBox3.Items.Count>=1)then
  270.         for i:=1 to listBox3.Items.Count do
  271.             begin
  272.               if(listBox3.Items[i-1]=StationName)then
  273.                 Flag:=false;
  274.             end;
  275.     if(flag=true)then
  276.         listbox3.Items.Add(StationName);
  277. end;
  278. procedure Tfrmzhuzhou.Button1Click(Sender: TObject);
  279. begin
  280.     N9Click(nil);
  281. end;
  282. procedure Tfrmzhuzhou.Button2Click(Sender: TObject);
  283. begin
  284.     N10Click(nil);
  285. end;
  286. procedure Tfrmzhuzhou.N3Click(Sender: TObject);
  287. begin
  288.     if(despoint<>stationName)then
  289.         begin
  290.     //startName:=stationName;
  291.     startpoint:=stationName;
  292.     Label2.Caption:=startpoint;
  293.     //Label2.Enabled:=false;
  294.     popupMenu1.Items.Items[3].Enabled:=false;
  295.     popupMenu1.Items.Items[4].Enabled:=true;
  296.         end;
  297. end;
  298. procedure Tfrmzhuzhou.N5Click(Sender: TObject);
  299. begin
  300.     if(startpoint<>stationName)then
  301.         begin
  302.             //desName:=stationName;
  303.             despoint:=stationName;
  304.             label4.Caption:=despoint;
  305.             //label4.Enabled:=false;
  306.             popupMenu1.Items.Items[5].Enabled:=true;
  307.             popupMenu1.Items.Items[4].Enabled:=false;
  308.         end;
  309. end;
  310. procedure Tfrmzhuzhou.N6Click(Sender: TObject);
  311. var
  312.     trains:Carrayword;
  313.     i:integer;
  314. begin
  315.     popupMenu1.Items.Items[3].Enabled:=true;
  316.     popupMenu1.Items.Items[4].Enabled:=false;
  317.     popupMenu1.Items.Items[5].Enabled:=false;
  318.     Label2.Enabled:=true;
  319.     label4.Enabled:=true;
  320.     listbox1.Clear;
  321.     listbox4.Clear;
  322.     if((startpoint<>'')and(despoint<>''))then
  323.         begin
  324.             trains:=Carrayword.Create();
  325.             trainclass.getArrive(stationclass.getNo(startpoint),stationclass.getNo(despoint),trains);
  326.             //showmessage(inttostr(trains.Num));
  327.             if (trains.Num>0)then
  328.                 begin
  329.                     for i:=1 to trains.Num do
  330.                         begin
  331.                             listbox1.Items.Add(inttostr(trains.warray[i]));
  332.                         end;
  333.                 end
  334.              else
  335.                 showmessage('没有查到相关信息!');
  336.             trains.Free;
  337.         end
  338.     else
  339.         begin
  340.             showmessage('请选定起点站和终点站!');
  341.         end;
  342. end;
  343. procedure Tfrmzhuzhou.N13Click(Sender: TObject);
  344. begin
  345.     //popupMenu1.Items.Items[3].Enabled:=true;
  346.     bitbtn19.Click(); 
  347. end;
  348. procedure Tfrmzhuzhou.FormCreate(Sender: TObject);
  349. begin
  350.     trainclass:=Ctrain.Create();
  351.     stationclass:=Cstation.Create();
  352.     ticketclass:=Cticket.Create();
  353.     ticketclass.myCtrain:=trainclass;
  354.     trainclass.setQuery(qtrain);
  355.     trainclass.localstation:=6;
  356.     ticketclass.setQuery(qticket);
  357.     ticketclass.settable('ticket6.db');
  358.     ticketclass.localstation:=6;
  359.     stationclass.setQuery(qstation);
  360.     tickets.Num:=0;
  361. end;
  362. procedure Tfrmzhuzhou.FormClose(Sender: TObject; var Action: TCloseAction);
  363. begin
  364.     ticketclass.query.Close;
  365.     stationclass.query.Close;
  366.     trainclass.query.Close;
  367.     ticketclass.Free;
  368.     stationclass.Free;
  369.     trainclass.Free;
  370. end;
  371. procedure Tfrmzhuzhou.BitBtn16Click(Sender: TObject);
  372. begin
  373.     if(Bitbtn11.Enabled=false)then
  374.         BitBtn17Click(nil);
  375.       begin
  376.         Label2.Caption:='';
  377.         Label4.Caption:='';
  378.         Label6.Caption:='';
  379.         Label7.Caption:='';
  380.         Label9.Caption:='';
  381.         Label16.Caption:='';
  382.         Label17.Caption:='';
  383.         listBox1.Items.Clear;
  384.         listBox3.Items.Clear;
  385.         listBox4.Items.Clear;
  386.         //listBox5.Items.Clear;
  387.         bitbtn10.Enabled:=false;
  388.         bitbtn17.Enabled:=false;
  389.       end
  390. end;
  391. procedure Tfrmzhuzhou.BitBtn17Click(Sender: TObject);
  392. begin
  393.     bitbtn11.Enabled:=true;
  394.     //ack ticket falg=false
  395.     ticketclass.ackTicket(stationclass.getNo(Label6.Caption),stationclass.getNo(Label7.Caption),strtoint(label9.Caption),(strtoint(label16.Caption)*128+strtoint(label17.Caption)),ackNo,false);
  396.     bitbtn10.Enabled:=false;
  397.     bitbtn17.Enabled:=false;
  398.     label6.Caption:='';
  399.     label7.Caption:='';
  400.     label9.Caption:='';
  401.     label16.Caption:='';
  402.     label17.Caption:='';
  403. end;
  404. procedure Tfrmzhuzhou.Label2DblClick(Sender: TObject);
  405. begin
  406.     Label2.Caption:='';
  407. end;
  408. procedure Tfrmzhuzhou.Label4DblClick(Sender: TObject);
  409. begin
  410.     Label4.Caption:='';
  411. end;
  412. procedure Tfrmzhuzhou.BitBtn8Click(Sender: TObject);
  413. var
  414.     trains:Carrayword;
  415.     i:integer;
  416. begin
  417.     Label2.Enabled:=true;
  418.     label4.Enabled:=true;
  419.     listbox1.Clear;
  420.     listbox4.Clear;
  421.     if((label2.Caption<>'')and(label4.Caption<>''))then
  422.         begin
  423.             trains:=Carrayword.Create();
  424.             trainclass.getArrive(stationclass.getNo(label2.Caption),stationclass.getNo(label4.Caption),trains);
  425.             //showmessage(inttostr(trains.Num));
  426.             if (trains.Num>0)then
  427.                 begin
  428.                     for i:=1 to trains.Num do
  429.                         begin
  430.                             listbox1.Items.Add(inttostr(trains.warray[i]));
  431.                         end;
  432.                 end
  433.              else
  434.                 showmessage('没有查到相关信息!');
  435.             trains.Free;
  436.         end
  437.     else
  438.         begin
  439.             showmessage('请选定起点站和终点站!');
  440.         end;
  441. end;
  442. procedure Tfrmzhuzhou.BitBtn9Click(Sender: TObject);
  443. var
  444.     stations:Carrayword;
  445.     i:integer;
  446. begin
  447. //consult all info about the checked train
  448.     listbox4.Clear;
  449.     if(listbox1.ItemIndex>=0)then
  450.         begin
  451.             stations:=Carrayword.Create;
  452.             //showmessage(inttostr(listbox1.ItemIndex));
  453.             i:=trainclass.getRoute(strtoint(listBox1.Items[listbox1.ItemIndex]),stations);
  454.             //showmessage(inttostr(stations.Num));
  455.             if(i=0)then
  456.                 begin
  457.                     for i:=1 to stations.Num do
  458.                         begin
  459.                             listbox4.Items.Add(stationclass.getName(stations.warray[i]));
  460.                         end;
  461.                 end
  462.             else
  463.                 begin
  464.                     showmessage('请选定起点站和终点站!');
  465.                 end;
  466.             stations.Free;
  467.         end
  468.     else
  469.         begin
  470.             showmessage('清首先选定一辆列车!');
  471.         end;
  472. end;
  473. procedure Tfrmzhuzhou.BitBtn11Click(Sender: TObject);
  474. var
  475.     ticketNo:word;
  476. begin
  477.     if(listBox1.ItemIndex>=0)then
  478.         begin
  479.     ticketNo:=0;
  480.     ackNo:=ticketclass.getTicket(stationclass.getNo(label2.Caption),stationclass.getNo(label4.Caption),strtoint(listbox1.Items[listBox1.ItemIndex]),ticketNo);
  481.     //showmessage(inttostr(ticketNo));
  482.     if(ticketNo<>0)then
  483.         begin
  484.             bitbtn11.Enabled:=false;
  485.             bitbtn10.Enabled:=true;
  486.             bitbtn17.Enabled:=true;
  487.             Label6.Caption:=startpoint;
  488.             Label7.Caption:=despoint;
  489.             Label9.Caption:=listbox1.Items[listbox1.ItemIndex];
  490.             label16.Caption:=inttostr(ticketNo div 128);
  491.             label17.Caption:=inttostr(ticketNo mod 128);
  492.         end
  493.     else
  494.         showmessage('没有车票可买了!');
  495.         end;// listBox1.ItemIndex>=0
  496. end;
  497. procedure Tfrmzhuzhou.BitBtn10Click(Sender: TObject);
  498. begin
  499.     bitbtn11.Enabled:=true;
  500.     //record the ticket in listbox5
  501.     tickets.Num:=tickets.Num+1;
  502.     tickets.ticketNo[tickets.Num]:=strtoint(Label16.Caption)*128+strtoint(label17.Caption);
  503.     tickets.trainNo[tickets.Num]:=strtoint(Label9.Caption);
  504.     tickets.SName[tickets.Num]:=Label6.Caption;
  505.     tickets.DName[tickets.Num]:=Label7.Caption;
  506.     tickets.ackNo[tickets.Num]:=ackNo;
  507.     listbox5.Items.Add(tickets.SName[tickets.Num]+'-->'+tickets.DName[tickets.Num]+' '+label9.caption+'次 '+label16.caption+'车厢 '+label17.Caption+'座');
  508.     bitbtn10.Enabled:=false;
  509.     bitbtn17.Enabled:=false;
  510.     label6.Caption:='';
  511.     label7.Caption:='';
  512.     label9.Caption:='';
  513.     label16.Caption:='';
  514.     label17.Caption:='';
  515. end;
  516. procedure Tfrmzhuzhou.N2Click(Sender: TObject);
  517. var
  518.     stations:Carrayword;
  519.     stationNo:word;
  520.     i:integer;
  521. begin
  522.     popupmenu1.Items[1].Enabled:=false;  
  523.     stations:=Carrayword.Create;
  524.     stationNo:=stationclass.getNo(stationName);
  525.     //stationNo:word;var stations:Carrayword
  526.     trainclass.getLink(stationNo,stations);
  527.     //bitbtn1.Brush.Color:=clRed;
  528.     //bitbtn1.Font.Color:=clRed;
  529.     //bitbtn1.Repaint;
  530.     listbox3.Clear;
  531.     for i:=1 to stations.Num do
  532.         begin
  533.             case stations.warray[i] of
  534.                 1:Bitbtn1.Font.Color:=clRed;
  535.                 2:Bitbtn7.Font.Color:=clRed;
  536.                 3:Bitbtn2.Font.Color:=clRed;
  537.                 4:Bitbtn3.Font.Color:=clRed;
  538.                 5:Bitbtn4.Font.Color:=clRed;
  539.                 6:Bitbtn5.Font.Color:=clRed;
  540.                 7:Bitbtn6.Font.Color:=clRed;
  541.             end;
  542.             listbox3.Items.Add(stationclass.getName(stations.warray[i]));
  543.         end;
  544.     stations.Free;
  545. end;
  546. procedure Tfrmzhuzhou.N8Click(Sender: TObject);
  547. var
  548.     i:integer;
  549. begin
  550.     popupmenu1.Items[1].Enabled:=true;  
  551.     for i:=1 to 7 do
  552.         begin
  553.             bitbtn1.Font.Color:=clBlack;
  554.             bitbtn2.Font.Color:=clBlack;
  555.             bitbtn3.Font.Color:=clBlack;
  556.             bitbtn4.Font.Color:=clBlack;
  557.             bitbtn5.Font.Color:=clBlack;
  558.             bitbtn6.Font.Color:=clBlack;
  559.             bitbtn7.Font.Color:=clBlack;
  560.         end;
  561. end;
  562. procedure Tfrmzhuzhou.BitBtn18Click(Sender: TObject);
  563. var
  564.     stations:Carrayword;
  565.     i:integer;
  566. begin
  567.     if tickets.Num>0 then
  568.         begin
  569.             for i:=1 to tickets.Num do
  570.                 begin
  571.     stations:=Carrayword.Create;
  572.     trainclass.getRoute(tickets.trainNo[i],stations);
  573.     ticketclass.ackTicket(stationclass.getNo(tickets.SName[i]),stationclass.getNo(tickets.DName[i]),tickets.trainNo[i],tickets.ticketNo[i],tickets.ackNo[i],true);
  574.     tickets.Num:=0;
  575.     bitbtn16.Click();
  576.     listBox5.Clear;
  577.                     showmessage('第 '+inttostr(i)+' 张票处理完毕!');
  578.     stations.Free;
  579.                 end;
  580.         end
  581.     else
  582.         begin
  583.             showmessage('没有车票可以打印!');
  584.         end;
  585. end;
  586. procedure Tfrmzhuzhou.Button4Click(Sender: TObject);
  587. begin
  588.     try
  589.         if(ticketclass.addfull(stationclass.getNo(combobox1.Text),strtoint(edit1.Text),strtoint(maskedit1.Text),strtoint(spinEdit1.Text))=0)then
  590.             showmessage('票据加入成功!')
  591.         else
  592.             showmessage('票据加入出错!');
  593.         table1.Refresh; 
  594.     except
  595.         showmessage('请检查输入!');
  596.     end;
  597. end;
  598. procedure Tfrmzhuzhou.BitBtn19Click(Sender: TObject);
  599. begin
  600.     Label2.Caption:='';
  601.     startpoint:='';
  602.     Label4.Caption:='';
  603.     despoint:='';
  604.     listbox1.Clear;
  605.     listbox4.Clear;
  606.     listbox3.Clear;
  607.     bitbtn11.Enabled:=true;
  608.     label6.Caption:='';
  609.     Label7.Caption:='';
  610.     Label9.Caption:='';
  611.     Label16.Caption:='';
  612.     Label17.Caption:='';
  613.     listbox1.Clear;
  614.     listbox4.Clear;
  615.     popupmenu1.Items[3].Enabled:=true;
  616.     popupmenu1.Items[4].Enabled:=false;
  617.     popupmenu1.Items[5].Enabled:=false;
  618. end;
  619. procedure Tfrmzhuzhou.BitBtn15Click(Sender: TObject);
  620. var
  621.     trains:Carrayword;
  622.     i:integer;
  623. begin
  624.     button3.Enabled:=false; 
  625.     listbox2.Clear;
  626.     trains:=Carrayword.Create;
  627.     if(trainclass.getPass(trainclass.localstation,trains)=0)then
  628.         begin
  629.             for i:=1 to trains.Num do
  630.                 begin
  631.                     listbox2.Items.Add(inttostr(trains.warray[i]));
  632.                     listbox2.Items.Add(inttostr(trains.warray[i]+1));
  633.                 end;
  634.         end
  635.     else
  636.         showmessage('ERROR!');
  637.     trains.Free; 
  638. end;
  639. procedure Tfrmzhuzhou.BitBtn20Click(Sender: TObject);
  640. begin
  641.     button3.Enabled:=false; 
  642.     listbox2.Clear;
  643.     Memo4.Clear;
  644. end;
  645. procedure Tfrmzhuzhou.BitBtn13Click(Sender: TObject);
  646. var
  647.     trains:Carrayword;
  648.     i:integer;
  649. begin
  650.     button3.Enabled:=true; 
  651.     listbox2.Clear;
  652.     trains:=Carrayword.Create;
  653.     if(trainclass.getStart(trainclass.localstation,trains)<>1)then
  654.         begin
  655.             for i:=1 to trains.Num do
  656.                 begin
  657.                     listbox2.Items.Add(inttostr(trains.warray[i]));
  658.                     listbox2.Items.Add(inttostr(trains.warray[i]+1));
  659.                 end;
  660.         end
  661.     else
  662.         showmessage('ERROR!');
  663.     trains.Free; 
  664. end;
  665. procedure Tfrmzhuzhou.Button3Click(Sender: TObject);
  666. begin
  667. if(listbox2.ItemIndex>=0)then
  668.     Edit1.Text:=listbox2.Items[listbox2.Itemindex];  
  669. end;
  670. procedure Tfrmzhuzhou.TabSheet2Show(Sender: TObject);
  671. begin
  672.     table1.Refresh; 
  673. end;
  674. procedure Tfrmzhuzhou.qtrainBeforeDelete(DataSet: TDataSet);
  675. begin
  676.     showmessage('dfhtytr');
  677. end;
  678. end.