@rangka-os/create 0.0.0-stage → 0.5.0-alpha.2
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/index.js +101 -0
- package/package.json +29 -4
- package/template/base/README.md +32 -0
- package/template/base/_gitignore +3 -0
- package/template/base/_vscode/settings.json +4 -0
- package/template/base/apps/crm/app.rk +42 -0
- package/template/base/apps/crm/dashboards/crm_overview.rk +88 -0
- package/template/base/apps/crm/dashboards/sales_overview.rk +66 -0
- package/template/base/apps/fnb_cabang/app.rk +41 -0
- package/template/base/apps/fnb_cabang/dashboards/fnb_overview.rk +80 -0
- package/template/base/apps/fnb_cabang/dashboards/stock_recap.rk +129 -0
- package/template/base/apps/jasa_proyek/app.rk +49 -0
- package/template/base/apps/jasa_proyek/dashboards/ar_aging.rk +88 -0
- package/template/base/apps/jasa_proyek/dashboards/jasa_overview.rk +121 -0
- package/template/base/connectors/whatsapp_business/connector.rk +68 -0
- package/template/base/docker-compose.yml +16 -0
- package/template/base/env.example +12 -0
- package/template/base/modules/catalogue/models/item.rk +60 -0
- package/template/base/modules/catalogue/models/price_list.rk +34 -0
- package/template/base/modules/catalogue/models/price_list_item.rk +21 -0
- package/template/base/modules/catalogue/models/uom.rk +20 -0
- package/template/base/modules/catalogue/models/uom_conversion.rk +36 -0
- package/template/base/modules/catalogue/module.rk +5 -0
- package/template/base/modules/contacts/models/contact_person.rk +21 -0
- package/template/base/modules/contacts/models/customer.rk +72 -0
- package/template/base/modules/contacts/models/vendor.rk +71 -0
- package/template/base/modules/contacts/module.rk +5 -0
- package/template/base/modules/currency/models/currency.rk +34 -0
- package/template/base/modules/currency/models/exchange_rate.rk +39 -0
- package/template/base/modules/currency/module.rk +5 -0
- package/template/base/modules/invoicing/models/sales_invoice.rk +290 -0
- package/template/base/modules/invoicing/models/sales_invoice_item.rk +37 -0
- package/template/base/modules/invoicing/module.rk +9 -0
- package/template/base/modules/invoicing/print/sales_invoice.html +63 -0
- package/template/base/modules/invoicing/print/sales_invoice.rk +7 -0
- package/template/base/modules/orders/models/customer_order.rk +100 -0
- package/template/base/modules/orders/models/customer_order_item.rk +30 -0
- package/template/base/modules/orders/module.rk +9 -0
- package/template/base/modules/outlet_sales/imports/daily_form.rk +20 -0
- package/template/base/modules/outlet_sales/imports/moka_item_details.rk +24 -0
- package/template/base/modules/outlet_sales/models/outlet_sales.rk +106 -0
- package/template/base/modules/outlet_sales/models/outlet_sales_line.rk +39 -0
- package/template/base/modules/outlet_sales/module.rk +7 -0
- package/template/base/modules/outlets/models/outlet.rk +39 -0
- package/template/base/modules/outlets/module.rk +5 -0
- package/template/base/modules/payments/models/payment.rk +154 -0
- package/template/base/modules/payments/models/payment_allocation.rk +35 -0
- package/template/base/modules/payments/models/withholding.rk +62 -0
- package/template/base/modules/payments/module.rk +8 -0
- package/template/base/modules/payments/print/statement.html +55 -0
- package/template/base/modules/payments/print/statement.rk +13 -0
- package/template/base/modules/pipeline/flows/morning_follow_up.rk +10 -0
- package/template/base/modules/pipeline/flows/whatsapp_to_lead.rk +24 -0
- package/template/base/modules/pipeline/models/activity.rk +83 -0
- package/template/base/modules/pipeline/models/deal.rk +139 -0
- package/template/base/modules/pipeline/models/lead.rk +119 -0
- package/template/base/modules/pipeline/module.rk +7 -0
- package/template/base/modules/procurement/models/goods_receipt.rk +85 -0
- package/template/base/modules/procurement/models/goods_receipt_item.rk +42 -0
- package/template/base/modules/procurement/models/purchase_order.rk +148 -0
- package/template/base/modules/procurement/models/purchase_order_item.rk +46 -0
- package/template/base/modules/procurement/models/purchase_request.rk +81 -0
- package/template/base/modules/procurement/models/purchase_request_item.rk +35 -0
- package/template/base/modules/procurement/models/vendor_bill.rk +166 -0
- package/template/base/modules/procurement/models/vendor_bill_item.rk +33 -0
- package/template/base/modules/procurement/module.rk +9 -0
- package/template/base/modules/procurement/print/purchase_order.html +120 -0
- package/template/base/modules/procurement/print/purchase_order.rk +7 -0
- package/template/base/modules/projects/models/acceptance.rk +68 -0
- package/template/base/modules/projects/models/assignment.rk +63 -0
- package/template/base/modules/projects/models/project.rk +81 -0
- package/template/base/modules/projects/models/timesheet.rk +82 -0
- package/template/base/modules/projects/module.rk +6 -0
- package/template/base/modules/quotation/models/quotation.rk +201 -0
- package/template/base/modules/quotation/models/quotation_item.rk +37 -0
- package/template/base/modules/quotation/module.rk +9 -0
- package/template/base/modules/quotation/print/quotation.html +65 -0
- package/template/base/modules/quotation/print/quotation.rk +7 -0
- package/template/base/modules/stock/flows/stock_negative_alert.rk +15 -0
- package/template/base/modules/stock/models/recipe.rk +60 -0
- package/template/base/modules/stock/models/recipe_line.rk +24 -0
- package/template/base/modules/stock/models/stock_adjustment.rk +61 -0
- package/template/base/modules/stock/models/stock_adjustment_item.rk +32 -0
- package/template/base/modules/stock/models/stock_balance.rk +23 -0
- package/template/base/modules/stock/models/stock_count.rk +54 -0
- package/template/base/modules/stock/models/stock_count_item.rk +33 -0
- package/template/base/modules/stock/models/stock_move.rk +41 -0
- package/template/base/modules/stock/models/stock_transfer.rk +70 -0
- package/template/base/modules/stock/models/stock_transfer_item.rk +34 -0
- package/template/base/modules/stock/models/stock_transfer_receipt.rk +57 -0
- package/template/base/modules/stock/models/stock_transfer_receipt_item.rk +18 -0
- package/template/base/modules/stock/module.rk +8 -0
- package/template/base/modules/tax_id/models/tax_code.rk +49 -0
- package/template/base/modules/tax_id/module.rk +5 -0
- package/template/base/modules/users/models/user.rk +27 -0
- package/template/base/modules/users/module.rk +5 -0
- package/template/base/modules/users/roles/finance_manager.rk +4 -0
- package/template/base/modules/users/roles/head_office.rk +4 -0
- package/template/base/modules/users/roles/outlet_staff.rk +6 -0
- package/template/base/modules/users/roles/project_admin.rk +4 -0
- package/template/base/modules/users/roles/purchasing_manager.rk +4 -0
- package/template/base/modules/users/roles/sales_manager.rk +4 -0
- package/template/base/modules/users/roles/sales_rep.rk +4 -0
- package/template/base/modules/workforce/models/certification.rk +26 -0
- package/template/base/modules/workforce/models/worker.rk +53 -0
- package/template/base/modules/workforce/module.rk +5 -0
- package/template/base/package.json +17 -0
- package/template/blank/fixtures/start.rk +5 -0
- package/template/blank/site/config.rk +13 -0
- package/template/blank/site/custom/README.md +2 -0
- package/template/blank/site/features.rk +13 -0
- package/template/blank/site/layouts/main.rk +14 -0
- package/template/blank/site/system.rk +20 -0
- package/template/blank/site/themes/main.rk +8 -0
- package/template/demo/fixtures/crm_demo.rk +168 -0
- package/template/demo/fixtures/demo.rk +417 -0
- package/template/demo/site/config.rk +13 -0
- package/template/demo/site/features.rk +13 -0
- package/template/demo/site/layouts/crm_first.rk +23 -0
- package/template/demo/site/system.rk +26 -0
- package/template/demo/site/themes/kopi_senja.rk +10 -0
- package/README.md +0 -3
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/import.json
|
|
2
|
+
# Moka Backoffice "Export Item Details", one file per outlet and day (or several days). The headers are the English
|
|
3
|
+
# Backoffice headers assumed in contract 0012; when the pilot's first real export arrives, fix them here, not in the kernel.
|
|
4
|
+
# Same file twice -> duplicate (file hash). Overlapping exports -> only rows whose key is new. Records arrive as drafts.
|
|
5
|
+
name: moka_item_details
|
|
6
|
+
label: {id: Penjualan Moka (detail item), en: Moka sales (item details)}
|
|
7
|
+
model: outlet_sales
|
|
8
|
+
source: csv
|
|
9
|
+
header_row: 1
|
|
10
|
+
per: outlet
|
|
11
|
+
key: [Date, Receipt Number, Item, Variant, Modifiers]
|
|
12
|
+
group: [Date]
|
|
13
|
+
map:
|
|
14
|
+
date: Date
|
|
15
|
+
source: "='moka'"
|
|
16
|
+
note: "='Moka ' + row['Date']"
|
|
17
|
+
lines:
|
|
18
|
+
field: lines
|
|
19
|
+
map:
|
|
20
|
+
item: {value: SKU, match: sku}
|
|
21
|
+
qty: Quantity
|
|
22
|
+
gross: Gross Sales
|
|
23
|
+
discount: Discounts
|
|
24
|
+
refund: Refunds
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/model.json
|
|
2
|
+
name: outlet_sales
|
|
3
|
+
label: {id: Penjualan outlet harian, en: Daily outlet sales}
|
|
4
|
+
icon: store
|
|
5
|
+
is_submittable: true
|
|
6
|
+
naming: SLS-{YYYY}-{#####}
|
|
7
|
+
title_field: date
|
|
8
|
+
# Created as a draft (by the daily form or by an import); stock moves only when head office or the outlet submits it.
|
|
9
|
+
# stock.post_moves explodes each line through its active recipe, writes the line cogs and cogs_total, and refuses
|
|
10
|
+
# a second submitted record for the same outlet and date when source is form (409 duplicate_sales).
|
|
11
|
+
on_submit: [stock.post_moves]
|
|
12
|
+
on_cancel: [stock.reverse_moves]
|
|
13
|
+
permissions:
|
|
14
|
+
- {role: head_office, read: true, create: true, write: true, delete: true, submit: true, cancel: true, amend: true, export: true, import: true, print: true}
|
|
15
|
+
- {role: outlet_staff, read: true, create: true, write: true, submit: true}
|
|
16
|
+
fields:
|
|
17
|
+
- name: outlet
|
|
18
|
+
type: link
|
|
19
|
+
to: outlet
|
|
20
|
+
label: {id: Outlet}
|
|
21
|
+
required: true
|
|
22
|
+
in_list: true
|
|
23
|
+
- name: date
|
|
24
|
+
type: date
|
|
25
|
+
label: {id: Tanggal}
|
|
26
|
+
required: true
|
|
27
|
+
in_list: true
|
|
28
|
+
- name: source
|
|
29
|
+
type: select
|
|
30
|
+
label: {id: Sumber}
|
|
31
|
+
default: "'form'"
|
|
32
|
+
in_list: true
|
|
33
|
+
chip: true
|
|
34
|
+
options:
|
|
35
|
+
- {value: moka, label: {id: Moka}}
|
|
36
|
+
- {value: form, label: {id: Formulir harian}}
|
|
37
|
+
- name: note
|
|
38
|
+
type: data
|
|
39
|
+
label: {id: Catatan}
|
|
40
|
+
- name: lines
|
|
41
|
+
type: table
|
|
42
|
+
of: outlet_sales_line
|
|
43
|
+
label: {id: Barang terjual}
|
|
44
|
+
min_rows: 1
|
|
45
|
+
- name: qty_total
|
|
46
|
+
type: float
|
|
47
|
+
label: {id: Total qty}
|
|
48
|
+
compute: lines.map(l, l.qty).sum()
|
|
49
|
+
- name: gross_total
|
|
50
|
+
type: currency
|
|
51
|
+
label: {id: Penjualan kotor}
|
|
52
|
+
compute: lines.map(l, l.gross).sum()
|
|
53
|
+
- name: discount_total
|
|
54
|
+
type: currency
|
|
55
|
+
label: {id: Diskon}
|
|
56
|
+
compute: lines.map(l, l.discount).sum()
|
|
57
|
+
- name: refund_total
|
|
58
|
+
type: currency
|
|
59
|
+
label: {id: Retur}
|
|
60
|
+
compute: lines.map(l, l.refund).sum()
|
|
61
|
+
- name: net_total
|
|
62
|
+
type: currency
|
|
63
|
+
label: {id: Penjualan bersih}
|
|
64
|
+
compute: lines.map(l, l.net).sum()
|
|
65
|
+
in_list: true
|
|
66
|
+
- name: cogs_total
|
|
67
|
+
type: currency
|
|
68
|
+
label: {id: Harga pokok}
|
|
69
|
+
help: {id: 'Diisi sistem saat diajukan: bahan resep x rata-rata biaya'}
|
|
70
|
+
read_only: true
|
|
71
|
+
in_list: true
|
|
72
|
+
- name: margin
|
|
73
|
+
type: currency
|
|
74
|
+
label: {id: Margin}
|
|
75
|
+
compute: net_total - cogs_total
|
|
76
|
+
in_list: true
|
|
77
|
+
rules:
|
|
78
|
+
- name: qty_not_negative
|
|
79
|
+
on: save
|
|
80
|
+
check: "lines.map(l, l.qty < 0 ? 1 : 0).sum() == 0"
|
|
81
|
+
message: {id: Jumlah terjual tidak boleh negatif}
|
|
82
|
+
- name: discount_within_gross
|
|
83
|
+
on: save
|
|
84
|
+
check: "lines.map(l, l.discount > l.gross ? 1 : 0).sum() == 0"
|
|
85
|
+
message: {id: Diskon tidak boleh melebihi penjualan kotor}
|
|
86
|
+
- name: net_not_negative
|
|
87
|
+
on: save
|
|
88
|
+
check: "lines.map(l, l.net < 0 ? 1 : 0).sum() == 0"
|
|
89
|
+
message: {id: Penjualan bersih per baris tidak boleh negatif}
|
|
90
|
+
views:
|
|
91
|
+
list:
|
|
92
|
+
columns: [name, outlet, date, source, status, net_total, cogs_total, margin]
|
|
93
|
+
filters: [outlet, source]
|
|
94
|
+
sort: -date
|
|
95
|
+
form:
|
|
96
|
+
layout:
|
|
97
|
+
- section: {id: Penjualan}
|
|
98
|
+
columns:
|
|
99
|
+
- [outlet, date, source]
|
|
100
|
+
- [note]
|
|
101
|
+
- section: {id: Barang terjual}
|
|
102
|
+
fields: [lines]
|
|
103
|
+
- section: {id: Ringkasan}
|
|
104
|
+
columns:
|
|
105
|
+
- [gross_total, discount_total, refund_total, net_total]
|
|
106
|
+
- [cogs_total, margin, qty_total]
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/model.json
|
|
2
|
+
name: outlet_sales_line
|
|
3
|
+
is_child: true
|
|
4
|
+
fields:
|
|
5
|
+
- name: item
|
|
6
|
+
type: link
|
|
7
|
+
to: item
|
|
8
|
+
label: {id: Barang}
|
|
9
|
+
required: true
|
|
10
|
+
- name: description
|
|
11
|
+
type: text
|
|
12
|
+
label: {id: Uraian}
|
|
13
|
+
default: item.item_name
|
|
14
|
+
- name: qty
|
|
15
|
+
type: float
|
|
16
|
+
label: {id: Qty}
|
|
17
|
+
required: true
|
|
18
|
+
stock: true
|
|
19
|
+
- name: gross
|
|
20
|
+
type: currency
|
|
21
|
+
label: {id: Penjualan kotor}
|
|
22
|
+
default: round(qty * item.rate)
|
|
23
|
+
- name: discount
|
|
24
|
+
type: currency
|
|
25
|
+
label: {id: Diskon}
|
|
26
|
+
default: '0'
|
|
27
|
+
- name: refund
|
|
28
|
+
type: currency
|
|
29
|
+
label: {id: Retur}
|
|
30
|
+
default: '0'
|
|
31
|
+
- name: net
|
|
32
|
+
type: currency
|
|
33
|
+
label: {id: Penjualan bersih}
|
|
34
|
+
help: {id: 'Kotor dikurangi diskon dan retur (sama dengan Net Sales di Moka)'}
|
|
35
|
+
compute: round(gross - discount - refund)
|
|
36
|
+
- name: cogs
|
|
37
|
+
type: currency
|
|
38
|
+
label: {id: Harga pokok}
|
|
39
|
+
read_only: true
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/module.json
|
|
2
|
+
name: outlet_sales
|
|
3
|
+
version: 1.0.0
|
|
4
|
+
title: {id: Penjualan outlet, en: Outlet sales}
|
|
5
|
+
requires: {rangka: '>=0.5', users: ^1.0, outlets: ^1.0, catalogue: ^1.0, stock: ^1.0}
|
|
6
|
+
# Semantics fixed in docs/kernel-hooks.md (section stock): submitting posts the stock moves through the recipes.
|
|
7
|
+
hooks: [stock.reverse_moves]
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/model.json
|
|
2
|
+
name: outlet
|
|
3
|
+
naming: OUT-{##}
|
|
4
|
+
label: {id: Outlet}
|
|
5
|
+
icon: store
|
|
6
|
+
title_field: outlet_name
|
|
7
|
+
permissions:
|
|
8
|
+
- {role: sales_manager, read: true, create: true, write: true, print: true}
|
|
9
|
+
- {role: finance_manager, read: true, create: true, write: true, print: true}
|
|
10
|
+
- {role: purchasing_manager, read: true, create: true, write: true, print: true}
|
|
11
|
+
- {role: project_admin, read: true, create: true, write: true, print: true}
|
|
12
|
+
- {role: head_office, read: true, create: true, write: true, print: true}
|
|
13
|
+
- {role: outlet_staff, read: true}
|
|
14
|
+
- {role: sales_rep, read: true}
|
|
15
|
+
fields:
|
|
16
|
+
- name: outlet_name
|
|
17
|
+
type: data
|
|
18
|
+
label: {id: Nama outlet}
|
|
19
|
+
required: true
|
|
20
|
+
in_list: true
|
|
21
|
+
- name: code
|
|
22
|
+
type: data
|
|
23
|
+
label: {id: Kode}
|
|
24
|
+
in_list: true
|
|
25
|
+
unique: true
|
|
26
|
+
- name: city
|
|
27
|
+
type: data
|
|
28
|
+
label: {id: Kota}
|
|
29
|
+
in_list: true
|
|
30
|
+
- name: address
|
|
31
|
+
type: text
|
|
32
|
+
label: {id: Alamat}
|
|
33
|
+
- name: is_head_office
|
|
34
|
+
type: check
|
|
35
|
+
label: {id: Kantor pusat}
|
|
36
|
+
- name: active
|
|
37
|
+
type: check
|
|
38
|
+
label: {id: Aktif}
|
|
39
|
+
default: 'true'
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/model.json
|
|
2
|
+
name: payment
|
|
3
|
+
label: {id: Pembayaran, en: Payment}
|
|
4
|
+
icon: card
|
|
5
|
+
is_submittable: true
|
|
6
|
+
naming: PAY-{YYYY}-{#####}
|
|
7
|
+
title_field: reference
|
|
8
|
+
on_submit: [payments.allocate]
|
|
9
|
+
on_cancel: [payments.unallocate]
|
|
10
|
+
permissions:
|
|
11
|
+
- {role: finance_manager, read: true, create: true, write: true, delete: true, submit: true, cancel: true, amend: true, export: true, print: true}
|
|
12
|
+
- {role: sales_manager, read: true, create: true, write: true, delete: true, submit: true, cancel: true, amend: true, export: true, print: true}
|
|
13
|
+
# head office records vendor payments only
|
|
14
|
+
- {role: head_office, read: true, create: true, write: true, submit: true, print: true, if: direction == 'pay'}
|
|
15
|
+
fields:
|
|
16
|
+
- name: direction
|
|
17
|
+
type: select
|
|
18
|
+
label: {id: Arah}
|
|
19
|
+
default: "'receive'"
|
|
20
|
+
required: true
|
|
21
|
+
in_list: true
|
|
22
|
+
chip: true
|
|
23
|
+
options:
|
|
24
|
+
- {value: receive, label: {id: Terima dari pelanggan}}
|
|
25
|
+
- {value: pay, label: {id: Bayar ke pemasok}}
|
|
26
|
+
- name: customer
|
|
27
|
+
type: link
|
|
28
|
+
to: customer
|
|
29
|
+
label: {id: Pelanggan}
|
|
30
|
+
depends_on: direction == 'receive'
|
|
31
|
+
in_list: true
|
|
32
|
+
- name: vendor
|
|
33
|
+
type: link
|
|
34
|
+
to: vendor
|
|
35
|
+
label: {id: Pemasok}
|
|
36
|
+
depends_on: direction == 'pay'
|
|
37
|
+
- name: payment_date
|
|
38
|
+
type: date
|
|
39
|
+
label: {id: Tanggal pembayaran}
|
|
40
|
+
default: today()
|
|
41
|
+
required: true
|
|
42
|
+
in_list: true
|
|
43
|
+
- name: method
|
|
44
|
+
type: select
|
|
45
|
+
label: {id: Metode}
|
|
46
|
+
default: "'transfer'"
|
|
47
|
+
options:
|
|
48
|
+
- {value: transfer, label: {id: Transfer}}
|
|
49
|
+
- {value: cash, label: {id: Tunai}}
|
|
50
|
+
- {value: giro, label: {id: Giro}}
|
|
51
|
+
- {value: other, label: {id: Lainnya}}
|
|
52
|
+
- name: reference
|
|
53
|
+
type: data
|
|
54
|
+
label: {id: No. bukti/transfer}
|
|
55
|
+
- name: amount
|
|
56
|
+
type: currency
|
|
57
|
+
label: {id: Jumlah uang}
|
|
58
|
+
required: true
|
|
59
|
+
# A foreign-currency payment is converted once, here: amount = round(amount_fx x exchange_rate) (half away from zero, as the
|
|
60
|
+
# twin amount_fx_idr; a default cannot read the twin, which is settled after defaults). An IDR payment is typed in rupiah. Allocation rows are always IDR.
|
|
61
|
+
default: "currency != 'IDR' ? round(amount_fx * exchange_rate) : 0"
|
|
62
|
+
in_list: true
|
|
63
|
+
- name: allocations
|
|
64
|
+
type: table
|
|
65
|
+
of: payment_allocation
|
|
66
|
+
label: {id: Alokasi ke tagihan}
|
|
67
|
+
- name: allocated_total
|
|
68
|
+
type: currency
|
|
69
|
+
label: {id: Total alokasi}
|
|
70
|
+
compute: allocations.map(a, a.amount).sum()
|
|
71
|
+
- name: withheld_total
|
|
72
|
+
type: currency
|
|
73
|
+
label: {id: Total PPh 23 dipotong}
|
|
74
|
+
compute: allocations.map(a, a.withheld).sum()
|
|
75
|
+
- name: unallocated
|
|
76
|
+
type: currency
|
|
77
|
+
label: {id: Belum dialokasikan}
|
|
78
|
+
compute: amount - allocated_total
|
|
79
|
+
in_list: true
|
|
80
|
+
- name: notes
|
|
81
|
+
type: text
|
|
82
|
+
label: {id: Catatan}
|
|
83
|
+
- {name: currency, type: data, label: {id: Mata uang}, default: "'IDR'"}
|
|
84
|
+
- {name: exchange_rate, type: float, label: {id: Kurs}, default: '1'} # IDR per 1 unit of the foreign currency
|
|
85
|
+
- {name: amount_fx, type: money, currency_field: currency, rate_field: exchange_rate, label: {id: Jumlah uang (valas)}, default: '0'}
|
|
86
|
+
rules:
|
|
87
|
+
- name: foreign_needs_rate
|
|
88
|
+
on: save
|
|
89
|
+
check: currency == '' || currency == 'IDR' || exchange_rate > 1
|
|
90
|
+
message: {id: Dokumen valas wajib diisi kursnya (rupiah per 1 unit mata uang asing)}
|
|
91
|
+
- name: amount_positive
|
|
92
|
+
on: save
|
|
93
|
+
check: amount > 0
|
|
94
|
+
message: {id: Jumlah pembayaran harus lebih dari 0}
|
|
95
|
+
- name: allocated_within_amount
|
|
96
|
+
on: save
|
|
97
|
+
check: allocated_total <= amount
|
|
98
|
+
message: {id: Alokasi melebihi jumlah pembayaran}
|
|
99
|
+
- name: fx_amount_matches
|
|
100
|
+
on: save
|
|
101
|
+
check: "currency == 'IDR' || amount == round(amount_fx * exchange_rate)"
|
|
102
|
+
message: {id: Jumlah rupiah harus sama dengan jumlah valas x kurs}
|
|
103
|
+
- name: receive_needs_customer
|
|
104
|
+
on: save
|
|
105
|
+
check: direction != 'receive' || customer != ''
|
|
106
|
+
message: {id: Pilih pelanggan}
|
|
107
|
+
- name: pay_needs_vendor
|
|
108
|
+
on: save
|
|
109
|
+
check: direction != 'pay' || vendor != ''
|
|
110
|
+
message: {id: Pilih pemasok}
|
|
111
|
+
- name: row_amount_positive
|
|
112
|
+
on: save
|
|
113
|
+
check: "allocations.map(a, a.amount <= 0 ? 1 : 0).sum() == 0"
|
|
114
|
+
message: {id: Jumlah alokasi harus lebih dari 0}
|
|
115
|
+
- name: row_not_negative
|
|
116
|
+
on: save
|
|
117
|
+
check: "allocations.map(a, a.amount < 0 || a.withheld < 0 ? 1 : 0).sum() == 0"
|
|
118
|
+
message: {id: Alokasi dan PPh 23 dipotong tidak boleh negatif}
|
|
119
|
+
# amount_due of a PPh 23 invoice already nets the tax (the bukti potong is a `withholding` record), so `withheld`
|
|
120
|
+
# is only for invoices where pph23_applies is false but the customer withheld anyway.
|
|
121
|
+
- name: no_double_pph23
|
|
122
|
+
on: save
|
|
123
|
+
check: "allocations.map(a, a.withheld > 0 && a.pph23_applies ? 1 : 0).sum() == 0"
|
|
124
|
+
message: {id: PPh 23 sudah dipotong di faktur ini}
|
|
125
|
+
# `all` is not in the validators' CEL subset yet (map and sum only), so "every row" is "no violating row".
|
|
126
|
+
- name: allocation_within_outstanding
|
|
127
|
+
on: save
|
|
128
|
+
check: "allocations.map(a, a.amount + a.withheld > a.outstanding ? 1 : 0).sum() == 0"
|
|
129
|
+
message: {id: Alokasi melebihi sisa tagihan}
|
|
130
|
+
# receive allocates to a sales_invoice, pay to a vendor_bill; a row must name its own kind and only that kind.
|
|
131
|
+
- name: allocation_has_target
|
|
132
|
+
on: save
|
|
133
|
+
check: "allocations.map(a, (direction == 'receive' ? a.sales_invoice == '' || a.vendor_bill != '' : a.vendor_bill == '' || a.sales_invoice != '') ? 1 : 0).sum() == 0"
|
|
134
|
+
message: {id: Pilih faktur penjualan (terima) atau tagihan pemasok (bayar) untuk setiap baris alokasi}
|
|
135
|
+
views:
|
|
136
|
+
list:
|
|
137
|
+
columns: [name, direction, customer, payment_date, status, amount, unallocated]
|
|
138
|
+
sort: -payment_date
|
|
139
|
+
form:
|
|
140
|
+
layout:
|
|
141
|
+
- section: {id: Pembayaran}
|
|
142
|
+
columns:
|
|
143
|
+
- [direction, customer, vendor, payment_date]
|
|
144
|
+
- [method, reference, amount]
|
|
145
|
+
- section: {id: Alokasi}
|
|
146
|
+
fields: [allocations]
|
|
147
|
+
- section: {id: Ringkasan}
|
|
148
|
+
columns:
|
|
149
|
+
- [allocated_total, withheld_total, unallocated]
|
|
150
|
+
- section: {id: Catatan}
|
|
151
|
+
fields: [notes]
|
|
152
|
+
- section: {id: Mata uang asing}
|
|
153
|
+
columns:
|
|
154
|
+
- [currency, exchange_rate, amount_fx]
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/model.json
|
|
2
|
+
name: payment_allocation
|
|
3
|
+
label: {id: Alokasi pembayaran}
|
|
4
|
+
is_child: true
|
|
5
|
+
fields:
|
|
6
|
+
- name: sales_invoice
|
|
7
|
+
type: link
|
|
8
|
+
to: sales_invoice
|
|
9
|
+
label: {id: Faktur penjualan}
|
|
10
|
+
- name: vendor_bill
|
|
11
|
+
type: link
|
|
12
|
+
to: vendor_bill
|
|
13
|
+
label: {id: Tagihan pemasok}
|
|
14
|
+
- name: outstanding
|
|
15
|
+
type: currency
|
|
16
|
+
label: {id: Sisa tagihan saat input}
|
|
17
|
+
default: "sales_invoice != '' ? sales_invoice.outstanding : (vendor_bill != '' ? vendor_bill.outstanding : 0)"
|
|
18
|
+
read_only: true
|
|
19
|
+
- name: pph23_applies
|
|
20
|
+
type: check
|
|
21
|
+
label: {id: Faktur sudah dipotong PPh 23}
|
|
22
|
+
default: "sales_invoice != '' ? sales_invoice.pph23_applies : false"
|
|
23
|
+
read_only: true
|
|
24
|
+
- name: amount
|
|
25
|
+
type: currency
|
|
26
|
+
label: {id: Uang diterapkan}
|
|
27
|
+
required: true
|
|
28
|
+
- name: withheld
|
|
29
|
+
type: currency
|
|
30
|
+
label: {id: PPh 23 dipotong pelanggan}
|
|
31
|
+
default: '0'
|
|
32
|
+
- name: applied_idr
|
|
33
|
+
type: int
|
|
34
|
+
label: {id: Diterapkan (Rp)}
|
|
35
|
+
read_only: true
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/model.json
|
|
2
|
+
name: withholding
|
|
3
|
+
label: {id: Bukti potong PPh 23, en: Withholding certificate}
|
|
4
|
+
icon: invoice
|
|
5
|
+
is_submittable: true
|
|
6
|
+
naming: BP-{YYYY}-{#####}
|
|
7
|
+
title_field: cert_no
|
|
8
|
+
permissions:
|
|
9
|
+
- {role: finance_manager, read: true, create: true, write: true, delete: true, submit: true, cancel: true, amend: true, export: true, print: true}
|
|
10
|
+
- {role: sales_manager, read: true, print: true}
|
|
11
|
+
fields:
|
|
12
|
+
- name: customer
|
|
13
|
+
type: link
|
|
14
|
+
to: customer
|
|
15
|
+
label: {id: Pelanggan}
|
|
16
|
+
required: true
|
|
17
|
+
in_list: true
|
|
18
|
+
- name: sales_invoice
|
|
19
|
+
type: link
|
|
20
|
+
to: sales_invoice
|
|
21
|
+
label: {id: Faktur penjualan}
|
|
22
|
+
required: true
|
|
23
|
+
in_list: true
|
|
24
|
+
- name: payment
|
|
25
|
+
type: link
|
|
26
|
+
to: payment
|
|
27
|
+
label: {id: Pembayaran}
|
|
28
|
+
- name: cert_no
|
|
29
|
+
type: data
|
|
30
|
+
label: {id: No. bukti potong}
|
|
31
|
+
required: true
|
|
32
|
+
in_list: true
|
|
33
|
+
- name: cert_date
|
|
34
|
+
type: date
|
|
35
|
+
label: {id: Tanggal bukti potong}
|
|
36
|
+
required: true
|
|
37
|
+
in_list: true
|
|
38
|
+
- name: dpp
|
|
39
|
+
type: currency
|
|
40
|
+
label: {id: DPP}
|
|
41
|
+
default: sales_invoice.dpp
|
|
42
|
+
- name: rate
|
|
43
|
+
type: percent
|
|
44
|
+
label: {id: Tarif}
|
|
45
|
+
default: '2'
|
|
46
|
+
- name: amount
|
|
47
|
+
type: currency
|
|
48
|
+
label: {id: PPh 23 dipotong}
|
|
49
|
+
compute: round(dpp * rate / 100)
|
|
50
|
+
in_list: true
|
|
51
|
+
- name: document
|
|
52
|
+
type: attach
|
|
53
|
+
label: {id: Berkas bukti potong}
|
|
54
|
+
rules:
|
|
55
|
+
- name: invoice_of_customer
|
|
56
|
+
on: save
|
|
57
|
+
check: sales_invoice.customer == customer
|
|
58
|
+
message: {id: Faktur bukan milik pelanggan ini}
|
|
59
|
+
views:
|
|
60
|
+
list:
|
|
61
|
+
columns: [name, customer, sales_invoice, cert_no, cert_date, amount]
|
|
62
|
+
sort: -cert_date
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/module.json
|
|
2
|
+
name: payments
|
|
3
|
+
version: 1.0.0
|
|
4
|
+
title: {id: Pembayaran, en: Payments}
|
|
5
|
+
requires: {rangka: '>=0.5', users: ^1.0, contacts: ^1.0, invoicing: ^1.0, procurement: ^1.0}
|
|
6
|
+
optional: {currency: ^1.0}
|
|
7
|
+
# Semantics fixed in docs/kernel-hooks.md (section payments).
|
|
8
|
+
hooks: [payments.allocate, payments.unallocate]
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{{define "style"}}
|
|
2
|
+
.meta { width: 100%; margin: 12px 0; border-collapse: collapse; }
|
|
3
|
+
.meta td { padding: 2px 6px 2px 0; vertical-align: top; }
|
|
4
|
+
.items { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 0.92em; }
|
|
5
|
+
.items th, .items td { border-bottom: 1px solid #d6d3d1; padding: 5px 6px; text-align: left; }
|
|
6
|
+
.items th { background: #f6ede6; }
|
|
7
|
+
.items tr.total td { border-top: 2px solid #1c1917; font-weight: 700; }
|
|
8
|
+
.num { text-align: right !important; font-variant-numeric: tabular-nums; }
|
|
9
|
+
.note { margin-top: 14px; font-size: 0.9em; }
|
|
10
|
+
{{end}}
|
|
11
|
+
{{template "letterhead" .}}
|
|
12
|
+
<h1>Laporan tagihan / Statement of account</h1>
|
|
13
|
+
<table class="meta">
|
|
14
|
+
<tr><td>Pelanggan</td><td>: {{.Doc.customer_name}}</td><td>Per tanggal</td><td>: {{date .Printed}}</td></tr>
|
|
15
|
+
<tr><td>Alamat</td><td>: {{.Doc.address}}</td><td>NPWP</td><td>: {{.Doc.npwp}}</td></tr>
|
|
16
|
+
</table>
|
|
17
|
+
{{/* Open amounts use the invoice's own `outstanding` (amount_due - paid_amount), not grand_total - paid_amount:
|
|
18
|
+
PPh 23 and retention make the two differ. Aging buckets are summed here for the same reason (see docs/kernel-hooks.md). */}}
|
|
19
|
+
{{/* `sub $x (sub 0 n)` is x + n: the helper set has sub but no add. */}}
|
|
20
|
+
{{$cur := 0}}{{$d30 := 0}}{{$d60 := 0}}{{$d90 := 0}}{{$o90 := 0}}
|
|
21
|
+
<table class="items">
|
|
22
|
+
<thead><tr><th>No. faktur</th><th>Tanggal</th><th>Jatuh tempo</th><th class="num">Tagihan</th><th class="num">Dibayar</th><th class="num">Sisa</th><th class="num">Umur (hari)</th></tr></thead>
|
|
23
|
+
<tbody>
|
|
24
|
+
{{range $inv := .Related.invoices}}
|
|
25
|
+
{{if $inv.outstanding}}
|
|
26
|
+
{{$age := overdue $inv.due_date}}
|
|
27
|
+
<tr>
|
|
28
|
+
<td>{{$inv.name}}</td>
|
|
29
|
+
<td>{{date $inv.posting_date}}</td>
|
|
30
|
+
<td>{{date $inv.due_date}}</td>
|
|
31
|
+
<td class="num">{{rupiah $inv.amount_due}}</td>
|
|
32
|
+
<td class="num">{{rupiah $inv.paid_amount}}</td>
|
|
33
|
+
<td class="num">{{rupiah $inv.outstanding}}</td>
|
|
34
|
+
<td class="num">{{$age}}</td>
|
|
35
|
+
</tr>
|
|
36
|
+
{{if le $age 0}}{{$cur = sub $cur (sub 0 $inv.outstanding)}}
|
|
37
|
+
{{else if le $age 30}}{{$d30 = sub $d30 (sub 0 $inv.outstanding)}}
|
|
38
|
+
{{else if le $age 60}}{{$d60 = sub $d60 (sub 0 $inv.outstanding)}}
|
|
39
|
+
{{else if le $age 90}}{{$d90 = sub $d90 (sub 0 $inv.outstanding)}}
|
|
40
|
+
{{else}}{{$o90 = sub $o90 (sub 0 $inv.outstanding)}}{{end}}
|
|
41
|
+
{{end}}
|
|
42
|
+
{{end}}
|
|
43
|
+
<tr class="total"><td colspan="5">Total sisa tagihan</td><td class="num">{{rupiah (sum .Related.invoices "outstanding")}}</td><td></td></tr>
|
|
44
|
+
</tbody>
|
|
45
|
+
</table>
|
|
46
|
+
<h2>Umur piutang</h2>
|
|
47
|
+
<table class="items">
|
|
48
|
+
<thead><tr><th class="num">Belum jatuh tempo</th><th class="num">1-30 hari</th><th class="num">31-60 hari</th><th class="num">61-90 hari</th><th class="num">> 90 hari</th></tr></thead>
|
|
49
|
+
<tbody><tr>
|
|
50
|
+
<td class="num">{{rupiah $cur}}</td><td class="num">{{rupiah $d30}}</td><td class="num">{{rupiah $d60}}</td><td class="num">{{rupiah $d90}}</td><td class="num">{{rupiah $o90}}</td>
|
|
51
|
+
</tr></tbody>
|
|
52
|
+
</table>
|
|
53
|
+
{{if .Truncated.invoices}}<p class="note"><strong>Daftar dipotong:</strong> hanya 1.000 tagihan terlama yang ditampilkan, jadi total dan umur piutang di atas lebih kecil dari yang sebenarnya.</p>{{end}}
|
|
54
|
+
<p class="note">Faktur yang sudah lunas tidak ditampilkan. Bila ada selisih dengan catatan kamu, mohon hubungi kami.</p>
|
|
55
|
+
{{template "bank_accounts" .}}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/print.json
|
|
2
|
+
name: statement
|
|
3
|
+
model: customer
|
|
4
|
+
label: {id: Laporan tagihan (SOA), en: Statement of account}
|
|
5
|
+
paper: A4
|
|
6
|
+
template: statement.html
|
|
7
|
+
related:
|
|
8
|
+
invoices:
|
|
9
|
+
model: sales_invoice
|
|
10
|
+
match: {customer: name}
|
|
11
|
+
filter: docstatus == 1 && outstanding > 0
|
|
12
|
+
sort: posting_date
|
|
13
|
+
limit: 1000
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
|
|
2
|
+
name: morning_follow_up
|
|
3
|
+
label: {id: Pengingat follow-up pagi}
|
|
4
|
+
schedule: 0 8 * * 1-5
|
|
5
|
+
steps:
|
|
6
|
+
- {find_all: activity, where: "!done && due_date <= today()", as: due}
|
|
7
|
+
- if: size(due) > 0
|
|
8
|
+
notify: owner
|
|
9
|
+
channel: email
|
|
10
|
+
template: {id: 'Ada {size(due)} aktivitas yang harus di-follow-up hari ini'}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
|
|
2
|
+
name: whatsapp_to_lead
|
|
3
|
+
label: {id: Chat WhatsApp baru jadi lead}
|
|
4
|
+
on: whatsapp_business.message_received
|
|
5
|
+
steps:
|
|
6
|
+
- {find: lead, where: phone == event.from, as: lead}
|
|
7
|
+
- {find: customer, where: phone == event.from, as: customer}
|
|
8
|
+
- if: lead == null && customer == null
|
|
9
|
+
create: lead
|
|
10
|
+
set:
|
|
11
|
+
lead_name: event.profile_name
|
|
12
|
+
phone: event.from
|
|
13
|
+
source: "'whatsapp'"
|
|
14
|
+
status: "'new'"
|
|
15
|
+
as: lead
|
|
16
|
+
- create: activity
|
|
17
|
+
set:
|
|
18
|
+
activity_type: "'whatsapp'"
|
|
19
|
+
subject: truncate(event.text, 80)
|
|
20
|
+
lead: lead.name
|
|
21
|
+
due_date: today()
|
|
22
|
+
done: 'true'
|
|
23
|
+
notes: event.text
|
|
24
|
+
idempotency: event.message_id
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/model.json
|
|
2
|
+
name: activity
|
|
3
|
+
label: {id: Aktivitas, en: Activity}
|
|
4
|
+
icon: calendar
|
|
5
|
+
naming: ACT-{#####}
|
|
6
|
+
title_field: subject
|
|
7
|
+
permissions:
|
|
8
|
+
- {role: sales_manager, read: true, create: true, write: true, delete: true, submit: true, cancel: true, amend: true, export: true, print: true}
|
|
9
|
+
- {role: finance_manager, read: true}
|
|
10
|
+
- {role: purchasing_manager, read: true}
|
|
11
|
+
- {role: project_admin, read: true}
|
|
12
|
+
- {role: head_office, read: true}
|
|
13
|
+
- {role: outlet_staff, read: true}
|
|
14
|
+
- {role: sales_rep, read: true, create: true, write: true, if: owner == user.name}
|
|
15
|
+
fields:
|
|
16
|
+
- name: activity_type
|
|
17
|
+
type: select
|
|
18
|
+
label: {id: Jenis}
|
|
19
|
+
in_list: true
|
|
20
|
+
default: "'whatsapp'"
|
|
21
|
+
options:
|
|
22
|
+
- value: whatsapp
|
|
23
|
+
label: {id: WhatsApp}
|
|
24
|
+
- value: call
|
|
25
|
+
label: {id: Telepon}
|
|
26
|
+
- value: meeting
|
|
27
|
+
label: {id: Meeting}
|
|
28
|
+
- value: visit
|
|
29
|
+
label: {id: Kunjungan}
|
|
30
|
+
- value: email
|
|
31
|
+
label: {id: Email}
|
|
32
|
+
- name: subject
|
|
33
|
+
type: data
|
|
34
|
+
label: {id: Perihal}
|
|
35
|
+
required: true
|
|
36
|
+
in_list: true
|
|
37
|
+
- name: deal
|
|
38
|
+
type: link
|
|
39
|
+
to: deal
|
|
40
|
+
label: {id: Peluang}
|
|
41
|
+
in_list: true
|
|
42
|
+
- name: lead
|
|
43
|
+
type: link
|
|
44
|
+
to: lead
|
|
45
|
+
label: {id: Lead}
|
|
46
|
+
- name: due_date
|
|
47
|
+
type: date
|
|
48
|
+
label: {id: Tanggal}
|
|
49
|
+
default: today()
|
|
50
|
+
in_list: true
|
|
51
|
+
- name: done
|
|
52
|
+
type: check
|
|
53
|
+
label: {id: Selesai}
|
|
54
|
+
in_list: true
|
|
55
|
+
- name: owner
|
|
56
|
+
type: link
|
|
57
|
+
to: user
|
|
58
|
+
label: {id: Penanggung jawab}
|
|
59
|
+
in_list: true
|
|
60
|
+
- name: notes
|
|
61
|
+
type: text
|
|
62
|
+
label: {id: Catatan}
|
|
63
|
+
rules:
|
|
64
|
+
- name: linked
|
|
65
|
+
on: save
|
|
66
|
+
check: deal != '' || lead != ''
|
|
67
|
+
message: {id: Hubungkan aktivitas ke peluang atau lead}
|
|
68
|
+
views:
|
|
69
|
+
list:
|
|
70
|
+
columns: [due_date, activity_type, subject, deal, owner, done]
|
|
71
|
+
sort: due_date
|
|
72
|
+
form:
|
|
73
|
+
layout:
|
|
74
|
+
- section: {id: Aktivitas}
|
|
75
|
+
columns:
|
|
76
|
+
- [activity_type, subject, due_date]
|
|
77
|
+
- [deal, lead, owner]
|
|
78
|
+
- section: {id: Hasil}
|
|
79
|
+
columns:
|
|
80
|
+
- [done]
|
|
81
|
+
- []
|
|
82
|
+
- section: {id: Catatan}
|
|
83
|
+
fields: [notes]
|