@rangka-os/create 0.5.0-alpha.33 → 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 (93) 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/kasir/skills/rangka-app-kasir/SKILL.md +1 -1
  11. package/template/base/apps/pembelian_pemasok/app.rk +8 -0
  12. package/template/base/apps/pembelian_pemasok/skills/rangka-app-pembelian-pemasok/SKILL.md +43 -0
  13. package/template/base/apps/pesanan_whatsapp/app.rk +28 -0
  14. package/template/base/apps/ritel_cabang/app.rk +7 -0
  15. package/template/base/apps/ritel_cabang/dashboards/ritel_overview.rk +16 -0
  16. package/template/base/apps/ritel_cabang/dashboards/ritel_stock.rk +13 -0
  17. package/template/base/apps/ritel_cabang/skills/rangka-app-ritel-cabang/SKILL.md +43 -0
  18. package/template/base/apps/sewa_alat/skills/rangka-app-sewa-alat/SKILL.md +3 -3
  19. package/template/base/connectors/rangka_whatsapp/README.md +3 -2
  20. package/template/base/connectors/rangka_whatsapp/connector.rk +12 -4
  21. package/template/base/connectors/rangka_whatsapp/fixtures/expect.json +3 -2
  22. package/template/base/connectors/rangka_whatsapp/fixtures/message_received.json +1 -1
  23. package/template/base/connectors/rangka_whatsapp/fixtures/message_received_order.json +1 -0
  24. package/template/base/connectors/rangka_whatsapp/mock/rangka_whatsapp_mock.py +9 -4
  25. package/template/base/modules/accounting/flows/financial_report_compute.rk +1 -1
  26. package/template/base/modules/accounting/flows/financial_report_recompute.rk +1 -1
  27. package/template/base/modules/accounting/flows/gl_pos_sale_post.rk +38 -2
  28. package/template/base/modules/accounting/models/gl_entry.rk +3 -0
  29. package/template/base/modules/attendance/module.rk +4 -4
  30. package/template/base/modules/attendance/screens/absen_outlet.rk +3 -0
  31. package/template/base/modules/catalogue/defaults/uom.rk +19 -0
  32. package/template/base/modules/catalogue/models/item.rk +12 -0
  33. package/template/base/modules/kitchen/flows/kitchen_ticket_on_draft.rk +44 -0
  34. package/template/base/modules/kitchen/flows/kitchen_ticket_on_sale.rk +6 -5
  35. package/template/base/modules/loyalty/flows/loyalty_on_sale.rk +6 -5
  36. package/template/base/modules/loyalty/flows/loyalty_on_sale_cancel.rk +2 -2
  37. package/template/base/modules/outlet_sales/models/outlet_sales_line.rk +1 -0
  38. package/template/base/modules/outlets/models/outlet.rk +48 -0
  39. package/template/base/modules/outlets/module.rk +1 -1
  40. package/template/base/modules/payroll/flows/pph21_annual_on_slip_cancel.rk +28 -0
  41. package/template/base/modules/payroll/flows/pph21_annual_on_slip_submit.rk +84 -0
  42. package/template/base/modules/payroll/models/payslip.rk +4 -0
  43. package/template/base/modules/payroll/models/pph21_annual.rk +84 -0
  44. package/template/base/modules/payroll/models/pph21_period.rk +77 -0
  45. package/template/base/modules/payroll/module.rk +3 -2
  46. package/template/base/modules/payroll/print/bukti_potong_a1.html +53 -0
  47. package/template/base/modules/payroll/print/bukti_potong_a1.rk +9 -0
  48. package/template/base/modules/payroll/print/coretax_bp21.rk +44 -0
  49. package/template/base/modules/payroll/print/coretax_bp21.xml +36 -0
  50. package/template/base/modules/payroll/print/coretax_bpa1.rk +21 -0
  51. package/template/base/modules/payroll/print/coretax_bpa1.xml +46 -0
  52. package/template/base/modules/payroll/print/coretax_bpmp.rk +23 -0
  53. package/template/base/modules/payroll/print/coretax_bpmp.xml +31 -0
  54. package/template/base/modules/pos/flows/pos_sale_merge.rk +34 -0
  55. package/template/base/modules/pos/flows/pos_sale_on_cancel.rk +3 -0
  56. package/template/base/modules/pos/flows/pos_sale_on_submit.rk +28 -1
  57. package/template/base/modules/pos/flows/pos_sale_split.rk +37 -0
  58. package/template/base/modules/pos/flows/pos_shift_on_create.rk +9 -1
  59. package/template/base/modules/pos/flows/pos_table_guard_on_create.rk +24 -0
  60. package/template/base/modules/pos/flows/pos_table_guard_on_update.rk +23 -0
  61. package/template/base/modules/pos/models/dining_area.rk +23 -0
  62. package/template/base/modules/pos/models/dining_table.rk +38 -0
  63. package/template/base/modules/pos/models/pos_guard.rk +39 -0
  64. package/template/base/modules/pos/models/pos_payment.rk +2 -0
  65. package/template/base/modules/pos/models/pos_sale.rk +153 -7
  66. package/template/base/modules/pos/models/pos_sale_item.rk +4 -0
  67. package/template/base/modules/pos/models/pos_shift.rk +11 -1
  68. package/template/base/modules/pos/module.rk +9 -4
  69. package/template/base/modules/pos/print/pos_receipt.html +5 -2
  70. package/template/base/modules/pos/print/pos_receipt_part.html +30 -0
  71. package/template/base/modules/pos/print/pos_receipt_part.rk +8 -0
  72. package/template/base/modules/pos/screens/kasir.rk +6 -3
  73. package/template/base/modules/pos/screens/kasir_meja.rk +62 -0
  74. package/template/base/modules/reimbursement/models/expense_claim.rk +1 -1
  75. package/template/base/modules/shifts/module.rk +1 -1
  76. package/template/base/modules/stock/flows/stock_balance_variant_group.rk +26 -0
  77. package/template/base/modules/stock/models/stock_balance.rk +1 -0
  78. package/template/base/modules/stock/models/stock_move.rk +1 -0
  79. package/template/base/modules/users/flows/summary_daily.rk +3 -1
  80. package/template/base/modules/users/flows/summary_monthly.rk +3 -1
  81. package/template/base/modules/users/flows/summary_weekly.rk +3 -1
  82. package/template/base/modules/whatsapp/models/whatsapp_message.rk +2 -0
  83. package/template/base/modules/whatsapp/module.rk +2 -2
  84. package/template/base/modules/whatsapp_order/README.md +44 -0
  85. package/template/base/modules/whatsapp_order/flows/whatsapp_order_intake.rk +118 -0
  86. package/template/base/modules/whatsapp_order/flows/whatsapp_order_locked.rk +12 -0
  87. package/template/base/modules/whatsapp_order/flows/whatsapp_order_on_update.rk +124 -0
  88. package/template/base/modules/whatsapp_order/models/whatsapp_inbound.rk +62 -0
  89. package/template/base/modules/whatsapp_order/models/whatsapp_order.rk +164 -0
  90. package/template/base/modules/whatsapp_order/models/whatsapp_order_guard.rk +46 -0
  91. package/template/base/modules/whatsapp_order/models/whatsapp_order_line.rk +45 -0
  92. package/template/base/modules/whatsapp_order/module.rk +42 -0
  93. package/template/base/modules/whatsapp_order/screens/pesanan_wa.rk +22 -0
@@ -0,0 +1,77 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/model.json
2
+ # One PPh 21 withholding month (masa pajak) of the employer, with its Coretax downloads (print formats coretax_bpmp,
3
+ # coretax_bp21 and coretax_bpa1). Kept in payroll, not coretax, so the employee bundle needs no invoicing (rangka-apps#128,
4
+ # docs/ebupot21.md). The employer TIN and NITKU default from the org's NPWP the way coretax tax_period does.
5
+ name: pph21_period
6
+ label: {id: Masa PPh 21, en: PPh 21 period}
7
+ icon: file-download
8
+ naming: PPH21-{####}
9
+ title_field: period_key
10
+ permissions:
11
+ - {role: finance_manager, read: true, create: true, write: true, delete: true, print: true, export: true}
12
+ fields:
13
+ - {name: year, type: int, grouping: false, label: {id: Tahun}, required: true, in_list: true}
14
+ - name: month
15
+ type: int
16
+ label: {id: Bulan (1 sampai 12)}
17
+ required: true
18
+ in_list: true
19
+ help: {id: 'Unggah bukti potong ke Coretax paling lambat tanggal 20 bulan berikutnya'}
20
+ - name: period_key
21
+ type: data
22
+ label: {id: Masa}
23
+ unique: true
24
+ in_list: true
25
+ compute: "truncate(year, 4) + '-' + (month < 10 ? '0' : '') + truncate(month, 2)"
26
+ - name: seller_tin
27
+ type: data
28
+ label: {id: NPWP pemotong (16 angka)}
29
+ required: true
30
+ default: "org.npwp.replace('.', '').replace('-', '')"
31
+ - name: seller_nitku
32
+ type: data
33
+ label: {id: NITKU pemotong (22 angka)}
34
+ help: {id: 'ID TKU dari Coretax; kantor pusat = NPWP + 000000'}
35
+ required: true
36
+ default: "org.npwp == '' ? '' : org.npwp.replace('.', '').replace('-', '') + '000000'"
37
+ # Text YYYY-MM-DD, so the rule below can compare it with the month in text order.
38
+ - name: withholding_date
39
+ type: data
40
+ label: {id: Tanggal pemotongan (TTTT-BB-HH)}
41
+ required: true
42
+ help: {id: 'Contoh 2026-11-30. Tidak boleh sebelum bulan masa pajak; biasanya akhir bulan masa pajak atau tanggal bayar gaji'}
43
+ - name: notes
44
+ type: text
45
+ label: {id: Catatan}
46
+ rules:
47
+ - name: month_range
48
+ on: save
49
+ check: month >= 1 && month <= 12 && year >= 2024 && year <= 2100
50
+ message: {id: 'Bulan 1 sampai 12 dan tahun 4 angka, misalnya 2026'}
51
+ - name: seller_tin_16
52
+ on: save
53
+ check: "size(seller_tin) == 16 && seller_tin.matches('^[0-9]+$')"
54
+ message: {id: 'NPWP pemotong harus 16 angka, isi NPWP usaha di Pengaturan'}
55
+ - name: seller_nitku_22
56
+ on: save
57
+ check: "size(seller_nitku) == 22 && seller_nitku.matches('^[0-9]+$') && seller_nitku.startsWith(seller_tin)"
58
+ message: {id: NITKU pemotong harus 22 angka dan diawali NPWP pemotong}
59
+ - name: withholding_not_before_period
60
+ on: save
61
+ check: "withholding_date.matches('^20[0-9]{2}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$') && withholding_date >= truncate(year, 4) + '-' + (month < 10 ? '0' : '') + truncate(month, 2) + '-01'"
62
+ message: {id: 'Tanggal pemotongan harus berbentuk 2026-11-30 dan tidak boleh sebelum bulan masa pajak'}
63
+ views:
64
+ list:
65
+ columns: [name, period_key, year, month, withholding_date]
66
+ sort: -period_key
67
+ form:
68
+ layout:
69
+ - section: {id: Masa pajak}
70
+ columns:
71
+ - [year, month, withholding_date]
72
+ - section: {id: Identitas pemotong}
73
+ columns:
74
+ - [seller_tin, seller_nitku]
75
+ - section: {id: Catatan}
76
+ columns:
77
+ - [notes]
@@ -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: payroll
3
- version: 2.3.0
3
+ version: 2.4.0
4
4
  title: {id: Penggajian, en: Payroll}
5
5
  summary:
6
6
  id: Data gaji pekerja, periode gaji, slip gaji dan tutup periode.
@@ -15,7 +15,8 @@ icon: money-dollar-box-line
15
15
  # 2.0 moved projects, invoicing, contacts and catalogue from requires to optional (breaking only for what they pulled
16
16
  # in). 2.2 (rangka-apps#117): staff request a kasbon, repaid by a monthly installment the slips fill in (one open kasbon
17
17
  # per worker, cash_advance_balance), and slips pay approved expense claims (module reimbursement) untaxed. Rules and
18
- # sources: docs/payroll.md.
18
+ # sources: docs/payroll.md. 2.4 (rangka-apps#128): PPh 21 Coretax exports (masa PPh 21 pph21_period with the BPMP, BP21
19
+ # and BPA1 XML) and the annual summary pph21_annual with the employee's own 1721-A1; sources: docs/ebupot21.md.
19
20
  requires: {rangka: '>=0.5', users: ^1.0, workforce: ^1.0}
20
21
  optional: {projects: ^1.0, invoicing: ^1.7, contacts: ^1.0, catalogue: ^1.0, outlets: ^1.0, attendance: ^1.0, reimbursement: ^1.0}
21
22
  # What this module tells people (contract 0066 §1.1), both from flow payroll_reminder. Nothing here runs payroll.
@@ -0,0 +1,53 @@
1
+ {{define "style"}}
2
+ .meta { width: 100%; margin: 6px 0 12px; border-collapse: collapse; font-size: 0.95em; }
3
+ .meta td { padding: 3px 8px 3px 0; vertical-align: top; }
4
+ .meta td.k { width: 30%; color: #57534e; }
5
+ h2.sec { font-size: 1em; margin: 16px 0 4px; padding: 4px 8px; background: #f5f5f4; }
6
+ .items { width: 100%; border-collapse: collapse; font-size: 0.95em; }
7
+ .items th, .items td { padding: 4px 6px; text-align: left; border-bottom: 1px solid #e7e5e4; }
8
+ .items th { font-weight: 600; }
9
+ .items tr.total td { border-top: 2px solid #1c1917; border-bottom: 0; font-weight: 700; }
10
+ .num { text-align: right !important; font-variant-numeric: tabular-nums; }
11
+ .note { margin-top: 12px; font-size: 0.82em; color: #57534e; }
12
+ {{end}}
13
+ {{template "letterhead" .}}
14
+ <h1>Bukti Pemotongan PPh Pasal 21 Tahunan (1721-A1)</h1>
15
+ <p class="note">Masa pajak {{.Doc.month_start}} sampai {{.Doc.month_end}}, tahun pajak {{.Doc.tax_year}} ({{if eq .Doc.withholding_status "full_year"}}setahun penuh{{else}}kurang dari setahun{{end}})</p>
16
+
17
+ <h2 class="sec">A. Identitas</h2>
18
+ <table class="meta">
19
+ <tr><td class="k">Pemotong</td><td>{{.Doc.employer_name}}</td></tr>
20
+ <tr><td class="k">NPWP pemotong</td><td>{{.Doc.employer_tin}}</td></tr>
21
+ <tr><td class="k">Nama pegawai</td><td>{{.Doc.worker_name}}</td></tr>
22
+ <tr><td class="k">NIK / NPWP</td><td>{{or .Doc.npwp .Doc.nik}}</td></tr>
23
+ <tr><td class="k">Jabatan</td><td>{{.Doc.position}}</td></tr>
24
+ <tr><td class="k">Status PTKP</td><td>{{upper .Doc.ptkp_status}}</td></tr>
25
+ <tr><td class="k">Tanggal pemotongan</td><td>{{date .Doc.withholding_date}}</td></tr>
26
+ </table>
27
+
28
+ <h2 class="sec">B. Penghasilan dan pengurang</h2>
29
+ <table class="items">
30
+ <thead><tr><th>Uraian</th><th class="num">Rp</th></tr></thead>
31
+ <tbody>
32
+ <tr><td>Gaji</td><td class="num">{{rupiah .Doc.gross_salary}}</td></tr>
33
+ <tr><td>Tunjangan lain dan lembur</td><td class="num">{{rupiah .Doc.other_benefit}}</td></tr>
34
+ <tr><td>Premi asuransi dibayar pemberi kerja</td><td class="num">{{rupiah .Doc.insurance_employer}}</td></tr>
35
+ <tr><td>Bonus, THR, tantiem</td><td class="num">{{rupiah .Doc.bonus_thr}}</td></tr>
36
+ <tr class="total"><td>Penghasilan bruto</td><td class="num">{{rupiah .Doc.year_gross}}</td></tr>
37
+ <tr><td>Biaya jabatan</td><td class="num">-{{rupiah .Doc.job_cost}}</td></tr>
38
+ <tr><td>Iuran pensiun dan JHT pegawai</td><td class="num">-{{rupiah .Doc.pension_contribution}}</td></tr>
39
+ <tr class="total"><td>Penghasilan neto</td><td class="num">{{rupiah .Doc.year_net}}</td></tr>
40
+ <tr><td>PTKP</td><td class="num">-{{rupiah .Doc.ptkp}}</td></tr>
41
+ <tr class="total"><td>Penghasilan kena pajak (PKP)</td><td class="num">{{rupiah .Doc.year_pkp}}</td></tr>
42
+ </tbody>
43
+ </table>
44
+
45
+ <h2 class="sec">C. PPh Pasal 21</h2>
46
+ <table class="items">
47
+ <tbody>
48
+ <tr><td>PPh 21 terutang setahun (tarif Pasal 17)</td><td class="num">{{rupiah .Doc.year_pph21}}</td></tr>
49
+ <tr><td>Sudah dipotong di masa sebelumnya</td><td class="num">{{rupiah .Doc.withheld_before}}</td></tr>
50
+ <tr class="total"><td>{{if eq (slice (print .Doc.last_withheld) 0 1) "-"}}Kelebihan potong dikembalikan di masa terakhir{{else}}Dipotong di masa terakhir{{end}}</td><td class="num">{{rupiah .Doc.last_withheld}}</td></tr>
51
+ </tbody>
52
+ </table>
53
+ <p class="note">Rekap ini disalin dari slip gaji masa pajak terakhir dan slip bulan-bulan sebelumnya. Bukti potong resmi dibuat di Coretax DJP.</p>
@@ -0,0 +1,9 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/print.json
2
+ # Bukti pemotongan PPh 21 tahunan 1721-A1 for one employee: sections A (identitas), B (penghasilan dan pengurang) and
3
+ # C (PPh 21) of the DJP form, from the worker's pph21_annual row (rangka-apps#128). The employee prints their own.
4
+ name: bukti_potong_a1
5
+ model: pph21_annual
6
+ label: {id: Bukti potong 1721-A1, en: Form 1721-A1}
7
+ paper: A4
8
+ template: bukti_potong_a1.html
9
+ default: true
@@ -0,0 +1,44 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/print.json
2
+ # Monthly PPh 21 withholding slips of casual daily workers (BP21, pegawai tidak tetap paid per day) as Coretax imports
3
+ # them (Bp21Bulk, DJP template bp21.xml and converter "BP21 Excel to XML v.4"). They never get a 1721-A1. Three lists
4
+ # by the daily gross, the same bands as the slip's daily TER (PMK 168/2023 Pasal 16): up to 450.000 a day 0%, up to
5
+ # 2.500.000 a day 0,5% (code 21-100-24), above that Pasal 17 on 50% (code 21-100-30). Field map: docs/ebupot21.md.
6
+ name: coretax_bp21
7
+ model: pph21_period
8
+ label: {id: XML Bukti Potong PPh 21 Pegawai Tidak Tetap Harian (Coretax)}
9
+ output: xml
10
+ template: coretax_bp21.xml
11
+ related:
12
+ zero:
13
+ model: payslip
14
+ range: {tax_year: [year, year], tax_month: [month, month]}
15
+ filter: docstatus == 1 && ter_daily && (days + holiday_overtime_days <= 0 || gross_taxable * 1.0 <= 450000.0 * (days + holiday_overtime_days))
16
+ sort: name
17
+ limit: 1000
18
+ require:
19
+ - check: "((size(slip_npwp.replace('.', '').replace('-', '').replace(' ', '')) in [15, 16] && slip_npwp.replace('.', '').replace('-', '').replace(' ', '').matches('^[0-9]+$')) || (size(slip_nik) == 16 && slip_nik.matches('^[0-9]+$')))"
20
+ message: {id: 'Pekerja di slip ini belum punya NIK 16 angka atau NPWP: lengkapi Data gaji pekerja (slip lama: buat bukti potongnya langsung di Coretax)'}
21
+ - check: "ptkp_status != '' && gross_taxable >= 0"
22
+ message: {id: 'Status PTKP atau penghasilan bruto di slip ini tidak valid'}
23
+ low:
24
+ model: payslip
25
+ range: {tax_year: [year, year], tax_month: [month, month]}
26
+ filter: docstatus == 1 && ter_daily && gross_taxable * 1.0 > 450000.0 * (days + holiday_overtime_days) && gross_taxable * 1.0 <= 2500000.0 * (days + holiday_overtime_days)
27
+ sort: name
28
+ limit: 1000
29
+ require:
30
+ - check: "((size(slip_npwp.replace('.', '').replace('-', '').replace(' ', '')) in [15, 16] && slip_npwp.replace('.', '').replace('-', '').replace(' ', '').matches('^[0-9]+$')) || (size(slip_nik) == 16 && slip_nik.matches('^[0-9]+$')))"
31
+ message: {id: 'Pekerja di slip ini belum punya NIK 16 angka atau NPWP: lengkapi Data gaji pekerja (slip lama: buat bukti potongnya langsung di Coretax)'}
32
+ - check: "ptkp_status != '' && gross_taxable >= 0"
33
+ message: {id: 'Status PTKP atau penghasilan bruto di slip ini tidak valid'}
34
+ high:
35
+ model: payslip
36
+ range: {tax_year: [year, year], tax_month: [month, month]}
37
+ filter: docstatus == 1 && ter_daily && days + holiday_overtime_days > 0 && gross_taxable * 1.0 > 2500000.0 * (days + holiday_overtime_days)
38
+ sort: name
39
+ limit: 1000
40
+ require:
41
+ - check: "((size(slip_npwp.replace('.', '').replace('-', '').replace(' ', '')) in [15, 16] && slip_npwp.replace('.', '').replace('-', '').replace(' ', '').matches('^[0-9]+$')) || (size(slip_nik) == 16 && slip_nik.matches('^[0-9]+$')))"
42
+ message: {id: 'Pekerja di slip ini belum punya NIK 16 angka atau NPWP: lengkapi Data gaji pekerja (slip lama: buat bukti potongnya langsung di Coretax)'}
43
+ - check: "ptkp_status != '' && gross_taxable >= 0"
44
+ message: {id: 'Status PTKP atau penghasilan bruto di slip ini tidak valid'}
@@ -0,0 +1,36 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2
+ {{- /* Element names and order follow the DJP template bp21.xml (pajak.go.id Coretax templates); column meanings from
3
+ "BP21 Excel to XML v.4.xlsx" sheet BP21. Gross is the slip's whole bruto; Rate x Deemed% x Gross is the slip's PPh 21:
4
+ 21-100-24 is Deemed 100 and Rate 0 or 0,5 (x120% without a tax number); 21-100-30 is Deemed 50 and the Rate is the
5
+ slip's PPh 21 over half of its gross (the Pasal 17 layers as one percent, 2 decimals). The reference document is the
6
+ slip itself (Document Other). */}}
7
+ <Bp21Bulk xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
8
+ <TIN>{{.Doc.seller_tin}}</TIN>
9
+ <ListOfBp21>
10
+ {{- $d := .Doc}}
11
+ {{- range $k, $rows := .Related}}
12
+ {{- range $rows}}
13
+ {{- $tin := digits .slip_nik}}
14
+ {{- if eq (len (digits .slip_npwp)) 16}}{{$tin = digits .slip_npwp}}{{else if eq (len (digits .slip_npwp)) 15}}{{$tin = print "0" (digits .slip_npwp)}}{{end}}
15
+ {{- $m := 100}}{{if not .has_tax_id}}{{$m = 120}}{{end}}
16
+ <Bp21>
17
+ <TaxPeriodMonth>{{dec $d.month 0}}</TaxPeriodMonth>
18
+ <TaxPeriodYear>{{$d.year}}</TaxPeriodYear>
19
+ <CounterpartTin>{{$tin}}</CounterpartTin>
20
+ <IDPlaceOfBusinessActivityOfIncomeRecipient>{{$tin}}000000</IDPlaceOfBusinessActivityOfIncomeRecipient>
21
+ <StatusTaxExemption>{{if eq (slice .ptkp_status 0 1) "t"}}TK/{{slice .ptkp_status 2}}{{else}}K/{{slice .ptkp_status 1}}{{end}}</StatusTaxExemption>
22
+ <TaxCertificate>N/A</TaxCertificate>
23
+ <TaxObjectCode>{{if eq $k "high"}}21-100-30{{else}}21-100-24{{end}}</TaxObjectCode>
24
+ <Gross>{{dec .gross_taxable 0}}</Gross>
25
+ <Deemed>{{if eq $k "high"}}50{{else}}100{{end}}</Deemed>
26
+ <Rate>{{if eq $k "zero"}}0{{else if eq $k "low"}}{{dec (div (mul 5 $m) 1000) 2}}{{else}}{{dec (div (mul .daily_pph21 200) .gross_taxable) 4}}{{end}}</Rate>
27
+ <Document>Other</Document>
28
+ <DocumentNumber>{{.name}}</DocumentNumber>
29
+ <DocumentDate>{{isodate .run_period_to}}</DocumentDate>
30
+ <IDPlaceOfBusinessActivity>{{$d.seller_nitku}}</IDPlaceOfBusinessActivity>
31
+ <WithholdingDate>{{isodate $d.withholding_date}}</WithholdingDate>
32
+ </Bp21>
33
+ {{- end}}
34
+ {{- end}}
35
+ </ListOfBp21>
36
+ </Bp21Bulk>
@@ -0,0 +1,21 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/print.json
2
+ # Annual or last-month 1721-A1 of permanent employees as Coretax imports them (A1Bulk, DJP template bpa1.xml and converter
3
+ # "BPA1 Excel to XML"): the pph21_annual rows whose last tax month is the period's month and year. Coretax computes the
4
+ # annual tax itself from the income parts below, so Article21IncomeTax is 0 as the DJP sheet says. Field map: docs/ebupot21.md.
5
+ name: coretax_bpa1
6
+ model: pph21_period
7
+ label: {id: XML Bukti Potong 1721-A1 (Coretax)}
8
+ output: xml
9
+ template: coretax_bpa1.xml
10
+ related:
11
+ a1:
12
+ model: pph21_annual
13
+ range: {tax_year: [year, year], month_end: [month, month]}
14
+ filter: "!voided"
15
+ sort: name
16
+ limit: 1000
17
+ require:
18
+ - check: "((size(npwp.replace('.', '').replace('-', '').replace(' ', '')) in [15, 16] && npwp.replace('.', '').replace('-', '').replace(' ', '').matches('^[0-9]+$')) || (size(nik) == 16 && nik.matches('^[0-9]+$')))"
19
+ message: {id: 'Pekerja di slip ini belum punya NIK 16 angka atau NPWP: lengkapi Data gaji pekerja (slip lama: buat bukti potongnya langsung di Coretax)'}
20
+ - check: "ptkp_status != '' && year_gross >= 0"
21
+ message: {id: 'Status PTKP atau penghasilan di rekap ini tidak valid'}
@@ -0,0 +1,46 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2
+ {{- /* Element names and order follow the DJP template bpa1.xml (pajak.go.id Coretax templates); column meanings from
3
+ "BPA1 Excel to XML.xlsx" sheet BPA1. SalaryPensionJhtTht is the salary after unpaid days and lateness; OtherBenefit
4
+ allowances, overtime and other income; InsurancePaidByEmployer the employer JKK, JKM and BPJS Kesehatan counted in
5
+ the bruto; TantiemBonusThr the THR; PensionContributionJhtThtFee the employee JHT and JP. The rows are those whose last
6
+ tax month is the period's month. Status FullYear (full_year) is January to December, else PartialYear (partial_year); NumberOfMonths is 0 for both
7
+ (the DJP sheet: 0 unless Annualized). */}}
8
+ <A1Bulk xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
9
+ <TIN>{{.Doc.seller_tin}}</TIN>
10
+ <ListOfA1>
11
+ {{- $d := .Doc}}
12
+ {{- range .Related.a1}}
13
+ {{- $tin := digits .nik}}
14
+ {{- if eq (len (digits .npwp)) 16}}{{$tin = digits .npwp}}{{else if eq (len (digits .npwp)) 15}}{{$tin = print "0" (digits .npwp)}}{{end}}
15
+ <A1>
16
+ <WorkForSecondEmployer>No</WorkForSecondEmployer>
17
+ <TaxPeriodMonthStart>{{dec .month_start 0}}</TaxPeriodMonthStart>
18
+ <TaxPeriodMonthEnd>{{dec .month_end 0}}</TaxPeriodMonthEnd>
19
+ <TaxPeriodYear>{{.tax_year}}</TaxPeriodYear>
20
+ <CounterpartOpt>Resident</CounterpartOpt>
21
+ <CounterpartPassport xsi:nil="true"/>
22
+ <CounterpartTin>{{$tin}}</CounterpartTin>
23
+ <TaxExemptOpt>{{if eq (slice .ptkp_status 0 1) "t"}}TK/{{slice .ptkp_status 2}}{{else}}K/{{slice .ptkp_status 1}}{{end}}</TaxExemptOpt>
24
+ <StatusOfWithholding>{{if eq .withholding_status "full_year"}}FullYear{{else}}PartialYear{{end}}</StatusOfWithholding>
25
+ <CounterpartPosition>{{or .position "Staff"}}</CounterpartPosition>
26
+ <TaxObjectCode>21-100-01</TaxObjectCode>
27
+ <NumberOfMonths>0</NumberOfMonths>
28
+ <SalaryPensionJhtTht>{{dec .gross_salary 0}}</SalaryPensionJhtTht>
29
+ <GrossUpOpt>No</GrossUpOpt>
30
+ <IncomeTaxBenefit>0</IncomeTaxBenefit>
31
+ <OtherBenefit>{{dec .other_benefit 0}}</OtherBenefit>
32
+ <Honorarium>0</Honorarium>
33
+ <InsurancePaidByEmployer>{{dec .insurance_employer 0}}</InsurancePaidByEmployer>
34
+ <Natura>0</Natura>
35
+ <TantiemBonusThr>{{dec .bonus_thr 0}}</TantiemBonusThr>
36
+ <PensionContributionJhtThtFee>{{dec .pension_contribution 0}}</PensionContributionJhtThtFee>
37
+ <Zakat>0</Zakat>
38
+ <PrevWhTaxSlip xsi:nil="true"/>
39
+ <TaxCertificate>N/A</TaxCertificate>
40
+ <Article21IncomeTax>0</Article21IncomeTax>
41
+ <IDPlaceOfBusinessActivity>{{$d.seller_nitku}}</IDPlaceOfBusinessActivity>
42
+ <WithholdingDate>{{isodate $d.withholding_date}}</WithholdingDate>
43
+ </A1>
44
+ {{- end}}
45
+ </ListOfA1>
46
+ </A1Bulk>
@@ -0,0 +1,23 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/print.json
2
+ # Every slip taxed with monthly TER is here, also a casual worker paid monthly (the slip taxes it like a permanent one). Monthly PPh 21 withholding slips of permanent employees (BPMP, form 1721-VIII) as Coretax imports them (MmPayrollBulk,
3
+ # DJP template bpmp.xml and converter "BPMP Excel to XML v.3"). The last tax month (December or the month a worker
4
+ # leaves) is a 1721-A1 instead: see coretax_bpa1. Field map and sources: docs/ebupot21.md.
5
+ name: coretax_bpmp
6
+ model: pph21_period
7
+ label: {id: XML Bukti Potong PPh 21 Bulanan Pegawai Tetap (Coretax)}
8
+ output: xml
9
+ template: coretax_bpmp.xml
10
+ related:
11
+ slips:
12
+ model: payslip
13
+ range: {tax_year: [year, year], tax_month: [month, month]}
14
+ filter: docstatus == 1 && !last_month && !ter_daily
15
+ sort: name
16
+ limit: 1000
17
+ require:
18
+ - check: "((size(slip_npwp.replace('.', '').replace('-', '').replace(' ', '')) in [15, 16] && slip_npwp.replace('.', '').replace('-', '').replace(' ', '').matches('^[0-9]+$')) || (size(slip_nik) == 16 && slip_nik.matches('^[0-9]+$')))"
19
+ message: {id: 'Pekerja di slip ini belum punya NIK 16 angka atau NPWP: lengkapi Data gaji pekerja (slip lama: buat bukti potongnya langsung di Coretax)'}
20
+ - check: "ptkp_status != ''"
21
+ message: {id: 'Status PTKP pekerja di slip ini kosong'}
22
+ - check: "ter_bp >= 0 && gross_taxable >= 0"
23
+ message: {id: 'Penghasilan bruto atau tarif TER di slip ini tidak valid'}
@@ -0,0 +1,31 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2
+ {{- /* Element names and order follow the DJP template bpmp.xml (pajak.go.id Coretax templates); column meanings from
3
+ "BPMP Excel to XML v.3.xlsx" sheet BPMP. Gross is the slip's bruto PPh 21 (pay + employer JKK, JKM, health), Rate the
4
+ TER percent the slip withheld with (x120% when the profile says no tax number), so Coretax's Gross x Rate is the
5
+ slip's PPh 21. Code 21-100-01: permanent employee. */}}
6
+ <MmPayrollBulk xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
7
+ <TIN>{{.Doc.seller_tin}}</TIN>
8
+ <ListOfMmPayroll>
9
+ {{- $d := .Doc}}
10
+ {{- range .Related.slips}}
11
+ {{- $tin := digits .slip_nik}}
12
+ {{- if eq (len (digits .slip_npwp)) 16}}{{$tin = digits .slip_npwp}}{{else if eq (len (digits .slip_npwp)) 15}}{{$tin = print "0" (digits .slip_npwp)}}{{end}}
13
+ {{- $m := 100}}{{if not .has_tax_id}}{{$m = 120}}{{end}}
14
+ <MmPayroll>
15
+ <TaxPeriodMonth>{{dec $d.month 0}}</TaxPeriodMonth>
16
+ <TaxPeriodYear>{{$d.year}}</TaxPeriodYear>
17
+ <CounterpartOpt>Resident</CounterpartOpt>
18
+ <CounterpartPassport xsi:nil="true"/>
19
+ <CounterpartTin>{{$tin}}</CounterpartTin>
20
+ <StatusTaxExemption>{{if eq (slice .ptkp_status 0 1) "t"}}TK/{{slice .ptkp_status 2}}{{else}}K/{{slice .ptkp_status 1}}{{end}}</StatusTaxExemption>
21
+ <Position>{{or .slip_role_title "Staff"}}</Position>
22
+ <TaxCertificate>N/A</TaxCertificate>
23
+ <TaxObjectCode>21-100-01</TaxObjectCode>
24
+ <Gross>{{dec .gross_taxable 0}}</Gross>
25
+ <Rate>{{dec (div (mul .ter_bp $m) 10000) 4}}</Rate>
26
+ <IDPlaceOfBusinessActivity>{{$d.seller_nitku}}</IDPlaceOfBusinessActivity>
27
+ <WithholdingDate>{{isodate $d.withholding_date}}</WithholdingDate>
28
+ </MmPayroll>
29
+ {{- end}}
30
+ </ListOfMmPayroll>
31
+ </MmPayrollBulk>
@@ -0,0 +1,34 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
2
+ # Merge two open bills (rangka-apps#122, contract 0048 Open 4). The cashier sets merge_into on the bill to fold; this flow
3
+ # runs inside that write, so the lines land on the target and the source is marked merged in one atomic step: the lines
4
+ # are never on both bills as payable ones. The source keeps its lines as a record, frees its table and can never be
5
+ # paid (rule merged_not_payable); it can be deleted afterwards. Nothing touches stock: stock moves only when the
6
+ # target is paid. Line keys are prefixed with the source's name so they stay unique on the target, and the lines the
7
+ # kitchen already got are carried over under the same prefixed keys, so none is sent twice. The source's bill discount
8
+ # (discount_amount, rupiah) is added to the target's, so the merged total is the sum of both totals; a discount is
9
+ # rupiah off the net, so the sum leaves every later percentage (service, tax) on the same base. The target's
10
+ # "Minta tagihan" is cleared: the bill it asked for has changed. An amended copy (a return) is never merged, as source or
11
+ # target, and a line without a key keeps an empty key.
12
+ name: pos_sale_merge
13
+ label: {id: 'Gabung dua tagihan meja'}
14
+ description: {id: 'Semua barang tagihan yang digabung pindah ke tagihan tujuan, lalu tagihan asal tidak bisa dibayar lagi'}
15
+ on: pos_sale.updated
16
+ if: "event.docstatus == 0 && event.merge_into != '' && !event.merged"
17
+ steps:
18
+ - {find: pos_sale, where: "name == event.merge_into", as: tgt}
19
+ - {find: pos_sale, where: "name == event.name", as: src}
20
+ - if: tgt == null || (has(tgt.amended_from) && tgt.amended_from != '') || (has(event.amended_from) && event.amended_from != '') || tgt.docstatus != 0 || tgt.outlet != event.outlet || tgt.merged || tgt.merge_into != '' || tgt.name == event.name || event.promotion != '' || event.member != '' || event.points_redeemed > 0 || event.deposit_used > 0
21
+ create: pos_guard
22
+ set: {reason: "'merge_invalid'", document: event.name}
23
+ - if: tgt != null && (!has(tgt.amended_from) || tgt.amended_from == '') && (!has(event.amended_from) || event.amended_from == '') && tgt.docstatus == 0 && tgt.outlet == event.outlet && !tgt.merged && tgt.merge_into == '' && tgt.name != event.name && event.promotion == '' && event.member == '' && event.points_redeemed == 0 && event.deposit_used == 0
24
+ then:
25
+ - update: tgt
26
+ set:
27
+ items: "tgt.items.map(l, {'item': l.item, 'packing': l.packing, 'qty': l.qty, 'discount_pct': l.discount_pct, 'description': l.description, 'note': l.note, 'is_gift': l.is_gift, 'line_key': l.line_key}) + event.items.map(l, {'item': l.item, 'packing': l.packing, 'qty': l.qty, 'discount_pct': l.discount_pct, 'description': l.description, 'note': l.note, 'is_gift': l.is_gift, 'line_key': l.line_key == '' ? '' : event.name + ':' + l.line_key})"
28
+ sent_to_kitchen: "(tgt.sent_to_kitchen == null ? [] : tgt.sent_to_kitchen) + (event.sent_to_kitchen == null ? [] : event.sent_to_kitchen).map(s, {'key': event.name + ':' + s.key, 'item': s.item, 'packing': has(s.packing) ? s.packing : '', 'description': s.description, 'qty': s.qty, 'uom': s.uom, 'note': s.note, 'category': s.category})"
29
+ guests: tgt.guests + event.guests
30
+ discount_amount: tgt.discount_amount + event.discount_amount
31
+ bill_asked: "false"
32
+ rev: tgt.rev + 1
33
+ - update: src
34
+ set: {merged: "true", table: "''", bill_asked: "false", send_kitchen: "false"}
@@ -29,6 +29,9 @@ steps:
29
29
  cash_total: s.cash_total - event.cash_amount
30
30
  qris_total: s.qris_total - event.qris_amount
31
31
  deposit_total: s.deposit_total - event.deposit_used
32
+ service_total: s.service_total - event.service_charge
33
+ pbjt_total: s.pbjt_total - event.pbjt
34
+ rounding_total: s.rounding_total - event.rounding
32
35
  cogs_total: s.cogs_total - event.cogs_total
33
36
  void_count: s.void_count + 1
34
37
  void_total: s.void_total + event.grand_total
@@ -8,6 +8,27 @@ label: {id: 'Transaksi kasir dibayar: tambah ke sesi kasir'}
8
8
  on: pos_sale.submitted
9
9
  steps:
10
10
  - {find: pos_shift, where: name == event.shift && state == 'open', as: s}
11
+ # only a store sells (rangka-apps#104): a device event turns the sale's own rules (sale_at_store) into exceptions,
12
+ # so the store check is repeated here, where a guard still refuses
13
+ - {find: outlet, if: device.event, where: name == event.outlet, as: so}
14
+ - if: device.event && so != null && so.location_type != '' && so.location_type != 'store'
15
+ create: pos_guard
16
+ set: {reason: "'not_a_store'", document: event.name}
17
+ # A device event also turns rules outlet_of_shift (outlet == shift.outlet) and own_shift into exceptions, so a sale
18
+ # could add to another outlet's or another cashier's head-office drawer and book a false shortage at its close. The
19
+ # shift is read whatever its state (a closed one is still not this device's to link). The kernel already refuses a
20
+ # shift made on another device (deviceLinks, shift_other_device); what is left is a shift made without a device.
21
+ - {find: pos_shift, if: device.event, where: name == event.shift, as: ds}
22
+ - if: device.event && ds != null && (ds.outlet != event.outlet || (device.outlet != '' && ds.outlet != device.outlet))
23
+ create: pos_guard
24
+ set: {reason: "'shift_other_outlet'", document: ds.name}
25
+ # Own shift on a device: one this device opened (its name carries the device code, contract 0058 §3; a cashier switch
26
+ # keeps selling on it) or one the same cashier opened.
27
+ - if: >-
28
+ device.event && ds != null && ds.cashier != user.email
29
+ && !(so != null && ds.name.startsWith('SESI-' + so.code + '-' + device.code + '-'))
30
+ create: pos_guard
31
+ set: {reason: "'shift_not_own'", document: ds.name}
11
32
  # Jalur A and B never on the same outlet and day: a daily sales record (form, Moka, POS file) of this outlet and day
12
33
  # refuses the receipt (and flow pos_daily_form_guard refuses the record after a receipt), whatever sales_source says
13
34
  - find_all: outlet_sales
@@ -45,7 +66,10 @@ steps:
45
66
  - if: day != null && day.source == ''
46
67
  update: day
47
68
  set: {source: "'kasir'", document: event.name}
48
- - if: s == null
69
+ # A receipt a paired device sends from its queue (device.event) was already paid at the outlet (rangka-os contract
70
+ # 0058 §10): a shift head office closed meanwhile does not refuse it (rule shift_open becomes a rule_overridden exception for head office) and the
71
+ # closed shift's totals stay as counted.
72
+ - if: s == null && !device.event
49
73
  create: pos_guard
50
74
  set: {reason: "'shift_closed'", document: event.name}
51
75
  - update: s
@@ -58,4 +82,7 @@ steps:
58
82
  cash_total: s.cash_total + event.cash_amount
59
83
  qris_total: s.qris_total + event.qris_amount
60
84
  deposit_total: s.deposit_total + event.deposit_used
85
+ service_total: s.service_total + event.service_charge
86
+ pbjt_total: s.pbjt_total + event.pbjt
87
+ rounding_total: s.rounding_total + event.rounding
61
88
  cogs_total: s.cogs_total + event.cogs_total
@@ -0,0 +1,37 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
2
+ # Split an open bill by line (rangka-apps#122). The cashier lists the line keys to move in split_lines; this flow runs
3
+ # inside that write: the new bill (split_of set) takes those lines on the same table, the old bill keeps the rest and
4
+ # split_lines is cleared so the flow cannot run twice. The two bills add up to the original: lines move whole, with their
5
+ # own discounts, and the lines the kitchen already got stay recorded under their keys on the bill they moved to. At
6
+ # least one line must stay, and a bill with a promo, a member or a deposit picked is not split (those amounts belong to
7
+ # the whole bill). An amended copy (a return) is not split. Stock moves only at payment, once per paid bill. The new bill
8
+ # takes the old bill's order_type, so each bill computes its own service charge, PBJT and rounding (rangka-apps#121).
9
+ name: pos_sale_split
10
+ label: {id: 'Pisah tagihan meja per barang'}
11
+ description: {id: 'Barang yang dipilih pindah ke tagihan baru di meja yang sama; sisanya tetap di tagihan lama'}
12
+ on: pos_sale.updated
13
+ if: "event.docstatus == 0 && event.split_lines.size() > 0"
14
+ steps:
15
+ - {find: pos_sale, where: "name == event.name", as: src}
16
+ - if: "event.table == '' || (has(event.amended_from) && event.amended_from != '') || event.merged || event.items.filter(l, !(l.line_key in event.split_lines)).size() == 0 || event.items.filter(l, l.line_key in event.split_lines).size() == 0 || event.promotion != '' || event.member != '' || event.points_redeemed > 0 || event.deposit_used > 0"
17
+ create: pos_guard
18
+ set: {reason: "'split_invalid'", document: event.name}
19
+ - if: "event.table != '' && (!has(event.amended_from) || event.amended_from == '') && !event.merged && event.items.filter(l, !(l.line_key in event.split_lines)).size() > 0 && event.items.filter(l, l.line_key in event.split_lines).size() > 0 && event.promotion == '' && event.member == '' && event.points_redeemed == 0 && event.deposit_used == 0"
20
+ then:
21
+ - create: pos_sale
22
+ set:
23
+ shift: event.shift
24
+ outlet: event.outlet
25
+ date: event.date
26
+ table: event.table
27
+ order_type: event.order_type
28
+ guests: "1"
29
+ split_of: event.name
30
+ items: "event.items.filter(l, l.line_key in event.split_lines).map(l, {'item': l.item, 'packing': l.packing, 'qty': l.qty, 'discount_pct': l.discount_pct, 'description': l.description, 'note': l.note, 'is_gift': l.is_gift, 'line_key': l.line_key})"
31
+ sent_to_kitchen: "event.sent_to_kitchen.filter(s, s.key in event.split_lines)"
32
+ - update: src
33
+ set:
34
+ items: "event.items.filter(l, !(l.line_key in event.split_lines)).map(l, {'item': l.item, 'packing': l.packing, 'qty': l.qty, 'discount_pct': l.discount_pct, 'description': l.description, 'note': l.note, 'is_gift': l.is_gift, 'line_key': l.line_key})"
35
+ sent_to_kitchen: "event.sent_to_kitchen.filter(s, !(s.key in event.split_lines))"
36
+ split_lines: "[]"
37
+ rev: event.rev + 1
@@ -7,6 +7,11 @@ label: {id: 'Sesi kasir dibuka: hanya satu sesi terbuka per kasir per outlet'}
7
7
  on: pos_shift.created
8
8
  steps:
9
9
  - {find: outlet, where: name == event.outlet, as: o}
10
+ # only a store sells (rangka-apps#104, rule shift_at_store): repeated here because a paired device's write turns the
11
+ # shift's own rules into exceptions (rangka-os contract 0058 §10), while a guard a flow writes still refuses
12
+ - if: o != null && o.location_type != '' && o.location_type != 'store'
13
+ create: pos_guard
14
+ set: {reason: "'not_a_store'", document: event.name}
10
15
  - if: o != null && o.cash_float > 0 && event.opening_cash != o.cash_float
11
16
  create: pos_guard
12
17
  set: {reason: "'float_of_outlet'", document: event.name}
@@ -14,7 +19,10 @@ steps:
14
19
  where: outlet == event.outlet && cashier == event.cashier && state == 'open' && name != event.name
15
20
  limit: 1
16
21
  as: open
17
- - if: open.size() > 0
22
+ # a shift a paired device opened offline (device.event) already took sales at the outlet: a second open shift of the
23
+ # same cashier is accepted then (rangka-os contract 0058 §6, one shift per cashier per device); refusing it would
24
+ # refuse every receipt queued on it
25
+ - if: open.size() > 0 && !device.event
18
26
  create: pos_guard
19
27
  set:
20
28
  reason: "'shift_already_open'"
@@ -0,0 +1,24 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
2
+ # The create half of pos_table_guard: a new bill on a table that already has an open bill is refused. Every open bill
3
+ # counts, a split child included. A bill made by the split flow (split_of set, a read-only field only that flow writes)
4
+ # shares its table on purpose and is not guarded. A copy with amended_from (a voided receipt paid again, a partial return)
5
+ # is not a table bill any more: its table is cleared. Amend itself runs no created flows, so pos_table_guard_on_update
6
+ # clears it on the copy's first write and the table map and the guards never count an amended copy as an open bill;
7
+ # this branch covers a copy created with amended_from (a device write that keeps its name).
8
+ name: pos_table_guard_on_create
9
+ label: {id: 'Satu tagihan terbuka per meja (tagihan baru)'}
10
+ description: {id: 'Tagihan baru di meja yang sudah punya tagihan terbuka ditolak'}
11
+ on: pos_sale.created
12
+ if: "event.docstatus == 0 && event.table != '' && event.split_of == ''"
13
+ steps:
14
+ - if: "has(event.amended_from) && event.amended_from != ''"
15
+ then:
16
+ - {find: pos_sale, where: "name == event.name", as: self}
17
+ - update: self
18
+ set: {table: "''", bill_asked: "false", send_kitchen: "false"}
19
+ - if: "!has(event.amended_from) || event.amended_from == ''"
20
+ then:
21
+ - {find_all: pos_sale, where: "table == event.table && docstatus == 0 && !merged && amended_from == '' && name != event.name", limit: 1, as: others}
22
+ - if: others.size() > 0
23
+ create: pos_guard
24
+ set: {reason: "'table_busy'", document: event.name}
@@ -0,0 +1,23 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
2
+ # The update half of pos_table_guard: moving an open bill onto a table that already has an open bill is refused. It runs
3
+ # only when the table changes (event.before), so a bill and its split child sharing a table on purpose can still be
4
+ # edited, while any bill moved onto a busy table is refused, a split child included. A merged bill never sits on a
5
+ # table (rule merged_no_table). An amended copy of a paid bill (amended_from set; amend copies the table) is a return,
6
+ # not an open bill: its first write clears the table, and it is never counted as the table's open bill.
7
+ name: pos_table_guard_on_update
8
+ label: {id: 'Satu tagihan terbuka per meja (pindah meja)'}
9
+ description: {id: 'Pindah ke meja yang sudah punya tagihan terbuka ditolak'}
10
+ on: pos_sale.updated
11
+ if: "event.docstatus == 0 && event.table != ''"
12
+ steps:
13
+ - if: "has(event.amended_from) && event.amended_from != ''"
14
+ then:
15
+ - {find: pos_sale, where: "name == event.name", as: self}
16
+ - update: self
17
+ set: {table: "''", bill_asked: "false", send_kitchen: "false"}
18
+ - if: "(!has(event.amended_from) || event.amended_from == '') && (event.before == null || event.before.table != event.table)"
19
+ then:
20
+ - {find_all: pos_sale, where: "table == event.table && docstatus == 0 && !merged && amended_from == '' && name != event.name", limit: 1, as: others}
21
+ - if: others.size() > 0
22
+ create: pos_guard
23
+ set: {reason: "'table_busy'", document: event.name}
@@ -0,0 +1,23 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/model.json
2
+ # A section of an outlet's floor (Dalam, Teras, Lantai 2): the table map groups its tables by area.
3
+ name: dining_area
4
+ label: {id: Area meja, en: Dining area}
5
+ icon: stock
6
+ naming: ARM-{###}
7
+ title_field: area_name
8
+ permissions:
9
+ - {role: head_office, read: true, create: true, write: true, delete: true}
10
+ # the cashier reads the areas to see the map
11
+ - {role: cashier, read: true}
12
+ - {role: outlet_staff, read: true}
13
+ fields:
14
+ - {name: area_name, type: data, label: {id: Nama area}, help: {id: 'Misalnya Dalam, Teras, Lantai 2'}, required: true, in_list: true}
15
+ - {name: outlet, type: link, to: outlet, label: {id: Outlet}, required: true, in_list: true}
16
+ - {name: sort, type: int, label: {id: Urutan}, default: '0'}
17
+ # one area of a name per outlet
18
+ - {name: area_key, type: data, label: {id: Kunci area}, hidden: true, unique: true, compute: "outlet + '/' + area_name"}
19
+ views:
20
+ list:
21
+ columns: [area_name, outlet, sort]
22
+ filters: [outlet]
23
+ sort: sort