@rangka-os/create 0.5.0-alpha.27 → 0.5.0-alpha.29

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 (220) hide show
  1. package/package.json +1 -1
  2. package/template/base/apps/absen_karyawan/app.rk +37 -0
  3. package/template/base/apps/absen_karyawan/dashboards/absen_hari_ini.rk +20 -0
  4. package/template/base/apps/absen_karyawan/dashboards/absen_karyawan_saya.rk +14 -0
  5. package/template/base/apps/absen_karyawan/dashboards/rekap_absen_karyawan.rk +12 -0
  6. package/template/base/apps/jasa_proyek/app.rk +4 -1
  7. package/template/base/apps/kasir/app.rk +5 -1
  8. package/template/base/apps/kasir/dashboards/kasir_ringkas.rk +4 -0
  9. package/template/base/apps/kasir/skills/rangka-app-kasir/SKILL.md +20 -0
  10. package/template/base/apps/pembukuan/app.rk +3 -0
  11. package/template/base/connectors/midtrans/connector.rk +249 -0
  12. package/template/base/connectors/midtrans/fixtures/charge_gopay.json +34 -0
  13. package/template/base/connectors/midtrans/fixtures/charge_qris.json +23 -0
  14. package/template/base/connectors/midtrans/fixtures/charge_va.json +20 -0
  15. package/template/base/connectors/midtrans/fixtures/create_snap.json +4 -0
  16. package/template/base/connectors/midtrans/fixtures/expect.json +88 -0
  17. package/template/base/connectors/midtrans/fixtures/get_status.json +15 -0
  18. package/template/base/connectors/midtrans/fixtures/payment_notified.json +28 -0
  19. package/template/base/connectors/midtrans/fixtures/payment_notified_challenge.json +24 -0
  20. package/template/base/connectors/midtrans/fixtures/payment_notified_expire.json +24 -0
  21. package/template/base/connectors/midtrans/fixtures/payment_notified_other_amount.json +28 -0
  22. package/template/base/connectors/midtrans/fixtures/payment_notified_partial_refund.json +34 -0
  23. package/template/base/connectors/midtrans/fixtures/payment_notified_pending.json +31 -0
  24. package/template/base/connectors/midtrans/fixtures/payment_notified_refund.json +34 -0
  25. package/template/base/connectors/midtrans/fixtures/payment_notified_relabelled.json +28 -0
  26. package/template/base/connectors/midtrans/fixtures/payment_notified_va.json +32 -0
  27. package/template/base/connectors/midtrans/fixtures/signature_vector.txt +3 -0
  28. package/template/base/connectors/midtrans/mock/midtrans_mock.py +335 -0
  29. package/template/base/connectors/rangka_whatsapp/README.md +105 -0
  30. package/template/base/connectors/rangka_whatsapp/connector.rk +141 -0
  31. package/template/base/connectors/rangka_whatsapp/fixtures/expect.json +9 -0
  32. package/template/base/connectors/rangka_whatsapp/fixtures/message_received.json +1 -0
  33. package/template/base/connectors/rangka_whatsapp/fixtures/message_status.json +1 -0
  34. package/template/base/connectors/rangka_whatsapp/fixtures/message_status_refused.json +1 -0
  35. package/template/base/connectors/rangka_whatsapp/fixtures/opted_out.json +1 -0
  36. package/template/base/connectors/rangka_whatsapp/fixtures/send_template.json +1 -0
  37. package/template/base/connectors/rangka_whatsapp/fixtures/send_template_duplicate.json +1 -0
  38. package/template/base/connectors/rangka_whatsapp/fixtures/set_opt_out.json +1 -0
  39. package/template/base/connectors/rangka_whatsapp/mock/rangka_whatsapp_mock.py +354 -0
  40. package/template/base/connectors/shopee/connector.rk +360 -0
  41. package/template/base/connectors/shopee/fixtures/expect.json +119 -0
  42. package/template/base/connectors/shopee/fixtures/get_models.json +52 -0
  43. package/template/base/connectors/shopee/fixtures/get_order_detail.json +396 -0
  44. package/template/base/connectors/shopee/fixtures/get_settlement.json +90 -0
  45. package/template/base/connectors/shopee/fixtures/get_tracking.json +13 -0
  46. package/template/base/connectors/shopee/fixtures/list_items.json +29 -0
  47. package/template/base/connectors/shopee/fixtures/list_orders.json +31 -0
  48. package/template/base/connectors/shopee/fixtures/list_settlements.json +15 -0
  49. package/template/base/connectors/shopee/fixtures/order_changed.json +101 -0
  50. package/template/base/connectors/shopee/fixtures/order_changed_cancelled.json +72 -0
  51. package/template/base/connectors/shopee/fixtures/order_changed_completed.json +101 -0
  52. package/template/base/connectors/shopee/fixtures/order_changed_in_cancel.json +72 -0
  53. package/template/base/connectors/shopee/fixtures/order_changed_unpaid.json +71 -0
  54. package/template/base/connectors/shopee/fixtures/order_settled.json +92 -0
  55. package/template/base/connectors/shopee/fixtures/push_received.json +12 -0
  56. package/template/base/connectors/shopee/fixtures/push_received_tracking.json +11 -0
  57. package/template/base/connectors/shopee/fixtures/update_stock.json +15 -0
  58. package/template/base/connectors/shopee/mock/shopee_mock.py +894 -0
  59. package/template/base/connectors/tiktok_shop/connector.rk +300 -0
  60. package/template/base/connectors/tiktok_shop/fixtures/expect.json +105 -0
  61. package/template/base/connectors/tiktok_shop/fixtures/get_order_detail.json +136 -0
  62. package/template/base/connectors/tiktok_shop/fixtures/get_settlement.json +83 -0
  63. package/template/base/connectors/tiktok_shop/fixtures/get_tracking.json +28 -0
  64. package/template/base/connectors/tiktok_shop/fixtures/list_orders.json +242 -0
  65. package/template/base/connectors/tiktok_shop/fixtures/list_products.json +77 -0
  66. package/template/base/connectors/tiktok_shop/fixtures/list_settlements.json +22 -0
  67. package/template/base/connectors/tiktok_shop/fixtures/list_shops.json +17 -0
  68. package/template/base/connectors/tiktok_shop/fixtures/order_changed.json +129 -0
  69. package/template/base/connectors/tiktok_shop/fixtures/order_changed_cancelled.json +81 -0
  70. package/template/base/connectors/tiktok_shop/fixtures/order_changed_completed.json +106 -0
  71. package/template/base/connectors/tiktok_shop/fixtures/order_changed_on_hold.json +104 -0
  72. package/template/base/connectors/tiktok_shop/fixtures/order_changed_tokopedia.json +106 -0
  73. package/template/base/connectors/tiktok_shop/fixtures/order_changed_unpaid.json +79 -0
  74. package/template/base/connectors/tiktok_shop/fixtures/order_settled.json +73 -0
  75. package/template/base/connectors/tiktok_shop/fixtures/update_stock.json +6 -0
  76. package/template/base/connectors/tiktok_shop/fixtures/webhook_received.json +12 -0
  77. package/template/base/connectors/tiktok_shop/fixtures/webhook_received_cancellation.json +13 -0
  78. package/template/base/connectors/tiktok_shop/mock/tiktok_shop_mock.py +819 -0
  79. package/template/base/connectors/whatsapp_business/connector.rk +3 -1
  80. package/template/base/connectors/whatsapp_business/templates.md +13 -1
  81. package/template/base/modules/accounting/flows/gl_asset_disposal_post.rk +68 -0
  82. package/template/base/modules/accounting/flows/gl_asset_disposal_reverse.rk +194 -0
  83. package/template/base/modules/accounting/flows/gl_depreciation_run_post.rk +43 -0
  84. package/template/base/modules/accounting/flows/gl_depreciation_run_reverse.rk +36 -0
  85. package/template/base/modules/accounting/flows/gl_fixed_asset_post.rk +51 -0
  86. package/template/base/modules/accounting/flows/gl_fixed_asset_reverse.rk +194 -0
  87. package/template/base/modules/accounting/flows/gl_vendor_bill_post.rk +2 -2
  88. package/template/base/modules/accounting/models/gl_entry.rk +2 -0
  89. package/template/base/modules/accounting/module.rk +2 -2
  90. package/template/base/modules/attendance/flows/attendance_missing_digest.rk +30 -0
  91. package/template/base/modules/attendance/flows/attendance_period_on_cancel.rk +15 -0
  92. package/template/base/modules/attendance/flows/attendance_period_on_submit.rk +60 -0
  93. package/template/base/modules/attendance/flows/staff_attendance_cancel_guard.rk +14 -0
  94. package/template/base/modules/attendance/flows/staff_attendance_guard_created.rk +16 -0
  95. package/template/base/modules/attendance/flows/staff_attendance_guard_submitted.rk +37 -0
  96. package/template/base/modules/attendance/flows/staff_attendance_guard_updated.rk +14 -0
  97. package/template/base/modules/attendance/models/attendance_period.rk +62 -0
  98. package/template/base/modules/attendance/models/attendance_summary.rk +37 -0
  99. package/template/base/modules/attendance/models/staff_attendance.rk +281 -0
  100. package/template/base/modules/attendance/models/staff_attendance_guard.rk +50 -0
  101. package/template/base/modules/attendance/module.rk +18 -0
  102. package/template/base/modules/attendance/screens/absen_outlet.rk +22 -0
  103. package/template/base/modules/catalogue/models/item.rk +69 -0
  104. package/template/base/modules/catalogue/module.rk +1 -1
  105. package/template/base/modules/contacts/models/customer.rk +43 -19
  106. package/template/base/modules/contacts/module.rk +1 -1
  107. package/template/base/modules/coretax/module.rk +1 -1
  108. package/template/base/modules/coretax/print/coretax_faktur.rk +3 -2
  109. package/template/base/modules/coretax/print/coretax_faktur.xml +3 -1
  110. package/template/base/modules/coretax/print/rekap_ppn.html +9 -7
  111. package/template/base/modules/courses/flows/charge_invoice_on_submit.rk +15 -0
  112. package/template/base/modules/courses/module.rk +1 -1
  113. package/template/base/modules/courses/screens/absen_kelas.rk +1 -0
  114. package/template/base/modules/fixed_assets/flows/asset_disposal_on_cancel.rk +14 -0
  115. package/template/base/modules/fixed_assets/flows/asset_disposal_on_submit.rk +21 -0
  116. package/template/base/modules/fixed_assets/flows/asset_from_vendor_bill.rk +41 -0
  117. package/template/base/modules/fixed_assets/flows/depreciation_run_fill.rk +28 -0
  118. package/template/base/modules/fixed_assets/flows/depreciation_run_monthly.rk +36 -0
  119. package/template/base/modules/fixed_assets/flows/depreciation_run_on_cancel.rk +30 -0
  120. package/template/base/modules/fixed_assets/flows/depreciation_run_on_submit.rk +34 -0
  121. package/template/base/modules/fixed_assets/flows/fixed_asset_on_cancel.rk +24 -0
  122. package/template/base/modules/fixed_assets/flows/fixed_asset_on_submit.rk +69 -0
  123. package/template/base/modules/fixed_assets/flows/fixed_assets_setup.rk +29 -0
  124. package/template/base/modules/fixed_assets/flows/opening_balance_asset_guard.rk +15 -0
  125. package/template/base/modules/fixed_assets/flows/vendor_bill_asset_guard.rk +14 -0
  126. package/template/base/modules/fixed_assets/imports/asset_list.rk +22 -0
  127. package/template/base/modules/fixed_assets/models/asset_bill_line.rk +24 -0
  128. package/template/base/modules/fixed_assets/models/asset_book.rk +83 -0
  129. package/template/base/modules/fixed_assets/models/asset_category.rk +54 -0
  130. package/template/base/modules/fixed_assets/models/asset_disposal.rk +97 -0
  131. package/template/base/modules/fixed_assets/models/asset_guard.rk +90 -0
  132. package/template/base/modules/fixed_assets/models/depreciation_line.rk +13 -0
  133. package/template/base/modules/fixed_assets/models/depreciation_run.rk +65 -0
  134. package/template/base/modules/fixed_assets/models/fixed_asset.rk +165 -0
  135. package/template/base/modules/fixed_assets/models/fixed_asset_setting.rk +34 -0
  136. package/template/base/modules/fixed_assets/module.rk +30 -0
  137. package/template/base/modules/fixed_assets/print/fixed_asset_register.html +45 -0
  138. package/template/base/modules/fixed_assets/print/fixed_asset_register.rk +17 -0
  139. package/template/base/modules/invoicing/flows/invoice_due_digest.rk +45 -7
  140. package/template/base/modules/invoicing/models/sales_invoice_item.rk +4 -1
  141. package/template/base/modules/invoicing/module.rk +15 -2
  142. package/template/base/modules/kitchen/screens/dapur.rk +1 -0
  143. package/template/base/modules/outlets/models/outlet.rk +69 -0
  144. package/template/base/modules/outlets/module.rk +1 -1
  145. package/template/base/modules/payments/flows/payment_from_midtrans.rk +85 -0
  146. package/template/base/modules/payments/flows/payment_refund_from_midtrans.rk +22 -0
  147. package/template/base/modules/payments/models/payment.rk +2 -1
  148. package/template/base/modules/payments/module.rk +1 -1
  149. package/template/base/modules/payroll/flows/payroll_close_on_cancel.rk +8 -5
  150. package/template/base/modules/payroll/flows/payroll_close_on_submit.rk +8 -5
  151. package/template/base/modules/payroll/flows/payroll_reminder.rk +106 -0
  152. package/template/base/modules/payroll/flows/payroll_run_overlap_guard_created.rk +5 -3
  153. package/template/base/modules/payroll/flows/payroll_run_overlap_guard_updated.rk +5 -3
  154. package/template/base/modules/payroll/flows/payslip_from_recap.rk +1 -1
  155. package/template/base/modules/payroll/imports/payroll_profile_list.rk +27 -0
  156. package/template/base/modules/payroll/models/payroll_close.rk +10 -6
  157. package/template/base/modules/payroll/models/payroll_run.rk +64 -15
  158. package/template/base/modules/payroll/models/payslip.rk +48 -9
  159. package/template/base/modules/payroll/module.rk +22 -5
  160. package/template/base/modules/payroll/print/payslip.html +4 -1
  161. package/template/base/modules/pos/models/pos_sale.rk +136 -9
  162. package/template/base/modules/pos/models/pos_sale_item.rk +33 -1
  163. package/template/base/modules/pos/module.rk +5 -3
  164. package/template/base/modules/pos/print/pos_receipt.html +7 -3
  165. package/template/base/modules/pos/screens/kasir.rk +7 -2
  166. package/template/base/modules/procurement/flows/reorder_draft_po.rk +57 -0
  167. package/template/base/modules/procurement/models/vendor_bill.rk +21 -2
  168. package/template/base/modules/procurement/module.rk +11 -2
  169. package/template/base/modules/projects/screens/absen.rk +1 -0
  170. package/template/base/modules/promotions/flows/promo_code_batch_on_submit.rk +26 -0
  171. package/template/base/modules/promotions/flows/promotion_apply.rk +110 -0
  172. package/template/base/modules/promotions/flows/promotion_apply_on_create.rk +110 -0
  173. package/template/base/modules/promotions/flows/promotion_apply_on_delete.rk +111 -0
  174. package/template/base/modules/promotions/flows/promotion_apply_on_update.rk +110 -0
  175. package/template/base/modules/promotions/flows/promotion_on_sale.rk +95 -0
  176. package/template/base/modules/promotions/flows/promotion_on_sale_cancel.rk +43 -0
  177. package/template/base/modules/promotions/models/promo_code.rk +27 -0
  178. package/template/base/modules/promotions/models/promo_code_batch.rk +36 -0
  179. package/template/base/modules/promotions/models/promo_guard.rk +44 -0
  180. package/template/base/modules/promotions/models/promotion.rk +197 -0
  181. package/template/base/modules/promotions/models/promotion_ledger.rk +35 -0
  182. package/template/base/modules/promotions/module.rk +20 -0
  183. package/template/base/modules/rental/models/rental_unit.rk +13 -3
  184. package/template/base/modules/rental/module.rk +2 -2
  185. package/template/base/modules/rental/screens/alat_keluar.rk +1 -0
  186. package/template/base/modules/rental/screens/alat_kembali.rk +1 -0
  187. package/template/base/modules/rental/screens/jadwal_alat.rk +1 -0
  188. package/template/base/modules/stock/flows/stock_low_alert.rk +65 -0
  189. package/template/base/modules/stock/flows/stock_negative_alert.rk +14 -5
  190. package/template/base/modules/stock/models/stock_reorder.rk +34 -0
  191. package/template/base/modules/stock/module.rk +17 -2
  192. package/template/base/modules/subscriptions/screens/catat_tagih.rk +1 -0
  193. package/template/base/modules/subscriptions/screens/rute_tagih.rk +1 -0
  194. package/template/base/modules/users/flows/summary_daily.rk +83 -0
  195. package/template/base/modules/users/flows/summary_monthly.rk +83 -0
  196. package/template/base/modules/users/flows/summary_weekly.rk +83 -0
  197. package/template/base/modules/users/models/business_summary.rk +67 -0
  198. package/template/base/modules/users/models/summary_setting.rk +35 -0
  199. package/template/base/modules/users/models/user.rk +11 -3
  200. package/template/base/modules/users/module.rk +21 -2
  201. package/template/base/modules/users/roles/employee.rk +8 -0
  202. package/template/base/modules/users/roles/outlet_supervisor.rk +7 -0
  203. package/template/base/modules/whatsapp/flows/whatsapp_customer_opt_out.rk +16 -0
  204. package/template/base/modules/whatsapp/flows/whatsapp_customer_opt_out_new.rk +17 -0
  205. package/template/base/modules/whatsapp/flows/whatsapp_message_status.rk +24 -0
  206. package/template/base/modules/whatsapp/flows/whatsapp_opted_out.rk +26 -0
  207. package/template/base/modules/whatsapp/models/whatsapp_message.rk +99 -0
  208. package/template/base/modules/whatsapp/models/whatsapp_opt_out.rk +44 -0
  209. package/template/base/modules/whatsapp/module.rk +23 -0
  210. package/template/base/modules/whatsapp_booking/flows/whatsapp_booking_tomorrow.rk +48 -0
  211. package/template/base/modules/whatsapp_booking/module.rk +13 -0
  212. package/template/base/modules/whatsapp_order_ready/flows/whatsapp_pickup_on_sale.rk +19 -0
  213. package/template/base/modules/whatsapp_order_ready/flows/whatsapp_ticket_ready.rk +40 -0
  214. package/template/base/modules/whatsapp_order_ready/models/whatsapp_pickup.rk +22 -0
  215. package/template/base/modules/whatsapp_order_ready/module.rk +14 -0
  216. package/template/base/modules/whatsapp_receipt/flows/whatsapp_receipt_on_sale.rk +43 -0
  217. package/template/base/modules/whatsapp_receipt/module.rk +13 -0
  218. package/template/base/modules/whatsapp_reminder/flows/whatsapp_invoice_overdue.rk +64 -0
  219. package/template/base/modules/whatsapp_reminder/module.rk +15 -0
  220. package/template/base/modules/workforce/imports/worker_list.rk +4 -1
@@ -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: payments
3
- version: 1.5.0
3
+ version: 1.6.0
4
4
  title: {id: Pembayaran, en: Payments}
5
5
  summary:
6
6
  id: Catat pembayaran masuk dan keluar, termasuk bukti potong PPh 23.
@@ -2,21 +2,24 @@
2
2
  name: payroll_close_on_cancel
3
3
  label: {id: Tutup periode gaji dibatalkan}
4
4
  # Refused while the client invoice of this close is submitted (cancel that invoice first); otherwise the run is open
5
- # again and the project ledger row is reversed. A draft invoice is left for the owner to delete.
5
+ # again and the project ledger row is reversed. A draft invoice is left for the owner to delete. An internal run has
6
+ # neither, so only the run is reopened. `!= 'internal'`: a close submitted before payroll 2.0 is a client close.
6
7
  on: payroll_close.cancelled
7
8
  steps:
8
- - find: sales_invoice
9
+ - if: event.run_kind != 'internal' && app_installed('invoicing')
10
+ find: sales_invoice
9
11
  where: project == event.project && docstatus == 1 && notes.contains('(' + event.name + ')')
10
12
  as: inv
11
- - if: inv != null
13
+ - if: event.run_kind != 'internal' && app_installed('invoicing') && inv != null
12
14
  create: payroll_guard
13
15
  set:
14
16
  reason: "'invoice_submitted'"
15
17
  document: inv.name
16
- - find: project_ledger
18
+ - if: event.run_kind != 'internal' && app_installed('projects')
19
+ find: project_ledger
17
20
  where: source_name == event.name && kind == 'payroll' && entry == 'post'
18
21
  as: orig
19
- - if: orig != null
22
+ - if: event.run_kind != 'internal' && app_installed('projects') && orig != null
20
23
  create: project_ledger
21
24
  set:
22
25
  project: event.project
@@ -2,6 +2,9 @@
2
2
  name: payroll_close_on_submit
3
3
  label: {id: 'Tutup periode gaji, biaya ke untung proyek dan faktur klien'}
4
4
  # 0. The run is closed: no slip can be submitted into it or cancelled out of it.
5
+ # Steps 1 and 2 are for client runs only (projects and invoicing installed): an internal run has no project and no
6
+ # client, so its close only closes the run. Tested as `!= 'internal'`, so a close made before payroll 2.0 (no run_kind
7
+ # of its own) still counts as a client close.
5
8
  # 1. The project ledger gets the employer cost the recaps did not book (allowances, THR, employer BPJS), so the margin
6
9
  # is revenue minus the full cost of the workers.
7
10
  # 2. The client invoice is made as a draft (a flow cannot submit): wages on their own line, outside the PPh 23 base
@@ -16,7 +19,7 @@ steps:
16
19
  as: run
17
20
  - update: run
18
21
  set: {closed: 'true', closed_by: event.name}
19
- - if: event.extra_cost != 0
22
+ - if: event.run_kind != 'internal' && app_installed('projects') && event.extra_cost != 0
20
23
  create: project_ledger
21
24
  set:
22
25
  project: event.project
@@ -27,11 +30,11 @@ steps:
27
30
  source_name: event.name
28
31
  payroll_close: event.name
29
32
  amount: "0 - event.extra_cost"
30
- - if: event.billing_mode != 'none'
33
+ - if: event.run_kind != 'internal' && app_installed('invoicing') && event.billing_mode != 'none'
31
34
  find: sales_invoice
32
35
  where: project == event.project && docstatus == 0 && notes.contains('[' + event.payroll_run + ']')
33
36
  as: old
34
- - if: event.billing_mode != 'none' && old != null
37
+ - if: event.run_kind != 'internal' && app_installed('invoicing') && event.billing_mode != 'none' && old != null
35
38
  update: old
36
39
  set:
37
40
  posting_date: "event.invoice_date != '' ? event.invoice_date : today()"
@@ -41,7 +44,7 @@ steps:
41
44
  event.billing_mode == 'fee_only' ? [{'item': event.fee_item, 'description': 'Management fee', 'qty': 1, 'rate': event.fee_amount, 'pph23_exclude': false}] : [{'item': event.wage_item, 'description': 'Gaji, tunjangan, lembur dan THR tenaga kerja', 'qty': 1, 'rate': event.total_cash_gross, 'pph23_exclude': true, 'ppn_exclude': true},
42
45
  {'item': event.bpjs_item, 'description': 'Iuran BPJS Ketenagakerjaan dan Kesehatan bagian perusahaan', 'qty': 1, 'rate': event.total_employer_bpjs, 'pph23_exclude': false},
43
46
  {'item': event.fee_item, 'description': 'Management fee', 'qty': 1, 'rate': event.fee_amount, 'pph23_exclude': false}]
44
- - if: event.billing_mode != 'none' && event.billing_mode == 'wages_plus_fee' && old == null
47
+ - if: event.run_kind != 'internal' && app_installed('invoicing') && event.billing_mode != 'none' && event.billing_mode == 'wages_plus_fee' && old == null
45
48
  create: sales_invoice
46
49
  set:
47
50
  customer: event.customer
@@ -54,7 +57,7 @@ steps:
54
57
  [{'item': event.wage_item, 'description': 'Gaji, tunjangan, lembur dan THR tenaga kerja', 'qty': 1, 'rate': event.total_cash_gross, 'pph23_exclude': true, 'ppn_exclude': true},
55
58
  {'item': event.bpjs_item, 'description': 'Iuran BPJS Ketenagakerjaan dan Kesehatan bagian perusahaan', 'qty': 1, 'rate': event.total_employer_bpjs, 'pph23_exclude': false},
56
59
  {'item': event.fee_item, 'description': 'Management fee', 'qty': 1, 'rate': event.fee_amount, 'pph23_exclude': false}]
57
- - if: event.billing_mode != 'none' && event.billing_mode == 'fee_only' && old == null
60
+ - if: event.run_kind != 'internal' && app_installed('invoicing') && event.billing_mode != 'none' && event.billing_mode == 'fee_only' && old == null
58
61
  create: sales_invoice
59
62
  set:
60
63
  customer: event.customer
@@ -0,0 +1,106 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
2
+ # Every morning at 07:15 (scheduler.timezone), and by the owner or finance from the flow list: each payroll run that is
3
+ # not closed is checked, and finance and the owner are told (contract 0066). The flow only reads and tells (its one
4
+ # write is the run's own ready_told mark): it makes no slip, submits nothing and never closes or pays a run.
5
+ # - payroll_ready, once per run (the run is then marked ready_told): the cut-off period is over, no attendance recap of the period is still a draft, no
6
+ # field attendance close is still a draft, and the run has at least one slip. Finance checks the draft slips,
7
+ # submits them and closes the period.
8
+ # - payroll_due, once a day from three days before the pay date until the pay date, while the run is not closed:
9
+ # what is ready (slips submitted) and what is missing (draft slips, attendance recaps not submitted, submitted
10
+ # recaps without a slip because the worker has no pay data, field attendance not closed).
11
+ # Recaps are the monthly ones payroll reads (timesheet with period_to, paid per day), as payslip_from_recap does.
12
+ # A client run reads its project, recaps and field attendance closes (projects module). An internal run (payroll 2.0)
13
+ # has no project: it is ready when its period is over, it has a slip and no staff attendance period overlapping it
14
+ # (its outlet's or the whole business's) is still a draft (attendance module, when installed).
15
+ # The day is today, or event.as_of (YYYY-MM-DD) when the flow is run by hand for another day (and in tests).
16
+ # At most 100 open runs per run of the flow.
17
+ name: payroll_reminder
18
+ label: {id: Pengingat periode gaji, en: Payroll reminder}
19
+ description: {id: 'Tiap pagi, bagian keuangan dan pemilik dikabari periode gaji yang siap diproses dan yang tanggal bayarnya tinggal tiga hari atau kurang, lengkap dengan yang masih kurang. Gaji tidak pernah dijalankan otomatis.'}
20
+ schedule: '15 7 * * *'
21
+ steps:
22
+ - find_all: payroll_run
23
+ where: "!closed"
24
+ sort: period_to
25
+ limit: 100
26
+ as: runs
27
+ - for_each: runs
28
+ as: run
29
+ do:
30
+ - find_all: payslip
31
+ where: payroll_run == run.name && docstatus != 2
32
+ as: slips
33
+ - if: "run.run_kind != 'internal' && app_installed('projects')"
34
+ then:
35
+ - {find: project, where: name == run.project, as: pj}
36
+ - find_all: timesheet
37
+ where: "project == run.project && docstatus != 2 && period_to != '' && rate_basis == 'day' && work_date >= run.period_from && work_date <= run.period_to"
38
+ as: recaps
39
+ - find_all: attendance_close
40
+ where: "project == run.project && docstatus == 0 && period_from <= run.period_to && period_to >= run.period_from"
41
+ as: closes
42
+ - if: "!run.ready_told && ('as_of' in event ? event.as_of : today()) > run.period_to && size(slips) > 0 && recaps.filter(t, t.docstatus == 0).size() == 0 && size(closes) == 0"
43
+ notify: finance_manager
44
+ notice: payroll_ready
45
+ channel: email
46
+ record: run
47
+ id: "'ready:' + run.name"
48
+ title: 'Periode gaji {pj != null ? pj.project_name : run.project} siap diproses'
49
+ template: >-
50
+ Periode {run.period_from} sampai {run.period_to} sudah lewat dan semua rekap absen sudah diajukan.
51
+ Slip gaji: {slips.filter(s, s.docstatus == 0).size()} draft menunggu diperiksa, {slips.filter(s, s.docstatus == 1).size()} sudah diajukan.
52
+ Periksa slip, ajukan, lalu tutup periode gaji.
53
+ # the notify step above ran exactly when this is true: the run is marked, so it is announced once
54
+ - if: "!run.ready_told && ('as_of' in event ? event.as_of : today()) > run.period_to && size(slips) > 0 && recaps.filter(t, t.docstatus == 0).size() == 0 && size(closes) == 0"
55
+ update: run
56
+ set: {ready_told: 'true'}
57
+ - if: "run.pay_date != '' && days_between(('as_of' in event ? event.as_of : today()), run.pay_date) >= 0 && days_between(('as_of' in event ? event.as_of : today()), run.pay_date) <= 3"
58
+ notify: finance_manager
59
+ notice: payroll_due
60
+ channel: email
61
+ record: run
62
+ id: "'due:' + run.name + ':' + ('as_of' in event ? event.as_of : today())"
63
+ title: "Gaji {pj != null ? pj.project_name : run.project} dibayar {days_between(('as_of' in event ? event.as_of : today()), run.pay_date) == 0 ? 'hari ini' : string(days_between(('as_of' in event ? event.as_of : today()), run.pay_date)) + ' hari lagi'}"
64
+ template: >-
65
+ Tanggal bayar {run.pay_date}. Siap: {slips.filter(s, s.docstatus == 1).size()} slip gaji sudah diajukan.
66
+ Belum: {slips.filter(s, s.docstatus == 0).size()} slip masih draft, {recaps.filter(t, t.docstatus == 0).size()} rekap absen belum diajukan,
67
+ {recaps.filter(t, t.docstatus == 1 && !slips.exists(s, s.timesheet == t.name)).size()} rekap belum jadi slip, {size(closes)} rekap absen lapangan belum diajukan.
68
+ Periode gaji belum ditutup.
69
+ else:
70
+ # Draft staff attendance periods overlapping the run, of its outlet or of the whole business. Without the
71
+ # attendance module there are none: a find on a model that is not installed fails, so the list is then an
72
+ # empty find of payslips (a payslip always has a name).
73
+ - if: "app_installed('attendance')"
74
+ then:
75
+ - find_all: attendance_period
76
+ where: "docstatus == 0 && period_from <= run.period_to && period_to >= run.period_from && (run.outlet == '' || only_outlet == '' || only_outlet == run.outlet)"
77
+ as: open_periods
78
+ else:
79
+ - find_all: payslip
80
+ where: "name == ''"
81
+ as: open_periods
82
+ - if: "!run.ready_told && ('as_of' in event ? event.as_of : today()) > run.period_to && size(slips) > 0 && size(open_periods) == 0"
83
+ notify: finance_manager
84
+ notice: payroll_ready
85
+ channel: email
86
+ record: run
87
+ id: "'ready:' + run.name"
88
+ title: 'Periode gaji karyawan {run.period_from} sampai {run.period_to} siap diproses'
89
+ template: >-
90
+ Periode {run.period_from} sampai {run.period_to} sudah lewat dan rekap absen karyawannya sudah diajukan.
91
+ Slip gaji: {slips.filter(s, s.docstatus == 0).size()} draft menunggu diperiksa, {slips.filter(s, s.docstatus == 1).size()} sudah diajukan.
92
+ Periksa slip, ajukan, lalu tutup periode gaji.
93
+ - if: "!run.ready_told && ('as_of' in event ? event.as_of : today()) > run.period_to && size(slips) > 0 && size(open_periods) == 0"
94
+ update: run
95
+ set: {ready_told: 'true'}
96
+ - if: "run.pay_date != '' && days_between(('as_of' in event ? event.as_of : today()), run.pay_date) >= 0 && days_between(('as_of' in event ? event.as_of : today()), run.pay_date) <= 3"
97
+ notify: finance_manager
98
+ notice: payroll_due
99
+ channel: email
100
+ record: run
101
+ id: "'due:' + run.name + ':' + ('as_of' in event ? event.as_of : today())"
102
+ title: "Gaji karyawan dibayar {days_between(('as_of' in event ? event.as_of : today()), run.pay_date) == 0 ? 'hari ini' : string(days_between(('as_of' in event ? event.as_of : today()), run.pay_date)) + ' hari lagi'}"
103
+ template: >-
104
+ Tanggal bayar {run.pay_date}. Siap: {slips.filter(s, s.docstatus == 1).size()} slip gaji sudah diajukan.
105
+ Belum: {slips.filter(s, s.docstatus == 0).size()} slip masih draft, {size(open_periods)} rekap absen karyawan belum diajukan.
106
+ Periode gaji belum ditutup.
@@ -1,11 +1,13 @@
1
1
  # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
2
2
  name: payroll_run_overlap_guard_created
3
- label: {id: Periode gaji satu proyek tidak tumpang tindih}
4
- # Two runs of one project over the same days would pay the same attendance twice.
3
+ label: {id: Periode gaji satu proyek atau outlet tidak tumpang tindih}
4
+ # Two runs of one project over the same days would pay the same attendance twice. Internal runs (payroll 2.0) overlap
5
+ # only with internal runs of the same outlet (or both of every outlet); a worker paid twice is refused per slip
6
+ # (payslip_pay_overlap_guard).
5
7
  on: payroll_run.created
6
8
  steps:
7
9
  - find: payroll_run
8
- where: project == event.project && name != event.name && period_from <= event.period_to && period_to >= event.period_from
10
+ where: ((event.run_kind == 'internal' && run_kind == 'internal' && outlet == event.outlet) || (event.run_kind != 'internal' && run_kind != 'internal' && project == event.project)) && name != event.name && period_from <= event.period_to && period_to >= event.period_from
9
11
  as: other
10
12
  - if: other != null
11
13
  create: payroll_guard
@@ -1,11 +1,13 @@
1
1
  # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
2
2
  name: payroll_run_overlap_guard_updated
3
- label: {id: Periode gaji satu proyek tidak tumpang tindih}
4
- # Two runs of one project over the same days would pay the same attendance twice.
3
+ label: {id: Periode gaji satu proyek atau outlet tidak tumpang tindih}
4
+ # Two runs of one project over the same days would pay the same attendance twice. Internal runs (payroll 2.0) overlap
5
+ # only with internal runs of the same outlet (or both of every outlet); a worker paid twice is refused per slip
6
+ # (payslip_pay_overlap_guard).
5
7
  on: payroll_run.updated
6
8
  steps:
7
9
  - find: payroll_run
8
- where: project == event.project && name != event.name && period_from <= event.period_to && period_to >= event.period_from
10
+ where: ((event.run_kind == 'internal' && run_kind == 'internal' && outlet == event.outlet) || (event.run_kind != 'internal' && run_kind != 'internal' && project == event.project)) && name != event.name && period_from <= event.period_to && period_to >= event.period_from
9
11
  as: other
10
12
  - if: other != null
11
13
  create: payroll_guard
@@ -16,7 +16,7 @@ steps:
16
16
  as: prof
17
17
  - if: prof != null
18
18
  find: payroll_run
19
- where: project == event.project && !closed && period_from <= event.work_date && period_to >= event.work_date
19
+ where: run_kind != 'internal' && project == event.project && !closed && period_from <= event.work_date && period_to >= event.work_date
20
20
  as: run
21
21
  - if: prof != null && run != null
22
22
  find: payslip
@@ -0,0 +1,27 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/import.json
2
+ # Pay data of the workers already in the worker list (import worker_list first): one row per worker, found by the
3
+ # employee number. Status PTKP as written on the tax form (TK/0 to K/3), Dasar gaji Bulanan or Harian (anything else,
4
+ # empty included, is a row error), the BPJS columns Ya or Tidak (empty = Ya). Without a NIK or NPWP the profile has no
5
+ # valid tax number (PPh 21 120%). NIK and bank account are personal data: the file stays with the owner and finance.
6
+ name: payroll_profile_list
7
+ label: {id: Data gaji karyawan, en: Payroll profiles}
8
+ model: payroll_profile
9
+ source: csv
10
+ header_row: 1
11
+ key: [Nomor karyawan]
12
+ map:
13
+ worker: {value: Nomor karyawan, match: employee_no}
14
+ ptkp_status: "=row['Status PTKP'].trim().lowerAscii().replace('/', '')"
15
+ pay_basis: "=row['Dasar gaji'].trim().lowerAscii() in ['bulanan', 'bulan', 'monthly'] ? 'monthly' : (row['Dasar gaji'].trim().lowerAscii() in ['harian', 'daily'] ? 'daily' : '(' + row['Dasar gaji'] + ')')"
16
+ employment: "='Pegawai tidak tetap' in row && row['Pegawai tidak tetap'].trim().lowerAscii() in ['ya', 'y', '1', 'true'] ? 'casual' : 'permanent'"
17
+ monthly_salary: "='Gaji pokok' in row && row['Gaji pokok'] != '' ? row['Gaji pokok'] : '0'"
18
+ fixed_allowance: "='Tunjangan tetap' in row && row['Tunjangan tetap'] != '' ? row['Tunjangan tetap'] : '0'"
19
+ daily_allowance: "='Tunjangan per hari' in row && row['Tunjangan per hari'] != '' ? row['Tunjangan per hari'] : '0'"
20
+ nik: "='NIK' in row ? row['NIK'] : ''"
21
+ npwp: "='NPWP' in row ? row['NPWP'] : ''"
22
+ has_tax_id: "=('NIK' in row && row['NIK'].trim() != '') || ('NPWP' in row && row['NPWP'].trim() != '') ? 'Ya' : 'Tidak'"
23
+ bpjs_tk: "='BPJS Ketenagakerjaan' in row && row['BPJS Ketenagakerjaan'] != '' ? row['BPJS Ketenagakerjaan'] : 'Ya'"
24
+ bpjs_jp: "='Jaminan Pensiun' in row && row['Jaminan Pensiun'] != '' ? row['Jaminan Pensiun'] : 'Ya'"
25
+ bpjs_kes: "='BPJS Kesehatan' in row && row['BPJS Kesehatan'] != '' ? row['BPJS Kesehatan'] : 'Ya'"
26
+ bank_name: "='Bank' in row ? row['Bank'] : ''"
27
+ bank_account: "='No. rekening' in row ? row['No. rekening'] : ''"
@@ -6,9 +6,11 @@ is_submittable: true
6
6
  naming: TPG-{YYYY}-{####}
7
7
  title_field: payroll_run
8
8
  # Closing a payroll run. Its amounts are copied from the run when it is saved and frozen by the submit; the submit
9
- # closes the run (no slip can then be submitted into it or cancelled out of it), books the employer cost the recaps
10
- # did not book on the project margin, and makes the client invoice as a draft (payroll_close_on_submit). Cancelling
11
- # it reopens the run and reverses the margin row; it is refused while the client invoice is submitted.
9
+ # closes the run (no slip can then be submitted into it or cancelled out of it) and, for a client run only, books the
10
+ # employer cost the recaps did not book on the project margin and makes the client invoice as a draft
11
+ # (payroll_close_on_submit). Cancelling it reopens the run and reverses the margin row; it is refused while the client
12
+ # invoice is submitted. An internal run's close books nothing outside payroll (the accounting module, when installed,
13
+ # journals every close).
12
14
  permissions:
13
15
  - {role: finance_manager, read: true, create: true, write: true, delete: true, submit: true, cancel: true, amend: true, export: true, print: true}
14
16
  - {role: project_admin, read: true}
@@ -19,8 +21,10 @@ fields:
19
21
  label: {id: Periode gaji}
20
22
  required: true
21
23
  in_list: true
22
- - {name: project, type: link, to: project, label: {id: Proyek}, compute: payroll_run.project, in_list: true}
23
- - {name: customer, type: link, to: customer, label: {id: Klien}, compute: payroll_run.customer}
24
+ - {name: run_kind, type: data, label: {id: Jenis periode}, compute: payroll_run.run_kind}
25
+ - {name: project, type: link, to: project, label: {id: Proyek}, compute: payroll_run.project, in_list: true, depends_on: run_kind == 'client'}
26
+ - {name: customer, type: link, to: customer, label: {id: Klien}, compute: payroll_run.customer, depends_on: run_kind == 'client'}
27
+ - {name: outlet, type: link, to: outlet, label: {id: Outlet}, compute: payroll_run.outlet, depends_on: run_kind == 'internal' && app_installed('outlets')}
24
28
  - {name: period_from, type: date, label: {id: Periode dari}, compute: payroll_run.period_from}
25
29
  - {name: period_to, type: date, label: {id: Periode sampai}, compute: payroll_run.period_to, in_list: true}
26
30
  - {name: billing_mode, type: data, label: {id: Cara tagih klien}, compute: payroll_run.billing_mode}
@@ -72,7 +76,7 @@ views:
72
76
  layout:
73
77
  - section: {id: Periode}
74
78
  columns:
75
- - [payroll_run, project, customer]
79
+ - [payroll_run, run_kind, project, customer, outlet]
76
80
  - [period_from, period_to, billing_mode]
77
81
  - section: {id: Setoran dan biaya}
78
82
  columns:
@@ -4,7 +4,8 @@ label: {id: Periode gaji, en: Payroll run}
4
4
  icon: calendar
5
5
  naming: PAY-{YYYY}-{####}
6
6
  title_field: project
7
- # One client contract (project) for one cut-off period. Create it before the attendance recaps are submitted: each
7
+ # One cut-off period of either one client contract (run_kind client: outsourced workers, a project, a client invoice at
8
+ # the close) or the firm's own staff (run_kind internal: no project and no invoice; optionally one outlet). Create it before the attendance recaps are submitted: each
8
9
  # submitted recap of a worker with a payroll profile becomes a draft payslip of this run (flow payslip_from_recap).
9
10
  # The totals are kept by the flows of payslip submit and cancel. The run is not itself submitted: slips link to it, and
10
11
  # a submit would rename a DRAFT- record without its links following. It is closed by submitting a payroll_close
@@ -16,18 +17,37 @@ permissions:
16
17
  - {role: finance_manager, read: true, create: true, write: true, export: true, print: true}
17
18
  - {role: project_admin, read: true}
18
19
  fields:
20
+ # client: a client contract (projects installed); internal: the firm's own staff. Runs made before 2.0 are all client
21
+ # (the upgrade fills the default, tests/upgrade_payroll_internal.py). A new run defaults to client only where the
22
+ # projects module is installed. Locked with the project once a slip is submitted (rule project_matches_kind).
23
+ - name: run_kind
24
+ type: select
25
+ label: {id: Jenis periode, en: Run kind}
26
+ required: true
27
+ default: "app_installed('projects') ? 'client' : 'internal'"
28
+ in_list: true
29
+ options:
30
+ - {value: client, label: {id: Kontrak klien, en: Client contract}}
31
+ - {value: internal, label: {id: Karyawan sendiri, en: Own staff}}
19
32
  - name: project
20
33
  type: link
21
34
  to: project
22
35
  label: {id: Proyek (kontrak klien)}
23
- required: true
24
36
  in_list: true
37
+ depends_on: run_kind == 'client'
25
38
  - name: customer
26
39
  type: link
27
40
  to: customer
28
41
  label: {id: Klien}
29
- default: project.customer
42
+ default: "app_installed('projects') && project != '' ? project.customer : ''"
30
43
  read_only: true
44
+ depends_on: run_kind == 'client'
45
+ # Cost centre of an internal run: the outlet whose staff it pays (empty = every outlet).
46
+ - name: outlet
47
+ type: link
48
+ to: outlet
49
+ label: {id: Outlet, en: Outlet}
50
+ depends_on: run_kind == 'internal' && app_installed('outlets')
31
51
  - name: period_from
32
52
  type: date
33
53
  label: {id: Periode dari}
@@ -75,7 +95,8 @@ fields:
75
95
  type: select
76
96
  label: {id: Cara tagih klien}
77
97
  required: true
78
- default: "'wages_plus_fee'"
98
+ default: "run_kind == 'internal' ? 'none' : 'wages_plus_fee'"
99
+ depends_on: run_kind == 'client'
79
100
  options:
80
101
  - {value: wages_plus_fee, label: {id: Gaji + BPJS + fee}}
81
102
  - {value: fee_only, label: {id: Fee saja}}
@@ -84,6 +105,7 @@ fields:
84
105
  type: select
85
106
  label: {id: Fee}
86
107
  default: "'percent'"
108
+ depends_on: run_kind == 'client' && billing_mode != 'none'
87
109
  options:
88
110
  - {value: percent, label: {id: Persen dari biaya tenaga kerja}}
89
111
  - {value: flat, label: {id: Flat per pekerja per bulan}}
@@ -91,32 +113,46 @@ fields:
91
113
  type: percent
92
114
  label: {id: Fee persen}
93
115
  default: '0'
94
- depends_on: fee_mode == 'percent'
116
+ depends_on: run_kind == 'client' && billing_mode != 'none' && fee_mode == 'percent'
95
117
  - name: fee_per_worker
96
118
  type: currency
97
119
  label: {id: Fee per pekerja}
98
120
  default: '0'
99
- depends_on: fee_mode == 'flat'
121
+ depends_on: run_kind == 'client' && billing_mode != 'none' && fee_mode == 'flat'
100
122
  - name: wage_item
101
123
  type: link
102
124
  to: item
125
+ depends_on: run_kind == 'client' && billing_mode != 'none'
103
126
  label: {id: Barang/jasa untuk baris gaji}
104
127
  - name: bpjs_item
105
128
  type: link
106
129
  to: item
130
+ depends_on: run_kind == 'client' && billing_mode != 'none'
107
131
  label: {id: Barang/jasa untuk baris BPJS}
108
132
  - name: fee_item
109
133
  type: link
110
134
  to: item
135
+ depends_on: run_kind == 'client' && billing_mode != 'none'
111
136
  label: {id: Barang/jasa untuk baris fee}
112
137
  - name: invoice_date
113
138
  type: date
114
139
  label: {id: Tanggal faktur klien}
140
+ depends_on: run_kind == 'client' && billing_mode != 'none'
115
141
  - name: pph23_applies
116
142
  type: check
117
143
  label: {id: Klien memotong PPh 23}
118
144
  default: 'true'
145
+ depends_on: run_kind == 'client' && billing_mode != 'none'
146
+ # Lateness deduction per minute late (staff attendance summary), 0 = off. Off by default (DECISIONS.md, 19 Nov 2026):
147
+ # a firm that deducts for lateness sets it here, and the slips show late minutes either way.
148
+ - name: late_rate_per_min
149
+ type: currency
150
+ label: {id: Potongan telat per menit, en: Lateness deduction per minute}
151
+ default: '0'
119
152
  - {name: closed, type: check, label: {id: Sudah ditutup}, default: 'false', read_only: true, in_list: true}
153
+ # Set by flow payroll_reminder on the morning it told finance the period is ready (notice payroll_ready), so a run is
154
+ # announced once and the daily check sends nothing more about it.
155
+ - {name: ready_told, type: check, label: {id: Sudah dikabari siap diproses}, default: 'false', read_only: true}
120
156
  # Locks (written by the flows): once a slip is submitted the run's rates, period, tax month and project are those of
121
157
  # the slips (lock_slip, the first submitted slip, stores copies); once closed, everything the close froze must stay
122
158
  # (closed_by). Cleared when the last slip is cancelled or the close is cancelled.
@@ -133,13 +169,14 @@ fields:
133
169
  label: {id: Masa pajak sebelumnya}
134
170
  hidden: true
135
171
  compute: "tax_month == 1 ? truncate(tax_year - 1, 4) + '-12' : truncate(tax_year, 4) + '-' + (tax_month < 11 ? '0' : '') + truncate(tax_month - 1, 2)"
136
- # One run per project and start of period.
172
+ # One client run per project and start of period; one internal run per outlet (or all outlets) and start of period.
173
+ # A client run's key is the same as before 2.0.
137
174
  - name: run_key
138
175
  type: data
139
176
  label: {id: Kunci periode}
140
177
  hidden: true
141
178
  unique: true
142
- compute: "project + ':' + period_from"
179
+ compute: "run_kind == 'internal' ? 'internal:' + outlet + ':' + period_from : project + ':' + period_from"
143
180
  # Totals of the submitted payslips (flows payroll_totals_on_payslip_*). Not typed by anyone.
144
181
  - {name: headcount, type: int, label: {id: Jumlah pekerja}, default: '0', read_only: true, in_list: true}
145
182
  - {name: total_cash_gross, type: currency, label: {id: 'Gaji, tunjangan, lembur, THR'}, default: '0', read_only: true}
@@ -162,6 +199,17 @@ fields:
162
199
  label: {id: Biaya tambahan ke untung proyek}
163
200
  compute: total_employer_cost - total_timesheet_cost
164
201
  rules:
202
+ # A client run has a project and an internal run none: the kind cannot change once a slip is submitted, since the
203
+ # project is locked by locked_by_slips.
204
+ - name: project_matches_kind
205
+ on: save
206
+ check: "run_kind == 'client' ? app_installed('projects') && project != '' : project == ''"
207
+ message: {id: 'Periode kontrak klien butuh proyek; periode karyawan sendiri tanpa proyek'}
208
+ # An internal run bills nobody; an outlet is the cost centre of an internal run only.
209
+ - name: internal_not_billed
210
+ on: save
211
+ check: "run_kind == 'client' ? outlet == '' : billing_mode == 'none'"
212
+ message: {id: 'Periode karyawan sendiri tidak ditagih ke klien; outlet hanya untuk periode karyawan sendiri'}
165
213
  - name: period_order
166
214
  on: save
167
215
  check: period_to >= period_from && period_to < period_from + duration(31)
@@ -172,8 +220,8 @@ rules:
172
220
  message: {id: 'Bulan pajak 1 sampai 12, tahun pajak mulai 2024 (TER)'}
173
221
  - name: rates_range
174
222
  on: save
175
- check: umk > 0 && jkk_rate >= 0.24 && jkk_rate <= 1.74 && jp_wage_cap > 0 && kes_wage_cap > 0 && (workdays_per_week == 5 || workdays_per_week == 6) && fee_percent >= 0 && fee_per_worker >= 0
176
- message: {id: 'Isi UMK; JKK 0,24 sampai 1,74 persen; batas upah lebih dari 0; hari kerja 5 atau 6; fee tidak negatif'}
223
+ check: umk > 0 && jkk_rate >= 0.24 && jkk_rate <= 1.74 && jp_wage_cap > 0 && kes_wage_cap > 0 && (workdays_per_week == 5 || workdays_per_week == 6) && fee_percent >= 0 && fee_per_worker >= 0 && late_rate_per_min >= 0
224
+ message: {id: 'Isi UMK; JKK 0,24 sampai 1,74 persen; batas upah lebih dari 0; hari kerja 5 atau 6; fee dan potongan telat tidak negatif'}
177
225
  # Pay of a period is paid (and taxed) in the month it ends or the month after: the tax month follows the period, so the
178
226
  # same days cannot be put into two tax months.
179
227
  - name: tax_month_follows_period
@@ -186,8 +234,9 @@ rules:
186
234
  lock_slip == '' || (lock_slip.project == project && lock_slip.tax_year == tax_year && lock_slip.tax_month == tax_month
187
235
  && lock_slip.run_umk == umk && lock_slip.run_jkk_rate == jkk_rate && lock_slip.run_jp_cap == jp_wage_cap
188
236
  && lock_slip.run_kes_cap == kes_wage_cap && lock_slip.run_workdays == workdays_per_week
189
- && lock_slip.run_period_from == period_from && lock_slip.run_period_to == period_to)
190
- message: {id: 'Periode sudah punya slip diajukan: proyek, periode, bulan pajak, UMK dan tarif terkunci'}
237
+ && lock_slip.run_period_from == period_from && lock_slip.run_period_to == period_to
238
+ && lock_slip.run_late_rate == late_rate_per_min && lock_slip.run_outlet == outlet)
239
+ message: {id: 'Periode sudah punya slip diajukan: jenis, proyek, outlet, periode, bulan pajak, UMK dan tarif terkunci'}
191
240
  - name: locked_by_close
192
241
  on: save
193
242
  check: >-
@@ -198,18 +247,18 @@ rules:
198
247
  message: {id: 'Periode gaji sudah ditutup: batalkan dokumen tutup periodenya dulu untuk mengubahnya'}
199
248
  views:
200
249
  list:
201
- columns: [name, project, period_from, period_to, headcount, total_net_pay, closed]
250
+ columns: [name, run_kind, project, period_from, period_to, headcount, total_net_pay, closed]
202
251
  sort: -period_from
203
252
  form:
204
253
  layout:
205
254
  - section: {id: Periode}
206
255
  columns:
207
- - [project, customer, period_from, period_to, closed]
256
+ - [run_kind, project, customer, outlet, period_from, period_to, closed]
208
257
  - [tax_year, tax_month, pay_date]
209
258
  - section: {id: Tarif dan batas}
210
259
  columns:
211
260
  - [umk, workdays_per_week, jkk_rate]
212
- - [jp_wage_cap, kes_wage_cap]
261
+ - [jp_wage_cap, kes_wage_cap, late_rate_per_min]
213
262
  - section: {id: Tagihan klien}
214
263
  columns:
215
264
  - [billing_mode, fee_mode, fee_percent, fee_per_worker, pph23_applies]