@rangka-os/create 0.5.0-alpha.26 → 0.5.0-alpha.28
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.
- package/package.json +1 -1
- package/template/base/apps/absen_karyawan/app.rk +37 -0
- package/template/base/apps/absen_karyawan/dashboards/absen_hari_ini.rk +20 -0
- package/template/base/apps/absen_karyawan/dashboards/absen_karyawan_saya.rk +14 -0
- package/template/base/apps/absen_karyawan/dashboards/rekap_absen_karyawan.rk +12 -0
- package/template/base/apps/jasa_proyek/app.rk +1 -1
- package/template/base/apps/kasir/app.rk +5 -1
- package/template/base/apps/kasir/dashboards/kasir_ringkas.rk +4 -0
- package/template/base/apps/kasir/skills/rangka-app-kasir/SKILL.md +20 -0
- package/template/base/connectors/email/connector.rk +144 -0
- package/template/base/connectors/email/fixtures/email_received.json +33 -0
- package/template/base/connectors/email/fixtures/email_received_reply.json +31 -0
- package/template/base/connectors/email/fixtures/expect.json +20 -0
- package/template/base/connectors/email/fixtures/fetch_email.json +66 -0
- package/template/base/connectors/email/fixtures/send_email.json +4 -0
- package/template/base/connectors/midtrans/connector.rk +249 -0
- package/template/base/connectors/midtrans/fixtures/charge_gopay.json +34 -0
- package/template/base/connectors/midtrans/fixtures/charge_qris.json +23 -0
- package/template/base/connectors/midtrans/fixtures/charge_va.json +20 -0
- package/template/base/connectors/midtrans/fixtures/create_snap.json +4 -0
- package/template/base/connectors/midtrans/fixtures/expect.json +88 -0
- package/template/base/connectors/midtrans/fixtures/get_status.json +15 -0
- package/template/base/connectors/midtrans/fixtures/payment_notified.json +28 -0
- package/template/base/connectors/midtrans/fixtures/payment_notified_challenge.json +24 -0
- package/template/base/connectors/midtrans/fixtures/payment_notified_expire.json +24 -0
- package/template/base/connectors/midtrans/fixtures/payment_notified_other_amount.json +28 -0
- package/template/base/connectors/midtrans/fixtures/payment_notified_partial_refund.json +34 -0
- package/template/base/connectors/midtrans/fixtures/payment_notified_pending.json +31 -0
- package/template/base/connectors/midtrans/fixtures/payment_notified_refund.json +34 -0
- package/template/base/connectors/midtrans/fixtures/payment_notified_relabelled.json +28 -0
- package/template/base/connectors/midtrans/fixtures/payment_notified_va.json +32 -0
- package/template/base/connectors/midtrans/fixtures/signature_vector.txt +3 -0
- package/template/base/connectors/midtrans/mock/midtrans_mock.py +335 -0
- package/template/base/connectors/rangka_whatsapp/README.md +105 -0
- package/template/base/connectors/rangka_whatsapp/connector.rk +141 -0
- package/template/base/connectors/rangka_whatsapp/fixtures/expect.json +9 -0
- package/template/base/connectors/rangka_whatsapp/fixtures/message_received.json +1 -0
- package/template/base/connectors/rangka_whatsapp/fixtures/message_status.json +1 -0
- package/template/base/connectors/rangka_whatsapp/fixtures/message_status_refused.json +1 -0
- package/template/base/connectors/rangka_whatsapp/fixtures/opted_out.json +1 -0
- package/template/base/connectors/rangka_whatsapp/fixtures/send_template.json +1 -0
- package/template/base/connectors/rangka_whatsapp/fixtures/send_template_duplicate.json +1 -0
- package/template/base/connectors/rangka_whatsapp/fixtures/set_opt_out.json +1 -0
- package/template/base/connectors/rangka_whatsapp/mock/rangka_whatsapp_mock.py +354 -0
- package/template/base/connectors/shopee/connector.rk +360 -0
- package/template/base/connectors/shopee/fixtures/expect.json +119 -0
- package/template/base/connectors/shopee/fixtures/get_models.json +52 -0
- package/template/base/connectors/shopee/fixtures/get_order_detail.json +396 -0
- package/template/base/connectors/shopee/fixtures/get_settlement.json +90 -0
- package/template/base/connectors/shopee/fixtures/get_tracking.json +13 -0
- package/template/base/connectors/shopee/fixtures/list_items.json +29 -0
- package/template/base/connectors/shopee/fixtures/list_orders.json +31 -0
- package/template/base/connectors/shopee/fixtures/list_settlements.json +15 -0
- package/template/base/connectors/shopee/fixtures/order_changed.json +101 -0
- package/template/base/connectors/shopee/fixtures/order_changed_cancelled.json +72 -0
- package/template/base/connectors/shopee/fixtures/order_changed_completed.json +101 -0
- package/template/base/connectors/shopee/fixtures/order_changed_in_cancel.json +72 -0
- package/template/base/connectors/shopee/fixtures/order_changed_unpaid.json +71 -0
- package/template/base/connectors/shopee/fixtures/order_settled.json +92 -0
- package/template/base/connectors/shopee/fixtures/push_received.json +12 -0
- package/template/base/connectors/shopee/fixtures/push_received_tracking.json +11 -0
- package/template/base/connectors/shopee/fixtures/update_stock.json +15 -0
- package/template/base/connectors/shopee/mock/shopee_mock.py +894 -0
- package/template/base/connectors/tiktok_shop/connector.rk +300 -0
- package/template/base/connectors/tiktok_shop/fixtures/expect.json +105 -0
- package/template/base/connectors/tiktok_shop/fixtures/get_order_detail.json +136 -0
- package/template/base/connectors/tiktok_shop/fixtures/get_settlement.json +83 -0
- package/template/base/connectors/tiktok_shop/fixtures/get_tracking.json +28 -0
- package/template/base/connectors/tiktok_shop/fixtures/list_orders.json +242 -0
- package/template/base/connectors/tiktok_shop/fixtures/list_products.json +77 -0
- package/template/base/connectors/tiktok_shop/fixtures/list_settlements.json +22 -0
- package/template/base/connectors/tiktok_shop/fixtures/list_shops.json +17 -0
- package/template/base/connectors/tiktok_shop/fixtures/order_changed.json +129 -0
- package/template/base/connectors/tiktok_shop/fixtures/order_changed_cancelled.json +81 -0
- package/template/base/connectors/tiktok_shop/fixtures/order_changed_completed.json +106 -0
- package/template/base/connectors/tiktok_shop/fixtures/order_changed_on_hold.json +104 -0
- package/template/base/connectors/tiktok_shop/fixtures/order_changed_tokopedia.json +106 -0
- package/template/base/connectors/tiktok_shop/fixtures/order_changed_unpaid.json +79 -0
- package/template/base/connectors/tiktok_shop/fixtures/order_settled.json +73 -0
- package/template/base/connectors/tiktok_shop/fixtures/update_stock.json +6 -0
- package/template/base/connectors/tiktok_shop/fixtures/webhook_received.json +12 -0
- package/template/base/connectors/tiktok_shop/fixtures/webhook_received_cancellation.json +13 -0
- package/template/base/connectors/tiktok_shop/mock/tiktok_shop_mock.py +819 -0
- package/template/base/connectors/whatsapp_business/connector.rk +3 -1
- package/template/base/connectors/whatsapp_business/templates.md +13 -1
- package/template/base/modules/attendance/flows/attendance_missing_digest.rk +30 -0
- package/template/base/modules/attendance/flows/attendance_period_on_cancel.rk +15 -0
- package/template/base/modules/attendance/flows/attendance_period_on_submit.rk +60 -0
- package/template/base/modules/attendance/flows/staff_attendance_cancel_guard.rk +14 -0
- package/template/base/modules/attendance/flows/staff_attendance_guard_created.rk +16 -0
- package/template/base/modules/attendance/flows/staff_attendance_guard_submitted.rk +37 -0
- package/template/base/modules/attendance/flows/staff_attendance_guard_updated.rk +14 -0
- package/template/base/modules/attendance/models/attendance_period.rk +62 -0
- package/template/base/modules/attendance/models/attendance_summary.rk +37 -0
- package/template/base/modules/attendance/models/staff_attendance.rk +281 -0
- package/template/base/modules/attendance/models/staff_attendance_guard.rk +50 -0
- package/template/base/modules/attendance/module.rk +18 -0
- package/template/base/modules/attendance/screens/absen_outlet.rk +22 -0
- package/template/base/modules/catalogue/models/item.rk +69 -0
- package/template/base/modules/catalogue/module.rk +1 -1
- package/template/base/modules/contacts/models/customer.rk +43 -19
- package/template/base/modules/contacts/module.rk +1 -1
- package/template/base/modules/coretax/module.rk +1 -1
- package/template/base/modules/coretax/print/coretax_faktur.rk +3 -2
- package/template/base/modules/coretax/print/coretax_faktur.xml +3 -1
- package/template/base/modules/coretax/print/rekap_ppn.html +9 -7
- package/template/base/modules/courses/flows/charge_invoice_on_submit.rk +15 -0
- package/template/base/modules/courses/module.rk +1 -1
- package/template/base/modules/courses/screens/absen_kelas.rk +1 -0
- package/template/base/modules/invoicing/flows/invoice_due_digest.rk +45 -7
- package/template/base/modules/invoicing/models/sales_invoice_item.rk +4 -1
- package/template/base/modules/invoicing/module.rk +15 -2
- package/template/base/modules/kitchen/screens/dapur.rk +1 -0
- package/template/base/modules/outlets/models/outlet.rk +69 -0
- package/template/base/modules/outlets/module.rk +1 -1
- package/template/base/modules/payments/flows/payment_from_midtrans.rk +85 -0
- package/template/base/modules/payments/flows/payment_refund_from_midtrans.rk +22 -0
- package/template/base/modules/payments/models/payment.rk +2 -1
- package/template/base/modules/payments/module.rk +1 -1
- package/template/base/modules/payroll/flows/payroll_close_on_cancel.rk +8 -5
- package/template/base/modules/payroll/flows/payroll_close_on_submit.rk +8 -5
- package/template/base/modules/payroll/flows/payroll_reminder.rk +106 -0
- package/template/base/modules/payroll/flows/payroll_run_overlap_guard_created.rk +5 -3
- package/template/base/modules/payroll/flows/payroll_run_overlap_guard_updated.rk +5 -3
- package/template/base/modules/payroll/flows/payslip_from_recap.rk +1 -1
- package/template/base/modules/payroll/imports/payroll_profile_list.rk +27 -0
- package/template/base/modules/payroll/models/payroll_close.rk +10 -6
- package/template/base/modules/payroll/models/payroll_run.rk +64 -15
- package/template/base/modules/payroll/models/payslip.rk +48 -9
- package/template/base/modules/payroll/module.rk +22 -5
- package/template/base/modules/payroll/print/payslip.html +4 -1
- package/template/base/modules/pos/models/pos_sale.rk +136 -9
- package/template/base/modules/pos/models/pos_sale_item.rk +33 -1
- package/template/base/modules/pos/module.rk +5 -3
- package/template/base/modules/pos/print/pos_receipt.html +7 -3
- package/template/base/modules/pos/screens/kasir.rk +7 -2
- package/template/base/modules/procurement/flows/reorder_draft_po.rk +57 -0
- package/template/base/modules/procurement/models/vendor_bill.rk +14 -1
- package/template/base/modules/procurement/module.rk +11 -2
- package/template/base/modules/projects/screens/absen.rk +1 -0
- package/template/base/modules/promotions/flows/promo_code_batch_on_submit.rk +26 -0
- package/template/base/modules/promotions/flows/promotion_apply.rk +110 -0
- package/template/base/modules/promotions/flows/promotion_apply_on_create.rk +110 -0
- package/template/base/modules/promotions/flows/promotion_apply_on_delete.rk +111 -0
- package/template/base/modules/promotions/flows/promotion_apply_on_update.rk +110 -0
- package/template/base/modules/promotions/flows/promotion_on_sale.rk +95 -0
- package/template/base/modules/promotions/flows/promotion_on_sale_cancel.rk +43 -0
- package/template/base/modules/promotions/models/promo_code.rk +27 -0
- package/template/base/modules/promotions/models/promo_code_batch.rk +36 -0
- package/template/base/modules/promotions/models/promo_guard.rk +44 -0
- package/template/base/modules/promotions/models/promotion.rk +197 -0
- package/template/base/modules/promotions/models/promotion_ledger.rk +35 -0
- package/template/base/modules/promotions/module.rk +20 -0
- package/template/base/modules/rental/screens/alat_keluar.rk +1 -0
- package/template/base/modules/rental/screens/alat_kembali.rk +1 -0
- package/template/base/modules/rental/screens/jadwal_alat.rk +1 -0
- package/template/base/modules/stock/flows/stock_low_alert.rk +65 -0
- package/template/base/modules/stock/flows/stock_negative_alert.rk +14 -5
- package/template/base/modules/stock/models/stock_reorder.rk +34 -0
- package/template/base/modules/stock/module.rk +17 -2
- package/template/base/modules/subscriptions/screens/catat_tagih.rk +1 -0
- package/template/base/modules/subscriptions/screens/rute_tagih.rk +1 -0
- package/template/base/modules/users/flows/summary_daily.rk +83 -0
- package/template/base/modules/users/flows/summary_monthly.rk +83 -0
- package/template/base/modules/users/flows/summary_weekly.rk +83 -0
- package/template/base/modules/users/models/business_summary.rk +67 -0
- package/template/base/modules/users/models/summary_setting.rk +35 -0
- package/template/base/modules/users/models/user.rk +11 -3
- package/template/base/modules/users/module.rk +21 -2
- package/template/base/modules/users/roles/employee.rk +8 -0
- package/template/base/modules/users/roles/outlet_supervisor.rk +7 -0
- package/template/base/modules/whatsapp/flows/whatsapp_customer_opt_out.rk +16 -0
- package/template/base/modules/whatsapp/flows/whatsapp_customer_opt_out_new.rk +17 -0
- package/template/base/modules/whatsapp/flows/whatsapp_message_status.rk +24 -0
- package/template/base/modules/whatsapp/flows/whatsapp_opted_out.rk +26 -0
- package/template/base/modules/whatsapp/models/whatsapp_message.rk +99 -0
- package/template/base/modules/whatsapp/models/whatsapp_opt_out.rk +44 -0
- package/template/base/modules/whatsapp/module.rk +23 -0
- package/template/base/modules/whatsapp_booking/flows/whatsapp_booking_tomorrow.rk +48 -0
- package/template/base/modules/whatsapp_booking/module.rk +13 -0
- package/template/base/modules/whatsapp_order_ready/flows/whatsapp_pickup_on_sale.rk +19 -0
- package/template/base/modules/whatsapp_order_ready/flows/whatsapp_ticket_ready.rk +40 -0
- package/template/base/modules/whatsapp_order_ready/models/whatsapp_pickup.rk +22 -0
- package/template/base/modules/whatsapp_order_ready/module.rk +14 -0
- package/template/base/modules/whatsapp_receipt/flows/whatsapp_receipt_on_sale.rk +43 -0
- package/template/base/modules/whatsapp_receipt/module.rk +13 -0
- package/template/base/modules/whatsapp_reminder/flows/whatsapp_invoice_overdue.rk +64 -0
- package/template/base/modules/whatsapp_reminder/module.rk +15 -0
- package/template/base/modules/workforce/imports/worker_list.rk +4 -1
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
|
|
2
|
+
# Every morning at 06:30 (scheduler.timezone), and by the owner from the flow list: balances below their item's
|
|
3
|
+
# reorder level (item.reorder_level > 0) are compared with the open stock_reorder rows.
|
|
4
|
+
# - a row whose balance is no longer below its item's level (or whose item is no longer watched) is closed;
|
|
5
|
+
# - a balance below the level without an open row gets one, with the figures of today;
|
|
6
|
+
# - head office is told once, about the balances that are new today (notice stock_low). A balance that stays low
|
|
7
|
+
# tells nobody again until it recovered and fell once more.
|
|
8
|
+
# Nothing is ordered here: procurement/reorder_draft_po turns the open rows into draft purchase orders.
|
|
9
|
+
# `marks` is read before the rows are closed and opened, so the filters below see yesterday's state.
|
|
10
|
+
# At most 500 balances (the first 500 by item) per run; every open row is read: a business with more below-level balances
|
|
11
|
+
# hears about the rest on a later morning, once the first ones recovered.
|
|
12
|
+
name: stock_low_alert
|
|
13
|
+
label: {id: Kabari stok di bawah batas minimum, en: Low stock alert}
|
|
14
|
+
description: {id: 'Tiap pagi, barang yang stoknya baru turun di bawah batas minimum dikabarkan ke kantor pusat. Sekali saja sampai stoknya pulih.'}
|
|
15
|
+
schedule: '30 6 * * *'
|
|
16
|
+
steps:
|
|
17
|
+
- find_all: stock_balance
|
|
18
|
+
where: "item.reorder_level > 0 && item.active && qty < item.reorder_level"
|
|
19
|
+
sort: item
|
|
20
|
+
limit: 500
|
|
21
|
+
as: low
|
|
22
|
+
# every open row, no limit: a row missed here would get a second open row and a second draft (audit owner-automation-pack
|
|
23
|
+
# R1). Open rows are at most one per balance, and the loop below allows 2000.
|
|
24
|
+
- find_all: stock_reorder
|
|
25
|
+
where: open
|
|
26
|
+
as: marks
|
|
27
|
+
# each open row is checked against its own balance and item, not against `low`: `low` stops at 500 balances, and a
|
|
28
|
+
# balance outside it is not back above its level (audit owner-automation-pack 3)
|
|
29
|
+
- for_each: marks
|
|
30
|
+
as: m
|
|
31
|
+
do:
|
|
32
|
+
- {find: stock_balance, where: name == m.balance, as: mb}
|
|
33
|
+
- {find: item, where: name == m.item, as: mi}
|
|
34
|
+
- if: "mb == null || mi == null || !mi.active || mi.reorder_level <= 0 || mb.qty >= mi.reorder_level"
|
|
35
|
+
update: m
|
|
36
|
+
set: {open: 'false'}
|
|
37
|
+
- for_each: "low.filter(b, !marks.exists(m, m.balance == b.name))"
|
|
38
|
+
as: b
|
|
39
|
+
do:
|
|
40
|
+
- {find: item, where: name == b.item, as: it}
|
|
41
|
+
- create: stock_reorder
|
|
42
|
+
set:
|
|
43
|
+
balance: b.name
|
|
44
|
+
outlet: b.outlet
|
|
45
|
+
item: b.item
|
|
46
|
+
alerted_on: today()
|
|
47
|
+
qty: b.qty
|
|
48
|
+
level: it.reorder_level
|
|
49
|
+
order_qty: "it.reorder_qty > 0 ? it.reorder_qty : it.reorder_level - b.qty"
|
|
50
|
+
rate: b.avg_cost
|
|
51
|
+
vendor: it.default_vendor
|
|
52
|
+
open: 'true'
|
|
53
|
+
drafted: 'false'
|
|
54
|
+
as: mk
|
|
55
|
+
# `it` and `mk` are the last item and row of the loop above: the notice names one item and links to its row
|
|
56
|
+
- if: "low.filter(b, !marks.exists(m, m.balance == b.name)).size() > 0"
|
|
57
|
+
notify: head_office
|
|
58
|
+
notice: stock_low
|
|
59
|
+
channel: email
|
|
60
|
+
record: mk
|
|
61
|
+
id: "'low:' + mk.name"
|
|
62
|
+
title: '{low.filter(b, !marks.exists(m, m.balance == b.name)).size()} barang di bawah batas stok minimum'
|
|
63
|
+
template: >-
|
|
64
|
+
Stok {it.item_name} tinggal {mk.qty} (batas minimum {mk.level}){low.filter(b, !marks.exists(m, m.balance == b.name)).size() > 1 ? ', dan ' + string(low.filter(b, !marks.exists(m, m.balance == b.name)).size() - 1) + ' barang lain juga baru turun di bawah batas' : ''}.
|
|
65
|
+
Buka daftar "Stok di bawah batas minimum" untuk melihat semuanya.
|
|
@@ -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, ...).
|
|
6
|
-
#
|
|
7
|
-
#
|
|
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
|
+
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
|
-
|
|
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
|
+
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
|