@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,16 +1,25 @@
1
1
  # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
2
2
  name: stock_negative_alert
3
3
  label: {id: Peringatan stok minus}
4
- description: {id: 'Kalau stok sebuah barang di outlet jadi minus, kantor pusat langsung dikabari.'}
5
- # The kernel passes the stock_move record as `event` (name, outlet, item, qty, balance_qty, negative, ...). It does not
6
- # yet dispatch `<model>.created` events to flows (S8c finding), so head office also sees the "Stok minus" list.
7
- # The two find steps turn the record names into item and outlet names for the message; when a record cannot be found
8
- # (deleted, or outside the actor's scope) the text falls back to the plain names.
4
+ description: {id: 'Kalau stok sebuah barang di outlet jadi minus, pemilik dan kantor pusat langsung dikabari.'}
5
+ # The kernel passes the stock_move record as `event` (name, outlet, item, qty, balance_qty, negative, ...). The flow
6
+ # runs inside the writer's submit, as the writer (a sales manager's delivery note, a purchasing manager's receipt), so
7
+ # it reads only models every such writer may read: item and outlet, for the names in the message. When a record cannot
8
+ # be found (deleted, or outside the actor's scope) the text falls back to the plain names. It must not read
9
+ # stock_balance: a find on a model the writer may not read refuses the whole submit (audit owner-automation-pack 1).
10
+ # The notice (stock_negative, contract 0066) leaves out people limited to other outlets and tells once per balance and
11
+ # day (id), however many moves keep it below zero that day. The step stays `in_app`: on a kernel that mails by SMTP a
12
+ # `channel: email` step also queues the older notify_email mail on every run, without the id or the outlet. So mail is
13
+ # off by default for this kind; a person who wants it switches it on in Pengaturan › Notifikasi.
9
14
  on: stock_move.created
10
15
  if: event.negative == true
11
16
  steps:
12
17
  - {find: item, where: name == event.item, as: it}
13
18
  - {find: outlet, where: name == event.outlet, as: ou}
14
19
  - notify: head_office
20
+ notice: stock_negative
15
21
  channel: in_app
22
+ outlet: event.outlet
23
+ id: "'neg:' + event.outlet + ':' + event.item + ':' + string(today())"
24
+ title: {id: 'Stok {it != null ? it.item_name : event.item} minus'}
16
25
  template: {id: 'Stok {it != null ? it.item_name : event.item} di {ou != null ? ou.outlet_name : event.outlet} minus ({event.balance_qty})'}
@@ -0,0 +1,34 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/model.json
2
+ # One row per time an item's balance in an outlet fell below the item's reorder level (catalogue item.reorder_level).
3
+ # Written only by flows: stock_low_alert opens a row when a balance is below its level and has no open row, and
4
+ # closes it (open = false) when the balance is back at or above the level, so head office is told once per episode,
5
+ # not every day. procurement/reorder_draft_po puts the open rows that have a supplier on a draft purchase order and
6
+ # ticks `drafted`, so one episode gives at most one draft. The figures (qty, level, order_qty, rate, vendor) are
7
+ # those of the day the row was opened; the draft is the place to change them. Every field is read_only.
8
+ name: stock_reorder
9
+ label: {id: Stok di bawah batas minimum, en: Reorder alert}
10
+ icon: alarm-warning-line
11
+ naming: ROP-{YYYY}-{#####}
12
+ title_field: item
13
+ permissions:
14
+ - {role: head_office, read: true, export: true}
15
+ - {role: purchasing_manager, read: true, export: true}
16
+ fields:
17
+ - {name: balance, type: link, to: stock_balance, label: {id: Saldo stok}, required: true, read_only: true}
18
+ - {name: outlet, type: link, to: outlet, label: {id: Outlet}, required: true, read_only: true, in_list: true}
19
+ - {name: item, type: link, to: item, label: {id: Barang}, required: true, read_only: true, in_list: true}
20
+ - {name: alerted_on, type: date, label: {id: Tanggal dikabari}, read_only: true, in_list: true}
21
+ - {name: qty, type: float, label: {id: Stok saat dikabari}, read_only: true, in_list: true}
22
+ - {name: level, type: float, label: {id: Batas stok minimum}, read_only: true, in_list: true}
23
+ - {name: order_qty, type: float, label: {id: Jumlah yang disarankan dipesan}, read_only: true}
24
+ - {name: rate, type: currency, label: {id: Perkiraan harga beli}, read_only: true, help: {id: 'Rata-rata biaya barang ini di outlet saat dikabari'}}
25
+ - {name: vendor, type: link, to: vendor, label: {id: Pemasok utama}, read_only: true}
26
+ - {name: open, type: check, label: {id: Masih di bawah batas}, read_only: true, in_list: true, in_filter: true}
27
+ # A draft is renamed when it is submitted and links do not follow the new name, so the draft's number is kept as text.
28
+ - {name: drafted, type: check, label: {id: Sudah masuk draft pesanan pembelian}, read_only: true, in_list: true}
29
+ - {name: draft_ref, type: data, label: {id: Nomor draft pesanan pembelian}, read_only: true}
30
+ views:
31
+ list:
32
+ columns: [item, outlet, alerted_on, qty, level, open, drafted]
33
+ filters: [outlet, item, open]
34
+ sort: -alerted_on
@@ -1,13 +1,28 @@
1
1
  # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/module.json
2
2
  name: stock
3
- version: 1.3.1
3
+ version: 1.4.0
4
4
  title: {id: Stok, en: Stock}
5
5
  summary:
6
6
  id: Saldo dan mutasi stok, transfer antar outlet, opname dan penyesuaian.
7
7
  en: Stock balances and moves, transfers between outlets, counts and adjustments.
8
8
  category: stock
9
9
  icon: archive-line
10
- requires: {rangka: '>=0.5', users: ^1.2, catalogue: ^1.0, outlets: ^1.0}
10
+ # contacts: stock_reorder.vendor links a vendor. catalogue already requires contacts, so no site gains a module.
11
+ requires: {rangka: '>=0.5', users: ^1.2, contacts: ^1.0, catalogue: ^1.4, outlets: ^1.0}
11
12
  # Semantics fixed in docs/kernel-hooks.md (section stock). stock.post_moves is a core hook on the on_submit of
12
13
  # goods_receipt, stock_transfer, stock_transfer_receipt, stock_count, stock_adjustment and outlet_sales; stock.reverse_moves is declared here.
13
14
  hooks: [stock.reverse_moves]
15
+ # What this module tells people (contract 0066 §1.1). stock_negative: flow stock_negative_alert, the moment a balance
16
+ # goes below zero. stock_low: flow stock_low_alert, once per item and outlet when the balance falls below the item's
17
+ # reorder level (item.reorder_level). A person switches the mail of a kind off in Pengaturan › Notifikasi.
18
+ notices:
19
+ - name: stock_negative
20
+ label: {id: Stok minus, en: Negative stock}
21
+ description: {id: 'Stok sebuah barang di outlet jadi di bawah nol.'}
22
+ severity: high
23
+ to: [owner, head_office]
24
+ - name: stock_low
25
+ label: {id: Stok di bawah batas minimum, en: Stock below reorder level}
26
+ description: {id: 'Stok sebuah barang turun di bawah batas minimum yang kamu isi di data barang.'}
27
+ severity: warn
28
+ to: [owner, head_office, purchasing_manager]
@@ -2,6 +2,7 @@
2
2
  name: catat_tagih
3
3
  type: entry
4
4
  label: {id: Catat uang tertagih, en: Record cash collected}
5
+ description: {id: 'Catat uang yang kamu terima dari pelanggan saat menagih.'}
5
6
  icon: wallet
6
7
  # Cash taken at the subscriber's place (contract 0030 §2 entry): one field_collection. Opened from rute_tagih the
7
8
  # subscription is filled (stop); opened alone the collector picks it. The flows field_collection_cap_* refuse more
@@ -2,6 +2,7 @@
2
2
  name: rute_tagih
3
3
  type: route
4
4
  label: {id: Rute tagih, en: Collection route}
5
+ description: {id: 'Pelanggan yang perlu ditagih hari ini; check in di rumahnya, lalu catat uang tertagih.'}
5
6
  icon: map
6
7
  # The collector's day (plans/layar-kerja.md §3 #3, contract 0030 §2 route): subscribers of their area (row scope)
7
8
  # who still owe more than what is already deposited and waiting, with the distance from the phone; check in at the
@@ -0,0 +1,83 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
2
+ # Daily summary for the owner: 0 7 * * * (scheduler.timezone), and by the owner from the flow list. One business_summary record per
3
+ # period (summary_key is unique: a second run for the same period makes and tells nothing), then one notice to the
4
+ # owner (daily_summary, contract 0066) that links to it. The record keeps the exact figures; the notice text is the
5
+ # record's `message` (short amounts), so the same text works for mail now and WhatsApp later.
6
+ # - period: the day before the run day
7
+ # - sales: submitted sales invoices (grand total, before sales returns), cashier receipts and daily outlet sales of the period. An outlet
8
+ # and day has one sales source (outlets/outlet_day), so receipts and daily sales never count the same sale twice.
9
+ # - money in: submitted customer payments (not "Potong retur", method sales_return: no money moves), cashier receipts (cash, QRIS or card, all taken at the counter) and daily
10
+ # takings of the period.
11
+ # - invoices: submitted, money still owed, due within 7 days from the run day, or already overdue.
12
+ # - low stock: open stock_reorder rows (stock/stock_low_alert).
13
+ # Each source is read only when its module is installed (app_installed is checked first, so the variable of a skipped
14
+ # step is never read). The owner switches a summary off in the one summary_setting record (made on the first run with
15
+ # every summary on), and its mail in Pengaturan › Notifikasi. Digest mails are not a kernel feature (0066 "Not in this
16
+ # contract"), so this is an app flow.
17
+ # The run day is today, or event.as_of (YYYY-MM-DD) when the owner runs the flow by hand for another day (and in tests).
18
+ name: summary_daily
19
+ label: {id: Ringkasan harian untuk pemilik, en: Daily summary for the owner}
20
+ description: {id: 'Tiap pagi jam 07.00, pemilik menerima ringkasan kemarin: penjualan, uang masuk, faktur yang jatuh tempo dan stok yang menipis.'}
21
+ schedule: '0 7 * * *'
22
+ steps:
23
+ - {find: summary_setting, as: cfg}
24
+ - create: summary_setting
25
+ if: cfg == null
26
+ set: {key: "'usaha'"}
27
+ as: cfg
28
+ - find: business_summary
29
+ where: "summary_key == 'daily|' + string(('as_of' in event ? event.as_of : today()) - duration(1))"
30
+ as: old
31
+ - find_all: sales_invoice
32
+ if: "cfg.daily && old == null && app_installed('invoicing')"
33
+ where: "docstatus == 1 && posting_date == ('as_of' in event ? event.as_of : today()) - duration(1)"
34
+ as: inv
35
+ - find_all: pos_sale
36
+ if: "cfg.daily && old == null && app_installed('pos')"
37
+ where: "docstatus == 1 && date == ('as_of' in event ? event.as_of : today()) - duration(1)"
38
+ as: receipts
39
+ - find_all: outlet_sales
40
+ if: "cfg.daily && old == null && app_installed('outlet_sales')"
41
+ where: "docstatus == 1 && date == ('as_of' in event ? event.as_of : today()) - duration(1)"
42
+ as: daily
43
+ - find_all: outlet_takings
44
+ if: "cfg.daily && old == null && app_installed('outlet_sales')"
45
+ where: "docstatus == 1 && date == ('as_of' in event ? event.as_of : today()) - duration(1)"
46
+ as: takings
47
+ - find_all: payment
48
+ if: "cfg.daily && old == null && app_installed('payments')"
49
+ where: "docstatus == 1 && direction == 'receive' && method != 'sales_return' && payment_date == ('as_of' in event ? event.as_of : today()) - duration(1)"
50
+ as: paid
51
+ - find_all: sales_invoice
52
+ if: "cfg.daily && old == null && app_installed('invoicing')"
53
+ where: "docstatus == 1 && due_date <= ('as_of' in event ? event.as_of : today()) + duration(6) && due_date != '' && outstanding > 0"
54
+ as: owed
55
+ - find_all: stock_reorder
56
+ if: "cfg.daily && old == null && app_installed('stock')"
57
+ where: open
58
+ as: low
59
+ - create: business_summary
60
+ if: "cfg.daily && old == null"
61
+ set:
62
+ period: "'daily'"
63
+ date_from: "('as_of' in event ? event.as_of : today()) - duration(1)"
64
+ date_to: "('as_of' in event ? event.as_of : today()) - duration(1)"
65
+ summary_key: "'daily|' + string(('as_of' in event ? event.as_of : today()) - duration(1))"
66
+ setting: cfg.name
67
+ sales_total: "(app_installed('invoicing') ? inv.map(i, i.grand_total).sum() : 0) + (app_installed('pos') ? receipts.map(i, i.grand_total).sum() : 0) + (app_installed('outlet_sales') ? daily.map(i, i.net_total).sum() : 0)"
68
+ sales_count: "(app_installed('invoicing') ? size(inv) : 0) + (app_installed('pos') ? size(receipts) : 0) + (app_installed('outlet_sales') ? size(daily) : 0)"
69
+ cash_in: "(app_installed('payments') ? paid.map(i, i.amount).sum() : 0) + (app_installed('pos') ? receipts.map(i, i.grand_total).sum() : 0) + (app_installed('outlet_sales') ? takings.map(i, i.received_total).sum() : 0)"
70
+ due_count: "app_installed('invoicing') ? owed.filter(i, i.due_date >= ('as_of' in event ? event.as_of : today())).size() : 0"
71
+ due_total: "app_installed('invoicing') ? owed.filter(i, i.due_date >= ('as_of' in event ? event.as_of : today())).map(i, i.outstanding).sum() : 0"
72
+ overdue_count: "app_installed('invoicing') ? owed.filter(i, i.due_date < ('as_of' in event ? event.as_of : today())).size() : 0"
73
+ overdue_total: "app_installed('invoicing') ? owed.filter(i, i.due_date < ('as_of' in event ? event.as_of : today())).map(i, i.outstanding).sum() : 0"
74
+ low_stock_count: "app_installed('stock') ? size(low) : 0"
75
+ as: s
76
+ - notify: owner
77
+ if: "cfg.daily && old == null"
78
+ notice: daily_summary
79
+ channel: email
80
+ record: s
81
+ id: "'daily:' + string(s.date_to)"
82
+ title: '{s.title}'
83
+ template: '{s.message}'
@@ -0,0 +1,83 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
2
+ # Monthly summary for the owner: 10 7 1 * * (scheduler.timezone), and by the owner from the flow list. One business_summary record per
3
+ # period (summary_key is unique: a second run for the same period makes and tells nothing), then one notice to the
4
+ # owner (monthly_summary, contract 0066) that links to it. The record keeps the exact figures; the notice text is the
5
+ # record's `message` (short amounts), so the same text works for mail now and WhatsApp later.
6
+ # - period: one month back from the run day (run on the 1st: the whole previous month)
7
+ # - sales: submitted sales invoices (grand total, before sales returns), cashier receipts and daily outlet sales of the period. An outlet
8
+ # and day has one sales source (outlets/outlet_day), so receipts and daily sales never count the same sale twice.
9
+ # - money in: submitted customer payments (not "Potong retur", method sales_return: no money moves), cashier receipts (cash, QRIS or card, all taken at the counter) and daily
10
+ # takings of the period.
11
+ # - invoices: submitted, money still owed, due within 7 days from the run day, or already overdue.
12
+ # - low stock: open stock_reorder rows (stock/stock_low_alert).
13
+ # Each source is read only when its module is installed (app_installed is checked first, so the variable of a skipped
14
+ # step is never read). The owner switches a summary off in the one summary_setting record (made on the first run with
15
+ # every summary on), and its mail in Pengaturan › Notifikasi. Digest mails are not a kernel feature (0066 "Not in this
16
+ # contract"), so this is an app flow.
17
+ # The run day is today, or event.as_of (YYYY-MM-DD) when the owner runs the flow by hand for another day (and in tests).
18
+ name: summary_monthly
19
+ label: {id: Ringkasan bulanan untuk pemilik, en: Monthly summary for the owner}
20
+ description: {id: 'Tiap tanggal 1, pemilik menerima ringkasan sebulan terakhir: penjualan, uang masuk, faktur yang jatuh tempo dan stok yang menipis.'}
21
+ schedule: '10 7 1 * *'
22
+ steps:
23
+ - {find: summary_setting, as: cfg}
24
+ - create: summary_setting
25
+ if: cfg == null
26
+ set: {key: "'usaha'"}
27
+ as: cfg
28
+ - find: business_summary
29
+ where: "summary_key == 'monthly|' + string(('as_of' in event ? event.as_of : today()) - duration(1))"
30
+ as: old
31
+ - find_all: sales_invoice
32
+ if: "cfg.monthly && old == null && app_installed('invoicing')"
33
+ where: "docstatus == 1 && posting_date >= add_months(('as_of' in event ? event.as_of : today()), -1) && posting_date < ('as_of' in event ? event.as_of : today())"
34
+ as: inv
35
+ - find_all: pos_sale
36
+ if: "cfg.monthly && old == null && app_installed('pos')"
37
+ where: "docstatus == 1 && date >= add_months(('as_of' in event ? event.as_of : today()), -1) && date < ('as_of' in event ? event.as_of : today())"
38
+ as: receipts
39
+ - find_all: outlet_sales
40
+ if: "cfg.monthly && old == null && app_installed('outlet_sales')"
41
+ where: "docstatus == 1 && date >= add_months(('as_of' in event ? event.as_of : today()), -1) && date < ('as_of' in event ? event.as_of : today())"
42
+ as: daily
43
+ - find_all: outlet_takings
44
+ if: "cfg.monthly && old == null && app_installed('outlet_sales')"
45
+ where: "docstatus == 1 && date >= add_months(('as_of' in event ? event.as_of : today()), -1) && date < ('as_of' in event ? event.as_of : today())"
46
+ as: takings
47
+ - find_all: payment
48
+ if: "cfg.monthly && old == null && app_installed('payments')"
49
+ where: "docstatus == 1 && direction == 'receive' && method != 'sales_return' && payment_date >= add_months(('as_of' in event ? event.as_of : today()), -1) && payment_date < ('as_of' in event ? event.as_of : today())"
50
+ as: paid
51
+ - find_all: sales_invoice
52
+ if: "cfg.monthly && old == null && app_installed('invoicing')"
53
+ where: "docstatus == 1 && due_date <= ('as_of' in event ? event.as_of : today()) + duration(6) && due_date != '' && outstanding > 0"
54
+ as: owed
55
+ - find_all: stock_reorder
56
+ if: "cfg.monthly && old == null && app_installed('stock')"
57
+ where: open
58
+ as: low
59
+ - create: business_summary
60
+ if: "cfg.monthly && old == null"
61
+ set:
62
+ period: "'monthly'"
63
+ date_from: "add_months(('as_of' in event ? event.as_of : today()), -1)"
64
+ date_to: "('as_of' in event ? event.as_of : today()) - duration(1)"
65
+ summary_key: "'monthly|' + string(('as_of' in event ? event.as_of : today()) - duration(1))"
66
+ setting: cfg.name
67
+ sales_total: "(app_installed('invoicing') ? inv.map(i, i.grand_total).sum() : 0) + (app_installed('pos') ? receipts.map(i, i.grand_total).sum() : 0) + (app_installed('outlet_sales') ? daily.map(i, i.net_total).sum() : 0)"
68
+ sales_count: "(app_installed('invoicing') ? size(inv) : 0) + (app_installed('pos') ? size(receipts) : 0) + (app_installed('outlet_sales') ? size(daily) : 0)"
69
+ cash_in: "(app_installed('payments') ? paid.map(i, i.amount).sum() : 0) + (app_installed('pos') ? receipts.map(i, i.grand_total).sum() : 0) + (app_installed('outlet_sales') ? takings.map(i, i.received_total).sum() : 0)"
70
+ due_count: "app_installed('invoicing') ? owed.filter(i, i.due_date >= ('as_of' in event ? event.as_of : today())).size() : 0"
71
+ due_total: "app_installed('invoicing') ? owed.filter(i, i.due_date >= ('as_of' in event ? event.as_of : today())).map(i, i.outstanding).sum() : 0"
72
+ overdue_count: "app_installed('invoicing') ? owed.filter(i, i.due_date < ('as_of' in event ? event.as_of : today())).size() : 0"
73
+ overdue_total: "app_installed('invoicing') ? owed.filter(i, i.due_date < ('as_of' in event ? event.as_of : today())).map(i, i.outstanding).sum() : 0"
74
+ low_stock_count: "app_installed('stock') ? size(low) : 0"
75
+ as: s
76
+ - notify: owner
77
+ if: "cfg.monthly && old == null"
78
+ notice: monthly_summary
79
+ channel: email
80
+ record: s
81
+ id: "'monthly:' + string(s.date_to)"
82
+ title: '{s.title}'
83
+ template: '{s.message}'
@@ -0,0 +1,83 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
2
+ # Weekly summary for the owner: 5 7 * * 1 (scheduler.timezone), and by the owner from the flow list. One business_summary record per
3
+ # period (summary_key is unique: a second run for the same period makes and tells nothing), then one notice to the
4
+ # owner (weekly_summary, contract 0066) that links to it. The record keeps the exact figures; the notice text is the
5
+ # record's `message` (short amounts), so the same text works for mail now and WhatsApp later.
6
+ # - period: the 7 days before the run day (run on Monday: Monday to Sunday of last week)
7
+ # - sales: submitted sales invoices (grand total, before sales returns), cashier receipts and daily outlet sales of the period. An outlet
8
+ # and day has one sales source (outlets/outlet_day), so receipts and daily sales never count the same sale twice.
9
+ # - money in: submitted customer payments (not "Potong retur", method sales_return: no money moves), cashier receipts (cash, QRIS or card, all taken at the counter) and daily
10
+ # takings of the period.
11
+ # - invoices: submitted, money still owed, due within 7 days from the run day, or already overdue.
12
+ # - low stock: open stock_reorder rows (stock/stock_low_alert).
13
+ # Each source is read only when its module is installed (app_installed is checked first, so the variable of a skipped
14
+ # step is never read). The owner switches a summary off in the one summary_setting record (made on the first run with
15
+ # every summary on), and its mail in Pengaturan › Notifikasi. Digest mails are not a kernel feature (0066 "Not in this
16
+ # contract"), so this is an app flow.
17
+ # The run day is today, or event.as_of (YYYY-MM-DD) when the owner runs the flow by hand for another day (and in tests).
18
+ name: summary_weekly
19
+ label: {id: Ringkasan mingguan untuk pemilik, en: Weekly summary for the owner}
20
+ description: {id: 'Tiap Senin pagi, pemilik menerima ringkasan 7 hari terakhir: penjualan, uang masuk, faktur yang jatuh tempo dan stok yang menipis.'}
21
+ schedule: '5 7 * * 1'
22
+ steps:
23
+ - {find: summary_setting, as: cfg}
24
+ - create: summary_setting
25
+ if: cfg == null
26
+ set: {key: "'usaha'"}
27
+ as: cfg
28
+ - find: business_summary
29
+ where: "summary_key == 'weekly|' + string(('as_of' in event ? event.as_of : today()) - duration(1))"
30
+ as: old
31
+ - find_all: sales_invoice
32
+ if: "cfg.weekly && old == null && app_installed('invoicing')"
33
+ where: "docstatus == 1 && posting_date >= ('as_of' in event ? event.as_of : today()) - duration(7) && posting_date < ('as_of' in event ? event.as_of : today())"
34
+ as: inv
35
+ - find_all: pos_sale
36
+ if: "cfg.weekly && old == null && app_installed('pos')"
37
+ where: "docstatus == 1 && date >= ('as_of' in event ? event.as_of : today()) - duration(7) && date < ('as_of' in event ? event.as_of : today())"
38
+ as: receipts
39
+ - find_all: outlet_sales
40
+ if: "cfg.weekly && old == null && app_installed('outlet_sales')"
41
+ where: "docstatus == 1 && date >= ('as_of' in event ? event.as_of : today()) - duration(7) && date < ('as_of' in event ? event.as_of : today())"
42
+ as: daily
43
+ - find_all: outlet_takings
44
+ if: "cfg.weekly && old == null && app_installed('outlet_sales')"
45
+ where: "docstatus == 1 && date >= ('as_of' in event ? event.as_of : today()) - duration(7) && date < ('as_of' in event ? event.as_of : today())"
46
+ as: takings
47
+ - find_all: payment
48
+ if: "cfg.weekly && old == null && app_installed('payments')"
49
+ where: "docstatus == 1 && direction == 'receive' && method != 'sales_return' && payment_date >= ('as_of' in event ? event.as_of : today()) - duration(7) && payment_date < ('as_of' in event ? event.as_of : today())"
50
+ as: paid
51
+ - find_all: sales_invoice
52
+ if: "cfg.weekly && old == null && app_installed('invoicing')"
53
+ where: "docstatus == 1 && due_date <= ('as_of' in event ? event.as_of : today()) + duration(6) && due_date != '' && outstanding > 0"
54
+ as: owed
55
+ - find_all: stock_reorder
56
+ if: "cfg.weekly && old == null && app_installed('stock')"
57
+ where: open
58
+ as: low
59
+ - create: business_summary
60
+ if: "cfg.weekly && old == null"
61
+ set:
62
+ period: "'weekly'"
63
+ date_from: "('as_of' in event ? event.as_of : today()) - duration(7)"
64
+ date_to: "('as_of' in event ? event.as_of : today()) - duration(1)"
65
+ summary_key: "'weekly|' + string(('as_of' in event ? event.as_of : today()) - duration(1))"
66
+ setting: cfg.name
67
+ sales_total: "(app_installed('invoicing') ? inv.map(i, i.grand_total).sum() : 0) + (app_installed('pos') ? receipts.map(i, i.grand_total).sum() : 0) + (app_installed('outlet_sales') ? daily.map(i, i.net_total).sum() : 0)"
68
+ sales_count: "(app_installed('invoicing') ? size(inv) : 0) + (app_installed('pos') ? size(receipts) : 0) + (app_installed('outlet_sales') ? size(daily) : 0)"
69
+ cash_in: "(app_installed('payments') ? paid.map(i, i.amount).sum() : 0) + (app_installed('pos') ? receipts.map(i, i.grand_total).sum() : 0) + (app_installed('outlet_sales') ? takings.map(i, i.received_total).sum() : 0)"
70
+ due_count: "app_installed('invoicing') ? owed.filter(i, i.due_date >= ('as_of' in event ? event.as_of : today())).size() : 0"
71
+ due_total: "app_installed('invoicing') ? owed.filter(i, i.due_date >= ('as_of' in event ? event.as_of : today())).map(i, i.outstanding).sum() : 0"
72
+ overdue_count: "app_installed('invoicing') ? owed.filter(i, i.due_date < ('as_of' in event ? event.as_of : today())).size() : 0"
73
+ overdue_total: "app_installed('invoicing') ? owed.filter(i, i.due_date < ('as_of' in event ? event.as_of : today())).map(i, i.outstanding).sum() : 0"
74
+ low_stock_count: "app_installed('stock') ? size(low) : 0"
75
+ as: s
76
+ - notify: owner
77
+ if: "cfg.weekly && old == null"
78
+ notice: weekly_summary
79
+ channel: email
80
+ record: s
81
+ id: "'weekly:' + string(s.date_to)"
82
+ title: '{s.title}'
83
+ template: '{s.message}'
@@ -0,0 +1,67 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/model.json
2
+ # One record per summary sent to the owner (flows summary_daily, summary_weekly, summary_monthly): the figures of the
3
+ # period as they were on the morning of the run, kept so the notice can link to them and the owner can look back.
4
+ # Written only by those flows; every field is read_only and no role but the owner reads it (the figures are the whole
5
+ # business's sales and money). summary_key (period|date_to) is unique: one summary per period.
6
+ # `message` is the text of the notice: amounts shortened (12,5 juta; 850 ribu) so it stays a short message for mail
7
+ # now and WhatsApp later; the currency fields hold the exact figures.
8
+ name: business_summary
9
+ label: {id: Ringkasan usaha, en: Business summary}
10
+ icon: bar-chart-box-line
11
+ naming: RKS-{YYYY}-{#####}
12
+ title_field: title
13
+ # An empty list: the model is closed to every role, so only the owner (and the flows the kernel starts) reads it.
14
+ permissions: []
15
+ fields:
16
+ - name: period
17
+ type: select
18
+ label: {id: Jenis ringkasan}
19
+ required: true
20
+ read_only: true
21
+ in_list: true
22
+ options:
23
+ - {value: daily, label: {id: Harian}}
24
+ - {value: weekly, label: {id: Mingguan}}
25
+ - {value: monthly, label: {id: Bulanan}}
26
+ - {name: date_from, type: date, label: {id: Dari tanggal}, read_only: true, in_list: true}
27
+ - {name: date_to, type: date, label: {id: Sampai tanggal}, read_only: true, in_list: true}
28
+ - {name: summary_key, type: data, label: {id: Kunci}, required: true, unique: true, read_only: true}
29
+ - {name: title, type: data, label: {id: Judul}, compute: "(period == 'daily' ? 'Ringkasan harian ' : (period == 'weekly' ? 'Ringkasan mingguan sampai ' : 'Ringkasan bulanan sampai ')) + string(date_to)"}
30
+ - {name: sales_total, type: currency, label: {id: Penjualan}, read_only: true, in_list: true}
31
+ - {name: sales_count, type: int, label: {id: Transaksi tercatat}, read_only: true, in_list: true}
32
+ - {name: cash_in, type: currency, label: {id: Uang masuk}, read_only: true, in_list: true}
33
+ - {name: due_count, type: int, label: {id: Faktur jatuh tempo 7 hari ke depan}, read_only: true, depends_on: app_installed('invoicing')}
34
+ - {name: due_total, type: currency, label: {id: Sisa tagihan jatuh tempo 7 hari ke depan}, read_only: true, depends_on: app_installed('invoicing')}
35
+ - {name: overdue_count, type: int, label: {id: Faktur lewat jatuh tempo}, read_only: true, depends_on: app_installed('invoicing')}
36
+ - {name: overdue_total, type: currency, label: {id: Sisa tagihan lewat jatuh tempo}, read_only: true, depends_on: app_installed('invoicing')}
37
+ - {name: low_stock_count, type: int, label: {id: Barang di bawah batas stok minimum}, read_only: true, depends_on: app_installed('stock')}
38
+ - name: message
39
+ type: text
40
+ label: {id: Ringkasan}
41
+ compute: >-
42
+ (period == 'daily' ? 'Kemarin' : (period == 'weekly' ? '7 hari terakhir' : 'Sebulan terakhir')) + ': penjualan Rp ' + (int(sales_total) >= 1000000000 ? string(int(sales_total) / 1000000000) + ',' + string(int(sales_total) / 100000000 % 10) + ' miliar' : (int(sales_total) >= 1000000 ? string(int(sales_total) / 1000000) + ',' + string(int(sales_total) / 100000 % 10) + ' juta' : (int(sales_total) >= 1000 ? string(int(sales_total) / 1000) + ' ribu' : string(int(sales_total))))) + ' dari ' + string(sales_count) + ' transaksi, uang masuk Rp ' + (int(cash_in) >= 1000000000 ? string(int(cash_in) / 1000000000) + ',' + string(int(cash_in) / 100000000 % 10) + ' miliar' : (int(cash_in) >= 1000000 ? string(int(cash_in) / 1000000) + ',' + string(int(cash_in) / 100000 % 10) + ' juta' : (int(cash_in) >= 1000 ? string(int(cash_in) / 1000) + ' ribu' : string(int(cash_in))))) + '.' + (app_installed('invoicing') ? ' Jatuh tempo 7 hari ke depan: ' + string(due_count) + ' faktur (Rp ' + (int(due_total) >= 1000000000 ? string(int(due_total) / 1000000000) + ',' + string(int(due_total) / 100000000 % 10) + ' miliar' : (int(due_total) >= 1000000 ? string(int(due_total) / 1000000) + ',' + string(int(due_total) / 100000 % 10) + ' juta' : (int(due_total) >= 1000 ? string(int(due_total) / 1000) + ' ribu' : string(int(due_total))))) + '). Lewat jatuh tempo: ' + string(overdue_count) + ' faktur (Rp ' + (int(overdue_total) >= 1000000000 ? string(int(overdue_total) / 1000000000) + ',' + string(int(overdue_total) / 100000000 % 10) + ' miliar' : (int(overdue_total) >= 1000000 ? string(int(overdue_total) / 1000000) + ',' + string(int(overdue_total) / 100000 % 10) + ' juta' : (int(overdue_total) >= 1000 ? string(int(overdue_total) / 1000) + ' ribu' : string(int(overdue_total))))) + ').' : '') + (app_installed('stock') ? ' Stok di bawah batas minimum: ' + string(low_stock_count) + ' barang.' : '')
43
+ - name: setting
44
+ type: link
45
+ to: summary_setting
46
+ label: {id: Pengaturan ringkasan}
47
+ help: {id: 'Buka untuk mematikan ringkasan harian, mingguan atau bulanan'}
48
+ read_only: true
49
+ views:
50
+ list:
51
+ columns: [title, period, date_to, sales_total, sales_count, cash_in]
52
+ filters: [period]
53
+ sort: -date_to
54
+ form:
55
+ layout:
56
+ - section: {id: Ringkasan}
57
+ fields: [message]
58
+ - section: {id: Penjualan dan uang masuk}
59
+ columns:
60
+ - [period, date_from, date_to]
61
+ - [sales_total, sales_count, cash_in]
62
+ - section: {id: Tagihan dan stok}
63
+ columns:
64
+ - [due_count, due_total]
65
+ - [overdue_count, overdue_total, low_stock_count]
66
+ - section: {id: Pengaturan}
67
+ fields: [setting]
@@ -0,0 +1,35 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/model.json
2
+ # The owner's switches for the summaries (flows summary_daily, summary_weekly, summary_monthly). One record per
3
+ # business: `key` is unique and always 'usaha', and the first run of a summary flow makes the record with every
4
+ # summary on. Unticking a summary stops its record, its notice and its mail; the mail alone is switched off per
5
+ # person in Pengaturan › Notifikasi. No role but the owner reads or changes it.
6
+ name: summary_setting
7
+ label: {id: Pengaturan ringkasan, en: Summary settings}
8
+ icon: settings-3-line
9
+ naming: RKP-{##}
10
+ title_field: title
11
+ # An empty list: the model is closed to every role, so only the owner reads and changes it.
12
+ permissions: []
13
+ fields:
14
+ - {name: key, type: data, label: {id: Kunci}, default: "'usaha'", required: true, unique: true, read_only: true}
15
+ - {name: title, type: data, label: {id: Nama}, compute: "'Pengaturan ringkasan'"}
16
+ - name: daily
17
+ type: check
18
+ label: {id: Kirim ringkasan harian}
19
+ help: {id: 'Tiap pagi jam 07.00: penjualan dan uang masuk kemarin, faktur yang jatuh tempo, stok yang menipis'}
20
+ default: 'true'
21
+ - name: weekly
22
+ type: check
23
+ label: {id: Kirim ringkasan mingguan}
24
+ help: {id: 'Tiap Senin pagi: 7 hari terakhir'}
25
+ default: 'true'
26
+ - name: monthly
27
+ type: check
28
+ label: {id: Kirim ringkasan bulanan}
29
+ help: {id: 'Tiap tanggal 1: sebulan terakhir'}
30
+ default: 'true'
31
+ views:
32
+ form:
33
+ layout:
34
+ - section: {id: Ringkasan yang dikirim ke kamu}
35
+ fields: [daily, weekly, monthly]
@@ -14,6 +14,8 @@ permissions:
14
14
  - {role: sales_rep, read: true}
15
15
  - {role: field_sales, read: true}
16
16
  - {role: course_admin, read: true}
17
+ # module attendance: the outlet supervisor reads the names of the staff whose clock-ins they decide
18
+ - {role: outlet_supervisor, read: true}
17
19
  fields:
18
20
  - name: full_name
19
21
  type: data
@@ -26,12 +28,12 @@ fields:
26
28
  - name: phone
27
29
  type: phone
28
30
  label: {id: Nomor telepon}
29
- hidden_for: [cashier, collector, course_admin, field_sales, field_worker, finance_manager, instructor, kitchen, outlet_staff, project_admin, purchasing_manager, rental_staff, sales_manager, sales_rep, site_supervisor]
31
+ hidden_for: [cashier, collector, course_admin, employee, field_sales, field_worker, finance_manager, instructor, kitchen, outlet_staff, outlet_supervisor, project_admin, purchasing_manager, rental_staff, sales_manager, sales_rep, site_supervisor]
30
32
  - name: email
31
33
  type: data
32
34
  label: {id: Email}
33
35
  read_only: true
34
- hidden_for: [cashier, collector, course_admin, field_sales, field_worker, finance_manager, instructor, kitchen, outlet_staff, project_admin, purchasing_manager, rental_staff, sales_manager, sales_rep, site_supervisor]
36
+ hidden_for: [cashier, collector, course_admin, employee, field_sales, field_worker, finance_manager, instructor, kitchen, outlet_staff, outlet_supervisor, project_admin, purchasing_manager, rental_staff, sales_manager, sales_rep, site_supervisor]
35
37
  - name: role
36
38
  type: data
37
39
  label: {id: Peran}
@@ -55,4 +57,10 @@ fields:
55
57
  type: int
56
58
  label: {id: ID akun}
57
59
  read_only: true
58
- hidden_for: [cashier, collector, course_admin, field_sales, field_worker, finance_manager, head_office, instructor, kitchen, outlet_staff, project_admin, purchasing_manager, rental_staff, sales_manager, sales_rep, site_supervisor]
60
+ hidden_for: [cashier, collector, course_admin, employee, field_sales, field_worker, finance_manager, head_office, instructor, kitchen, outlet_staff, outlet_supervisor, project_admin, purchasing_manager, rental_staff, sales_manager, sales_rep, site_supervisor]
61
+ # module attendance: owner, office manager or anyone not expected to clock in. Left out of the monthly attendance
62
+ # summary (attendance_period_on_submit). Set by the owner on the employee record.
63
+ - name: attendance_exempt
64
+ type: check
65
+ label: {id: Tidak wajib absen}
66
+ depends_on: app_installed('attendance')
@@ -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: users
3
- version: 1.3.0
3
+ version: 1.5.0
4
4
  title: {id: Karyawan, en: Employees}
5
5
  summary:
6
6
  id: Orang yang memakai Rangka di usaha kamu.
@@ -8,4 +8,23 @@ summary:
8
8
  category: people
9
9
  icon: user-line
10
10
  requires: {rangka: '>=0.5'}
11
- optional: {outlets: ^1.5}
11
+ optional: {outlets: ^1.5, invoicing: ^1.0, payments: ^1.0, outlet_sales: ^1.0, pos: ^1.0, stock: ^1.4}
12
+ # The owner's summaries (flows summary_daily, summary_weekly, summary_monthly; models business_summary and
13
+ # summary_setting) live here because users is the one module every installation has: the flows read the sales, money
14
+ # and stock modules only when they are installed (optional above). Notices of contract 0066 §1.1, to the owner only.
15
+ notices:
16
+ - name: daily_summary
17
+ label: {id: Ringkasan harian, en: Daily summary}
18
+ description: {id: 'Tiap pagi: penjualan dan uang masuk kemarin, faktur yang jatuh tempo, stok yang menipis.'}
19
+ severity: info
20
+ to: [owner]
21
+ - name: weekly_summary
22
+ label: {id: Ringkasan mingguan, en: Weekly summary}
23
+ description: {id: 'Tiap Senin pagi: ringkasan 7 hari terakhir.'}
24
+ severity: info
25
+ to: [owner]
26
+ - name: monthly_summary
27
+ label: {id: Ringkasan bulanan, en: Monthly summary}
28
+ description: {id: 'Tiap tanggal 1: ringkasan sebulan terakhir.'}
29
+ severity: info
30
+ to: [owner]
@@ -0,0 +1,8 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/role.json
2
+ name: employee
3
+ label: {id: Karyawan}
4
+ description: {id: 'Karyawan yang hanya absen dari HP dan melihat absennya sendiri (staf dapur, gudang, kantor)'}
5
+ # Works from the phone: the clock screen full screen (work shell, contract 0030 §3), no sidebar. No row scope: every
6
+ # model that grants this role reads only the member's own rows through its permission if: (employee == user.name).
7
+ # Kept as a role once the member grant of the employee app (rangka-os#261) lands.
8
+ desk: false
@@ -0,0 +1,7 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/role.json
2
+ name: outlet_supervisor
3
+ label: {id: Kepala outlet}
4
+ description: {id: 'Melihat absen outlet yang dia pegang dan menyetujui absen di luar radius atau lembur'}
5
+ # Contract 0010 §5: only records of the member's outlets (the outlets set in Tim). Added with module attendance
6
+ # (rangka-apps#100); leave, reimbursement and shifts (rangka-apps#114, #117, #120) reuse it for their approvals.
7
+ scope: {field: outlet, from: user.outlets}
@@ -0,0 +1,16 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
2
+ # Staff tick "Tidak mau dikirimi WA" on a customer: the number goes on this business's list and Rangka Cloud is told
3
+ # (rangka_whatsapp.set_opt_out, which only ever adds to its list). Unticking later does not take the number off
4
+ # either list: a customer comes back only by their own action. Runs inside the customer's save, as the writer.
5
+ name: whatsapp_customer_opt_out
6
+ label: {id: 'Pelanggan ditandai tidak mau dikirimi WA'}
7
+ on: customer.updated
8
+ if: "event.wa_opt_out && event.wa_number != '' && (event.before == null || !event.before.wa_opt_out || event.before.wa_number != event.wa_number)"
9
+ idempotency: "'optout:' + event.wa_number"
10
+ steps:
11
+ - {find: whatsapp_opt_out, where: number == event.wa_number, as: known}
12
+ - create: whatsapp_opt_out
13
+ if: known == null
14
+ set: {number: event.wa_number, source: "'staff'", customer: event.name}
15
+ - call: rangka_whatsapp.set_opt_out
16
+ with: {phone: "'+' + event.wa_number"}
@@ -0,0 +1,17 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
2
+ # A customer saved for the first time with "Tidak mau dikirimi WA" ticked: the same as flow
3
+ # whatsapp_customer_opt_out. Staff tick "Tidak mau dikirimi WA" on a customer: the number goes on this business's list and Rangka Cloud is told
4
+ # (rangka_whatsapp.set_opt_out, which only ever adds to its list). Unticking later does not take the number off
5
+ # either list: a customer comes back only by their own action. Runs inside the customer's save, as the writer.
6
+ name: whatsapp_customer_opt_out_new
7
+ label: {id: 'Pelanggan baru tidak mau dikirimi WA'}
8
+ on: customer.created
9
+ if: "event.wa_opt_out && event.wa_number != ''"
10
+ idempotency: "'optout:' + event.wa_number"
11
+ steps:
12
+ - {find: whatsapp_opt_out, where: number == event.wa_number, as: known}
13
+ - create: whatsapp_opt_out
14
+ if: known == null
15
+ set: {number: event.wa_number, source: "'staff'", customer: event.name}
16
+ - call: rangka_whatsapp.set_opt_out
17
+ with: {phone: "'+' + event.wa_number"}