--- tags: mPOS --- # Receipt Model JSON <style> .notused{ color:lightgrey; font-style:italic } .comment{ color:green; } .new{ color:red; } .removed{ text-decoration: line-through; font-style:italic; } </style> [toc] #### last updated: 2021/04/09 - added new attributes - buyer.moicaNo :::spoiler Changelog #### 2021/04/01 - added new attributes - buyer.passport #### 2021/03/24 - added new attributes - printJobId - type [`"purchase"`, `"dlv"`,` "repair"`, `"collect"`, `"so"`] - numOfCopies - item.barcode1 - item.barcode2 - item.barcode3 - added suggested return values ([Link](#POSPrinter-return-values)) #### 2021/03/08 - added new attributes - repairNo - buyer.memberName - payment.note - item.remarks ::: --- <table> <tbody> <tr> <th>&nbsp;</th> <th>一般交易</th> <th>配達起單/結帳</th> <th>維修單</th> <th>代收</th> <th>轉POS機結帳</th> </tr> <tr> <th>serialNo</th> <td>&#10004;&#65039; </td> <td>&#10004;&#65039; </td> <td>&#10004;&#65039; </td> <td>&#10004;&#65039; </td> <td>&#10060;</td> </tr> <tr> <th>invoiceNo</th> <td>&#10004;&#65039; </td> <td>&#10004;&#65039; </td> <td>&#10004;&#65039; </td> <td>&#10060;</td> <td>&#10060;</td> </tr> <tr> <th>deliverNo</th> <td>&#10060;</td> <td>&#10004;&#65039;</td> <td>&#10060; </td> <td>&#10060;</td> <td>&#10004;&#65039;</td> </tr> <tr> <th>repairNo</th> <td>&#10060; </td> <td>&#10060; </td> <td>&#10004;&#65039;</td> <td>&#10060;</td> <td>&#10060;</td> </tr> </tbody> </table> --- ## Normal Transaction 正常交易 / DLV 配達結帳 <span class="new">* New attr added 2021/04/09</span> <pre> { "printJobId": 1837820662, "type": "purchase" / "dlv", "numOfCopies": 1, <span class="comment">//列印張數</span> "repairNo": "", <span class="comment">//維修單號</span> "receiptNo":"KX70560038", "deliverNo":"", "serialNo":"02829", "random":"5474", "donateReceipt":"N", "printReceipt":"Y", "receiptAmt":73399, "netSale":69904, "tax":3495, "heartCode":"", "PONo":"", "subtotal": 73399, "time":"2021-03-08 16:22:22", "buyer":{ "memberName":"TEST", "memberID":"2990499999993" "memberTel":"0965391470", "commCode":"", <span class="new">"moicaNo": "",</span> "GUINo":"", "passport":"" }, "seller":{ "TKGUINo":"69568009", "storeNo":"00705", "sellerNo":" ", "storeName":"內湖訓練教室", "termNo":"0025", "addr":"內湖燦坤TEST" }, "payments":[ { "amount":73399, "method":"信用卡", <span class="removed">"note": "",</span> <span class="comment">// removed 20210308</span> "note":[ { "label": "PayNo", "text": "493817******0078" }, { "label": "分期", "text": "台灣銀行03期" } ] }, { "amount":1, "method":"現金", <span class="removed">"note": "",</span> <span class="comment">// removed 20210308</span> "note":[] } ], "items":[ { "quantity":1, "pluNo":"213200", "name":"ASUS S433EQ 筆記型電腦 黑", "pluSpec":"W10/ i5-1135G7/14F/16GD4/512GSSDP", "taxIncludeAmt":32000, "barcode1": null, "barcode2": null, "barcode3": null, "remarks":[] }, { "quantity":1, "pluNo":"211371", "name":"分離式空調延長2年保固", "pluSpec":"條碼326(免費8年+2年)", "taxIncludeAmt":3999, "barcode1": null, "barcode2": null, "barcode3": null, "remarks":[ { "label":"備註", "text":"213200 $32000 1234567890123" } ] }, { "quantity":1, "pluNo":"212340", "name":"iPhone 12 Pro 256GB 太平洋藍色", "pluSpec":"A2407", "taxIncludeAmt":37400, "barcode1": null, "barcode2": null, "barcode3": null, "remarks":[ { "label":"SEQ", "text":"G6TDP6PU0D95" } ] }, { "quantity":1, "pluNo":"212371", "name":"YE5(1年期)行動商品意外損壞保固服務", "pluSpec":"", "taxIncludeAmt":0, "barcode1": null, "barcode2": null, "barcode3": null, "remarks":[ { "label":"備註", "text":"212340 $37400 0987654321942" } ] } ] } </pre> ## Repair 維修結帳 <pre> { "printJobId": 1837820662, "type": "repair", "numOfCopies": 1, <span class="comment">//列印張數</span> "repairNo": "1234123412341", <span class="comment">//維修單號</span> "PONo":"", "deliverNo":"", "donateReceipt":"N", "tax":0, "serialNo":"02831", "printReceipt":"Y", "random":"2390", "netSale":1, "subtotal":1, "receiptNo":"KX70560039", "heartCode":"", "receiptAmt":1, "time":"2021-03-08 16:50:07", "buyer":{ "memberTel":"", "commCode":"", "memberName":"", "GUINo":"", <span class="new">"moicaNo": "",</span> "passport":"", "memberID":"" }, "seller":{ "TKGUINo":"69568009", "storeNo":"00705", "sellerNo":" ", "storeName":"內湖訓練教室", "termNo":"0025", "addr":"內湖燦坤TEST" }, "payments":[ { "note":[], "amount":1, "method":"現金" } ], "items":[ { "quantity":1, "pluNo":"029251", "name":"1C維修收入(1234123412341)", "pluSpec":"1C維修收入", "taxIncludeAmt":1, "remarks":[], "barcode1": null, "barcode2": null, "barcode3": null } ] } </pre> ## SO 轉POS機結帳 <pre> { "printJobId": 1837820662, "type": "so", "numOfCopies": 1, <span class="comment">//列印張數</span> "deliverNo": "7055003518001", "receiptAmt": 450, "subtotal": 450, "time": "2020-11-18 15:08:22", "netSale": 450, "heartCode": "", "printReceipt": "N", "receiptNo": "", <span class="notused">"PONo": "", "donateReceipt": "N", "tax": 0, "serialNo": "", "random": "", "payments": null,</span> "buyer": { "memberName":"TEST", "memberID": "2990499999993", "GUINo": "", "memberTel": "0965391470" <span class="notused">"commCode": "", "passport":""</span> <span class="new">"moicaNo": "",</span> }, "seller": { "storeNo": "00705", "termNo": "0025", "TKGUINo": "69568009", "addr": "內湖燦坤TEST", "sellerNo": " ", "storeName": "內湖訓練教室" }, "items": [ { "name": "Epson 12mm 緞帶米底黑字 LC-4JBK", "pluNo": "141640", "pluSpec": "LW-500/LW-700/LW-900P", "quantity": 1, "taxIncludeAmt": 450, "barcode1": null, "barcode2": null, "barcode3": null } ] } </pre> --- ## Collect 代收 <pre> { "printJobId": 1837820662, "type":"collect", "numOfCopies":3, <span class="comment">//列印張數</span> "serialNo":"03054", "PONo":"", "deliverNo":"", "donateReceipt":"N", "tax":0, "repairNo":"", "printReceipt":"N", "random":"6185", "netSale":0, "subtotal":2800, "receiptAmt":2800, "receiptNo":"", "heartCode":"", "time":"2021-03-24 13:34:14", "seller":{ "TKGUINo":"69568009", "storeNo":"00705", "sellerNo":" ", "storeName":"內湖訓練教室", "termNo":"0025", "addr":"內湖燦坤TEST" }, "buyer":{ "memberTel":"", "commCode":"", "memberName":"", "GUINo":"", "memberID":"", <span class="new">"moicaNo": "",</span> "passport":"" }, "payments":[ { "note":[], "amount":2800, "method":"現金" } ], "items":[ { "quantity":1, "pluNo":"", "name":"代收保費", "pluSpec":"", "taxIncludeAmt":2800, "barcode3":"040800000002800", "barcode2":"0000000217949060", "barcode1":"100308ACP", "remarks":[ { "label":"備註", "text":"\n 稅額:0 元\n 收款完成後須立即開通" } ] } ] } </pre> --- # POSPrinter return values ```json { "printJobId": <printJobId>, "deliverNo": <deliverNo>, "invoice": <invoiceNo>, "serialNo":<serialNo>, "printer":"None/RP700/PRN0", // printer name/model/id</span> "status":true, // if state == 2 "state": 2, // 0: DISCONNECT, 1: OFFLINE, 2: ONLINE "status_text": null "msg":null, // same as status_text, kept for compatibility purpose } ``` ## Invoice/Receipt printing format flowchart ```mermaid graph TD start((Start)) --> condHasInvoNum opInvoice(Print<br/>UniInvoice + receipt) -->condDlv opPrintReceipt(Print<br/>receipt only) -->condDlv opPrintRepair(Print<br/>repair slip) -->done((Done)) opPrintSO(Print SO) opPrintCollectBill(Print collect bill) condHasInvoNum{has<br/>invoice<br/>number} condIsRepair{is Repair} condHasSerial{has SerialNo} cond0{ReceiptAmt==0} condH{has heartCode} condD{donateReceipt=='Y'} condGUI{has GUI No} condC{has commCode} condDlv{Is Deliver Order} -->|YES| opDlv(Print Dlv slip) --> done((Done)) condDlv --> |NO| done((Done)) condHasInvoNum --> |YES| condIsRepair condIsRepair --> |NO| cond0 condIsRepair --> |YES| opPrintRepair condHasInvoNum --> |NO| condHasSerial condHasSerial --> |NO| opPrintSO --> done condHasSerial --> |YES| opPrintCollectBill --> done cond0 -->|YES| opPrintReceipt condD -->|YES| opPrintReceipt condC -->|YES| opPrintReceipt cond0 -->|NO| condH condH -->|YES| opSetDonate(donateReceipt='Y') --> condD condH -->|NO| condD condD -->|NO| condGUI condGUI -->|NO| condC condC -->|NO| opInvoice condGUI -->|YES| opInvoice ```