@rangka-os/create 0.5.0-alpha.6 → 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.
Files changed (94) hide show
  1. package/package.json +1 -1
  2. package/template/base/apps/grosir_distribusi/app.rk +48 -0
  3. package/template/base/apps/grosir_distribusi/dashboards/grosir_ar.rk +62 -0
  4. package/template/base/apps/grosir_distribusi/dashboards/grosir_overview.rk +85 -0
  5. package/template/base/apps/jasa_proyek/dashboards/jasa_overview.rk +4 -0
  6. package/template/base/apps/jasa_proyek/dashboards/project_margin.rk +28 -0
  7. package/template/base/apps/produksi_pabrik/app.rk +46 -0
  8. package/template/base/apps/produksi_pabrik/dashboards/produksi_overview.rk +96 -0
  9. package/template/base/apps/produksi_pabrik/dashboards/produksi_upah.rk +39 -0
  10. package/template/base/modules/catalogue/models/item.rk +22 -0
  11. package/template/base/modules/catalogue/models/item_category.rk +1 -0
  12. package/template/base/modules/catalogue/models/uom.rk +1 -0
  13. package/template/base/modules/catalogue/module.rk +2 -1
  14. package/template/base/modules/contacts/models/customer.rk +58 -1
  15. package/template/base/modules/contacts/module.rk +1 -1
  16. package/template/base/modules/delivery/flows/delivery_cancel_guard.rk +18 -0
  17. package/template/base/modules/delivery/flows/fulfilment_on_delivery_cancelled.rk +21 -0
  18. package/template/base/modules/delivery/flows/fulfilment_on_delivery_submitted.rk +21 -0
  19. package/template/base/modules/delivery/flows/fulfilment_on_invoice_cancelled.rk +22 -0
  20. package/template/base/modules/delivery/flows/fulfilment_on_invoice_submitted.rk +22 -0
  21. package/template/base/modules/delivery/flows/fulfilment_on_order_created.rk +18 -0
  22. package/template/base/modules/delivery/flows/fulfilment_on_order_submitted.rk +16 -0
  23. package/template/base/modules/delivery/flows/fulfilment_on_order_updated.rk +19 -0
  24. package/template/base/modules/delivery/flows/fulfilment_on_return_cancelled.rk +16 -0
  25. package/template/base/modules/delivery/flows/fulfilment_on_return_submitted.rk +16 -0
  26. package/template/base/modules/delivery/flows/invoice_qty_from_deliveries.rk +20 -0
  27. package/template/base/modules/delivery/flows/order_cancel_guard.rk +10 -0
  28. package/template/base/modules/delivery/flows/return_cancel_guard.rk +11 -0
  29. package/template/base/modules/delivery/flows/return_credit_on_payment_cancelled.rk +11 -0
  30. package/template/base/modules/delivery/flows/return_credit_on_payment_submitted.rk +21 -0
  31. package/template/base/modules/delivery/flows/return_credit_on_return_cancelled.rk +11 -0
  32. package/template/base/modules/delivery/flows/return_credit_on_return_submitted.rk +10 -0
  33. package/template/base/modules/delivery/models/delivery_guard.rk +48 -0
  34. package/template/base/modules/delivery/models/delivery_note.rk +94 -0
  35. package/template/base/modules/delivery/models/delivery_note_item.rk +9 -0
  36. package/template/base/modules/delivery/models/order_fulfilment.rk +27 -0
  37. package/template/base/modules/delivery/models/order_fulfilment_item.rk +10 -0
  38. package/template/base/modules/delivery/models/return_credit.rk +23 -0
  39. package/template/base/modules/delivery/models/sales_return.rk +87 -0
  40. package/template/base/modules/delivery/models/sales_return_item.rk +16 -0
  41. package/template/base/modules/delivery/module.rk +11 -0
  42. package/template/base/modules/distribution/flows/credit_on_invoice_cancelled.rk +17 -0
  43. package/template/base/modules/distribution/flows/credit_on_invoice_submitted.rk +17 -0
  44. package/template/base/modules/distribution/flows/credit_on_order_cancelled.rk +17 -0
  45. package/template/base/modules/distribution/flows/credit_on_order_submitted.rk +17 -0
  46. package/template/base/modules/distribution/flows/credit_on_payment_cancelled.rk +17 -0
  47. package/template/base/modules/distribution/flows/credit_on_payment_submitted.rk +17 -0
  48. package/template/base/modules/distribution/flows/giro_bounced.rk +20 -0
  49. package/template/base/modules/distribution/flows/giro_from_payment.rk +21 -0
  50. package/template/base/modules/distribution/flows/order_tier_pricing_created.rk +17 -0
  51. package/template/base/modules/distribution/flows/order_tier_pricing_updated.rk +17 -0
  52. package/template/base/modules/distribution/models/giro.rk +79 -0
  53. package/template/base/modules/distribution/module.rk +9 -0
  54. package/template/base/modules/invoicing/models/sales_invoice.rk +16 -1
  55. package/template/base/modules/invoicing/module.rk +2 -2
  56. package/template/base/modules/orders/models/customer_order.rk +80 -2
  57. package/template/base/modules/orders/models/customer_order_item.rk +19 -0
  58. package/template/base/modules/orders/module.rk +2 -2
  59. package/template/base/modules/outlets/models/outlet.rk +1 -0
  60. package/template/base/modules/outlets/module.rk +1 -1
  61. package/template/base/modules/payments/models/payment.rk +36 -1
  62. package/template/base/modules/payments/module.rk +2 -2
  63. package/template/base/modules/production/flows/batch_cancel_guard.rk +12 -0
  64. package/template/base/modules/production/flows/batch_from_bom.rk +19 -0
  65. package/template/base/modules/production/flows/wage_sheet_on_batch_cancelled.rk +14 -0
  66. package/template/base/modules/production/flows/wage_sheet_on_batch_submitted.rk +12 -0
  67. package/template/base/modules/production/flows/work_order_materials_created.rk +20 -0
  68. package/template/base/modules/production/flows/work_order_materials_updated.rk +20 -0
  69. package/template/base/modules/production/models/bom.rk +67 -0
  70. package/template/base/modules/production/models/bom_byproduct.rk +7 -0
  71. package/template/base/modules/production/models/bom_line.rk +11 -0
  72. package/template/base/modules/production/models/production_batch.rk +149 -0
  73. package/template/base/modules/production/models/production_guard.rk +23 -0
  74. package/template/base/modules/production/models/production_labour.rk +10 -0
  75. package/template/base/modules/production/models/production_material.rk +8 -0
  76. package/template/base/modules/production/models/production_output.rk +8 -0
  77. package/template/base/modules/production/models/production_stage.rk +19 -0
  78. package/template/base/modules/production/models/wage_line.rk +11 -0
  79. package/template/base/modules/production/models/wage_sheet.rk +28 -0
  80. package/template/base/modules/production/models/work_order.rk +63 -0
  81. package/template/base/modules/production/models/work_order_material.rk +8 -0
  82. package/template/base/modules/production/module.rk +12 -0
  83. package/template/base/modules/projects/flows/timesheet_assignment_on_create.rk +28 -0
  84. package/template/base/modules/projects/imports/attendance_recap.rk +23 -0
  85. package/template/base/modules/projects/models/assignment.rk +16 -3
  86. package/template/base/modules/projects/models/project_ledger.rk +5 -2
  87. package/template/base/modules/projects/models/timesheet.rk +58 -14
  88. package/template/base/modules/stock/models/stock_move.rk +4 -0
  89. package/template/base/modules/stock/module.rk +1 -1
  90. package/template/base/modules/users/models/user.rk +1 -0
  91. package/template/base/modules/users/module.rk +1 -1
  92. package/template/base/modules/users/roles/field_sales.rk +7 -0
  93. package/template/base/modules/workforce/imports/worker_list.rk +6 -1
  94. package/template/base/modules/workforce/models/worker.rk +28 -8
@@ -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]
@@ -39,6 +39,10 @@ fields:
39
39
  - {value: waste, label: {id: Terbuang}}
40
40
  - {value: adjustment, label: {id: Penyesuaian}}
41
41
  - {value: reversal, label: {id: Pembatalan}}
42
+ - {value: delivery, label: {id: Pengiriman (surat jalan)}}
43
+ - {value: return_in, label: {id: Retur penjualan masuk}}
44
+ - {value: production_out, label: {id: Bahan ke produksi}}
45
+ - {value: production_in, label: {id: Hasil produksi}}
42
46
  views:
43
47
  list:
44
48
  columns: [name, posting_date, outlet, item, qty, value, balance_qty, negative, voucher_type, voucher, reason]
@@ -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: stock
3
- version: 1.0.0
3
+ version: 1.1.0
4
4
  title: {id: Stok, en: Stock}
5
5
  requires: {rangka: '>=0.5', users: ^1.0, catalogue: ^1.0, outlets: ^1.0}
6
6
  # Semantics fixed in docs/kernel-hooks.md (section stock). stock.post_moves is a core hook on the on_submit of
@@ -12,6 +12,7 @@ permissions:
12
12
  - {role: head_office, read: true}
13
13
  - {role: outlet_staff, read: true}
14
14
  - {role: sales_rep, read: true}
15
+ - {role: field_sales, read: true}
15
16
  fields:
16
17
  - name: full_name
17
18
  type: data
@@ -1,5 +1,5 @@
1
1
  # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/module.json
2
2
  name: users
3
- version: 1.0.0
3
+ version: 1.1.0
4
4
  title: {id: Pengguna, en: Users}
5
5
  requires: {rangka: '>=0.5'}
@@ -0,0 +1,7 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/role.json
2
+ name: field_sales
3
+ label: {id: Salesman}
4
+ description: {id: Mengambil pesanan dan melihat piutang pelanggan yang dia pegang}
5
+ # Contract 0010 §5: records whose salesman is the member's own user record (customers, orders, invoices, payments,
6
+ # giro, delivery notes). user.name is the member's user record (rangka user add --record).
7
+ scope: {field: salesman, from: '[user.name]'}
@@ -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]