@rangka-os/create 0.0.0-stage → 0.5.0-alpha.11
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 +137 -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 +44 -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/crm/processes/lead_to_cash.rk +8 -0
- package/template/base/apps/dapur/app.rk +35 -0
- package/template/base/apps/dapur/dashboards/dapur_hari_ini.rk +26 -0
- package/template/base/apps/faktur_piutang/app.rk +31 -0
- package/template/base/apps/faktur_piutang/dashboards/piutang_ringkas.rk +88 -0
- package/template/base/apps/fnb_cabang/app.rk +46 -0
- package/template/base/apps/fnb_cabang/dashboards/fnb_overview.rk +104 -0
- package/template/base/apps/fnb_cabang/dashboards/outlet_harian.rk +36 -0
- package/template/base/apps/fnb_cabang/dashboards/stock_recap.rk +132 -0
- package/template/base/apps/grosir_distribusi/app.rk +56 -0
- package/template/base/apps/grosir_distribusi/dashboards/grosir_ar.rk +62 -0
- package/template/base/apps/grosir_distribusi/dashboards/grosir_overview.rk +87 -0
- package/template/base/apps/jasa_proyek/app.rk +64 -0
- package/template/base/apps/jasa_proyek/dashboards/absen_saya.rk +15 -0
- package/template/base/apps/jasa_proyek/dashboards/ar_aging.rk +88 -0
- package/template/base/apps/jasa_proyek/dashboards/jasa_overview.rk +148 -0
- package/template/base/apps/jasa_proyek/dashboards/project_margin.rk +94 -0
- package/template/base/apps/jasa_proyek/dashboards/rekap_absen.rk +18 -0
- package/template/base/apps/jasa_proyek/processes/quote_to_cash.rk +10 -0
- package/template/base/apps/kasir/app.rk +38 -0
- package/template/base/apps/kasir/dashboards/kasir_ringkas.rk +20 -0
- package/template/base/apps/kasir/skills/rangka-app-kasir/SKILL.md +64 -0
- package/template/base/apps/kelas_kursus/app.rk +29 -0
- package/template/base/apps/kelas_kursus/dashboards/kelas_saya.rk +41 -0
- package/template/base/apps/kelas_kursus/dashboards/kursus_ringkas.rk +67 -0
- package/template/base/apps/langganan_jasa/app.rk +32 -0
- package/template/base/apps/langganan_jasa/dashboards/langganan_ringkas.rk +167 -0
- package/template/base/apps/langganan_jasa/dashboards/penagihan_saya.rk +54 -0
- package/template/base/apps/mutasi_bank/app.rk +22 -0
- package/template/base/apps/pajak/app.rk +25 -0
- package/template/base/apps/pembelian_pemasok/app.rk +23 -0
- package/template/base/apps/pembukuan/app.rk +19 -0
- package/template/base/apps/penjualan_harian/app.rk +34 -0
- package/template/base/apps/penjualan_harian/dashboards/penjualan_ringkas.rk +87 -0
- package/template/base/apps/produksi_pabrik/app.rk +54 -0
- package/template/base/apps/produksi_pabrik/dashboards/produksi_overview.rk +101 -0
- package/template/base/apps/produksi_pabrik/dashboards/produksi_upah.rk +39 -0
- package/template/base/apps/ritel_cabang/app.rk +58 -0
- package/template/base/apps/ritel_cabang/dashboards/ritel_overview.rk +137 -0
- package/template/base/apps/ritel_cabang/dashboards/ritel_stock.rk +147 -0
- package/template/base/apps/ritel_cabang/dashboards/ritel_tax.rk +76 -0
- package/template/base/apps/sewa_alat/app.rk +31 -0
- package/template/base/apps/sewa_alat/dashboards/alat_hari_ini.rk +90 -0
- package/template/base/apps/sewa_alat/dashboards/sewa_ringkas.rk +86 -0
- package/template/base/apps/stok_outlet/app.rk +34 -0
- package/template/base/apps/stok_outlet/dashboards/outlet_hari_ini.rk +33 -0
- package/template/base/apps/stok_outlet/dashboards/stok_ringkas.rk +50 -0
- package/template/base/connectors/biteship/connector.rk +246 -0
- package/template/base/connectors/biteship/fixtures/cancel_order.json +1 -0
- package/template/base/connectors/biteship/fixtures/create_order.json +8 -0
- package/template/base/connectors/biteship/fixtures/expect.json +9 -0
- package/template/base/connectors/biteship/fixtures/get_order.json +2 -0
- package/template/base/connectors/biteship/fixtures/get_rates.json +7 -0
- package/template/base/connectors/biteship/fixtures/get_tracking.json +7 -0
- package/template/base/connectors/biteship/fixtures/order_price.json +11 -0
- package/template/base/connectors/biteship/fixtures/order_status.json +15 -0
- package/template/base/connectors/biteship/fixtures/order_status_cancelled.json +15 -0
- package/template/base/connectors/biteship/fixtures/order_waybill.json +7 -0
- package/template/base/connectors/biteship/fixtures/search_areas.json +1 -0
- package/template/base/connectors/doku/connector.rk +128 -0
- package/template/base/connectors/doku/fixtures/create_checkout.json +6 -0
- package/template/base/connectors/doku/fixtures/expect.json +38 -0
- package/template/base/connectors/doku/fixtures/payment_notified.json +5 -0
- package/template/base/connectors/doku/fixtures/payment_notified_failed.json +3 -0
- package/template/base/connectors/doku/fixtures/payment_notified_no_type.json +3 -0
- package/template/base/connectors/doku/fixtures/payment_notified_null_type.json +3 -0
- package/template/base/connectors/doku/fixtures/payment_notified_refund.json +3 -0
- package/template/base/connectors/doku/mock/doku_mock.py +206 -0
- package/template/base/connectors/loyverse/connector.rk +98 -0
- package/template/base/connectors/moka/connector.rk +120 -0
- package/template/base/connectors/moka/fixtures/expect.json +44 -0
- package/template/base/connectors/moka/fixtures/latest_transactions.json +79 -0
- package/template/base/connectors/moka/fixtures/list_items.json +4 -0
- package/template/base/connectors/moka/fixtures/list_outlets.json +4 -0
- package/template/base/connectors/moka/fixtures/transaction_created.json +44 -0
- package/template/base/connectors/moka/fixtures/transaction_created_refund.json +39 -0
- package/template/base/connectors/moka/fixtures/transaction_created_refund_later.json +51 -0
- package/template/base/connectors/whatsapp_business/connector.rk +89 -0
- package/template/base/connectors/whatsapp_business/templates.md +32 -0
- package/template/base/connectors/xendit/connector.rk +184 -0
- package/template/base/docker-compose.yml +16 -0
- package/template/base/env.example +12 -0
- package/template/base/modules/accounting/flows/financial_report_compute.rk +47 -0
- package/template/base/modules/accounting/flows/financial_report_recompute.rk +47 -0
- package/template/base/modules/accounting/flows/gl_delivery_note_post.rk +37 -0
- package/template/base/modules/accounting/flows/gl_delivery_note_reverse.rk +194 -0
- package/template/base/modules/accounting/flows/gl_goods_receipt_post.rk +41 -0
- package/template/base/modules/accounting/flows/gl_goods_receipt_reverse.rk +194 -0
- package/template/base/modules/accounting/flows/gl_opening_balance_post.rk +132 -0
- package/template/base/modules/accounting/flows/gl_opening_balance_reverse.rk +194 -0
- package/template/base/modules/accounting/flows/gl_outlet_return_post.rk +38 -0
- package/template/base/modules/accounting/flows/gl_outlet_return_reverse.rk +194 -0
- package/template/base/modules/accounting/flows/gl_outlet_sales_post.rk +95 -0
- package/template/base/modules/accounting/flows/gl_outlet_sales_reverse.rk +194 -0
- package/template/base/modules/accounting/flows/gl_outlet_takings_post.rk +71 -0
- package/template/base/modules/accounting/flows/gl_outlet_takings_reverse.rk +194 -0
- package/template/base/modules/accounting/flows/gl_payment_post.rk +63 -0
- package/template/base/modules/accounting/flows/gl_payment_reverse.rk +194 -0
- package/template/base/modules/accounting/flows/gl_payroll_close_post.rk +89 -0
- package/template/base/modules/accounting/flows/gl_payroll_close_reverse.rk +194 -0
- package/template/base/modules/accounting/flows/gl_pos_sale_post.rk +95 -0
- package/template/base/modules/accounting/flows/gl_pos_sale_reverse.rk +194 -0
- package/template/base/modules/accounting/flows/gl_pos_shift_close_post.rk +59 -0
- package/template/base/modules/accounting/flows/gl_pos_shift_close_reverse.rk +194 -0
- package/template/base/modules/accounting/flows/gl_production_batch_post.rk +62 -0
- package/template/base/modules/accounting/flows/gl_production_batch_reverse.rk +194 -0
- package/template/base/modules/accounting/flows/gl_project_expense_post.rk +64 -0
- package/template/base/modules/accounting/flows/gl_project_expense_reverse.rk +194 -0
- package/template/base/modules/accounting/flows/gl_rental_booking_post.rk +35 -0
- package/template/base/modules/accounting/flows/gl_rental_booking_reverse.rk +194 -0
- package/template/base/modules/accounting/flows/gl_rental_return_post.rk +47 -0
- package/template/base/modules/accounting/flows/gl_rental_return_reverse.rk +194 -0
- package/template/base/modules/accounting/flows/gl_sales_invoice_post.rk +95 -0
- package/template/base/modules/accounting/flows/gl_sales_invoice_reverse.rk +194 -0
- package/template/base/modules/accounting/flows/gl_sales_return_post.rk +40 -0
- package/template/base/modules/accounting/flows/gl_sales_return_reverse.rk +194 -0
- package/template/base/modules/accounting/flows/gl_stock_adjustment_post.rk +38 -0
- package/template/base/modules/accounting/flows/gl_stock_adjustment_reverse.rk +194 -0
- package/template/base/modules/accounting/flows/gl_stock_count_post.rk +38 -0
- package/template/base/modules/accounting/flows/gl_stock_count_reverse.rk +194 -0
- package/template/base/modules/accounting/flows/gl_stock_transfer_post.rk +38 -0
- package/template/base/modules/accounting/flows/gl_stock_transfer_receipt_post.rk +38 -0
- package/template/base/modules/accounting/flows/gl_stock_transfer_receipt_reverse.rk +194 -0
- package/template/base/modules/accounting/flows/gl_stock_transfer_reverse.rk +194 -0
- package/template/base/modules/accounting/flows/gl_timesheet_post.rk +35 -0
- package/template/base/modules/accounting/flows/gl_timesheet_reverse.rk +194 -0
- package/template/base/modules/accounting/flows/gl_vendor_bill_post.rk +63 -0
- package/template/base/modules/accounting/flows/gl_vendor_bill_reverse.rk +194 -0
- package/template/base/modules/accounting/imports/opening_balance_sheet.rk +22 -0
- package/template/base/modules/accounting/models/financial_report.rk +85 -0
- package/template/base/modules/accounting/models/gl_entry.rk +161 -0
- package/template/base/modules/accounting/models/opening_balance.rk +48 -0
- package/template/base/modules/accounting/models/period_close.rk +33 -0
- package/template/base/modules/accounting/module.rk +16 -0
- package/template/base/modules/bank_statement/flows/bank_transaction_claim.rk +19 -0
- package/template/base/modules/bank_statement/flows/bank_transaction_confirm.rk +43 -0
- package/template/base/modules/bank_statement/flows/bank_transaction_link_locked.rk +11 -0
- package/template/base/modules/bank_statement/flows/bank_transaction_matched.rk +13 -0
- package/template/base/modules/bank_statement/flows/bank_transaction_release.rk +11 -0
- package/template/base/modules/bank_statement/flows/bank_transaction_suggest.rk +31 -0
- package/template/base/modules/bank_statement/flows/bank_transaction_unmatched.rk +11 -0
- package/template/base/modules/bank_statement/imports/bank_statement_csv.rk +25 -0
- package/template/base/modules/bank_statement/models/bank_transaction.rk +124 -0
- package/template/base/modules/bank_statement/models/bank_transaction_claim.rk +49 -0
- package/template/base/modules/bank_statement/module.rk +12 -0
- package/template/base/modules/catalogue/imports/item_list.rk +20 -0
- package/template/base/modules/catalogue/imports/item_master.rk +25 -0
- package/template/base/modules/catalogue/models/item.rk +129 -0
- package/template/base/modules/catalogue/models/item_category.rk +27 -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 +34 -0
- package/template/base/modules/catalogue/models/uom_conversion.rk +44 -0
- package/template/base/modules/catalogue/module.rk +11 -0
- package/template/base/modules/consignment/flows/consignment_bill.rk +39 -0
- package/template/base/modules/consignment/flows/consignment_bill_cancelled.rk +14 -0
- package/template/base/modules/consignment/models/consignment_settlement.rk +111 -0
- package/template/base/modules/consignment/models/consignment_settlement_item.rk +37 -0
- package/template/base/modules/consignment/module.rk +15 -0
- package/template/base/modules/contacts/imports/customer_list.rk +17 -0
- package/template/base/modules/contacts/imports/vendor_list.rk +16 -0
- package/template/base/modules/contacts/models/contact_person.rk +21 -0
- package/template/base/modules/contacts/models/credit_guard.rk +40 -0
- package/template/base/modules/contacts/models/customer.rk +180 -0
- package/template/base/modules/contacts/models/vendor.rk +104 -0
- package/template/base/modules/contacts/module.rk +10 -0
- package/template/base/modules/coretax/models/tax_period.rk +89 -0
- package/template/base/modules/coretax/module.rk +13 -0
- package/template/base/modules/coretax/print/coretax_bupot.rk +26 -0
- package/template/base/modules/coretax/print/coretax_bupot.xml +28 -0
- package/template/base/modules/coretax/print/coretax_faktur.rk +34 -0
- package/template/base/modules/coretax/print/coretax_faktur.xml +58 -0
- package/template/base/modules/courses/flows/charge_cancel_guard.rk +23 -0
- package/template/base/modules/courses/flows/charge_invoice_on_submit.rk +56 -0
- package/template/base/modules/courses/flows/enrollment_seats_on_create.rk +15 -0
- package/template/base/modules/courses/flows/enrollment_seats_on_update.rk +35 -0
- package/template/base/modules/courses/flows/invoice_course_once.rk +22 -0
- package/template/base/modules/courses/flows/invoice_course_tag_lock.rk +16 -0
- package/template/base/modules/courses/flows/session_fill_attendance.rk +16 -0
- package/template/base/modules/courses/flows/student_billing_on_create.rk +25 -0
- package/template/base/modules/courses/models/course_attendance.rk +22 -0
- package/template/base/modules/courses/models/course_batch.rk +119 -0
- package/template/base/modules/courses/models/course_batch_slot.rk +18 -0
- package/template/base/modules/courses/models/course_charge.rk +125 -0
- package/template/base/modules/courses/models/course_guard.rk +50 -0
- package/template/base/modules/courses/models/course_program.rk +101 -0
- package/template/base/modules/courses/models/course_session.rk +93 -0
- package/template/base/modules/courses/models/enrollment.rk +136 -0
- package/template/base/modules/courses/models/student.rk +68 -0
- package/template/base/modules/courses/module.rk +14 -0
- package/template/base/modules/courses/roles/instructor.rk +7 -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 +10 -0
- package/template/base/modules/delivery/flows/delivery_cancel_guard.rk +18 -0
- package/template/base/modules/delivery/flows/fulfilment_on_delivery_cancelled.rk +21 -0
- package/template/base/modules/delivery/flows/fulfilment_on_delivery_submitted.rk +28 -0
- package/template/base/modules/delivery/flows/fulfilment_on_invoice_cancelled.rk +22 -0
- package/template/base/modules/delivery/flows/fulfilment_on_invoice_submitted.rk +22 -0
- package/template/base/modules/delivery/flows/fulfilment_on_order_created.rk +18 -0
- package/template/base/modules/delivery/flows/fulfilment_on_order_submitted.rk +16 -0
- package/template/base/modules/delivery/flows/fulfilment_on_order_updated.rk +19 -0
- package/template/base/modules/delivery/flows/fulfilment_on_return_cancelled.rk +16 -0
- package/template/base/modules/delivery/flows/fulfilment_on_return_submitted.rk +16 -0
- package/template/base/modules/delivery/flows/invoice_qty_from_deliveries.rk +20 -0
- package/template/base/modules/delivery/flows/order_cancel_guard.rk +10 -0
- package/template/base/modules/delivery/flows/return_cancel_guard.rk +11 -0
- package/template/base/modules/delivery/flows/return_credit_on_payment_cancelled.rk +11 -0
- package/template/base/modules/delivery/flows/return_credit_on_payment_submitted.rk +21 -0
- package/template/base/modules/delivery/flows/return_credit_on_return_cancelled.rk +11 -0
- package/template/base/modules/delivery/flows/return_credit_on_return_submitted.rk +10 -0
- package/template/base/modules/delivery/models/delivery_guard.rk +48 -0
- package/template/base/modules/delivery/models/delivery_note.rk +101 -0
- package/template/base/modules/delivery/models/delivery_note_item.rk +11 -0
- package/template/base/modules/delivery/models/order_fulfilment.rk +27 -0
- package/template/base/modules/delivery/models/order_fulfilment_item.rk +10 -0
- package/template/base/modules/delivery/models/return_credit.rk +23 -0
- package/template/base/modules/delivery/models/sales_return.rk +87 -0
- package/template/base/modules/delivery/models/sales_return_item.rk +16 -0
- package/template/base/modules/delivery/module.rk +16 -0
- package/template/base/modules/delivery/print/delivery_note.html +96 -0
- package/template/base/modules/delivery/print/delivery_note.rk +9 -0
- package/template/base/modules/distribution/flows/credit_on_invoice_cancelled.rk +17 -0
- package/template/base/modules/distribution/flows/credit_on_invoice_submitted.rk +17 -0
- package/template/base/modules/distribution/flows/credit_on_order_cancelled.rk +17 -0
- package/template/base/modules/distribution/flows/credit_on_order_submitted.rk +25 -0
- package/template/base/modules/distribution/flows/credit_on_payment_cancelled.rk +17 -0
- package/template/base/modules/distribution/flows/credit_on_payment_submitted.rk +17 -0
- package/template/base/modules/distribution/flows/giro_bounced.rk +20 -0
- package/template/base/modules/distribution/flows/giro_from_payment.rk +21 -0
- package/template/base/modules/distribution/flows/order_tier_pricing_created.rk +17 -0
- package/template/base/modules/distribution/flows/order_tier_pricing_updated.rk +17 -0
- package/template/base/modules/distribution/models/giro.rk +79 -0
- package/template/base/modules/distribution/module.rk +14 -0
- package/template/base/modules/invoicing/flows/invoice_due_digest.rk +12 -0
- package/template/base/modules/invoicing/flows/milestone_invoiced.rk +23 -0
- package/template/base/modules/invoicing/flows/milestone_reopened.rk +19 -0
- package/template/base/modules/invoicing/flows/payment_instruction_on_submit.rk +25 -0
- package/template/base/modules/invoicing/flows/project_billed_on_cancel.rk +16 -0
- package/template/base/modules/invoicing/flows/project_billed_on_submit.rk +16 -0
- package/template/base/modules/invoicing/flows/project_revenue_on_cancel.rk +22 -0
- package/template/base/modules/invoicing/flows/project_revenue_on_submit.rk +17 -0
- package/template/base/modules/invoicing/flows/sales_invoice_credit_recheck.rk +18 -0
- package/template/base/modules/invoicing/models/bank_account.rk +134 -0
- package/template/base/modules/invoicing/models/invoice_reminder.rk +83 -0
- package/template/base/modules/invoicing/models/payment_instruction.rk +72 -0
- package/template/base/modules/invoicing/models/sales_invoice.rk +480 -0
- package/template/base/modules/invoicing/models/sales_invoice_item.rk +53 -0
- package/template/base/modules/invoicing/module.rk +14 -0
- package/template/base/modules/invoicing/print/sales_invoice.html +163 -0
- package/template/base/modules/invoicing/print/sales_invoice.rk +14 -0
- package/template/base/modules/invoicing/print/sales_invoice_nota.html +71 -0
- package/template/base/modules/invoicing/print/sales_invoice_nota.rk +13 -0
- package/template/base/modules/invoicing/print/sales_invoice_whatsapp.html +45 -0
- package/template/base/modules/invoicing/print/sales_invoice_whatsapp.rk +15 -0
- package/template/base/modules/kitchen/flows/kitchen_ticket_on_sale.rk +29 -0
- package/template/base/modules/kitchen/flows/kitchen_ticket_on_update.rk +26 -0
- package/template/base/modules/kitchen/flows/kitchen_ticket_on_void.rk +15 -0
- package/template/base/modules/kitchen/models/kitchen_guard.rk +35 -0
- package/template/base/modules/kitchen/models/kitchen_route.rk +26 -0
- package/template/base/modules/kitchen/models/kitchen_station.rk +40 -0
- package/template/base/modules/kitchen/models/kitchen_ticket.rk +78 -0
- package/template/base/modules/kitchen/models/kitchen_ticket_item.rk +10 -0
- package/template/base/modules/kitchen/module.rk +18 -0
- package/template/base/modules/kitchen/print/kitchen_ticket.html +29 -0
- package/template/base/modules/kitchen/print/kitchen_ticket.rk +9 -0
- package/template/base/modules/kitchen/roles/kitchen.rk +6 -0
- package/template/base/modules/kitchen/screens/dapur.rk +22 -0
- package/template/base/modules/orders/models/customer_order.rk +186 -0
- package/template/base/modules/orders/models/customer_order_item.rk +49 -0
- package/template/base/modules/orders/module.rk +14 -0
- package/template/base/modules/outlet_sales/flows/moka_daily_sales.rk +57 -0
- package/template/base/modules/outlet_sales/flows/moka_legacy_key_overlap.rk +22 -0
- package/template/base/modules/outlet_sales/flows/moka_line_mapped.rk +14 -0
- package/template/base/modules/outlet_sales/flows/moka_transaction_staged.rk +90 -0
- package/template/base/modules/outlet_sales/flows/refund_on_return_cancelled.rk +15 -0
- package/template/base/modules/outlet_sales/flows/refund_on_return_submitted.rk +26 -0
- package/template/base/modules/outlet_sales/flows/refund_on_sales_submitted.rk +14 -0
- package/template/base/modules/outlet_sales/flows/sales_cancel_guard.rk +14 -0
- package/template/base/modules/outlet_sales/imports/daily_form.rk +22 -0
- package/template/base/modules/outlet_sales/imports/loyverse_receipts.rk +28 -0
- package/template/base/modules/outlet_sales/imports/moka_item_details.rk +34 -0
- package/template/base/modules/outlet_sales/imports/pos_sales_file.rk +28 -0
- package/template/base/modules/outlet_sales/imports/takings_file.rk +23 -0
- package/template/base/modules/outlet_sales/models/moka_sale_line.rk +53 -0
- package/template/base/modules/outlet_sales/models/moka_transaction.rk +26 -0
- package/template/base/modules/outlet_sales/models/outlet_return.rk +66 -0
- package/template/base/modules/outlet_sales/models/outlet_return_item.rk +7 -0
- package/template/base/modules/outlet_sales/models/outlet_sales.rk +176 -0
- package/template/base/modules/outlet_sales/models/outlet_sales_guard.rk +35 -0
- package/template/base/modules/outlet_sales/models/outlet_sales_line.rk +40 -0
- package/template/base/modules/outlet_sales/models/outlet_takings.rk +85 -0
- package/template/base/modules/outlet_sales/models/outlet_takings_line.rk +37 -0
- package/template/base/modules/outlet_sales/models/pos_refund.rk +33 -0
- package/template/base/modules/outlet_sales/models/pos_refund_item.rk +9 -0
- package/template/base/modules/outlet_sales/module.rk +12 -0
- package/template/base/modules/outlets/models/outlet.rk +84 -0
- package/template/base/modules/outlets/module.rk +10 -0
- package/template/base/modules/payments/flows/payment_from_doku.rk +73 -0
- package/template/base/modules/payments/flows/payment_from_xendit_invoice.rk +59 -0
- package/template/base/modules/payments/flows/payment_from_xendit_qr.rk +59 -0
- package/template/base/modules/payments/flows/payment_from_xendit_va.rk +59 -0
- package/template/base/modules/payments/flows/payment_gateway_claim_created.rk +19 -0
- package/template/base/modules/payments/flows/payment_gateway_claim_submitted.rk +19 -0
- package/template/base/modules/payments/flows/payment_gateway_release.rk +12 -0
- package/template/base/modules/payments/models/gateway_ref_claim.rk +42 -0
- package/template/base/modules/payments/models/payment.rk +215 -0
- package/template/base/modules/payments/models/payment_allocation.rk +35 -0
- package/template/base/modules/payments/models/withholding.rk +76 -0
- package/template/base/modules/payments/module.rk +13 -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/payroll/flows/invoice_payroll_once.rk +20 -0
- package/template/base/modules/payroll/flows/invoice_payroll_tag_lock.rk +13 -0
- package/template/base/modules/payroll/flows/payroll_close_on_cancel.rk +35 -0
- package/template/base/modules/payroll/flows/payroll_close_on_submit.rk +66 -0
- package/template/base/modules/payroll/flows/payroll_run_overlap_guard_created.rk +14 -0
- package/template/base/modules/payroll/flows/payroll_run_overlap_guard_updated.rk +14 -0
- package/template/base/modules/payroll/flows/payroll_totals_on_payslip_cancel.rk +29 -0
- package/template/base/modules/payroll/flows/payroll_totals_on_payslip_submit.rk +29 -0
- package/template/base/modules/payroll/flows/payslip_cancel_guard.rk +14 -0
- package/template/base/modules/payroll/flows/payslip_from_recap.rk +47 -0
- package/template/base/modules/payroll/flows/payslip_month_guard_created.rk +16 -0
- package/template/base/modules/payroll/flows/payslip_month_guard_submitted.rk +16 -0
- package/template/base/modules/payroll/flows/payslip_order_guard_cancelled.rk +15 -0
- package/template/base/modules/payroll/flows/payslip_order_guard_submitted.rk +15 -0
- package/template/base/modules/payroll/flows/payslip_pay_overlap_guard.rk +15 -0
- package/template/base/modules/payroll/flows/payslip_ytd_guard.rk +16 -0
- package/template/base/modules/payroll/flows/payslip_ytd_on_create.rk +20 -0
- package/template/base/modules/payroll/flows/recap_cancel_guard.rk +15 -0
- package/template/base/modules/payroll/models/payroll_close.rk +80 -0
- package/template/base/modules/payroll/models/payroll_guard.rk +74 -0
- package/template/base/modules/payroll/models/payroll_profile.rk +136 -0
- package/template/base/modules/payroll/models/payroll_run.rk +220 -0
- package/template/base/modules/payroll/models/payslip.rk +293 -0
- package/template/base/modules/payroll/module.rk +13 -0
- package/template/base/modules/payroll/print/payslip.html +53 -0
- package/template/base/modules/payroll/print/payslip.rk +7 -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 +12 -0
- package/template/base/modules/pos/flows/pos_daily_form_guard.rk +18 -0
- package/template/base/modules/pos/flows/pos_sale_on_cancel.rk +33 -0
- package/template/base/modules/pos/flows/pos_sale_on_submit.rk +46 -0
- package/template/base/modules/pos/flows/pos_shift_close_on_cancel.rk +26 -0
- package/template/base/modules/pos/flows/pos_shift_close_on_submit.rk +23 -0
- package/template/base/modules/pos/flows/pos_shift_on_create.rk +21 -0
- package/template/base/modules/pos/flows/pos_shift_on_update.rk +10 -0
- package/template/base/modules/pos/flows/pos_takings_guard.rk +28 -0
- package/template/base/modules/pos/models/pos_guard.rk +76 -0
- package/template/base/modules/pos/models/pos_payment.rk +17 -0
- package/template/base/modules/pos/models/pos_sale.rk +222 -0
- package/template/base/modules/pos/models/pos_sale_item.rk +43 -0
- package/template/base/modules/pos/models/pos_shift.rk +92 -0
- package/template/base/modules/pos/models/pos_shift_close.rk +77 -0
- package/template/base/modules/pos/module.rk +22 -0
- package/template/base/modules/pos/print/pos_receipt.html +50 -0
- package/template/base/modules/pos/print/pos_receipt.rk +9 -0
- package/template/base/modules/pos/screens/kasir.rk +41 -0
- package/template/base/modules/procurement/flows/project_vendor_cost_on_cancel.rk +22 -0
- package/template/base/modules/procurement/flows/project_vendor_cost_on_submit.rk +17 -0
- package/template/base/modules/procurement/imports/opening_stock.rk +25 -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 +156 -0
- package/template/base/modules/procurement/models/purchase_order_item.rk +46 -0
- package/template/base/modules/procurement/models/purchase_request.rk +91 -0
- package/template/base/modules/procurement/models/purchase_request_item.rk +35 -0
- package/template/base/modules/procurement/models/vendor_bill.rk +272 -0
- package/template/base/modules/procurement/models/vendor_bill_item.rk +33 -0
- package/template/base/modules/procurement/module.rk +14 -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/production/flows/batch_cancel_guard.rk +12 -0
- package/template/base/modules/production/flows/batch_from_bom.rk +19 -0
- package/template/base/modules/production/flows/wage_sheet_on_batch_cancelled.rk +14 -0
- package/template/base/modules/production/flows/wage_sheet_on_batch_submitted.rk +12 -0
- package/template/base/modules/production/flows/work_order_materials_created.rk +20 -0
- package/template/base/modules/production/flows/work_order_materials_updated.rk +20 -0
- package/template/base/modules/production/models/bom.rk +67 -0
- package/template/base/modules/production/models/bom_byproduct.rk +7 -0
- package/template/base/modules/production/models/bom_line.rk +11 -0
- package/template/base/modules/production/models/production_batch.rk +149 -0
- package/template/base/modules/production/models/production_guard.rk +23 -0
- package/template/base/modules/production/models/production_labour.rk +10 -0
- package/template/base/modules/production/models/production_material.rk +8 -0
- package/template/base/modules/production/models/production_output.rk +8 -0
- package/template/base/modules/production/models/production_stage.rk +19 -0
- package/template/base/modules/production/models/wage_line.rk +15 -0
- package/template/base/modules/production/models/wage_sheet.rk +28 -0
- package/template/base/modules/production/models/work_order.rk +63 -0
- package/template/base/modules/production/models/work_order_material.rk +8 -0
- package/template/base/modules/production/module.rk +17 -0
- package/template/base/modules/production/print/wage_sheet.html +75 -0
- package/template/base/modules/production/print/wage_sheet.rk +9 -0
- package/template/base/modules/projects/flows/attendance_close_cancel_guard.rk +15 -0
- package/template/base/modules/projects/flows/attendance_close_on_submit.rk +64 -0
- package/template/base/modules/projects/flows/attendance_log_cancel_guard.rk +14 -0
- package/template/base/modules/projects/flows/attendance_log_guard_created.rk +15 -0
- package/template/base/modules/projects/flows/attendance_log_guard_submitted.rk +34 -0
- package/template/base/modules/projects/flows/attendance_log_guard_updated.rk +14 -0
- package/template/base/modules/projects/flows/milestone_back_on_acceptance_cancel.rk +15 -0
- package/template/base/modules/projects/flows/milestone_lock_on_update.rk +16 -0
- package/template/base/modules/projects/flows/milestone_ready_on_acceptance.rk +40 -0
- package/template/base/modules/projects/flows/milestone_scheduled_on_create.rk +14 -0
- package/template/base/modules/projects/flows/milestone_scheduled_on_update.rk +27 -0
- package/template/base/modules/projects/flows/project_expense_on_cancel.rk +21 -0
- package/template/base/modules/projects/flows/project_expense_on_submit.rk +16 -0
- package/template/base/modules/projects/flows/project_labor_on_cancel.rk +22 -0
- package/template/base/modules/projects/flows/project_labor_on_submit.rk +17 -0
- package/template/base/modules/projects/flows/project_terms_lock.rk +26 -0
- package/template/base/modules/projects/flows/timesheet_assignment_on_create.rk +28 -0
- package/template/base/modules/projects/flows/timesheet_attendance_overlap_guard.rk +20 -0
- package/template/base/modules/projects/flows/vendor_bill_cancel_guard.rk +15 -0
- package/template/base/modules/projects/imports/attendance_recap.rk +23 -0
- package/template/base/modules/projects/imports/billing_milestone.rk +20 -0
- package/template/base/modules/projects/models/acceptance.rk +68 -0
- package/template/base/modules/projects/models/assignment.rk +116 -0
- package/template/base/modules/projects/models/attendance_close.rk +63 -0
- package/template/base/modules/projects/models/attendance_guard.rk +57 -0
- package/template/base/modules/projects/models/attendance_log.rk +266 -0
- package/template/base/modules/projects/models/billing_milestone.rk +217 -0
- package/template/base/modules/projects/models/project.rk +155 -0
- package/template/base/modules/projects/models/project_expense.rk +121 -0
- package/template/base/modules/projects/models/project_guard.rk +27 -0
- package/template/base/modules/projects/models/project_ledger.rk +146 -0
- package/template/base/modules/projects/models/timesheet.rk +167 -0
- package/template/base/modules/projects/models/work_site.rk +73 -0
- package/template/base/modules/projects/module.rk +11 -0
- package/template/base/modules/projects/roles/field_worker.rk +7 -0
- package/template/base/modules/projects/roles/site_supervisor.rk +7 -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 +14 -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/rental/flows/rental_booking_on_cancel.rk +19 -0
- package/template/base/modules/rental/flows/rental_booking_on_submit.rk +45 -0
- package/template/base/modules/rental/flows/rental_checkout_on_cancel.rk +24 -0
- package/template/base/modules/rental/flows/rental_checkout_on_submit.rk +33 -0
- package/template/base/modules/rental/flows/rental_invoice_once.rk +20 -0
- package/template/base/modules/rental/flows/rental_invoice_tag_lock.rk +12 -0
- package/template/base/modules/rental/flows/rental_return_on_cancel.rk +26 -0
- package/template/base/modules/rental/flows/rental_return_on_submit.rk +45 -0
- package/template/base/modules/rental/models/rental_booking.rk +124 -0
- package/template/base/modules/rental/models/rental_checkout.rk +96 -0
- package/template/base/modules/rental/models/rental_checkout_unit.rk +22 -0
- package/template/base/modules/rental/models/rental_guard.rk +93 -0
- package/template/base/modules/rental/models/rental_item.rk +83 -0
- package/template/base/modules/rental/models/rental_return.rk +142 -0
- package/template/base/modules/rental/models/rental_return_unit.rk +29 -0
- package/template/base/modules/rental/models/rental_schedule.rk +51 -0
- package/template/base/modules/rental/models/rental_unit.rk +73 -0
- package/template/base/modules/rental/module.rk +25 -0
- package/template/base/modules/rental/print/rental_bast_in.html +107 -0
- package/template/base/modules/rental/print/rental_bast_in.rk +9 -0
- package/template/base/modules/rental/print/rental_bast_out.html +98 -0
- package/template/base/modules/rental/print/rental_bast_out.rk +11 -0
- package/template/base/modules/rental/roles/rental_staff.rk +7 -0
- package/template/base/modules/stock/flows/adjustment_value_backfill.rk +95 -0
- package/template/base/modules/stock/flows/adjustment_value_on_cancel.rk +19 -0
- package/template/base/modules/stock/flows/adjustment_value_on_submit.rk +17 -0
- package/template/base/modules/stock/flows/stock_negative_alert.rk +15 -0
- package/template/base/modules/stock/models/recipe.rk +68 -0
- package/template/base/modules/stock/models/recipe_line.rk +24 -0
- package/template/base/modules/stock/models/stock_adjustment.rk +62 -0
- package/template/base/modules/stock/models/stock_adjustment_item.rk +32 -0
- package/template/base/modules/stock/models/stock_adjustment_value.rk +79 -0
- package/template/base/modules/stock/models/stock_balance.rk +27 -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 +53 -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 +13 -0
- package/template/base/modules/subscriptions/flows/collector_deposit_on_submit.rk +57 -0
- package/template/base/modules/subscriptions/flows/deposit_payment_kept.rk +17 -0
- package/template/base/modules/subscriptions/flows/deposit_payment_not_cancelled.rk +14 -0
- package/template/base/modules/subscriptions/flows/deposit_payment_not_deleted.rk +14 -0
- package/template/base/modules/subscriptions/flows/field_collection_cap_created.rk +24 -0
- package/template/base/modules/subscriptions/flows/field_collection_cap_updated.rk +24 -0
- package/template/base/modules/subscriptions/flows/field_collection_locked.rk +12 -0
- package/template/base/modules/subscriptions/flows/field_collection_not_deleted.rk +10 -0
- package/template/base/modules/subscriptions/flows/invoice_subscription_kept.rk +19 -0
- package/template/base/modules/subscriptions/flows/invoice_subscription_once.rk +34 -0
- package/template/base/modules/subscriptions/flows/invoice_subscription_tag_lock.rk +13 -0
- package/template/base/modules/subscriptions/flows/service_area_collector.rk +14 -0
- package/template/base/modules/subscriptions/flows/subscription_billing.rk +79 -0
- package/template/base/modules/subscriptions/flows/subscription_dunning.rk +81 -0
- package/template/base/modules/subscriptions/flows/subscription_extra_locked.rk +14 -0
- package/template/base/modules/subscriptions/flows/subscription_status_on_payment.rk +48 -0
- package/template/base/modules/subscriptions/models/collector_deposit.rk +36 -0
- package/template/base/modules/subscriptions/models/field_collection.rk +42 -0
- package/template/base/modules/subscriptions/models/service_area.rk +19 -0
- package/template/base/modules/subscriptions/models/subscription.rk +233 -0
- package/template/base/modules/subscriptions/models/subscription_bill.rk +48 -0
- package/template/base/modules/subscriptions/models/subscription_extra.rk +50 -0
- package/template/base/modules/subscriptions/models/subscription_guard.rk +65 -0
- package/template/base/modules/subscriptions/models/subscription_month.rk +29 -0
- package/template/base/modules/subscriptions/models/subscription_plan.rk +75 -0
- package/template/base/modules/subscriptions/models/subscription_status_log.rk +27 -0
- package/template/base/modules/subscriptions/module.rk +18 -0
- package/template/base/modules/subscriptions/roles/collector.rk +7 -0
- package/template/base/modules/tax_id/models/tax_code.rk +49 -0
- package/template/base/modules/tax_id/module.rk +10 -0
- package/template/base/modules/users/models/user.rk +29 -0
- package/template/base/modules/users/module.rk +10 -0
- package/template/base/modules/users/roles/cashier.rk +8 -0
- package/template/base/modules/users/roles/course_admin.rk +4 -0
- package/template/base/modules/users/roles/field_sales.rk +7 -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/imports/worker_list.rk +21 -0
- package/template/base/modules/workforce/models/certification.rk +25 -0
- package/template/base/modules/workforce/models/worker.rk +94 -0
- package/template/base/modules/workforce/module.rk +10 -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,19 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
|
|
2
|
+
name: invoice_subscription_kept
|
|
3
|
+
label: {id: Faktur terakhir tagihan langganan tidak dihapus}
|
|
4
|
+
# A bill's period is billed once (period_key): deleting its only live invoice would leave the period billed and never
|
|
5
|
+
# invoiced. A second draft of the same bill, or a draft whose tag names no bill, may be deleted.
|
|
6
|
+
on: sales_invoice.deleted
|
|
7
|
+
if: event.notes.contains('{langganan:')
|
|
8
|
+
steps:
|
|
9
|
+
- find_all: subscription_bill
|
|
10
|
+
where: event.notes.contains('[' + name + ']')
|
|
11
|
+
as: tags
|
|
12
|
+
- find: sales_invoice
|
|
13
|
+
where: size(tags) == 1 && docstatus != 2 && notes.contains('[' + tags[0].name + ']')
|
|
14
|
+
as: other
|
|
15
|
+
- if: size(tags) == 1 && other == null
|
|
16
|
+
create: subscription_guard
|
|
17
|
+
set:
|
|
18
|
+
reason: "'invoice_kept'"
|
|
19
|
+
document: event.name
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
|
|
2
|
+
name: invoice_subscription_once
|
|
3
|
+
label: {id: Satu faktur per tagihan langganan}
|
|
4
|
+
# An invoice that names a subscription bill ([<bill>] in its notes) is submitted only when it names exactly one bill,
|
|
5
|
+
# carries that bill's {langganan:<subscription>}, goes to the bill's customer for exactly its total before PPN (dpp),
|
|
6
|
+
# and no other submitted invoice carries the bill. An invoice with a {langganan:...} tag but no bill is refused too. So
|
|
7
|
+
# a period is never invoiced twice and an invoice is never moved to another client or amount. Then the subscription's
|
|
8
|
+
# unpaid amount is refreshed (what a collector sees).
|
|
9
|
+
on: sales_invoice.submitted
|
|
10
|
+
steps:
|
|
11
|
+
- find_all: subscription_bill
|
|
12
|
+
where: event.notes.contains('[' + name + ']')
|
|
13
|
+
as: tags
|
|
14
|
+
- find: sales_invoice
|
|
15
|
+
where: size(tags) == 1 && name != event.name && docstatus == 1 && notes.contains('[' + tags[0].name + ']')
|
|
16
|
+
as: twin
|
|
17
|
+
- if: >-
|
|
18
|
+
size(tags) > 1 || (size(tags) == 0 && event.notes.contains('{langganan:'))
|
|
19
|
+
|| (size(tags) == 1 && (twin != null || tags[0].customer != event.customer || tags[0].total != event.dpp
|
|
20
|
+
|| !event.notes.contains('{langganan:' + tags[0].subscription + '}')))
|
|
21
|
+
create: subscription_guard
|
|
22
|
+
set:
|
|
23
|
+
reason: "'invoice_twice'"
|
|
24
|
+
document: event.name
|
|
25
|
+
- find: subscription
|
|
26
|
+
where: size(tags) == 1 && name == tags[0].subscription
|
|
27
|
+
as: s
|
|
28
|
+
- find_all: sales_invoice
|
|
29
|
+
where: s != null && docstatus == 1 && outstanding > 0 && notes.contains('{langganan:' + s.name + '}')
|
|
30
|
+
as: open
|
|
31
|
+
- update: s
|
|
32
|
+
if: s != null
|
|
33
|
+
set:
|
|
34
|
+
unpaid_amount: open.map(i, i.outstanding).sum()
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
|
|
2
|
+
name: invoice_subscription_tag_lock
|
|
3
|
+
label: {id: Catatan faktur langganan dikunci}
|
|
4
|
+
# The invoice of a subscription bill is found by the tags in its notes. Nobody adds, removes or edits notes that carry
|
|
5
|
+
# one by hand (a flow's writes start no flows, so the billing flow is not refused).
|
|
6
|
+
on: sales_invoice.updated
|
|
7
|
+
if: event.before != null && event.notes != event.before.notes
|
|
8
|
+
steps:
|
|
9
|
+
- if: event.before.notes.contains('{langganan:') || event.notes.contains('{langganan:')
|
|
10
|
+
create: subscription_guard
|
|
11
|
+
set:
|
|
12
|
+
reason: "'invoice_tag'"
|
|
13
|
+
document: event.name
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
|
|
2
|
+
name: service_area_collector
|
|
3
|
+
label: {id: Penagih area pindah ke langganannya}
|
|
4
|
+
# A subscription's collector is its area's (a computed field, saved with the subscription). When an area gets another
|
|
5
|
+
# collector, every subscription of the area is saved again so the new collector sees it (row scope).
|
|
6
|
+
on: service_area.updated
|
|
7
|
+
if: event.before != null && event.collector != event.before.collector
|
|
8
|
+
steps:
|
|
9
|
+
- {find_all: subscription, where: area == event.name, as: subs}
|
|
10
|
+
- for_each: subs
|
|
11
|
+
as: s
|
|
12
|
+
do:
|
|
13
|
+
- update: s
|
|
14
|
+
set: {area: s.area}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
|
|
2
|
+
name: subscription_billing
|
|
3
|
+
label: {id: Tagihan langganan otomatis}
|
|
4
|
+
# Every day at 00:05 (scheduler.timezone of system.rk), and by the owner from the flow list: each subscription whose
|
|
5
|
+
# next bill date has come (before its end date; a period the end date cuts is billed up to the day before it,
|
|
6
|
+
# pro-rated) gets its next period billed. One run bills one period per
|
|
7
|
+
# subscription (the oldest unbilled); a subscription behind by several periods catches up one period per run. Per
|
|
8
|
+
# subscription, in the run's one transaction (contract 0031 for_each):
|
|
9
|
+
# 1. the active extras overlapping the period (one-off ones not billed before); an extra every period is pro-rated on
|
|
10
|
+
# a bill shorter than a full cycle (pro-rated start, a period an end date cuts, the rest of a cut period) by the same
|
|
11
|
+
# share as the plan line (next_amount over a full cycle at the price of that period: last_cycle_value for the rest of
|
|
12
|
+
# a cut period), so the pieces of one period add up to one extra;
|
|
13
|
+
# 2. a subscription_bill (period_key unique: the same period is never billed twice);
|
|
14
|
+
# 3. a draft sales invoice dated the period's first day, due due_days after it, one line for the plan and one per extra,
|
|
15
|
+
# notes with {langganan:<subscription>} and [<bill>] (a flow cannot submit: finance checks and submits it, then
|
|
16
|
+
# payment, reminders, aging, PPN and bank matching are the money rail's);
|
|
17
|
+
# 4. the extras taken are marked, the subscription moves on (prorata_billed or billed_months) and its start date and
|
|
18
|
+
# anchor and customer are locked; billed_through is the day after the period billed. A period an end date cut short
|
|
19
|
+
# whose end date was then taken away (the client stays) is billed for the rest of it first, pro-rated against the
|
|
20
|
+
# full period (kind remainder), before the next full period.
|
|
21
|
+
# At most 500 subscriptions per run (the oldest bill dates first); the next run takes the rest.
|
|
22
|
+
schedule: '5 0 * * *'
|
|
23
|
+
steps:
|
|
24
|
+
- find_all: subscription
|
|
25
|
+
where: "next_bill_date != '' && next_bill_date <= today() && (end_date == '' || next_bill_date < end_date)"
|
|
26
|
+
sort: next_bill_date
|
|
27
|
+
limit: 500
|
|
28
|
+
as: due
|
|
29
|
+
- for_each: due
|
|
30
|
+
as: s
|
|
31
|
+
do:
|
|
32
|
+
- find_all: subscription_extra
|
|
33
|
+
where: >-
|
|
34
|
+
subscription == s.name && active && from_date <= s.next_period_end
|
|
35
|
+
&& (until_date == '' || until_date >= s.next_bill_date) && (repeat == 'every_period' || billed_bill == '')
|
|
36
|
+
sort: name
|
|
37
|
+
as: extras
|
|
38
|
+
- create: subscription_bill
|
|
39
|
+
set:
|
|
40
|
+
subscription: s.name
|
|
41
|
+
customer: s.customer
|
|
42
|
+
kind: "s.next_is_prorata ? 'prorata' : (s.resume ? 'remainder' : 'regular')"
|
|
43
|
+
period_start: s.next_bill_date
|
|
44
|
+
period_end: s.next_period_end
|
|
45
|
+
months: "s.next_is_prorata || s.resume ? 0 : s.cycle_months"
|
|
46
|
+
base_amount: s.next_amount
|
|
47
|
+
extras_total: "extras.map(x, (x.repeat == 'once' ? x.amount : round(x.amount * s.next_amount / (s.resume ? s.last_cycle_value : s.monthly_net * s.cycle_months)))).sum()"
|
|
48
|
+
due_date: s.next_bill_date + duration(s.due_days)
|
|
49
|
+
as: bill
|
|
50
|
+
- create: sales_invoice
|
|
51
|
+
set:
|
|
52
|
+
customer: s.customer
|
|
53
|
+
posting_date: s.next_bill_date
|
|
54
|
+
due_date: bill.due_date
|
|
55
|
+
notes: "'Langganan ' + s.plan_name + ' periode ' + bill.period_start + ' s.d. ' + bill.period_end + ' {langganan:' + s.name + '} [' + bill.name + ']'"
|
|
56
|
+
items: >-
|
|
57
|
+
[{'item': s.item, 'description': s.plan_name + ' ' + bill.period_start + ' s.d. ' + bill.period_end
|
|
58
|
+
+ (s.next_is_prorata ? ' (prorata)' : ''), 'qty': 1, 'rate': bill.base_amount}]
|
|
59
|
+
+ extras.map(x, {'item': x.item, 'description': x.description, 'qty': 1, 'rate': (x.repeat == 'once' ? x.amount : round(x.amount * s.next_amount / (s.resume ? s.last_cycle_value : s.monthly_net * s.cycle_months)))})
|
|
60
|
+
as: inv
|
|
61
|
+
- for_each: extras
|
|
62
|
+
as: x
|
|
63
|
+
do:
|
|
64
|
+
- update: x
|
|
65
|
+
set:
|
|
66
|
+
last_bill: bill.name
|
|
67
|
+
billed_bill: "x.repeat == 'once' ? bill.name : x.billed_bill"
|
|
68
|
+
- update: s
|
|
69
|
+
set:
|
|
70
|
+
prorata_billed: "s.next_is_prorata ? true : s.prorata_billed"
|
|
71
|
+
billed_months: "s.next_is_prorata || s.resume ? s.billed_months : s.billed_months + s.cycle_months"
|
|
72
|
+
last_period_start: "s.resume ? s.last_period_start : s.next_bill_date"
|
|
73
|
+
last_full_amount: "s.resume ? s.last_full_amount : s.cycle_amount"
|
|
74
|
+
last_cycle_value: "s.resume ? s.last_cycle_value : s.monthly_net * s.cycle_months"
|
|
75
|
+
last_bill: bill.name
|
|
76
|
+
locked_start: s.start_date
|
|
77
|
+
locked_anchor: s.anchor
|
|
78
|
+
locked_customer: s.customer
|
|
79
|
+
billed_through: s.next_period_end + duration(1)
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
|
|
2
|
+
name: subscription_dunning
|
|
3
|
+
label: {id: Status layanan dan rekap langganan}
|
|
4
|
+
# Every day at 02:00 (open-isp practice), and by the owner from the flow list. The dunning ladder, per subscription that
|
|
5
|
+
# is not finally stopped (a stopped one that still owes, or has a deposit waiting, is refreshed too: its arrears are
|
|
6
|
+
# still collected), from its submitted invoices still unpaid (found once for the run, oldest due date first):
|
|
7
|
+
# - stopped: its end date has come; or stop_after_days > 0 and the oldest unpaid invoice is that many days past due,
|
|
8
|
+
# which sets the end date (today, or billed_through when that is later);
|
|
9
|
+
# - suspended: the oldest unpaid invoice is suspend_after_days or more past due (isolir; the owner is told);
|
|
10
|
+
# - late: past due, less than that; active: nothing past due (paying lifts a suspension, also at once through flow
|
|
11
|
+
# subscription_status_on_payment).
|
|
12
|
+
# The flow writes the facts (unpaid_amount, overdue_amount, oldest_due, checked_on; prev_status keeps the status before)
|
|
13
|
+
# and the subscription computes its status from them; a change of status writes a subscription_status_log row. Reminders are not sent from here: the dashboard lists the invoices due in 3 days and those past due, and
|
|
14
|
+
# each invoice has the print *Pesan tagihan WA* (the WhatsApp connector sends them later).
|
|
15
|
+
# Then the month recap (subscription_month) of this month and the month before: submitted subscription invoices dated
|
|
16
|
+
# in the month, what of them is paid, and (this month) the running subscriptions and MRR.
|
|
17
|
+
schedule: '0 2 * * *'
|
|
18
|
+
steps:
|
|
19
|
+
- find_all: sales_invoice
|
|
20
|
+
where: docstatus == 1 && outstanding > 0 && notes.contains('{langganan:')
|
|
21
|
+
sort: due_date
|
|
22
|
+
as: allopen
|
|
23
|
+
- find_all: subscription
|
|
24
|
+
where: status != 'stopped' || end_date == '' || end_date > today() || unpaid_amount > 0 || deposit_waiting > 0
|
|
25
|
+
sort: name
|
|
26
|
+
limit: 2000
|
|
27
|
+
as: subs
|
|
28
|
+
# draft payments of collector deposits not submitted yet (deposit_waiting, what a collector may still collect)
|
|
29
|
+
- find_all: payment
|
|
30
|
+
where: docstatus == 0 && direction == 'receive' && notes.startsWith('Setoran ')
|
|
31
|
+
as: waiting
|
|
32
|
+
- for_each: subs
|
|
33
|
+
as: s
|
|
34
|
+
do:
|
|
35
|
+
- update: s
|
|
36
|
+
set:
|
|
37
|
+
prev_status: s.status
|
|
38
|
+
unpaid_amount: "allopen.filter(i, i.notes.contains('{langganan:' + s.name + '}')).map(i, i.outstanding).sum()"
|
|
39
|
+
overdue_amount: "allopen.filter(i, i.notes.contains('{langganan:' + s.name + '}')).filter(i, i.due_date < today()).map(i, i.outstanding).sum()"
|
|
40
|
+
oldest_due: "size(allopen.filter(i, i.notes.contains('{langganan:' + s.name + '}'))) > 0 ? allopen.filter(i, i.notes.contains('{langganan:' + s.name + '}'))[0].due_date : ''"
|
|
41
|
+
checked_on: today()
|
|
42
|
+
deposit_waiting: waiting.filter(p, p.reference == s.name).map(p, p.amount).sum()
|
|
43
|
+
- update: s
|
|
44
|
+
if: s.stop_due
|
|
45
|
+
set:
|
|
46
|
+
end_date: "s.billed_through == '' || today() >= s.billed_through ? today() : s.billed_through"
|
|
47
|
+
- create: subscription_status_log
|
|
48
|
+
if: s.status != s.prev_status
|
|
49
|
+
set:
|
|
50
|
+
subscription: s.name
|
|
51
|
+
changed_on: today()
|
|
52
|
+
from_status: s.prev_status
|
|
53
|
+
to_status: s.status
|
|
54
|
+
overdue_since: s.overdue_since
|
|
55
|
+
overdue_amount: s.overdue_amount
|
|
56
|
+
- notify: owner
|
|
57
|
+
if: s.status == 'suspended' && s.prev_status != 'suspended'
|
|
58
|
+
channel: email
|
|
59
|
+
template: {id: 'Layanan {s.customer_name} ({s.name} {s.service_id}) ditangguhkan: telat {s.late_days} hari, Rp {s.overdue_amount}. Isolir bila perlu.'}
|
|
60
|
+
- find_all: subscription
|
|
61
|
+
where: status != 'stopped'
|
|
62
|
+
as: live
|
|
63
|
+
- for_each: "[truncate(today(), 7), truncate(add_months(truncate(today(), 7) + '-01', -1), 7)]"
|
|
64
|
+
as: m
|
|
65
|
+
do:
|
|
66
|
+
- {find: subscription_month, where: month == m, as: rec}
|
|
67
|
+
- create: subscription_month
|
|
68
|
+
if: rec == null
|
|
69
|
+
set: {month: m}
|
|
70
|
+
as: rec
|
|
71
|
+
- find_all: sales_invoice
|
|
72
|
+
where: docstatus == 1 && notes.contains('{langganan:') && truncate(posting_date, 7) == m
|
|
73
|
+
as: invs
|
|
74
|
+
- update: rec
|
|
75
|
+
set:
|
|
76
|
+
billed: invs.map(i, i.amount_due).sum()
|
|
77
|
+
collected: invs.map(i, i.amount_due - i.outstanding).sum()
|
|
78
|
+
invoices: size(invs)
|
|
79
|
+
active_count: "m == truncate(today(), 7) ? size(live) : rec.active_count"
|
|
80
|
+
mrr: "m == truncate(today(), 7) ? live.map(x, x.monthly_net).sum() : rec.mrr"
|
|
81
|
+
refreshed_on: today()
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
|
|
2
|
+
name: subscription_extra_locked
|
|
3
|
+
label: {id: Tambahan yang sudah ditagih dikunci}
|
|
4
|
+
# An extra a bill took keeps what it billed: only its until date and active flag change after that.
|
|
5
|
+
on: subscription_extra.updated
|
|
6
|
+
if: >-
|
|
7
|
+
event.before != null && event.before.last_bill != '' && (event.amount != event.before.amount
|
|
8
|
+
|| event.item != event.before.item || event.description != event.before.description || event.repeat != event.before.repeat
|
|
9
|
+
|| event.from_date != event.before.from_date || event.subscription != event.before.subscription)
|
|
10
|
+
steps:
|
|
11
|
+
- create: subscription_guard
|
|
12
|
+
set:
|
|
13
|
+
reason: "'extra_billed'"
|
|
14
|
+
document: event.name
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
|
|
2
|
+
name: subscription_status_on_payment
|
|
3
|
+
label: {id: Status langganan diperbarui saat pembayaran diajukan}
|
|
4
|
+
# A received payment of a client refreshes that client's subscriptions at once, with the same ladder as
|
|
5
|
+
# subscription_dunning: a client who pays what was past due is active again (the suspension is lifted) without waiting
|
|
6
|
+
# for the night run.
|
|
7
|
+
on: payment.submitted
|
|
8
|
+
if: event.direction == 'receive' && event.customer != ''
|
|
9
|
+
steps:
|
|
10
|
+
- find_all: sales_invoice
|
|
11
|
+
where: docstatus == 1 && outstanding > 0 && customer == event.customer && notes.contains('{langganan:')
|
|
12
|
+
sort: due_date
|
|
13
|
+
as: allopen
|
|
14
|
+
- find_all: subscription
|
|
15
|
+
where: customer == event.customer && (status != 'stopped' || end_date == '' || end_date > today() || unpaid_amount > 0 || deposit_waiting > 0)
|
|
16
|
+
as: subs
|
|
17
|
+
# draft payments of collector deposits not submitted yet (deposit_waiting, what a collector may still collect)
|
|
18
|
+
- find_all: payment
|
|
19
|
+
where: docstatus == 0 && direction == 'receive' && notes.startsWith('Setoran ')
|
|
20
|
+
as: waiting
|
|
21
|
+
- for_each: subs
|
|
22
|
+
as: s
|
|
23
|
+
do:
|
|
24
|
+
- update: s
|
|
25
|
+
set:
|
|
26
|
+
prev_status: s.status
|
|
27
|
+
unpaid_amount: "allopen.filter(i, i.notes.contains('{langganan:' + s.name + '}')).map(i, i.outstanding).sum()"
|
|
28
|
+
overdue_amount: "allopen.filter(i, i.notes.contains('{langganan:' + s.name + '}')).filter(i, i.due_date < today()).map(i, i.outstanding).sum()"
|
|
29
|
+
oldest_due: "size(allopen.filter(i, i.notes.contains('{langganan:' + s.name + '}'))) > 0 ? allopen.filter(i, i.notes.contains('{langganan:' + s.name + '}'))[0].due_date : ''"
|
|
30
|
+
checked_on: today()
|
|
31
|
+
deposit_waiting: waiting.filter(p, p.reference == s.name).map(p, p.amount).sum()
|
|
32
|
+
- update: s
|
|
33
|
+
if: s.stop_due
|
|
34
|
+
set:
|
|
35
|
+
end_date: "s.billed_through == '' || today() >= s.billed_through ? today() : s.billed_through"
|
|
36
|
+
- create: subscription_status_log
|
|
37
|
+
if: s.status != s.prev_status
|
|
38
|
+
set:
|
|
39
|
+
subscription: s.name
|
|
40
|
+
changed_on: today()
|
|
41
|
+
from_status: s.prev_status
|
|
42
|
+
to_status: s.status
|
|
43
|
+
overdue_since: s.overdue_since
|
|
44
|
+
overdue_amount: s.overdue_amount
|
|
45
|
+
- notify: owner
|
|
46
|
+
if: s.status == 'suspended' && s.prev_status != 'suspended'
|
|
47
|
+
channel: email
|
|
48
|
+
template: {id: 'Layanan {s.customer_name} ({s.name} {s.service_id}) ditangguhkan: telat {s.late_days} hari, Rp {s.overdue_amount}. Isolir bila perlu.'}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/model.json
|
|
2
|
+
name: collector_deposit
|
|
3
|
+
label: {id: Setoran penagih, en: Collector deposit}
|
|
4
|
+
icon: cash
|
|
5
|
+
is_submittable: true
|
|
6
|
+
naming: STP-{YYYY}-{#####}
|
|
7
|
+
title_field: collector
|
|
8
|
+
# The cash a collector hands over, counted by finance. Submitting it (flow collector_deposit_on_submit) takes every
|
|
9
|
+
# collection of that collector on or before the deposit date not yet deposited; refused when there is none or when the
|
|
10
|
+
# cash counted is not exactly their total (a shortage is found before submitting, not booked). Each collection becomes
|
|
11
|
+
# a draft cash payment of its client, allocated to the subscription's oldest unpaid invoices after the draft payments
|
|
12
|
+
# already waiting for that subscription (the rest stays unallocated as the client's credit). Finance submits those
|
|
13
|
+
# payments, which settles the invoices and puts the cash in Kas. A deposit is not cancelled: its draft payments cannot
|
|
14
|
+
# be deleted, and their amount, client and method cannot change (flows deposit_payment_*).
|
|
15
|
+
permissions:
|
|
16
|
+
- {role: finance_manager, read: true, create: true, write: true, submit: true, export: true, print: true}
|
|
17
|
+
- {role: collector, read: true}
|
|
18
|
+
fields:
|
|
19
|
+
- {name: collector, type: link, to: user, label: {id: Penagih}, required: true, in_list: true}
|
|
20
|
+
- {name: deposit_date, type: date, label: {id: Tanggal setor}, default: today(), required: true, in_list: true}
|
|
21
|
+
- {name: cash_counted, type: currency, label: {id: Uang yang dihitung}, required: true, in_list: true}
|
|
22
|
+
- {name: notes, type: text, label: {id: Catatan}}
|
|
23
|
+
rules:
|
|
24
|
+
- name: cash_positive
|
|
25
|
+
on: save
|
|
26
|
+
check: cash_counted > 0
|
|
27
|
+
message: {id: 'Uang yang dihitung harus lebih dari 0'}
|
|
28
|
+
- name: not_future
|
|
29
|
+
on: save
|
|
30
|
+
check: deposit_date <= today()
|
|
31
|
+
message: {id: 'Tanggal setor tidak boleh sesudah hari ini'}
|
|
32
|
+
views:
|
|
33
|
+
list:
|
|
34
|
+
columns: [name, deposit_date, collector, cash_counted, status]
|
|
35
|
+
filters: [collector]
|
|
36
|
+
sort: -deposit_date
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/model.json
|
|
2
|
+
name: field_collection
|
|
3
|
+
label: {id: Uang tertagih penagih, en: Field collection}
|
|
4
|
+
icon: wallet
|
|
5
|
+
naming: UTP-{YYYY}-{#####}
|
|
6
|
+
title_field: customer_name
|
|
7
|
+
# Cash a collector took from a client in the field (Rangka has no cash until the collector deposits it). Recorded on a
|
|
8
|
+
# subscription, not an invoice: a collector reads no invoices, and what the subscription still owes is on it
|
|
9
|
+
# (unpaid_amount less deposit_waiting, refreshed by the flows). The cap and the collector's area are checked when the
|
|
10
|
+
# collection is saved (flows field_collection_cap_*), not again when it is deposited: cash in hand is deposited even
|
|
11
|
+
# when the client paid the rest elsewhere meanwhile (the surplus is the client's credit) or the area changed hands. A collector deposit takes every collection of its collector not yet
|
|
12
|
+
# deposited and turns each into a draft cash payment allocated to the subscription's oldest unpaid invoices (flow
|
|
13
|
+
# collector_deposit_on_submit; the payment carries this collection's number in []). Once deposited a collection cannot change or be deleted (flows field_collection_*).
|
|
14
|
+
permissions:
|
|
15
|
+
- {role: collector, read: true, create: true, write: true, delete: true}
|
|
16
|
+
- {role: finance_manager, read: true, create: true, write: true, delete: true, export: true, print: true}
|
|
17
|
+
# the payment flows look for the collection of a payment as whoever edits it
|
|
18
|
+
- {role: sales_manager, read: true}
|
|
19
|
+
fields:
|
|
20
|
+
- {name: collector, type: link, to: user, label: {id: Penagih}, default: user.name, required: true, in_list: true}
|
|
21
|
+
- {name: subscription, type: link, to: subscription, label: {id: Langganan}, required: true}
|
|
22
|
+
- {name: customer, type: link, to: customer, label: {id: Pelanggan}, compute: subscription.customer}
|
|
23
|
+
- {name: customer_name, type: data, label: {id: Nama pelanggan}, compute: subscription.customer_name, in_list: true}
|
|
24
|
+
- {name: unpaid_amount, type: currency, label: {id: Belum dibayar saat dicatat}, compute: subscription.unpaid_amount}
|
|
25
|
+
- {name: amount, type: currency, label: {id: Uang diterima}, required: true, in_list: true}
|
|
26
|
+
- {name: collected_on, type: date, label: {id: Tanggal tagih}, default: today(), required: true, in_list: true}
|
|
27
|
+
- {name: deposit, type: link, to: collector_deposit, label: {id: Disetor di}, read_only: true, in_list: true}
|
|
28
|
+
- {name: notes, type: text, label: {id: Catatan}}
|
|
29
|
+
rules:
|
|
30
|
+
- name: amount_positive
|
|
31
|
+
on: save
|
|
32
|
+
check: amount > 0
|
|
33
|
+
message: {id: 'Uang diterima harus lebih dari 0'}
|
|
34
|
+
- name: not_future
|
|
35
|
+
on: save
|
|
36
|
+
check: collected_on <= today()
|
|
37
|
+
message: {id: 'Tanggal tagih tidak boleh sesudah hari ini'}
|
|
38
|
+
views:
|
|
39
|
+
list:
|
|
40
|
+
columns: [name, collected_on, customer_name, amount, collector, deposit]
|
|
41
|
+
filters: [collector, deposit, subscription]
|
|
42
|
+
sort: -collected_on
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/model.json
|
|
2
|
+
name: service_area
|
|
3
|
+
label: {id: Area layanan, en: Service area}
|
|
4
|
+
icon: map
|
|
5
|
+
naming: ARE-{###}
|
|
6
|
+
title_field: area_name
|
|
7
|
+
# An area (a village, a cluster, a block of a housing estate) and the collector who visits it. The subscriptions of an
|
|
8
|
+
# area follow its collector (flow service_area_collector).
|
|
9
|
+
permissions:
|
|
10
|
+
- {role: finance_manager, read: true, create: true, write: true, export: true, print: true}
|
|
11
|
+
- {role: collector, read: true}
|
|
12
|
+
fields:
|
|
13
|
+
- {name: area_name, type: data, label: {id: Nama area}, required: true, in_list: true}
|
|
14
|
+
- {name: collector, type: link, to: user, label: {id: Penagih}, in_list: true}
|
|
15
|
+
- {name: notes, type: text, label: {id: Catatan}}
|
|
16
|
+
views:
|
|
17
|
+
list:
|
|
18
|
+
columns: [area_name, collector]
|
|
19
|
+
sort: area_name
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/model.json
|
|
2
|
+
name: subscription
|
|
3
|
+
label: {id: Langganan, en: Subscription}
|
|
4
|
+
icon: repeat
|
|
5
|
+
naming: LGN-{#####}
|
|
6
|
+
title_field: customer_name
|
|
7
|
+
# One client's subscription to a plan, on its own cycle.
|
|
8
|
+
# - Cycle: monthly, every 3 months, yearly, or N months paid in advance; cycle_months is 1, 3, 12 or N. The cycle and
|
|
9
|
+
# the price may change at any time; they apply from the next bill.
|
|
10
|
+
# - Anchor: "start" bills every period from the start date (a retainer started on the 15th bills on the 15th);
|
|
11
|
+
# "month_start" bills on the 1st, and a start on another day gets a first bill pro-rated by days, from the start date
|
|
12
|
+
# to the day before the next 1st (open-isp practice). Periods are counted from the anchor with add_months (contract
|
|
13
|
+
# 0031), never from the previous period, so a 31st anchor does not drift: period k starts at
|
|
14
|
+
# add_months(anchor_date, billed_months). The start date, the anchor and the customer cannot change after the first bill.
|
|
15
|
+
# - Bills: flow subscription_billing (every day, 00:05) bills each subscription whose next bill date has come: one
|
|
16
|
+
# subscription_bill and one draft sales invoice per period. billed_months and prorata_billed are written only by it.
|
|
17
|
+
# - end_date: no period that starts on or after it is billed; the period it falls in is billed up to the day before,
|
|
18
|
+
# pro-rated by days; the subscription is stopped from that day. It cannot fall before billed_through.
|
|
19
|
+
# - Status (computed, never set by hand) from the facts the dunning flows write (oldest_due, checked_on): stopped once
|
|
20
|
+
# end_date has come; else suspended when the oldest unpaid invoice is suspend_after_days past due, late when past
|
|
21
|
+
# due, else active. stop_after_days > 0 makes the dunning flow set end_date when the oldest unpaid invoice is that
|
|
22
|
+
# late (stop_due). Its invoices carry {langganan:<name>} in their notes.
|
|
23
|
+
# The collector of a subscription is its area's (row scope of role collector). Not deleted by anyone but the owner: a
|
|
24
|
+
# client who leaves gets an end date, which keeps the history.
|
|
25
|
+
permissions:
|
|
26
|
+
- {role: finance_manager, read: true, create: true, write: true, export: true, print: true}
|
|
27
|
+
- {role: collector, read: true}
|
|
28
|
+
# the invoice and payment flows refresh a subscription's unpaid amount as whoever submits
|
|
29
|
+
- {role: sales_manager, read: true, write: true}
|
|
30
|
+
fields:
|
|
31
|
+
- {name: customer, type: link, to: customer, label: {id: Pelanggan}, required: true}
|
|
32
|
+
- {name: customer_name, type: data, label: {id: Nama pelanggan}, compute: customer.customer_name, in_list: true}
|
|
33
|
+
- {name: phone, type: data, label: {id: Telepon}, compute: customer.phone}
|
|
34
|
+
- {name: address, type: data, label: {id: Alamat}, compute: customer.address}
|
|
35
|
+
- {name: plan, type: link, to: subscription_plan, label: {id: Paket}, required: true, in_list: true}
|
|
36
|
+
- {name: plan_name, type: data, label: {id: Nama paket}, compute: plan.plan_name}
|
|
37
|
+
- {name: item, type: link, to: item, label: {id: Nama jasa di faktur}, compute: plan.item}
|
|
38
|
+
- name: service_id
|
|
39
|
+
type: data
|
|
40
|
+
label: {id: ID layanan}
|
|
41
|
+
help: {id: 'Nomor pelanggan, user PPPoE, domain, atau nomor lisensi'}
|
|
42
|
+
- {name: area, type: link, to: service_area, label: {id: Area}, in_list: true}
|
|
43
|
+
- {name: collector, type: link, to: user, label: {id: Penagih}, compute: area.collector}
|
|
44
|
+
- name: cycle
|
|
45
|
+
type: select
|
|
46
|
+
label: {id: Siklus tagihan}
|
|
47
|
+
required: true
|
|
48
|
+
default: plan.default_cycle
|
|
49
|
+
options:
|
|
50
|
+
- {value: monthly, label: {id: Bulanan}}
|
|
51
|
+
- {value: quarterly, label: {id: Tiap 3 bulan}}
|
|
52
|
+
- {value: yearly, label: {id: Tahunan}}
|
|
53
|
+
- {value: prepaid, label: {id: Bayar di muka N bulan}}
|
|
54
|
+
- name: prepaid_months
|
|
55
|
+
type: int
|
|
56
|
+
label: {id: Bayar di muka (bulan)}
|
|
57
|
+
default: plan.default_prepaid_months
|
|
58
|
+
depends_on: cycle == 'prepaid'
|
|
59
|
+
- name: cycle_months
|
|
60
|
+
type: int
|
|
61
|
+
label: {id: Bulan per tagihan}
|
|
62
|
+
compute: "cycle == 'monthly' ? 1 : (cycle == 'quarterly' ? 3 : (cycle == 'yearly' ? 12 : prepaid_months))"
|
|
63
|
+
- {name: monthly_price, type: currency, label: {id: Harga per bulan}, default: plan.monthly_price, required: true}
|
|
64
|
+
- name: discount_percent
|
|
65
|
+
type: float
|
|
66
|
+
label: {id: Potongan (%)}
|
|
67
|
+
help: {id: 'Misalnya potongan tahunan; berlaku mulai tagihan berikutnya'}
|
|
68
|
+
default: '0'
|
|
69
|
+
- name: monthly_net
|
|
70
|
+
type: currency
|
|
71
|
+
label: {id: Nilai per bulan (MRR)}
|
|
72
|
+
compute: round(monthly_price * (100 - discount_percent) / 100)
|
|
73
|
+
in_list: true
|
|
74
|
+
- name: start_date
|
|
75
|
+
type: date
|
|
76
|
+
label: {id: Mulai berlangganan}
|
|
77
|
+
default: today()
|
|
78
|
+
required: true
|
|
79
|
+
- name: anchor
|
|
80
|
+
type: select
|
|
81
|
+
label: {id: Tanggal tagihan}
|
|
82
|
+
required: true
|
|
83
|
+
default: "'start'"
|
|
84
|
+
options:
|
|
85
|
+
- {value: start, label: {id: Tiap tanggal mulai}}
|
|
86
|
+
- {value: month_start, label: {id: Tiap tanggal 1 (bulan pertama diprorata)}}
|
|
87
|
+
- name: anchor_date
|
|
88
|
+
type: date
|
|
89
|
+
label: {id: Awal periode penuh pertama}
|
|
90
|
+
compute: "anchor == 'month_start' && truncate(start_date, 7) + '-01' != start_date ? add_months(truncate(start_date, 7) + '-01', 1) : start_date"
|
|
91
|
+
- {name: end_date, type: date, label: {id: Berhenti mulai}}
|
|
92
|
+
- {name: due_days, type: int, label: {id: Jatuh tempo (hari dari awal periode)}, default: plan.due_days}
|
|
93
|
+
- {name: suspend_after_days, type: int, label: {id: Ditangguhkan setelah telat (hari)}, default: plan.suspend_after_days}
|
|
94
|
+
- {name: stop_after_days, type: int, label: {id: Berhenti otomatis setelah telat (hari)}, default: plan.stop_after_days}
|
|
95
|
+
# written by flow subscription_billing only
|
|
96
|
+
- {name: billed_months, type: int, label: {id: Bulan sudah ditagih}, default: '0', read_only: true}
|
|
97
|
+
- {name: prorata_billed, type: check, label: {id: Prorata sudah ditagih}, read_only: true}
|
|
98
|
+
- {name: last_bill, type: link, to: subscription_bill, label: {id: Tagihan terakhir}, read_only: true}
|
|
99
|
+
- name: next_is_prorata
|
|
100
|
+
type: check
|
|
101
|
+
label: {id: Tagihan berikutnya prorata}
|
|
102
|
+
compute: anchor_date != start_date && !prorata_billed
|
|
103
|
+
# the first day after the full periods billed; a period an end date cut short and then the end date taken away
|
|
104
|
+
# (the client stays) leaves billed_through before it: the rest of that period is billed first (audit 2026-11-08 #12)
|
|
105
|
+
- {name: boundary, type: date, label: {id: Batas periode penuh}, hidden: true, compute: "add_months(anchor_date, billed_months)"}
|
|
106
|
+
- name: resume
|
|
107
|
+
type: check
|
|
108
|
+
label: {id: Tagihan berikutnya sisa periode}
|
|
109
|
+
hidden: true
|
|
110
|
+
compute: "!next_is_prorata && billed_through != '' && last_period_start != '' && last_cycle_value > 0 && billed_through < boundary"
|
|
111
|
+
- name: next_bill_date
|
|
112
|
+
type: date
|
|
113
|
+
label: {id: Tagihan berikutnya}
|
|
114
|
+
compute: "next_is_prorata ? start_date : (resume ? billed_through : boundary)"
|
|
115
|
+
in_list: true
|
|
116
|
+
# the period as the cycle runs, then cut at the end date: a client who stops mid-period is billed up to the day before
|
|
117
|
+
# end_date, pro-rated by days of that period (audit 2026-11-08 #1)
|
|
118
|
+
- name: cycle_period_end
|
|
119
|
+
type: date
|
|
120
|
+
label: {id: Akhir periode penuh}
|
|
121
|
+
hidden: true
|
|
122
|
+
compute: "(next_is_prorata ? anchor_date : (resume ? boundary : add_months(anchor_date, billed_months + cycle_months))) - duration(1)"
|
|
123
|
+
- name: next_period_end
|
|
124
|
+
type: date
|
|
125
|
+
label: {id: Akhir periode berikutnya}
|
|
126
|
+
compute: "end_date != '' && end_date - duration(1) < cycle_period_end ? end_date - duration(1) : cycle_period_end"
|
|
127
|
+
- name: cycle_amount
|
|
128
|
+
type: currency
|
|
129
|
+
label: {id: Nilai periode penuh}
|
|
130
|
+
hidden: true
|
|
131
|
+
compute: >-
|
|
132
|
+
next_is_prorata ? round(monthly_net * days_between(start_date, anchor_date) / days_between(add_months(anchor_date, -1), anchor_date))
|
|
133
|
+
: (resume ? round(last_full_amount * days_between(billed_through, boundary) / days_between(last_period_start, boundary)) : monthly_net * cycle_months)
|
|
134
|
+
- name: next_amount
|
|
135
|
+
type: currency
|
|
136
|
+
label: {id: Nilai tagihan berikutnya}
|
|
137
|
+
help: {id: 'Tanpa baris tambahan dan PPN'}
|
|
138
|
+
compute: "next_period_end == cycle_period_end ? cycle_amount : round(cycle_amount * days_between(next_bill_date, next_period_end + duration(1)) / days_between(next_bill_date, cycle_period_end + duration(1)))"
|
|
139
|
+
- {name: billed_through, type: date, label: {id: Sudah ditagih sampai sebelum}, read_only: true}
|
|
140
|
+
# the last period billed as the cycle runs (before an end date cut it): what the rest of it is pro-rated against
|
|
141
|
+
- {name: last_period_start, type: date, label: {id: Awal periode terakhir}, read_only: true, hidden: true}
|
|
142
|
+
- {name: last_full_amount, type: currency, label: {id: Nilai penuh periode terakhir}, read_only: true, hidden: true}
|
|
143
|
+
- {name: last_cycle_value, type: currency, label: {id: Nilai satu siklus saat periode terakhir}, read_only: true, hidden: true}
|
|
144
|
+
# facts written by the dunning flows only; the status is computed from them when they are saved
|
|
145
|
+
- {name: unpaid_amount, type: currency, label: {id: Belum dibayar}, read_only: true, in_list: true}
|
|
146
|
+
- name: deposit_waiting
|
|
147
|
+
type: currency
|
|
148
|
+
label: {id: Setoran penagih menunggu diajukan}
|
|
149
|
+
help: {id: 'Uang tunai yang sudah disetor tapi pembayarannya belum diajukan finance'}
|
|
150
|
+
read_only: true
|
|
151
|
+
- {name: overdue_amount, type: currency, label: {id: Lewat jatuh tempo}, read_only: true}
|
|
152
|
+
- {name: oldest_due, type: date, label: {id: Jatuh tempo tagihan tertua yang belum lunas}, read_only: true}
|
|
153
|
+
- {name: checked_on, type: date, label: {id: Status dicek}, read_only: true}
|
|
154
|
+
- {name: prev_status, type: data, label: {id: Status sebelum dicek}, read_only: true, hidden: true}
|
|
155
|
+
- name: overdue_since
|
|
156
|
+
type: date
|
|
157
|
+
label: {id: Telat sejak}
|
|
158
|
+
compute: "oldest_due != '' && checked_on != '' && oldest_due < checked_on ? oldest_due : ''"
|
|
159
|
+
- name: late_days
|
|
160
|
+
type: int
|
|
161
|
+
label: {id: Telat (hari)}
|
|
162
|
+
compute: "overdue_since == '' ? 0 : days_between(overdue_since, checked_on)"
|
|
163
|
+
- name: stop_due
|
|
164
|
+
type: check
|
|
165
|
+
label: {id: Waktunya berhenti otomatis}
|
|
166
|
+
hidden: true
|
|
167
|
+
compute: end_date == '' && stop_after_days > 0 && late_days >= stop_after_days
|
|
168
|
+
- name: status
|
|
169
|
+
type: select
|
|
170
|
+
label: {id: Status layanan}
|
|
171
|
+
compute: "end_date != '' && end_date <= (checked_on == '' ? start_date : checked_on) ? 'stopped' : (late_days >= suspend_after_days ? 'suspended' : (late_days > 0 ? 'late' : 'active'))"
|
|
172
|
+
in_list: true
|
|
173
|
+
chip: true
|
|
174
|
+
options:
|
|
175
|
+
- {value: active, label: {id: Aktif}}
|
|
176
|
+
- {value: late, label: {id: Telat}}
|
|
177
|
+
- {value: suspended, label: {id: Ditangguhkan}}
|
|
178
|
+
- {value: stopped, label: {id: Berhenti}}
|
|
179
|
+
# copies the billing flow takes at the first bill (rule terms_locked)
|
|
180
|
+
- {name: locked_start, type: date, label: {id: Mulai (terkunci)}, read_only: true, hidden: true}
|
|
181
|
+
- {name: locked_anchor, type: data, label: {id: Tanggal tagihan (terkunci)}, read_only: true, hidden: true}
|
|
182
|
+
- {name: locked_customer, type: data, label: {id: Pelanggan (terkunci)}, read_only: true, hidden: true}
|
|
183
|
+
- {name: notes, type: text, label: {id: Catatan}}
|
|
184
|
+
rules:
|
|
185
|
+
- name: prepaid_range
|
|
186
|
+
on: save
|
|
187
|
+
check: cycle != 'prepaid' || (prepaid_months >= 1 && prepaid_months <= 36)
|
|
188
|
+
message: {id: 'Bayar di muka antara 1 dan 36 bulan'}
|
|
189
|
+
- name: price_positive
|
|
190
|
+
on: save
|
|
191
|
+
check: monthly_price > 0 && discount_percent >= 0 && discount_percent < 100 && monthly_net > 0
|
|
192
|
+
message: {id: 'Harga per bulan harus lebih dari 0 dan potongan 0 sampai di bawah 100%'}
|
|
193
|
+
- name: end_after_start
|
|
194
|
+
on: save
|
|
195
|
+
check: end_date == '' || end_date > start_date
|
|
196
|
+
message: {id: 'Tanggal berhenti harus sesudah tanggal mulai'}
|
|
197
|
+
- name: ladder_valid
|
|
198
|
+
on: save
|
|
199
|
+
check: due_days >= 0 && due_days <= 60 && suspend_after_days >= 1 && suspend_after_days <= 365 && (stop_after_days == 0 || (stop_after_days > suspend_after_days && stop_after_days <= 730))
|
|
200
|
+
message: {id: 'Jatuh tempo 0 sampai 60 hari, ditangguhkan 1 sampai 365 hari, berhenti otomatis 0 atau lebih lama dari ditangguhkan'}
|
|
201
|
+
- name: terms_locked
|
|
202
|
+
on: save
|
|
203
|
+
check: locked_start == '' || (start_date == locked_start && anchor == locked_anchor && (locked_customer == '' || customer == locked_customer))
|
|
204
|
+
message: {id: 'Sudah ada tagihan: pelanggan, tanggal mulai dan tanggal tagihan tidak bisa diubah lagi'}
|
|
205
|
+
- name: end_not_billed
|
|
206
|
+
on: save
|
|
207
|
+
check: end_date == '' || billed_through == '' || end_date >= billed_through
|
|
208
|
+
message: {id: 'Periode sampai tanggal itu sudah ditagih; isi tanggal berhenti sesudah periode terakhir yang ditagih'}
|
|
209
|
+
views:
|
|
210
|
+
list:
|
|
211
|
+
columns: [name, customer_name, plan, area, monthly_net, next_bill_date, status]
|
|
212
|
+
filters: [status, area, plan, collector]
|
|
213
|
+
sort: customer_name
|
|
214
|
+
form:
|
|
215
|
+
layout:
|
|
216
|
+
- section: {id: Pelanggan}
|
|
217
|
+
columns:
|
|
218
|
+
- [customer, customer_name, phone, address]
|
|
219
|
+
- [service_id, area, collector, status]
|
|
220
|
+
- section: {id: Paket dan siklus}
|
|
221
|
+
columns:
|
|
222
|
+
- [plan, cycle, prepaid_months, cycle_months]
|
|
223
|
+
- [monthly_price, discount_percent, monthly_net]
|
|
224
|
+
- section: {id: Periode}
|
|
225
|
+
columns:
|
|
226
|
+
- [start_date, anchor, anchor_date, end_date]
|
|
227
|
+
- [next_bill_date, next_period_end, next_amount, billed_months]
|
|
228
|
+
- section: {id: Penagihan}
|
|
229
|
+
columns:
|
|
230
|
+
- [due_days, suspend_after_days, stop_after_days]
|
|
231
|
+
- [unpaid_amount, deposit_waiting, overdue_amount, overdue_since, late_days, checked_on]
|
|
232
|
+
- section: {id: Catatan}
|
|
233
|
+
fields: [notes]
|