# JikoXpress Thermal Printer Documentation

> ESC/POS Templates, Print Flow & Integration Reference  
> Version 1.2 | March 2026 | QBIT SPARK CO LIMITED

---

## Table of Contents

1. [Overview](#1-overview)
2. [ESC/POS Quick Reference](#2-escpos-quick-reference)
3. [Discount & Calculation Rules](#3-discount--calculation-rules)
4. [Receipt — Dine In](#4-receipt--dine-in)
5. [Receipt — Pickup](#5-receipt--pickup)
6. [Kitchen Receipt — Delivery](#6-kitchen-receipt--delivery)
7. [Customer Bill](#7-customer-bill)
8. [Kitchen Ticket — Dine In](#8-kitchen-ticket--dine-in)
9. [Kitchen Ticket — Pack](#9-kitchen-ticket--pack)
10. [Order / Round Cancelled](#10-order--round-cancelled)
11. [Payment Slip — Kiosk Cash](#11-payment-slip--kiosk-cash)
12. [Full Print Flow](#12-full-print-flow)
13. [Name Display Rules](#13-name-display-rules)
14. [Java / Spring Boot Integration](#14-java--spring-boot-integration)

---

## 1. Overview

JikoXpress uses a thermal printer (MHT-P80A, 80mm, USB/LAN) for all customer and kitchen print operations. The printer speaks **ESC/POS** — a byte-level command language. No special driver is needed on Linux; CUPS handles the connection and raw bytes are sent directly to the printer.

**Printer specs:**
- Model: MHT-P80A
- Interface: USB (primary), LAN (future/Ethernet)
- Paper width: 80mm
- Characters per line: 48 (normal font)
- CUPS printer name: `MHT-P80H-Printer`

### Document Types

| # | Document | Printed | Digital | Channel | Recipient |
|---|----------|---------|---------|---------|-----------|
| 1 | Receipt | ✅ | ❌ | Dine In, Pickup | Customer |
| 2 | Kitchen Receipt | ✅ | ❌ | Delivery — inside package | Customer |
| 3 | Full Payment Receipt | ❌ | ✅ | Delivery — WhatsApp/SMS | Customer |
| 4 | Customer Bill | ✅ | ❌ | Dine In | Customer |
| 5 | Kitchen Ticket — Dine In | ✅ | ❌ | Dine In | Chef |
| 6 | Kitchen Ticket — Pack | ✅ | ❌ | Pickup, Delivery | Chef |
| 7 | Order / Round Cancelled | ✅ | ❌ | All | Chef |
| 8 | Payment Slip | ✅ | ❌ | Kiosk cash | Customer |

### Border Style Quick Reference

| Border | Document |
|--------|----------|
| `================================================` | Dine In tickets |
| `************************************************` | Pack tickets |
| `=` top/bottom + `- - -` middle | Cancellations |
| `. . . . . . . . .` | Payment Slip |

---

## 2. ESC/POS Quick Reference

| ESC Code | Meaning |
|----------|---------|
| `\x1b\x40` | Initialize printer (reset all settings) |
| `\x1b\x61\x00` | Align LEFT |
| `\x1b\x61\x01` | Align CENTER |
| `\x1b\x61\x02` | Align RIGHT |
| `\x1b\x45\x01` | Bold ON |
| `\x1b\x45\x00` | Bold OFF |
| `\x1b\x21\x00` | Normal font size |
| `\x1b\x21\x10` | Double height font (medium) |
| `\x1b\x21\x30` | Double width + height font (large) |
| `\x0a` | Line feed (new line) |
| `\x1d\x56\x00` | Full paper cut |
| `\x1d\x68\x40` | Barcode height — 64 dots |
| `\x1d\x77\x02` | Barcode width multiplier — x2 |
| `\x1d\x6b\x04 ... \x00` | Print CODE39 barcode (text + null terminator) |

> ⚠️ Always reset font with `\x1b\x21\x00` and bold with `\x1b\x45\x00` after large/bold sections.

---

## 3. Discount & Calculation Rules

### V1 Discount Types

JikoXpress V1 supports two discount types only. Item-level discounts are planned for V2.

| Type | Applied By | Shows On |
|------|-----------|---------|
| Order Discount | Waiter (manual, % or fixed amount) | Receipt, Bill |
| Coupon Code | Customer (at kiosk or ordering platform) | Receipt, Slip |

### Calculation Order

All totals follow this strict order:

```
Subtotal          = sum of all item prices (full prices)
Order Discount    = percentage or fixed amount off subtotal (if applied)
Coupon Discount   = coupon value off remaining amount (if applied)
                  ─────────────────────────────────────
Discounted Total  = Subtotal - Order Discount - Coupon Discount
VAT (18%)         = 18% of Discounted Total   ← VAT always after discounts
                  ─────────────────────────────────────
TOTAL             = Discounted Total + VAT
```

### Coupon Validation

Coupons are validated **at the kiosk** before the slip is printed — not at the counter. This means:
- Customer sees the discounted price before going to counter
- Cashier just collects the amount on the slip — no manual calculation
- Coupon is consumed in the system at validation — no double use
- Slip shows coupon code so cashier can verify if needed

### Paid & Change

Paid and Change lines appear **only on cash payment receipts**. For M-Pesa/card the exact amount is charged so no change line is needed.

```
 Payment: Cash
 Paid:                              TZS 10000
 Change:                            TZS   848
```

### Display Rules

- Show discount lines **only if a discount was applied** — never show empty discount lines
- Show coupon line **only if a coupon was used**
- Show Paid/Change **only for cash payments**
- VAT is always calculated on the discounted amount

---

## 4. Receipt — Dine In

**When printed:** After dine-in customer completes payment. Official proof of purchase.

**Contains:** Restaurant header, date/time, waiter, table number, items, subtotal, discounts (if any), VAT, total, payment info, ready by time, order number, barcode, thank you, Powered by JikoXpress.

### Preview — Cash with Order Discount

```
================================================
            JIKOXPRESS
         Mbeya, Tanzania
      Tel: +255 700 000 000
================================================
 Date: 28/03/2026        Time: 19:30
 Waiter: Amina           Table: 05
================================================
 Item                    Qty         Price
------------------------------------------------
 Chips Mwitu              1            500
 Kuku Choma               2           6000
 Soda Baridi              2           1000
 Maji ya Madafu           1            500
================================================
 Subtotal:                          TZS 8000
 Discount (10%):                   -TZS  800
================================================
 VAT (18%):                         TZS 1296
================================================
 TOTAL:                             TZS 8496
================================================
 Payment: Cash
 Paid:                              TZS 10000
 Change:                            TZS  1504
 Ready By: 19:45
================================================
          Order: JKX-00123
        [======= BARCODE =======]

       Asante kwa kununua!
      Karibu tena JikoXpress
================================================
         Powered by JikoXpress
================================================
```

### Preview — M-Pesa, No Discount

```
================================================
            JIKOXPRESS
         Mbeya, Tanzania
      Tel: +255 700 000 000
================================================
 Date: 28/03/2026        Time: 19:30
 Waiter: Amina           Table: 05
================================================
 Item                    Qty         Price
------------------------------------------------
 Chips Mwitu              1            500
 Kuku Choma               2           6000
 Soda Baridi              2           1000
 Maji ya Madafu           1            500
================================================
 Subtotal:                          TZS 8000
 VAT (18%):                         TZS 1440
================================================
 TOTAL:                             TZS 9440
================================================
 Payment: M-Pesa
 Ref: MP2026XXXX
 Ready By: 19:45
================================================
          Order: JKX-00123
        [======= BARCODE =======]

       Asante kwa kununua!
      Karibu tena JikoXpress
================================================
         Powered by JikoXpress
================================================
```

### ESC/POS Command — Cash with Discount

```bash
printf '\x1b\x61\x01\x1b\x21\x30JIKOXPRESS\x1b\x21\x00\n\x1b\x61\x01Mbeya, Tanzania\nTel: +255 700 000 000\n================================================\n\x1b\x61\x00Date: 28/03/2026  Time: 19:30\nWaiter: Amina           Table: 05\n================================================\n\x1b\x45\x01Item                     Qty        Price\x1b\x45\x00\n------------------------------------------------\nChips Mwitu              1            500\nKuku Choma               2           6000\nSoda Baridi              2           1000\nMaji ya Madafu           1            500\n================================================\n\x1b\x45\x01Subtotal:                          TZS 8000\x1b\x45\x00\nDiscount (10%%):                  -TZS  800\n================================================\nVAT (18%%):                        TZS 1296\n================================================\n\x1b\x45\x01\x1b\x21\x10TOTAL:                         TZS 8496\x1b\x21\x00\x1b\x45\x00\n================================================\nPayment: Cash\nPaid:                              TZS 10000\nChange:                            TZS  1504\nReady By: 19:45\n================================================\n\x1b\x61\x01Order: JKX-00123\n\x1d\x68\x40\x1d\x77\x02\x1d\x6b\x04JKX00123\x00\n\nAsante kwa kununua!\nKaribu tena JikoXpress\n================================================\nPowered by JikoXpress\n\n\n\x1d\x56\x00' | lp -d MHT-P80H-Printer
```

---

## 5. Receipt — Pickup

**When printed:** After pickup customer completes payment.

**Contains:** Same as Dine In receipt but with customer full name instead of table number.

### Preview — Cash with Coupon

```
================================================
            JIKOXPRESS
         Mbeya, Tanzania
      Tel: +255 700 000 000
================================================
 Date: 28/03/2026        Time: 19:30
 Waiter: Amina
 Customer: John Mwangi
================================================
 Item                    Qty         Price
------------------------------------------------
 Chips Mwitu              1            500
 Kuku Choma               2           6000
 Soda Baridi              2           1000
================================================
 Subtotal:                          TZS 7500
 Coupon (SAVE20):                  -TZS 1500
================================================
 VAT (18%):                         TZS 1080
================================================
 TOTAL:                             TZS 7080
================================================
 Payment: Cash
 Paid:                              TZS 8000
 Change:                            TZS  920
 Ready By: 19:50
================================================
          Order: JKX-00124
        [======= BARCODE =======]

       Asante kwa kununua!
      Karibu tena JikoXpress
================================================
         Powered by JikoXpress
================================================
```

### ESC/POS Command

```bash
printf '\x1b\x61\x01\x1b\x21\x30JIKOXPRESS\x1b\x21\x00\n\x1b\x61\x01Mbeya, Tanzania\nTel: +255 700 000 000\n================================================\n\x1b\x61\x00Date: 28/03/2026  Time: 19:30\nWaiter: Amina\nCustomer: John Mwangi\n================================================\n\x1b\x45\x01Item                     Qty        Price\x1b\x45\x00\n------------------------------------------------\nChips Mwitu              1            500\nKuku Choma               2           6000\nSoda Baridi              2           1000\n================================================\n\x1b\x45\x01Subtotal:                          TZS 7500\x1b\x45\x00\nCoupon (SAVE20):                  -TZS 1500\n================================================\nVAT (18%%):                        TZS 1080\n================================================\n\x1b\x45\x01\x1b\x21\x10TOTAL:                         TZS 7080\x1b\x21\x00\x1b\x45\x00\n================================================\nPayment: Cash\nPaid:                              TZS  8000\nChange:                            TZS   920\nReady By: 19:50\n================================================\n\x1b\x61\x01Order: JKX-00124\n\x1d\x68\x40\x1d\x77\x02\x1d\x6b\x04JKX00124\x00\n\nAsante kwa kununua!\nKaribu tena JikoXpress\n================================================\nPowered by JikoXpress\n\n\n\x1d\x56\x00' | lp -d MHT-P80H-Printer
```

---

## 6. Kitchen Receipt — Delivery

**When printed:** Printed and placed inside the delivery package.

**Contains:** Food items + prices, subtotal, discounts (if any), VAT, total, order number, customer first name, courier name, ready by time.

**Does NOT contain:** Delivery fee, full address, zone, payment method — those are in the Full Payment Receipt sent digitally.

> 💡 The **Full Payment Receipt** (with delivery fee, full address, payment ref) is sent digitally via WhatsApp/SMS. It is not printed.

### Preview

```
================================================
            JIKOXPRESS
         Mbeya, Tanzania
      Tel: +255 700 000 000
================================================
 Date: 28/03/2026        Time: 19:32
 Customer: Sarah
 Courier: James Oduya
================================================
 Item                    Qty         Price
------------------------------------------------
 Kuku Choma               1           3000
 Maji ya Madafu           2           1000
================================================
 Subtotal:                          TZS 4000
 VAT (18%):                         TZS  720
================================================
 TOTAL:                             TZS 4720
================================================
 Ready By: 19:55
================================================
          Order: JKX-00125
        [======= BARCODE =======]

       Asante kwa kununua!
      Karibu tena JikoXpress
================================================
         Powered by JikoXpress
================================================
```

### ESC/POS Command

```bash
printf '\x1b\x61\x01\x1b\x21\x30JIKOXPRESS\x1b\x21\x00\n\x1b\x61\x01Mbeya, Tanzania\nTel: +255 700 000 000\n================================================\n\x1b\x61\x00Date: 28/03/2026  Time: 19:32\nCustomer: Sarah\nCourier: James Oduya\n================================================\n\x1b\x45\x01Item                     Qty        Price\x1b\x45\x00\n------------------------------------------------\nKuku Choma               1           3000\nMaji ya Madafu           2           1000\n================================================\n\x1b\x45\x01Subtotal:                          TZS 4000\x1b\x45\x00\nVAT (18%%):                        TZS  720\n================================================\n\x1b\x45\x01\x1b\x21\x10TOTAL:                         TZS 4720\x1b\x21\x00\x1b\x45\x00\n================================================\nReady By: 19:55\n================================================\n\x1b\x61\x01Order: JKX-00125\n\x1d\x68\x40\x1d\x77\x02\x1d\x6b\x04JKX00125\x00\n\nAsante kwa kununua!\nKaribu tena JikoXpress\n================================================\nPowered by JikoXpress\n\n\n\x1d\x56\x00' | lp -d MHT-P80H-Printer
```

---

## 7. Customer Bill

**When printed:** When dine-in customer requests the bill before payment.

**Contains:** All rounds accumulated, subtotal, order discount (if applied by waiter), VAT, total due. Explicitly states "This is not a receipt".

**Note:** Coupon discounts do not apply to dine-in bills — coupons are for kiosk/online orders only.

### Preview — With Order Discount

```
================================================
              BILL
           TABLE 05
================================================
  # JKX-00123
  28/03/2026        Waiter: Amina
================================================
 ROUND 1 - 19:30
------------------------------------------------
 Chips Mwitu              1            500
 Kuku Choma               2           6000
================================================
 ROUND 2 - 19:55
------------------------------------------------
 Soda Baridi              2           1000
 Maji ya Madafu           1            500
================================================
 Subtotal:                          TZS 8000
 Discount (10%):                   -TZS  800
================================================
 VAT (18%):                         TZS 1296
================================================
 TOTAL DUE:                         TZS 8496
================================================
        This is not a receipt
        Please proceed to pay
================================================
         Powered by JikoXpress
================================================
```

### ESC/POS Command

```bash
printf '\x1b\x61\x01\x1b\x21\x30BILL\x1b\x21\x00\n\x1b\x21\x10\x1b\x45\x01TABLE 05\x1b\x45\x00\x1b\x21\x00\n================================================\n\x1b\x61\x00\x1b\x21\x10\x1b\x45\x01# JKX-00123\x1b\x45\x00\x1b\x21\x00\n28/03/2026   Waiter: Amina\n================================================\n\x1b\x45\x01ROUND 1 - 19:30\x1b\x45\x00\n------------------------------------------------\nChips Mwitu              1            500\nKuku Choma               2           6000\n================================================\n\x1b\x45\x01ROUND 2 - 19:55\x1b\x45\x00\n------------------------------------------------\nSoda Baridi              2           1000\nMaji ya Madafu           1            500\n================================================\n\x1b\x45\x01Subtotal:                          TZS 8000\x1b\x45\x00\nDiscount (10%%):                  -TZS  800\n================================================\nVAT (18%%):                        TZS 1296\n================================================\n\x1b\x21\x10\x1b\x45\x01TOTAL DUE:                     TZS 8496\x1b\x45\x00\x1b\x21\x00\n================================================\n\x1b\x61\x01This is not a receipt\nPlease proceed to pay\n================================================\nPowered by JikoXpress\n\n\n\x1d\x56\x00' | lp -d MHT-P80H-Printer
```

---

## 8. Kitchen Ticket — Dine In

**When printed:** Every time a dine-in order is placed or a new round is added. Chef receives one ticket per round.

**Border style:** `=` — calm, signals food will be plated and served at the table.

**Does NOT contain:** Prices, discounts, customer name, payment info.

### Preview — Round 1

```
================================================
           -- DINE IN --
================================================
      TABLE 05          ROUND 1
================================================
      # JKX-00123
      28/03/2026  19:30
================================================
 Item                                  Qty
------------------------------------------------
 Chips Mwitu                             1
 Kuku Choma                              2
 Soda Baridi                             2
 Maji ya Madafu                          1
================================================
 NOTES:
 ! ONGEZA CHUMVI KWA CHIPS
 ! KUKU BILA PILIPILI
================================================
          READY BY: 19:45
================================================
```

### Preview — Round 2 (new items only)

```
================================================
           -- DINE IN --
================================================
      TABLE 05          ROUND 2
================================================
      # JKX-00123
      28/03/2026  19:55
================================================
 Item                                  Qty
------------------------------------------------
 Soda Baridi                             2
 Maji ya Madafu                          1
================================================
 NOTES:
 ! ONGEZA SUKARI KWA MADAFU
================================================
          READY BY: 20:10
================================================
```

### ESC/POS Command

```bash
printf '================================================\n\x1b\x61\x01\x1b\x21\x30\x1b\x45\x01-- DINE IN --\x1b\x45\x00\x1b\x21\x00\n================================================\n\x1b\x61\x01\x1b\x21\x30\x1b\x45\x01TABLE 05        ROUND 1\x1b\x45\x00\x1b\x21\x00\n================================================\n\x1b\x61\x00\x1b\x21\x30\x1b\x45\x01# JKX-00123\x1b\x45\x00\x1b\x21\x00\n28/03/2026  19:30\n================================================\n\x1b\x45\x01Item                                  Qty\x1b\x45\x00\n------------------------------------------------\nChips Mwitu                             1\nKuku Choma                              2\n================================================\n\x1b\x45\x01NOTES:\x1b\x45\x00\n\x1b\x21\x10\x1b\x45\x01! ONGEZA CHUMVI KWA CHIPS\x1b\x45\x00\x1b\x21\x00\n\x1b\x21\x10\x1b\x45\x01! KUKU BILA PILIPILI\x1b\x45\x00\x1b\x21\x00\n================================================\n\x1b\x61\x01\x1b\x21\x10\x1b\x45\x01READY BY: 19:45\x1b\x45\x00\x1b\x21\x00\n================================================\n\n\n\x1d\x56\x00' | lp -d MHT-P80H-Printer
```

---

## 9. Kitchen Ticket — Pack

**When printed:** When a pickup or delivery order is placed.

**Border style:** `*` — high attention, signals food must be packaged.

**Two variants:**
- **Pickup** — no customer name, no courier
- **Delivery** — customer first name + courier name

### Preview — Pickup

```
************************************************
*                                              *
            *** PACK ***
*                                              *
************************************************
      # JKX-00124
      28/03/2026  19:32
************************************************
 Item                                  Qty
------------------------------------------------
 Chips Mwitu                             2
 Kuku Choma                              1
************************************************
 NOTES:
 ! CHIPS BILA CHUMVI
************************************************
          READY BY: 19:47
************************************************
```

### Preview — Delivery

```
************************************************
*                                              *
            *** PACK ***
*                                              *
************************************************
      # JKX-00125
      28/03/2026  19:35
      Customer: Sarah
      Courier: James
************************************************
 Item                                  Qty
------------------------------------------------
 Kuku Choma                              1
 Maji ya Madafu                          2
************************************************
 NOTES:
 ! ONGEZA MCHUZI
************************************************
          READY BY: 19:50
************************************************
```

### ESC/POS Command — Pickup

```bash
printf '************************************************\n*                                              *\n\x1b\x61\x01\x1b\x21\x30\x1b\x45\x01*** PACK ***\x1b\x45\x00\x1b\x21\x00\n*                                              *\n************************************************\n\x1b\x61\x00\x1b\x21\x30\x1b\x45\x01# JKX-00124\x1b\x45\x00\x1b\x21\x00\n28/03/2026  19:32\n************************************************\n\x1b\x45\x01Item                                  Qty\x1b\x45\x00\n------------------------------------------------\nChips Mwitu                             2\nKuku Choma                              1\n************************************************\n\x1b\x45\x01NOTES:\x1b\x45\x00\n\x1b\x21\x10\x1b\x45\x01! CHIPS BILA CHUMVI\x1b\x45\x00\x1b\x21\x00\n************************************************\n\x1b\x61\x01\x1b\x21\x10\x1b\x45\x01READY BY: 19:47\x1b\x45\x00\x1b\x21\x00\n************************************************\n\n\n\x1d\x56\x00' | lp -d MHT-P80H-Printer
```

### ESC/POS Command — Delivery

```bash
printf '************************************************\n*                                              *\n\x1b\x61\x01\x1b\x21\x30\x1b\x45\x01*** PACK ***\x1b\x45\x00\x1b\x21\x00\n*                                              *\n************************************************\n\x1b\x61\x00\x1b\x21\x30\x1b\x45\x01# JKX-00125\x1b\x45\x00\x1b\x21\x00\n28/03/2026  19:35\nCustomer: Sarah\nCourier: James\n************************************************\n\x1b\x45\x01Item                                  Qty\x1b\x45\x00\n------------------------------------------------\nKuku Choma                              1\nMaji ya Madafu                          2\n************************************************\n\x1b\x45\x01NOTES:\x1b\x45\x00\n\x1b\x21\x10\x1b\x45\x01! ONGEZA MCHUZI\x1b\x45\x00\x1b\x21\x00\n************************************************\n\x1b\x61\x01\x1b\x21\x10\x1b\x45\x01READY BY: 19:50\x1b\x45\x00\x1b\x21\x00\n************************************************\n\n\n\x1d\x56\x00' | lp -d MHT-P80H-Printer
```

---

## 10. Order / Round Cancelled

**When printed:** When a full order or specific round is cancelled after kitchen ticket has been sent.

**Border style:** Mix of `=` (top/bottom) and `- -` (middle) — unmistakable.

### Preview — Full Order Cancelled

```
================================================
- - - - - - - - - - - - - - - - - - - - - - - -
         ORDER CANCELLED
   #JKX-00123          TABLE 05
   28/03/2026  19:30
- - - - - - - - - - - - - - - - - - - - - - - -
       STOP PREPARING THIS ORDER
- - - - - - - - - - - - - - - - - - - - - - - -
================================================
```

### Preview — Round Cancelled

```
================================================
- - - - - - - - - - - - - - - - - - - - - - - -
         ROUND CANCELLED
   #JKX-00123          ROUND 2
   TABLE 05   28/03/2026  19:55
- - - - - - - - - - - - - - - - - - - - - - - -
       STOP ROUND 2 ITEMS ONLY
- - - - - - - - - - - - - - - - - - - - - - - -
================================================
```

### ESC/POS Command — Full Order Cancelled

```bash
printf '================================================\n- - - - - - - - - - - - - - - - - - - - - - - -\n\x1b\x61\x01\x1b\x21\x30\x1b\x45\x01ORDER CANCELLED\x1b\x45\x00\x1b\x21\x00\n\x1b\x21\x30\x1b\x45\x01#JKX-00123  TABLE 05\x1b\x45\x00\x1b\x21\x00\n\x1b\x21\x00\x1b\x45\x0128/03/2026  19:30\x1b\x45\x00\n- - - - - - - - - - - - - - - - - - - - - - - -\n\x1b\x21\x10\x1b\x45\x01STOP PREPARING THIS ORDER\x1b\x45\x00\x1b\x21\x00\n- - - - - - - - - - - - - - - - - - - - - - - -\n================================================\n\n\n\x1d\x56\x00' | lp -d MHT-P80H-Printer
```

### ESC/POS Command — Round Cancelled

```bash
printf '================================================\n- - - - - - - - - - - - - - - - - - - - - - - -\n\x1b\x61\x01\x1b\x21\x30\x1b\x45\x01ROUND CANCELLED\x1b\x45\x00\x1b\x21\x00\n\x1b\x21\x30\x1b\x45\x01#JKX-00123  ROUND 2\x1b\x45\x00\x1b\x21\x00\n\x1b\x21\x00\x1b\x45\x01TABLE 05  28/03/2026  19:55\x1b\x45\x00\x1b\x21\x00\n- - - - - - - - - - - - - - - - - - - - - - - -\n\x1b\x21\x10\x1b\x45\x01STOP ROUND 2 ITEMS ONLY\x1b\x45\x00\x1b\x21\x00\n- - - - - - - - - - - - - - - - - - - - - - - -\n================================================\n\n\n\x1d\x56\x00' | lp -d MHT-P80H-Printer
```

---

## 11. Payment Slip — Kiosk Cash

**When printed:** When a kiosk customer chooses to pay cash at the counter.

**This is NOT an order yet.** Only after cashier confirms payment does the system create a real order and send to kitchen.

**Coupon:** Validated at kiosk before slip prints. Discounted total already reflected on slip — cashier just collects the amount shown.

**Expiry:** Configurable by admin. Default: 15 minutes from slip creation.

### Preview — With Coupon

```
. . . . . . . . . . . . . . . . . . . . . . . .
           PAYMENT SLIP
. . . . . . . . . . . . . . . . . . . . . . . .
.                                             .
.            SLIP-0045                        .
.       [====== BARCODE ======]               .
.                                             .
. . . . . . . . . . . . . . . . . . . . . . . .
 Item                          Qty      Price
...............................................
 Chips Mwitu                    1        500
 Kuku Choma                     2       6000
 Soda Baridi                    2       1000
...............................................
 Subtotal:                           TZS 8000
 Coupon (SAVE20):                   -TZS 1600
 VAT (18%):                          TZS 1152
...............................................
 TOTAL DUE:                          TZS 6552
. . . . . . . . . . . . . . . . . . . . . . . .
.                                             .
.    TAKE THIS TO COUNTER BEFORE:            .
.                                             .
.              19:45                          .
.                                             .
. . . . . . . . . . . . . . . . . . . . . . . .
```

### Preview — No Coupon

```
. . . . . . . . . . . . . . . . . . . . . . . .
           PAYMENT SLIP
. . . . . . . . . . . . . . . . . . . . . . . .
.                                             .
.            SLIP-0045                        .
.       [====== BARCODE ======]               .
.                                             .
. . . . . . . . . . . . . . . . . . . . . . . .
 Item                          Qty      Price
...............................................
 Chips Mwitu                    1        500
 Kuku Choma                     2       6000
 Soda Baridi                    2       1000
...............................................
 Subtotal:                           TZS 8000
 VAT (18%):                          TZS 1440
...............................................
 TOTAL DUE:                          TZS 9440
. . . . . . . . . . . . . . . . . . . . . . . .
.                                             .
.    TAKE THIS TO COUNTER BEFORE:            .
.                                             .
.              19:45                          .
.                                             .
. . . . . . . . . . . . . . . . . . . . . . . .
```

### ESC/POS Command — With Coupon

```bash
printf '. . . . . . . . . . . . . . . . . . . . . . . .\n\x1b\x61\x01\x1b\x21\x10\x1b\x45\x01PAYMENT SLIP\x1b\x45\x00\x1b\x21\x00\n. . . . . . . . . . . . . . . . . . . . . . . .\n.\n\x1b\x61\x01\x1b\x21\x30\x1b\x45\x01SLIP-0045\x1b\x45\x00\x1b\x21\x00\n\x1d\x68\x50\x1d\x77\x02\x1d\x6b\x04SLIP0045\x00\n.\n. . . . . . . . . . . . . . . . . . . . . . . .\n\x1b\x61\x00\x1b\x45\x01Item                          Qty      Price\x1b\x45\x00\n...............................................\nChips Mwitu                    1          500\nKuku Choma                     2         6000\nSoda Baridi                    2         1000\n...............................................\n\x1b\x45\x01Subtotal:                          TZS 8000\x1b\x45\x00\nCoupon (SAVE20):                  -TZS 1600\nVAT (18%%):                        TZS 1152\n...............................................\n\x1b\x45\x01TOTAL DUE:                         TZS 6552\x1b\x45\x00\n. . . . . . . . . . . . . . . . . . . . . . . .\n.\n\x1b\x61\x01\x1b\x21\x10\x1b\x45\x01TAKE THIS TO COUNTER BEFORE:\x1b\x45\x00\x1b\x21\x00\n.\n\x1b\x21\x30\x1b\x45\x0119:45\x1b\x45\x00\x1b\x21\x00\n.\n. . . . . . . . . . . . . . . . . . . . . . . .\n\n\n\x1d\x56\x00' | lp -d MHT-P80H-Printer
```

---

## 12. Full Print Flow

### Dine In Flow

```
Customer sits → Waiter opens order, assigns table
       ↓
Waiter takes order
       ↓
Print: Kitchen Ticket (DINE IN, ROUND 1) → Chef cooks
       ↓
Customer orders more?
       ↓
Print: Kitchen Ticket (DINE IN, ROUND 2) → new items only
       ↓
Repeat for additional rounds...
       ↓
Customer asks for bill
       ↓
Waiter applies discount? (optional)
       ↓
Print: Bill (all rounds + discount if any, TOTAL DUE, not a receipt)
       ↓
Customer pays (cash or mobile money)
       ↓
Print: Receipt — Dine In (with discount if any, paid+change if cash)
```

### Pickup Flow

```
Order placed (POS / App / WhatsApp)
Customer applies coupon? → validated instantly
       ↓
Print: Kitchen Ticket (PACK — no names) → Chef prepares & packages
       ↓
Customer arrives, pays
       ↓
Print: Receipt — Pickup (customer full name, coupon if used, paid+change if cash)
```

### Delivery Flow

```
Order placed (App / WhatsApp)
Customer applies coupon? → validated instantly
       ↓
Digital Full Payment Receipt sent to customer (WhatsApp/SMS)
includes: delivery fee, address, payment ref, courier name, discounts
       ↓
Print: Kitchen Ticket (PACK — customer first name + courier name)
→ Chef prepares & packages
       ↓
Print: Kitchen Receipt → placed inside package
includes: food items, discounts, total, customer first name, courier name, ready by
       ↓
Courier collects and delivers
```

### Kiosk Cash Flow

```
Customer orders on kiosk
Customer enters coupon code? → validated instantly at kiosk
       ↓
Print: Payment Slip (SLIP-0045, discounted total if coupon, expiry time)
       ↓
Customer walks to counter with slip
       ↓
Cashier scans barcode → confirms payment → collects exact amount on slip
       ↓
System converts slip → Order JKX-00123
       ↓
Print: Kitchen Ticket (PACK) → Chef cooks
       ↓
Print: Receipt → Customer gets proof of payment
```

### Cancellation Flow

```
Order or round cancelled in JikoXpress system
       ↓
Print: Cancellation Ticket → immediately to kitchen printer
       ↓
Chef stops preparation, discards matching kitchen ticket
```

---

## 13. Name Display Rules

| Document | Dine In | Pickup | Delivery |
|----------|---------|--------|----------|
| Receipt | ❌ Table number only | ✅ Full name | ✅ Full name + Courier full name |
| Kitchen Receipt | — | — | ✅ First name + Courier first name |
| Bill | ❌ Table number only | — | — |
| Kitchen Ticket | ❌ No name | ✅ First name only | ✅ First name + Courier first name |
| Payment Slip | ❌ | ❌ | ❌ |

> **Rule:** Kitchen never sees full names or personal details. First name is enough for kitchen coordination. Full names only on official customer-facing documents.

---

## 14. Java / Spring Boot Integration

### Printer Name

```java
private static final String PRINTER_NAME = "MHT-P80H-Printer";
```

### Print Method

```java
public void print(String escposContent) throws Exception {
    ProcessBuilder pb = new ProcessBuilder("lp", "-d", PRINTER_NAME, "-o", "raw", "-");
    pb.redirectErrorStream(true);
    Process process = pb.start();
    process.getOutputStream().write(escposContent.getBytes(StandardCharsets.ISO_8859_1));
    process.getOutputStream().close();
    process.waitFor();
}
```

> ⚠️ Use `ISO_8859_1` encoding, not UTF-8.

### Discount Calculation (Java)

```java
public OrderTotals calculate(Order order) {
    BigDecimal subtotal = order.getItems().stream()
        .map(i -> i.getPrice().multiply(BigDecimal.valueOf(i.getQty())))
        .reduce(BigDecimal.ZERO, BigDecimal::add);

    BigDecimal orderDiscount = order.getOrderDiscount() != null
        ? subtotal.multiply(order.getOrderDiscount()).divide(BigDecimal.valueOf(100))
        : BigDecimal.ZERO;

    BigDecimal couponDiscount = order.getCouponDiscount() != null
        ? order.getCouponDiscount()
        : BigDecimal.ZERO;

    BigDecimal discountedTotal = subtotal
        .subtract(orderDiscount)
        .subtract(couponDiscount);

    BigDecimal vat = discountedTotal
        .multiply(BigDecimal.valueOf(18))
        .divide(BigDecimal.valueOf(100), 0, RoundingMode.HALF_UP);

    BigDecimal total = discountedTotal.add(vat);

    return new OrderTotals(subtotal, orderDiscount, couponDiscount, vat, total);
}
```

### Key Rules

1. Always reset font after large/bold: `\x1b\x21\x00` and `\x1b\x45\x00`
2. Notes must be uppercased: `note.toUpperCase()`
3. Ready By = order timestamp + admin-configured prep time
4. Barcode = order number without dashes e.g. `JKX00123`
5. Slip barcode = slip number without dashes e.g. `SLIP0045`
6. VAT always calculated after all discounts
7. Show discount lines only if discount was applied — never show empty lines
8. Show Paid/Change only for cash payments
9. Show coupon line only if coupon was used
10. Always end with `\n\n\n\x1d\x56\x00`
11. Delivery fee never on any printed document — digital only
12. Kitchen tickets never show prices or discounts

### Ethernet Printing (Future — LAN)

```java
public void printOverEthernet(String escposContent, String printerIp) throws Exception {
    try (Socket socket = new Socket(printerIp, 9100);
         OutputStream out = socket.getOutputStream()) {
        out.write(escposContent.getBytes(StandardCharsets.ISO_8859_1));
        out.flush();
    }
}
```

> Set printer IP via DHCP reservation. Port 9100 is the standard raw print port for ESC/POS over network.

---

*QBIT SPARK CO LIMITED | JikoXpress | March 2026*  
*This document is internal and confidential.*