@rangka-os/create 0.5.0-alpha.27 → 0.5.0-alpha.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/template/base/apps/absen_karyawan/app.rk +37 -0
- package/template/base/apps/absen_karyawan/dashboards/absen_hari_ini.rk +20 -0
- package/template/base/apps/absen_karyawan/dashboards/absen_karyawan_saya.rk +14 -0
- package/template/base/apps/absen_karyawan/dashboards/rekap_absen_karyawan.rk +12 -0
- package/template/base/apps/jasa_proyek/app.rk +1 -1
- package/template/base/apps/kasir/app.rk +5 -1
- package/template/base/apps/kasir/dashboards/kasir_ringkas.rk +4 -0
- package/template/base/apps/kasir/skills/rangka-app-kasir/SKILL.md +20 -0
- package/template/base/connectors/midtrans/connector.rk +249 -0
- package/template/base/connectors/midtrans/fixtures/charge_gopay.json +34 -0
- package/template/base/connectors/midtrans/fixtures/charge_qris.json +23 -0
- package/template/base/connectors/midtrans/fixtures/charge_va.json +20 -0
- package/template/base/connectors/midtrans/fixtures/create_snap.json +4 -0
- package/template/base/connectors/midtrans/fixtures/expect.json +88 -0
- package/template/base/connectors/midtrans/fixtures/get_status.json +15 -0
- package/template/base/connectors/midtrans/fixtures/payment_notified.json +28 -0
- package/template/base/connectors/midtrans/fixtures/payment_notified_challenge.json +24 -0
- package/template/base/connectors/midtrans/fixtures/payment_notified_expire.json +24 -0
- package/template/base/connectors/midtrans/fixtures/payment_notified_other_amount.json +28 -0
- package/template/base/connectors/midtrans/fixtures/payment_notified_partial_refund.json +34 -0
- package/template/base/connectors/midtrans/fixtures/payment_notified_pending.json +31 -0
- package/template/base/connectors/midtrans/fixtures/payment_notified_refund.json +34 -0
- package/template/base/connectors/midtrans/fixtures/payment_notified_relabelled.json +28 -0
- package/template/base/connectors/midtrans/fixtures/payment_notified_va.json +32 -0
- package/template/base/connectors/midtrans/fixtures/signature_vector.txt +3 -0
- package/template/base/connectors/midtrans/mock/midtrans_mock.py +335 -0
- package/template/base/connectors/rangka_whatsapp/README.md +105 -0
- package/template/base/connectors/rangka_whatsapp/connector.rk +141 -0
- package/template/base/connectors/rangka_whatsapp/fixtures/expect.json +9 -0
- package/template/base/connectors/rangka_whatsapp/fixtures/message_received.json +1 -0
- package/template/base/connectors/rangka_whatsapp/fixtures/message_status.json +1 -0
- package/template/base/connectors/rangka_whatsapp/fixtures/message_status_refused.json +1 -0
- package/template/base/connectors/rangka_whatsapp/fixtures/opted_out.json +1 -0
- package/template/base/connectors/rangka_whatsapp/fixtures/send_template.json +1 -0
- package/template/base/connectors/rangka_whatsapp/fixtures/send_template_duplicate.json +1 -0
- package/template/base/connectors/rangka_whatsapp/fixtures/set_opt_out.json +1 -0
- package/template/base/connectors/rangka_whatsapp/mock/rangka_whatsapp_mock.py +354 -0
- package/template/base/connectors/shopee/connector.rk +360 -0
- package/template/base/connectors/shopee/fixtures/expect.json +119 -0
- package/template/base/connectors/shopee/fixtures/get_models.json +52 -0
- package/template/base/connectors/shopee/fixtures/get_order_detail.json +396 -0
- package/template/base/connectors/shopee/fixtures/get_settlement.json +90 -0
- package/template/base/connectors/shopee/fixtures/get_tracking.json +13 -0
- package/template/base/connectors/shopee/fixtures/list_items.json +29 -0
- package/template/base/connectors/shopee/fixtures/list_orders.json +31 -0
- package/template/base/connectors/shopee/fixtures/list_settlements.json +15 -0
- package/template/base/connectors/shopee/fixtures/order_changed.json +101 -0
- package/template/base/connectors/shopee/fixtures/order_changed_cancelled.json +72 -0
- package/template/base/connectors/shopee/fixtures/order_changed_completed.json +101 -0
- package/template/base/connectors/shopee/fixtures/order_changed_in_cancel.json +72 -0
- package/template/base/connectors/shopee/fixtures/order_changed_unpaid.json +71 -0
- package/template/base/connectors/shopee/fixtures/order_settled.json +92 -0
- package/template/base/connectors/shopee/fixtures/push_received.json +12 -0
- package/template/base/connectors/shopee/fixtures/push_received_tracking.json +11 -0
- package/template/base/connectors/shopee/fixtures/update_stock.json +15 -0
- package/template/base/connectors/shopee/mock/shopee_mock.py +894 -0
- package/template/base/connectors/tiktok_shop/connector.rk +300 -0
- package/template/base/connectors/tiktok_shop/fixtures/expect.json +105 -0
- package/template/base/connectors/tiktok_shop/fixtures/get_order_detail.json +136 -0
- package/template/base/connectors/tiktok_shop/fixtures/get_settlement.json +83 -0
- package/template/base/connectors/tiktok_shop/fixtures/get_tracking.json +28 -0
- package/template/base/connectors/tiktok_shop/fixtures/list_orders.json +242 -0
- package/template/base/connectors/tiktok_shop/fixtures/list_products.json +77 -0
- package/template/base/connectors/tiktok_shop/fixtures/list_settlements.json +22 -0
- package/template/base/connectors/tiktok_shop/fixtures/list_shops.json +17 -0
- package/template/base/connectors/tiktok_shop/fixtures/order_changed.json +129 -0
- package/template/base/connectors/tiktok_shop/fixtures/order_changed_cancelled.json +81 -0
- package/template/base/connectors/tiktok_shop/fixtures/order_changed_completed.json +106 -0
- package/template/base/connectors/tiktok_shop/fixtures/order_changed_on_hold.json +104 -0
- package/template/base/connectors/tiktok_shop/fixtures/order_changed_tokopedia.json +106 -0
- package/template/base/connectors/tiktok_shop/fixtures/order_changed_unpaid.json +79 -0
- package/template/base/connectors/tiktok_shop/fixtures/order_settled.json +73 -0
- package/template/base/connectors/tiktok_shop/fixtures/update_stock.json +6 -0
- package/template/base/connectors/tiktok_shop/fixtures/webhook_received.json +12 -0
- package/template/base/connectors/tiktok_shop/fixtures/webhook_received_cancellation.json +13 -0
- package/template/base/connectors/tiktok_shop/mock/tiktok_shop_mock.py +819 -0
- package/template/base/connectors/whatsapp_business/connector.rk +3 -1
- package/template/base/connectors/whatsapp_business/templates.md +13 -1
- package/template/base/modules/attendance/flows/attendance_missing_digest.rk +30 -0
- package/template/base/modules/attendance/flows/attendance_period_on_cancel.rk +15 -0
- package/template/base/modules/attendance/flows/attendance_period_on_submit.rk +60 -0
- package/template/base/modules/attendance/flows/staff_attendance_cancel_guard.rk +14 -0
- package/template/base/modules/attendance/flows/staff_attendance_guard_created.rk +16 -0
- package/template/base/modules/attendance/flows/staff_attendance_guard_submitted.rk +37 -0
- package/template/base/modules/attendance/flows/staff_attendance_guard_updated.rk +14 -0
- package/template/base/modules/attendance/models/attendance_period.rk +62 -0
- package/template/base/modules/attendance/models/attendance_summary.rk +37 -0
- package/template/base/modules/attendance/models/staff_attendance.rk +281 -0
- package/template/base/modules/attendance/models/staff_attendance_guard.rk +50 -0
- package/template/base/modules/attendance/module.rk +18 -0
- package/template/base/modules/attendance/screens/absen_outlet.rk +22 -0
- package/template/base/modules/catalogue/models/item.rk +69 -0
- package/template/base/modules/catalogue/module.rk +1 -1
- package/template/base/modules/contacts/models/customer.rk +43 -19
- package/template/base/modules/contacts/module.rk +1 -1
- package/template/base/modules/coretax/module.rk +1 -1
- package/template/base/modules/coretax/print/coretax_faktur.rk +3 -2
- package/template/base/modules/coretax/print/coretax_faktur.xml +3 -1
- package/template/base/modules/coretax/print/rekap_ppn.html +9 -7
- package/template/base/modules/courses/flows/charge_invoice_on_submit.rk +15 -0
- package/template/base/modules/courses/module.rk +1 -1
- package/template/base/modules/courses/screens/absen_kelas.rk +1 -0
- package/template/base/modules/invoicing/flows/invoice_due_digest.rk +45 -7
- package/template/base/modules/invoicing/models/sales_invoice_item.rk +4 -1
- package/template/base/modules/invoicing/module.rk +15 -2
- package/template/base/modules/kitchen/screens/dapur.rk +1 -0
- package/template/base/modules/outlets/models/outlet.rk +69 -0
- package/template/base/modules/outlets/module.rk +1 -1
- package/template/base/modules/payments/flows/payment_from_midtrans.rk +85 -0
- package/template/base/modules/payments/flows/payment_refund_from_midtrans.rk +22 -0
- package/template/base/modules/payments/models/payment.rk +2 -1
- package/template/base/modules/payments/module.rk +1 -1
- package/template/base/modules/payroll/flows/payroll_close_on_cancel.rk +8 -5
- package/template/base/modules/payroll/flows/payroll_close_on_submit.rk +8 -5
- package/template/base/modules/payroll/flows/payroll_reminder.rk +106 -0
- package/template/base/modules/payroll/flows/payroll_run_overlap_guard_created.rk +5 -3
- package/template/base/modules/payroll/flows/payroll_run_overlap_guard_updated.rk +5 -3
- package/template/base/modules/payroll/flows/payslip_from_recap.rk +1 -1
- package/template/base/modules/payroll/imports/payroll_profile_list.rk +27 -0
- package/template/base/modules/payroll/models/payroll_close.rk +10 -6
- package/template/base/modules/payroll/models/payroll_run.rk +64 -15
- package/template/base/modules/payroll/models/payslip.rk +48 -9
- package/template/base/modules/payroll/module.rk +22 -5
- package/template/base/modules/payroll/print/payslip.html +4 -1
- package/template/base/modules/pos/models/pos_sale.rk +136 -9
- package/template/base/modules/pos/models/pos_sale_item.rk +33 -1
- package/template/base/modules/pos/module.rk +5 -3
- package/template/base/modules/pos/print/pos_receipt.html +7 -3
- package/template/base/modules/pos/screens/kasir.rk +7 -2
- package/template/base/modules/procurement/flows/reorder_draft_po.rk +57 -0
- package/template/base/modules/procurement/models/vendor_bill.rk +14 -1
- package/template/base/modules/procurement/module.rk +11 -2
- package/template/base/modules/projects/screens/absen.rk +1 -0
- package/template/base/modules/promotions/flows/promo_code_batch_on_submit.rk +26 -0
- package/template/base/modules/promotions/flows/promotion_apply.rk +110 -0
- package/template/base/modules/promotions/flows/promotion_apply_on_create.rk +110 -0
- package/template/base/modules/promotions/flows/promotion_apply_on_delete.rk +111 -0
- package/template/base/modules/promotions/flows/promotion_apply_on_update.rk +110 -0
- package/template/base/modules/promotions/flows/promotion_on_sale.rk +95 -0
- package/template/base/modules/promotions/flows/promotion_on_sale_cancel.rk +43 -0
- package/template/base/modules/promotions/models/promo_code.rk +27 -0
- package/template/base/modules/promotions/models/promo_code_batch.rk +36 -0
- package/template/base/modules/promotions/models/promo_guard.rk +44 -0
- package/template/base/modules/promotions/models/promotion.rk +197 -0
- package/template/base/modules/promotions/models/promotion_ledger.rk +35 -0
- package/template/base/modules/promotions/module.rk +20 -0
- package/template/base/modules/rental/screens/alat_keluar.rk +1 -0
- package/template/base/modules/rental/screens/alat_kembali.rk +1 -0
- package/template/base/modules/rental/screens/jadwal_alat.rk +1 -0
- package/template/base/modules/stock/flows/stock_low_alert.rk +65 -0
- package/template/base/modules/stock/flows/stock_negative_alert.rk +14 -5
- package/template/base/modules/stock/models/stock_reorder.rk +34 -0
- package/template/base/modules/stock/module.rk +17 -2
- package/template/base/modules/subscriptions/screens/catat_tagih.rk +1 -0
- package/template/base/modules/subscriptions/screens/rute_tagih.rk +1 -0
- package/template/base/modules/users/flows/summary_daily.rk +83 -0
- package/template/base/modules/users/flows/summary_monthly.rk +83 -0
- package/template/base/modules/users/flows/summary_weekly.rk +83 -0
- package/template/base/modules/users/models/business_summary.rk +67 -0
- package/template/base/modules/users/models/summary_setting.rk +35 -0
- package/template/base/modules/users/models/user.rk +11 -3
- package/template/base/modules/users/module.rk +21 -2
- package/template/base/modules/users/roles/employee.rk +8 -0
- package/template/base/modules/users/roles/outlet_supervisor.rk +7 -0
- package/template/base/modules/whatsapp/flows/whatsapp_customer_opt_out.rk +16 -0
- package/template/base/modules/whatsapp/flows/whatsapp_customer_opt_out_new.rk +17 -0
- package/template/base/modules/whatsapp/flows/whatsapp_message_status.rk +24 -0
- package/template/base/modules/whatsapp/flows/whatsapp_opted_out.rk +26 -0
- package/template/base/modules/whatsapp/models/whatsapp_message.rk +99 -0
- package/template/base/modules/whatsapp/models/whatsapp_opt_out.rk +44 -0
- package/template/base/modules/whatsapp/module.rk +23 -0
- package/template/base/modules/whatsapp_booking/flows/whatsapp_booking_tomorrow.rk +48 -0
- package/template/base/modules/whatsapp_booking/module.rk +13 -0
- package/template/base/modules/whatsapp_order_ready/flows/whatsapp_pickup_on_sale.rk +19 -0
- package/template/base/modules/whatsapp_order_ready/flows/whatsapp_ticket_ready.rk +40 -0
- package/template/base/modules/whatsapp_order_ready/models/whatsapp_pickup.rk +22 -0
- package/template/base/modules/whatsapp_order_ready/module.rk +14 -0
- package/template/base/modules/whatsapp_receipt/flows/whatsapp_receipt_on_sale.rk +43 -0
- package/template/base/modules/whatsapp_receipt/module.rk +13 -0
- package/template/base/modules/whatsapp_reminder/flows/whatsapp_invoice_overdue.rk +64 -0
- package/template/base/modules/whatsapp_reminder/module.rk +15 -0
- package/template/base/modules/workforce/imports/worker_list.rk +4 -1
|
@@ -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: pos
|
|
3
|
-
version: 1.
|
|
3
|
+
version: 1.4.0
|
|
4
4
|
title: {id: Kasir, en: Point of sale}
|
|
5
5
|
summary:
|
|
6
6
|
id: Kasir di browser dengan sesi kas, transaksi dan tutup sesi per outlet.
|
|
@@ -17,6 +17,8 @@ icon: shopping-basket-line
|
|
|
17
17
|
# (cancel, then amend without the returned items) only on its own day while its shift is open.
|
|
18
18
|
# Sales of an outlet run either here or through outlet_sales (Jalur A), never both: an outlet whose sales_source is
|
|
19
19
|
# 'kasir' takes no daily form or POS file, and a sale needs that source when outlet_sales is installed.
|
|
20
|
-
|
|
20
|
+
# A sale may name its customer (contacts), and with module promotions it takes item promos by itself and a bill promo,
|
|
21
|
+
# voucher code or free gift picked at the counter's checkout (rangka-os contract 0069, rangka-apps#103).
|
|
22
|
+
requires: {rangka: '>=0.5', users: ^1.2, contacts: ^1.4, catalogue: ^1.5, outlets: ^1.5, stock: ^1.2}
|
|
21
23
|
hooks: [stock.reverse_moves]
|
|
22
|
-
optional: {accounting: ^1.2, outlet_sales: ^1.1}
|
|
24
|
+
optional: {accounting: ^1.2, outlet_sales: ^1.1, promotions: ^1.0}
|
|
@@ -25,16 +25,20 @@ body { font-size: 8.5pt; }
|
|
|
25
25
|
<div class="row"><span>Struk</span><span>{{.Doc.name}}</span></div>
|
|
26
26
|
<div class="row"><span>Tanggal</span><span>{{date .Doc.date}}</span></div>
|
|
27
27
|
{{with .Doc.buyer}}<div class="row"><span>Pembeli</span><span>{{.}}</span></div>{{end}}
|
|
28
|
+
{{with .Links.customer}}{{with .customer_name}}<div class="row"><span>Pelanggan</span><span>{{.}}</span></div>{{end}}{{end}}
|
|
28
29
|
<div class="rule"></div>
|
|
29
30
|
{{range $row := .Doc.items}}
|
|
30
31
|
<div class="line">
|
|
31
32
|
<div>{{if $row.description}}{{$row.description}}{{else}}{{$row.item}}{{end}}</div>
|
|
32
|
-
<div class="row sub"><span>{{number $row.qty}} x {{rupiah $row.rate}}{{if $row.discount_pct}} (-{{number $row.discount_pct}}%){{end}}</span><span class="num">{{rupiah $row.amount}}</span></div>
|
|
33
|
+
<div class="row sub"><span>{{number $row.qty}} x {{rupiah $row.rate}}{{if $row.discount_pct}} (-{{number $row.discount_pct}}%){{end}}</span><span class="num">{{if $row.is_gift}}Gratis{{else}}{{rupiah $row.amount}}{{end}}</span></div>
|
|
34
|
+
{{if $row.promo_discount}}<div class="row sub"><span>Promo {{$row.promo_name}}</span><span class="num">-{{rupiah $row.promo_discount}}</span></div>{{end}}
|
|
33
35
|
</div>
|
|
34
36
|
{{end}}
|
|
35
37
|
<div class="rule"></div>
|
|
36
|
-
{{if .Doc.discount_amount}}<div class="row"><span>Subtotal</span><span class="num">{{rupiah .Doc.subtotal}}</span></div>
|
|
37
|
-
<div class="row"><span>
|
|
38
|
+
{{if or .Doc.discount_amount .Doc.bill_promo}}<div class="row"><span>Subtotal</span><span class="num">{{rupiah .Doc.subtotal}}</span></div>{{end}}
|
|
39
|
+
{{if .Doc.bill_promo}}<div class="row"><span>Promo nota {{.Doc.promo_name}}</span><span class="num">-{{rupiah .Doc.bill_promo}}</span></div>{{end}}
|
|
40
|
+
{{if .Doc.discount_amount}}<div class="row"><span>Diskon nota</span><span class="num">-{{rupiah .Doc.discount_amount}}</span></div>{{end}}
|
|
41
|
+
{{if .Doc.promo_total}}<div class="row muted"><span>Hemat dari promo</span><span class="num">{{rupiah .Doc.promo_total}}</span></div>{{end}}
|
|
38
42
|
<div class="row big"><span>Total</span><span class="num">{{rupiah .Doc.grand_total}}</span></div>
|
|
39
43
|
{{if .Doc.ppn_in_sales}}<div class="row muted"><span>Termasuk PPN</span><span class="num">{{rupiah .Doc.ppn_in_sales}}</span></div>{{end}}
|
|
40
44
|
{{range $p := .Doc.payments}}<div class="row"><span>{{if eq (printf "%v" $p.method) "qris"}}QRIS{{with $p.ref}} {{.}}{{end}}{{else}}Tunai{{end}}</span><span class="num">{{rupiah $p.amount}}</span></div>
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
name: kasir
|
|
5
5
|
type: counter
|
|
6
6
|
label: {id: Kasir, en: Cashier}
|
|
7
|
+
description: {id: 'Layani pembeli di sini: pilih barang, terima tunai atau QRIS, lalu cetak struk.'}
|
|
7
8
|
icon: wallet
|
|
8
9
|
roles: [cashier, head_office]
|
|
9
10
|
device: tablet
|
|
@@ -22,10 +23,14 @@ counter:
|
|
|
22
23
|
document:
|
|
23
24
|
model: pos_sale
|
|
24
25
|
lines: items
|
|
25
|
-
|
|
26
|
+
# amount: the model's line amount shows a promo (struck price) or a free gift; flag: the cashier marks the gift line
|
|
27
|
+
line: {item: item, qty: qty, price: rate, note: note, amount: amount, flag: is_gift}
|
|
26
28
|
total: grand_total
|
|
27
29
|
change: change_amount
|
|
28
|
-
summary: [gross_total,
|
|
30
|
+
summary: [gross_total, promo_total, manual_discount_total, promo_shortfall, grand_total]
|
|
31
|
+
# rangka-os contract 0069: filled before paying; the promo picker lists live bill promos only. Fields of module
|
|
32
|
+
# promotions are left out when it is not installed (their depends_on).
|
|
33
|
+
checkout: [customer, {field: promotion, filter: "is_bill && live"}, promo_code]
|
|
29
34
|
set: {date: "today()"}
|
|
30
35
|
payments: {table: payments, method: method, amount: amount, ref: ref, methods: [cash, qris]}
|
|
31
36
|
session:
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
|
|
2
|
+
# Every morning at 06:40 (scheduler.timezone, ten minutes after stock/stock_low_alert), and by the owner from the flow
|
|
3
|
+
# list: the open stock_reorder rows that have a supplier (item.default_vendor) and are not on a draft yet become
|
|
4
|
+
# DRAFT purchase orders, one per supplier and outlet, and the purchasing role is told (notice reorder_draft) with a
|
|
5
|
+
# link to each draft. The flow never submits, approves or sends anything: a person checks quantities and prices and
|
|
6
|
+
# submits the draft, where the site's own approval policy (custom/purchase_order.rk) applies as for any other PO.
|
|
7
|
+
# - quantity: item.reorder_qty, else up to the reorder level (stock_reorder.order_qty, fixed when the row opened);
|
|
8
|
+
# - price: the outlet's average cost of the item when the row opened (0 when it was never received);
|
|
9
|
+
# - one episode gives one draft: the row is ticked `drafted`, so deleting the draft does not make a new one until
|
|
10
|
+
# the stock recovered and fell again. An item without a supplier is only in the stock_low notice.
|
|
11
|
+
# A site without the stock module has no rows: the flow is skipped (if:).
|
|
12
|
+
# At most 500 rows per run.
|
|
13
|
+
name: reorder_draft_po
|
|
14
|
+
label: {id: Draft pesanan pembelian dari stok di bawah batas minimum, en: Draft purchase orders for low stock}
|
|
15
|
+
description: {id: 'Tiap pagi, barang di bawah batas minimum yang punya pemasok utama dimasukkan ke draft pesanan pembelian per pemasok. Draft tidak pernah diajukan otomatis.'}
|
|
16
|
+
schedule: '40 6 * * *'
|
|
17
|
+
if: app_installed('stock')
|
|
18
|
+
steps:
|
|
19
|
+
- find_all: stock_reorder
|
|
20
|
+
where: "open && !drafted && vendor != '' && order_qty > 0"
|
|
21
|
+
sort: item
|
|
22
|
+
limit: 500
|
|
23
|
+
as: need
|
|
24
|
+
- find_all: vendor
|
|
25
|
+
if: size(need) > 0
|
|
26
|
+
as: vendors
|
|
27
|
+
- find_all: outlet
|
|
28
|
+
if: size(need) > 0
|
|
29
|
+
as: outlets
|
|
30
|
+
- for_each: "size(need) > 0 ? vendors.filter(v, need.exists(r, r.vendor == v.name)) : []"
|
|
31
|
+
as: v
|
|
32
|
+
do:
|
|
33
|
+
- for_each: "outlets.filter(o, need.exists(r, r.vendor == v.name && r.outlet == o.name))"
|
|
34
|
+
as: o
|
|
35
|
+
do:
|
|
36
|
+
- create: purchase_order
|
|
37
|
+
set:
|
|
38
|
+
vendor: v.name
|
|
39
|
+
outlet: o.name
|
|
40
|
+
notes: "'Dibuat otomatis dari stok di bawah batas minimum. Periksa jumlah dan harga sebelum diajukan.'"
|
|
41
|
+
items: "need.filter(r, r.vendor == v.name && r.outlet == o.name).map(r, {'item': r.item, 'qty': r.order_qty, 'rate': r.rate})"
|
|
42
|
+
as: po
|
|
43
|
+
- for_each: "need.filter(r, r.vendor == v.name && r.outlet == o.name)"
|
|
44
|
+
as: row
|
|
45
|
+
do:
|
|
46
|
+
- update: row
|
|
47
|
+
set: {drafted: 'true', draft_ref: po.name}
|
|
48
|
+
- notify: purchasing_manager
|
|
49
|
+
notice: reorder_draft
|
|
50
|
+
channel: email
|
|
51
|
+
record: po
|
|
52
|
+
outlet: o.name
|
|
53
|
+
id: "'po:' + po.name"
|
|
54
|
+
title: 'Draft pesanan pembelian untuk {v.vendor_name}'
|
|
55
|
+
template: >-
|
|
56
|
+
{need.filter(r, r.vendor == v.name && r.outlet == o.name).size()} barang di {o.outlet_name} di bawah batas stok minimum.
|
|
57
|
+
Draft {po.name} sudah disiapkan. Periksa jumlah dan harganya, lalu ajukan kalau sudah benar. Draft ini tidak dikirim ke pemasok sebelum kamu ajukan.
|
|
@@ -182,7 +182,9 @@ fields:
|
|
|
182
182
|
type: text
|
|
183
183
|
label: {id: Catatan}
|
|
184
184
|
- {name: currency, type: data, label: {id: Mata uang}, default: "'IDR'"}
|
|
185
|
-
|
|
185
|
+
# IDR per 1 unit of the foreign currency. With PPN on the bill in a PKP org the submit waits for finance (approval
|
|
186
|
+
# fx_rate_check): the rupiah DPP and input PPN (PPN masukan) follow this kurs, which must be the KMK kurs (PP 44/2022 art. 21).
|
|
187
|
+
- {name: exchange_rate, type: float, label: {id: Kurs}, default: '1', help: {id: 'Rupiah per 1 unit valas. PPN masukan memakai kurs Menteri Keuangan (KMK) minggu tanggal faktur; bagian keuangan memeriksanya.'}}
|
|
186
188
|
- {name: subtotal_fx, type: money, currency_field: currency, rate_field: exchange_rate, label: {id: Subtotal (valas)}, compute: "sum(items.map(i, i.amount_fx))"}
|
|
187
189
|
- {name: dpp_fx, type: money, currency_field: currency, rate_field: exchange_rate, label: {id: DPP (valas)}, compute: "subtotal_fx"}
|
|
188
190
|
- {name: ppn_fx, type: money, currency_field: currency, rate_field: exchange_rate, label: {id: PPN (valas)}, compute: "round(dpp_fx * dpp_num / dpp_den * tax_rate / 100, 2)"}
|
|
@@ -255,6 +257,17 @@ rules:
|
|
|
255
257
|
on: save
|
|
256
258
|
check: "items.map(i, i.rate < 0 || i.rate_fx < 0 ? 1 : 0).sum() == 0"
|
|
257
259
|
message: {id: Harga tidak boleh negatif}
|
|
260
|
+
approvals:
|
|
261
|
+
# The kurs of a foreign bill sets its rupiah DPP and the input PPN credited in the SPT (card t_d7bf36b3; audit
|
|
262
|
+
# ppn-base-fx N1, the purchase-side twin of sales_invoice fx_rate_check). A purchasing_manager must still draft the
|
|
263
|
+
# bill with its kurs, so the submit waits for finance instead of a field lock; read from the stored draft, so amend
|
|
264
|
+
# copies and drafts from before the upgrade are covered. Finance and the owner approve their own. A bill without PPN
|
|
265
|
+
# (non-PKP vendor or org) credits no PPN masukan and is left to the site's own spending approvals.
|
|
266
|
+
- name: fx_rate_check
|
|
267
|
+
on: submit
|
|
268
|
+
when: "tax.pkp && tax_rate > 0 && currency != '' && currency != 'IDR'"
|
|
269
|
+
approvers: [finance_manager]
|
|
270
|
+
label: {id: 'Tagihan valas dengan PPN: kurs pajak (KMK) perlu diperiksa keuangan', en: 'Foreign-currency bill with PPN: finance checks the tax rate (KMK)'}
|
|
258
271
|
views:
|
|
259
272
|
list:
|
|
260
273
|
columns: [name, vendor, bill_no, bill_date, due_date, status, amount_due, outstanding]
|
|
@@ -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: procurement
|
|
3
|
-
version: 1.
|
|
3
|
+
version: 1.3.0
|
|
4
4
|
title: {id: Pembelian, en: Procurement}
|
|
5
5
|
summary:
|
|
6
6
|
id: Permintaan dan pesanan pembelian, barang datang dan tagihan pemasok.
|
|
@@ -8,7 +8,16 @@ summary:
|
|
|
8
8
|
category: purchasing
|
|
9
9
|
icon: shopping-bag-line
|
|
10
10
|
requires: {rangka: '>=0.5', users: ^1.0, contacts: ^1.0, catalogue: ^1.0}
|
|
11
|
-
optional: {outlets: ^1.0, currency: ^1.0, stock: ^1.
|
|
11
|
+
optional: {outlets: ^1.0, currency: ^1.0, stock: ^1.4, projects: ^1.0}
|
|
12
12
|
# Semantics fixed in docs/kernel-hooks.md (section procurement). stock.post_moves is a core hook (goods_receipt.on_submit);
|
|
13
13
|
# stock.reverse_moves (goods_receipt.on_cancel) is declared here too, since stock is optional for procurement (a no-op without it).
|
|
14
14
|
hooks: [procurement.make_po, procurement.receive, procurement.post_payable, procurement.reverse_payable, stock.reverse_moves]
|
|
15
|
+
# What this module tells people (contract 0066 §1.1). reorder_draft: flow reorder_draft_po made a draft purchase order
|
|
16
|
+
# for items below their reorder level; only roles that may read purchase orders are told.
|
|
17
|
+
notices:
|
|
18
|
+
- name: reorder_draft
|
|
19
|
+
label: {id: Draft pesanan pembelian stok menipis, en: Draft purchase order for low stock}
|
|
20
|
+
description: {id: 'Draft pesanan pembelian dibuat untuk barang di bawah batas stok minimum. Draft menunggu kamu periksa dan ajukan.'}
|
|
21
|
+
severity: warn
|
|
22
|
+
to: [owner, purchasing_manager, head_office]
|
|
23
|
+
can: {model: purchase_order, action: read}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
name: absen
|
|
3
3
|
type: clock
|
|
4
4
|
label: {id: Absen, en: Clock in}
|
|
5
|
+
description: {id: 'Absen masuk dan pulang di lokasi kerja dari HP, dengan foto; di luar radius, tulis alasannya untuk mandor.'}
|
|
5
6
|
icon: clock
|
|
6
7
|
# A worker clocks in and out at the client's site from their phone (plans/layar-kerja.md §3 #2, contract 0030 §2 clock).
|
|
7
8
|
# The site is today's assignment (the worker cannot read the firm's list of client sites, only their own assignments),
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
|
|
2
|
+
# A submitted batch makes its coupons: count codes of prefix + 8 characters from random_code() (rangka-os contract 0069
|
|
3
|
+
# §3; 31^8 combinations, so a code cannot be guessed from another). A flow has no range, so the batch walks three
|
|
4
|
+
# digits (at most 1000 codes). A code that happened to exist already fails the unique check and the batch rolls back
|
|
5
|
+
# whole; submit it again.
|
|
6
|
+
name: promo_code_batch_on_submit
|
|
7
|
+
label: {id: 'Kiriman kupon diajukan: buat kode kupon'}
|
|
8
|
+
on: promo_code_batch.submitted
|
|
9
|
+
steps:
|
|
10
|
+
- for_each: "[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]"
|
|
11
|
+
as: a
|
|
12
|
+
do:
|
|
13
|
+
- for_each: "[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]"
|
|
14
|
+
as: b
|
|
15
|
+
if: a * 100 < event.count
|
|
16
|
+
do:
|
|
17
|
+
- for_each: "[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]"
|
|
18
|
+
as: c
|
|
19
|
+
if: a * 100 + b * 10 < event.count
|
|
20
|
+
do:
|
|
21
|
+
- create: promo_code
|
|
22
|
+
if: a * 100 + b * 10 + c < event.count
|
|
23
|
+
set:
|
|
24
|
+
promotion: event.promotion
|
|
25
|
+
code: event.prefix + random_code(8)
|
|
26
|
+
batch: event.name
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
|
|
2
|
+
# Generated by scripts/gen_promotion_flows.py (do not edit by hand). Every 5 minutes: promos start and end on their dates, days and hours (happy hour precision 5 minutes).
|
|
3
|
+
name: promotion_apply
|
|
4
|
+
label: {id: 'Promo: perbarui yang sedang berlaku'}
|
|
5
|
+
schedule: '*/5 * * * *'
|
|
6
|
+
steps:
|
|
7
|
+
# 1. live: active, in its dates, days and hours now
|
|
8
|
+
- find_all: promotion
|
|
9
|
+
as: all
|
|
10
|
+
- for_each: all
|
|
11
|
+
as: p
|
|
12
|
+
do:
|
|
13
|
+
- update: p
|
|
14
|
+
if: "p.live != (p.active && p.valid_from <= today() && p.valid_until >= today() && (p.days == '' || p.days.contains(string(days_between('2024-01-01', today()) % 7 + 1))) && (p.time_from == '' || clock() >= p.time_from && clock() < p.time_until))"
|
|
15
|
+
set:
|
|
16
|
+
live: "p.active && p.valid_from <= today() && p.valid_until >= today() && (p.days == '' || p.days.contains(string(days_between('2024-01-01', today()) % 7 + 1))) && (p.time_from == '' || clock() >= p.time_from && clock() < p.time_until)"
|
|
17
|
+
# 2. the live item promos for the counter, all outlets (kg) and one outlet (ko), and for invoices (vs)
|
|
18
|
+
- find_all: promotion
|
|
19
|
+
where: "live && !is_bill && channel != 'invoice' && only_outlet == ''"
|
|
20
|
+
as: kg
|
|
21
|
+
- find_all: promotion
|
|
22
|
+
where: "live && !is_bill && channel != 'invoice' && only_outlet != ''"
|
|
23
|
+
as: ko
|
|
24
|
+
- find_all: promotion
|
|
25
|
+
where: "live && kind == 'item_pct' && channel != 'kasir' && only_outlet == ''"
|
|
26
|
+
as: vs
|
|
27
|
+
# items that carry a promo now (it may have ended) ...
|
|
28
|
+
- find_all: item
|
|
29
|
+
where: "promo != '' || promo_o != '' || promo_invoice_pct != 0"
|
|
30
|
+
as: had
|
|
31
|
+
- for_each: had
|
|
32
|
+
as: it
|
|
33
|
+
do:
|
|
34
|
+
- for_each: "[kg.filter(p, (p.scope == 'item' && p.item == it.name || p.scope == 'category' && p.category != '' && p.category == it.category) && kg.filter(q, (q.scope == 'item' && q.item == it.name || q.scope == 'category' && q.category != '' && q.category == it.category) && (q.priority > p.priority || q.priority == p.priority && q.name < p.name)).size() == 0)]"
|
|
35
|
+
as: w
|
|
36
|
+
do:
|
|
37
|
+
- for_each: "[vs.filter(p, (p.scope == 'item' && p.item == it.name || p.scope == 'category' && p.category != '' && p.category == it.category) && vs.filter(q, (q.scope == 'item' && q.item == it.name || q.scope == 'category' && q.category != '' && q.category == it.category) && (q.priority > p.priority || q.priority == p.priority && q.name < p.name)).size() == 0)]"
|
|
38
|
+
as: v
|
|
39
|
+
do:
|
|
40
|
+
- for_each: "[ko.filter(p, (p.scope == 'item' && p.item == it.name || p.scope == 'category' && p.category != '' && p.category == it.category) && ko.filter(q, (q.scope == 'item' && q.item == it.name || q.scope == 'category' && q.category != '' && q.category == it.category) && (q.priority > p.priority || q.priority == p.priority && q.name < p.name)).size() == 0).filter(x, w.size() == 0 || x.priority >= w[0].priority)]"
|
|
41
|
+
as: o
|
|
42
|
+
do:
|
|
43
|
+
- update: it
|
|
44
|
+
if: "it.promo != (w.size() > 0 ? w[0].name : '') || it.promo_name != (w.size() > 0 ? w[0].promo_name : '') || it.promo_kind != (w.size() == 0 ? '' : (w[0].kind == 'item_pct' ? 'pct' : (w[0].kind == 'item_off' ? 'off' : 'buy_get'))) || it.promo_pct != (w.size() > 0 && w[0].kind == 'item_pct' ? w[0].pct : 0) || it.promo_off != (w.size() > 0 && w[0].kind == 'item_off' ? w[0].amount_off : 0) || it.promo_buy != (w.size() > 0 && w[0].kind == 'buy_get' ? w[0].buy_qty : 0) || it.promo_get != (w.size() > 0 && w[0].kind == 'buy_get' ? w[0].get_qty : 0) || it.promo_until != (w.size() > 0 ? w[0].valid_until : null) || it.promo_invoice_pct != (v.size() > 0 ? v[0].pct : 0) || it.promo_outlet != ('') || it.promo_o != (o.size() > 0 ? o[0].name : '') || it.promo_o_name != (o.size() > 0 ? o[0].promo_name : '') || it.promo_o_kind != (o.size() == 0 ? '' : (o[0].kind == 'item_pct' ? 'pct' : (o[0].kind == 'item_off' ? 'off' : 'buy_get'))) || it.promo_o_pct != (o.size() > 0 && o[0].kind == 'item_pct' ? o[0].pct : 0) || it.promo_o_off != (o.size() > 0 && o[0].kind == 'item_off' ? o[0].amount_off : 0) || it.promo_o_buy != (o.size() > 0 && o[0].kind == 'buy_get' ? o[0].buy_qty : 0) || it.promo_o_get != (o.size() > 0 && o[0].kind == 'buy_get' ? o[0].get_qty : 0) || it.promo_o_outlet != (o.size() > 0 ? o[0].only_outlet : '') || it.promo_o_until != (o.size() > 0 ? o[0].valid_until : null)"
|
|
45
|
+
set:
|
|
46
|
+
promo: "w.size() > 0 ? w[0].name : ''"
|
|
47
|
+
promo_name: "w.size() > 0 ? w[0].promo_name : ''"
|
|
48
|
+
promo_kind: "w.size() == 0 ? '' : (w[0].kind == 'item_pct' ? 'pct' : (w[0].kind == 'item_off' ? 'off' : 'buy_get'))"
|
|
49
|
+
promo_pct: "w.size() > 0 && w[0].kind == 'item_pct' ? w[0].pct : 0"
|
|
50
|
+
promo_off: "w.size() > 0 && w[0].kind == 'item_off' ? w[0].amount_off : 0"
|
|
51
|
+
promo_buy: "w.size() > 0 && w[0].kind == 'buy_get' ? w[0].buy_qty : 0"
|
|
52
|
+
promo_get: "w.size() > 0 && w[0].kind == 'buy_get' ? w[0].get_qty : 0"
|
|
53
|
+
promo_until: "w.size() > 0 ? w[0].valid_until : null"
|
|
54
|
+
promo_invoice_pct: "v.size() > 0 ? v[0].pct : 0"
|
|
55
|
+
promo_outlet: "''"
|
|
56
|
+
promo_o: "o.size() > 0 ? o[0].name : ''"
|
|
57
|
+
promo_o_name: "o.size() > 0 ? o[0].promo_name : ''"
|
|
58
|
+
promo_o_kind: "o.size() == 0 ? '' : (o[0].kind == 'item_pct' ? 'pct' : (o[0].kind == 'item_off' ? 'off' : 'buy_get'))"
|
|
59
|
+
promo_o_pct: "o.size() > 0 && o[0].kind == 'item_pct' ? o[0].pct : 0"
|
|
60
|
+
promo_o_off: "o.size() > 0 && o[0].kind == 'item_off' ? o[0].amount_off : 0"
|
|
61
|
+
promo_o_buy: "o.size() > 0 && o[0].kind == 'buy_get' ? o[0].buy_qty : 0"
|
|
62
|
+
promo_o_get: "o.size() > 0 && o[0].kind == 'buy_get' ? o[0].get_qty : 0"
|
|
63
|
+
promo_o_outlet: "o.size() > 0 ? o[0].only_outlet : ''"
|
|
64
|
+
promo_o_until: "o.size() > 0 ? o[0].valid_until : null"
|
|
65
|
+
# ... and the items each live item promo covers
|
|
66
|
+
- for_each: kg + ko + vs
|
|
67
|
+
as: pr
|
|
68
|
+
do:
|
|
69
|
+
- find_all: item
|
|
70
|
+
if: "pr.scope == 'item'"
|
|
71
|
+
where: name == pr.item
|
|
72
|
+
as: one
|
|
73
|
+
- find_all: item
|
|
74
|
+
if: "pr.scope == 'category'"
|
|
75
|
+
where: category == pr.category
|
|
76
|
+
as: cat
|
|
77
|
+
- for_each: "pr.scope == 'item' ? one : cat"
|
|
78
|
+
as: it
|
|
79
|
+
do:
|
|
80
|
+
- for_each: "[kg.filter(p, (p.scope == 'item' && p.item == it.name || p.scope == 'category' && p.category != '' && p.category == it.category) && kg.filter(q, (q.scope == 'item' && q.item == it.name || q.scope == 'category' && q.category != '' && q.category == it.category) && (q.priority > p.priority || q.priority == p.priority && q.name < p.name)).size() == 0)]"
|
|
81
|
+
as: w
|
|
82
|
+
do:
|
|
83
|
+
- for_each: "[vs.filter(p, (p.scope == 'item' && p.item == it.name || p.scope == 'category' && p.category != '' && p.category == it.category) && vs.filter(q, (q.scope == 'item' && q.item == it.name || q.scope == 'category' && q.category != '' && q.category == it.category) && (q.priority > p.priority || q.priority == p.priority && q.name < p.name)).size() == 0)]"
|
|
84
|
+
as: v
|
|
85
|
+
do:
|
|
86
|
+
- for_each: "[ko.filter(p, (p.scope == 'item' && p.item == it.name || p.scope == 'category' && p.category != '' && p.category == it.category) && ko.filter(q, (q.scope == 'item' && q.item == it.name || q.scope == 'category' && q.category != '' && q.category == it.category) && (q.priority > p.priority || q.priority == p.priority && q.name < p.name)).size() == 0).filter(x, w.size() == 0 || x.priority >= w[0].priority)]"
|
|
87
|
+
as: o
|
|
88
|
+
do:
|
|
89
|
+
- update: it
|
|
90
|
+
if: "it.promo != (w.size() > 0 ? w[0].name : '') || it.promo_name != (w.size() > 0 ? w[0].promo_name : '') || it.promo_kind != (w.size() == 0 ? '' : (w[0].kind == 'item_pct' ? 'pct' : (w[0].kind == 'item_off' ? 'off' : 'buy_get'))) || it.promo_pct != (w.size() > 0 && w[0].kind == 'item_pct' ? w[0].pct : 0) || it.promo_off != (w.size() > 0 && w[0].kind == 'item_off' ? w[0].amount_off : 0) || it.promo_buy != (w.size() > 0 && w[0].kind == 'buy_get' ? w[0].buy_qty : 0) || it.promo_get != (w.size() > 0 && w[0].kind == 'buy_get' ? w[0].get_qty : 0) || it.promo_until != (w.size() > 0 ? w[0].valid_until : null) || it.promo_invoice_pct != (v.size() > 0 ? v[0].pct : 0) || it.promo_outlet != ('') || it.promo_o != (o.size() > 0 ? o[0].name : '') || it.promo_o_name != (o.size() > 0 ? o[0].promo_name : '') || it.promo_o_kind != (o.size() == 0 ? '' : (o[0].kind == 'item_pct' ? 'pct' : (o[0].kind == 'item_off' ? 'off' : 'buy_get'))) || it.promo_o_pct != (o.size() > 0 && o[0].kind == 'item_pct' ? o[0].pct : 0) || it.promo_o_off != (o.size() > 0 && o[0].kind == 'item_off' ? o[0].amount_off : 0) || it.promo_o_buy != (o.size() > 0 && o[0].kind == 'buy_get' ? o[0].buy_qty : 0) || it.promo_o_get != (o.size() > 0 && o[0].kind == 'buy_get' ? o[0].get_qty : 0) || it.promo_o_outlet != (o.size() > 0 ? o[0].only_outlet : '') || it.promo_o_until != (o.size() > 0 ? o[0].valid_until : null)"
|
|
91
|
+
set:
|
|
92
|
+
promo: "w.size() > 0 ? w[0].name : ''"
|
|
93
|
+
promo_name: "w.size() > 0 ? w[0].promo_name : ''"
|
|
94
|
+
promo_kind: "w.size() == 0 ? '' : (w[0].kind == 'item_pct' ? 'pct' : (w[0].kind == 'item_off' ? 'off' : 'buy_get'))"
|
|
95
|
+
promo_pct: "w.size() > 0 && w[0].kind == 'item_pct' ? w[0].pct : 0"
|
|
96
|
+
promo_off: "w.size() > 0 && w[0].kind == 'item_off' ? w[0].amount_off : 0"
|
|
97
|
+
promo_buy: "w.size() > 0 && w[0].kind == 'buy_get' ? w[0].buy_qty : 0"
|
|
98
|
+
promo_get: "w.size() > 0 && w[0].kind == 'buy_get' ? w[0].get_qty : 0"
|
|
99
|
+
promo_until: "w.size() > 0 ? w[0].valid_until : null"
|
|
100
|
+
promo_invoice_pct: "v.size() > 0 ? v[0].pct : 0"
|
|
101
|
+
promo_outlet: "''"
|
|
102
|
+
promo_o: "o.size() > 0 ? o[0].name : ''"
|
|
103
|
+
promo_o_name: "o.size() > 0 ? o[0].promo_name : ''"
|
|
104
|
+
promo_o_kind: "o.size() == 0 ? '' : (o[0].kind == 'item_pct' ? 'pct' : (o[0].kind == 'item_off' ? 'off' : 'buy_get'))"
|
|
105
|
+
promo_o_pct: "o.size() > 0 && o[0].kind == 'item_pct' ? o[0].pct : 0"
|
|
106
|
+
promo_o_off: "o.size() > 0 && o[0].kind == 'item_off' ? o[0].amount_off : 0"
|
|
107
|
+
promo_o_buy: "o.size() > 0 && o[0].kind == 'buy_get' ? o[0].buy_qty : 0"
|
|
108
|
+
promo_o_get: "o.size() > 0 && o[0].kind == 'buy_get' ? o[0].get_qty : 0"
|
|
109
|
+
promo_o_outlet: "o.size() > 0 ? o[0].only_outlet : ''"
|
|
110
|
+
promo_o_until: "o.size() > 0 ? o[0].valid_until : null"
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
|
|
2
|
+
# Generated by scripts/gen_promotion_flows.py (do not edit by hand). A new promo reaches the items at once.
|
|
3
|
+
name: promotion_apply_on_create
|
|
4
|
+
label: {id: 'Promo baru: pasang ke barang'}
|
|
5
|
+
on: promotion.created
|
|
6
|
+
steps:
|
|
7
|
+
# 1. live: active, in its dates, days and hours now
|
|
8
|
+
- find_all: promotion
|
|
9
|
+
as: all
|
|
10
|
+
- for_each: all
|
|
11
|
+
as: p
|
|
12
|
+
do:
|
|
13
|
+
- update: p
|
|
14
|
+
if: "p.live != (p.active && p.valid_from <= today() && p.valid_until >= today() && (p.days == '' || p.days.contains(string(days_between('2024-01-01', today()) % 7 + 1))) && (p.time_from == '' || clock() >= p.time_from && clock() < p.time_until))"
|
|
15
|
+
set:
|
|
16
|
+
live: "p.active && p.valid_from <= today() && p.valid_until >= today() && (p.days == '' || p.days.contains(string(days_between('2024-01-01', today()) % 7 + 1))) && (p.time_from == '' || clock() >= p.time_from && clock() < p.time_until)"
|
|
17
|
+
# 2. the live item promos for the counter, all outlets (kg) and one outlet (ko), and for invoices (vs)
|
|
18
|
+
- find_all: promotion
|
|
19
|
+
where: "live && !is_bill && channel != 'invoice' && only_outlet == ''"
|
|
20
|
+
as: kg
|
|
21
|
+
- find_all: promotion
|
|
22
|
+
where: "live && !is_bill && channel != 'invoice' && only_outlet != ''"
|
|
23
|
+
as: ko
|
|
24
|
+
- find_all: promotion
|
|
25
|
+
where: "live && kind == 'item_pct' && channel != 'kasir' && only_outlet == ''"
|
|
26
|
+
as: vs
|
|
27
|
+
# items that carry a promo now (it may have ended) ...
|
|
28
|
+
- find_all: item
|
|
29
|
+
where: "promo != '' || promo_o != '' || promo_invoice_pct != 0"
|
|
30
|
+
as: had
|
|
31
|
+
- for_each: had
|
|
32
|
+
as: it
|
|
33
|
+
do:
|
|
34
|
+
- for_each: "[kg.filter(p, (p.scope == 'item' && p.item == it.name || p.scope == 'category' && p.category != '' && p.category == it.category) && kg.filter(q, (q.scope == 'item' && q.item == it.name || q.scope == 'category' && q.category != '' && q.category == it.category) && (q.priority > p.priority || q.priority == p.priority && q.name < p.name)).size() == 0)]"
|
|
35
|
+
as: w
|
|
36
|
+
do:
|
|
37
|
+
- for_each: "[vs.filter(p, (p.scope == 'item' && p.item == it.name || p.scope == 'category' && p.category != '' && p.category == it.category) && vs.filter(q, (q.scope == 'item' && q.item == it.name || q.scope == 'category' && q.category != '' && q.category == it.category) && (q.priority > p.priority || q.priority == p.priority && q.name < p.name)).size() == 0)]"
|
|
38
|
+
as: v
|
|
39
|
+
do:
|
|
40
|
+
- for_each: "[ko.filter(p, (p.scope == 'item' && p.item == it.name || p.scope == 'category' && p.category != '' && p.category == it.category) && ko.filter(q, (q.scope == 'item' && q.item == it.name || q.scope == 'category' && q.category != '' && q.category == it.category) && (q.priority > p.priority || q.priority == p.priority && q.name < p.name)).size() == 0).filter(x, w.size() == 0 || x.priority >= w[0].priority)]"
|
|
41
|
+
as: o
|
|
42
|
+
do:
|
|
43
|
+
- update: it
|
|
44
|
+
if: "it.promo != (w.size() > 0 ? w[0].name : '') || it.promo_name != (w.size() > 0 ? w[0].promo_name : '') || it.promo_kind != (w.size() == 0 ? '' : (w[0].kind == 'item_pct' ? 'pct' : (w[0].kind == 'item_off' ? 'off' : 'buy_get'))) || it.promo_pct != (w.size() > 0 && w[0].kind == 'item_pct' ? w[0].pct : 0) || it.promo_off != (w.size() > 0 && w[0].kind == 'item_off' ? w[0].amount_off : 0) || it.promo_buy != (w.size() > 0 && w[0].kind == 'buy_get' ? w[0].buy_qty : 0) || it.promo_get != (w.size() > 0 && w[0].kind == 'buy_get' ? w[0].get_qty : 0) || it.promo_until != (w.size() > 0 ? w[0].valid_until : null) || it.promo_invoice_pct != (v.size() > 0 ? v[0].pct : 0) || it.promo_outlet != ('') || it.promo_o != (o.size() > 0 ? o[0].name : '') || it.promo_o_name != (o.size() > 0 ? o[0].promo_name : '') || it.promo_o_kind != (o.size() == 0 ? '' : (o[0].kind == 'item_pct' ? 'pct' : (o[0].kind == 'item_off' ? 'off' : 'buy_get'))) || it.promo_o_pct != (o.size() > 0 && o[0].kind == 'item_pct' ? o[0].pct : 0) || it.promo_o_off != (o.size() > 0 && o[0].kind == 'item_off' ? o[0].amount_off : 0) || it.promo_o_buy != (o.size() > 0 && o[0].kind == 'buy_get' ? o[0].buy_qty : 0) || it.promo_o_get != (o.size() > 0 && o[0].kind == 'buy_get' ? o[0].get_qty : 0) || it.promo_o_outlet != (o.size() > 0 ? o[0].only_outlet : '') || it.promo_o_until != (o.size() > 0 ? o[0].valid_until : null)"
|
|
45
|
+
set:
|
|
46
|
+
promo: "w.size() > 0 ? w[0].name : ''"
|
|
47
|
+
promo_name: "w.size() > 0 ? w[0].promo_name : ''"
|
|
48
|
+
promo_kind: "w.size() == 0 ? '' : (w[0].kind == 'item_pct' ? 'pct' : (w[0].kind == 'item_off' ? 'off' : 'buy_get'))"
|
|
49
|
+
promo_pct: "w.size() > 0 && w[0].kind == 'item_pct' ? w[0].pct : 0"
|
|
50
|
+
promo_off: "w.size() > 0 && w[0].kind == 'item_off' ? w[0].amount_off : 0"
|
|
51
|
+
promo_buy: "w.size() > 0 && w[0].kind == 'buy_get' ? w[0].buy_qty : 0"
|
|
52
|
+
promo_get: "w.size() > 0 && w[0].kind == 'buy_get' ? w[0].get_qty : 0"
|
|
53
|
+
promo_until: "w.size() > 0 ? w[0].valid_until : null"
|
|
54
|
+
promo_invoice_pct: "v.size() > 0 ? v[0].pct : 0"
|
|
55
|
+
promo_outlet: "''"
|
|
56
|
+
promo_o: "o.size() > 0 ? o[0].name : ''"
|
|
57
|
+
promo_o_name: "o.size() > 0 ? o[0].promo_name : ''"
|
|
58
|
+
promo_o_kind: "o.size() == 0 ? '' : (o[0].kind == 'item_pct' ? 'pct' : (o[0].kind == 'item_off' ? 'off' : 'buy_get'))"
|
|
59
|
+
promo_o_pct: "o.size() > 0 && o[0].kind == 'item_pct' ? o[0].pct : 0"
|
|
60
|
+
promo_o_off: "o.size() > 0 && o[0].kind == 'item_off' ? o[0].amount_off : 0"
|
|
61
|
+
promo_o_buy: "o.size() > 0 && o[0].kind == 'buy_get' ? o[0].buy_qty : 0"
|
|
62
|
+
promo_o_get: "o.size() > 0 && o[0].kind == 'buy_get' ? o[0].get_qty : 0"
|
|
63
|
+
promo_o_outlet: "o.size() > 0 ? o[0].only_outlet : ''"
|
|
64
|
+
promo_o_until: "o.size() > 0 ? o[0].valid_until : null"
|
|
65
|
+
# ... and the items each live item promo covers
|
|
66
|
+
- for_each: kg + ko + vs
|
|
67
|
+
as: pr
|
|
68
|
+
do:
|
|
69
|
+
- find_all: item
|
|
70
|
+
if: "pr.scope == 'item'"
|
|
71
|
+
where: name == pr.item
|
|
72
|
+
as: one
|
|
73
|
+
- find_all: item
|
|
74
|
+
if: "pr.scope == 'category'"
|
|
75
|
+
where: category == pr.category
|
|
76
|
+
as: cat
|
|
77
|
+
- for_each: "pr.scope == 'item' ? one : cat"
|
|
78
|
+
as: it
|
|
79
|
+
do:
|
|
80
|
+
- for_each: "[kg.filter(p, (p.scope == 'item' && p.item == it.name || p.scope == 'category' && p.category != '' && p.category == it.category) && kg.filter(q, (q.scope == 'item' && q.item == it.name || q.scope == 'category' && q.category != '' && q.category == it.category) && (q.priority > p.priority || q.priority == p.priority && q.name < p.name)).size() == 0)]"
|
|
81
|
+
as: w
|
|
82
|
+
do:
|
|
83
|
+
- for_each: "[vs.filter(p, (p.scope == 'item' && p.item == it.name || p.scope == 'category' && p.category != '' && p.category == it.category) && vs.filter(q, (q.scope == 'item' && q.item == it.name || q.scope == 'category' && q.category != '' && q.category == it.category) && (q.priority > p.priority || q.priority == p.priority && q.name < p.name)).size() == 0)]"
|
|
84
|
+
as: v
|
|
85
|
+
do:
|
|
86
|
+
- for_each: "[ko.filter(p, (p.scope == 'item' && p.item == it.name || p.scope == 'category' && p.category != '' && p.category == it.category) && ko.filter(q, (q.scope == 'item' && q.item == it.name || q.scope == 'category' && q.category != '' && q.category == it.category) && (q.priority > p.priority || q.priority == p.priority && q.name < p.name)).size() == 0).filter(x, w.size() == 0 || x.priority >= w[0].priority)]"
|
|
87
|
+
as: o
|
|
88
|
+
do:
|
|
89
|
+
- update: it
|
|
90
|
+
if: "it.promo != (w.size() > 0 ? w[0].name : '') || it.promo_name != (w.size() > 0 ? w[0].promo_name : '') || it.promo_kind != (w.size() == 0 ? '' : (w[0].kind == 'item_pct' ? 'pct' : (w[0].kind == 'item_off' ? 'off' : 'buy_get'))) || it.promo_pct != (w.size() > 0 && w[0].kind == 'item_pct' ? w[0].pct : 0) || it.promo_off != (w.size() > 0 && w[0].kind == 'item_off' ? w[0].amount_off : 0) || it.promo_buy != (w.size() > 0 && w[0].kind == 'buy_get' ? w[0].buy_qty : 0) || it.promo_get != (w.size() > 0 && w[0].kind == 'buy_get' ? w[0].get_qty : 0) || it.promo_until != (w.size() > 0 ? w[0].valid_until : null) || it.promo_invoice_pct != (v.size() > 0 ? v[0].pct : 0) || it.promo_outlet != ('') || it.promo_o != (o.size() > 0 ? o[0].name : '') || it.promo_o_name != (o.size() > 0 ? o[0].promo_name : '') || it.promo_o_kind != (o.size() == 0 ? '' : (o[0].kind == 'item_pct' ? 'pct' : (o[0].kind == 'item_off' ? 'off' : 'buy_get'))) || it.promo_o_pct != (o.size() > 0 && o[0].kind == 'item_pct' ? o[0].pct : 0) || it.promo_o_off != (o.size() > 0 && o[0].kind == 'item_off' ? o[0].amount_off : 0) || it.promo_o_buy != (o.size() > 0 && o[0].kind == 'buy_get' ? o[0].buy_qty : 0) || it.promo_o_get != (o.size() > 0 && o[0].kind == 'buy_get' ? o[0].get_qty : 0) || it.promo_o_outlet != (o.size() > 0 ? o[0].only_outlet : '') || it.promo_o_until != (o.size() > 0 ? o[0].valid_until : null)"
|
|
91
|
+
set:
|
|
92
|
+
promo: "w.size() > 0 ? w[0].name : ''"
|
|
93
|
+
promo_name: "w.size() > 0 ? w[0].promo_name : ''"
|
|
94
|
+
promo_kind: "w.size() == 0 ? '' : (w[0].kind == 'item_pct' ? 'pct' : (w[0].kind == 'item_off' ? 'off' : 'buy_get'))"
|
|
95
|
+
promo_pct: "w.size() > 0 && w[0].kind == 'item_pct' ? w[0].pct : 0"
|
|
96
|
+
promo_off: "w.size() > 0 && w[0].kind == 'item_off' ? w[0].amount_off : 0"
|
|
97
|
+
promo_buy: "w.size() > 0 && w[0].kind == 'buy_get' ? w[0].buy_qty : 0"
|
|
98
|
+
promo_get: "w.size() > 0 && w[0].kind == 'buy_get' ? w[0].get_qty : 0"
|
|
99
|
+
promo_until: "w.size() > 0 ? w[0].valid_until : null"
|
|
100
|
+
promo_invoice_pct: "v.size() > 0 ? v[0].pct : 0"
|
|
101
|
+
promo_outlet: "''"
|
|
102
|
+
promo_o: "o.size() > 0 ? o[0].name : ''"
|
|
103
|
+
promo_o_name: "o.size() > 0 ? o[0].promo_name : ''"
|
|
104
|
+
promo_o_kind: "o.size() == 0 ? '' : (o[0].kind == 'item_pct' ? 'pct' : (o[0].kind == 'item_off' ? 'off' : 'buy_get'))"
|
|
105
|
+
promo_o_pct: "o.size() > 0 && o[0].kind == 'item_pct' ? o[0].pct : 0"
|
|
106
|
+
promo_o_off: "o.size() > 0 && o[0].kind == 'item_off' ? o[0].amount_off : 0"
|
|
107
|
+
promo_o_buy: "o.size() > 0 && o[0].kind == 'buy_get' ? o[0].buy_qty : 0"
|
|
108
|
+
promo_o_get: "o.size() > 0 && o[0].kind == 'buy_get' ? o[0].get_qty : 0"
|
|
109
|
+
promo_o_outlet: "o.size() > 0 ? o[0].only_outlet : ''"
|
|
110
|
+
promo_o_until: "o.size() > 0 ? o[0].valid_until : null"
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
|
|
2
|
+
# Generated by scripts/gen_promotion_flows.py (do not edit by hand). A deleted promo leaves the items at once (it runs in the delete, before the row goes, so it leaves the promo out).
|
|
3
|
+
name: promotion_apply_on_delete
|
|
4
|
+
label: {id: 'Promo dihapus: lepas dari barang'}
|
|
5
|
+
on: promotion.deleted
|
|
6
|
+
steps:
|
|
7
|
+
# 1. live: active, in its dates, days and hours now
|
|
8
|
+
- find_all: promotion
|
|
9
|
+
where: "name != event.name"
|
|
10
|
+
as: all
|
|
11
|
+
- for_each: all
|
|
12
|
+
as: p
|
|
13
|
+
do:
|
|
14
|
+
- update: p
|
|
15
|
+
if: "p.live != (p.active && p.valid_from <= today() && p.valid_until >= today() && (p.days == '' || p.days.contains(string(days_between('2024-01-01', today()) % 7 + 1))) && (p.time_from == '' || clock() >= p.time_from && clock() < p.time_until))"
|
|
16
|
+
set:
|
|
17
|
+
live: "p.active && p.valid_from <= today() && p.valid_until >= today() && (p.days == '' || p.days.contains(string(days_between('2024-01-01', today()) % 7 + 1))) && (p.time_from == '' || clock() >= p.time_from && clock() < p.time_until)"
|
|
18
|
+
# 2. the live item promos for the counter, all outlets (kg) and one outlet (ko), and for invoices (vs)
|
|
19
|
+
- find_all: promotion
|
|
20
|
+
where: "live && !is_bill && channel != 'invoice' && only_outlet == '' && name != event.name"
|
|
21
|
+
as: kg
|
|
22
|
+
- find_all: promotion
|
|
23
|
+
where: "live && !is_bill && channel != 'invoice' && only_outlet != '' && name != event.name"
|
|
24
|
+
as: ko
|
|
25
|
+
- find_all: promotion
|
|
26
|
+
where: "live && kind == 'item_pct' && channel != 'kasir' && only_outlet == '' && name != event.name"
|
|
27
|
+
as: vs
|
|
28
|
+
# items that carry a promo now (it may have ended) ...
|
|
29
|
+
- find_all: item
|
|
30
|
+
where: "promo != '' || promo_o != '' || promo_invoice_pct != 0"
|
|
31
|
+
as: had
|
|
32
|
+
- for_each: had
|
|
33
|
+
as: it
|
|
34
|
+
do:
|
|
35
|
+
- for_each: "[kg.filter(p, (p.scope == 'item' && p.item == it.name || p.scope == 'category' && p.category != '' && p.category == it.category) && kg.filter(q, (q.scope == 'item' && q.item == it.name || q.scope == 'category' && q.category != '' && q.category == it.category) && (q.priority > p.priority || q.priority == p.priority && q.name < p.name)).size() == 0)]"
|
|
36
|
+
as: w
|
|
37
|
+
do:
|
|
38
|
+
- for_each: "[vs.filter(p, (p.scope == 'item' && p.item == it.name || p.scope == 'category' && p.category != '' && p.category == it.category) && vs.filter(q, (q.scope == 'item' && q.item == it.name || q.scope == 'category' && q.category != '' && q.category == it.category) && (q.priority > p.priority || q.priority == p.priority && q.name < p.name)).size() == 0)]"
|
|
39
|
+
as: v
|
|
40
|
+
do:
|
|
41
|
+
- for_each: "[ko.filter(p, (p.scope == 'item' && p.item == it.name || p.scope == 'category' && p.category != '' && p.category == it.category) && ko.filter(q, (q.scope == 'item' && q.item == it.name || q.scope == 'category' && q.category != '' && q.category == it.category) && (q.priority > p.priority || q.priority == p.priority && q.name < p.name)).size() == 0).filter(x, w.size() == 0 || x.priority >= w[0].priority)]"
|
|
42
|
+
as: o
|
|
43
|
+
do:
|
|
44
|
+
- update: it
|
|
45
|
+
if: "it.promo != (w.size() > 0 ? w[0].name : '') || it.promo_name != (w.size() > 0 ? w[0].promo_name : '') || it.promo_kind != (w.size() == 0 ? '' : (w[0].kind == 'item_pct' ? 'pct' : (w[0].kind == 'item_off' ? 'off' : 'buy_get'))) || it.promo_pct != (w.size() > 0 && w[0].kind == 'item_pct' ? w[0].pct : 0) || it.promo_off != (w.size() > 0 && w[0].kind == 'item_off' ? w[0].amount_off : 0) || it.promo_buy != (w.size() > 0 && w[0].kind == 'buy_get' ? w[0].buy_qty : 0) || it.promo_get != (w.size() > 0 && w[0].kind == 'buy_get' ? w[0].get_qty : 0) || it.promo_until != (w.size() > 0 ? w[0].valid_until : null) || it.promo_invoice_pct != (v.size() > 0 ? v[0].pct : 0) || it.promo_outlet != ('') || it.promo_o != (o.size() > 0 ? o[0].name : '') || it.promo_o_name != (o.size() > 0 ? o[0].promo_name : '') || it.promo_o_kind != (o.size() == 0 ? '' : (o[0].kind == 'item_pct' ? 'pct' : (o[0].kind == 'item_off' ? 'off' : 'buy_get'))) || it.promo_o_pct != (o.size() > 0 && o[0].kind == 'item_pct' ? o[0].pct : 0) || it.promo_o_off != (o.size() > 0 && o[0].kind == 'item_off' ? o[0].amount_off : 0) || it.promo_o_buy != (o.size() > 0 && o[0].kind == 'buy_get' ? o[0].buy_qty : 0) || it.promo_o_get != (o.size() > 0 && o[0].kind == 'buy_get' ? o[0].get_qty : 0) || it.promo_o_outlet != (o.size() > 0 ? o[0].only_outlet : '') || it.promo_o_until != (o.size() > 0 ? o[0].valid_until : null)"
|
|
46
|
+
set:
|
|
47
|
+
promo: "w.size() > 0 ? w[0].name : ''"
|
|
48
|
+
promo_name: "w.size() > 0 ? w[0].promo_name : ''"
|
|
49
|
+
promo_kind: "w.size() == 0 ? '' : (w[0].kind == 'item_pct' ? 'pct' : (w[0].kind == 'item_off' ? 'off' : 'buy_get'))"
|
|
50
|
+
promo_pct: "w.size() > 0 && w[0].kind == 'item_pct' ? w[0].pct : 0"
|
|
51
|
+
promo_off: "w.size() > 0 && w[0].kind == 'item_off' ? w[0].amount_off : 0"
|
|
52
|
+
promo_buy: "w.size() > 0 && w[0].kind == 'buy_get' ? w[0].buy_qty : 0"
|
|
53
|
+
promo_get: "w.size() > 0 && w[0].kind == 'buy_get' ? w[0].get_qty : 0"
|
|
54
|
+
promo_until: "w.size() > 0 ? w[0].valid_until : null"
|
|
55
|
+
promo_invoice_pct: "v.size() > 0 ? v[0].pct : 0"
|
|
56
|
+
promo_outlet: "''"
|
|
57
|
+
promo_o: "o.size() > 0 ? o[0].name : ''"
|
|
58
|
+
promo_o_name: "o.size() > 0 ? o[0].promo_name : ''"
|
|
59
|
+
promo_o_kind: "o.size() == 0 ? '' : (o[0].kind == 'item_pct' ? 'pct' : (o[0].kind == 'item_off' ? 'off' : 'buy_get'))"
|
|
60
|
+
promo_o_pct: "o.size() > 0 && o[0].kind == 'item_pct' ? o[0].pct : 0"
|
|
61
|
+
promo_o_off: "o.size() > 0 && o[0].kind == 'item_off' ? o[0].amount_off : 0"
|
|
62
|
+
promo_o_buy: "o.size() > 0 && o[0].kind == 'buy_get' ? o[0].buy_qty : 0"
|
|
63
|
+
promo_o_get: "o.size() > 0 && o[0].kind == 'buy_get' ? o[0].get_qty : 0"
|
|
64
|
+
promo_o_outlet: "o.size() > 0 ? o[0].only_outlet : ''"
|
|
65
|
+
promo_o_until: "o.size() > 0 ? o[0].valid_until : null"
|
|
66
|
+
# ... and the items each live item promo covers
|
|
67
|
+
- for_each: kg + ko + vs
|
|
68
|
+
as: pr
|
|
69
|
+
do:
|
|
70
|
+
- find_all: item
|
|
71
|
+
if: "pr.scope == 'item'"
|
|
72
|
+
where: name == pr.item
|
|
73
|
+
as: one
|
|
74
|
+
- find_all: item
|
|
75
|
+
if: "pr.scope == 'category'"
|
|
76
|
+
where: category == pr.category
|
|
77
|
+
as: cat
|
|
78
|
+
- for_each: "pr.scope == 'item' ? one : cat"
|
|
79
|
+
as: it
|
|
80
|
+
do:
|
|
81
|
+
- for_each: "[kg.filter(p, (p.scope == 'item' && p.item == it.name || p.scope == 'category' && p.category != '' && p.category == it.category) && kg.filter(q, (q.scope == 'item' && q.item == it.name || q.scope == 'category' && q.category != '' && q.category == it.category) && (q.priority > p.priority || q.priority == p.priority && q.name < p.name)).size() == 0)]"
|
|
82
|
+
as: w
|
|
83
|
+
do:
|
|
84
|
+
- for_each: "[vs.filter(p, (p.scope == 'item' && p.item == it.name || p.scope == 'category' && p.category != '' && p.category == it.category) && vs.filter(q, (q.scope == 'item' && q.item == it.name || q.scope == 'category' && q.category != '' && q.category == it.category) && (q.priority > p.priority || q.priority == p.priority && q.name < p.name)).size() == 0)]"
|
|
85
|
+
as: v
|
|
86
|
+
do:
|
|
87
|
+
- for_each: "[ko.filter(p, (p.scope == 'item' && p.item == it.name || p.scope == 'category' && p.category != '' && p.category == it.category) && ko.filter(q, (q.scope == 'item' && q.item == it.name || q.scope == 'category' && q.category != '' && q.category == it.category) && (q.priority > p.priority || q.priority == p.priority && q.name < p.name)).size() == 0).filter(x, w.size() == 0 || x.priority >= w[0].priority)]"
|
|
88
|
+
as: o
|
|
89
|
+
do:
|
|
90
|
+
- update: it
|
|
91
|
+
if: "it.promo != (w.size() > 0 ? w[0].name : '') || it.promo_name != (w.size() > 0 ? w[0].promo_name : '') || it.promo_kind != (w.size() == 0 ? '' : (w[0].kind == 'item_pct' ? 'pct' : (w[0].kind == 'item_off' ? 'off' : 'buy_get'))) || it.promo_pct != (w.size() > 0 && w[0].kind == 'item_pct' ? w[0].pct : 0) || it.promo_off != (w.size() > 0 && w[0].kind == 'item_off' ? w[0].amount_off : 0) || it.promo_buy != (w.size() > 0 && w[0].kind == 'buy_get' ? w[0].buy_qty : 0) || it.promo_get != (w.size() > 0 && w[0].kind == 'buy_get' ? w[0].get_qty : 0) || it.promo_until != (w.size() > 0 ? w[0].valid_until : null) || it.promo_invoice_pct != (v.size() > 0 ? v[0].pct : 0) || it.promo_outlet != ('') || it.promo_o != (o.size() > 0 ? o[0].name : '') || it.promo_o_name != (o.size() > 0 ? o[0].promo_name : '') || it.promo_o_kind != (o.size() == 0 ? '' : (o[0].kind == 'item_pct' ? 'pct' : (o[0].kind == 'item_off' ? 'off' : 'buy_get'))) || it.promo_o_pct != (o.size() > 0 && o[0].kind == 'item_pct' ? o[0].pct : 0) || it.promo_o_off != (o.size() > 0 && o[0].kind == 'item_off' ? o[0].amount_off : 0) || it.promo_o_buy != (o.size() > 0 && o[0].kind == 'buy_get' ? o[0].buy_qty : 0) || it.promo_o_get != (o.size() > 0 && o[0].kind == 'buy_get' ? o[0].get_qty : 0) || it.promo_o_outlet != (o.size() > 0 ? o[0].only_outlet : '') || it.promo_o_until != (o.size() > 0 ? o[0].valid_until : null)"
|
|
92
|
+
set:
|
|
93
|
+
promo: "w.size() > 0 ? w[0].name : ''"
|
|
94
|
+
promo_name: "w.size() > 0 ? w[0].promo_name : ''"
|
|
95
|
+
promo_kind: "w.size() == 0 ? '' : (w[0].kind == 'item_pct' ? 'pct' : (w[0].kind == 'item_off' ? 'off' : 'buy_get'))"
|
|
96
|
+
promo_pct: "w.size() > 0 && w[0].kind == 'item_pct' ? w[0].pct : 0"
|
|
97
|
+
promo_off: "w.size() > 0 && w[0].kind == 'item_off' ? w[0].amount_off : 0"
|
|
98
|
+
promo_buy: "w.size() > 0 && w[0].kind == 'buy_get' ? w[0].buy_qty : 0"
|
|
99
|
+
promo_get: "w.size() > 0 && w[0].kind == 'buy_get' ? w[0].get_qty : 0"
|
|
100
|
+
promo_until: "w.size() > 0 ? w[0].valid_until : null"
|
|
101
|
+
promo_invoice_pct: "v.size() > 0 ? v[0].pct : 0"
|
|
102
|
+
promo_outlet: "''"
|
|
103
|
+
promo_o: "o.size() > 0 ? o[0].name : ''"
|
|
104
|
+
promo_o_name: "o.size() > 0 ? o[0].promo_name : ''"
|
|
105
|
+
promo_o_kind: "o.size() == 0 ? '' : (o[0].kind == 'item_pct' ? 'pct' : (o[0].kind == 'item_off' ? 'off' : 'buy_get'))"
|
|
106
|
+
promo_o_pct: "o.size() > 0 && o[0].kind == 'item_pct' ? o[0].pct : 0"
|
|
107
|
+
promo_o_off: "o.size() > 0 && o[0].kind == 'item_off' ? o[0].amount_off : 0"
|
|
108
|
+
promo_o_buy: "o.size() > 0 && o[0].kind == 'buy_get' ? o[0].buy_qty : 0"
|
|
109
|
+
promo_o_get: "o.size() > 0 && o[0].kind == 'buy_get' ? o[0].get_qty : 0"
|
|
110
|
+
promo_o_outlet: "o.size() > 0 ? o[0].only_outlet : ''"
|
|
111
|
+
promo_o_until: "o.size() > 0 ? o[0].valid_until : null"
|