@rangka-os/create 0.5.0-alpha.7 → 0.5.0-alpha.8

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rangka-os/create",
3
- "version": "0.5.0-alpha.7",
3
+ "version": "0.5.0-alpha.8",
4
4
  "description": "Start a Rangka OS project: npm create @rangka-os@latest my-shop",
5
5
  "license": "Elastic-2.0",
6
6
  "homepage": "https://rangka-os.github.io/rangka-os/guide/quick-start",
@@ -63,6 +63,8 @@ widgets:
63
63
  filter: state == 'planned' || state == 'running'
64
64
  span: 3
65
65
  - name: active_workers
66
+ # worker carries pay: only roles that may read it (audit L1)
67
+ if: "'owner' in user.roles || 'finance_manager' in user.roles || 'project_admin' in user.roles"
66
68
  type: number
67
69
  label: {id: Tenaga kerja aktif}
68
70
  model: worker
@@ -110,6 +112,8 @@ widgets:
110
112
  # Certification expiry cannot be a widget: `expired` lives on child rows (certification) and is a stored compute that goes
111
113
  # stale once expires_on passes. The closest honest view is the list of active workers; open one to see its certifications.
112
114
  - name: workers_certifications
115
+ # worker carries pay: only roles that may read it (audit L1)
116
+ if: "'owner' in user.roles || 'finance_manager' in user.roles || 'project_admin' in user.roles"
113
117
  type: list
114
118
  label: {id: Tenaga kerja aktif}
115
119
  description: {id: Buka satu untuk melihat masa berlaku sertifikasinya}
@@ -3,9 +3,14 @@
3
3
  name: project_margin
4
4
  label: {id: Untung per proyek, en: Project margin}
5
5
  default_period: 365
6
+ # Margin is cost: owner, finance and the project admin only. Sales and purchasing read only their own rows of the
7
+ # ledger, so a sum would show them revenue as "untung"; `roles` is not enforced by the kernel yet, so every widget on
8
+ # the ledger, timesheets or workers also carries the same `if` (they are hidden for other roles).
9
+ roles: [finance_manager, project_admin]
6
10
  cache: 5m
7
11
  widgets:
8
12
  - name: margin_total
13
+ if: "'owner' in user.roles || 'finance_manager' in user.roles || 'project_admin' in user.roles"
9
14
  type: number
10
15
  label: {id: Untung proyek}
11
16
  description: {id: 'Pendapatan dikurangi biaya tenaga kerja, proyek dan pemasok (DPP), dari dokumen yang diajukan sejak buku ini aktif'}
@@ -16,6 +21,7 @@ widgets:
16
21
  compact: true
17
22
  span: 4
18
23
  - name: revenue_total
24
+ if: "'owner' in user.roles || 'finance_manager' in user.roles || 'project_admin' in user.roles"
19
25
  type: number
20
26
  label: {id: Pendapatan proyek}
21
27
  model: project_ledger
@@ -35,7 +41,27 @@ widgets:
35
41
  filter: state == 'planned' || state == 'running'
36
42
  compact: true
37
43
  span: 4
44
+ # A margin is only as good as its labour cost: absensi without pay add no cost, so they are counted here (G5).
45
+ - name: timesheets_without_pay
46
+ if: "'owner' in user.roles || 'finance_manager' in user.roles || 'project_admin' in user.roles"
47
+ type: number
48
+ label: {id: Absensi tanpa upah}
49
+ description: {id: 'Absensi diajukan yang upahnya belum diisi: untung proyek di atas belum termasuk biaya tenaga ini'}
50
+ model: timesheet
51
+ filter: docstatus == 1 && cost_missing
52
+ good_when: down
53
+ span: 6
54
+ - name: workers_without_pay
55
+ if: "'owner' in user.roles || 'finance_manager' in user.roles || 'project_admin' in user.roles"
56
+ type: number
57
+ label: {id: Tenaga tanpa upah}
58
+ description: {id: 'Tenaga aktif yang upah per hari dan per jamnya belum diisi'}
59
+ model: worker
60
+ filter: active && cost_day_rate == 0 && cost_hour_rate == 0
61
+ good_when: down
62
+ span: 6
38
63
  - name: margin_by_project
64
+ if: "'owner' in user.roles || 'finance_manager' in user.roles || 'project_admin' in user.roles"
39
65
  type: chart
40
66
  chart: bar
41
67
  label: {id: Untung per proyek}
@@ -47,6 +73,7 @@ widgets:
47
73
  sort: -value
48
74
  span: 6
49
75
  - name: result_by_kind
76
+ if: "'owner' in user.roles || 'finance_manager' in user.roles || 'project_admin' in user.roles"
50
77
  type: chart
51
78
  chart: bar
52
79
  label: {id: Pendapatan dan biaya}
@@ -57,6 +84,7 @@ widgets:
57
84
  period: posting_date
58
85
  span: 6
59
86
  - name: latest_rows
87
+ if: "'owner' in user.roles || 'finance_manager' in user.roles || 'project_admin' in user.roles"
60
88
  type: list
61
89
  label: {id: Catatan terakhir}
62
90
  model: project_ledger
@@ -46,11 +46,13 @@ fields:
46
46
  type: select
47
47
  label: {id: Metode}
48
48
  default: "'transfer'"
49
+ # "Potong retur" (sales_return) is not listed here: it only works with the delivery module, and a select option
50
+ # cannot depend on an installed app, so a site that installs delivery adds it in custom/payment.rk
51
+ # (examples/sites/demo-grosir). Without it the option was always refused (audit re-pin alpha.7, L2).
49
52
  options:
50
53
  - {value: transfer, label: {id: Transfer}}
51
54
  - {value: cash, label: {id: Tunai}}
52
55
  - {value: giro, label: {id: Giro}}
53
- - {value: sales_return, label: {id: Potong retur}}
54
56
  - {value: qris, label: {id: QRIS}}
55
57
  - {value: va, label: {id: Virtual account}}
56
58
  - {value: ewallet, label: {id: E-wallet}}
@@ -1,6 +1,6 @@
1
1
  # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/module.json
2
2
  name: payments
3
- version: 1.2.0
3
+ version: 1.3.0
4
4
  title: {id: Pembayaran, en: Payments}
5
5
  requires: {rangka: '>=0.5', users: ^1.0, contacts: ^1.0, invoicing: ^1.0, procurement: ^1.0}
6
6
  optional: {currency: ^1.0, delivery: ^1.0}
@@ -0,0 +1,28 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
2
+ name: timesheet_assignment_on_create
3
+ label: {id: Absensi memakai tarif penugasan}
4
+ # An attendance recap import (or a timesheet typed without its assignment) names only the project and the worker. This
5
+ # finds the worker's assignment on that project covering the start of the work and takes its rates, so the client's
6
+ # rate and the project's pay apply instead of the worker's general ones. No assignment found: the worker's rates
7
+ # (the timesheet defaults) stay. A recap counts days, so it stays per day: an hourly assignment gives its day rate
8
+ # and the worker's pay per day stays (an hourly assignment's cost_rate is per hour). Runs on the draft, before anyone submits it. Only for recaps (period_to set): a daily
9
+ # timesheet typed by hand keeps the rates its author typed.
10
+ on: timesheet.created
11
+ if: event.assignment == '' && event.period_to != '' && event.docstatus == 0
12
+ steps:
13
+ - find: assignment
14
+ where: project == event.project && worker == event.worker && start_date <= event.work_date && end_date >= event.work_date
15
+ as: asg
16
+ - if: asg != null
17
+ find: timesheet
18
+ where: name == event.name
19
+ as: ts
20
+ - if: asg != null
21
+ update: ts
22
+ set:
23
+ assignment: asg.name
24
+ day_rate: asg.day_rate
25
+ hour_rate: asg.hour_rate
26
+ cost_rate: "asg.rate_basis == 'day' ? asg.cost_rate : ts.cost_rate"
27
+ overtime_rate: asg.overtime_rate
28
+ overtime_cost_rate: asg.overtime_cost_rate
@@ -0,0 +1,23 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/import.json
2
+ # Monthly attendance recap (G7): one row per worker per project per cut-off period, as fingerprint machines and HR apps
3
+ # export it (Rekap Absensi: days present and overtime hours per person for a date range, often the 21st to the 20th).
4
+ # Each row becomes one draft timesheet for the period, priced from the worker's assignment on the project
5
+ # (timesheet_assignment_on_create) or, without one, from the worker. Proyek is the project number (PRJ-...), No.
6
+ # pegawai the worker's employee number. Columns Nama and others are ignored. The same worker, project and start date
7
+ # twice is skipped by the key; a wrong file is undone by deleting its drafts, a submitted one by cancelling it.
8
+ name: attendance_recap
9
+ label: {id: Rekap absensi bulanan, en: Monthly attendance recap}
10
+ model: timesheet
11
+ source: xlsx
12
+ header_row: 1
13
+ key: [Proyek, No. pegawai, Dari tanggal]
14
+ map:
15
+ project: Proyek
16
+ worker: {value: No. pegawai, match: employee_no}
17
+ work_date: Dari tanggal
18
+ period_to: Sampai tanggal
19
+ # An empty cell must not become the model's default of 1 day: -1 makes the row fail recap_days with its message.
20
+ days: "=row['Hari hadir'] == '' ? '-1' : row['Hari hadir']"
21
+ overtime_hours: "='Jam lembur' in row && row['Jam lembur'] != '' ? row['Jam lembur'] : '0'"
22
+ rate_basis: "='day'"
23
+ description: "='Rekap absensi ' + row['Dari tanggal'] + ' s.d. ' + row['Sampai tanggal']"
@@ -6,7 +6,7 @@ naming: ASG-{#####}
6
6
  title_field: worker
7
7
  permissions:
8
8
  - {role: project_admin, read: true, create: true, write: true, delete: true, submit: true, cancel: true, amend: true, export: true, print: true}
9
- - {role: sales_manager, read: true}
9
+ # No sales_manager: an assignment carries the cost rates (audit L1).
10
10
  - {role: finance_manager, read: true}
11
11
  fields:
12
12
  - name: project
@@ -57,10 +57,23 @@ fields:
57
57
  type: currency
58
58
  label: {id: Biaya per satuan}
59
59
  default: "rate_basis == 'hour' ? worker.cost_hour_rate : worker.cost_day_rate"
60
+ # Overtime per hour on this project, from the worker unless the client agreed another rate.
61
+ - name: overtime_rate
62
+ type: currency
63
+ label: {id: Tarif jual lembur per jam}
64
+ default: worker.overtime_rate
65
+ - name: overtime_cost_rate
66
+ type: currency
67
+ label: {id: Upah lembur per jam}
68
+ default: worker.overtime_cost_rate
60
69
  - name: notes
61
70
  type: text
62
71
  label: {id: Catatan}
63
72
  rules:
73
+ - name: rates_not_negative
74
+ on: save
75
+ check: day_rate >= 0 && hour_rate >= 0 && cost_rate >= 0 && overtime_rate >= 0 && overtime_cost_rate >= 0
76
+ message: {id: 'Tarif dan upah tidak boleh negatif'}
64
77
  - name: end_after_start
65
78
  on: save
66
79
  check: end_date >= start_date
@@ -77,7 +90,7 @@ views:
77
90
  - [start_date, end_date]
78
91
  - section: {id: Tarif}
79
92
  columns:
80
- - [rate_basis, day_rate, hour_rate]
81
- - [cost_rate]
93
+ - [rate_basis, day_rate, hour_rate, overtime_rate]
94
+ - [cost_rate, overtime_cost_rate]
82
95
  - section: {id: Catatan}
83
96
  fields: [notes]
@@ -19,8 +19,11 @@ title_field: project
19
19
  permissions:
20
20
  - {role: project_admin, read: true, create: true, export: true}
21
21
  - {role: finance_manager, read: true, create: true, export: true}
22
- - {role: sales_manager, read: true, create: true, export: true}
23
- - {role: purchasing_manager, read: true, create: true}
22
+ # Sales and purchasing read (and their flows write) only the rows of their own documents: labour rows carry pay and
23
+ # cost rows the firm's margin (audit L1). Read stays because the cancel flows find the row they reverse as the person
24
+ # cancelling. No export for sales.
25
+ - {role: sales_manager, read: true, create: true, if: kind == 'revenue'}
26
+ - {role: purchasing_manager, read: true, create: true, if: kind == 'vendor'}
24
27
  fields:
25
28
  - name: project
26
29
  type: link
@@ -1,13 +1,13 @@
1
1
  # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/model.json
2
2
  name: timesheet
3
- label: {id: Timesheet}
3
+ label: {id: Absensi, en: Timesheet}
4
4
  icon: calendar
5
5
  is_submittable: true
6
6
  naming: TS-{YYYY}-{#####}
7
7
  title_field: worker
8
8
  permissions:
9
- - {role: project_admin, read: true, create: true, write: true, delete: true, submit: true, cancel: true, amend: true, export: true, print: true}
10
- - {role: sales_manager, read: true}
9
+ - {role: project_admin, read: true, create: true, write: true, delete: true, submit: true, cancel: true, amend: true, export: true, import: true, print: true}
10
+ # No sales_manager: a timesheet carries pay and cost (audit L1).
11
11
  - {role: finance_manager, read: true}
12
12
  fields:
13
13
  - name: project
@@ -31,11 +31,21 @@ fields:
31
31
  label: {id: Tanggal kerja}
32
32
  required: true
33
33
  in_list: true
34
+ # A monthly recap (G7): work_date is the first day of the cut-off period and period_to its last (21 Oct to 20 Nov,
35
+ # or a calendar month), days the days present in it. Empty period_to = one day, as before.
36
+ - name: period_to
37
+ type: date
38
+ label: {id: Sampai tanggal (rekap)}
39
+ in_list: true
34
40
  - name: days
35
41
  type: float
36
42
  label: {id: Hari kerja}
37
43
  default: '1'
38
44
  in_list: true
45
+ - name: overtime_hours
46
+ type: float
47
+ label: {id: Jam lembur}
48
+ default: '0'
39
49
  - name: hours
40
50
  type: float
41
51
  label: {id: Jam}
@@ -53,7 +63,7 @@ fields:
53
63
  - name: day_rate
54
64
  type: currency
55
65
  label: {id: Tarif per hari}
56
- default: assignment.day_rate
66
+ default: "assignment != '' ? assignment.day_rate : worker.day_rate"
57
67
  # Per hour when the assignment bills per hour (consultants); per day otherwise, as before.
58
68
  - name: rate_basis
59
69
  type: select
@@ -70,48 +80,82 @@ fields:
70
80
  type: currency
71
81
  label: {id: Biaya per satuan}
72
82
  default: "assignment != '' ? assignment.cost_rate : (rate_basis == 'hour' ? worker.cost_hour_rate : worker.cost_day_rate)"
83
+ - name: overtime_rate
84
+ type: currency
85
+ label: {id: Tarif jual lembur per jam}
86
+ default: "assignment != '' ? assignment.overtime_rate : worker.overtime_rate"
87
+ - name: overtime_cost_rate
88
+ type: currency
89
+ label: {id: Upah lembur per jam}
90
+ default: "assignment != '' ? assignment.overtime_cost_rate : worker.overtime_cost_rate"
73
91
  - name: amount
74
92
  type: currency
75
93
  label: {id: Jumlah}
76
- compute: "rate_basis == 'hour' ? round(hours * hour_rate) : round(days * day_rate)"
94
+ compute: "(rate_basis == 'hour' ? round(hours * hour_rate) : round(days * day_rate)) + round(overtime_hours * overtime_rate)"
77
95
  in_list: true
78
96
  - name: cost_amount
79
97
  type: currency
80
98
  label: {id: Biaya}
81
- compute: "round((rate_basis == 'hour' ? hours : days) * cost_rate)"
99
+ compute: "round((rate_basis == 'hour' ? hours : days) * cost_rate) + round(overtime_hours * overtime_cost_rate)"
100
+ # No pay entered for this work (G5): the cost is not 0, it is unknown. The project margin dashboard counts these so
101
+ # a margin without labour cost is read as incomplete; fix the pay on the worker, then cancel and amend.
102
+ - name: cost_missing
103
+ type: check
104
+ label: {id: Upah belum diisi}
105
+ compute: "cost_rate == 0 || (overtime_hours > 0 && overtime_cost_rate == 0)"
82
106
  - name: billable_amount
83
107
  type: currency
84
108
  label: {id: Jumlah dapat ditagih}
85
109
  compute: "billable ? amount : 0"
86
110
  rules:
111
+ - name: rates_not_negative
112
+ on: save
113
+ check: day_rate >= 0 && hour_rate >= 0 && cost_rate >= 0 && overtime_rate >= 0 && overtime_cost_rate >= 0
114
+ message: {id: 'Tarif dan upah tidak boleh negatif'}
87
115
  - name: days_range
88
116
  on: save
89
- check: rate_basis == 'hour' || (days > 0 && days <= 1.5)
117
+ check: rate_basis == 'hour' || period_to != '' || (days > 0 && days <= 1.5)
90
118
  message: {id: 'Hari kerja harus lebih dari 0 dan paling banyak 1,5'}
119
+ # A recap covers at most 31 days, never runs backwards, and cannot hold more days present than days in the period.
120
+ # date + duration drops a fraction of a day, so days are rounded up first (round(x + 0.49): 1,5 -> 2, 1,9 -> 2).
121
+ - name: recap_period
122
+ on: save
123
+ check: period_to == '' || (period_to >= work_date && period_to < work_date + duration(31))
124
+ message: {id: 'Periode rekap: sampai tanggal tidak boleh sebelum tanggal mulai, paling lama 31 hari'}
125
+ - name: recap_days
126
+ on: save
127
+ check: >-
128
+ period_to == '' || rate_basis == 'hour'
129
+ || (days >= 0 && (days > 0 || overtime_hours > 0) && work_date + duration(round(days + 0.49) - 1) <= period_to)
130
+ message: {id: 'Hari hadir rekap harus lebih dari 0 dan tidak melebihi jumlah hari di periodenya'}
131
+ - name: overtime_range
132
+ on: save
133
+ check: "overtime_hours >= 0 && (period_to == '' ? overtime_hours <= 24 : work_date + duration(round(overtime_hours / 24 + 0.49) - 1) <= period_to)"
134
+ message: {id: 'Jam lembur tidak boleh negatif atau melebihi jam di periodenya'}
91
135
  - name: hour_rate_for_billable_hours
92
136
  on: save
93
137
  check: rate_basis != 'hour' || !billable || hour_rate > 0
94
138
  message: {id: 'Timesheet per jam yang ditagih butuh tarif per jam (isi di tenaga kerja atau penugasan)'}
95
139
  - name: hours_range
96
140
  on: save
97
- check: rate_basis != 'hour' || (hours > 0 && hours <= 24)
98
- message: {id: 'Jam kerja harus lebih dari 0 dan paling banyak 24'}
141
+ check: "rate_basis != 'hour' || (hours > 0 && hours <= (period_to == '' ? 24 : 744))"
142
+ message: {id: 'Jam kerja harus lebih dari 0 dan paling banyak 24 per hari'}
99
143
  views:
100
144
  list:
101
- columns: [name, project, worker, work_date, days, status, amount]
145
+ columns: [name, project, worker, work_date, period_to, days, status, amount]
102
146
  sort: -work_date
103
147
  form:
104
148
  layout:
105
149
  - section: {id: Timesheet}
106
150
  columns:
107
151
  - [project, worker, assignment]
108
- - [work_date, days, hours]
152
+ - [work_date, period_to, days, hours, overtime_hours]
109
153
  - section: {id: Pekerjaan}
110
154
  columns:
111
155
  - [description, evidence]
112
156
  - section: {id: Tagihan}
113
157
  columns:
114
- - [billable, rate_basis, day_rate, hour_rate, amount]
115
- - section: {id: Biaya internal}
158
+ - [billable, rate_basis, day_rate, hour_rate, overtime_rate, amount]
159
+ - section: {id: Upah (biaya internal)}
116
160
  columns:
117
- - [cost_rate, cost_amount]
161
+ - [cost_rate, overtime_cost_rate, cost_amount, cost_missing]
@@ -1,7 +1,9 @@
1
1
  # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/import.json
2
2
  # The opening list of field workers (manpower, inspectors, trainers): one row per person. Certifications are added on
3
3
  # the worker afterwards (a table field, not part of this file). Name plus employee number is the duplicate key, so
4
- # workers without a number can share a file.
4
+ # workers without a number can share a file. Tarif harian is the selling rate per day; Upah harian (pay per day) and
5
+ # the overtime rates per hour are optional columns, so a file in the older template still imports: a worker without
6
+ # pay is flagged on the project margin dashboard instead of counting as zero cost.
5
7
  name: worker_list
6
8
  label: {id: Daftar tenaga kerja, en: Worker list}
7
9
  model: worker
@@ -14,3 +16,6 @@ map:
14
16
  role_title: Jabatan
15
17
  phone: WhatsApp
16
18
  day_rate: Tarif harian
19
+ cost_day_rate: "='Upah harian' in row && row['Upah harian'] != '' ? row['Upah harian'] : '0'"
20
+ overtime_rate: "='Tarif lembur per jam' in row && row['Tarif lembur per jam'] != '' ? row['Tarif lembur per jam'] : '0'"
21
+ overtime_cost_rate: "='Upah lembur per jam' in row && row['Upah lembur per jam'] != '' ? row['Upah lembur per jam'] : '0'"
@@ -5,9 +5,9 @@ icon: user
5
5
  naming: WRK-{####}
6
6
  title_field: worker_name
7
7
  permissions:
8
- - {role: sales_manager, read: true, create: true, write: true, print: true}
8
+ # Pay (cost_*_rate, overtime_cost_rate) lives on the worker and hidden_for is not enforced by the kernel, so sales and
9
+ # purchasing have no access at all (audit L1): workers are managed by finance and the project admin.
9
10
  - {role: finance_manager, read: true, create: true, write: true, print: true}
10
- - {role: purchasing_manager, read: true, create: true, write: true, print: true}
11
11
  - {role: project_admin, read: true, create: true, write: true, print: true}
12
12
  - {role: head_office, read: true, create: true, write: true, print: true}
13
13
  - {role: outlet_staff, read: true}
@@ -28,9 +28,10 @@ fields:
28
28
  - name: phone
29
29
  type: phone
30
30
  label: {id: Nomor WhatsApp}
31
+ # Selling rate per day: what the client pays for a day of this person (the invoice side).
31
32
  - name: day_rate
32
33
  type: currency
33
- label: {id: Tarif per hari}
34
+ label: {id: Tarif jual per hari}
34
35
  in_list: true
35
36
  # Selling rate per hour, and what an hour or a day of this person costs the firm (pay divided by working days or
36
37
  # hours, entered by the owner): project margin reads the cost, the invoice reads the selling rate.
@@ -40,14 +41,27 @@ fields:
40
41
  default: '0'
41
42
  # Pay per person: hidden in forms and lists for roles that do not need it (hidden_for is not enforced by the kernel
42
43
  # yet; the REST API still returns it to anyone who may read worker).
44
+ # Pay per day (upah harian). 0 means not entered yet: timesheets of this person are then flagged cost_missing and
45
+ # the project margin dashboard counts them, so a margin without labour cost is never read as complete.
43
46
  - name: cost_day_rate
44
47
  type: currency
45
- label: {id: Biaya per hari}
48
+ label: {id: Upah per hari}
46
49
  default: '0'
47
50
  hidden_for: [sales_manager, purchasing_manager, head_office, outlet_staff, sales_rep]
48
51
  - name: cost_hour_rate
49
52
  type: currency
50
- label: {id: Biaya per jam}
53
+ label: {id: Upah per jam}
54
+ default: '0'
55
+ hidden_for: [sales_manager, purchasing_manager, head_office, outlet_staff, sales_rep]
56
+ # Overtime per hour: what the client pays (overtime_rate) and what the firm pays (overtime_cost_rate). Enter the
57
+ # rates already weighted the way the firm counts overtime (PP 35/2021 multipliers vary per hour of the day).
58
+ - name: overtime_rate
59
+ type: currency
60
+ label: {id: Tarif jual lembur per jam}
61
+ default: '0'
62
+ - name: overtime_cost_rate
63
+ type: currency
64
+ label: {id: Upah lembur per jam}
51
65
  default: '0'
52
66
  hidden_for: [sales_manager, purchasing_manager, head_office, outlet_staff, sales_rep]
53
67
  - name: active
@@ -58,6 +72,12 @@ fields:
58
72
  type: table
59
73
  of: certification
60
74
  label: {id: Sertifikasi}
75
+ rules:
76
+ # A negative pay would raise the project margin instead of lowering it (audit 6 Nov).
77
+ - name: rates_not_negative
78
+ on: save
79
+ check: day_rate >= 0 && hour_rate >= 0 && cost_day_rate >= 0 && cost_hour_rate >= 0 && overtime_rate >= 0 && overtime_cost_rate >= 0
80
+ message: {id: 'Tarif dan upah tidak boleh negatif'}
61
81
  views:
62
82
  list:
63
83
  columns: [name, worker_name, role_title, day_rate, active]
@@ -66,9 +86,9 @@ views:
66
86
  - section: {id: Identitas}
67
87
  columns:
68
88
  - [worker_name, employee_no, role_title]
69
- - [phone, day_rate, hour_rate, active]
70
- - section: {id: Biaya internal}
89
+ - [phone, day_rate, hour_rate, overtime_rate, active]
90
+ - section: {id: Upah (biaya internal)}
71
91
  columns:
72
- - [cost_day_rate, cost_hour_rate]
92
+ - [cost_day_rate, cost_hour_rate, overtime_cost_rate]
73
93
  - section: {id: Sertifikasi}
74
94
  fields: [certifications]