@rangka-os/create 0.5.0-alpha.12 → 0.5.0-alpha.14
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/jasa_proyek/app.rk +1 -1
- package/template/base/apps/ritel_cabang/dashboards/ritel_stock.rk +4 -4
- package/template/base/modules/accounting/flows/gl_cash_advance_post.rk +33 -0
- package/template/base/modules/accounting/flows/gl_cash_advance_reverse.rk +194 -0
- package/template/base/modules/accounting/models/gl_entry.rk +1 -1
- package/template/base/modules/accounting/module.rk +1 -1
- package/template/base/modules/coretax/module.rk +1 -1
- package/template/base/modules/coretax/print/coretax_bupot.rk +10 -5
- package/template/base/modules/coretax/print/coretax_faktur.rk +12 -7
- package/template/base/modules/coretax/print/coretax_faktur.xml +4 -0
- package/template/base/modules/invoicing/models/sales_invoice.rk +3 -2
- package/template/base/modules/invoicing/module.rk +1 -1
- package/template/base/modules/kitchen/flows/kitchen_ticket_on_sale.rk +26 -8
- package/template/base/modules/kitchen/flows/kitchen_ticket_on_update.rk +5 -1
- package/template/base/modules/kitchen/flows/kitchen_ticket_on_void.rk +9 -1
- package/template/base/modules/kitchen/models/kitchen_guard.rk +5 -0
- package/template/base/modules/kitchen/models/kitchen_ticket.rk +5 -0
- package/template/base/modules/outlet_sales/flows/moka_daily_sales.rk +39 -18
- package/template/base/modules/outlet_sales/flows/moka_line_mapped.rk +16 -1
- package/template/base/modules/outlet_sales/flows/moka_transaction_staged.rk +85 -24
- package/template/base/modules/outlet_sales/flows/sales_cancel_guard.rk +5 -1
- package/template/base/modules/outlet_sales/models/moka_sale_line.rk +6 -1
- package/template/base/modules/outlet_sales/models/pos_refund.rk +4 -1
- package/template/base/modules/outlet_sales/module.rk +1 -1
- package/template/base/modules/payroll/flows/cash_advance_cancel_guard.rk +15 -0
- package/template/base/modules/payroll/flows/payslip_advance_guard.rk +20 -0
- package/template/base/modules/payroll/flows/payslip_casual_guard.rk +19 -0
- package/template/base/modules/payroll/flows/payslip_from_recap.rk +1 -1
- package/template/base/modules/payroll/flows/payslip_ytd_guard.rk +3 -1
- package/template/base/modules/payroll/flows/payslip_ytd_on_create.rk +3 -1
- package/template/base/modules/payroll/models/cash_advance.rk +53 -0
- package/template/base/modules/payroll/models/payroll_guard.rk +15 -0
- package/template/base/modules/payroll/models/payroll_profile.rk +11 -1
- package/template/base/modules/payroll/models/payslip.rk +66 -7
- package/template/base/modules/payroll/module.rk +1 -1
- package/template/base/modules/payroll/print/payslip.html +4 -3
- package/template/base/modules/pos/models/pos_sale.rk +2 -1
- package/template/base/modules/pos/models/pos_sale_item.rk +3 -0
- package/template/base/modules/procurement/models/vendor_bill.rk +3 -2
- package/template/base/modules/procurement/module.rk +1 -1
- package/template/base/modules/projects/models/assignment.rk +2 -2
- package/template/base/modules/projects/models/timesheet.rk +5 -0
- package/template/base/modules/projects/module.rk +1 -1
- package/template/base/modules/workforce/models/worker.rk +4 -4
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
|
|
2
2
|
# Head office picked the outlet and the item of an unmapped Moka line: it becomes staged and goes into the next daily
|
|
3
|
-
# recap (flow moka_daily_sales).
|
|
3
|
+
# recap (flow moka_daily_sales). The unmapped refund lines of the same Moka checkout (same transaction and checkout,
|
|
4
|
+
# or for a line without checkout the same description) take the same outlet and item and are staged with it, so a
|
|
5
|
+
# sale and its refund go into the recap together.
|
|
4
6
|
name: moka_line_mapped
|
|
5
7
|
label: {id: Baris Moka yang sudah dipetakan siap direkap}
|
|
6
8
|
on: moka_sale_line.updated
|
|
@@ -12,3 +14,16 @@ steps:
|
|
|
12
14
|
- update: rec
|
|
13
15
|
set:
|
|
14
16
|
status: "'staged'"
|
|
17
|
+
- find_all: moka_sale_line
|
|
18
|
+
if: event.qty > 0
|
|
19
|
+
where: "name != event.name && transaction == event.transaction && qty < 0 && status == 'unmapped' && (event.checkout != '' ? checkout == event.checkout : (checkout == '' && description == 'Retur ' + event.description))"
|
|
20
|
+
as: refunds
|
|
21
|
+
- for_each: refunds
|
|
22
|
+
if: event.qty > 0
|
|
23
|
+
as: r
|
|
24
|
+
do:
|
|
25
|
+
- update: r
|
|
26
|
+
set:
|
|
27
|
+
outlet: event.outlet
|
|
28
|
+
item: event.item
|
|
29
|
+
status: "'staged'"
|
|
@@ -1,42 +1,60 @@
|
|
|
1
1
|
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
|
|
2
|
-
# Moka API (connector moka, poll per outlet every
|
|
3
|
-
# moka_sale_line per item, plus a refund line per refunded
|
|
4
|
-
# makes the outlet's daily sales draft from the lines, and
|
|
2
|
+
# Moka API (connector moka, poll per outlet every 5 minutes of the transactions CHANGED since two days back): the first
|
|
3
|
+
# event of a transaction becomes a moka_transaction and one moka_sale_line per item, plus a refund line per refunded
|
|
4
|
+
# quantity. Nothing touches stock here: flow moka_daily_sales makes the outlet's daily sales draft from the lines, and
|
|
5
|
+
# stock moves when head office submits it (as with the export).
|
|
5
6
|
# Outlet: Moka's outlet id (outlet.moka_outlet_id), else Moka's outlet name (outlet.moka_name). Item: Moka's SKU = the
|
|
6
7
|
# item's sku, else Moka's item name = item_name. A line without outlet or item is unmapped and head office is told; it
|
|
7
8
|
# waits in Baris penjualan Moka until someone picks them (flow moka_line_mapped) and goes into the recap after that,
|
|
8
9
|
# as its own record for that day if the day was already recapped (an API line is posted exactly once).
|
|
9
|
-
#
|
|
10
|
-
#
|
|
11
|
-
#
|
|
12
|
-
#
|
|
13
|
-
#
|
|
14
|
-
#
|
|
10
|
+
# A later event of a known transaction (Moka changed it: a refund made after the sale was polled, or anything else) adds
|
|
11
|
+
# only refund lines for the quantity refunded since, per Moka checkout (moka_sale_line.checkout: the checkout's uuid,
|
|
12
|
+
# else its id), dated the day of the refund (refunded_date), staged for the recap of that day (or unmapped with its
|
|
13
|
+
# sale line, and mapped with it, flow moka_line_mapped); a change without a new refund adds nothing. A checkout without
|
|
14
|
+
# uuid or id is not matched by name (two lines of one item would share a refund): head office is told to book it.
|
|
15
|
+
# A refunded quantity counts at most the line's quantity. A checkout of qty <= 0 or a negative total is not staged:
|
|
16
|
+
# head office is told to check it in Moka.
|
|
17
|
+
# A transaction delivered twice records nothing: the kernel drops a repeated event and a known transaction only adds the
|
|
18
|
+
# refunded quantity not booked yet; moka_transaction.transaction_id is unique, so two runs racing on a new transaction
|
|
19
|
+
# roll the second back whole.
|
|
20
|
+
# Cost: one moka_transaction scan per event (the kernel reads a model whole for find); no moka_sale_line scan for a
|
|
21
|
+
# new transaction (unmapped lines are told about line by line), two per checkout for a refund.
|
|
22
|
+
# The day is the first 10 characters of created_at (Moka answers in the outlet's local time, +07:00); a time in UTC
|
|
23
|
+
# (ending in Z) is taken as WIB (+7 hours) first. The same for refunded_date. To confirm once API access is granted.
|
|
24
|
+
# Idempotency: the transaction and its refunded quantity, so a new refund is a new run and a repeat is not.
|
|
15
25
|
name: moka_transaction_staged
|
|
16
26
|
label: {id: Transaksi Moka masuk jadi baris penjualan}
|
|
17
27
|
on: moka.transaction_created
|
|
18
28
|
if: "'transaction_id' in event && 'created_at' in event && 'checkouts' in event && 'outlet_id' in event"
|
|
19
|
-
idempotency: string(event.transaction_id)
|
|
29
|
+
idempotency: "string(event.transaction_id) + ':' + string(event.checkouts.map(c, 'refunded_quantity' in c && c.refunded_quantity != null ? c.refunded_quantity : 0).sum())"
|
|
20
30
|
steps:
|
|
31
|
+
- find: moka_transaction
|
|
32
|
+
where: transaction_id == string(event.transaction_id)
|
|
33
|
+
as: known
|
|
34
|
+
# a new transaction
|
|
21
35
|
- find: outlet
|
|
36
|
+
if: known == null
|
|
22
37
|
where: "moka_outlet_id != '' && moka_outlet_id == string(event.outlet_id)"
|
|
23
38
|
as: by_id
|
|
24
39
|
- find: outlet
|
|
40
|
+
if: known == null
|
|
25
41
|
where: "moka_name != '' && moka_name == ('outlet_name' in event ? event.outlet_name : '')"
|
|
26
42
|
as: by_name
|
|
27
43
|
- create: moka_transaction
|
|
44
|
+
if: known == null
|
|
28
45
|
set:
|
|
29
46
|
transaction_id: string(event.transaction_id)
|
|
30
47
|
receipt_no: "'receipt_no' in event ? event.receipt_no : ''"
|
|
31
48
|
outlet: "by_id != null ? by_id.name : (by_name != null ? by_name.name : '')"
|
|
32
49
|
moka_outlet: "'outlet_name' in event ? event.outlet_name : string(event.outlet_id)"
|
|
33
50
|
sold_at: event.created_at
|
|
34
|
-
date: event.created_at
|
|
51
|
+
date: "string(event.created_at).matches('Z$') ? event.created_at + duration('7h') : event.created_at"
|
|
35
52
|
payment_type: "'payment_type' in event ? event.payment_type : ''"
|
|
36
53
|
total_collected: "'total_collected' in event ? event.total_collected : 0"
|
|
37
54
|
refunded: "'is_refunded' in event && event.is_refunded == true"
|
|
38
55
|
as: tx
|
|
39
56
|
- for_each: event.checkouts
|
|
57
|
+
if: known == null
|
|
40
58
|
as: c
|
|
41
59
|
do:
|
|
42
60
|
- find: item
|
|
@@ -45,12 +63,13 @@ steps:
|
|
|
45
63
|
- find: item
|
|
46
64
|
where: "item_name == c.item_name"
|
|
47
65
|
as: by_item_name
|
|
48
|
-
# a sale line only for a positive quantity, its discount never above its gross (outlet_sales rules
|
|
66
|
+
# a sale line only for a positive quantity and total, its discount never above its gross (outlet_sales rules
|
|
49
67
|
# qty_not_negative and discount_within_gross refuse anything else, and one refused line would stop the recap)
|
|
50
68
|
- create: moka_sale_line
|
|
51
|
-
if: c.quantity > 0
|
|
69
|
+
if: "c.quantity > 0 && c.total_price >= 0"
|
|
52
70
|
set:
|
|
53
71
|
transaction: tx.name
|
|
72
|
+
checkout: "('uuid' in c && c.uuid != null && string(c.uuid) != '' ? string(c.uuid) : ('id' in c && c.id != null ? string(c.id) : ''))"
|
|
54
73
|
outlet: tx.outlet
|
|
55
74
|
date: tx.date
|
|
56
75
|
item: "by_sku != null ? by_sku.name : (by_item_name != null ? by_item_name.name : '')"
|
|
@@ -63,28 +82,70 @@ steps:
|
|
|
63
82
|
status: "tx.outlet == '' || (by_sku == null && by_item_name == null) ? 'unmapped' : 'staged'"
|
|
64
83
|
- create: moka_sale_line
|
|
65
84
|
# a refund line only when it returns money: a refund of a free item (100% discount) changes nothing and a line of
|
|
66
|
-
# qty < 0 without refund is refused by outlet_sales
|
|
67
|
-
if: "c.quantity > 0 && 'refunded_quantity' in c && c.refunded_quantity > 0 && round((c.total_price - min('discount_amount' in c ? c.discount_amount : 0, c.total_price)) * c.refunded_quantity / c.quantity) > 0"
|
|
85
|
+
# qty < 0 without refund is refused by outlet_sales; never more than the quantity sold
|
|
86
|
+
if: "c.quantity > 0 && c.total_price >= 0 && 'refunded_quantity' in c && c.refunded_quantity > 0 && round((c.total_price - min('discount_amount' in c ? c.discount_amount : 0, c.total_price)) * min(c.refunded_quantity, c.quantity) / c.quantity) > 0"
|
|
68
87
|
set:
|
|
69
88
|
transaction: tx.name
|
|
89
|
+
checkout: "('uuid' in c && c.uuid != null && string(c.uuid) != '' ? string(c.uuid) : ('id' in c && c.id != null ? string(c.id) : ''))"
|
|
70
90
|
outlet: tx.outlet
|
|
71
91
|
date: tx.date
|
|
72
92
|
item: "by_sku != null ? by_sku.name : (by_item_name != null ? by_item_name.name : '')"
|
|
73
93
|
description: "'Retur ' + c.item_name + ('item_variant_name' in c && c.item_variant_name != '' ? ' ' + c.item_variant_name : '')"
|
|
74
94
|
sku: "'sku' in c ? c.sku : ''"
|
|
75
|
-
qty: -c.refunded_quantity
|
|
95
|
+
qty: -min(c.refunded_quantity, c.quantity)
|
|
76
96
|
gross: "0"
|
|
77
97
|
discount: "0"
|
|
78
|
-
refund: "round((c.total_price - min('discount_amount' in c ? c.discount_amount : 0, c.total_price)) * c.refunded_quantity / c.quantity)"
|
|
98
|
+
refund: "round((c.total_price - min('discount_amount' in c ? c.discount_amount : 0, c.total_price)) * min(c.refunded_quantity, c.quantity) / c.quantity)"
|
|
79
99
|
status: "tx.outlet == '' || (by_sku == null && by_item_name == null) ? 'unmapped' : 'staged'"
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
100
|
+
- notify: head_office
|
|
101
|
+
if: "tx.outlet != '' && c.quantity > 0 && c.total_price >= 0 && by_sku == null && by_item_name == null"
|
|
102
|
+
channel: email
|
|
103
|
+
template: {id: 'Moka {tx.receipt_no} ({tx.moka_outlet}, {tx.date}): barang "{c.item_name}" belum dikenali, petakan di Baris penjualan Moka'}
|
|
83
104
|
- notify: head_office
|
|
84
|
-
if: "event.checkouts.map(c, c.quantity > 0 ? 0 : 1).sum() > 0"
|
|
105
|
+
if: "known == null && event.checkouts.map(c, c.quantity > 0 && c.total_price >= 0 ? 0 : 1).sum() > 0"
|
|
85
106
|
channel: email
|
|
86
|
-
template: {id: 'Moka {tx.receipt_no} ({tx.moka_outlet}, {tx.date}) punya barang dengan qty 0 atau minus, tidak direkap. Cek di Moka'}
|
|
107
|
+
template: {id: 'Moka {tx.receipt_no} ({tx.moka_outlet}, {tx.date}) punya barang dengan qty 0 atau minus, atau total minus, tidak direkap. Cek di Moka'}
|
|
87
108
|
- notify: head_office
|
|
88
|
-
if:
|
|
109
|
+
if: "known == null && tx.outlet == ''"
|
|
89
110
|
channel: email
|
|
90
|
-
template: {id: 'Moka {tx.receipt_no} ({tx.moka_outlet}, {tx.date}):
|
|
111
|
+
template: {id: 'Moka {tx.receipt_no} ({tx.moka_outlet}, {tx.date}): outlet belum dikenali, petakan barisnya di Baris penjualan Moka'}
|
|
112
|
+
# a known transaction that changed in Moka: refunds made after the first poll
|
|
113
|
+
- for_each: event.checkouts
|
|
114
|
+
if: known != null
|
|
115
|
+
as: c
|
|
116
|
+
do:
|
|
117
|
+
- find: moka_sale_line
|
|
118
|
+
where: "('uuid' in c && c.uuid != null && string(c.uuid) != '' ? string(c.uuid) : ('id' in c && c.id != null ? string(c.id) : '')) != '' && transaction == known.name && qty > 0 && checkout == ('uuid' in c && c.uuid != null && string(c.uuid) != '' ? string(c.uuid) : ('id' in c && c.id != null ? string(c.id) : ''))"
|
|
119
|
+
as: sold
|
|
120
|
+
- notify: head_office
|
|
121
|
+
if: "('uuid' in c && c.uuid != null && string(c.uuid) != '' ? string(c.uuid) : ('id' in c && c.id != null ? string(c.id) : '')) == '' && 'refunded_quantity' in c && c.refunded_quantity != null && c.refunded_quantity > 0"
|
|
122
|
+
channel: email
|
|
123
|
+
template: {id: 'Moka {known.receipt_no} ({known.moka_outlet}): retur {c.item_name} tanpa ID baris Moka, catat manual'}
|
|
124
|
+
- find_all: moka_sale_line
|
|
125
|
+
if: sold != null
|
|
126
|
+
where: "transaction == known.name && qty < 0 && checkout == sold.checkout && description == 'Retur ' + sold.description"
|
|
127
|
+
as: returned
|
|
128
|
+
- create: moka_sale_line
|
|
129
|
+
if: "sold != null && 'refunded_quantity' in c && min(c.refunded_quantity, sold.qty) + returned.map(l, l.qty).sum() > 0 && round((sold.gross - sold.discount) * (min(c.refunded_quantity, sold.qty) + returned.map(l, l.qty).sum()) / sold.qty) > 0"
|
|
130
|
+
set:
|
|
131
|
+
transaction: known.name
|
|
132
|
+
checkout: sold.checkout
|
|
133
|
+
outlet: sold.outlet
|
|
134
|
+
date: "'refunded_date' in event && event.refunded_date != null && event.refunded_date != '' ? (string(event.refunded_date).matches('Z$') ? event.refunded_date + duration('7h') : event.refunded_date) : today()"
|
|
135
|
+
item: sold.item
|
|
136
|
+
description: "'Retur ' + sold.description"
|
|
137
|
+
sku: sold.sku
|
|
138
|
+
qty: -(min(c.refunded_quantity, sold.qty) + returned.map(l, l.qty).sum())
|
|
139
|
+
gross: "0"
|
|
140
|
+
discount: "0"
|
|
141
|
+
refund: "round((sold.gross - sold.discount) * (min(c.refunded_quantity, sold.qty) + returned.map(l, l.qty).sum()) / sold.qty)"
|
|
142
|
+
status: "sold.status == 'unmapped' || sold.outlet == '' || sold.item == '' ? 'unmapped' : 'staged'"
|
|
143
|
+
as: late
|
|
144
|
+
- notify: head_office
|
|
145
|
+
if: "sold != null && 'refunded_quantity' in c && min(c.refunded_quantity, sold.qty) + returned.map(l, l.qty).sum() > 0 && round((sold.gross - sold.discount) * (min(c.refunded_quantity, sold.qty) + returned.map(l, l.qty).sum()) / sold.qty) > 0"
|
|
146
|
+
channel: email
|
|
147
|
+
template: {id: 'Moka {known.receipt_no} ({known.moka_outlet}): retur susulan {sold.description} dicatat di Baris penjualan Moka'}
|
|
148
|
+
- update: known
|
|
149
|
+
if: "known != null && 'is_refunded' in event && event.is_refunded == true && !known.refunded"
|
|
150
|
+
set:
|
|
151
|
+
refunded: "true"
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
|
|
2
2
|
# Inside an outlet_sales cancel: refused while a live Retur ke stok comes from it. The return's goods came in at this
|
|
3
|
-
# sale's cost; cancelling the sale would put its goods back as well, so they would be counted back twice.
|
|
3
|
+
# sale's cost; cancelling the sale would put its goods back as well, so they would be counted back twice. A cancel
|
|
4
|
+
# that goes through marks the Retur di kasir, whose open qty is then 0 (QA stock-returns N3).
|
|
4
5
|
name: sales_cancel_guard
|
|
5
6
|
label: {id: Penjualan yang sudah dikembalikan ke stok tidak bisa dibatalkan}
|
|
6
7
|
on: outlet_sales.cancelled
|
|
@@ -12,3 +13,6 @@ steps:
|
|
|
12
13
|
- if: ret != null
|
|
13
14
|
create: outlet_sales_guard
|
|
14
15
|
set: {reason: "'sales_returned'", document: ret.name}
|
|
16
|
+
- update: rf
|
|
17
|
+
if: rf != null && ret == null
|
|
18
|
+
set: {sales_cancelled: true}
|
|
@@ -3,7 +3,10 @@
|
|
|
3
3
|
# record, not a child table, so the daily flow can read every line of an outlet and day with one find_all.
|
|
4
4
|
# status: staged (ready), unmapped (no outlet or no item matched: head office picks them here and the line becomes
|
|
5
5
|
# staged, flow moka_line_mapped; head office may still correct them while staged), posted (in outlet_sales `sales`). A refunded quantity is its own line, as in the
|
|
6
|
-
# export import: qty < 0, gross 0, refund = the refunded share of the line's net.
|
|
6
|
+
# export import: qty < 0, gross 0, refund = the refunded share of the line's net. A refund Moka reports after the first
|
|
7
|
+
# poll is a refund line of its own, dated the day of the refund (flow moka_transaction_staged).
|
|
8
|
+
# The recap sends a staged line back to unmapped (item or outlet emptied, head office told) when its item or outlet was
|
|
9
|
+
# deleted or the outlet no longer uses Moka, so one such line never stops the recap of other outlets and days.
|
|
7
10
|
name: moka_sale_line
|
|
8
11
|
label: {id: Baris penjualan Moka, en: Moka sales line}
|
|
9
12
|
icon: store
|
|
@@ -16,6 +19,8 @@ permissions:
|
|
|
16
19
|
- {role: head_office, read: true, export: true}
|
|
17
20
|
fields:
|
|
18
21
|
- {name: transaction, type: link, to: moka_transaction, label: {id: Transaksi Moka}, read_only: true, in_list: true}
|
|
22
|
+
# Moka's checkout id: the sale line and its refund lines share it, so a refund made later adds only what is new
|
|
23
|
+
- {name: checkout, type: data, label: {id: ID baris di Moka}, read_only: true}
|
|
19
24
|
- {name: outlet, type: link, to: outlet, label: {id: Outlet}, in_list: true}
|
|
20
25
|
- {name: date, type: date, label: {id: Tanggal}, read_only: true, in_list: true}
|
|
21
26
|
- {name: item, type: link, to: item, label: {id: Barang}, in_list: true}
|
|
@@ -19,7 +19,10 @@ fields:
|
|
|
19
19
|
- {name: date, type: date, label: {id: Tanggal penjualan}, read_only: true, in_list: true}
|
|
20
20
|
- {name: items, type: table, of: pos_refund_item, label: {id: Barang diretur}, read_only: true}
|
|
21
21
|
- {name: refunded_qty, type: float, label: {id: Qty diretur}, compute: "items.map(i, i.refunded_qty).sum()", in_list: true}
|
|
22
|
-
|
|
22
|
+
# Set by sales_cancel_guard when the sale is cancelled: its goods went back with the cancel, nothing is left to return
|
|
23
|
+
# (QA stock-returns N3).
|
|
24
|
+
- {name: sales_cancelled, type: check, label: {id: Penjualan dibatalkan}, read_only: true, default: 'false'}
|
|
25
|
+
- {name: open_qty, type: float, label: {id: Belum kembali ke stok}, compute: "sales_cancelled ? 0.0 : items.map(i, i.refunded_qty - i.returned_qty).sum()", in_list: true}
|
|
23
26
|
rules:
|
|
24
27
|
# every field is read_only, so a record typed by a person has no sale: only the flow makes one (QA N1)
|
|
25
28
|
- name: has_sales
|
|
@@ -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: outlet_sales
|
|
3
|
-
version: 1.
|
|
3
|
+
version: 1.4.0
|
|
4
4
|
title: {id: Penjualan outlet, en: Outlet sales}
|
|
5
5
|
summary:
|
|
6
6
|
id: Rekap penjualan harian per outlet, setoran kas dan retur di kasir.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
|
|
2
|
+
name: cash_advance_cancel_guard
|
|
3
|
+
label: {id: Kasbon yang sudah dipotong dari gaji tidak bisa dibatalkan}
|
|
4
|
+
# Inside a cash_advance cancel: refused while a submitted slip repays it, since its cancel would put the cash back
|
|
5
|
+
# that the slip already took off the wages (Piutang karyawan below 0; audit gelombang 3 F5).
|
|
6
|
+
on: cash_advance.cancelled
|
|
7
|
+
steps:
|
|
8
|
+
- find: payslip
|
|
9
|
+
where: cash_advance == event.name && docstatus == 1
|
|
10
|
+
as: slip
|
|
11
|
+
- if: slip != null
|
|
12
|
+
create: payroll_guard
|
|
13
|
+
set:
|
|
14
|
+
reason: "'advance_repaid'"
|
|
15
|
+
document: slip.name
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
|
|
2
|
+
name: payslip_advance_guard
|
|
3
|
+
label: {id: Potongan kasbon tidak melebihi kasbonnya}
|
|
4
|
+
# Inside a payslip submit: the live slips that repay one kasbon (this one included) never deduct more than the kasbon
|
|
5
|
+
# (audit gelombang 3 F5). The kasbon's own cancel is refused while one of them is submitted (cash_advance_cancel_guard).
|
|
6
|
+
on: payslip.submitted
|
|
7
|
+
steps:
|
|
8
|
+
- if: event.cash_advance != ''
|
|
9
|
+
find: cash_advance
|
|
10
|
+
where: name == event.cash_advance && docstatus == 1
|
|
11
|
+
as: ka
|
|
12
|
+
- if: event.cash_advance != ''
|
|
13
|
+
find_all: payslip
|
|
14
|
+
where: cash_advance == event.cash_advance && docstatus == 1 && name != event.name
|
|
15
|
+
as: others
|
|
16
|
+
- if: event.cash_advance != '' && (ka == null || others.map(p, p.other_deduction).sum() + event.other_deduction > ka.amount)
|
|
17
|
+
create: payroll_guard
|
|
18
|
+
set:
|
|
19
|
+
reason: "'advance_exceeded'"
|
|
20
|
+
document: event.name
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
|
|
2
|
+
name: payslip_casual_guard
|
|
3
|
+
label: {id: Pindah dari pegawai tetap ke tidak tetap menutup tahun pajaknya dulu}
|
|
4
|
+
# Inside a payslip submit under the daily TER (casual, paid per day): a worker who was a permanent employee earlier in
|
|
5
|
+
# the tax year has left that employment, so their last permanent slip must be the recomputed one (last_month,
|
|
6
|
+
# PMK 168/2023 masa pajak terakhir); otherwise the TER withheld on those months is never settled (audit gelombang 3 F1).
|
|
7
|
+
on: payslip.submitted
|
|
8
|
+
steps:
|
|
9
|
+
- if: event.employment == 'casual' && event.pay_basis == 'daily'
|
|
10
|
+
find_all: payslip
|
|
11
|
+
where: worker == event.worker && tax_year == event.tax_year && tax_month < event.tax_month && docstatus == 1 && !(employment == 'casual' && pay_basis == 'daily')
|
|
12
|
+
sort: -tax_month
|
|
13
|
+
limit: 1
|
|
14
|
+
as: perm
|
|
15
|
+
- if: event.employment == 'casual' && event.pay_basis == 'daily' && size(perm) > 0 && !perm[0].last_month
|
|
16
|
+
create: payroll_guard
|
|
17
|
+
set:
|
|
18
|
+
reason: "'casual_after_permanent'"
|
|
19
|
+
document: perm[0].name
|
|
@@ -29,7 +29,7 @@ steps:
|
|
|
29
29
|
document: other.name
|
|
30
30
|
- if: prof != null && run != null
|
|
31
31
|
find_all: payslip
|
|
32
|
-
where: worker == event.worker && tax_year == run.tax_year && tax_month < run.tax_month && docstatus == 1
|
|
32
|
+
where: worker == event.worker && tax_year == run.tax_year && tax_month < run.tax_month && docstatus == 1 && !(employment == 'casual' && pay_basis == 'daily')
|
|
33
33
|
as: prev
|
|
34
34
|
- if: prof != null && run != null
|
|
35
35
|
create: payslip
|
|
@@ -4,10 +4,12 @@ label: {id: Slip gaji dengan penghasilan sebelumnya yang basi tidak bisa diajuka
|
|
|
4
4
|
# Inside the submit: when the earlier submitted months of this worker and year no longer match the slip's year-to-date
|
|
5
5
|
# fields (an earlier slip was submitted or cancelled after this one was made), the submit is refused: delete the draft and make it
|
|
6
6
|
# again. The December recomputation never runs on stale sums.
|
|
7
|
+
# Slips under the daily TER (casual, paid per day) are not part of the year: the December recomputation covers the
|
|
8
|
+
# months as a permanent employee only (PMK 168/2023; audit gelombang 3 F1).
|
|
7
9
|
on: payslip.submitted
|
|
8
10
|
steps:
|
|
9
11
|
- find_all: payslip
|
|
10
|
-
where: worker == event.worker && tax_year == event.tax_year && tax_month < event.tax_month && docstatus == 1
|
|
12
|
+
where: worker == event.worker && tax_year == event.tax_year && tax_month < event.tax_month && docstatus == 1 && !(employment == 'casual' && pay_basis == 'daily')
|
|
11
13
|
as: prev
|
|
12
14
|
- if: size(prev) != event.ytd_months || prev.map(p, p.gross_taxable).sum() != event.ytd_gross || prev.map(p, p.pph21).sum() != event.ytd_pph21 || prev.map(p, p.jht_employee + p.jp_employee).sum() != event.ytd_pension
|
|
13
15
|
create: payroll_guard
|
|
@@ -4,10 +4,12 @@ label: {id: Slip gaji membaca penghasilan sebelumnya tahun ini}
|
|
|
4
4
|
# Year to date for the December (last) recomputation: the sums of this worker's submitted slips of the same tax year in
|
|
5
5
|
# earlier tax months (submitted = paid, whether or not the run is closed yet). Filled on every slip made by hand; the
|
|
6
6
|
# slips a recap makes get them from payslip_from_recap (a flow's writes start no flows).
|
|
7
|
+
# Slips under the daily TER (casual, paid per day) are not part of the year: the December recomputation covers the
|
|
8
|
+
# months as a permanent employee only (PMK 168/2023; audit gelombang 3 F1).
|
|
7
9
|
on: payslip.created
|
|
8
10
|
steps:
|
|
9
11
|
- find_all: payslip
|
|
10
|
-
where: worker == event.worker && tax_year == event.tax_year && tax_month < event.tax_month && docstatus == 1
|
|
12
|
+
where: worker == event.worker && tax_year == event.tax_year && tax_month < event.tax_month && docstatus == 1 && !(employment == 'casual' && pay_basis == 'daily')
|
|
11
13
|
as: prev
|
|
12
14
|
- find: payslip
|
|
13
15
|
where: name == event.name
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/model.json
|
|
2
|
+
name: cash_advance
|
|
3
|
+
label: {id: Kasbon, en: Cash advance}
|
|
4
|
+
icon: wallet
|
|
5
|
+
is_submittable: true
|
|
6
|
+
naming: KSB-{YYYY}-{#####}
|
|
7
|
+
title_field: worker
|
|
8
|
+
# Money lent to a worker ahead of their pay (kasbon). Submitting it books Dr Piutang karyawan (1-1330) / Cr Kas or Bank
|
|
9
|
+
# (accounting module), so the repayment taken from wages (payslip other_deduction, Cr 1-1330 in the payroll close)
|
|
10
|
+
# brings the receivable back to 0 instead of below it (audit akuntansi r4 L-i). Finance gives and records it. A slip
|
|
11
|
+
# links the kasbon it repays (payslip.cash_advance): the kasbon cannot be cancelled while a submitted slip repays it,
|
|
12
|
+
# and the live slips never deduct more than its amount (payslip_advance_guard, cash_advance_cancel_guard).
|
|
13
|
+
permissions:
|
|
14
|
+
- {role: finance_manager, read: true, create: true, write: true, delete: true, submit: true, cancel: true, amend: true, export: true, print: true}
|
|
15
|
+
- {role: project_admin, read: true}
|
|
16
|
+
fields:
|
|
17
|
+
- name: worker
|
|
18
|
+
type: link
|
|
19
|
+
to: worker
|
|
20
|
+
label: {id: Tenaga kerja}
|
|
21
|
+
required: true
|
|
22
|
+
in_list: true
|
|
23
|
+
- name: advance_date
|
|
24
|
+
type: date
|
|
25
|
+
label: {id: Tanggal kasbon}
|
|
26
|
+
required: true
|
|
27
|
+
default: today()
|
|
28
|
+
in_list: true
|
|
29
|
+
- name: amount
|
|
30
|
+
type: currency
|
|
31
|
+
label: {id: Jumlah}
|
|
32
|
+
required: true
|
|
33
|
+
in_list: true
|
|
34
|
+
- name: method
|
|
35
|
+
type: select
|
|
36
|
+
label: {id: Dibayar dari}
|
|
37
|
+
default: "'cash'"
|
|
38
|
+
options:
|
|
39
|
+
- {value: cash, label: {id: Kas}}
|
|
40
|
+
- {value: bank, label: {id: Bank}}
|
|
41
|
+
- name: notes
|
|
42
|
+
type: text
|
|
43
|
+
label: {id: Keperluan}
|
|
44
|
+
rules:
|
|
45
|
+
- name: amount_positive
|
|
46
|
+
on: save
|
|
47
|
+
check: amount > 0 && amount == round(amount)
|
|
48
|
+
message: {id: Jumlah kasbon harus rupiah bulat lebih dari 0}
|
|
49
|
+
views:
|
|
50
|
+
list:
|
|
51
|
+
columns: [name, advance_date, worker, amount, method]
|
|
52
|
+
filters: [worker]
|
|
53
|
+
sort: -advance_date
|
|
@@ -28,6 +28,9 @@ fields:
|
|
|
28
28
|
- {value: invoice_tag, label: {id: Catatan faktur tenaga kerja}}
|
|
29
29
|
- {value: invoice_twice, label: {id: Faktur kedua periode gaji}}
|
|
30
30
|
- {value: pay_overlap, label: {id: Hari kerja dibayar dua kali}}
|
|
31
|
+
- {value: advance_exceeded, label: {id: Potongan melebihi kasbon}}
|
|
32
|
+
- {value: advance_repaid, label: {id: Kasbon sudah dipotong}}
|
|
33
|
+
- {value: casual_after_permanent, label: {id: Slip tetap terakhir belum dihitung ulang}}
|
|
31
34
|
- name: document
|
|
32
35
|
type: data
|
|
33
36
|
label: {id: Dokumen}
|
|
@@ -72,3 +75,15 @@ rules:
|
|
|
72
75
|
on: save
|
|
73
76
|
check: reason != 'pay_overlap'
|
|
74
77
|
message: {id: 'Pekerja ini sudah dibayar untuk sebagian hari periode ini di periode gaji lain'}
|
|
78
|
+
- name: advance_exceeded
|
|
79
|
+
on: save
|
|
80
|
+
check: reason != 'advance_exceeded'
|
|
81
|
+
message: {id: 'Potongan kasbon di slip-slip yang diajukan melebihi kasbonnya, atau kasbonnya belum diajukan: kurangi potongannya'}
|
|
82
|
+
- name: advance_repaid
|
|
83
|
+
on: save
|
|
84
|
+
check: reason != 'advance_repaid'
|
|
85
|
+
message: {id: 'Kasbon ini sudah dipotong dari slip gaji yang diajukan; batalkan slip gajinya dulu'}
|
|
86
|
+
- name: casual_after_permanent
|
|
87
|
+
on: save
|
|
88
|
+
check: reason != 'casual_after_permanent'
|
|
89
|
+
message: {id: 'Pekerja ini pegawai tetap di bulan sebelumnya tahun ini: tandai slip tetap terakhirnya sebagai masa pajak terakhir (hitung tahunan) dulu'}
|
|
@@ -60,6 +60,16 @@ fields:
|
|
|
60
60
|
options:
|
|
61
61
|
- {value: daily, label: {id: Harian (upah x hari hadir)}}
|
|
62
62
|
- {value: monthly, label: {id: Bulanan (gaji pokok tetap)}}
|
|
63
|
+
# PMK 168/2023: a pegawai tidak tetap (tenaga kerja lepas, paid only for the days worked) who is paid per day or per
|
|
64
|
+
# week has PPh 21 by the daily TER (bruto sehari x TER harian; above 2.500.000 a day, 50% x Pasal 17), not the monthly
|
|
65
|
+
# TER, and no December recomputation. Paid monthly, the same worker takes the monthly TER: keep Tetap.
|
|
66
|
+
- name: employment
|
|
67
|
+
type: select
|
|
68
|
+
label: {id: Status pegawai (PPh 21)}
|
|
69
|
+
default: "'permanent'"
|
|
70
|
+
options:
|
|
71
|
+
- {value: permanent, label: {id: Tetap atau dibayar bulanan (TER bulanan)}}
|
|
72
|
+
- {value: casual, label: {id: 'Tidak tetap, dibayar harian atau mingguan (TER harian)'}}
|
|
63
73
|
- name: monthly_salary
|
|
64
74
|
type: currency
|
|
65
75
|
label: {id: Gaji pokok per bulan}
|
|
@@ -128,7 +138,7 @@ views:
|
|
|
128
138
|
- [ptkp_status, ter_category, active]
|
|
129
139
|
- section: {id: Gaji}
|
|
130
140
|
columns:
|
|
131
|
-
- [pay_basis, monthly_salary]
|
|
141
|
+
- [pay_basis, employment, monthly_salary]
|
|
132
142
|
- [fixed_allowance, daily_allowance]
|
|
133
143
|
- section: {id: BPJS dan rekening}
|
|
134
144
|
columns:
|
|
@@ -64,6 +64,13 @@ fields:
|
|
|
64
64
|
options:
|
|
65
65
|
- {value: daily, label: {id: Harian}}
|
|
66
66
|
- {value: monthly, label: {id: Bulanan}}
|
|
67
|
+
- name: employment
|
|
68
|
+
type: select
|
|
69
|
+
label: {id: Status pegawai (PPh 21)}
|
|
70
|
+
default: profile.employment
|
|
71
|
+
options:
|
|
72
|
+
- {value: permanent, label: {id: Tetap atau dibayar bulanan}}
|
|
73
|
+
- {value: casual, label: {id: 'Tidak tetap, dibayar harian'}}
|
|
67
74
|
- {name: days, type: float, label: {id: Hari hadir}, default: '0', in_list: true}
|
|
68
75
|
- {name: day_rate, type: currency, label: {id: Upah per hari}, default: profile.worker.cost_day_rate}
|
|
69
76
|
- {name: monthly_salary, type: currency, label: {id: Gaji pokok per bulan}, default: profile.monthly_salary}
|
|
@@ -74,10 +81,21 @@ fields:
|
|
|
74
81
|
# overtime rate is set.
|
|
75
82
|
- {name: overtime_days, type: float, label: {id: Hari ada lembur}, default: '0'}
|
|
76
83
|
- {name: overtime_rate, type: currency, label: {id: Upah lembur per jam (sudah ditimbang)}, default: profile.worker.overtime_cost_rate}
|
|
84
|
+
# Work on a rest day or a public holiday (PP 35/2021 Pasal 31), always at the PP 35 multipliers of 1/173 of the monthly
|
|
85
|
+
# wage. The hours are entered per multiplier, summed over the days (the tiers count per day, so they cannot come from
|
|
86
|
+
# a total): 6-day week, hours 1-7 of each day 2x, the 8th 3x, the 9th-11th 4x; 5-day week, 1-8 2x, the 9th 3x, the
|
|
87
|
+
# 10th-12th 4x; a holiday on the shortest day of a 6-day week, 1-5 2x, the 6th 3x, the 7th-9th 4x. Audit gelombang 3 F3.
|
|
88
|
+
- {name: holiday_overtime_days, type: float, label: {id: Hari libur masuk kerja}, default: '0'}
|
|
89
|
+
- {name: holiday_hours_2x, type: float, label: {id: 'Jam hari libur dibayar 2x'}, default: '0'}
|
|
90
|
+
- {name: holiday_hours_3x, type: float, label: {id: 'Jam hari libur dibayar 3x'}, default: '0'}
|
|
91
|
+
- {name: holiday_hours_4x, type: float, label: {id: 'Jam hari libur dibayar 4x'}, default: '0'}
|
|
77
92
|
# THR: months of service (12 or more = one month's wage, fewer = pro rata; under 1 = none). 0 = no THR this month.
|
|
78
93
|
- {name: thr_tenure_months, type: float, label: {id: Masa kerja untuk THR (bulan)}, default: '0'}
|
|
79
94
|
- {name: other_income, type: currency, label: {id: Insentif lain}, default: '0'}
|
|
80
95
|
- {name: other_deduction, type: currency, label: {id: Potongan lain (kasbon)}, default: '0'}
|
|
96
|
+
# The kasbon this deduction repays (cash_advance of the same worker, submitted): its cancel is then refused, and the
|
|
97
|
+
# live slips linking it never deduct more than it (payslip_advance_guard, audit gelombang 3 F5).
|
|
98
|
+
- {name: cash_advance, type: link, to: cash_advance, label: {id: Kasbon yang dipotong}}
|
|
81
99
|
- name: ptkp_status
|
|
82
100
|
type: select
|
|
83
101
|
label: {id: Status PTKP}
|
|
@@ -118,6 +136,10 @@ fields:
|
|
|
118
136
|
type: currency
|
|
119
137
|
label: {id: Lembur}
|
|
120
138
|
compute: "overtime_rate > 0 ? round(overtime_hours * overtime_rate) : round(month_wage * 1.0 / 173 * (1.5 * (overtime_days < overtime_hours ? overtime_days : overtime_hours) + 2.0 * (overtime_hours - (overtime_days < overtime_hours ? overtime_days : overtime_hours))))"
|
|
139
|
+
- name: holiday_overtime_pay
|
|
140
|
+
type: currency
|
|
141
|
+
label: {id: Lembur hari libur}
|
|
142
|
+
compute: "round(month_wage * 1.0 / 173 * (2.0 * holiday_hours_2x + 3.0 * holiday_hours_3x + 4.0 * holiday_hours_4x))"
|
|
121
143
|
- name: allowance_pay
|
|
122
144
|
type: currency
|
|
123
145
|
label: {id: Tunjangan}
|
|
@@ -129,7 +151,7 @@ fields:
|
|
|
129
151
|
- name: cash_gross
|
|
130
152
|
type: currency
|
|
131
153
|
label: {id: 'Penghasilan (gaji, tunjangan, lembur, THR)'}
|
|
132
|
-
compute: base_pay + overtime_pay + allowance_pay + thr_pay + other_income
|
|
154
|
+
compute: base_pay + overtime_pay + holiday_overtime_pay + allowance_pay + thr_pay + other_income
|
|
133
155
|
in_list: true
|
|
134
156
|
# BPJS wage: pokok + tunjangan tetap, never below the UMK of the site.
|
|
135
157
|
- name: bpjs_base
|
|
@@ -173,6 +195,32 @@ fields:
|
|
|
173
195
|
label: {id: PPh 21 TER bulan ini}
|
|
174
196
|
hidden: true
|
|
175
197
|
compute: "round(gross_taxable * ter_bp * (has_tax_id ? 100 : 120) / 1000000.0 - 0.5)"
|
|
198
|
+
# Daily TER (PP 58/2023, PMK 168/2023 Pasal 16 ayat 2) for a pegawai tidak tetap paid per day: bruto sehari = this
|
|
199
|
+
# slip's gross over the days worked (present + rest days worked, audit F2); up to 450.000 0%, up to 2.500.000 0,5%;
|
|
200
|
+
# above that the Pasal 17 layers on 50% of the gross paid (per payment, not cumulative, audit F7). x 120% without a
|
|
201
|
+
# tax number; truncated to the rupiah.
|
|
202
|
+
- name: ter_daily
|
|
203
|
+
type: check
|
|
204
|
+
label: {id: PPh 21 TER harian}
|
|
205
|
+
hidden: true
|
|
206
|
+
compute: "employment == 'casual' && pay_basis == 'daily'"
|
|
207
|
+
- name: daily_gross
|
|
208
|
+
type: currency
|
|
209
|
+
label: {id: Bruto sehari (TER harian)}
|
|
210
|
+
depends_on: ter_daily
|
|
211
|
+
compute: "days + holiday_overtime_days > 0 ? round(gross_taxable * 1.0 / (days + holiday_overtime_days)) : 0"
|
|
212
|
+
- name: daily_pph21
|
|
213
|
+
type: currency
|
|
214
|
+
label: {id: PPh 21 TER harian}
|
|
215
|
+
hidden: true
|
|
216
|
+
compute: >-
|
|
217
|
+
days + holiday_overtime_days <= 0 || gross_taxable * 1.0 / (days + holiday_overtime_days) <= 450000 ? 0
|
|
218
|
+
: (gross_taxable * 1.0 / (days + holiday_overtime_days) <= 2500000 ? round(gross_taxable * 0.5 * (has_tax_id ? 100 : 120) / 10000.0 - 0.5)
|
|
219
|
+
: round(((gross_taxable * 0.5 > 60000000 ? 60000000 : gross_taxable * 0.5) * 5
|
|
220
|
+
+ (gross_taxable * 0.5 > 250000000 ? 190000000 : (gross_taxable * 0.5 > 60000000 ? gross_taxable * 0.5 - 60000000 : 0)) * 15
|
|
221
|
+
+ (gross_taxable * 0.5 > 500000000 ? 250000000 : (gross_taxable * 0.5 > 250000000 ? gross_taxable * 0.5 - 250000000 : 0)) * 25
|
|
222
|
+
+ (gross_taxable * 0.5 > 5000000000 ? 4500000000 : (gross_taxable * 0.5 > 500000000 ? gross_taxable * 0.5 - 500000000 : 0)) * 30
|
|
223
|
+
+ (gross_taxable * 0.5 > 5000000000 ? gross_taxable * 0.5 - 5000000000 : 0) * 35) * (has_tax_id ? 100 : 120) / 10000.0 - 0.5))
|
|
176
224
|
# Annual recomputation (last_month).
|
|
177
225
|
- name: ptkp
|
|
178
226
|
type: currency
|
|
@@ -208,7 +256,7 @@ fields:
|
|
|
208
256
|
- name: pph21
|
|
209
257
|
type: currency
|
|
210
258
|
label: {id: PPh 21 dipotong}
|
|
211
|
-
compute: "last_month ? year_pph21 - ytd_pph21 : ter_pph21"
|
|
259
|
+
compute: "ter_daily ? daily_pph21 : (last_month ? year_pph21 - ytd_pph21 : ter_pph21)"
|
|
212
260
|
- name: employee_bpjs
|
|
213
261
|
type: currency
|
|
214
262
|
label: {id: BPJS dipotong dari pekerja}
|
|
@@ -239,7 +287,10 @@ rules:
|
|
|
239
287
|
days >= 0 && days <= 31 && day_rate >= 0 && monthly_salary >= 0 && fixed_allowance >= 0 && daily_allowance >= 0
|
|
240
288
|
&& overtime_hours >= 0 && overtime_hours <= 744 && overtime_days >= 0 && overtime_days <= days + 0.0001 && overtime_rate >= 0
|
|
241
289
|
&& thr_tenure_months >= 0 && other_income >= 0 && other_deduction >= 0
|
|
242
|
-
|
|
290
|
+
&& holiday_overtime_days >= 0 && holiday_overtime_days <= 31 && holiday_hours_2x >= 0 && holiday_hours_3x >= 0 && holiday_hours_4x >= 0
|
|
291
|
+
&& holiday_hours_2x <= holiday_overtime_days * (payroll_run.workdays_per_week == 5 ? 8 : 7)
|
|
292
|
+
&& holiday_hours_3x <= holiday_overtime_days && holiday_hours_4x <= holiday_overtime_days * 3
|
|
293
|
+
message: {id: 'Hari 0 sampai 31, jam hari libur per tarif tidak melebihi batas per hari (2x: 7 atau 8, 3x: 1, 4x: 3), tidak negatif'}
|
|
243
294
|
- name: pay_entered
|
|
244
295
|
on: submit
|
|
245
296
|
check: "pay_basis == 'monthly' ? monthly_salary > 0 : (days > 0 && day_rate > 0)"
|
|
@@ -248,6 +299,10 @@ rules:
|
|
|
248
299
|
on: save
|
|
249
300
|
check: timesheet == '' || (timesheet.project == payroll_run.project && timesheet.worker == profile.worker && timesheet.docstatus == 1)
|
|
250
301
|
message: {id: 'Rekap absensi harus milik pekerja dan proyek periode ini, dan sudah diajukan'}
|
|
302
|
+
- name: advance_of_worker
|
|
303
|
+
on: save
|
|
304
|
+
check: cash_advance == '' || (cash_advance.worker == profile.worker && cash_advance.docstatus == 1 && other_deduction > 0)
|
|
305
|
+
message: {id: 'Kasbon yang dipotong harus milik pekerja ini, sudah diajukan, dan potongannya diisi'}
|
|
251
306
|
- name: same_tax_month
|
|
252
307
|
on: save
|
|
253
308
|
check: tax_year == payroll_run.tax_year && tax_month == payroll_run.tax_month
|
|
@@ -273,11 +328,15 @@ views:
|
|
|
273
328
|
- [tax_year, tax_month, last_month, ptkp_status, has_tax_id]
|
|
274
329
|
- section: {id: Kehadiran dan upah}
|
|
275
330
|
columns:
|
|
276
|
-
- [pay_basis, days, day_rate, monthly_salary, fixed_allowance, daily_allowance]
|
|
277
|
-
- [overtime_hours, overtime_days, overtime_rate, thr_tenure_months, other_income, other_deduction]
|
|
331
|
+
- [pay_basis, employment, days, day_rate, monthly_salary, fixed_allowance, daily_allowance]
|
|
332
|
+
- [overtime_hours, overtime_days, overtime_rate, thr_tenure_months, other_income, other_deduction, cash_advance]
|
|
333
|
+
- section: {id: Hari libur masuk kerja}
|
|
334
|
+
columns:
|
|
335
|
+
- [holiday_overtime_days]
|
|
336
|
+
- [holiday_hours_2x, holiday_hours_3x, holiday_hours_4x]
|
|
278
337
|
- section: {id: Penghasilan}
|
|
279
338
|
columns:
|
|
280
|
-
- [base_pay, overtime_pay, allowance_pay]
|
|
339
|
+
- [base_pay, overtime_pay, holiday_overtime_pay, allowance_pay]
|
|
281
340
|
- [thr_pay, cash_gross]
|
|
282
341
|
- section: {id: BPJS}
|
|
283
342
|
columns:
|
|
@@ -285,7 +344,7 @@ views:
|
|
|
285
344
|
- [bpjs_tk, bpjs_jp, bpjs_kes, jht_employee, jp_employee, kes_employee, employee_bpjs]
|
|
286
345
|
- section: {id: PPh 21}
|
|
287
346
|
columns:
|
|
288
|
-
- [gross_taxable, ter_category, ter_bp, pph21]
|
|
347
|
+
- [gross_taxable, ter_category, ter_bp, daily_gross, pph21]
|
|
289
348
|
- [ytd_gross, ytd_pph21, year_gross, job_cost, year_net, year_pkp, year_pph21]
|
|
290
349
|
- section: {id: Bersih}
|
|
291
350
|
columns:
|