CN103914933A - Invoice printing method and apparatus based on XML technology - Google Patents

Invoice printing method and apparatus based on XML technology Download PDF

Info

Publication number
CN103914933A
CN103914933A CN201210592656.8A CN201210592656A CN103914933A CN 103914933 A CN103914933 A CN 103914933A CN 201210592656 A CN201210592656 A CN 201210592656A CN 103914933 A CN103914933 A CN 103914933A
Authority
CN
China
Prior art keywords
invoice
data
printing
template file
xml
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201210592656.8A
Other languages
Chinese (zh)
Other versions
CN103914933B (en
Inventor
陈懿
陈皓
张伟
曹洪建
付立库
江洪
杨为琛
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Aisino Corp
Original Assignee
Aisino Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Aisino Corp filed Critical Aisino Corp
Priority to CN201210592656.8A priority Critical patent/CN103914933B/en
Publication of CN103914933A publication Critical patent/CN103914933A/en
Application granted granted Critical
Publication of CN103914933B publication Critical patent/CN103914933B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Accessory Devices And Overall Control Thereof (AREA)
  • Record Information Processing For Printing (AREA)

Abstract

An embodiment of the invention provides an invoice printing method based on XML technology. The method comprises the steps of generating a template file; parsing the template file to obtain a TTTemplateData object which contains a TTTemplateAttr type attribute object, and a List of TTTemplateText type data item objects; padding data, that is, inserting corresponding invoice data value in each object in the List based on the attribute; assembling printing data, that is, assembling the TTTemplateData invoice data into printing data in accordance with a printing command and rule of a printer; and printing invoices, that is, transmitting invoice data and a printing command to the printer, and printing out the invoices. The template file is made based on an invoice sample and adopts an XML format. Each data item on the invoice face value occupies a node in the template file, the TTTemplateData type is used for representing the entire template file, the TTTemplateAttr type is used for representing a global attribute, and the TTTemplateText is used for representing each data item.

Description

Invoice printing method and device based on XML technology
Technical Field
The invention relates to a printing method, in particular to an invoice printing method based on an XML technology.
Background
The name of XML is eXtensible markup language (English, XML), which is a markup language. The label refers to an information symbol that can be understood by computers, and by this label, articles containing various information can be handled between computers. How to define these tags can be either international common markup language such as HTML, or markup language such as XML, which is freely decided by the relevant person, and this is the extensibility of the language. XML is a simplified modification from the Standard Generalized Markup Language (SGML). The method mainly uses extensible markup language, extensible style language (XSL), XBRL, XPath and the like.
An invoice usually contains a lot of information and data, and generally comprises taxpayer information, invoice header information, invoice receiver information, commodity detailed information and the like. When the invoice is printed, some data need to be manually input by a invoicing clerk, and some data need to be issued in the background of the server. How to effectively and conveniently organize and manage a great deal of invoice data with different sources is a problem which is troublesome.
Disclosure of Invention
In view of this, the present invention provides an invoice printing method based on an XML technology, including the following steps: generating a template file, wherein the template file is manufactured according to an invoice sample, the template file adopts an XML format, each data item on the invoice surface occupies a node in the template file, the whole template file is represented by TTTemplateData, the global attribute is represented by TTTemplateAtttr, and each data item is represented by TTTemplateText; analyzing the template file to obtain a TTTemplateData object which comprises an attribute object of a TTTemplateAttr type and a List List of data item objects of the TTTemplateText type; filling data, and inserting corresponding invoice data values into each object in the List according to the attribute of the object; assembling printing data, and assembling the TTTemplateData invoice data into the printed data according to the printing command and the rule of a printer; and printing the invoice, sending the invoice data to a printer and sending a printing command, wherein the invoice is printed.
Preferably, for each of the data items, the position, display content and display mode of the data item are specified in the template file.
Preferably, the template file further defines a common control attribute, which defines a global print setting or a default setting.
Preferably, static data does not require insertion of data values in the step of padding data.
Preferably, in the step of assembling the print data, the invoice data is transmitted according to character data.
Preferably, in the step of assembling the print data, the invoice data is first drawn into a picture by using a function drawText (draw text, float x, float y, Paint point) of the object of the image, and then the pixel data of the picture is sent to the printer.
Preferably, the data items include at least: the purchaser identification number, the merchant code, the merchant number, the billing date, the product name specification, the product name, the quantity, the unit price, the product amount, the item/expense detail, the total (lower case), the total (upper case), the seller name, the seller identification number, the remark, the anti-counterfeiting code, the billing date, the lower case, the upper case, the payee/seller name, the payee tax number, or one of the payer tax numbers.
The invention divides the invoice data into an independent data item by means of XML technology, and describes the data item in detail and accurately by using nodes. The XML file describing the entire invoice information is the template file. The scheme starts from the production of a template file, analyzes the template file in software, fills invoice data, converts the invoice data into a printer data stream and sends the printer data stream to a Bluetooth printer for printing. The whole process is simple and effective, so that the management of complicated invoice data becomes a simple work.
Drawings
FIG. 1 is a schematic diagram of an invoice printed using an invoice printing method based on XML technology according to an embodiment of the invention;
fig. 2 is a specific structural diagram of an invoice printing apparatus based on the XML technology according to an embodiment of the present invention.
Detailed Description
The present invention will be described in detail below with reference to the accompanying drawings, which describe the main steps of the XML-based invoice printing method of the present invention one by one.
1. Template generation:
the template is made according to invoice sample issued by tax bureau, and the template adopts XML format. As shown in fig. 1, each data item on the face of the ticket, such as "machine-printed code: "," 146001110202 ", etc. all occupy a node in the template file.
Such as "machine-coded: "the nodes are described as follows:
wherein,
< ID > is a unique identification of the data item;
< nType > is the type code of the data item, "2" indicates that the data item is static data, and "machine code", "machine number", "date of invoice", and "drawer" in the invoice are all such data. And the type codes of the corresponding content items "146001100202", "15273444", "20121030", "liquad", etc. are "22", "23", "26", "28", respectively;
< Name > this Name of the data item;
< Class > is the print category for this data item;
< bVisual > indicates whether this data item is printed;
< nX >, < nY >, < nRight >, < nBottom > respectively represent the leftmost, the uppermost, the rightmost and the lowermost coordinates of the position occupied by the data item on the invoice;
< content > the content of printing on the invoice for this data item;
< background > represents the background color of the data item printed on the invoice, < nR >, < nG >, < nB > represents the RGB values of the color, respectively;
< nKind > indicates the category of printing, form or content;
< FrameMode > indicates a frame mode;
< FrameColor > indicates a border color;
< nAlign > indicates the alignment of the fonts;
< nFontHeight > indicates the font height printed on the invoice;
< nFontWidth > represents the font width printed on the invoice;
typically, the data items present on the invoice are roughly "purchaser identification number", "machine code: "," date of invoicing: "," item name specification "," commodity name "," quantity "," unit price "," commodity amount "," item/expense particulars 5 "," item/expense particulars 6 "," total (lower case) "," total (upper case) "," seller name "," seller identification number "," remark "," anti-counterfeit code "," billing date "," lower case of amount "," upper case of amount "," payee unit/seller name "," payee tax number "," payer tax number ", and the like. For each item of data, its position, display content and display mode are specified in the template file.
In addition, the template file also defines the common control information, and the structure of the common control information is described as follows:
wherein,
< ID > represents the unique identification of the invoice;
< Name > invoice Name;
< nPaperLen > height of the invoice paper;
< nPaperWidth > width of the invoice paper;
< bClockLen > is a fixed-length flag;
< nTextHeight > default font height;
< nTextWidth > default font width;
< nDy > line spacing;
< nDx > word spacing;
< nprintlen > length of paper fed after printing;
< nPrntBegLen > paper feed length before printing;
< nxPos > printing the lateral offset of the pinhead;
< nyPos > print tip longitudinal offset;
< nPrntType > print mode, whether to type.
These common attributes define some global print settings or default settings.
2. Template analysis and data filling:
the software first parses the template before printing the invoice. In the software, the whole template file is represented by a class TTTemplateData, the global attribute is represented by a class TTTemplateAttr, and each data item is represented by a class TTTemplateText. And reading the template file into a memory, and respectively reading the XML node values into corresponding objects. The result of the parsing is a TTTemplateData object, which contains an attribute object of TTTemplateAttr type and a List of data item objects of TTTemplateText type. And then inserting corresponding invoice data values for each object in the List according to the attribute of the object. Obviously, data of type "2" need not be inserted, and such data can be considered static. Other types of data such as "invoice code", "invoice number", etc. are to be filled in with the corresponding invoice data.
3. Assembling and printing the printing data:
the next step is to assemble TTTemplateData invoice data into printed data according to the printing command and the rules of the Bluetooth printer. There are two ways of assembly, one is to send invoice data per character data, which has the advantage of a small amount of data to the printer, but the control is relatively complex, since different printers may have different print format control over characters; another way is to use the function drawText (Stringtext, float x, float y, paintable) of the object of the graphics, draw the invoice data into a picture first, and then send the pixel data of the picture to the printer. Finally, the invoice data is sent to a printer and a printing command is sent, so that the invoice can be printed.
The embodiment of the invention also provides an invoice printing device based on the XML technology, the specific structure of which is shown in FIG. 2 and comprises the following modules:
the template file generation module 21 is configured to generate a template file, the template file is manufactured according to an invoice sample, the template file is in an XML format, each data item on an invoice surface occupies a node in the template file, a tttemplate data-like representation is used for representing the whole template file, a tttemplate attr-like representation is used for representing a global attribute, and a tttemplate text-like representation is used for representing each data item;
the template file analysis module 22 is used for analyzing the template file to obtain a TTTemplateData object which comprises an attribute object of a TTTemplateAttr type and a List List of data item objects of the TTTemplateText type;
a data filling module 23, configured to insert, according to an attribute of each object in the List, a corresponding invoice data value;
the data assembling module 24 is used for assembling the TTTemplateData invoice data into printed data according to the printing command and the rules of the printer;
and the invoice printing module 25 is used for sending the invoice data to the printer and sending a printing command, and the invoice is printed.
The invention has been fully applied in the mobile phone billing software, and has good effect. The invention can effectively and accurately control a large amount of invoice data, and has convenient and simple use. The management work of a large number of unordered invoice data is greatly simplified, developers can concentrate on the development of the business process, great convenience is brought to the developers, and the project development progress is accelerated.
The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (8)

1. An invoice printing method based on an XML technology is characterized by comprising the following steps:
generating a template file, wherein the template file is manufactured according to an invoice sample, the template file adopts an XML format, each data item on the invoice surface occupies a node in the template file, the whole template file is represented by TTTemplateData, the global attribute is represented by TTTemplateAtttr, and each data item is represented by TTTemplateText;
analyzing the template file to obtain a TTTemplateData object which comprises an attribute object of a TTTemplateAttr type and a List List of data item objects of the TTTemplateText type;
filling data, and inserting corresponding invoice data values into each object in the List according to the attribute of the object;
assembling printing data, and assembling the TTTemplateData invoice data into the printed data according to the printing command and the rule of a printer;
and printing the invoice, sending the invoice data to a printer and sending a printing command, wherein the invoice is printed.
2. The method for printing the invoice according to the XML technology as claimed in claim 1, wherein for each data item, the position, the display content and the display mode of the data item are specified in the template file.
3. The method for printing the invoice based on the XML technology as claimed in claim 1, wherein the template file further defines common control attributes, global printing settings or default settings.
4. The method for printing the invoice based on the XML technology as claimed in claim 1, wherein in the step of filling the data, the static data does not need to insert a data value.
5. The XML-technology-based invoice printing method according to claim 1, wherein in the printing data assembling step, the invoice data is transmitted according to character data.
6. The method for printing the invoice based on the XML technology as claimed in claim 1, wherein in the step of assembling the printing data, the invoice data is firstly drawn into a picture by using a function drawText (draw text, float x, flow, Paint point) of the object of the graphics.
7. An XML-technology-based invoice printing method according to any one of claims 1-6, wherein the data items comprise at least: the purchaser identification number, the merchant code, the merchant number, the billing date, the product name specification, the product name, the quantity, the unit price, the product amount, the item/expense detail, the total (lower case), the total (upper case), the seller name, the seller identification number, the remark, the anti-counterfeiting code, the billing date, the lower case, the upper case, the payee/seller name, the payee tax number, or one of the payer tax numbers.
8. The invoice printing device based on the XML technology is characterized by comprising the following modules:
the template file generation module is used for generating a template file, the template file is manufactured according to an invoice sample, the template file adopts an XML format, each data item on the invoice surface occupies a node in the template file, the class TTTemplateData is used for representing the whole template file, the class TTTemplateAtttr is used for representing the global attribute, and the class TTTemplateText is used for representing each data item;
the template file analysis module is used for analyzing the template file to obtain a TTTemplateData object which comprises an attribute object of a TTTemplateAttr type and a List List of data item objects of the TTTemplateText type;
the data filling module is used for inserting corresponding invoice data values into each object in the List according to the attribute of the object;
the data assembly module is used for assembling the TTTemplateData invoice data into printed data according to the printing command and the rule of the printer;
and the invoice printing module is used for sending the invoice data to the printer and sending a printing command, so that the invoice is printed.
CN201210592656.8A 2012-12-30 2012-12-30 A kind of printing invoice method and apparatus based on XML technology Active CN103914933B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201210592656.8A CN103914933B (en) 2012-12-30 2012-12-30 A kind of printing invoice method and apparatus based on XML technology

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201210592656.8A CN103914933B (en) 2012-12-30 2012-12-30 A kind of printing invoice method and apparatus based on XML technology

Publications (2)

Publication Number Publication Date
CN103914933A true CN103914933A (en) 2014-07-09
CN103914933B CN103914933B (en) 2017-06-30

Family

ID=51040581

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201210592656.8A Active CN103914933B (en) 2012-12-30 2012-12-30 A kind of printing invoice method and apparatus based on XML technology

Country Status (1)

Country Link
CN (1) CN103914933B (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107391057A (en) * 2017-07-06 2017-11-24 北京三快在线科技有限公司 A kind of billing information management method, device and equipment
CN107423004A (en) * 2017-06-20 2017-12-01 上海慧银信息科技有限公司 The method and POS terminal of POS terminal printed tickets
CN109389786A (en) * 2017-08-14 2019-02-26 航天信息股份有限公司 A kind of printing invoice method and device
CN109669648A (en) * 2018-12-25 2019-04-23 福建南威软件有限公司 A kind of method that electronics license set is beaten
CN109683939A (en) * 2018-12-29 2019-04-26 北京小米移动软件有限公司 Component object update method, device and storage medium
CN109710568A (en) * 2018-12-18 2019-05-03 深圳壹账通智能科技有限公司 Method, apparatus, medium and the electronic equipment of file format standardization of settling a claim processing
CN112732205A (en) * 2020-12-18 2021-04-30 航天信息股份有限公司 Universal printing equipment control method, electronic equipment, storage medium and system

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1554045A (en) * 2001-09-26 2004-12-08 �Ҵ���˾ A printing system
CN1836201A (en) * 2003-06-20 2006-09-20 Zih公司 Xml system
CN101046904A (en) * 2006-03-29 2007-10-03 深圳市桑达实业股份有限公司 Method for generating bill form file of tax control cashier
CN101145266A (en) * 2007-10-24 2008-03-19 中国工商银行股份有限公司 Bill and its automatic generation system
CN101174350A (en) * 2007-11-15 2008-05-07 北大方正集团有限公司 Bill processing equipment and method
CN101201816A (en) * 2007-12-20 2008-06-18 北大方正集团有限公司 Adapter and method for outputting data in data stream to XML document
CN101477733A (en) * 2008-12-31 2009-07-08 深圳市奥拓电子有限公司 Bill printing system
CN101650711A (en) * 2009-08-18 2010-02-17 深圳市科陆电子科技股份有限公司 Method for generating report
CN102074080A (en) * 2009-11-25 2011-05-25 航天信息股份有限公司 Customization and management method of visual management invoice template
CN102567303A (en) * 2010-12-24 2012-07-11 北京大学 Typesetting method and device for variable official document data

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1554045A (en) * 2001-09-26 2004-12-08 �Ҵ���˾ A printing system
CN1836201A (en) * 2003-06-20 2006-09-20 Zih公司 Xml system
CN101046904A (en) * 2006-03-29 2007-10-03 深圳市桑达实业股份有限公司 Method for generating bill form file of tax control cashier
CN101145266A (en) * 2007-10-24 2008-03-19 中国工商银行股份有限公司 Bill and its automatic generation system
CN101174350A (en) * 2007-11-15 2008-05-07 北大方正集团有限公司 Bill processing equipment and method
CN101201816A (en) * 2007-12-20 2008-06-18 北大方正集团有限公司 Adapter and method for outputting data in data stream to XML document
CN101477733A (en) * 2008-12-31 2009-07-08 深圳市奥拓电子有限公司 Bill printing system
CN101650711A (en) * 2009-08-18 2010-02-17 深圳市科陆电子科技股份有限公司 Method for generating report
CN102074080A (en) * 2009-11-25 2011-05-25 航天信息股份有限公司 Customization and management method of visual management invoice template
CN102567303A (en) * 2010-12-24 2012-07-11 北京大学 Typesetting method and device for variable official document data

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107423004A (en) * 2017-06-20 2017-12-01 上海慧银信息科技有限公司 The method and POS terminal of POS terminal printed tickets
CN107391057A (en) * 2017-07-06 2017-11-24 北京三快在线科技有限公司 A kind of billing information management method, device and equipment
CN109389786A (en) * 2017-08-14 2019-02-26 航天信息股份有限公司 A kind of printing invoice method and device
CN109710568A (en) * 2018-12-18 2019-05-03 深圳壹账通智能科技有限公司 Method, apparatus, medium and the electronic equipment of file format standardization of settling a claim processing
CN109669648A (en) * 2018-12-25 2019-04-23 福建南威软件有限公司 A kind of method that electronics license set is beaten
CN109683939A (en) * 2018-12-29 2019-04-26 北京小米移动软件有限公司 Component object update method, device and storage medium
CN112732205A (en) * 2020-12-18 2021-04-30 航天信息股份有限公司 Universal printing equipment control method, electronic equipment, storage medium and system

Also Published As

Publication number Publication date
CN103914933B (en) 2017-06-30

Similar Documents

Publication Publication Date Title
CN103914933B (en) A kind of printing invoice method and apparatus based on XML technology
US7475333B2 (en) Defining form formats with layout items that present data of business application
US7277925B2 (en) Internet document services
CN100565601C (en) A kind of bill processing apparatus and method
US20190171708A1 (en) Assistive technology for the impaired
CN100350372C (en) A printing system
CN112000302B (en) Label generation method, template configuration method, device and storage medium
CN107423004B (en) Method for printing bill by POS terminal and POS terminal
CN102360274A (en) Variable-data printing template realization device and application method for same
CN108829363A (en) Business voucher Method of printing and device
US8381099B2 (en) Flows for variable-data printing
US7085998B2 (en) Mapping a print stream for printing on mailers from a first application for input to a second application
US7664805B2 (en) System and method for modifying output of a computer program without source code modifications
CN107415489B (en) Method for expanding printing content and printer thereof
CN114691712A (en) Method and device for generating bill and storage medium
CN1329810C (en) General method for printing and drawing graphics document, dynamic link-base
KR100743175B1 (en) Advertisement writing method using computerized typesetting system
CN111625208A (en) Template receipt custom printing method
CN115454360A (en) Label printing method, device and medium capable of flexibly adjusting printing format
JP2009169810A (en) Authoring device
US20060242571A1 (en) Systems and methods for processing derivative featurees in input files
CN108196802A (en) A kind of variable data printing system
CN111045614B (en) Method for printing running water report, method for generating overprint file, client and server
KR100249328B1 (en) Slip preparing method
US20160371233A1 (en) Assistive technology for the impaired

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant