1. Introduction
With the emergence of computer LANs and wide area networks, the quality of network products (including software and hardware) has been continuously improved; the variety and quantity have been rapidly growing and developing; as well as the maturity of database technology and the development of software engineering methods, various computer network management systems have become increasingly Complete. The microcomputer ticketing system for tourist attractions is the product of the combination of computer technology and network technology. Convenient and fast query and statistics enable managers to accurately grasp the business conditions of scenic spots and supervise and manage ticket sales personnel, and provide them with accurate and credible decision-making basis. It has successfully improved the ticket sales efficiency and management level of tourist attractions, bringing the situation of manual ticket sales to an end, thus entering a new stage of intelligent ticket sales.
This article introduces the development method of the microcomputer ticketing system for tourist attractions running in Windows NT 4.0 with Delphi 4.0 as the development language and Microsoft SQL Server 6.5 as the backend. This system is suitable for the automated management of ticketing systems for major, medium and small tourist attractions, and has strong practical promotion and application value.
2. Overall system solution design
The microcomputer ticketing system adopts a star topological LAN structure and consists of a server, hub, computer, and printer, see Figure 1. Run database and system management programs on the server to realize functions such as query, statistics, report printing, and system maintenance. Each ticket microcomputer and corresponding printer are placed in the ticket window, and the ticketing program is run to complete the functions of interface input, ticket printing, and ticket salesperson personal information query and statistics.
For ticketing systems, the speed of the printer and the speed of data transmission through the network are very critical indicators. For example, during its peak period, about 20,000 people enter the park to visit every day, requiring three microcomputers to sell tickets, and most of the visitors are concentrated at the same time. For example, the park has just opened until about 10 am in the morning and 2 pm Between ~ 3 o'clock, etc., so reducing the waiting time for tourists and speeding up ticket sales are problems that must be solved by the microcomputer ticket sales system. There are two factors that affect the speed of ticket sales. One is the printing speed of the hardware printer, and the other is the speed at which the printing program starts printing and transmits data. After actual testing, the EPSON stylus color 850 color inkjet printer has a printing speed of 8 pages/minute from A4 paper, which can meet the requirements.
In order to meet the printing speed requirements in terms of programs, Delphi 4.0 was determined to be used as the programming language after testing and careful selection. Delphi combines powerful object Pascal language with fast and convenient RAD. It is a universal graphical user interface (GUI) development tool. It is designed based on the concept of visualization and components, and can easily manipulate databases and implement them. Various reports make programming fast and are one of the fastest debugging and compilation programming languages. When printing tickets, directly call various procedures and functions in Delphi's class PRinters, such as Printers.Canvas.Textout(x:integer;y:integer;const Text:string) and combine other processes and functions to achieve rapid printing. , solves the problem of program printing speed.
The system selects SQL Sever as the database. SQL Sever is a client/server relational data management system (RDBMS). Transact-SQl is used to send requests between the client and SQL Sever, which can meet the system's network transmission requirements. In Delphi, database access can be performed through BDE (database engine) and ODBC, or database access can be performed directly through ADO.
In addition, in the overall programming, considering that the operators using this system are of uneven quality and the computer operation level is relatively low, the operations involved should be as simple as possible, and input as little information as possible, and try to use drop-down boxes and selection boxes. Avoid errors. The operator of this system only needs to enter the number of tourists (adults and children or students) and the number of vehicles. Other information such as fares are automatically called out from the database when the program starts. The time is taken from the system time. The total price is automatically generated by the computer. The interface is simple, easy to operate, easy to learn and use.
3. Overall design of system software
1. Database table design
The system database includes retail ticket information table, password table, operator information table, fare information table, and views built for statistical query. Taking the retail ticket information table as an example, the structure of the table is introduced. The field definitions are shown in Table 1.
Serial number: consists of the ticket seller's identifier, random number and the number of tickets from the start of the microcomputer ticket. For example, GK006662 represents the ticket seller with identification number G, with random number K, and the ticket 6662nd.
Refund No: This field is used to identify whether the ticket is valid. If it is valid, it is 1 and invalid is 0.
2. Software structure design
System software design follows the idea of modular programming, from top to bottom and seeks precision step by step. The system program consists of a system management module and a ticketing module. The ticketing module runs on the ticketing microcomputer, and the system management module runs on the server.
4. Main functional characteristics and implementation methods of the system
The main system modules: login and password input module; system main interface input module; statistics, query, report, printing module; ticket printing module. The following describes the functions of each module and the implementation of key parts.
1. Login and password input module
The login and password input modules are used to restrict the operator's permissions. The functions completed by the program are: take out the password from the interface and query the database password table. The operator has the same password and has the right to enter the next interface. If the input fails three times, the program will automatically exit. In addition, in the ticketing module, the corresponding operator's name should be taken out according to the password so as to associate the ticketing information with the operator. The corresponding operator function is obtained from the database based on the input password as follows, where handletbl is the password table name, id, handlename, and handlecode are fields in the table, representing the number, operator name, and operator password.
function TFormPswd.gethenlename(code:String):String;
var name:String;
Begin
name:='';
Query2.Close;
Query2.SQL.Clear;
Query2.DisableControls;
Query2.SQL.Add('Select id,handlename,handlecode from handletbl');
Query2.Open;
if Query2.locate('handlecode',code,[]) then
Begin
name:=query2.FieldByName('handlename').AsString;
end;
Query2.close;
Result:=name;
end;
2. System main interface input module
The system's main interface input module is used to enter and display ticket sales information, and automatically calculates the total number of tourists and the ticket price based on its information and ticket price. In this module, the operator is required to enter only the number of tourists and press "OK" to automatically calculate and display the total price, and press "Print" to print the ticket. In order to prevent the operator from accidentally entering other characters other than integer data, such as A and B, which leads to program errors, the judgment conditions are set in the program at the Tedit position where data input is required, and only integer data input is allowed.
3. Statistics and query, report printing module
Statistics and query and report printing modules are used to realize the statistics and query of ticket sales information. They can set start and end dates and other information, and can generate report printing. Statistics and queries are implemented in embedded SQL query language, and reports use various controls in the Qreport component group of Delphi's fast report component.
4. Ticket Printing Module
The ticket printing module realizes the printout function of the ticket. In ticket printing, the output position needs to be determined according to the ticket style. In order to achieve fast printing, the printers process and functions are directly called during printing.
The printing process is as follows:
procedure printmsg(thesyqo,Totalpeople,adultNum,childNum,Totalcar,bigcar,middlecar,minicar,totalmoney,prtdate:String);
Begin
Printer.Canvas.Font.Charset := GB2312_CHARSET;
Printer.BeginDoc;
Printer.PageHeight;
Printer.PageWidth;
Printer.Canvas.Font.Size :=14;//Font settings
…//Insert the content to be printed according to the user’s needs
Printer.Canvas.TextOut(x+2370,y,thesyqo);//Print content
Printer.EndDoc;
end;
5. Refund management module
The actual ticket sales process involves the situation of tourists refunding tickets for various reasons. The tickets sold by computer printed and related information have been stored in the database. When a refund occurs, the operator's ticket sales amount must be inconsistent with the database query results. In order to solve this phenomenon, a refund management module has been added.