@rangka-os/create 0.5.0-alpha.34 → 0.5.0-alpha.35

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.
Files changed (62) hide show
  1. package/package.json +1 -1
  2. package/template/base/apps/faktur_piutang/app.rk +4 -0
  3. package/template/base/apps/faktur_piutang/skills/rangka-app-faktur-piutang/SKILL.md +35 -0
  4. package/template/base/apps/fnb_cabang/app.rk +7 -0
  5. package/template/base/apps/fnb_cabang/skills/rangka-app-fnb-cabang/SKILL.md +43 -0
  6. package/template/base/apps/jasa_proyek/app.rk +11 -1
  7. package/template/base/apps/jasa_proyek/skills/rangka-app-jasa-proyek/SKILL.md +51 -0
  8. package/template/base/apps/karyawan_gaji/app.rk +2 -0
  9. package/template/base/apps/kasir/app.rk +2 -0
  10. package/template/base/apps/pembelian_pemasok/app.rk +8 -0
  11. package/template/base/apps/pembelian_pemasok/skills/rangka-app-pembelian-pemasok/SKILL.md +43 -0
  12. package/template/base/apps/ritel_cabang/app.rk +7 -0
  13. package/template/base/apps/ritel_cabang/skills/rangka-app-ritel-cabang/SKILL.md +43 -0
  14. package/template/base/modules/accounting/flows/financial_report_compute.rk +1 -1
  15. package/template/base/modules/accounting/flows/financial_report_recompute.rk +1 -1
  16. package/template/base/modules/accounting/flows/gl_pos_sale_post.rk +38 -2
  17. package/template/base/modules/accounting/models/gl_entry.rk +3 -0
  18. package/template/base/modules/attendance/module.rk +4 -4
  19. package/template/base/modules/attendance/screens/absen_outlet.rk +3 -0
  20. package/template/base/modules/kitchen/flows/kitchen_ticket_on_draft.rk +44 -0
  21. package/template/base/modules/kitchen/flows/kitchen_ticket_on_sale.rk +6 -5
  22. package/template/base/modules/loyalty/flows/loyalty_on_sale.rk +6 -5
  23. package/template/base/modules/loyalty/flows/loyalty_on_sale_cancel.rk +2 -2
  24. package/template/base/modules/outlets/models/outlet.rk +39 -0
  25. package/template/base/modules/payroll/flows/pph21_annual_on_slip_cancel.rk +28 -0
  26. package/template/base/modules/payroll/flows/pph21_annual_on_slip_submit.rk +84 -0
  27. package/template/base/modules/payroll/models/payslip.rk +4 -0
  28. package/template/base/modules/payroll/models/pph21_annual.rk +84 -0
  29. package/template/base/modules/payroll/models/pph21_period.rk +77 -0
  30. package/template/base/modules/payroll/module.rk +3 -2
  31. package/template/base/modules/payroll/print/bukti_potong_a1.html +53 -0
  32. package/template/base/modules/payroll/print/bukti_potong_a1.rk +9 -0
  33. package/template/base/modules/payroll/print/coretax_bp21.rk +44 -0
  34. package/template/base/modules/payroll/print/coretax_bp21.xml +36 -0
  35. package/template/base/modules/payroll/print/coretax_bpa1.rk +21 -0
  36. package/template/base/modules/payroll/print/coretax_bpa1.xml +46 -0
  37. package/template/base/modules/payroll/print/coretax_bpmp.rk +23 -0
  38. package/template/base/modules/payroll/print/coretax_bpmp.xml +31 -0
  39. package/template/base/modules/pos/flows/pos_sale_merge.rk +34 -0
  40. package/template/base/modules/pos/flows/pos_sale_on_cancel.rk +3 -0
  41. package/template/base/modules/pos/flows/pos_sale_on_submit.rk +28 -1
  42. package/template/base/modules/pos/flows/pos_sale_split.rk +37 -0
  43. package/template/base/modules/pos/flows/pos_shift_on_create.rk +9 -1
  44. package/template/base/modules/pos/flows/pos_table_guard_on_create.rk +24 -0
  45. package/template/base/modules/pos/flows/pos_table_guard_on_update.rk +23 -0
  46. package/template/base/modules/pos/models/dining_area.rk +23 -0
  47. package/template/base/modules/pos/models/dining_table.rk +38 -0
  48. package/template/base/modules/pos/models/pos_guard.rk +39 -0
  49. package/template/base/modules/pos/models/pos_payment.rk +2 -0
  50. package/template/base/modules/pos/models/pos_sale.rk +153 -7
  51. package/template/base/modules/pos/models/pos_sale_item.rk +3 -0
  52. package/template/base/modules/pos/models/pos_shift.rk +11 -1
  53. package/template/base/modules/pos/module.rk +9 -4
  54. package/template/base/modules/pos/print/pos_receipt.html +5 -2
  55. package/template/base/modules/pos/print/pos_receipt_part.html +30 -0
  56. package/template/base/modules/pos/print/pos_receipt_part.rk +8 -0
  57. package/template/base/modules/pos/screens/kasir.rk +5 -3
  58. package/template/base/modules/pos/screens/kasir_meja.rk +62 -0
  59. package/template/base/modules/shifts/module.rk +1 -1
  60. package/template/base/modules/users/flows/summary_daily.rk +3 -1
  61. package/template/base/modules/users/flows/summary_monthly.rk +3 -1
  62. package/template/base/modules/users/flows/summary_weekly.rk +3 -1
@@ -1,17 +1,19 @@
1
1
  # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/module.json
2
2
  name: pos
3
- version: 1.7.0
3
+ version: 1.10.0
4
4
  title: {id: Kasir, en: Point of sale}
5
5
  summary:
6
6
  id: Kasir di browser dengan sesi kas, transaksi dan tutup sesi per outlet.
7
7
  en: A browser till with cash sessions, sales and session close per outlet.
8
8
  category: sales
9
9
  icon: shopping-basket-line
10
- # The cashier of a shop or an F&B outlet, online (Jalur B v0; devices and offline come with rangka-edge, contracts
11
- # 0003 and 0006). A cashier opens a shift (pos_shift) at an outlet with the float in the drawer, rings up sales
10
+ # The cashier of a shop or an F&B outlet (Jalur B), online in any browser and offline on a paired device (rangka-os
11
+ # contract 0058: the device numbers its receipts and shifts with its own code, computes the totals with the model's
12
+ # computes and sends them when the connection is back; its totals are binding). A cashier opens a shift (pos_shift)
13
+ # at an outlet with the float in the drawer, rings up sales
12
14
  # (pos_sale: items or menu, qty in any unit of the item, line and receipt discounts, paid in cash with change, QRIS,
13
15
  # or both), and closes the shift by counting the drawer: the difference is booked as selisih kas. Each sale is
14
- # numbered per outlet (STRK-<outlet code>-<YYMM>-<n>, kernel contract 0009 §2a), takes its goods out of the outlet's
16
+ # numbered per outlet (STRK-<outlet code>-<YYMM>-<n>, kernel contract 0009 §2a; on a paired device with its code), takes its goods out of the outlet's
15
17
  # stock through the declared stock rule (contract 0021; a menu item through its active recipe, contract 0022) and is
16
18
  # journalled by the accounting module like a day of outlet_sales. A sale can be voided (cancel) or corrected
17
19
  # (cancel, then amend without the returned items) only on its own day while its shift is open.
@@ -20,6 +22,9 @@ icon: shopping-basket-line
20
22
  # A sale may name its customer (contacts), and with module promotions it takes item promos by itself and a bill promo,
21
23
  # voucher code or free gift picked at the counter's checkout (rangka-os contract 0069, rangka-apps#103). With module
22
24
  # loyalty the checkout also takes a member, points to redeem and a part paid from the member's deposit (rangka-apps#102).
25
+ # A sale copies the outlet's service charge (dine-in only), PBJT rate and bill rounding while it is a draft, and a paid
26
+ # receipt can be printed split into parts (rangka-apps#121, pos 1.9.0). Tables: an open bill per table, moved, merged
27
+ # or split by line, sent to the kitchen while a draft; a bill opened on a table is dine-in (rangka-apps#122, pos 1.10.0).
23
28
  requires: {rangka: '>=0.5', users: ^1.2, contacts: ^1.4, catalogue: ^1.5, outlets: ^1.7, stock: ^1.2}
24
29
  hooks: [stock.reverse_moves]
25
30
  optional: {accounting: ^1.4, outlet_sales: ^1.1, promotions: ^1.0, loyalty: ^1.0, shifts: ^1.0}
@@ -35,16 +35,19 @@ body { font-size: 8.5pt; }
35
35
  </div>
36
36
  {{end}}
37
37
  <div class="rule"></div>
38
- {{if or .Doc.discount_amount .Doc.bill_promo .Doc.member_discount .Doc.points_discount}}<div class="row"><span>Subtotal</span><span class="num">{{rupiah .Doc.subtotal}}</span></div>{{end}}
38
+ {{if or .Doc.discount_amount .Doc.bill_promo .Doc.member_discount .Doc.points_discount .Doc.service_charge .Doc.pbjt .Doc.rounding}}<div class="row"><span>Subtotal</span><span class="num">{{rupiah .Doc.subtotal}}</span></div>{{end}}
39
39
  {{if .Doc.bill_promo}}<div class="row"><span>Promo nota {{.Doc.promo_name}}</span><span class="num">-{{rupiah .Doc.bill_promo}}</span></div>{{end}}
40
40
  {{if .Doc.member_discount}}<div class="row"><span>Diskon member {{.Links.member.tier_name}}</span><span class="num">-{{rupiah .Doc.member_discount}}</span></div>{{end}}
41
41
  {{if .Doc.points_discount}}<div class="row"><span>Tukar {{number .Doc.points_redeemed}} poin</span><span class="num">-{{rupiah .Doc.points_discount}}</span></div>{{end}}
42
42
  {{if .Doc.discount_amount}}<div class="row"><span>Diskon nota</span><span class="num">-{{rupiah .Doc.discount_amount}}</span></div>{{end}}
43
43
  {{if .Doc.promo_total}}<div class="row muted"><span>Hemat dari promo</span><span class="num">{{rupiah .Doc.promo_total}}</span></div>{{end}}
44
+ {{if .Doc.service_charge}}<div class="row"><span>Service charge {{number .Doc.service_pct}}%</span><span class="num">{{rupiah .Doc.service_charge}}</span></div>{{end}}
45
+ {{if .Doc.pbjt}}<div class="row"><span>PBJT {{number .Doc.pbjt_pct}}%</span><span class="num">{{rupiah .Doc.pbjt}}</span></div>{{end}}
46
+ {{if .Doc.rounding}}<div class="row"><span>Pembulatan</span><span class="num">{{rupiah .Doc.rounding}}</span></div>{{end}}
44
47
  <div class="row big"><span>Total</span><span class="num">{{rupiah .Doc.grand_total}}</span></div>
45
48
  {{if .Doc.ppn_in_sales}}<div class="row muted"><span>Termasuk PPN</span><span class="num">{{rupiah .Doc.ppn_in_sales}}</span></div>{{end}}
46
49
  {{if .Doc.deposit_used}}<div class="row"><span>Deposit</span><span class="num">{{rupiah .Doc.deposit_used}}</span></div>{{end}}
47
- {{range $p := .Doc.payments}}<div class="row"><span>{{if eq (printf "%v" $p.method) "qris"}}QRIS{{with $p.ref}} {{.}}{{end}}{{else}}Tunai{{end}}</span><span class="num">{{rupiah $p.amount}}</span></div>
50
+ {{range $p := .Doc.payments}}<div class="row"><span>{{if gt $.Doc.parties 1}}Bagian {{$p.party}}: {{end}}{{if eq (printf "%v" $p.method) "qris"}}QRIS{{with $p.ref}} {{.}}{{end}}{{else}}Tunai{{end}}</span><span class="num">{{rupiah $p.amount}}</span></div>
48
51
  {{else}}{{if $.Doc.amount_due}}<div class="row"><span>Tunai</span><span class="num">{{rupiah $.Doc.amount_due}}</span></div>{{end}}
49
52
  {{end}}
50
53
  {{if .Doc.change_amount}}<div class="row"><span>Kembalian</span><span class="num">{{rupiah .Doc.change_amount}}</span></div>{{end}}
@@ -0,0 +1,30 @@
1
+ {{define "style"}}
2
+ /* Arah E untuk thermal, sama dengan nota faktur: hitam putih, nama usaha tebal, angka rata kanan. */
3
+ body { font-size: 8.5pt; }
4
+ .c { text-align: center; }
5
+ .brand { font-size: 1.25em; font-weight: 700; }
6
+ .rule { border-top: 1px dashed #1C1917; margin: 2mm 0; }
7
+ .row { display: flex; justify-content: space-between; gap: 2mm; }
8
+ .row .num { white-space: nowrap; }
9
+ .line { margin: 1mm 0; }
10
+ .line .sub { color: #57534E; }
11
+ .big { font-size: 1.35em; font-weight: 700; }
12
+ .status { font-weight: 700; }
13
+ .muted { color: #57534E; }
14
+ {{end}}
15
+ {{define "letterhead"}}{{with .Letterhead}}<div class="c">
16
+ <div class="brand">{{.legal_name}}</div>
17
+ </div>{{end}}{{end}}
18
+ {{template "letterhead" .}}
19
+ <div class="c">{{.Links.outlet.outlet_name}}</div>
20
+ <div class="rule"></div>
21
+ <div class="row"><span>Struk</span><span>{{.Doc.name}}</span></div>
22
+ <div class="row"><span>Tanggal</span><span>{{date .Doc.date}}</span></div>
23
+ <div class="row"><span>Total tagihan</span><span class="num">{{rupiah .Doc.grand_total}}</span></div>
24
+ {{range $p := .Doc.payments}}
25
+ <div class="rule"></div>
26
+ <div class="c big">Bagian {{$p.party}} dari {{$.Doc.parties}}</div>
27
+ <div class="row"><span>{{if eq (printf "%v" $p.method) "qris"}}QRIS{{with $p.ref}} {{.}}{{end}}{{else}}Tunai{{end}}</span><span class="num">{{rupiah $p.amount}}</span></div>
28
+ {{end}}
29
+ <div class="rule"></div>
30
+ <div class="c muted">Terima kasih</div>
@@ -0,0 +1,8 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/print.json
2
+ # One slip per payment row of a split bill ("Bagian 2 dari 3"): what that part paid and its change (rangka-apps#121).
3
+ # A part paid with two rows (cash and QRIS) gets two slips.
4
+ name: pos_receipt_part
5
+ model: pos_sale
6
+ label: {id: Struk per bagian (bayar terpisah), en: Receipt per part (split bill)}
7
+ paper: 80mm
8
+ template: pos_receipt_part.html
@@ -29,12 +29,14 @@ counter:
29
29
  # amount_due: the total less what the member's deposit pays (module loyalty); without it, the total
30
30
  total: amount_due
31
31
  change: change_amount
32
- summary: [gross_total, promo_total, member_discount, points_discount, manual_discount_total, promo_shortfall, deposit_used, amount_due]
32
+ # at most 12 lines (0034 §2, raised for rangka-apps#121; checkout takes at most 8 fields): the discounts show as one
33
+ # total here, the receipt and the sale keep the breakdown
34
+ summary: [gross_total, promo_total, member_discount, points_discount, manual_discount_total, promo_shortfall, service_charge, pbjt, rounding, deposit_used, amount_due]
33
35
  # rangka-os contract 0069: filled before paying; the promo picker lists live bill promos only, the member picker
34
36
  # active members. Fields of modules promotions and loyalty are left out when not installed (their depends_on).
35
- checkout: [customer, {field: member, filter: "active"}, {field: promotion, filter: "is_bill && live"}, promo_code, points_redeemed, deposit_used]
37
+ checkout: [order_type, customer, {field: member, filter: "active"}, {field: promotion, filter: "is_bill && live"}, promo_code, points_redeemed, deposit_used]
36
38
  set: {date: "today()"}
37
- payments: {table: payments, method: method, amount: amount, ref: ref, methods: [cash, qris]}
39
+ payments: {table: payments, method: method, amount: amount, ref: ref, party: party, parties: parties, methods: [cash, qris]}
38
40
  session:
39
41
  model: pos_shift
40
42
  link: shift
@@ -0,0 +1,62 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/screen.json
2
+ # The cashier's work screen for a restaurant or cafe with tables (contract 0030 §2 counter, 0048 §2; rangka-apps#122). Same
3
+ # sale as kasir, but the cashier opens on the table map. kasir stays for a counter without tables.
4
+ # (contract 0030 §2 counter): the kernel web app renders it from these slots. Money, stock
5
+ # and numbering stay in pos_sale (computes, rules, stock: block, journal flows); the screen only fills the sale.
6
+ name: kasir_meja
7
+ type: counter
8
+ label: {id: Kasir meja, en: Table cashier}
9
+ description: {id: 'Buka tagihan per meja, kirim ke dapur, pindah, gabung atau pisah tagihan, lalu bayar dan cetak struk.'}
10
+ icon: wallet
11
+ roles: [cashier, head_office]
12
+ device: tablet
13
+ needs: [print, scan]
14
+ offline: queue
15
+ counter:
16
+ catalogue:
17
+ model: item
18
+ filter: "kind != 'material' && active != false"
19
+ title: item_name
20
+ search: [item_name, sku, barcode]
21
+ group_by: category
22
+ price: rate
23
+ barcode: barcode
24
+ variants: {group: variant_group, label: variant_label, title: variant_title}
25
+ available: {model: stock_balance, item: item, qty: qty, match: {outlet: outlet}}
26
+ document:
27
+ model: pos_sale
28
+ lines: items
29
+ # amount: the model's line amount shows a promo (struck price) or a free gift; flag: the cashier marks the gift line
30
+ line: {item: item, qty: qty, price: rate, note: note, amount: amount, flag: is_gift}
31
+ # amount_due: the total less what the member's deposit pays (module loyalty); without it, the total
32
+ total: amount_due
33
+ change: change_amount
34
+ # the same rows as kasir, with #121's service charge, PBJT and rounding: a bill on a table is dine-in
35
+ summary: [gross_total, promo_total, member_discount, points_discount, manual_discount_total, promo_shortfall, service_charge, pbjt, rounding, deposit_used, amount_due]
36
+ # rangka-os contract 0069: filled before paying; the promo picker lists live bill promos only, the member picker
37
+ # active members. Fields of modules promotions and loyalty are left out when not installed (their depends_on).
38
+ checkout: [order_type, customer, {field: member, filter: "active"}, {field: promotion, filter: "is_bill && live"}, promo_code, points_redeemed, deposit_used]
39
+ set: {date: "today()"}
40
+ payments: {table: payments, method: method, amount: amount, ref: ref, party: party, parties: parties, methods: [cash, qris]}
41
+ session:
42
+ model: pos_shift
43
+ link: shift
44
+ filter: "cashier == user.email"
45
+ state: {field: state, open: open, closed: closed}
46
+ open: [outlet, opening_cash]
47
+ set: {outlet: "user.outlets.size() > 0 ? user.outlets[0] : ''"}
48
+ close: {model: pos_shift_close, link: shift, fields: [counted_cash, closing_note]}
49
+ # contract 0048 section 2: the counter opens on the table map; an open bill is a draft that links its table
50
+ customer:
51
+ field: buyer
52
+ table:
53
+ model: dining_table
54
+ link: table
55
+ title: table_name
56
+ area: area_title
57
+ seats: seats
58
+ filter: "active != false"
59
+ match: {outlet: outlet}
60
+ guests: guests
61
+ bill: bill_asked
62
+ print: pos_receipt
@@ -11,6 +11,6 @@ icon: calendar-line
11
11
  # (pos_shift, module pos) is something else: it links to the work shift when the cashier has one, never needs it.
12
12
  # With module attendance, a clock-in links to the employee's published shift of that day and lateness is measured
13
13
  # against the shift instead of the outlet's default hours; flow shift_attendance_sync marks each shift present, late or
14
- # absent. The kernel clock screen's own shift slot (clock.shift, rangka-os 0030 known gap) is a later task.
14
+ # absent. The clock screen shows the shift of the day (clock.shift, rangka-os 0030) and links it at clock-in.
15
15
  requires: {rangka: '>=0.5', users: ^1.5, outlets: ^1.6}
16
16
  optional: {attendance: ^1.1, pos: ^1.6}
@@ -64,7 +64,9 @@ steps:
64
64
  date_to: "('as_of' in event ? event.as_of : today()) - duration(1)"
65
65
  summary_key: "'daily|' + string(('as_of' in event ? event.as_of : today()) - duration(1))"
66
66
  setting: cfg.name
67
- sales_total: "(app_installed('invoicing') ? inv.map(i, i.grand_total).sum() : 0) + (app_installed('pos') ? receipts.map(i, i.grand_total).sum() : 0) + (app_installed('outlet_sales') ? daily.map(i, i.net_total).sum() : 0)"
67
+ # POS sales on the net before service charge, PBJT and rounding (audit F6): PBJT is owed to the region, service and
68
+ # rounding sit in their own accounts; cash_in below still counts the whole receipt
69
+ sales_total: "(app_installed('invoicing') ? inv.map(i, i.grand_total).sum() : 0) + (app_installed('pos') ? receipts.map(i, i.grand_total - i.service_charge - i.pbjt - i.rounding).sum() : 0) + (app_installed('outlet_sales') ? daily.map(i, i.net_total).sum() : 0)"
68
70
  sales_count: "(app_installed('invoicing') ? size(inv) : 0) + (app_installed('pos') ? size(receipts) : 0) + (app_installed('outlet_sales') ? size(daily) : 0)"
69
71
  cash_in: "(app_installed('payments') ? paid.map(i, i.amount).sum() : 0) + (app_installed('pos') ? receipts.map(i, i.grand_total).sum() : 0) + (app_installed('outlet_sales') ? takings.map(i, i.received_total).sum() : 0)"
70
72
  due_count: "app_installed('invoicing') ? owed.filter(i, i.due_date >= ('as_of' in event ? event.as_of : today())).size() : 0"
@@ -64,7 +64,9 @@ steps:
64
64
  date_to: "('as_of' in event ? event.as_of : today()) - duration(1)"
65
65
  summary_key: "'monthly|' + string(('as_of' in event ? event.as_of : today()) - duration(1))"
66
66
  setting: cfg.name
67
- sales_total: "(app_installed('invoicing') ? inv.map(i, i.grand_total).sum() : 0) + (app_installed('pos') ? receipts.map(i, i.grand_total).sum() : 0) + (app_installed('outlet_sales') ? daily.map(i, i.net_total).sum() : 0)"
67
+ # POS sales on the net before service charge, PBJT and rounding (audit F6): PBJT is owed to the region, service and
68
+ # rounding sit in their own accounts; cash_in below still counts the whole receipt
69
+ sales_total: "(app_installed('invoicing') ? inv.map(i, i.grand_total).sum() : 0) + (app_installed('pos') ? receipts.map(i, i.grand_total - i.service_charge - i.pbjt - i.rounding).sum() : 0) + (app_installed('outlet_sales') ? daily.map(i, i.net_total).sum() : 0)"
68
70
  sales_count: "(app_installed('invoicing') ? size(inv) : 0) + (app_installed('pos') ? size(receipts) : 0) + (app_installed('outlet_sales') ? size(daily) : 0)"
69
71
  cash_in: "(app_installed('payments') ? paid.map(i, i.amount).sum() : 0) + (app_installed('pos') ? receipts.map(i, i.grand_total).sum() : 0) + (app_installed('outlet_sales') ? takings.map(i, i.received_total).sum() : 0)"
70
72
  due_count: "app_installed('invoicing') ? owed.filter(i, i.due_date >= ('as_of' in event ? event.as_of : today())).size() : 0"
@@ -64,7 +64,9 @@ steps:
64
64
  date_to: "('as_of' in event ? event.as_of : today()) - duration(1)"
65
65
  summary_key: "'weekly|' + string(('as_of' in event ? event.as_of : today()) - duration(1))"
66
66
  setting: cfg.name
67
- sales_total: "(app_installed('invoicing') ? inv.map(i, i.grand_total).sum() : 0) + (app_installed('pos') ? receipts.map(i, i.grand_total).sum() : 0) + (app_installed('outlet_sales') ? daily.map(i, i.net_total).sum() : 0)"
67
+ # POS sales on the net before service charge, PBJT and rounding (audit F6): PBJT is owed to the region, service and
68
+ # rounding sit in their own accounts; cash_in below still counts the whole receipt
69
+ sales_total: "(app_installed('invoicing') ? inv.map(i, i.grand_total).sum() : 0) + (app_installed('pos') ? receipts.map(i, i.grand_total - i.service_charge - i.pbjt - i.rounding).sum() : 0) + (app_installed('outlet_sales') ? daily.map(i, i.net_total).sum() : 0)"
68
70
  sales_count: "(app_installed('invoicing') ? size(inv) : 0) + (app_installed('pos') ? size(receipts) : 0) + (app_installed('outlet_sales') ? size(daily) : 0)"
69
71
  cash_in: "(app_installed('payments') ? paid.map(i, i.amount).sum() : 0) + (app_installed('pos') ? receipts.map(i, i.grand_total).sum() : 0) + (app_installed('outlet_sales') ? takings.map(i, i.received_total).sum() : 0)"
70
72
  due_count: "app_installed('invoicing') ? owed.filter(i, i.due_date >= ('as_of' in event ? event.as_of : today())).size() : 0"