@rangka-os/create 0.5.0-alpha.27 → 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/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
|
@@ -14,6 +14,9 @@ permissions:
|
|
|
14
14
|
- {role: sales_rep, read: true}
|
|
15
15
|
- {role: field_sales, read: true}
|
|
16
16
|
- {role: cashier, read: true}
|
|
17
|
+
# module attendance: staff pick the outlet they clock in at; the outlet supervisor reads the outlets they keep
|
|
18
|
+
- {role: outlet_supervisor, read: true, print: true}
|
|
19
|
+
- {role: employee, read: true, if: "name in user.outlets"}
|
|
17
20
|
fields:
|
|
18
21
|
- name: outlet_name
|
|
19
22
|
type: data
|
|
@@ -87,6 +90,56 @@ fields:
|
|
|
87
90
|
label: {id: Modal kas kasir}
|
|
88
91
|
help: {id: 'Uang kembalian di laci tiap sesi kasir dibuka. Kosongkan kalau kasir yang mengisi'}
|
|
89
92
|
depends_on: app_installed('pos')
|
|
93
|
+
# module attendance (staff clock-in per outlet): the outlet's point and radius are the geofence of the clock screen
|
|
94
|
+
# (screens/absen_outlet.rk), and the default hours are the schedule lateness is measured against when the employee has
|
|
95
|
+
# no shift. Decimal degrees, as a phone's GPS or a map gives them (Bandung is about -6.9, 107.6).
|
|
96
|
+
- name: lat
|
|
97
|
+
type: float
|
|
98
|
+
label: {id: Lintang (lat)}
|
|
99
|
+
help: {id: 'Titik outlet untuk absen. Buka peta di HP saat berada di outlet, salin angka pertama'}
|
|
100
|
+
depends_on: app_installed('attendance')
|
|
101
|
+
- name: lng
|
|
102
|
+
type: float
|
|
103
|
+
label: {id: Bujur (lng)}
|
|
104
|
+
help: {id: 'Angka kedua dari titik peta yang sama'}
|
|
105
|
+
depends_on: app_installed('attendance')
|
|
106
|
+
# Empty until both numbers are set: an outlet without a point measures every clock-in as "no position" (held, never
|
|
107
|
+
# refused), so a forgotten point cannot make a far clock-in count as inside.
|
|
108
|
+
- {name: point, type: geo, label: {id: Titik lokasi}, read_only: true, depends_on: app_installed('attendance'), compute: "lat != 0 || lng != 0 ? {'lat': lat, 'lng': lng} : ''"}
|
|
109
|
+
# Indoor GPS in malls drifts 50 to 150 m: 100 is the default, the owner widens it per outlet.
|
|
110
|
+
- name: radius_m
|
|
111
|
+
type: int
|
|
112
|
+
label: {id: Radius absen (meter)}
|
|
113
|
+
default: '100'
|
|
114
|
+
depends_on: app_installed('attendance')
|
|
115
|
+
# The org timezone is not readable in CEL, so each outlet carries its own zone for the local work day and hours
|
|
116
|
+
# (staff_attendance turns it into the UTC offset +07:00, +08:00 or +09:00).
|
|
117
|
+
- name: time_zone
|
|
118
|
+
type: select
|
|
119
|
+
label: {id: Zona waktu}
|
|
120
|
+
default: "'wib'"
|
|
121
|
+
depends_on: app_installed('attendance')
|
|
122
|
+
options:
|
|
123
|
+
- {value: wib, label: {id: WIB (UTC+7)}}
|
|
124
|
+
- {value: wita, label: {id: WITA (UTC+8)}}
|
|
125
|
+
- {value: wit, label: {id: WIT (UTC+9)}}
|
|
126
|
+
# Empty = no default schedule: no lateness or early leave is measured for this outlet (F&B outlets keep very different
|
|
127
|
+
# hours, so no hour is assumed).
|
|
128
|
+
- name: work_start
|
|
129
|
+
type: data
|
|
130
|
+
label: {id: Jam masuk default}
|
|
131
|
+
help: {id: 'Format JJ:MM, misalnya 08:00. Kosong berarti keterlambatan tidak dihitung'}
|
|
132
|
+
depends_on: app_installed('attendance')
|
|
133
|
+
- name: work_end
|
|
134
|
+
type: data
|
|
135
|
+
label: {id: Jam pulang default}
|
|
136
|
+
help: {id: 'Format JJ:MM, misalnya 17:00. Lebih awal dari jam masuk berarti pulang besok (shift malam)'}
|
|
137
|
+
depends_on: app_installed('attendance')
|
|
138
|
+
- name: late_grace_min
|
|
139
|
+
type: int
|
|
140
|
+
label: {id: Toleransi terlambat (menit)}
|
|
141
|
+
default: '10'
|
|
142
|
+
depends_on: app_installed('attendance')
|
|
90
143
|
rules:
|
|
91
144
|
# The code is part of document numbers (cashier receipts STRK-<code>-..., kernel contract 0009 §2a), which take it
|
|
92
145
|
# as it is: capital letters and digits, parts joined by "-".
|
|
@@ -94,3 +147,19 @@ rules:
|
|
|
94
147
|
on: save
|
|
95
148
|
check: "code == '' || code.matches('^[A-Z0-9]+(-[A-Z0-9]+)*$')"
|
|
96
149
|
message: {id: 'Kode outlet hanya huruf besar dan angka, boleh dipisah tanda -, misalnya DGO atau BDG-1'}
|
|
150
|
+
- name: point_valid
|
|
151
|
+
on: save
|
|
152
|
+
check: "!app_installed('attendance') || (lat == 0 && lng == 0) || (lat >= -90.0 && lat <= 90.0 && lng >= -180.0 && lng <= 180.0)"
|
|
153
|
+
message: {id: 'Titik outlet tidak valid: lintang -90 sampai 90, bujur -180 sampai 180'}
|
|
154
|
+
- name: radius_range
|
|
155
|
+
on: save
|
|
156
|
+
check: "!app_installed('attendance') || radius_m == 0 || (radius_m >= 20 && radius_m <= 2000)"
|
|
157
|
+
message: {id: 'Radius absen 20 sampai 2000 meter'}
|
|
158
|
+
- name: work_hours_shape
|
|
159
|
+
on: save
|
|
160
|
+
check: "!app_installed('attendance') || ((work_start == '' || work_start.matches('^([01][0-9]|2[0-3]):[0-5][0-9]$')) && (work_end == '' || work_end.matches('^([01][0-9]|2[0-3]):[0-5][0-9]$')))"
|
|
161
|
+
message: {id: 'Jam masuk dan jam pulang ditulis JJ:MM, misalnya 08:00 atau 17:30'}
|
|
162
|
+
- name: grace_range
|
|
163
|
+
on: save
|
|
164
|
+
check: "!app_installed('attendance') || (late_grace_min >= 0 && late_grace_min <= 120)"
|
|
165
|
+
message: {id: 'Toleransi terlambat 0 sampai 120 menit'}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
|
|
2
|
+
# A Midtrans payment notification (connector midtrans, trigger payment_notified; Snap page, QRIS, virtual account or
|
|
3
|
+
# GoPay) whose order id is a sales invoice becomes a DRAFT payment allocated to that invoice, gateway midtrans, as the
|
|
4
|
+
# DOKU and Xendit flows do (payment_from_xendit_qr holds the reasoning). The kernel checks the notification's
|
|
5
|
+
# signature_key before this runs (rangka-os contract 0002, body-field signatures), so a forged notification never
|
|
6
|
+
# starts it.
|
|
7
|
+
# Midtrans signs only the order id, the status code and the gross amount, so the connector confirms every
|
|
8
|
+
# notification with Midtrans (GET status) before this runs: paid, the status and the channel come from Midtrans's own
|
|
9
|
+
# answer, and paid also needs it to name the same order id and amount. gateway_ref is the order id (one Midtrans
|
|
10
|
+
# transaction per order id), external_id the invoice number in it (an order id of a second or later attempt ends in
|
|
11
|
+
# ~2 ... ~9) and paid_amount the gross amount (a text with two decimals). A genuine notification resent with unsigned
|
|
12
|
+
# fields changed carries the same gateway_ref, so it finds the payment it already made.
|
|
13
|
+
# One Midtrans account per business: the server key is the org's, and an order id is looked up among this org's
|
|
14
|
+
# invoices only. Two businesses that share one Midtrans account and number invoices alike could see each other's
|
|
15
|
+
# notifications; give each business its own Midtrans account (or merchant) and notification URL.
|
|
16
|
+
# Only a completed payment of a positive amount records money. gateway_ref is the flow's idempotency key and the
|
|
17
|
+
# payment's gateway_ref, claimed in gateway_ref_claim BEFORE the payment is made, so two notifications racing
|
|
18
|
+
# (Midtrans retries after 2, 10, 30, 90 and 210 minutes, and sends capture then settlement for a card) record one
|
|
19
|
+
# payment. A notification for an unknown or cancelled invoice records nothing and tells the owner: the money is at
|
|
20
|
+
# Midtrans.
|
|
21
|
+
# Method: Midtrans payment_type qris is qris, bank_transfer and echannel (Mandiri bill) are va, gopay, shopeepay, dana
|
|
22
|
+
# and ovo are ewallet, the rest other.
|
|
23
|
+
name: payment_from_midtrans
|
|
24
|
+
label: {id: Pembayaran Midtrans jadi pembayaran faktur}
|
|
25
|
+
on: midtrans.payment_notified
|
|
26
|
+
# Every paid notification runs the flow; one without the order id or with no readable positive amount records nothing
|
|
27
|
+
# and tells the owner (the money is at Midtrans), instead of being skipped silently.
|
|
28
|
+
if: "'paid' in event && event.paid == true"
|
|
29
|
+
idempotency: "'gateway_ref' in event ? event.gateway_ref : ''"
|
|
30
|
+
steps:
|
|
31
|
+
- find: payment
|
|
32
|
+
if: "'gateway_ref' in event && event.gateway_ref != '' && 'external_id' in event && 'paid_amount' in event && string(event.paid_amount).matches('^[0-9]+([.][0-9]+)?$') && double(string(event.paid_amount)) > 0"
|
|
33
|
+
where: "gateway_ref == event.gateway_ref && docstatus != 2"
|
|
34
|
+
as: done
|
|
35
|
+
- find: sales_invoice
|
|
36
|
+
if: "'gateway_ref' in event && event.gateway_ref != '' && 'external_id' in event && 'paid_amount' in event && string(event.paid_amount).matches('^[0-9]+([.][0-9]+)?$') && double(string(event.paid_amount)) > 0"
|
|
37
|
+
where: "name == event.external_id && docstatus == 1"
|
|
38
|
+
as: inv
|
|
39
|
+
- find_all: payment
|
|
40
|
+
if: "'gateway_ref' in event && event.gateway_ref != '' && 'external_id' in event && 'paid_amount' in event && string(event.paid_amount).matches('^[0-9]+([.][0-9]+)?$') && double(string(event.paid_amount)) > 0"
|
|
41
|
+
where: "docstatus == 0 && reference == event.external_id"
|
|
42
|
+
as: drafts
|
|
43
|
+
- find: gateway_ref_claim
|
|
44
|
+
if: "'gateway_ref' in event && event.gateway_ref != '' && 'external_id' in event && 'paid_amount' in event && string(event.paid_amount).matches('^[0-9]+([.][0-9]+)?$') && double(string(event.paid_amount)) > 0"
|
|
45
|
+
where: gateway_ref == event.gateway_ref
|
|
46
|
+
as: held
|
|
47
|
+
- find: payment
|
|
48
|
+
if: "'gateway_ref' in event && event.gateway_ref != '' && 'external_id' in event && 'paid_amount' in event && string(event.paid_amount).matches('^[0-9]+([.][0-9]+)?$') && double(string(event.paid_amount)) > 0"
|
|
49
|
+
where: "held != null && name == held.payment && docstatus != 2"
|
|
50
|
+
as: holder
|
|
51
|
+
- update: held
|
|
52
|
+
if: "'gateway_ref' in event && event.gateway_ref != '' && 'external_id' in event && 'paid_amount' in event && string(event.paid_amount).matches('^[0-9]+([.][0-9]+)?$') && double(string(event.paid_amount)) > 0 && done == null && inv != null && held != null && holder == null"
|
|
53
|
+
set: {gateway_ref: "''", released_ref: event.gateway_ref}
|
|
54
|
+
- create: gateway_ref_claim
|
|
55
|
+
if: "'gateway_ref' in event && event.gateway_ref != '' && 'external_id' in event && 'paid_amount' in event && string(event.paid_amount).matches('^[0-9]+([.][0-9]+)?$') && double(string(event.paid_amount)) > 0 && done == null && inv != null && (held == null || holder == null)"
|
|
56
|
+
set: {gateway_ref: event.gateway_ref, payment: "''"}
|
|
57
|
+
as: claim
|
|
58
|
+
- create: payment
|
|
59
|
+
if: "'gateway_ref' in event && event.gateway_ref != '' && 'external_id' in event && 'paid_amount' in event && string(event.paid_amount).matches('^[0-9]+([.][0-9]+)?$') && double(string(event.paid_amount)) > 0 && done == null && inv != null && (held == null || holder == null)"
|
|
60
|
+
set:
|
|
61
|
+
direction: "'receive'"
|
|
62
|
+
customer: inv.customer
|
|
63
|
+
payment_date: today()
|
|
64
|
+
amount: "double(string(event.paid_amount))"
|
|
65
|
+
method: >-
|
|
66
|
+
'channel' in event && event.channel == 'qris' ? 'qris'
|
|
67
|
+
: ('channel' in event && event.channel in ['bank_transfer', 'echannel'] ? 'va'
|
|
68
|
+
: ('channel' in event && event.channel in ['gopay', 'shopeepay', 'dana', 'ovo'] ? 'ewallet' : 'other'))
|
|
69
|
+
gateway: "'midtrans'"
|
|
70
|
+
gateway_ref: event.gateway_ref
|
|
71
|
+
reference: inv.name
|
|
72
|
+
notes: "'Dari Midtrans ' + event.gateway_ref"
|
|
73
|
+
allocations: "min(double(string(event.paid_amount)), inv.outstanding - drafts.map(p, p.allocated_total).sum()) > 0 ? [{'sales_invoice': inv.name, 'amount': min(double(string(event.paid_amount)), inv.outstanding - drafts.map(p, p.allocated_total).sum())}] : []"
|
|
74
|
+
as: pay
|
|
75
|
+
- update: claim
|
|
76
|
+
if: "'gateway_ref' in event && event.gateway_ref != '' && 'external_id' in event && 'paid_amount' in event && string(event.paid_amount).matches('^[0-9]+([.][0-9]+)?$') && double(string(event.paid_amount)) > 0 && done == null && inv != null && (held == null || holder == null)"
|
|
77
|
+
set: {payment: pay.name}
|
|
78
|
+
- notify: owner
|
|
79
|
+
if: "'gateway_ref' in event && event.gateway_ref != '' && 'external_id' in event && 'paid_amount' in event && string(event.paid_amount).matches('^[0-9]+([.][0-9]+)?$') && double(string(event.paid_amount)) > 0 && done == null && inv == null"
|
|
80
|
+
channel: email
|
|
81
|
+
template: {id: 'Midtrans {event.gateway_ref}: Rp {event.paid_amount} untuk {event.external_id}, faktur tidak ada/terbuka. Catat manual.'}
|
|
82
|
+
- notify: owner
|
|
83
|
+
if: "!('gateway_ref' in event && event.gateway_ref != '' && 'external_id' in event && 'paid_amount' in event && string(event.paid_amount).matches('^[0-9]+([.][0-9]+)?$') && double(string(event.paid_amount)) > 0)"
|
|
84
|
+
channel: email
|
|
85
|
+
template: {id: 'Midtrans: ada pembayaran lunas tanpa order id atau jumlah yang terbaca. Cek dashboard Midtrans dan log connector, catat manual.'}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
|
|
2
|
+
# A Midtrans refund (trigger payment_notified, transaction_status refund or partial_refund, status code 200): the money
|
|
3
|
+
# went back to the payer from the Midtrans balance. It is never money in (payment_from_midtrans runs only for
|
|
4
|
+
# paid == true) and it is not booked here either (no credit note or money-out document yet), so the owner is told,
|
|
5
|
+
# with the order id (the invoice number, plus ~<attempt> for a later attempt), to record it, as payment_refund_from_doku does.
|
|
6
|
+
# The status and the refunded amount come from Midtrans's own answer (the connector confirms every notification with
|
|
7
|
+
# GET status), not from the notification, which Midtrans signs only in part. The message still sends the owner to the
|
|
8
|
+
# Midtrans dashboard: the refund is recorded there, not here.
|
|
9
|
+
name: payment_refund_from_midtrans
|
|
10
|
+
label: {id: Refund Midtrans diberitahukan ke pemilik}
|
|
11
|
+
on: midtrans.payment_notified
|
|
12
|
+
if: "'refunded' in event && event.refunded == true && 'gateway_ref' in event && event.gateway_ref != ''"
|
|
13
|
+
idempotency: "'refund:' + event.gateway_ref + ':' + ('status' in event && event.status != null ? event.status : '') + ':' + ('refund_amount' in event && event.refund_amount != null ? string(event.refund_amount) : '')"
|
|
14
|
+
steps:
|
|
15
|
+
- notify: owner
|
|
16
|
+
if: "'refund_amount' in event && event.refund_amount != null"
|
|
17
|
+
channel: email
|
|
18
|
+
template: {id: 'Refund Midtrans {event.gateway_ref}: Rp {event.refund_amount} menurut notifikasi. Cek dashboard Midtrans, lalu catat pengembaliannya.'}
|
|
19
|
+
- notify: owner
|
|
20
|
+
if: "!('refund_amount' in event && event.refund_amount != null)"
|
|
21
|
+
channel: email
|
|
22
|
+
template: {id: 'Refund Midtrans {event.gateway_ref}. Cek jumlahnya di dashboard Midtrans, lalu catat pengembaliannya.'}
|
|
@@ -82,7 +82,7 @@ fields:
|
|
|
82
82
|
label: {id: Salesman}
|
|
83
83
|
default: customer.salesman
|
|
84
84
|
depends_on: "app_installed('distribution') && direction == 'receive'"
|
|
85
|
-
# Payments that arrive through a payment gateway (Xendit VA, QRIS, payment link) carry the gateway's id, so a
|
|
85
|
+
# Payments that arrive through a payment gateway (Xendit, DOKU, Midtrans: VA, QRIS, payment link) carry the gateway's id, so a
|
|
86
86
|
# callback delivered twice finds the payment it already made instead of paying the invoice again. One live
|
|
87
87
|
# payment per id is kept by gateway_ref_claim, not by `unique` here: the kernel's unique index also holds the id
|
|
88
88
|
# on a cancelled payment, which made amending it fail (500) and the callback impossible to record again.
|
|
@@ -92,6 +92,7 @@ fields:
|
|
|
92
92
|
options:
|
|
93
93
|
- {value: xendit, label: {id: Xendit}}
|
|
94
94
|
- {value: doku, label: {id: DOKU}}
|
|
95
|
+
- {value: midtrans, label: {id: Midtrans}}
|
|
95
96
|
- name: gateway_ref
|
|
96
97
|
type: data
|
|
97
98
|
label: {id: ID transaksi gateway}
|
|
@@ -2,21 +2,24 @@
|
|
|
2
2
|
name: payroll_close_on_cancel
|
|
3
3
|
label: {id: Tutup periode gaji dibatalkan}
|
|
4
4
|
# Refused while the client invoice of this close is submitted (cancel that invoice first); otherwise the run is open
|
|
5
|
-
# again and the project ledger row is reversed. A draft invoice is left for the owner to delete.
|
|
5
|
+
# again and the project ledger row is reversed. A draft invoice is left for the owner to delete. An internal run has
|
|
6
|
+
# neither, so only the run is reopened. `!= 'internal'`: a close submitted before payroll 2.0 is a client close.
|
|
6
7
|
on: payroll_close.cancelled
|
|
7
8
|
steps:
|
|
8
|
-
-
|
|
9
|
+
- if: event.run_kind != 'internal' && app_installed('invoicing')
|
|
10
|
+
find: sales_invoice
|
|
9
11
|
where: project == event.project && docstatus == 1 && notes.contains('(' + event.name + ')')
|
|
10
12
|
as: inv
|
|
11
|
-
- if: inv != null
|
|
13
|
+
- if: event.run_kind != 'internal' && app_installed('invoicing') && inv != null
|
|
12
14
|
create: payroll_guard
|
|
13
15
|
set:
|
|
14
16
|
reason: "'invoice_submitted'"
|
|
15
17
|
document: inv.name
|
|
16
|
-
-
|
|
18
|
+
- if: event.run_kind != 'internal' && app_installed('projects')
|
|
19
|
+
find: project_ledger
|
|
17
20
|
where: source_name == event.name && kind == 'payroll' && entry == 'post'
|
|
18
21
|
as: orig
|
|
19
|
-
- if: orig != null
|
|
22
|
+
- if: event.run_kind != 'internal' && app_installed('projects') && orig != null
|
|
20
23
|
create: project_ledger
|
|
21
24
|
set:
|
|
22
25
|
project: event.project
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
name: payroll_close_on_submit
|
|
3
3
|
label: {id: 'Tutup periode gaji, biaya ke untung proyek dan faktur klien'}
|
|
4
4
|
# 0. The run is closed: no slip can be submitted into it or cancelled out of it.
|
|
5
|
+
# Steps 1 and 2 are for client runs only (projects and invoicing installed): an internal run has no project and no
|
|
6
|
+
# client, so its close only closes the run. Tested as `!= 'internal'`, so a close made before payroll 2.0 (no run_kind
|
|
7
|
+
# of its own) still counts as a client close.
|
|
5
8
|
# 1. The project ledger gets the employer cost the recaps did not book (allowances, THR, employer BPJS), so the margin
|
|
6
9
|
# is revenue minus the full cost of the workers.
|
|
7
10
|
# 2. The client invoice is made as a draft (a flow cannot submit): wages on their own line, outside the PPh 23 base
|
|
@@ -16,7 +19,7 @@ steps:
|
|
|
16
19
|
as: run
|
|
17
20
|
- update: run
|
|
18
21
|
set: {closed: 'true', closed_by: event.name}
|
|
19
|
-
- if: event.extra_cost != 0
|
|
22
|
+
- if: event.run_kind != 'internal' && app_installed('projects') && event.extra_cost != 0
|
|
20
23
|
create: project_ledger
|
|
21
24
|
set:
|
|
22
25
|
project: event.project
|
|
@@ -27,11 +30,11 @@ steps:
|
|
|
27
30
|
source_name: event.name
|
|
28
31
|
payroll_close: event.name
|
|
29
32
|
amount: "0 - event.extra_cost"
|
|
30
|
-
- if: event.billing_mode != 'none'
|
|
33
|
+
- if: event.run_kind != 'internal' && app_installed('invoicing') && event.billing_mode != 'none'
|
|
31
34
|
find: sales_invoice
|
|
32
35
|
where: project == event.project && docstatus == 0 && notes.contains('[' + event.payroll_run + ']')
|
|
33
36
|
as: old
|
|
34
|
-
- if: event.billing_mode != 'none' && old != null
|
|
37
|
+
- if: event.run_kind != 'internal' && app_installed('invoicing') && event.billing_mode != 'none' && old != null
|
|
35
38
|
update: old
|
|
36
39
|
set:
|
|
37
40
|
posting_date: "event.invoice_date != '' ? event.invoice_date : today()"
|
|
@@ -41,7 +44,7 @@ steps:
|
|
|
41
44
|
event.billing_mode == 'fee_only' ? [{'item': event.fee_item, 'description': 'Management fee', 'qty': 1, 'rate': event.fee_amount, 'pph23_exclude': false}] : [{'item': event.wage_item, 'description': 'Gaji, tunjangan, lembur dan THR tenaga kerja', 'qty': 1, 'rate': event.total_cash_gross, 'pph23_exclude': true, 'ppn_exclude': true},
|
|
42
45
|
{'item': event.bpjs_item, 'description': 'Iuran BPJS Ketenagakerjaan dan Kesehatan bagian perusahaan', 'qty': 1, 'rate': event.total_employer_bpjs, 'pph23_exclude': false},
|
|
43
46
|
{'item': event.fee_item, 'description': 'Management fee', 'qty': 1, 'rate': event.fee_amount, 'pph23_exclude': false}]
|
|
44
|
-
- if: event.billing_mode != 'none' && event.billing_mode == 'wages_plus_fee' && old == null
|
|
47
|
+
- if: event.run_kind != 'internal' && app_installed('invoicing') && event.billing_mode != 'none' && event.billing_mode == 'wages_plus_fee' && old == null
|
|
45
48
|
create: sales_invoice
|
|
46
49
|
set:
|
|
47
50
|
customer: event.customer
|
|
@@ -54,7 +57,7 @@ steps:
|
|
|
54
57
|
[{'item': event.wage_item, 'description': 'Gaji, tunjangan, lembur dan THR tenaga kerja', 'qty': 1, 'rate': event.total_cash_gross, 'pph23_exclude': true, 'ppn_exclude': true},
|
|
55
58
|
{'item': event.bpjs_item, 'description': 'Iuran BPJS Ketenagakerjaan dan Kesehatan bagian perusahaan', 'qty': 1, 'rate': event.total_employer_bpjs, 'pph23_exclude': false},
|
|
56
59
|
{'item': event.fee_item, 'description': 'Management fee', 'qty': 1, 'rate': event.fee_amount, 'pph23_exclude': false}]
|
|
57
|
-
- if: event.billing_mode != 'none' && event.billing_mode == 'fee_only' && old == null
|
|
60
|
+
- if: event.run_kind != 'internal' && app_installed('invoicing') && event.billing_mode != 'none' && event.billing_mode == 'fee_only' && old == null
|
|
58
61
|
create: sales_invoice
|
|
59
62
|
set:
|
|
60
63
|
customer: event.customer
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
|
|
2
|
+
# Every morning at 07:15 (scheduler.timezone), and by the owner or finance from the flow list: each payroll run that is
|
|
3
|
+
# not closed is checked, and finance and the owner are told (contract 0066). The flow only reads and tells (its one
|
|
4
|
+
# write is the run's own ready_told mark): it makes no slip, submits nothing and never closes or pays a run.
|
|
5
|
+
# - payroll_ready, once per run (the run is then marked ready_told): the cut-off period is over, no attendance recap of the period is still a draft, no
|
|
6
|
+
# field attendance close is still a draft, and the run has at least one slip. Finance checks the draft slips,
|
|
7
|
+
# submits them and closes the period.
|
|
8
|
+
# - payroll_due, once a day from three days before the pay date until the pay date, while the run is not closed:
|
|
9
|
+
# what is ready (slips submitted) and what is missing (draft slips, attendance recaps not submitted, submitted
|
|
10
|
+
# recaps without a slip because the worker has no pay data, field attendance not closed).
|
|
11
|
+
# Recaps are the monthly ones payroll reads (timesheet with period_to, paid per day), as payslip_from_recap does.
|
|
12
|
+
# A client run reads its project, recaps and field attendance closes (projects module). An internal run (payroll 2.0)
|
|
13
|
+
# has no project: it is ready when its period is over, it has a slip and no staff attendance period overlapping it
|
|
14
|
+
# (its outlet's or the whole business's) is still a draft (attendance module, when installed).
|
|
15
|
+
# The day is today, or event.as_of (YYYY-MM-DD) when the flow is run by hand for another day (and in tests).
|
|
16
|
+
# At most 100 open runs per run of the flow.
|
|
17
|
+
name: payroll_reminder
|
|
18
|
+
label: {id: Pengingat periode gaji, en: Payroll reminder}
|
|
19
|
+
description: {id: 'Tiap pagi, bagian keuangan dan pemilik dikabari periode gaji yang siap diproses dan yang tanggal bayarnya tinggal tiga hari atau kurang, lengkap dengan yang masih kurang. Gaji tidak pernah dijalankan otomatis.'}
|
|
20
|
+
schedule: '15 7 * * *'
|
|
21
|
+
steps:
|
|
22
|
+
- find_all: payroll_run
|
|
23
|
+
where: "!closed"
|
|
24
|
+
sort: period_to
|
|
25
|
+
limit: 100
|
|
26
|
+
as: runs
|
|
27
|
+
- for_each: runs
|
|
28
|
+
as: run
|
|
29
|
+
do:
|
|
30
|
+
- find_all: payslip
|
|
31
|
+
where: payroll_run == run.name && docstatus != 2
|
|
32
|
+
as: slips
|
|
33
|
+
- if: "run.run_kind != 'internal' && app_installed('projects')"
|
|
34
|
+
then:
|
|
35
|
+
- {find: project, where: name == run.project, as: pj}
|
|
36
|
+
- find_all: timesheet
|
|
37
|
+
where: "project == run.project && docstatus != 2 && period_to != '' && rate_basis == 'day' && work_date >= run.period_from && work_date <= run.period_to"
|
|
38
|
+
as: recaps
|
|
39
|
+
- find_all: attendance_close
|
|
40
|
+
where: "project == run.project && docstatus == 0 && period_from <= run.period_to && period_to >= run.period_from"
|
|
41
|
+
as: closes
|
|
42
|
+
- if: "!run.ready_told && ('as_of' in event ? event.as_of : today()) > run.period_to && size(slips) > 0 && recaps.filter(t, t.docstatus == 0).size() == 0 && size(closes) == 0"
|
|
43
|
+
notify: finance_manager
|
|
44
|
+
notice: payroll_ready
|
|
45
|
+
channel: email
|
|
46
|
+
record: run
|
|
47
|
+
id: "'ready:' + run.name"
|
|
48
|
+
title: 'Periode gaji {pj != null ? pj.project_name : run.project} siap diproses'
|
|
49
|
+
template: >-
|
|
50
|
+
Periode {run.period_from} sampai {run.period_to} sudah lewat dan semua rekap absen sudah diajukan.
|
|
51
|
+
Slip gaji: {slips.filter(s, s.docstatus == 0).size()} draft menunggu diperiksa, {slips.filter(s, s.docstatus == 1).size()} sudah diajukan.
|
|
52
|
+
Periksa slip, ajukan, lalu tutup periode gaji.
|
|
53
|
+
# the notify step above ran exactly when this is true: the run is marked, so it is announced once
|
|
54
|
+
- if: "!run.ready_told && ('as_of' in event ? event.as_of : today()) > run.period_to && size(slips) > 0 && recaps.filter(t, t.docstatus == 0).size() == 0 && size(closes) == 0"
|
|
55
|
+
update: run
|
|
56
|
+
set: {ready_told: 'true'}
|
|
57
|
+
- if: "run.pay_date != '' && days_between(('as_of' in event ? event.as_of : today()), run.pay_date) >= 0 && days_between(('as_of' in event ? event.as_of : today()), run.pay_date) <= 3"
|
|
58
|
+
notify: finance_manager
|
|
59
|
+
notice: payroll_due
|
|
60
|
+
channel: email
|
|
61
|
+
record: run
|
|
62
|
+
id: "'due:' + run.name + ':' + ('as_of' in event ? event.as_of : today())"
|
|
63
|
+
title: "Gaji {pj != null ? pj.project_name : run.project} dibayar {days_between(('as_of' in event ? event.as_of : today()), run.pay_date) == 0 ? 'hari ini' : string(days_between(('as_of' in event ? event.as_of : today()), run.pay_date)) + ' hari lagi'}"
|
|
64
|
+
template: >-
|
|
65
|
+
Tanggal bayar {run.pay_date}. Siap: {slips.filter(s, s.docstatus == 1).size()} slip gaji sudah diajukan.
|
|
66
|
+
Belum: {slips.filter(s, s.docstatus == 0).size()} slip masih draft, {recaps.filter(t, t.docstatus == 0).size()} rekap absen belum diajukan,
|
|
67
|
+
{recaps.filter(t, t.docstatus == 1 && !slips.exists(s, s.timesheet == t.name)).size()} rekap belum jadi slip, {size(closes)} rekap absen lapangan belum diajukan.
|
|
68
|
+
Periode gaji belum ditutup.
|
|
69
|
+
else:
|
|
70
|
+
# Draft staff attendance periods overlapping the run, of its outlet or of the whole business. Without the
|
|
71
|
+
# attendance module there are none: a find on a model that is not installed fails, so the list is then an
|
|
72
|
+
# empty find of payslips (a payslip always has a name).
|
|
73
|
+
- if: "app_installed('attendance')"
|
|
74
|
+
then:
|
|
75
|
+
- find_all: attendance_period
|
|
76
|
+
where: "docstatus == 0 && period_from <= run.period_to && period_to >= run.period_from && (run.outlet == '' || only_outlet == '' || only_outlet == run.outlet)"
|
|
77
|
+
as: open_periods
|
|
78
|
+
else:
|
|
79
|
+
- find_all: payslip
|
|
80
|
+
where: "name == ''"
|
|
81
|
+
as: open_periods
|
|
82
|
+
- if: "!run.ready_told && ('as_of' in event ? event.as_of : today()) > run.period_to && size(slips) > 0 && size(open_periods) == 0"
|
|
83
|
+
notify: finance_manager
|
|
84
|
+
notice: payroll_ready
|
|
85
|
+
channel: email
|
|
86
|
+
record: run
|
|
87
|
+
id: "'ready:' + run.name"
|
|
88
|
+
title: 'Periode gaji karyawan {run.period_from} sampai {run.period_to} siap diproses'
|
|
89
|
+
template: >-
|
|
90
|
+
Periode {run.period_from} sampai {run.period_to} sudah lewat dan rekap absen karyawannya sudah diajukan.
|
|
91
|
+
Slip gaji: {slips.filter(s, s.docstatus == 0).size()} draft menunggu diperiksa, {slips.filter(s, s.docstatus == 1).size()} sudah diajukan.
|
|
92
|
+
Periksa slip, ajukan, lalu tutup periode gaji.
|
|
93
|
+
- if: "!run.ready_told && ('as_of' in event ? event.as_of : today()) > run.period_to && size(slips) > 0 && size(open_periods) == 0"
|
|
94
|
+
update: run
|
|
95
|
+
set: {ready_told: 'true'}
|
|
96
|
+
- if: "run.pay_date != '' && days_between(('as_of' in event ? event.as_of : today()), run.pay_date) >= 0 && days_between(('as_of' in event ? event.as_of : today()), run.pay_date) <= 3"
|
|
97
|
+
notify: finance_manager
|
|
98
|
+
notice: payroll_due
|
|
99
|
+
channel: email
|
|
100
|
+
record: run
|
|
101
|
+
id: "'due:' + run.name + ':' + ('as_of' in event ? event.as_of : today())"
|
|
102
|
+
title: "Gaji karyawan dibayar {days_between(('as_of' in event ? event.as_of : today()), run.pay_date) == 0 ? 'hari ini' : string(days_between(('as_of' in event ? event.as_of : today()), run.pay_date)) + ' hari lagi'}"
|
|
103
|
+
template: >-
|
|
104
|
+
Tanggal bayar {run.pay_date}. Siap: {slips.filter(s, s.docstatus == 1).size()} slip gaji sudah diajukan.
|
|
105
|
+
Belum: {slips.filter(s, s.docstatus == 0).size()} slip masih draft, {size(open_periods)} rekap absen karyawan belum diajukan.
|
|
106
|
+
Periode gaji belum ditutup.
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
|
|
2
2
|
name: payroll_run_overlap_guard_created
|
|
3
|
-
label: {id: Periode gaji satu proyek tidak tumpang tindih}
|
|
4
|
-
# Two runs of one project over the same days would pay the same attendance twice.
|
|
3
|
+
label: {id: Periode gaji satu proyek atau outlet tidak tumpang tindih}
|
|
4
|
+
# Two runs of one project over the same days would pay the same attendance twice. Internal runs (payroll 2.0) overlap
|
|
5
|
+
# only with internal runs of the same outlet (or both of every outlet); a worker paid twice is refused per slip
|
|
6
|
+
# (payslip_pay_overlap_guard).
|
|
5
7
|
on: payroll_run.created
|
|
6
8
|
steps:
|
|
7
9
|
- find: payroll_run
|
|
8
|
-
where: project == event.project && name != event.name && period_from <= event.period_to && period_to >= event.period_from
|
|
10
|
+
where: ((event.run_kind == 'internal' && run_kind == 'internal' && outlet == event.outlet) || (event.run_kind != 'internal' && run_kind != 'internal' && project == event.project)) && name != event.name && period_from <= event.period_to && period_to >= event.period_from
|
|
9
11
|
as: other
|
|
10
12
|
- if: other != null
|
|
11
13
|
create: payroll_guard
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
|
|
2
2
|
name: payroll_run_overlap_guard_updated
|
|
3
|
-
label: {id: Periode gaji satu proyek tidak tumpang tindih}
|
|
4
|
-
# Two runs of one project over the same days would pay the same attendance twice.
|
|
3
|
+
label: {id: Periode gaji satu proyek atau outlet tidak tumpang tindih}
|
|
4
|
+
# Two runs of one project over the same days would pay the same attendance twice. Internal runs (payroll 2.0) overlap
|
|
5
|
+
# only with internal runs of the same outlet (or both of every outlet); a worker paid twice is refused per slip
|
|
6
|
+
# (payslip_pay_overlap_guard).
|
|
5
7
|
on: payroll_run.updated
|
|
6
8
|
steps:
|
|
7
9
|
- find: payroll_run
|
|
8
|
-
where: project == event.project && name != event.name && period_from <= event.period_to && period_to >= event.period_from
|
|
10
|
+
where: ((event.run_kind == 'internal' && run_kind == 'internal' && outlet == event.outlet) || (event.run_kind != 'internal' && run_kind != 'internal' && project == event.project)) && name != event.name && period_from <= event.period_to && period_to >= event.period_from
|
|
9
11
|
as: other
|
|
10
12
|
- if: other != null
|
|
11
13
|
create: payroll_guard
|
|
@@ -16,7 +16,7 @@ steps:
|
|
|
16
16
|
as: prof
|
|
17
17
|
- if: prof != null
|
|
18
18
|
find: payroll_run
|
|
19
|
-
where: project == event.project && !closed && period_from <= event.work_date && period_to >= event.work_date
|
|
19
|
+
where: run_kind != 'internal' && project == event.project && !closed && period_from <= event.work_date && period_to >= event.work_date
|
|
20
20
|
as: run
|
|
21
21
|
- if: prof != null && run != null
|
|
22
22
|
find: payslip
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/import.json
|
|
2
|
+
# Pay data of the workers already in the worker list (import worker_list first): one row per worker, found by the
|
|
3
|
+
# employee number. Status PTKP as written on the tax form (TK/0 to K/3), Dasar gaji Bulanan or Harian (anything else,
|
|
4
|
+
# empty included, is a row error), the BPJS columns Ya or Tidak (empty = Ya). Without a NIK or NPWP the profile has no
|
|
5
|
+
# valid tax number (PPh 21 120%). NIK and bank account are personal data: the file stays with the owner and finance.
|
|
6
|
+
name: payroll_profile_list
|
|
7
|
+
label: {id: Data gaji karyawan, en: Payroll profiles}
|
|
8
|
+
model: payroll_profile
|
|
9
|
+
source: csv
|
|
10
|
+
header_row: 1
|
|
11
|
+
key: [Nomor karyawan]
|
|
12
|
+
map:
|
|
13
|
+
worker: {value: Nomor karyawan, match: employee_no}
|
|
14
|
+
ptkp_status: "=row['Status PTKP'].trim().lowerAscii().replace('/', '')"
|
|
15
|
+
pay_basis: "=row['Dasar gaji'].trim().lowerAscii() in ['bulanan', 'bulan', 'monthly'] ? 'monthly' : (row['Dasar gaji'].trim().lowerAscii() in ['harian', 'daily'] ? 'daily' : '(' + row['Dasar gaji'] + ')')"
|
|
16
|
+
employment: "='Pegawai tidak tetap' in row && row['Pegawai tidak tetap'].trim().lowerAscii() in ['ya', 'y', '1', 'true'] ? 'casual' : 'permanent'"
|
|
17
|
+
monthly_salary: "='Gaji pokok' in row && row['Gaji pokok'] != '' ? row['Gaji pokok'] : '0'"
|
|
18
|
+
fixed_allowance: "='Tunjangan tetap' in row && row['Tunjangan tetap'] != '' ? row['Tunjangan tetap'] : '0'"
|
|
19
|
+
daily_allowance: "='Tunjangan per hari' in row && row['Tunjangan per hari'] != '' ? row['Tunjangan per hari'] : '0'"
|
|
20
|
+
nik: "='NIK' in row ? row['NIK'] : ''"
|
|
21
|
+
npwp: "='NPWP' in row ? row['NPWP'] : ''"
|
|
22
|
+
has_tax_id: "=('NIK' in row && row['NIK'].trim() != '') || ('NPWP' in row && row['NPWP'].trim() != '') ? 'Ya' : 'Tidak'"
|
|
23
|
+
bpjs_tk: "='BPJS Ketenagakerjaan' in row && row['BPJS Ketenagakerjaan'] != '' ? row['BPJS Ketenagakerjaan'] : 'Ya'"
|
|
24
|
+
bpjs_jp: "='Jaminan Pensiun' in row && row['Jaminan Pensiun'] != '' ? row['Jaminan Pensiun'] : 'Ya'"
|
|
25
|
+
bpjs_kes: "='BPJS Kesehatan' in row && row['BPJS Kesehatan'] != '' ? row['BPJS Kesehatan'] : 'Ya'"
|
|
26
|
+
bank_name: "='Bank' in row ? row['Bank'] : ''"
|
|
27
|
+
bank_account: "='No. rekening' in row ? row['No. rekening'] : ''"
|
|
@@ -6,9 +6,11 @@ is_submittable: true
|
|
|
6
6
|
naming: TPG-{YYYY}-{####}
|
|
7
7
|
title_field: payroll_run
|
|
8
8
|
# Closing a payroll run. Its amounts are copied from the run when it is saved and frozen by the submit; the submit
|
|
9
|
-
# closes the run (no slip can then be submitted into it or cancelled out of it),
|
|
10
|
-
# did not book on the project margin
|
|
11
|
-
# it reopens the run and reverses the margin row; it is refused while the client
|
|
9
|
+
# closes the run (no slip can then be submitted into it or cancelled out of it) and, for a client run only, books the
|
|
10
|
+
# employer cost the recaps did not book on the project margin and makes the client invoice as a draft
|
|
11
|
+
# (payroll_close_on_submit). Cancelling it reopens the run and reverses the margin row; it is refused while the client
|
|
12
|
+
# invoice is submitted. An internal run's close books nothing outside payroll (the accounting module, when installed,
|
|
13
|
+
# journals every close).
|
|
12
14
|
permissions:
|
|
13
15
|
- {role: finance_manager, read: true, create: true, write: true, delete: true, submit: true, cancel: true, amend: true, export: true, print: true}
|
|
14
16
|
- {role: project_admin, read: true}
|
|
@@ -19,8 +21,10 @@ fields:
|
|
|
19
21
|
label: {id: Periode gaji}
|
|
20
22
|
required: true
|
|
21
23
|
in_list: true
|
|
22
|
-
- {name:
|
|
23
|
-
- {name:
|
|
24
|
+
- {name: run_kind, type: data, label: {id: Jenis periode}, compute: payroll_run.run_kind}
|
|
25
|
+
- {name: project, type: link, to: project, label: {id: Proyek}, compute: payroll_run.project, in_list: true, depends_on: run_kind == 'client'}
|
|
26
|
+
- {name: customer, type: link, to: customer, label: {id: Klien}, compute: payroll_run.customer, depends_on: run_kind == 'client'}
|
|
27
|
+
- {name: outlet, type: link, to: outlet, label: {id: Outlet}, compute: payroll_run.outlet, depends_on: run_kind == 'internal' && app_installed('outlets')}
|
|
24
28
|
- {name: period_from, type: date, label: {id: Periode dari}, compute: payroll_run.period_from}
|
|
25
29
|
- {name: period_to, type: date, label: {id: Periode sampai}, compute: payroll_run.period_to, in_list: true}
|
|
26
30
|
- {name: billing_mode, type: data, label: {id: Cara tagih klien}, compute: payroll_run.billing_mode}
|
|
@@ -72,7 +76,7 @@ views:
|
|
|
72
76
|
layout:
|
|
73
77
|
- section: {id: Periode}
|
|
74
78
|
columns:
|
|
75
|
-
- [payroll_run, project, customer]
|
|
79
|
+
- [payroll_run, run_kind, project, customer, outlet]
|
|
76
80
|
- [period_from, period_to, billing_mode]
|
|
77
81
|
- section: {id: Setoran dan biaya}
|
|
78
82
|
columns:
|