CN103914933B - A kind of printing invoice method and apparatus based on XML technology - Google Patents
A kind of printing invoice method and apparatus based on XML technology Download PDFInfo
- Publication number
- CN103914933B CN103914933B CN201210592656.8A CN201210592656A CN103914933B CN 103914933 B CN103914933 B CN 103914933B CN 201210592656 A CN201210592656 A CN 201210592656A CN 103914933 B CN103914933 B CN 103914933B
- Authority
- CN
- China
- Prior art keywords
- invoice
- data
- template file
- printing
- tttemplatedata
- 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.)
- Active
Links
Landscapes
- Record Information Processing For Printing (AREA)
- Accessory Devices And Overall Control Thereof (AREA)
Abstract
A kind of printing invoice method based on XML technology is the embodiment of the invention provides, is comprised the following steps:Generation template file, the template file makes according to invoice tickets sample, the template file uses XML format, wherein, each data item in invoice nominal value, takes a node all in the template file, and whole template file is characterized using class TTTemplateData, global property is characterized using class TTTemplateAttr, each data item is characterized using TTTemplateText;The template file is parsed, a TTTemplateData object is obtained, comprising an attributes object for TTTemplateAttr types, and a list List for the Item Object of TTTemplateText types;Filling data, corresponding invoice data value is inserted to each object in the List according to its attribute;Assembling print data, is assembled into the TTTemplateData invoice datas according to the print command and rule of printer the data of printing;Printed invoice, is sent to invoice data printer and sends print command, and invoice is to be printed.
Description
Technical field
The present invention relates to a kind of Method of printing, specifically, it is related to a kind of printing invoice method based on XML technology.
Background technology
XML Chineses are extensible markup language(English:EXtensible Markup Language, referred to as:
XML), it is a kind of markup language.Mark refers to computer information symbol to understand, by this kind of mark, can between computer
To process article comprising various information etc..These marks how are defined, international markup language can be both selected, such as
HTML, it is also possible to use as XML by the discretionary markup language of stakeholder, here it is the scalability of language.XML
It is from standard generalized markup language(SGML)What middle simplification was changed out.What it was mainly used has extensible markup language, can expand
Exhibition stylesheet language(XSL), XBRL and XPath etc..
A usual invoice includes many information and data, generally comprises taxpayer's information, invoice header, Drawee Party's letter
Breath, commodity managing detailed catalogue etc..During printing invoice, some data need drawer's craft typing, and some will be in server background
Issue.How to realize, to the effective easily organization and management of various and different invoice datas of originating carrying out, being one and making us
The problem of headache.
The content of the invention
In view of this, the invention provides a kind of printing invoice method based on XML technology, comprise the following steps:Generation
Template file, the template file makes according to invoice tickets sample, and the template file uses XML format, wherein, in invoice nominal value
Each data item, takes a node all in the template file, and whole template text is characterized using class TTTemplateData
Part, global property is characterized using class TTTemplateAttr, and each data item is characterized using TTTemplateText;Parsing institute
Template file is stated, a TTTemplateData object is obtained, comprising an attributes object for TTTemplateAttr types, and
One list List of the Item Object of TTTemplateText types;Filling data, to each object root in the List
Corresponding invoice data value is inserted according to its attribute;Assembling print data, the TTTemplateData invoice datas according to beating
The print command and rule of print machine are assembled into the data of printing;Printed invoice, is sent to invoice data printer and transmission is beaten
Print order, invoice is to be printed.
Preferably, for data item each described, its position has been provided in the template file, display content and aobvious
Show mode.
Preferably, public controlled attribute is also defined in the template file, defines setting of printing or the acquiescence of the overall situation
Set.
Preferably, in filling data step, static data need not insert data value.
Preferably, in assembling print data step, invoice data is sent by character data.
Preferably, in assembling print data step, the function of ndroid.graphics.Canvas objects is used
Invoice data is first drawn as a pictures by drawText (String text, float x, float y, Paint paint), so
The pixel data of picture is sent to printer afterwards.
Preferably, the data item at least includes:Purchaser's identifier, machine beat code, machine marking code, date of making out an invoice, product
Name specification, trade name, quantity, unit price, goods amount, project/expense detailed, total (small letter), total (capitalization), selling party
Title, selling party's identifier, remarks, security code, date of making out an invoice, amount of money small letter, amount of money capitalization, payee/marketing unit's name
One of title, beneficiary duty paragraph or paying party duty paragraph.
The present invention relies on XML technology, and invoice data is split as into data item independent one by one, and with node to data
Item carries out accurately description in detail.It is exactly template file to the XML file that whole invoice information is described.This programme is from making
Template file starts, and it is parsed in software and is filled invoice data, is then converted into printer data stream and is sent to
Blue-tooth printer is printed.Whole process is simple and effective so that the management to numerous and diverse invoice data becomes one simply
Work.
Brief description of the drawings
Fig. 1 is a signal for invoice using the printing of the printing invoice method based on XML technology of the embodiment of the present invention
Figure;
Fig. 2 is a kind of printing invoice device based on XML technology provided in an embodiment of the present invention, concrete structure diagram.
Specific embodiment
The present invention is described in detail below in conjunction with accompanying drawing, make introductions all round the hair based on XML technology of the invention
Key step included by ticket Method of printing.
1st, template generation:
Template is that the invoice tickets sample issued according to tax office makes, and template uses XML format.Tickets sample as shown in Figure 1, nominal value
Upper each data item, such as " machine plays code:", " 146001110202 " etc. a node is taken all in template file.
Such as " machine plays code:" node be described as follows:
Wherein,
<ID>It is the unique mark of data item;
<nType>The type code of data item, " 2 " represent the data item for static data, in invoice " machine beats generation
Code ", " machine marking code ", " making out an invoice the date ", and " drawer " etc. is all such data.And corresponding content item
The type code of " 146001100202 ", " 15273444 ", " 20121030 ", " Li Si " etc. is respectively " 22 ", " 23 ", " 26 ",
“28”;
<Name>It is the title of this data item;
<Class>It is the printing classification of this data item;
<bVisual>Represent whether this data item prints;
<nX>,<nY>,<nRight>,<nBottom>Represent that this data item is occupied on invoice respectively most left, most
On, it is most right, most descend coordinate;
<content>The content on invoice is printed upon for this data item;
<background>Represent that this data item is printed upon the background color on invoice,<nR>,<nG>,<nB>Represent respectively
The rgb value of color;
<nKind>Represent the classification of printing, list or content;
<FrameMode>Represent frame pattern;
<FrameColor>Represent border color;
<nAlign>Represent the alignment thereof of font;
<nFontHeight>Expression is printed upon the font height on invoice;
<nFontWidth>Expression is printed upon the set width on invoice;
Usually, data item present on invoice substantially has " purchaser's identifier ", " machine plays code ", " machine marking code:",
" make out an invoice the date:", " name of an article specification ", " trade name ", " quantity ", " unit price ", " goods amount ", " project/expense detail 5 ",
" project/expense detail 6 ", " total (small letter) ", " total (capitalization) ", " selling party's title ", " selling party's identifier " is " standby
Note ", " security code ", " making out an invoice the date ", " amount of money small letter ", " amount of money capitalization ", " payee/marketing unit's title ", " beneficiary
Duty paragraph ", " paying party duty paragraph " etc..Its position, display content and display have been provided for each item data, in template file
Mode.
Additionally, also defining common control information in template file, its structure is described as follows:
Wherein,
<ID>Represent the unique mark of invoice;
<Name>Invoice title;
<nPaperLen>The height of invoice paper;
<nPaperWidth>The width of invoice paper;
<bClockLen>It is fixed length mark;
<nTextHeight>The font height of acquiescence;
<nTextWidth>The set width of acquiescence;
<nDy>Line space;
<nDx>Word space;
<nPrntendLen>Paper length is walked after printing;
<nPrntBegLen>Paper length is walked before printing;
<nxPos>Printing syringe needle transversal displacement;
<nyPos>Printing syringe needle vertical misalignment amount;
<nPrntType>Printing model, if set is beaten.
These public attributes define some global settings of printing or default setting.
2nd, template parsing and data filling:
Software first has to parse template before printed invoice.Characterized entirely with class TTTemplateData in software
Template file, global property is characterized with class TTTemplateAttr, and each data item is characterized with TTTemplateText.Mould
Plate file reads in internal memory, during XML node value read in into corresponding object respectively.Result after parsing is to obtain one
TTTemplateData objects, comprising an attributes object for TTTemplateAttr types, and a TTTemplateText
The list List of the Item Object of type.Then corresponding invoice data is inserted according to its attribute to each object in List
Value.Obviously, data type is the data that need not insert of " 2 ", and this kind of data can regard static as.Other kinds of data
Such as " invoice codes ", " invoice number " etc. will insert corresponding invoice data.
3rd, assemble print data and print:
Next step is exactly according to the print command of blue-tooth printer and rule assembling TTTemplateData invoice datas
Into the data of printing.Assembling mode has two kinds, and one kind is to send invoice data by character data, and the advantage of this mode is destined for
The data volume of printer is few, but control is relative complex, because different printers may have different printings to character
Form is controlled;Another way be use ndroid.graphics.Canvas objects function drawText (Stringtext,
Float x, float y, Paintpaint) invoice data is first drawn as a pictures, the picture of picture is then sent to printer
Prime number evidence, this mode is more flexible to character control ratio, also relatively good to different printer adaptability, but shortcoming is exactly several
Big according to amount, especially shortcoming becomes apparent when the data receiver buffering area of printer is less, it is likely that data occurs and loses
The situation of mistake.Finally, invoice data is sent to printer and sends print command, invoice can just be printed.
The embodiment of the present invention additionally provides a kind of printing invoice device based on XML technology, its concrete structure such as Fig. 2 institutes
Show, including with lower module:
Template file generation module 21, for generating template file, the template file makes according to invoice tickets sample, described
Template file uses XML format, wherein, each data item in invoice nominal value takes a node all in the template file,
Whole template file is characterized using class TTTemplateData, global property is characterized using class TTTemplateAttr, used
TTTemplateText characterizes each data item;
Template file parsing module 22, for parsing the template file, obtains a TTTemplateData object, bag
Containing an attributes object for TTTemplateAttr types, and a list for the Item Object of TTTemplateText types
List;
Database population module 23, for inserting corresponding invoice data according to its attribute to each object in the List
Value;
Data assembling module 24, for the TTTemplateData invoice datas according to the print command of printer and
Rule is assembled into the data of printing;
Printing invoice module 25, for invoice data to be sent into printer and print command is sent, invoice is to be printed
Go out.
The present invention is fully applied in mobile phone makes out an invoice software, and effect is fine.The present invention is to a large amount of
Invoice data can efficiently and accurately be controlled, it is and easy to use, simply.Which greatly simplifies large number of and nothing
The management work of the invoice data of sequence, enables developer to focus more on developing business processes, and pole is brought to developer
Big facility, accelerates project development progress.
The preferred embodiments of the present invention are the foregoing is only, is not intended to limit the invention, for the skill of this area
For art personnel, the present invention can have various modifications and variations.It is all within the spirit and principles in the present invention, made any repair
Change, equivalent, improvement etc., should be included within the scope of the present invention.
Claims (5)
1. a kind of printing invoice method based on XML technology, it is characterised in that comprise the following steps:
Generation template file, the template file makes according to invoice tickets sample, and the template file uses XML format, wherein, hair
Each data item in ticket nominal value, takes a node all in the template file, is characterized using class TTTemplateData whole
Individual template file, global property is characterized using class TTTemplateAttr, and each data is characterized using TTTemplateText
;
The template file is parsed, a TTTemplateData object is obtained, comprising TTTemplateAttr type
Attributes object, and a list List for the Item Object of TTTemplateText types;
Filling data, corresponding invoice data value is inserted to each object in the List according to its attribute;
Assembling print data, is assembled into the TTTemplateData invoice datas according to the print command and rule of printer
The data of printing, wherein, invoice data is first drawn as a pictures using the function of ndroid.graphics.Canvas objects,
Then the pixel data of picture is sent to printer;Printed invoice, is sent to invoice data printer and sends print command,
Invoice is to be printed;Also,
For data item each described, its position, display content and display mode are provided in the template file;
Public controlled attribute is also defined in the template file, setting of printing or the default setting of the overall situation is defined.
2. the printing invoice method based on XML technology according to claim 1, it is characterised in that in filling data step,
Static data need not insert data value.
3. the printing invoice method based on XML technology according to claim 1, it is characterised in that assembling print data step
In rapid, invoice data is sent by character data.
4. the printing invoice method based on XML technology according to claim any one of 1-3, it is characterised in that the number
At least include according to item:Purchaser's identifier, machine beat code, machine marking code, the date of making out an invoice, name of an article specification, trade name, quantity,
Unit price, goods amount, project/expense detail, small letter add up to, capitalize total, selling party's title, selling party's identifier, remarks, prevent
Pseudo-code, date of making out an invoice, amount of money small letter, amount of money capitalization, payee/marketing unit's title, beneficiary duty paragraph or paying party duty paragraph
One of.
5. a kind of printing invoice device based on XML technology, it is characterised in that including with lower module:
Template file generation module, for generating template file, the template file makes according to invoice tickets sample, the template text
Part uses XML format, wherein, each data item in invoice nominal value takes a node all in the template file, uses class
TTTemplateData characterizes whole template file, and global property is characterized using class TTTemplateAttr, uses
TTTemplateText characterizes each data item;For data item each described, it is provided in the template file
Position, display content and display mode;Public controlled attribute is also defined in the template file, the printing for defining the overall situation sets
Put or default setting;
Template file parsing module, for parsing the template file, obtains a TTTemplateData object, comprising one
The attributes object of TTTemplateAttr types, and a list List for the Item Object of TTTemplateText types;
Database population module, for inserting corresponding invoice data value according to its attribute to each object in the List;
Data assembling module, for the TTTemplateData invoice datas according to the print command of printer and regular group
The data of printing are dressed up, wherein, invoice data is first drawn as one using the function of ndroid.graphics.Canvas objects
Picture, then sends the pixel data of picture to printer;
Printing invoice module, for invoice data to be sent into printer and print command is sent, invoice is to be printed.
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 CN103914933A (en) | 2014-07-09 |
CN103914933B true 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) |
Families Citing this family (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107423004B (en) * | 2017-06-20 | 2021-03-30 | 上海慧银信息科技有限公司 | Method for printing bill by POS terminal and POS terminal |
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 |
CN109683939B (en) * | 2018-12-29 | 2023-05-02 | 北京小米移动软件有限公司 | Component object updating method, device and storage medium |
CN112732205B (en) * | 2020-12-18 | 2024-06-18 | 航天信息股份有限公司 | Universal printing equipment control method, electronic equipment, storage medium and system |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101201816A (en) * | 2007-12-20 | 2008-06-18 | 北大方正集团有限公司 | Adapter and method for outputting data in data stream to XML document |
CN102567303A (en) * | 2010-12-24 | 2012-07-11 | 北京大学 | Typesetting method and device for variable official document data |
Family Cites Families (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7733509B2 (en) * | 2001-09-26 | 2010-06-08 | Infoprint Solutions Company, Llc | Method and apparatus for printing XML directly using a formatting template |
US6908034B2 (en) * | 2001-12-17 | 2005-06-21 | Zih Corp. | 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 |
CN100565601C (en) * | 2007-11-15 | 2009-12-02 | 北大方正集团有限公司 | A kind of bill processing apparatus and method |
CN101477733B (en) * | 2008-12-31 | 2010-11-17 | 深圳市奥拓电子股份有限公司 | Bill printing system |
CN101650711A (en) * | 2009-08-18 | 2010-02-17 | 深圳市科陆电子科技股份有限公司 | Method for generating report |
CN102074080B (en) * | 2009-11-25 | 2012-09-26 | 航天信息股份有限公司 | Customization and management method of visual management invoice template |
-
2012
- 2012-12-30 CN CN201210592656.8A patent/CN103914933B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101201816A (en) * | 2007-12-20 | 2008-06-18 | 北大方正集团有限公司 | Adapter and method for outputting data in data stream to XML document |
CN102567303A (en) * | 2010-12-24 | 2012-07-11 | 北京大学 | Typesetting method and device for variable official document data |
Also Published As
Publication number | Publication date |
---|---|
CN103914933A (en) | 2014-07-09 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN103914933B (en) | A kind of printing invoice method and apparatus based on XML technology | |
CN100350372C (en) | A printing system | |
US7277925B2 (en) | Internet document services | |
US7111235B1 (en) | Business description vocabulary for standardized, extensible interoperation | |
CN100565601C (en) | A kind of bill processing apparatus and method | |
US8296648B2 (en) | Method and system for displaying variable shaped products on a computer display | |
CN108052491A (en) | A kind of automatic processing method and device of certificate document | |
MXPA04005656A (en) | Xml printer system. | |
WO2001069404A1 (en) | Method and system for preparing printed matter | |
US6633890B1 (en) | Method for washing of graphic image files | |
US8381099B2 (en) | Flows for variable-data printing | |
CN108829363A (en) | Business voucher Method of printing and device | |
US20080201328A1 (en) | Data Processing System and Method | |
US20040205467A1 (en) | Mapping a print stream for printing on mailers from a first application for input to a second application | |
US6903839B1 (en) | Apparatus for washing of graphic image files | |
US20070226610A1 (en) | Data Processing System and Method | |
US20050125724A1 (en) | PPML to PDF conversion | |
US20030038972A1 (en) | Method and system for preparing printed matter | |
WO2001084299A1 (en) | Customizing forms based upon parameters in a template | |
World Wide Web Consortium | Cascading style sheets level 2 revision 1 (CSS 2.1) specification | |
JP2004046627A (en) | Business card management system, terminal device, and computer program and method for managing business card | |
US20060242571A1 (en) | Systems and methods for processing derivative featurees in input files | |
JP2004326567A (en) | Table content formation support system, method, and program | |
JP2011022773A (en) | Variable printing system, variable printing method, layout converter and text image generation device | |
Harder | Data merge and styles for Adobe InDesign CC 2018: Creating custom documents for mailouts and presentation packages |
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 |