Use Delphi to develop a microcomputer Ticketing System for Tourist Attractions

Source: Internet
Author: User
Tags textout

I. Introduction

With the emergence of computer LAN and WAN, the quality of network products (including software and hardware) has been continuously improved; varieties and quantities have rapidly increased and developed; as well as the maturity of database technology and the development of software engineering methods, various computer network management systems are becoming increasingly perfect. The Microcomputer Ticketing System for tourist attractions is a combination of computer technology and network technology. Convenient and fast query statistics allow managers to accurately grasp the operation status of scenic spots, supervise and manage ticket sales personnel, and provide accurate and credible decision-making basis for them. It has successfully improved the ticket sales efficiency and management level of tourist attractions, and has been ending with the manual ticket sales situation, thus entering a new stage of intelligent ticket sales.

This article introduces the development method of the Microcomputer Ticketing System for tourist attractions running on Windows NT 4.0 with Delphi 6.5 as the development language and Microsoft SQL Server 4.0 as the background. This system is suitable for automated management of ticketing systems for major, medium, and small tourist attractions, and has great practical application value.

Ii. Overall system solution design

The Microcomputer ticketing system adopts a star-shaped LAN structure, which consists of servers, hubs, computers, and printers. See figure 1. Run the database and system management program on the server to implement functions such as query, statistics, report printing, and system maintenance. Each ticket sales microcomputer and the corresponding printer are placed in the ticket sales window, and the ticket sales program is run to complete the interface input, ticket printing, and ticket sales personnel personal information query and statistics functions.

For the ticketing system, printer speed and data transmission speed through the network are very critical indicators. For example, at the peak of the Qinhuangdao Wildlife Park, about 20 thousand people visited the park every day, and three computers were required to sell tickets. Most of the guests in the park were concentrated in the same period of time. For example, when the park was just opened in the morning and around ten o'clock A.M, two o'clock P.M ~ So it is a problem that the microcomputer ticketing system must solve to reduce the waiting time of tourists and speed up ticket sales. There are two factors that affect the ticket sales speed. One is the printing speed of the hardware printer and the other is the speed at which the printing program starts printing and transmitting data. According to actual tests, Epson stylus color 850 color inkjet printer can print 8 PAGES/minute on A4 paper to meet the requirements.

In terms of programming, in order to meet the printing speed requirements, after testing and careful selection, it is determined that Delphi 4.0 is used as the programming language. Delphi combines powerful Object Pascal language with fast and convenient rad. It is a common graphical user interface (GUI) development tool, it is designed based on visualization and component concepts, and can easily manipulate the database and implement various reports, making programming fast, it is one of the fastest programming languages for debugging and compilation. When printing tickets, you can directly call various procedures and functions in the printers class of Delphi, such as printers. canvas. textout (X: integer; Y: integer; const text: string) can be used in combination with other processes and functions to achieve rapid printing, solving 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) that uses Transact-SQL to send requests between the client and SQL Sever, it can meet the network transmission requirements of the system. In Delphi, you can access the database through BDE and ODBC, or directly access the database through ADO.

In addition, in the general program design, considering the uneven quality of the operator using the system, the computer operation level is relatively low, the operations involved should be as simple as possible, and the information should be input as little as possible, try to use the drop-down box and select box to avoid errors. The system operator only needs to enter the number of visitors (adults and children or students) and the number of vehicles. Other information, such as fare, is 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 easy to use.

Iii. Overall System Software Design

1. Database Table Design

The system database contains the retail ticket information table, password table, operator information table, fare information table, and view created for statistical query. The structure of the table is described in the example of the retail ticket information table. The field definition is shown in table 1.

Serial number: It is composed of the identification symbol of the conductor, the random number and the number of votes recorded starting from the PC ticket sales. For example, gk006662 represents the conductor with the ID number g. the random number is K and 6,662nd tickets.

Return ticket No: this field is used to identify whether the ticket is valid. If it is valid, it is 1. If it is invalid, it is 0.

2. Software Structure Design

The system software design follows the idea of modular program design and keeps improving from top to bottom. The system program consists of the system management module and the ticket sales module. The ticket sales module runs on the ticket sales microcomputer and the system management module runs on the server.

Iv. Main Features and implementation methods of the system

Main system modules: logon and password input modules; main system interface input modules; statistics, query, report, printing modules; ticket printing module. The following describes the functions of each module and the implementation of key parts.

1. login and password input module

The logon and password input modules are used to restrict the permissions of operators. Functions completed by the Program: retrieve the password from the interface and query the database password table. operators with the same password have the right to access the next interface, the program automatically exits when the input fails three times. In addition, in the ticket sales module, the name of the operator should be obtained based on the password to associate the ticket sales information with the operator. The following operator functions are obtained from the database based on the entered password. handletbl is the name of the password table, and ID, handlename, and handlecode are the fields in the table, representing the number, Operator name, and operator password.

Function tformpswd. gethandlename (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 information. The total number of travelers and fare are automatically calculated based on the information and fare. In this module, the operator is required to enter only the number of visitors. Press "OK" to automatically calculate and display the total price. Press "print" to print the tickets. To prevent program errors caused by incorrect input of characters other than integer data, such as a and B, the operator sets judgment conditions at the tedit location where data is required, only integer data input is allowed.

3. Statistics and query and report printing module

The statistics and query and report printing modules are used to collect and query ticket information. You can set the start and end dates and generate reports for printing. Statistics and query are implemented using an embedded SQL query language. Reports use various controls in the qreport component group of Delphi's quick report component.

4. Ticket printing module

The ticket printing module prints out tickets. In ticket printing, you must determine the output position based on the ticket style. To achieve fast printing, you can directly call the printers process and function 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 setting

...... // Insert the content to be printed as needed

Printer. Canvas. textout (x + 2370, Y, thesyqo); // print the content

Printer. enddoc;

End;

5. Refund Management Module

In the actual ticket sales process, tourists may refund tickets for various reasons. The tickets and related information printed by the computer have been stored in the database. When there is a refund, the ticket amount of the operator must be inconsistent with the database query results. To solve this problem, the refund management module is added.

Transfer http://tech.sina.com.cn 2001/02/13 Software world Ma Shuhua Shu Dongmei Zhao Yiding

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.