@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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rangka-os/create",
3
- "version": "0.5.0-alpha.34",
3
+ "version": "0.5.0-alpha.35",
4
4
  "description": "Start a Rangka OS project: npm create @rangka-os@latest my-shop",
5
5
  "license": "Elastic-2.0",
6
6
  "homepage": "https://rangka-os.github.io/rangka-os/guide/quick-start",
@@ -29,3 +29,7 @@ onboarding:
29
29
  - ask: {id: 'Apakah usaha kamu PKP (memungut PPN)?'}
30
30
  options: ['true', 'false']
31
31
  sets: tax.pkp
32
+ # Approval presets are opt-in (docs/presets/approvals/README.md): the answer 'ya' makes Raka copy the preset to custom/.
33
+ - ask: {id: 'Mau pasang Persetujuan diskon besar? Faktur dengan diskon di atas 20% menunggu persetujuan dulu.'}
34
+ options: ['ya', 'tidak']
35
+ sets: approvals.big_discount
@@ -0,0 +1,35 @@
1
+ ---
2
+ name: rangka-app-faktur-piutang
3
+ description: "Rangka Faktur dan Piutang (app faktur_piutang): sales invoices, payments received and reminders. Use when an owner asks for approval or a spending limit (\"PO besar harus aku setujui\", \"batasi pengeluaran staf\", \"diskon besar tanya aku dulu\") and during onboarding of this app, to offer the approval presets."
4
+ metadata: {rangka: {version: 1.0.0, app: faktur_piutang, requires: [rangka-compose, rangka-changesets]}}
5
+ ---
6
+
7
+ # Rangka approval presets for this app
8
+
9
+ Read `rangka-compose` first. This skill only covers the approval presets (issue rangka-apps#105). The engine is the
10
+ document approval of contract 0007: a submit that matches a policy is held (202), the approver sees it in Persetujuan
11
+ and the document proceeds when approved; a rejected one stays a draft.
12
+
13
+ ## Rules
14
+
15
+ - **Opt-in.** Never switch a preset on by default. Ask the owner (onboarding question) and only an answer `ya` installs it.
16
+ - **Roles only.** No per-person limits. The approver of the spending and big discount presets is the owner only (`approvers: [owner]`): finance can submit these documents, and an approver who submits approves their own request.
17
+ - **The limit is the owner's call.** The files use Rp 5.000.000 (purchasing, payouts) and 20% (discount) as examples.
18
+ Ask "mulai dari berapa?" and change the number in the `when:` expression of the copy, never in the preset file.
19
+ - Money or tax questions beyond a threshold are not part of a preset: say so and offer the nearest preset.
20
+
21
+ ## Presets for this app
22
+
23
+ ### Persetujuan diskon besar
24
+
25
+ - What the owner gets: a sales invoice with a discount above 20% waits for finance.
26
+ - Say it like this: "Mau aku pasangkan Persetujuan diskon besar? Mulai dari berapa?"
27
+ - Files: `docs/presets/approvals/sales_invoice_discount.rk`. Read each with `rangka_skill_file`, replace the limit if the owner named another, and write it as a
28
+ change set to custom/sales_invoice.rk (a copy of the file, named after its model). Each file starts with a plain-words header comment.
29
+ - After install, tell the owner the request shows in Persetujuan and only the owner approves it.
30
+
31
+ ## Checks before you propose the change set
32
+
33
+ - `custom/<model>.rk` does not exist yet for that model (one preset per model; if it does, merge the `approvals:` entry into it).
34
+ - The approver role is not the role that normally submits that document: an approver who submits approves their own request.
35
+ - Run the site validation of the change set; do not apply it when it reports an error.
@@ -45,3 +45,10 @@ onboarding:
45
45
  - ask: {id: 'Satuan stok apa yang kamu pakai untuk bahan baku? (gram dan karung diisi sebagai kemasan)'}
46
46
  options: [kg, liter, pcs]
47
47
  sets: item.stock_uom
48
+ # Approval presets are opt-in (docs/presets/approvals/README.md): the answer 'ya' makes Raka copy the preset to custom/.
49
+ - ask: {id: 'Mau pasang Persetujuan PO di atas batas? Pesanan pembelian di atas Rp 5.000.000 menunggu persetujuan dulu.'}
50
+ options: ['ya', 'tidak']
51
+ sets: approvals.po_threshold
52
+ - ask: {id: 'Mau pasang Persetujuan pengeluaran? Pembayaran keluar dan tagihan pemasok di atas Rp 5.000.000 menunggu persetujuan dulu.'}
53
+ options: ['ya', 'tidak']
54
+ sets: approvals.spending
@@ -0,0 +1,43 @@
1
+ ---
2
+ name: rangka-app-fnb-cabang
3
+ description: "Rangka F&B Cabang (app fnb_cabang): outlets, stock, recipes, purchasing and daily sales for a multi-outlet food business. Use when an owner asks for approval or a spending limit (\"PO besar harus aku setujui\", \"batasi pengeluaran staf\", \"diskon besar tanya aku dulu\") and during onboarding of this app, to offer the approval presets."
4
+ metadata: {rangka: {version: 1.0.0, app: fnb_cabang, requires: [rangka-compose, rangka-changesets]}}
5
+ ---
6
+
7
+ # Rangka approval presets for this app
8
+
9
+ Read `rangka-compose` first. This skill only covers the approval presets (issue rangka-apps#105). The engine is the
10
+ document approval of contract 0007: a submit that matches a policy is held (202), the approver sees it in Persetujuan
11
+ and the document proceeds when approved; a rejected one stays a draft.
12
+
13
+ ## Rules
14
+
15
+ - **Opt-in.** Never switch a preset on by default. Ask the owner (onboarding question) and only an answer `ya` installs it.
16
+ - **Roles only.** No per-person limits. The approver here is the owner (this app has no finance role, so the `_owner_only` files are used: the approver role is one nobody holds and the owner may always approve).
17
+ - **The limit is the owner's call.** The files use Rp 5.000.000 (purchasing, payouts) and 20% (discount) as examples.
18
+ Ask "mulai dari berapa?" and change the number in the `when:` expression of the copy, never in the preset file.
19
+ - Money or tax questions beyond a threshold are not part of a preset: say so and offer the nearest preset.
20
+
21
+ ## Presets for this app
22
+
23
+ ### Persetujuan PO di atas batas
24
+
25
+ - What the owner gets: a purchase order above Rp 5.000.000 (or in a foreign currency) waits for approval before it can be submitted; a smaller one goes straight through.
26
+ - Say it like this: "Mau aku pasangkan Persetujuan PO di atas batas? Mulai dari berapa?"
27
+ - Files: `docs/presets/approvals/purchase_order_threshold_owner_only.rk`. Read each with `rangka_skill_file`, replace the limit if the owner named another, and write it as a
28
+ change set to custom/purchase_order.rk (a copy of the file, named after its model). Each file starts with a plain-words header comment.
29
+ - After install, tell the owner who will see the request: the owner (this app has no finance role, so the `_owner_only` files are used: the approver role is one nobody holds and the owner may always approve), in Persetujuan.
30
+
31
+ ### Persetujuan pengeluaran
32
+
33
+ - What the owner gets: an outgoing payment above Rp 5.000.000, and a supplier bill above it that has no approved PO, wait for approval; incoming payments are not affected.
34
+ - Say it like this: "Mau aku pasangkan Persetujuan pengeluaran? Mulai dari berapa?"
35
+ - Files: `docs/presets/approvals/payment_payout.rk` and `docs/presets/approvals/vendor_bill_threshold.rk`. Read each with `rangka_skill_file`, replace the limit if the owner named another, and write it as a
36
+ change set to custom/payment.rk and custom/vendor_bill.rk (a copy of the file, named after its model). Each file starts with a plain-words header comment.
37
+ - After install, tell the owner who will see the request: the owner (this app has no finance role, so the `_owner_only` files are used: the approver role is one nobody holds and the owner may always approve), in Persetujuan.
38
+
39
+ ## Checks before you propose the change set
40
+
41
+ - `custom/<model>.rk` does not exist yet for that model (one preset per model; if it does, merge the `approvals:` entry into it).
42
+ - The approver role is not the role that normally submits that document: an approver who submits approves their own request.
43
+ - Run the site validation of the change set; do not apply it when it reports an error.
@@ -45,7 +45,7 @@ menu:
45
45
  - group: {id: Tenaga kerja}
46
46
  items: [worker]
47
47
  - group: {id: Penggajian}
48
- items: [payroll_run, payslip, payroll_close, payroll_profile, cash_advance]
48
+ items: [payroll_run, payslip, payroll_close, payroll_profile, cash_advance, pph21_period, pph21_annual]
49
49
  - group: {id: Keuangan}
50
50
  items: [payment, bank_transaction, invoice_reminder, withholding, vendor_bill, bank_account]
51
51
  - group: {id: Pembelian}
@@ -69,3 +69,13 @@ onboarding:
69
69
  sets: settings.business_line
70
70
  - ask: {id: 'Berapa PT yang kamu kelola?'}
71
71
  sets: seed.orgs
72
+ # Approval presets are opt-in (docs/presets/approvals/README.md): the answer 'ya' makes Raka copy the preset to custom/.
73
+ - ask: {id: 'Mau pasang Persetujuan PO di atas batas? Pesanan pembelian di atas Rp 5.000.000 menunggu persetujuan dulu.'}
74
+ options: ['ya', 'tidak']
75
+ sets: approvals.po_threshold
76
+ - ask: {id: 'Mau pasang Persetujuan pengeluaran? Pembayaran keluar dan tagihan pemasok di atas Rp 5.000.000 menunggu persetujuan dulu.'}
77
+ options: ['ya', 'tidak']
78
+ sets: approvals.spending
79
+ - ask: {id: 'Mau pasang Persetujuan diskon besar? Faktur dan penawaran dengan diskon di atas 20% menunggu persetujuan dulu.'}
80
+ options: ['ya', 'tidak']
81
+ sets: approvals.big_discount
@@ -0,0 +1,51 @@
1
+ ---
2
+ name: rangka-app-jasa-proyek
3
+ description: "Rangka Jasa dan Proyek (app jasa_proyek): quotations, projects, invoices, purchasing and staff work for a service firm. Use when an owner asks for approval or a spending limit (\"PO besar harus aku setujui\", \"batasi pengeluaran staf\", \"diskon besar tanya aku dulu\") and during onboarding of this app, to offer the approval presets."
4
+ metadata: {rangka: {version: 1.0.0, app: jasa_proyek, requires: [rangka-compose, rangka-changesets]}}
5
+ ---
6
+
7
+ # Rangka approval presets for this app
8
+
9
+ Read `rangka-compose` first. This skill only covers the approval presets (issue rangka-apps#105). The engine is the
10
+ document approval of contract 0007: a submit that matches a policy is held (202), the approver sees it in Persetujuan
11
+ and the document proceeds when approved; a rejected one stays a draft.
12
+
13
+ ## Rules
14
+
15
+ - **Opt-in.** Never switch a preset on by default. Ask the owner (onboarding question) and only an answer `ya` installs it.
16
+ - **Roles only.** No per-person limits. The approver of the spending and big discount presets is the owner only (`approvers: [owner]`): finance can submit these documents, and an approver who submits approves their own request.
17
+ - **The limit is the owner's call.** The files use Rp 5.000.000 (purchasing, payouts) and 20% (discount) as examples.
18
+ Ask "mulai dari berapa?" and change the number in the `when:` expression of the copy, never in the preset file.
19
+ - Money or tax questions beyond a threshold are not part of a preset: say so and offer the nearest preset.
20
+
21
+ ## Presets for this app
22
+
23
+ ### Persetujuan PO di atas batas
24
+
25
+ - What the owner gets: a purchase order above Rp 5.000.000 (or in a foreign currency) waits for approval before it can be submitted; a smaller one goes straight through.
26
+ - Say it like this: "Mau aku pasangkan Persetujuan PO di atas batas? Mulai dari berapa?"
27
+ - Files: `docs/presets/approvals/purchase_order_threshold.rk`. Read each with `rangka_skill_file`, replace the limit if the owner named another, and write it as a
28
+ change set to custom/purchase_order.rk (a copy of the file, named after its model). Each file starts with a plain-words header comment.
29
+ - After install, tell the owner the request shows in Persetujuan and only the owner approves it.
30
+
31
+ ### Persetujuan pengeluaran
32
+
33
+ - What the owner gets: an outgoing payment above Rp 5.000.000, and a supplier bill above it that has no approved PO, wait for approval; incoming payments are not affected.
34
+ - Say it like this: "Mau aku pasangkan Persetujuan pengeluaran? Mulai dari berapa?"
35
+ - Files: `docs/presets/approvals/payment_payout.rk` and `docs/presets/approvals/vendor_bill_threshold.rk`. Read each with `rangka_skill_file`, replace the limit if the owner named another, and write it as a
36
+ change set to custom/payment.rk and custom/vendor_bill.rk (a copy of the file, named after its model). Each file starts with a plain-words header comment.
37
+ - After install, tell the owner the request shows in Persetujuan and only the owner approves it.
38
+
39
+ ### Persetujuan diskon besar
40
+
41
+ - What the owner gets: a sales invoice or quotation with a discount above 20% waits for finance.
42
+ - Say it like this: "Mau aku pasangkan Persetujuan diskon besar? Mulai dari berapa?"
43
+ - Files: `docs/presets/approvals/sales_invoice_discount.rk` and `docs/presets/approvals/quotation_discount.rk`. Read each with `rangka_skill_file`, replace the limit if the owner named another, and write it as a
44
+ change set to custom/sales_invoice.rk and custom/quotation.rk (a copy of the file, named after its model). Each file starts with a plain-words header comment.
45
+ - After install, tell the owner the request shows in Persetujuan and only the owner approves it.
46
+
47
+ ## Checks before you propose the change set
48
+
49
+ - `custom/<model>.rk` does not exist yet for that model (one preset per model; if it does, merge the `approvals:` entry into it).
50
+ - The approver role is not the role that normally submits that document: an approver who submits approves their own request.
51
+ - Run the site validation of the change set; do not apply it when it reports an error.
@@ -38,6 +38,8 @@ work:
38
38
  menu:
39
39
  - group: {id: Gaji}
40
40
  items: [payroll_run, payslip, payroll_close, cash_advance, cash_advance_balance]
41
+ - group: {id: Pajak PPh 21}
42
+ items: [pph21_period, pph21_annual]
41
43
  - group: {id: Klaim biaya}
42
44
  items: [expense_claim, claim_settlement, claim_payment, expense_category]
43
45
  - group: {id: Karyawan}
@@ -33,6 +33,8 @@ home: {model: pos_sale}
33
33
  work:
34
34
  - {screen: kasir, roles: [cashier], home: true}
35
35
  - {screen: kasir, roles: [head_office]}
36
+ # tables (rangka-apps#122): a cafe or restaurant opens this one instead of kasir
37
+ - {screen: kasir_meja, roles: [cashier, head_office]}
36
38
  menu:
37
39
  - group: {id: Kasir}
38
40
  items: [pos_sale, pos_shift, pos_shift_close]
@@ -21,3 +21,11 @@ menu:
21
21
  items: [purchase_request, purchase_order, goods_receipt, vendor_bill]
22
22
  - group: {id: Pemasok}
23
23
  items: [vendor]
24
+ onboarding:
25
+ # Approval presets are opt-in (docs/presets/approvals/README.md): the answer 'ya' makes Raka copy the preset to custom/.
26
+ - ask: {id: 'Mau pasang Persetujuan PO di atas batas? Pesanan pembelian di atas Rp 5.000.000 menunggu persetujuan dulu.'}
27
+ options: ['ya', 'tidak']
28
+ sets: approvals.po_threshold
29
+ - ask: {id: 'Mau pasang Persetujuan pengeluaran? Pembayaran keluar dan tagihan pemasok di atas Rp 5.000.000 menunggu persetujuan dulu.'}
30
+ options: ['ya', 'tidak']
31
+ sets: approvals.spending
@@ -0,0 +1,43 @@
1
+ ---
2
+ name: rangka-app-pembelian-pemasok
3
+ description: "Rangka Pembelian (app pembelian_pemasok): purchase requests and orders, goods received, supplier bills. Use when an owner asks for approval or a spending limit (\"PO besar harus aku setujui\", \"batasi pengeluaran staf\", \"diskon besar tanya aku dulu\") and during onboarding of this app, to offer the approval presets."
4
+ metadata: {rangka: {version: 1.0.0, app: pembelian_pemasok, requires: [rangka-compose, rangka-changesets]}}
5
+ ---
6
+
7
+ # Rangka approval presets for this app
8
+
9
+ Read `rangka-compose` first. This skill only covers the approval presets (issue rangka-apps#105). The engine is the
10
+ document approval of contract 0007: a submit that matches a policy is held (202), the approver sees it in Persetujuan
11
+ and the document proceeds when approved; a rejected one stays a draft.
12
+
13
+ ## Rules
14
+
15
+ - **Opt-in.** Never switch a preset on by default. Ask the owner (onboarding question) and only an answer `ya` installs it.
16
+ - **Roles only.** No per-person limits. The approver here is the owner (this app has no finance role, so the `_owner_only` files are used: the approver role is one nobody holds and the owner may always approve).
17
+ - **The limit is the owner's call.** The files use Rp 5.000.000 (purchasing, payouts) and 20% (discount) as examples.
18
+ Ask "mulai dari berapa?" and change the number in the `when:` expression of the copy, never in the preset file.
19
+ - Money or tax questions beyond a threshold are not part of a preset: say so and offer the nearest preset.
20
+
21
+ ## Presets for this app
22
+
23
+ ### Persetujuan PO di atas batas
24
+
25
+ - What the owner gets: a purchase order above Rp 5.000.000 (or in a foreign currency) waits for approval before it can be submitted; a smaller one goes straight through.
26
+ - Say it like this: "Mau aku pasangkan Persetujuan PO di atas batas? Mulai dari berapa?"
27
+ - Files: `docs/presets/approvals/purchase_order_threshold_owner_only.rk`. Read each with `rangka_skill_file`, replace the limit if the owner named another, and write it as a
28
+ change set to custom/purchase_order.rk (a copy of the file, named after its model). Each file starts with a plain-words header comment.
29
+ - After install, tell the owner who will see the request: the owner (this app has no finance role, so the `_owner_only` files are used: the approver role is one nobody holds and the owner may always approve), in Persetujuan.
30
+
31
+ ### Persetujuan pengeluaran
32
+
33
+ - What the owner gets: an outgoing payment above Rp 5.000.000, and a supplier bill above it that has no approved PO, wait for approval; incoming payments are not affected.
34
+ - Say it like this: "Mau aku pasangkan Persetujuan pengeluaran? Mulai dari berapa?"
35
+ - Files: `docs/presets/approvals/payment_payout.rk` and `docs/presets/approvals/vendor_bill_threshold.rk`. Read each with `rangka_skill_file`, replace the limit if the owner named another, and write it as a
36
+ change set to custom/payment.rk and custom/vendor_bill.rk (a copy of the file, named after its model). Each file starts with a plain-words header comment.
37
+ - After install, tell the owner who will see the request: the owner (this app has no finance role, so the `_owner_only` files are used: the approver role is one nobody holds and the owner may always approve), in Persetujuan.
38
+
39
+ ## Checks before you propose the change set
40
+
41
+ - `custom/<model>.rk` does not exist yet for that model (one preset per model; if it does, merge the `approvals:` entry into it).
42
+ - The approver role is not the role that normally submits that document: an approver who submits approves their own request.
43
+ - Run the site validation of the change set; do not apply it when it reports an error.
@@ -60,3 +60,10 @@ onboarding:
60
60
  - ask: {id: 'Apakah usaha kamu PKP (memungut PPN)?'}
61
61
  options: ['true', 'false']
62
62
  sets: tax.pkp
63
+ # Approval presets are opt-in (docs/presets/approvals/README.md): the answer 'ya' makes Raka copy the preset to custom/.
64
+ - ask: {id: 'Mau pasang Persetujuan PO di atas batas? Pesanan pembelian di atas Rp 5.000.000 menunggu persetujuan dulu.'}
65
+ options: ['ya', 'tidak']
66
+ sets: approvals.po_threshold
67
+ - ask: {id: 'Mau pasang Persetujuan pengeluaran? Pembayaran keluar dan tagihan pemasok di atas Rp 5.000.000 menunggu persetujuan dulu.'}
68
+ options: ['ya', 'tidak']
69
+ sets: approvals.spending
@@ -0,0 +1,43 @@
1
+ ---
2
+ name: rangka-app-ritel-cabang
3
+ description: "Rangka Ritel Cabang (app ritel_cabang): outlets, stock, purchasing and sales for a multi-outlet shop. Use when an owner asks for approval or a spending limit (\"PO besar harus aku setujui\", \"batasi pengeluaran staf\", \"diskon besar tanya aku dulu\") and during onboarding of this app, to offer the approval presets."
4
+ metadata: {rangka: {version: 1.0.0, app: ritel_cabang, requires: [rangka-compose, rangka-changesets]}}
5
+ ---
6
+
7
+ # Rangka approval presets for this app
8
+
9
+ Read `rangka-compose` first. This skill only covers the approval presets (issue rangka-apps#105). The engine is the
10
+ document approval of contract 0007: a submit that matches a policy is held (202), the approver sees it in Persetujuan
11
+ and the document proceeds when approved; a rejected one stays a draft.
12
+
13
+ ## Rules
14
+
15
+ - **Opt-in.** Never switch a preset on by default. Ask the owner (onboarding question) and only an answer `ya` installs it.
16
+ - **Roles only.** No per-person limits. The approver here is the owner (this app has no finance role, so the `_owner_only` files are used: the approver role is one nobody holds and the owner may always approve).
17
+ - **The limit is the owner's call.** The files use Rp 5.000.000 (purchasing, payouts) and 20% (discount) as examples.
18
+ Ask "mulai dari berapa?" and change the number in the `when:` expression of the copy, never in the preset file.
19
+ - Money or tax questions beyond a threshold are not part of a preset: say so and offer the nearest preset.
20
+
21
+ ## Presets for this app
22
+
23
+ ### Persetujuan PO di atas batas
24
+
25
+ - What the owner gets: a purchase order above Rp 5.000.000 (or in a foreign currency) waits for approval before it can be submitted; a smaller one goes straight through.
26
+ - Say it like this: "Mau aku pasangkan Persetujuan PO di atas batas? Mulai dari berapa?"
27
+ - Files: `docs/presets/approvals/purchase_order_threshold_owner_only.rk`. Read each with `rangka_skill_file`, replace the limit if the owner named another, and write it as a
28
+ change set to custom/purchase_order.rk (a copy of the file, named after its model). Each file starts with a plain-words header comment.
29
+ - After install, tell the owner who will see the request: the owner (this app has no finance role, so the `_owner_only` files are used: the approver role is one nobody holds and the owner may always approve), in Persetujuan.
30
+
31
+ ### Persetujuan pengeluaran
32
+
33
+ - What the owner gets: an outgoing payment above Rp 5.000.000, and a supplier bill above it that has no approved PO, wait for approval; incoming payments are not affected.
34
+ - Say it like this: "Mau aku pasangkan Persetujuan pengeluaran? Mulai dari berapa?"
35
+ - Files: `docs/presets/approvals/payment_payout.rk` and `docs/presets/approvals/vendor_bill_threshold.rk`. Read each with `rangka_skill_file`, replace the limit if the owner named another, and write it as a
36
+ change set to custom/payment.rk and custom/vendor_bill.rk (a copy of the file, named after its model). Each file starts with a plain-words header comment.
37
+ - After install, tell the owner who will see the request: the owner (this app has no finance role, so the `_owner_only` files are used: the approver role is one nobody holds and the owner may always approve), in Persetujuan.
38
+
39
+ ## Checks before you propose the change set
40
+
41
+ - `custom/<model>.rk` does not exist yet for that model (one preset per model; if it does, merge the `approvals:` entry into it).
42
+ - The approver role is not the role that normally submits that document: an approver who submits approves their own request.
43
+ - Run the site validation of the change set; do not apply it when it reports an error.
@@ -20,7 +20,7 @@ steps:
20
20
  set:
21
21
  computed_at: now()
22
22
  line_count: pl.size()
23
- revenue: "0 - pl.map(r, r.account.startsWith('411') ? r.amount : 0).sum()"
23
+ revenue: "0 - pl.map(r, r.account.startsWith('411') || r.account.startsWith('413') ? r.amount : 0).sum()"
24
24
  sales_returns: "pl.map(r, r.account.startsWith('412') ? r.amount : 0).sum()"
25
25
  other_income: "0 - pl.map(r, r.account.startsWith('49') ? r.amount : 0).sum()"
26
26
  cogs: "pl.map(r, r.account.startsWith('511') ? r.amount : 0).sum()"
@@ -20,7 +20,7 @@ steps:
20
20
  set:
21
21
  computed_at: now()
22
22
  line_count: pl.size()
23
- revenue: "0 - pl.map(r, r.account.startsWith('411') ? r.amount : 0).sum()"
23
+ revenue: "0 - pl.map(r, r.account.startsWith('411') || r.account.startsWith('413') ? r.amount : 0).sum()"
24
24
  sales_returns: "pl.map(r, r.account.startsWith('412') ? r.amount : 0).sum()"
25
25
  other_income: "0 - pl.map(r, r.account.startsWith('49') ? r.amount : 0).sum()"
26
26
  cogs: "pl.map(r, r.account.startsWith('511') ? r.amount : 0).sum()"
@@ -22,11 +22,11 @@ steps:
22
22
  outlet: "event.outlet"
23
23
  lock_date: "locks.size() > 0 ? locks[0].closed_until : null"
24
24
  - create: gl_entry
25
- if: "(0 - (event.grand_total - event.ppn_in_sales)) != 0"
25
+ if: "(0 - (event.net_before_charges - event.ppn_in_sales)) != 0"
26
26
  set:
27
27
  posting_date: "event.date"
28
28
  account: "'41100'"
29
- amount: "0 - (event.grand_total - event.ppn_in_sales)"
29
+ amount: "0 - (event.net_before_charges - event.ppn_in_sales)"
30
30
  voucher_type: event.model
31
31
  voucher: event.name
32
32
  entry: "'post'"
@@ -106,3 +106,39 @@ steps:
106
106
  outlet: "event.outlet"
107
107
  party: "event.member"
108
108
  lock_date: "locks.size() > 0 ? locks[0].closed_until : null"
109
+ - create: gl_entry
110
+ if: "(0 - event.service_charge) != 0"
111
+ set:
112
+ posting_date: "event.date"
113
+ account: "'41300'"
114
+ amount: "0 - event.service_charge"
115
+ voucher_type: event.model
116
+ voucher: event.name
117
+ entry: "'post'"
118
+ line: "'9'"
119
+ outlet: "event.outlet"
120
+ lock_date: "locks.size() > 0 ? locks[0].closed_until : null"
121
+ - create: gl_entry
122
+ if: "(0 - event.pbjt) != 0"
123
+ set:
124
+ posting_date: "event.date"
125
+ account: "'21330'"
126
+ amount: "0 - event.pbjt"
127
+ voucher_type: event.model
128
+ voucher: event.name
129
+ entry: "'post'"
130
+ line: "'10'"
131
+ outlet: "event.outlet"
132
+ lock_date: "locks.size() > 0 ? locks[0].closed_until : null"
133
+ - create: gl_entry
134
+ if: "(0 - event.rounding) != 0"
135
+ set:
136
+ posting_date: "event.date"
137
+ account: "'49400'"
138
+ amount: "0 - event.rounding"
139
+ voucher_type: event.model
140
+ voucher: event.name
141
+ entry: "'post'"
142
+ line: "'11'"
143
+ outlet: "event.outlet"
144
+ lock_date: "locks.size() > 0 ? locks[0].closed_until : null"
@@ -69,6 +69,7 @@ fields:
69
69
  - {value: '21300', label: {id: '2-1300 Utang PPh 23'}}
70
70
  - {value: '21310', label: {id: '2-1310 Utang PPh final'}}
71
71
  - {value: '21320', label: {id: '2-1320 Utang PPh 21'}}
72
+ - {value: '21330', label: {id: '2-1330 Utang pajak restoran (PBJT)'}}
72
73
  - {value: '21400', label: {id: '2-1400 Uang muka pelanggan'}}
73
74
  - {value: '21500', label: {id: '2-1500 Utang upah'}}
74
75
  - {value: '21510', label: {id: '2-1510 Utang reimburse karyawan'}}
@@ -79,9 +80,11 @@ fields:
79
80
  - {value: '31900', label: {id: '3-1900 Ekuitas saldo awal'}}
80
81
  - {value: '41100', label: {id: '4-1100 Pendapatan usaha'}}
81
82
  - {value: '41200', label: {id: '4-1200 Retur penjualan'}}
83
+ - {value: '41300', label: {id: '4-1300 Pendapatan service charge'}}
82
84
  - {value: '49100', label: {id: '4-9100 Pendapatan lain-lain'}}
83
85
  - {value: '49200', label: {id: '4-9200 Pendapatan denda dan ganti rugi sewa'}}
84
86
  - {value: '49300', label: {id: '4-9300 Laba (rugi) pelepasan aset tetap'}}
87
+ - {value: '49400', label: {id: '4-9400 Selisih pembulatan'}}
85
88
  - {value: '51100', label: {id: '5-1100 Harga pokok penjualan'}}
86
89
  - {value: '51200', label: {id: '5-1200 Selisih dan susut persediaan'}}
87
90
  - {value: '51300', label: {id: '5-1300 Upah langsung'}}
@@ -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: attendance
3
- version: 1.2.0
3
+ version: 1.3.0
4
4
  title: {id: Absen karyawan, en: Staff attendance}
5
5
  summary:
6
6
  id: Absen masuk dan pulang dari HP di outlet, dengan lokasi GPS dan selfie, terlambat dan lembur, rekap bulanan per karyawan.
@@ -9,9 +9,9 @@ category: people
9
9
  icon: time-line
10
10
  # Outlet staff attendance (rangka-apps#100). Field workers of projects keep their own attendance_log (module projects):
11
11
  # project billing and work sites differ, so the two are not merged.
12
- requires: {rangka: '>=0.5', users: ^1.5, outlets: ^1.6}
13
- # shifts: a clock-in follows the employee's published shift of the day (staff_attendance.work_shift)
14
- optional: {shifts: ^1.0}
12
+ # shifts: a clock-in follows the employee's published shift of the day (staff_attendance.work_shift) and the clock screen
13
+ # shows it (clock.shift). A module screen may only read models of its requires, so shifts is required, not optional.
14
+ requires: {rangka: '>=0.5', users: ^1.5, outlets: ^1.6, shifts: ^1.0}
15
15
  notices:
16
16
  - name: attendance_missing
17
17
  label: {id: Belum absen masuk, en: Not clocked in yet}
@@ -18,5 +18,8 @@ clock:
18
18
  in: {field: clock_in, location: in_pos, photo: in_photo}
19
19
  out: {field: clock_out, location: out_pos, photo: out_photo}
20
20
  site: {model: outlet, link: outlet, filter: "active && (name in user.outlets || (user.outlets.size() == 0 && ('head_office' in user.roles || 'owner' in user.roles)))", title: outlet_name, location: point, radius_m: radius_m}
21
+ # The published shift of today: shown above the buttons and linked to the log at clock-in. Lateness is the record's
22
+ # compute (shift first, then the outlet's hours); a failed or empty shift read never blocks a clock-in.
23
+ shift: {model: shift_assignment, filter: "employee == user.name && published && !day_off && work_date == today()", start: start_at, end: end_at, title: shift_name, outlet: outlet, link: work_shift}
21
24
  reason: reason
22
25
  submit: true
@@ -0,0 +1,44 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
2
+ # "Kirim ke dapur" on an open table bill (rangka-apps#122, contract 0048 Open 3). The counter sets send_kitchen on the draft;
3
+ # this flow runs inside that write, as the cashier: one ticket per active station with the routed lines the kitchen was
4
+ # not sent yet (line_key not in sent_to_kitchen), then it records them and clears send_kitchen. A line the cashier
5
+ # removed after it was sent makes a ticket line "BATAL: <menu>" at its station, so the kitchen stops cooking it. Lines
6
+ # without a line_key are never sent from here (the payment flow handles them). At payment flow kitchen_ticket_on_sale
7
+ # skips every recorded line, so each line reaches the kitchen once. A change of quantity of a sent line is not tracked in v1:
8
+ # remove the line and add it again. An amended copy (a receipt paid again) never sends from here: its tickets come
9
+ # from kitchen_ticket_on_sale, which knows what the voided receipt's kitchen already served.
10
+ name: kitchen_ticket_on_draft
11
+ label: {id: 'Kirim pesanan meja ke dapur sebelum dibayar'}
12
+ description: {id: 'Barang baru di tagihan meja dikirim ke stasiun dapur; barang yang dihapus setelah terkirim dikirim sebagai BATAL'}
13
+ on: pos_sale.updated
14
+ if: "event.docstatus == 0 && event.table != '' && event.send_kitchen && !event.merged && (!has(event.amended_from) || event.amended_from == '')"
15
+ steps:
16
+ - {find: pos_sale, where: "name == event.name", as: src}
17
+ - {find: dining_table, where: "name == event.table", as: tbl}
18
+ - {find_all: kitchen_station, where: outlet == event.outlet && active, as: stations}
19
+ - {find_all: kitchen_route, where: outlet == event.outlet, as: routes}
20
+ - for_each: stations
21
+ as: st
22
+ do:
23
+ - if: "event.items.filter(l, l.line_key != '' && !(l.line_key in event.sent_to_kitchen.map(s, s.key)) && routes.filter(r, r.station == st.name && r.category == l.category).size() > 0).size() > 0"
24
+ create: kitchen_ticket
25
+ set:
26
+ sale: event.name
27
+ outlet: event.outlet
28
+ station: st.name
29
+ date: event.date
30
+ buyer: tbl.table_name
31
+ items: "event.items.filter(l, l.line_key != '' && !(l.line_key in event.sent_to_kitchen.map(s, s.key)) && routes.filter(r, r.station == st.name && r.category == l.category).size() > 0).map(l, {'item': l.item, 'description': l.description, 'qty': l.qty, 'uom': l.uom, 'note': l.note})"
32
+ - if: "event.sent_to_kitchen.filter(s, !(s.key in event.items.map(l, l.line_key)) && routes.filter(r, r.station == st.name && r.category == s.category).size() > 0).size() > 0"
33
+ create: kitchen_ticket
34
+ set:
35
+ sale: event.name
36
+ outlet: event.outlet
37
+ station: st.name
38
+ date: event.date
39
+ buyer: tbl.table_name
40
+ items: "event.sent_to_kitchen.filter(s, !(s.key in event.items.map(l, l.line_key)) && routes.filter(r, r.station == st.name && r.category == s.category).size() > 0).map(s, {'item': s.item, 'description': 'BATAL: ' + s.description, 'qty': s.qty, 'uom': s.uom, 'note': s.note})"
41
+ - update: src
42
+ set:
43
+ sent_to_kitchen: "event.sent_to_kitchen.filter(s, s.key in event.items.map(l, l.line_key)) + event.items.filter(l, l.line_key != '' && !(l.line_key in event.sent_to_kitchen.map(s, s.key))).map(l, {'key': l.line_key, 'item': l.item, 'packing': l.packing, 'description': l.description, 'qty': l.qty, 'uom': l.uom, 'note': l.note, 'category': l.category})"
44
+ send_kitchen: "false"
@@ -2,7 +2,8 @@
2
2
  # Runs inside a receipt's payment (pos_sale submitted), as the cashier: one ticket per active station of the outlet
3
3
  # with the receipt's lines whose item category (pos_sale_item.category, kept on the line) is routed to that station
4
4
  # (kitchen_route). An outlet without stations (a shop) and a receipt without kitchen lines make nothing. A failure here
5
- # rolls the payment back, so a paid receipt never misses its tickets.
5
+ # rolls the payment back, so a paid receipt never misses its tickets. Lines the kitchen already got from the open bill
6
+ # (sent_to_kitchen, flow kitchen_ticket_on_draft, rangka-apps#122) are skipped here, so no line is cooked twice.
6
7
  # A receipt paid again after a void (amend) is a revision: what the voided receipt's picked-up tickets of that station
7
8
  # already sent out is not cooked again. The served quantity of an item is spread over the revision's lines of that item
8
9
  # in their order (line idx), so two lines of one item never both count the same served portion. The rest goes to the kitchen as Baru, and the part already served is kept as a
@@ -23,7 +24,7 @@ steps:
23
24
  - for_each: stations
24
25
  as: st
25
26
  do:
26
- - if: "event.items.filter(l, routes.filter(r, r.station == st.name && r.category == l.category).size() > 0 && l.qty - max(0, min(l.qty, served.filter(t, t.station == st.name).map(t, t.served.map(x, x.item == l.item ? x.qty : 0).sum()).sum() - event.items.filter(y, y.item == l.item && y.idx < l.idx).map(y, y.qty).sum())) > 0).size() > 0"
27
+ - if: "event.items.filter(l, !(l.line_key in event.sent_to_kitchen.map(s, s.key)) && routes.filter(r, r.station == st.name && r.category == l.category).size() > 0 && l.qty - max(0, min(l.qty, served.filter(t, t.station == st.name).map(t, t.served.map(x, x.item == l.item ? x.qty : 0).sum()).sum() - event.items.filter(y, y.item == l.item && y.idx < l.idx).map(y, y.qty).sum())) > 0).size() > 0"
27
28
  create: kitchen_ticket
28
29
  set:
29
30
  sale: event.name
@@ -32,8 +33,8 @@ steps:
32
33
  date: event.date
33
34
  buyer: event.buyer
34
35
  revision_of: event.amended_from
35
- items: "event.items.filter(l, routes.filter(r, r.station == st.name && r.category == l.category).size() > 0 && l.qty - max(0, min(l.qty, served.filter(t, t.station == st.name).map(t, t.served.map(x, x.item == l.item ? x.qty : 0).sum()).sum() - event.items.filter(y, y.item == l.item && y.idx < l.idx).map(y, y.qty).sum())) > 0).map(l, {'item': l.item, 'description': l.description, 'qty': l.qty - max(0, min(l.qty, served.filter(t, t.station == st.name).map(t, t.served.map(x, x.item == l.item ? x.qty : 0).sum()).sum() - event.items.filter(y, y.item == l.item && y.idx < l.idx).map(y, y.qty).sum())), 'uom': l.uom, 'note': l.note})"
36
- - if: "event.items.filter(l, routes.filter(r, r.station == st.name && r.category == l.category).size() > 0 && max(0, min(l.qty, served.filter(t, t.station == st.name).map(t, t.served.map(x, x.item == l.item ? x.qty : 0).sum()).sum() - event.items.filter(y, y.item == l.item && y.idx < l.idx).map(y, y.qty).sum())) > 0).size() > 0"
36
+ items: "event.items.filter(l, !(l.line_key in event.sent_to_kitchen.map(s, s.key)) && routes.filter(r, r.station == st.name && r.category == l.category).size() > 0 && l.qty - max(0, min(l.qty, served.filter(t, t.station == st.name).map(t, t.served.map(x, x.item == l.item ? x.qty : 0).sum()).sum() - event.items.filter(y, y.item == l.item && y.idx < l.idx).map(y, y.qty).sum())) > 0).map(l, {'item': l.item, 'description': l.description, 'qty': l.qty - max(0, min(l.qty, served.filter(t, t.station == st.name).map(t, t.served.map(x, x.item == l.item ? x.qty : 0).sum()).sum() - event.items.filter(y, y.item == l.item && y.idx < l.idx).map(y, y.qty).sum())), 'uom': l.uom, 'note': l.note})"
37
+ - if: "event.items.filter(l, !(l.line_key in event.sent_to_kitchen.map(s, s.key)) && routes.filter(r, r.station == st.name && r.category == l.category).size() > 0 && max(0, min(l.qty, served.filter(t, t.station == st.name).map(t, t.served.map(x, x.item == l.item ? x.qty : 0).sum()).sum() - event.items.filter(y, y.item == l.item && y.idx < l.idx).map(y, y.qty).sum())) > 0).size() > 0"
37
38
  create: kitchen_ticket
38
39
  set:
39
40
  sale: event.name
@@ -44,4 +45,4 @@ steps:
44
45
  revision_of: event.amended_from
45
46
  status: "'picked_up'"
46
47
  picked_up_at: now()
47
- items: "event.items.filter(l, routes.filter(r, r.station == st.name && r.category == l.category).size() > 0 && max(0, min(l.qty, served.filter(t, t.station == st.name).map(t, t.served.map(x, x.item == l.item ? x.qty : 0).sum()).sum() - event.items.filter(y, y.item == l.item && y.idx < l.idx).map(y, y.qty).sum())) > 0).map(l, {'item': l.item, 'description': l.description, 'qty': max(0, min(l.qty, served.filter(t, t.station == st.name).map(t, t.served.map(x, x.item == l.item ? x.qty : 0).sum()).sum() - event.items.filter(y, y.item == l.item && y.idx < l.idx).map(y, y.qty).sum())), 'uom': l.uom, 'note': l.note})"
48
+ items: "event.items.filter(l, !(l.line_key in event.sent_to_kitchen.map(s, s.key)) && routes.filter(r, r.station == st.name && r.category == l.category).size() > 0 && max(0, min(l.qty, served.filter(t, t.station == st.name).map(t, t.served.map(x, x.item == l.item ? x.qty : 0).sum()).sum() - event.items.filter(y, y.item == l.item && y.idx < l.idx).map(y, y.qty).sum())) > 0).map(l, {'item': l.item, 'description': l.description, 'qty': max(0, min(l.qty, served.filter(t, t.station == st.name).map(t, t.served.map(x, x.item == l.item ? x.qty : 0).sum()).sum() - event.items.filter(y, y.item == l.item && y.idx < l.idx).map(y, y.qty).sum())), 'uom': l.uom, 'note': l.note})"
@@ -7,8 +7,9 @@
7
7
  # up a tier as soon as its spend this year (or last year) reaches a higher active tier, never down here (loyalty_yearly).
8
8
  # A device's replay pins the sale's computed fields and turns its rules into exceptions (contract 0058 §10), so the
9
9
  # flow checks again from the member's own figures: points and deposit only with a member, the deposit never above the
10
- # total, the points' value and cap recomputed (audit #102 F4). Every run writes a member_spend row first, so a run
11
- # started by hand (no ledger rows, contract 0026) is refused as a whole (audit #102 F1).
10
+ # total, the points' value and cap recomputed (audit #102 F4). Spend counts the sale before service charge, PBJT and
11
+ # rounding (rangka-apps#121 audit F6): PBJT is the region's money, not the member's spend. Every run writes a
12
+ # member_spend row first, so a run started by hand (no ledger rows, contract 0026) is refused as a whole (audit #102 F1).
12
13
  name: loyalty_on_sale
13
14
  label: {id: 'Transaksi kasir dibayar: poin dan deposit member'}
14
15
  on: pos_sale.submitted
@@ -43,7 +44,7 @@ steps:
43
44
  set:
44
45
  account: a.name
45
46
  sale: event.name
46
- amount: event.grand_total
47
+ amount: (event.grand_total - event.service_charge - event.pbjt - event.rounding)
47
48
  date: event.date
48
49
  outlet: event.outlet
49
50
  entry: "'post'"
@@ -92,7 +93,7 @@ steps:
92
93
  - find: member_tier
93
94
  where: name == a.tier
94
95
  as: cur
95
- - for_each: "tiers.filter(t, t.min_spend <= max(a.spend_this_year + event.grand_total, a.spend_last_year)).size() > 0 && (cur == null || tiers.filter(t, t.min_spend <= max(a.spend_this_year + event.grand_total, a.spend_last_year))[0].min_spend > cur.min_spend) ? [tiers.filter(t, t.min_spend <= max(a.spend_this_year + event.grand_total, a.spend_last_year))[0]] : []"
96
+ - for_each: "tiers.filter(t, t.min_spend <= max(a.spend_this_year + (event.grand_total - event.service_charge - event.pbjt - event.rounding), a.spend_last_year)).size() > 0 && (cur == null || tiers.filter(t, t.min_spend <= max(a.spend_this_year + (event.grand_total - event.service_charge - event.pbjt - event.rounding), a.spend_last_year))[0].min_spend > cur.min_spend) ? [tiers.filter(t, t.min_spend <= max(a.spend_this_year + (event.grand_total - event.service_charge - event.pbjt - event.rounding), a.spend_last_year))[0]] : []"
96
97
  as: up
97
98
  do:
98
99
  - update: a
@@ -109,5 +110,5 @@ steps:
109
110
  set:
110
111
  points_balance: a.points_balance - event.points_redeemed + event.points_earned
111
112
  deposit_balance: a.deposit_balance - event.deposit_used
112
- spend_this_year: a.spend_this_year + event.grand_total
113
+ spend_this_year: a.spend_this_year + (event.grand_total - event.service_charge - event.pbjt - event.rounding)
113
114
  last_activity: event.date
@@ -25,7 +25,7 @@ steps:
25
25
  set:
26
26
  account: a.name
27
27
  sale: event.name
28
- amount: 0 - event.grand_total
28
+ amount: 0 - (event.grand_total - event.service_charge - event.pbjt - event.rounding)
29
29
  date: today()
30
30
  outlet: event.outlet
31
31
  entry: "'reverse'"
@@ -59,4 +59,4 @@ steps:
59
59
  set:
60
60
  points_balance: a.points_balance - pe.map(e, e.points).sum()
61
61
  deposit_balance: a.deposit_balance - de.map(e, e.amount).sum()
62
- spend_this_year: a.spend_this_year - event.grand_total
62
+ spend_this_year: a.spend_this_year - (event.grand_total - event.service_charge - event.pbjt - event.rounding)