@rangka-os/create 0.5.0-alpha.10 → 0.5.0-alpha.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/template/base/apps/dapur/app.rk +35 -0
- package/template/base/apps/dapur/dashboards/dapur_hari_ini.rk +26 -0
- package/template/base/apps/fnb_cabang/app.rk +2 -2
- package/template/base/apps/fnb_cabang/dashboards/outlet_harian.rk +36 -0
- package/template/base/apps/jasa_proyek/app.rk +5 -2
- package/template/base/apps/jasa_proyek/dashboards/absen_saya.rk +15 -0
- package/template/base/apps/jasa_proyek/dashboards/rekap_absen.rk +18 -0
- package/template/base/apps/kelas_kursus/app.rk +1 -1
- package/template/base/apps/kelas_kursus/dashboards/kelas_saya.rk +41 -0
- package/template/base/apps/penjualan_harian/app.rk +1 -1
- package/template/base/apps/ritel_cabang/app.rk +1 -1
- package/template/base/apps/sewa_alat/app.rk +7 -5
- package/template/base/apps/sewa_alat/dashboards/alat_hari_ini.rk +90 -0
- package/template/base/apps/stok_outlet/app.rk +1 -1
- package/template/base/apps/stok_outlet/dashboards/outlet_hari_ini.rk +33 -0
- package/template/base/connectors/doku/connector.rk +128 -0
- package/template/base/connectors/doku/fixtures/create_checkout.json +6 -0
- package/template/base/connectors/doku/fixtures/expect.json +38 -0
- package/template/base/connectors/doku/fixtures/payment_notified.json +5 -0
- package/template/base/connectors/doku/fixtures/payment_notified_failed.json +3 -0
- package/template/base/connectors/doku/fixtures/payment_notified_no_type.json +3 -0
- package/template/base/connectors/doku/fixtures/payment_notified_null_type.json +3 -0
- package/template/base/connectors/doku/fixtures/payment_notified_refund.json +3 -0
- package/template/base/connectors/doku/mock/doku_mock.py +206 -0
- package/template/base/connectors/moka/connector.rk +46 -12
- package/template/base/connectors/moka/fixtures/expect.json +44 -0
- package/template/base/connectors/moka/fixtures/latest_transactions.json +79 -0
- package/template/base/connectors/moka/fixtures/list_items.json +4 -0
- package/template/base/connectors/moka/fixtures/list_outlets.json +4 -0
- package/template/base/connectors/moka/fixtures/transaction_created.json +44 -0
- package/template/base/connectors/moka/fixtures/transaction_created_refund.json +39 -0
- package/template/base/connectors/moka/fixtures/transaction_created_refund_later.json +51 -0
- package/template/base/modules/courses/models/course_batch.rk +7 -0
- package/template/base/modules/courses/models/course_session.rk +4 -1
- package/template/base/modules/courses/module.rk +1 -1
- package/template/base/modules/kitchen/flows/kitchen_ticket_on_sale.rk +29 -0
- package/template/base/modules/kitchen/flows/kitchen_ticket_on_update.rk +26 -0
- package/template/base/modules/kitchen/flows/kitchen_ticket_on_void.rk +15 -0
- package/template/base/modules/kitchen/models/kitchen_guard.rk +35 -0
- package/template/base/modules/kitchen/models/kitchen_route.rk +26 -0
- package/template/base/modules/kitchen/models/kitchen_station.rk +40 -0
- package/template/base/modules/kitchen/models/kitchen_ticket.rk +78 -0
- package/template/base/modules/kitchen/models/kitchen_ticket_item.rk +10 -0
- package/template/base/modules/kitchen/module.rk +18 -0
- package/template/base/modules/kitchen/print/kitchen_ticket.html +29 -0
- package/template/base/modules/kitchen/print/kitchen_ticket.rk +9 -0
- package/template/base/modules/kitchen/roles/kitchen.rk +6 -0
- package/template/base/modules/kitchen/screens/dapur.rk +22 -0
- package/template/base/modules/outlet_sales/flows/moka_daily_sales.rk +57 -0
- package/template/base/modules/outlet_sales/flows/moka_line_mapped.rk +14 -0
- package/template/base/modules/outlet_sales/flows/moka_transaction_staged.rk +90 -0
- package/template/base/modules/outlet_sales/models/moka_sale_line.rk +53 -0
- package/template/base/modules/outlet_sales/models/moka_transaction.rk +26 -0
- package/template/base/modules/outlet_sales/models/outlet_sales.rk +4 -3
- package/template/base/modules/outlet_sales/module.rk +1 -1
- package/template/base/modules/outlets/models/outlet.rk +9 -0
- package/template/base/modules/payments/flows/payment_from_doku.rk +73 -0
- package/template/base/modules/payments/models/payment.rk +1 -0
- package/template/base/modules/payments/module.rk +1 -1
- package/template/base/modules/projects/flows/attendance_close_cancel_guard.rk +15 -0
- package/template/base/modules/projects/flows/attendance_close_on_submit.rk +64 -0
- package/template/base/modules/projects/flows/attendance_log_cancel_guard.rk +14 -0
- package/template/base/modules/projects/flows/attendance_log_guard_created.rk +15 -0
- package/template/base/modules/projects/flows/attendance_log_guard_submitted.rk +34 -0
- package/template/base/modules/projects/flows/attendance_log_guard_updated.rk +14 -0
- package/template/base/modules/projects/flows/timesheet_attendance_overlap_guard.rk +20 -0
- package/template/base/modules/projects/models/assignment.rk +21 -1
- package/template/base/modules/projects/models/attendance_close.rk +63 -0
- package/template/base/modules/projects/models/attendance_guard.rk +57 -0
- package/template/base/modules/projects/models/attendance_log.rk +266 -0
- package/template/base/modules/projects/models/timesheet.rk +7 -1
- package/template/base/modules/projects/models/work_site.rk +73 -0
- package/template/base/modules/projects/module.rk +1 -1
- package/template/base/modules/projects/roles/field_worker.rk +7 -0
- package/template/base/modules/projects/roles/site_supervisor.rk +7 -0
- package/template/base/modules/rental/flows/rental_checkout_on_cancel.rk +11 -0
- package/template/base/modules/rental/flows/rental_checkout_on_submit.rk +13 -1
- package/template/base/modules/rental/flows/rental_return_on_cancel.rk +12 -1
- package/template/base/modules/rental/flows/rental_return_on_submit.rk +17 -0
- package/template/base/modules/rental/models/rental_booking.rk +1 -0
- package/template/base/modules/rental/models/rental_checkout.rk +61 -2
- package/template/base/modules/rental/models/rental_checkout_unit.rk +22 -0
- package/template/base/modules/rental/models/rental_guard.rk +21 -0
- package/template/base/modules/rental/models/rental_item.rk +10 -2
- package/template/base/modules/rental/models/rental_return.rk +67 -8
- package/template/base/modules/rental/models/rental_return_unit.rk +29 -0
- package/template/base/modules/rental/models/rental_schedule.rk +2 -0
- package/template/base/modules/rental/models/rental_unit.rk +73 -0
- package/template/base/modules/rental/module.rk +7 -1
- package/template/base/modules/rental/print/rental_bast_in.html +107 -0
- package/template/base/modules/rental/print/rental_bast_in.rk +9 -0
- package/template/base/modules/rental/print/rental_bast_out.html +98 -0
- package/template/base/modules/rental/print/rental_bast_out.rk +11 -0
- package/template/base/modules/rental/roles/rental_staff.rk +7 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
|
|
2
|
+
# A ticket's status moves one step at a time, forward or back (Baru -> Dimasak -> Siap -> Diambil; back is the work
|
|
3
|
+
# screen's "Urungkan"), and each step is stamped with its time; a step back clears the stamp of the step undone. Batal
|
|
4
|
+
# is set only by flow kitchen_ticket_on_void (writes by flows start no flow), so a person cannot void a ticket, and a
|
|
5
|
+
# void ticket does not come back. Runs inside the write, as the writer; kitchen_guard refuses the write.
|
|
6
|
+
name: kitchen_ticket_on_update
|
|
7
|
+
label: {id: 'Tiket dapur diubah: satu langkah, catat waktunya'}
|
|
8
|
+
on: kitchen_ticket.updated
|
|
9
|
+
if: event.before != null && event.before.status != event.status
|
|
10
|
+
steps:
|
|
11
|
+
- if: event.before.status == 'void'
|
|
12
|
+
create: kitchen_guard
|
|
13
|
+
set: {reason: "'ticket_void'", document: event.name}
|
|
14
|
+
- if: event.status == 'void'
|
|
15
|
+
create: kitchen_guard
|
|
16
|
+
set: {reason: "'void_by_receipt'", document: event.name}
|
|
17
|
+
# positions 0..3; a jump of more than one step is refused
|
|
18
|
+
- if: "event.status != 'void' && event.before.status != 'void' && ({'new': 0, 'cooking': 1, 'ready': 2, 'picked_up': 3}[event.status] - {'new': 0, 'cooking': 1, 'ready': 2, 'picked_up': 3}[event.before.status]) * ({'new': 0, 'cooking': 1, 'ready': 2, 'picked_up': 3}[event.status] - {'new': 0, 'cooking': 1, 'ready': 2, 'picked_up': 3}[event.before.status]) > 1"
|
|
19
|
+
create: kitchen_guard
|
|
20
|
+
set: {reason: "'one_step'", document: event.name}
|
|
21
|
+
- {find: kitchen_ticket, where: name == event.name, as: t}
|
|
22
|
+
- update: t
|
|
23
|
+
set:
|
|
24
|
+
cooking_at: "event.status == 'new' ? null : (event.status == 'cooking' && event.before.status == 'new' ? now() : t.cooking_at)"
|
|
25
|
+
ready_at: "event.status == 'new' || event.status == 'cooking' ? null : (event.status == 'ready' && event.before.status == 'cooking' ? now() : t.ready_at)"
|
|
26
|
+
picked_up_at: "event.status == 'picked_up' ? now() : null"
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
|
|
2
|
+
# A voided receipt (pos_sale cancelled, same day, open shift) voids its tickets that are not picked up yet, as the
|
|
3
|
+
# cashier who voided it; the kitchen screen drops them. A ticket already picked up stays as it was (the food went out).
|
|
4
|
+
name: kitchen_ticket_on_void
|
|
5
|
+
label: {id: 'Struk dibatalkan: tiket dapurnya batal'}
|
|
6
|
+
on: pos_sale.cancelled
|
|
7
|
+
steps:
|
|
8
|
+
- {find_all: kitchen_ticket, where: "sale == event.name && status != 'void' && status != 'picked_up'", as: tickets}
|
|
9
|
+
- for_each: tickets
|
|
10
|
+
as: t
|
|
11
|
+
do:
|
|
12
|
+
- update: t
|
|
13
|
+
set:
|
|
14
|
+
status: "'void'"
|
|
15
|
+
void_at: now()
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/model.json
|
|
2
|
+
# Never stored: flow kitchen_ticket_on_update creates one when a ticket's status change must be refused (the pattern of
|
|
3
|
+
# pos_guard); the matching rule fails with the reason's message and rolls the write back.
|
|
4
|
+
name: kitchen_guard
|
|
5
|
+
label: {id: Penjaga tiket dapur, en: Kitchen ticket guard}
|
|
6
|
+
icon: check
|
|
7
|
+
naming: KGD-{######}
|
|
8
|
+
title_field: reason
|
|
9
|
+
permissions:
|
|
10
|
+
- {role: head_office, create: true}
|
|
11
|
+
- {role: cashier, create: true}
|
|
12
|
+
- {role: kitchen, create: true}
|
|
13
|
+
fields:
|
|
14
|
+
- name: reason
|
|
15
|
+
type: select
|
|
16
|
+
label: {id: Alasan}
|
|
17
|
+
required: true
|
|
18
|
+
options:
|
|
19
|
+
- {value: ticket_void, label: {id: Tiket sudah batal}}
|
|
20
|
+
- {value: void_by_receipt, label: {id: Batal hanya dari struk}}
|
|
21
|
+
- {value: one_step, label: {id: Satu langkah}}
|
|
22
|
+
- {name: document, type: data, label: {id: Dokumen}}
|
|
23
|
+
rules:
|
|
24
|
+
- name: ticket_void
|
|
25
|
+
on: save
|
|
26
|
+
check: reason != 'ticket_void'
|
|
27
|
+
message: {id: 'Tiket ini sudah batal karena struknya dibatalkan; tidak bisa dilanjutkan'}
|
|
28
|
+
- name: void_by_receipt
|
|
29
|
+
on: save
|
|
30
|
+
check: reason != 'void_by_receipt'
|
|
31
|
+
message: {id: 'Tiket dapur batal hanya kalau struknya dibatalkan kasir'}
|
|
32
|
+
- name: one_step
|
|
33
|
+
on: save
|
|
34
|
+
check: reason != 'one_step'
|
|
35
|
+
message: {id: 'Status tiket maju atau mundur satu langkah saja (Baru, Dimasak, Siap, Diambil)'}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/model.json
|
|
2
|
+
# Which item category a station cooks: Kopi -> Bar, Makanan -> Dapur panas. A category can go to one station per
|
|
3
|
+
# outlet; a category with no route at an outlet makes no ticket there (bottled drinks the cashier hands over).
|
|
4
|
+
# A separate model rather than a table of the station: a flow reads records without their table rows.
|
|
5
|
+
name: kitchen_route
|
|
6
|
+
label: {id: Kategori ke stasiun, en: Category to station}
|
|
7
|
+
icon: stock
|
|
8
|
+
naming: RTD-{####}
|
|
9
|
+
title_field: category
|
|
10
|
+
permissions:
|
|
11
|
+
- {role: head_office, read: true, create: true, write: true, delete: true, print: true}
|
|
12
|
+
- {role: cashier, read: true}
|
|
13
|
+
- {role: kitchen, read: true}
|
|
14
|
+
- {role: outlet_staff, read: true}
|
|
15
|
+
fields:
|
|
16
|
+
- {name: station, type: link, to: kitchen_station, label: {id: Stasiun}, required: true, in_list: true, peek: [outlet]}
|
|
17
|
+
- {name: category, type: link, to: item_category, label: {id: Kategori barang}, required: true, in_list: true}
|
|
18
|
+
# the station's outlet, so the row scope of contract 0010 (field outlet) applies to routes too
|
|
19
|
+
- {name: outlet, type: link, to: outlet, label: {id: Outlet}, compute: station.outlet, in_list: true}
|
|
20
|
+
# one station per category and outlet
|
|
21
|
+
- {name: route_key, type: data, label: {id: Kunci rute}, hidden: true, unique: true, compute: "outlet + '/' + category"}
|
|
22
|
+
views:
|
|
23
|
+
list:
|
|
24
|
+
columns: [category, station, outlet]
|
|
25
|
+
filters: [outlet, station, category]
|
|
26
|
+
sort: category
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/model.json
|
|
2
|
+
# A place in an outlet's kitchen that gets its own tickets: Bar (drinks), Dapur panas (hot food), Pastry. Which items
|
|
3
|
+
# go there is set by kitchen_route (item category -> station). An outlet with no active station makes no ticket.
|
|
4
|
+
name: kitchen_station
|
|
5
|
+
label: {id: Stasiun dapur, en: Kitchen station}
|
|
6
|
+
icon: stock
|
|
7
|
+
naming: STD-{###}
|
|
8
|
+
title_field: station_name
|
|
9
|
+
permissions:
|
|
10
|
+
- {role: head_office, read: true, create: true, write: true, delete: true, print: true}
|
|
11
|
+
# flow kitchen_ticket_on_sale reads the stations of the outlet as the cashier who took the payment
|
|
12
|
+
- {role: cashier, read: true}
|
|
13
|
+
- {role: kitchen, read: true}
|
|
14
|
+
- {role: outlet_staff, read: true}
|
|
15
|
+
fields:
|
|
16
|
+
- name: station_name
|
|
17
|
+
type: data
|
|
18
|
+
label: {id: Nama stasiun}
|
|
19
|
+
help: {id: 'Misalnya Bar, Dapur panas, Pastry'}
|
|
20
|
+
required: true
|
|
21
|
+
in_list: true
|
|
22
|
+
- name: outlet
|
|
23
|
+
type: link
|
|
24
|
+
to: outlet
|
|
25
|
+
label: {id: Outlet}
|
|
26
|
+
required: true
|
|
27
|
+
in_list: true
|
|
28
|
+
- name: active
|
|
29
|
+
type: check
|
|
30
|
+
label: {id: Aktif}
|
|
31
|
+
default: 'true'
|
|
32
|
+
in_list: true
|
|
33
|
+
- {name: notes, type: text, label: {id: Catatan}}
|
|
34
|
+
# one station of a name per outlet
|
|
35
|
+
- {name: station_key, type: data, label: {id: Kunci stasiun}, hidden: true, unique: true, compute: "outlet + '/' + station_name"}
|
|
36
|
+
views:
|
|
37
|
+
list:
|
|
38
|
+
columns: [station_name, outlet, active]
|
|
39
|
+
filters: [outlet, active]
|
|
40
|
+
sort: station_name
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/model.json
|
|
2
|
+
# Tiket dapur: the lines of one paid receipt that one station cooks. Made only by flow kitchen_ticket_on_sale when the
|
|
3
|
+
# receipt is paid, so its receipt, outlet, station and lines are read-only; staff change only the status. The status
|
|
4
|
+
# runs Baru -> Dimasak -> Siap -> Diambil, one step at a time or one step back (the work screen's "Urungkan"); each
|
|
5
|
+
# step is stamped by flow kitchen_ticket_on_update. Batal comes only from the receipt being voided. Not submittable:
|
|
6
|
+
# a ticket is a work card, nothing is booked from it (no stock, no money; the receipt did that).
|
|
7
|
+
# Fields follow the queue slot of kernel contract 0030 §2: source (status, date, sent_at), card (heading, station,
|
|
8
|
+
# lines items with description, qty, note), steps (set status), columns by status.
|
|
9
|
+
name: kitchen_ticket
|
|
10
|
+
label: {id: Tiket dapur, en: Kitchen ticket}
|
|
11
|
+
icon: list
|
|
12
|
+
naming: TKD-{outlet.code}-{YY}{MM}-{#####}
|
|
13
|
+
title_field: heading
|
|
14
|
+
permissions:
|
|
15
|
+
# the flow makes the tickets as whoever took the payment (cashier, or head office on any outlet), and voids them as
|
|
16
|
+
# whoever voids the receipt; a ticket typed by hand has no lines (read-only) and is refused (min_rows);
|
|
17
|
+
# the cashier (or the waiter on the cashier's login) marks a ready ticket picked up
|
|
18
|
+
- {role: head_office, read: true, create: true, write: true, export: true, print: true}
|
|
19
|
+
- {role: cashier, read: true, create: true, write: true, print: true}
|
|
20
|
+
- {role: kitchen, read: true, write: true, print: true}
|
|
21
|
+
- {role: outlet_staff, read: true}
|
|
22
|
+
fields:
|
|
23
|
+
- {name: sale, type: link, to: pos_sale, label: {id: Struk}, read_only: true, in_list: true}
|
|
24
|
+
- {name: outlet, type: link, to: outlet, label: {id: Outlet}, read_only: true, in_list: true}
|
|
25
|
+
- {name: station, type: link, to: kitchen_station, label: {id: Stasiun}, read_only: true, in_list: true}
|
|
26
|
+
- {name: date, type: date, label: {id: Tanggal}, read_only: true, default: today(), in_list: true}
|
|
27
|
+
- {name: buyer, type: data, label: {id: Pembeli atau meja}, read_only: true}
|
|
28
|
+
# a corrected receipt (void, then amend) sends its lines again: the kitchen sees it is a revision of the earlier one
|
|
29
|
+
- {name: revision_of, type: link, to: pos_sale, label: {id: Revisi dari struk}, read_only: true}
|
|
30
|
+
# the card's title: the table or buyer when the cashier typed one, else the receipt number; REVISI first for a
|
|
31
|
+
# corrected receipt
|
|
32
|
+
- name: heading
|
|
33
|
+
type: data
|
|
34
|
+
label: {id: Pesanan}
|
|
35
|
+
compute: "(revision_of != '' ? 'REVISI ' : '') + (buyer != '' ? buyer : sale)"
|
|
36
|
+
in_list: true
|
|
37
|
+
- {name: items, type: table, of: kitchen_ticket_item, label: {id: Menu}, read_only: true, min_rows: 1}
|
|
38
|
+
- {name: item_count, type: float, label: {id: Jumlah porsi}, compute: "items.map(l, l.qty).sum()"}
|
|
39
|
+
- name: status
|
|
40
|
+
type: select
|
|
41
|
+
label: {id: Status}
|
|
42
|
+
required: true
|
|
43
|
+
default: "'new'"
|
|
44
|
+
in_list: true
|
|
45
|
+
chip: true
|
|
46
|
+
options:
|
|
47
|
+
- {value: new, label: {id: Baru}}
|
|
48
|
+
- {value: cooking, label: {id: Dimasak}}
|
|
49
|
+
- {value: ready, label: {id: Siap}}
|
|
50
|
+
- {value: picked_up, label: {id: Diambil}}
|
|
51
|
+
- {value: void, label: {id: Batal}}
|
|
52
|
+
# when each step happened (flow kitchen_ticket_on_update); sent_at is the moment the receipt was paid
|
|
53
|
+
- {name: sent_at, type: datetime, label: {id: Masuk dapur}, read_only: true, default: now()}
|
|
54
|
+
- {name: cooking_at, type: datetime, label: {id: Mulai dimasak}, read_only: true}
|
|
55
|
+
- {name: ready_at, type: datetime, label: {id: Siap}, read_only: true}
|
|
56
|
+
- {name: picked_up_at, type: datetime, label: {id: Diambil}, read_only: true}
|
|
57
|
+
- {name: void_at, type: datetime, label: {id: Dibatalkan}, read_only: true}
|
|
58
|
+
views:
|
|
59
|
+
list:
|
|
60
|
+
columns: [name, heading, station, status, sent_at, item_count, outlet]
|
|
61
|
+
filters: [outlet, station, status, date]
|
|
62
|
+
sort: -sent_at
|
|
63
|
+
kanban:
|
|
64
|
+
group_by: status
|
|
65
|
+
title: heading
|
|
66
|
+
card: [station, item_count, sent_at]
|
|
67
|
+
form:
|
|
68
|
+
layout:
|
|
69
|
+
- section: {id: Tiket}
|
|
70
|
+
columns:
|
|
71
|
+
- [heading, station, status]
|
|
72
|
+
- [sale, outlet, date, buyer, revision_of]
|
|
73
|
+
- section: {id: Menu}
|
|
74
|
+
fields: [items]
|
|
75
|
+
- section: {id: Waktu}
|
|
76
|
+
columns:
|
|
77
|
+
- [sent_at, cooking_at, ready_at]
|
|
78
|
+
- [picked_up_at, void_at]
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/model.json
|
|
2
|
+
# A line of a kitchen ticket: copied from the receipt line (no price).
|
|
3
|
+
name: kitchen_ticket_item
|
|
4
|
+
is_child: true
|
|
5
|
+
fields:
|
|
6
|
+
- {name: item, type: link, to: item, label: {id: Menu}, required: true}
|
|
7
|
+
- {name: description, type: data, label: {id: Uraian}}
|
|
8
|
+
- {name: qty, type: float, label: {id: Qty}, required: true}
|
|
9
|
+
- {name: uom, type: link, to: uom, label: {id: Satuan}}
|
|
10
|
+
- {name: note, type: data, label: {id: Catatan}}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/module.json
|
|
2
|
+
name: kitchen
|
|
3
|
+
version: 1.0.0
|
|
4
|
+
title: {id: Tiket dapur, en: Kitchen tickets}
|
|
5
|
+
summary:
|
|
6
|
+
id: Pesanan kasir jadi tiket per stasiun dapur, dengan status dimasak, siap dan diambil.
|
|
7
|
+
en: Paid receipts become tickets per kitchen station, marked cooking, ready and picked up.
|
|
8
|
+
category: sales
|
|
9
|
+
icon: restaurant-line
|
|
10
|
+
# Kitchen tickets of an F&B outlet that sells through the cashier (module pos). The owner names the stations of each
|
|
11
|
+
# outlet (Bar, Dapur panas) and sends each item category to a station; an outlet without stations makes no ticket, so a
|
|
12
|
+
# shop on the same cashier is untouched. When a receipt is paid (pos_sale submitted) flow kitchen_ticket_on_sale makes
|
|
13
|
+
# one ticket per station with the lines whose item category goes there; items of an unrouted category (bottled water)
|
|
14
|
+
# make no ticket. Kitchen staff move a ticket new -> cooking -> ready, the waiter, cashier or kitchen marks it picked up; each
|
|
15
|
+
# step is stamped with its time by flow kitchen_ticket_on_update (one step back, the work screen's "Urungkan", clears
|
|
16
|
+
# the stamp). A voided receipt voids its tickets; a corrected receipt (amend) makes new tickets marked as a revision.
|
|
17
|
+
# The kitchen screen (screens/dapur.rk) is a queue screen of kernel contract 0030 over these tickets.
|
|
18
|
+
requires: {rangka: '>=0.5', users: ^1.2, catalogue: ^1.3, outlets: ^1.2, pos: ^1.0}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{{define "style"}}
|
|
2
|
+
/* Tiket dapur: dibaca dari jarak satu lengan, jadi huruf besar dan tanpa harga. Hitam putih untuk thermal. */
|
|
3
|
+
body { font-size: 10pt; }
|
|
4
|
+
.c { text-align: center; }
|
|
5
|
+
.station { font-size: 1.6em; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
|
|
6
|
+
.heading { font-size: 1.5em; font-weight: 700; }
|
|
7
|
+
.rule { border-top: 1px dashed #1C1917; margin: 2mm 0; }
|
|
8
|
+
.row { display: flex; justify-content: space-between; gap: 2mm; }
|
|
9
|
+
.line { display: flex; gap: 3mm; margin: 1.5mm 0; font-size: 1.25em; font-weight: 700; }
|
|
10
|
+
.line .qty { min-width: 9mm; text-align: right; }
|
|
11
|
+
.note { font-size: .85em; font-weight: 400; font-style: italic; }
|
|
12
|
+
.flag { font-weight: 700; border: 1px solid #1C1917; padding: 1mm; text-align: center; margin: 1mm 0; }
|
|
13
|
+
.muted { color: #57534E; }
|
|
14
|
+
{{end}}
|
|
15
|
+
{{- $st := printf "%v" .Doc.status -}}
|
|
16
|
+
<div class="c station">{{with .Links.station}}{{.station_name}}{{else}}{{.Doc.station}}{{end}}</div>
|
|
17
|
+
<div class="c muted">{{.Links.outlet.outlet_name}}</div>
|
|
18
|
+
<div class="rule"></div>
|
|
19
|
+
<div class="c heading">{{.Doc.heading}}</div>
|
|
20
|
+
<div class="row"><span>Struk</span><span>{{.Doc.sale}}</span></div>
|
|
21
|
+
<div class="row"><span>Masuk</span><span>{{date .Doc.date}}{{with .Doc.sent_at}} {{slice (printf "%v" .) 11 16}}{{end}}</span></div>
|
|
22
|
+
{{with .Doc.revision_of}}<div class="flag">REVISI dari {{.}}</div>{{end}}
|
|
23
|
+
{{if eq $st "void"}}<div class="flag">BATAL, JANGAN DIMASAK</div>{{end}}
|
|
24
|
+
<div class="rule"></div>
|
|
25
|
+
{{range $row := .Doc.items}}
|
|
26
|
+
<div class="line"><span class="qty">{{number $row.qty}}x</span><span>{{if $row.description}}{{$row.description}}{{else}}{{$row.item}}{{end}}{{with $row.note}}<div class="note">{{.}}</div>{{end}}</span></div>
|
|
27
|
+
{{end}}
|
|
28
|
+
<div class="rule"></div>
|
|
29
|
+
<div class="c muted">{{.Doc.name}}</div>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/print.json
|
|
2
|
+
# Tiket dapur for an 80 mm printer, printed from the browser (contract 0008) until rangka-edge sends it to the
|
|
3
|
+
# station's printer itself (contract 0003, ESC/POS). Big type for a kitchen: station, table, time, qty x menu, note.
|
|
4
|
+
name: kitchen_ticket
|
|
5
|
+
model: kitchen_ticket
|
|
6
|
+
label: {id: Tiket dapur (printer 80 mm), en: Kitchen ticket (80 mm)}
|
|
7
|
+
paper: 80mm
|
|
8
|
+
default: true
|
|
9
|
+
template: kitchen_ticket.html
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/role.json
|
|
2
|
+
name: kitchen
|
|
3
|
+
label: {id: Dapur}
|
|
4
|
+
description: {id: 'Melihat tiket dapur outlet tempatnya bekerja dan menandai pesanan dimasak dan siap'}
|
|
5
|
+
# Contract 0010 §5: only the tickets and stations of the member's outlets. No money: a ticket carries no price.
|
|
6
|
+
scope: {field: outlet, from: user.outlets}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/screen.json
|
|
2
|
+
# The kitchen display (contract 0030 queue): today's open tickets of the member's outlet (row scope), oldest first, in
|
|
3
|
+
# columns Baru, Dimasak, Siap. One tap moves a card one step (flow kitchen_ticket_on_update stamps the time; the
|
|
4
|
+
# renderer's "Urungkan" is the step back). Rendered by the kernel's queue renderer (rangka-os WS4).
|
|
5
|
+
# No link to the receipt on the card: a receipt's title is its total (pos_sale title_field), and the kitchen sees no
|
|
6
|
+
# money; the card's title carries the table or receipt number and REVISI for a corrected receipt.
|
|
7
|
+
name: dapur
|
|
8
|
+
type: queue
|
|
9
|
+
label: {id: Dapur, en: Kitchen}
|
|
10
|
+
icon: list
|
|
11
|
+
roles: [kitchen, cashier, head_office]
|
|
12
|
+
device: tablet
|
|
13
|
+
needs: [print]
|
|
14
|
+
queue:
|
|
15
|
+
source: {model: kitchen_ticket, filter: "status != 'picked_up' && status != 'void' && date == today()", sort: sent_at}
|
|
16
|
+
card: {title: heading, subtitle: station, lines: items, line: [description, qty, note], age_from: sent_at}
|
|
17
|
+
columns: {by: status, values: [new, cooking, ready]}
|
|
18
|
+
steps:
|
|
19
|
+
- {when: "status == 'new'", set: {status: cooking}, label: {id: Masak}}
|
|
20
|
+
- {when: "status == 'cooking'", set: {status: ready}, label: {id: Siap}}
|
|
21
|
+
- {when: "status == 'ready'", set: {status: picked_up}, label: {id: Diambil}}
|
|
22
|
+
refresh: 5
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
|
|
2
|
+
# Every hour at :15 (scheduler.timezone), and from the flow list: the staged Moka lines of past days become DRAFT
|
|
3
|
+
# outlet_sales (source moka, key_version 3), one record per outlet and day, oldest first, up to 30 outlet-days and 1000
|
|
4
|
+
# lines each per run (the rest waits for the next run); the lines are marked posted. Today is never taken (Moka still
|
|
5
|
+
# sells). Stock moves when a draft is submitted (stock.post_moves through the recipes), never here.
|
|
6
|
+
# Every API line is posted exactly once, so a second API record for a day (lines that came in or were mapped after the
|
|
7
|
+
# day was recapped, or a day over 1000 lines) holds other sales, not the same ones, and is not flagged. Only an export
|
|
8
|
+
# (key_version 1 or 2) on the same outlet and day can count the same sales twice: the API record is then flagged
|
|
9
|
+
# (legacy_key_overlap) and rule legacy_key_reviewed holds its submit until head office has removed what is counted
|
|
10
|
+
# twice; an export imported after the API day is flagged by flow moka_legacy_key_overlap.
|
|
11
|
+
# An unmapped line waits in Baris penjualan Moka and does not hold anything back; once mapped it joins the next recap.
|
|
12
|
+
name: moka_daily_sales
|
|
13
|
+
label: {id: Rekap harian penjualan Moka per outlet}
|
|
14
|
+
schedule: '15 * * * *'
|
|
15
|
+
steps:
|
|
16
|
+
- for_each: "[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]"
|
|
17
|
+
as: slot
|
|
18
|
+
do:
|
|
19
|
+
- find_all: moka_sale_line
|
|
20
|
+
where: "status == 'staged' && outlet != '' && date < today()"
|
|
21
|
+
sort: date
|
|
22
|
+
limit: 1
|
|
23
|
+
as: first
|
|
24
|
+
- find_all: moka_sale_line
|
|
25
|
+
if: size(first) > 0
|
|
26
|
+
where: "outlet == first[0].outlet && date == first[0].date && status == 'staged'"
|
|
27
|
+
sort: name
|
|
28
|
+
limit: 1000
|
|
29
|
+
as: rows
|
|
30
|
+
- find: outlet
|
|
31
|
+
if: size(first) > 0
|
|
32
|
+
where: name == first[0].outlet
|
|
33
|
+
as: o
|
|
34
|
+
- find: outlet_sales
|
|
35
|
+
if: size(first) > 0
|
|
36
|
+
where: "outlet == first[0].outlet && date == first[0].date && source == 'moka' && docstatus != 2 && key_version != 3"
|
|
37
|
+
as: filed
|
|
38
|
+
- create: outlet_sales
|
|
39
|
+
if: size(first) > 0
|
|
40
|
+
set:
|
|
41
|
+
outlet: first[0].outlet
|
|
42
|
+
date: first[0].date
|
|
43
|
+
source: "'moka'"
|
|
44
|
+
moka_outlet: "o != null ? o.moka_name : ''"
|
|
45
|
+
key_version: "3"
|
|
46
|
+
note: "'Dari Moka API'"
|
|
47
|
+
legacy_key_overlap: filed != null
|
|
48
|
+
lines: "rows.map(r, {'item': r.item, 'description': r.description, 'qty': r.qty, 'gross': r.gross, 'discount': r.discount, 'refund': r.refund})"
|
|
49
|
+
as: sales
|
|
50
|
+
- for_each: rows
|
|
51
|
+
if: size(first) > 0
|
|
52
|
+
as: r
|
|
53
|
+
do:
|
|
54
|
+
- update: r
|
|
55
|
+
set:
|
|
56
|
+
status: "'posted'"
|
|
57
|
+
sales: sales.name
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
|
|
2
|
+
# Head office picked the outlet and the item of an unmapped Moka line: it becomes staged and goes into the next daily
|
|
3
|
+
# recap (flow moka_daily_sales).
|
|
4
|
+
name: moka_line_mapped
|
|
5
|
+
label: {id: Baris Moka yang sudah dipetakan siap direkap}
|
|
6
|
+
on: moka_sale_line.updated
|
|
7
|
+
if: event.status == 'unmapped' && event.outlet != '' && event.item != ''
|
|
8
|
+
steps:
|
|
9
|
+
- find: moka_sale_line
|
|
10
|
+
where: name == event.name
|
|
11
|
+
as: rec
|
|
12
|
+
- update: rec
|
|
13
|
+
set:
|
|
14
|
+
status: "'staged'"
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
|
|
2
|
+
# Moka API (connector moka, poll per outlet every 15 minutes): one transaction becomes a moka_transaction and one
|
|
3
|
+
# moka_sale_line per item, plus a refund line per refunded quantity. Nothing touches stock here: flow moka_daily_sales
|
|
4
|
+
# makes the outlet's daily sales draft from the lines, and stock moves when head office submits it (as with the export).
|
|
5
|
+
# Outlet: Moka's outlet id (outlet.moka_outlet_id), else Moka's outlet name (outlet.moka_name). Item: Moka's SKU = the
|
|
6
|
+
# item's sku, else Moka's item name = item_name. A line without outlet or item is unmapped and head office is told; it
|
|
7
|
+
# waits in Baris penjualan Moka until someone picks them (flow moka_line_mapped) and goes into the recap after that,
|
|
8
|
+
# as its own record for that day if the day was already recapped (an API line is posted exactly once).
|
|
9
|
+
# Refunds: a refunded quantity is recorded only if Moka reports it when the transaction is first polled. A refund made
|
|
10
|
+
# after that poll is not seen (the poll cursor is the newest created_at and the transaction id is unique); until the
|
|
11
|
+
# connector polls refunds, such refunds are booked by head office, or the day comes from the export file instead.
|
|
12
|
+
# A transaction delivered twice records nothing: the kernel drops a repeated event, idempotency stops a second run, and
|
|
13
|
+
# moka_transaction.transaction_id is unique, so a run racing another rolls back whole.
|
|
14
|
+
# The day is the first 10 characters of created_at (Moka answers in the outlet's local time, +07:00).
|
|
15
|
+
name: moka_transaction_staged
|
|
16
|
+
label: {id: Transaksi Moka masuk jadi baris penjualan}
|
|
17
|
+
on: moka.transaction_created
|
|
18
|
+
if: "'transaction_id' in event && 'created_at' in event && 'checkouts' in event && 'outlet_id' in event"
|
|
19
|
+
idempotency: string(event.transaction_id)
|
|
20
|
+
steps:
|
|
21
|
+
- find: outlet
|
|
22
|
+
where: "moka_outlet_id != '' && moka_outlet_id == string(event.outlet_id)"
|
|
23
|
+
as: by_id
|
|
24
|
+
- find: outlet
|
|
25
|
+
where: "moka_name != '' && moka_name == ('outlet_name' in event ? event.outlet_name : '')"
|
|
26
|
+
as: by_name
|
|
27
|
+
- create: moka_transaction
|
|
28
|
+
set:
|
|
29
|
+
transaction_id: string(event.transaction_id)
|
|
30
|
+
receipt_no: "'receipt_no' in event ? event.receipt_no : ''"
|
|
31
|
+
outlet: "by_id != null ? by_id.name : (by_name != null ? by_name.name : '')"
|
|
32
|
+
moka_outlet: "'outlet_name' in event ? event.outlet_name : string(event.outlet_id)"
|
|
33
|
+
sold_at: event.created_at
|
|
34
|
+
date: event.created_at
|
|
35
|
+
payment_type: "'payment_type' in event ? event.payment_type : ''"
|
|
36
|
+
total_collected: "'total_collected' in event ? event.total_collected : 0"
|
|
37
|
+
refunded: "'is_refunded' in event && event.is_refunded == true"
|
|
38
|
+
as: tx
|
|
39
|
+
- for_each: event.checkouts
|
|
40
|
+
as: c
|
|
41
|
+
do:
|
|
42
|
+
- find: item
|
|
43
|
+
where: "sku != '' && sku == ('sku' in c ? c.sku : '')"
|
|
44
|
+
as: by_sku
|
|
45
|
+
- find: item
|
|
46
|
+
where: "item_name == c.item_name"
|
|
47
|
+
as: by_item_name
|
|
48
|
+
# a sale line only for a positive quantity, its discount never above its gross (outlet_sales rules
|
|
49
|
+
# qty_not_negative and discount_within_gross refuse anything else, and one refused line would stop the recap)
|
|
50
|
+
- create: moka_sale_line
|
|
51
|
+
if: c.quantity > 0
|
|
52
|
+
set:
|
|
53
|
+
transaction: tx.name
|
|
54
|
+
outlet: tx.outlet
|
|
55
|
+
date: tx.date
|
|
56
|
+
item: "by_sku != null ? by_sku.name : (by_item_name != null ? by_item_name.name : '')"
|
|
57
|
+
description: "c.item_name + ('item_variant_name' in c && c.item_variant_name != '' ? ' ' + c.item_variant_name : '')"
|
|
58
|
+
sku: "'sku' in c ? c.sku : ''"
|
|
59
|
+
qty: c.quantity
|
|
60
|
+
gross: c.total_price
|
|
61
|
+
discount: "min('discount_amount' in c ? c.discount_amount : 0, c.total_price)"
|
|
62
|
+
refund: "0"
|
|
63
|
+
status: "tx.outlet == '' || (by_sku == null && by_item_name == null) ? 'unmapped' : 'staged'"
|
|
64
|
+
- create: moka_sale_line
|
|
65
|
+
# a refund line only when it returns money: a refund of a free item (100% discount) changes nothing and a line of
|
|
66
|
+
# qty < 0 without refund is refused by outlet_sales
|
|
67
|
+
if: "c.quantity > 0 && 'refunded_quantity' in c && c.refunded_quantity > 0 && round((c.total_price - min('discount_amount' in c ? c.discount_amount : 0, c.total_price)) * c.refunded_quantity / c.quantity) > 0"
|
|
68
|
+
set:
|
|
69
|
+
transaction: tx.name
|
|
70
|
+
outlet: tx.outlet
|
|
71
|
+
date: tx.date
|
|
72
|
+
item: "by_sku != null ? by_sku.name : (by_item_name != null ? by_item_name.name : '')"
|
|
73
|
+
description: "'Retur ' + c.item_name + ('item_variant_name' in c && c.item_variant_name != '' ? ' ' + c.item_variant_name : '')"
|
|
74
|
+
sku: "'sku' in c ? c.sku : ''"
|
|
75
|
+
qty: -c.refunded_quantity
|
|
76
|
+
gross: "0"
|
|
77
|
+
discount: "0"
|
|
78
|
+
refund: "round((c.total_price - min('discount_amount' in c ? c.discount_amount : 0, c.total_price)) * c.refunded_quantity / c.quantity)"
|
|
79
|
+
status: "tx.outlet == '' || (by_sku == null && by_item_name == null) ? 'unmapped' : 'staged'"
|
|
80
|
+
- find_all: moka_sale_line
|
|
81
|
+
where: "transaction == tx.name && status == 'unmapped'"
|
|
82
|
+
as: unmapped
|
|
83
|
+
- notify: head_office
|
|
84
|
+
if: "event.checkouts.map(c, c.quantity > 0 ? 0 : 1).sum() > 0"
|
|
85
|
+
channel: email
|
|
86
|
+
template: {id: 'Moka {tx.receipt_no} ({tx.moka_outlet}, {tx.date}) punya barang dengan qty 0 atau minus, tidak direkap. Cek di Moka'}
|
|
87
|
+
- notify: head_office
|
|
88
|
+
if: size(unmapped) > 0
|
|
89
|
+
channel: email
|
|
90
|
+
template: {id: 'Moka {tx.receipt_no} ({tx.moka_outlet}, {tx.date}): barang atau outlet belum dikenali, petakan di Baris penjualan Moka'}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/model.json
|
|
2
|
+
# One item of one Moka transaction, waiting to become a line of the outlet's daily sales (flow moka_daily_sales). A flat
|
|
3
|
+
# record, not a child table, so the daily flow can read every line of an outlet and day with one find_all.
|
|
4
|
+
# status: staged (ready), unmapped (no outlet or no item matched: head office picks them here and the line becomes
|
|
5
|
+
# staged, flow moka_line_mapped; head office may still correct them while staged), posted (in outlet_sales `sales`). A refunded quantity is its own line, as in the
|
|
6
|
+
# export import: qty < 0, gross 0, refund = the refunded share of the line's net.
|
|
7
|
+
name: moka_sale_line
|
|
8
|
+
label: {id: Baris penjualan Moka, en: Moka sales line}
|
|
9
|
+
icon: store
|
|
10
|
+
naming: MKL-{YYYY}-{######}
|
|
11
|
+
title_field: description
|
|
12
|
+
permissions:
|
|
13
|
+
# head office picks outlet and item until the line is in a daily sales record (the mapping flow writes as them, so the
|
|
14
|
+
# grant holds for staged too); a posted line is history
|
|
15
|
+
- {role: head_office, read: true, write: true, export: true, if: status != 'posted'}
|
|
16
|
+
- {role: head_office, read: true, export: true}
|
|
17
|
+
fields:
|
|
18
|
+
- {name: transaction, type: link, to: moka_transaction, label: {id: Transaksi Moka}, read_only: true, in_list: true}
|
|
19
|
+
- {name: outlet, type: link, to: outlet, label: {id: Outlet}, in_list: true}
|
|
20
|
+
- {name: date, type: date, label: {id: Tanggal}, read_only: true, in_list: true}
|
|
21
|
+
- {name: item, type: link, to: item, label: {id: Barang}, in_list: true}
|
|
22
|
+
- {name: description, type: data, label: {id: Nama di Moka}, read_only: true}
|
|
23
|
+
- {name: sku, type: data, label: {id: SKU di Moka}, read_only: true}
|
|
24
|
+
- {name: qty, type: float, label: {id: Qty}, read_only: true, in_list: true}
|
|
25
|
+
- {name: gross, type: currency, label: {id: Penjualan kotor}, read_only: true}
|
|
26
|
+
- {name: discount, type: currency, label: {id: Diskon}, read_only: true}
|
|
27
|
+
- {name: refund, type: currency, label: {id: Retur}, read_only: true}
|
|
28
|
+
- name: status
|
|
29
|
+
type: select
|
|
30
|
+
label: {id: Status}
|
|
31
|
+
read_only: true
|
|
32
|
+
in_list: true
|
|
33
|
+
chip: true
|
|
34
|
+
default: "'staged'"
|
|
35
|
+
options:
|
|
36
|
+
- {value: staged, label: {id: Siap direkap}}
|
|
37
|
+
- {value: unmapped, label: {id: Belum dipetakan}}
|
|
38
|
+
- {value: posted, label: {id: Sudah direkap}}
|
|
39
|
+
- {name: sales, type: link, to: outlet_sales, label: {id: Penjualan harian}, read_only: true, in_list: true}
|
|
40
|
+
rules:
|
|
41
|
+
- name: staged_has_outlet_and_item
|
|
42
|
+
on: save
|
|
43
|
+
check: status != 'staged' || (outlet != '' && item != '')
|
|
44
|
+
message: {id: 'Baris yang siap direkap harus punya outlet dan barang'}
|
|
45
|
+
# the recap makes a source moka record, which only an outlet with Moka takes (rule source_matches_outlet)
|
|
46
|
+
- name: staged_outlet_uses_moka
|
|
47
|
+
on: save
|
|
48
|
+
check: status != 'staged' || outlet == '' || outlet.moka_name != ''
|
|
49
|
+
message: {id: 'Pilih outlet yang memakai Moka (Nama outlet di Moka terisi)'}
|
|
50
|
+
views:
|
|
51
|
+
list:
|
|
52
|
+
columns: [date, outlet, description, qty, status, item, sales]
|
|
53
|
+
filters: [status, outlet, date]
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/model.json
|
|
2
|
+
# One Moka sale as the moka connector's poll delivered it (rangka-connectors moka, trigger transaction_created, one poll
|
|
3
|
+
# per outlet). Written only by flow moka_transaction_staged; transaction_id is unique, so a transaction delivered twice
|
|
4
|
+
# (a repeated poll, two runs racing) rolls the second run back and nothing is counted twice. Its lines are
|
|
5
|
+
# moka_sale_line records, which flow moka_daily_sales turns into one draft outlet_sales per outlet and day.
|
|
6
|
+
name: moka_transaction
|
|
7
|
+
label: {id: Transaksi Moka, en: Moka transaction}
|
|
8
|
+
icon: store
|
|
9
|
+
naming: MKT-{YYYY}-{#####}
|
|
10
|
+
title_field: receipt_no
|
|
11
|
+
permissions:
|
|
12
|
+
- {role: head_office, read: true, export: true}
|
|
13
|
+
fields:
|
|
14
|
+
- {name: transaction_id, type: data, label: {id: ID transaksi Moka}, unique: true, read_only: true, in_list: true}
|
|
15
|
+
- {name: receipt_no, type: data, label: {id: No. struk Moka}, read_only: true, in_list: true}
|
|
16
|
+
- {name: outlet, type: link, to: outlet, label: {id: Outlet}, read_only: true, in_list: true}
|
|
17
|
+
- {name: moka_outlet, type: data, label: {id: Outlet di Moka}, read_only: true}
|
|
18
|
+
- {name: sold_at, type: datetime, label: {id: Waktu transaksi}, read_only: true}
|
|
19
|
+
- {name: date, type: date, label: {id: Tanggal}, read_only: true, in_list: true}
|
|
20
|
+
- {name: payment_type, type: data, label: {id: Cara bayar di Moka}, read_only: true}
|
|
21
|
+
- {name: total_collected, type: currency, label: {id: Diterima}, read_only: true, in_list: true}
|
|
22
|
+
- {name: refunded, type: check, label: {id: Ada retur}, read_only: true}
|
|
23
|
+
views:
|
|
24
|
+
list:
|
|
25
|
+
columns: [date, outlet, receipt_no, total_collected, transaction_id]
|
|
26
|
+
filters: [outlet, date]
|
|
@@ -62,13 +62,14 @@ fields:
|
|
|
62
62
|
# match the new key, so an overlapping export re-imports rows of a day already imported. key_version is 2 on every
|
|
63
63
|
# record the current import writes; flow moka_legacy_key_overlap marks a new record whose outlet and day already have
|
|
64
64
|
# a live Moka record without it, and rule legacy_key_reviewed holds its submit until head office has removed the
|
|
65
|
-
# repeated lines and ticks legacy_key_checked.
|
|
65
|
+
# repeated lines and ticks legacy_key_checked. key_version 3 is a record from the Moka API (flow moka_daily_sales): an
|
|
66
|
+
# export imported for the same day, or a second API record of late lines, is flagged and held the same way.
|
|
66
67
|
- {name: key_version, type: int, label: {id: Versi kunci impor}, hidden: true}
|
|
67
68
|
- name: legacy_key_overlap
|
|
68
69
|
type: check
|
|
69
70
|
label: {id: Tumpang tindih impor lama}
|
|
70
71
|
read_only: true
|
|
71
|
-
help: {id: 'Tanggal ini sudah punya penjualan Moka
|
|
72
|
+
help: {id: 'Tanggal ini sudah punya penjualan Moka lain (impor sebelum pembaruan, atau dari API Moka); baris yang sama bisa masuk lagi'}
|
|
72
73
|
- name: legacy_key_checked
|
|
73
74
|
type: check
|
|
74
75
|
label: {id: Baris ganda sudah dihapus}
|
|
@@ -154,7 +155,7 @@ rules:
|
|
|
154
155
|
- name: legacy_key_reviewed
|
|
155
156
|
on: submit
|
|
156
157
|
check: "!legacy_key_overlap || legacy_key_checked"
|
|
157
|
-
message: {id: 'Tanggal ini sudah
|
|
158
|
+
message: {id: 'Tanggal ini sudah punya penjualan Moka lain (impor lama atau API): hapus baris yang terulang, lalu centang Baris ganda sudah dihapus'}
|
|
158
159
|
views:
|
|
159
160
|
list:
|
|
160
161
|
# outlet, day and net sales first: they fit a phone screen (P7)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/module.json
|
|
2
2
|
name: outlet_sales
|
|
3
|
-
version: 1.
|
|
3
|
+
version: 1.3.0
|
|
4
4
|
title: {id: Penjualan outlet, en: Outlet sales}
|
|
5
5
|
summary:
|
|
6
6
|
id: Rekap penjualan harian per outlet, setoran kas dan retur di kasir.
|
|
@@ -45,6 +45,15 @@ fields:
|
|
|
45
45
|
label: {id: Nama outlet di Moka}
|
|
46
46
|
help: {id: 'Persis seperti kolom Outlet di ekspor Moka, misalnya "Tahu Contoh - Dago". Kosongkan kalau outlet ini tidak pakai Moka'}
|
|
47
47
|
depends_on: app_installed('outlet_sales')
|
|
48
|
+
# Moka's outlet id (connector moka, rangka-connectors): the poll per outlet emits it with every transaction, and flow
|
|
49
|
+
# moka_transaction_staged finds the outlet by it, else by moka_name (Moka's outlet name). While the moka connector is
|
|
50
|
+
# switched on, every outlet whose id or name matches receives its API sales; an outlet that should keep the export
|
|
51
|
+
# only is left out of the connector in Moka (or its moka_name differs from Moka's).
|
|
52
|
+
- name: moka_outlet_id
|
|
53
|
+
type: data
|
|
54
|
+
label: {id: ID outlet di Moka}
|
|
55
|
+
help: {id: 'Diisi saat Moka tersambung lewat API. Selama connector Moka aktif, outlet juga dicocokkan lewat Nama outlet di Moka'}
|
|
56
|
+
depends_on: app_installed('outlet_sales') && moka_name != ''
|
|
48
57
|
# The sales source of an outlet without Moka (moka_name empty): the daily form (default when empty), a file from
|
|
49
58
|
# another POS in Juragan's template, a Loyverse export, or Juragan's own cashier (module pos). One source per outlet,
|
|
50
59
|
# so a day is never counted twice.
|