Skip to content

Cost Control

Module: procurement, shown in the menu as Cost Control. The folder name is the old name of the module and is the source of most confusion in this area: the Procurement menu group (Requisition, RFQ, PO and the rest) lives in other folders, while modules/procurement/ is the commitment and expenditure register of the Cost Control & Budgeting group.

How this page was verified

Written from master on 2026-09-06 and compared with the big five the same day. No earlier page existed. A map, not a line-by-line trace: 49 files, about 820 database calls. Only master has the module installed, so the screens were not exercised on a fork.

Where it sits

WBS (ts_cbs)  ─┐
AFE           ─┼→  Contract (ts_contract_number, revisions)  →  Order line items (ts_lineitem)
               │        →  Expenditure (ts_transact: actual, forecast, invoice, payment)
               │        →  Actual & Forecast snapshots  →  Budget & Expense Reporting
Vendor        ─┘

Every amount hangs off a WBS node and an AFE, so the Cost Control settings must be filled before the first contract.

The five tabs

procurement.php with procurement_browse.htm opens a tab bar: Contract, Order, Expenditure, Report, Snapshot. One toolbar serves all of them: New, Add, Edit, Delete, Save, Close, Add Lineitem, Select Lineitem, Import, Import from Excel, Print, Export to CSV, Search, Sort, View Comments, Refresh.

TabDataActions
Contractts_contract_number: contract_number, contract_desc, contract_value, contract_currency, contract_exchangerate, contract_date, contract_award_date, contract_completion_date, contract_requisition_ref, itb_id, company_code, status_contract_id, the procurement representative. Revisions in ts_contract_rev.adddatacontract, editcontract, addrevcontract, editrev, approveunapprove, Excel import (import_excel_upload)
Orderts_lineitem per contract: lineitem_no, lineitem_desc, cbs_id, order_id, po_item_id, is_manualaddlineitem, editlineitem, deletelineitem, editlinecbs, movegridtogrid
Expenditurets_transact per line item: transact_unit, quantities and values, transact_order_date, transact_actual_date, transact_forec_accrual_completion_date, transact_forec_cash_completion_date, payment_status, pertamina_afe_id, approve_for_actual_date; ts_projectdocref for the reference document (invoice, delivery note) with its projectdocref_value and currency; ts_invoice; all tied together by ts_map_transactaddline_transact, editline_transact, deleteline_transact, moveTransact, addmap, editmap, delmap, invoice import (import_inv_preview_upload), validateDuplicateInvNo
Reportthe printed reports belowPrint
Snapshotts_actual_forecast headers with ts_actual_forecast_snapshot rows: a frozen copy of every transaction with its order, actual and forecast valuessave, view

The accounts-payable voucher (AccPayAdd, AccPayEdit, procurement_accounts_payable_voucher.php) is a sixth form reached from the Expenditure tab.

The reports

The Report tab and the Report menu's Cost Control & Budgeting heading run the same scripts: AFE accrual (three versions and a snapshot version), finance accrual, actual versus payment (per contract and per WBS, weekly and Excel variants), budget commitment, cost summary, accrual summary. How they are registered is on the Reporting page.

Report scriptState where the legacy helper throws
print_afe_accrual_2, print_act_vs_payment*, print_afe_finance_accrual_xls, print_report3, the two weekly Excel exportson $pdo, work
print_afe_accrual, print_afe_accrual_2_month, print_afe_accrual_snapshot, print_accrual_summary, print_budget_commitment, print_cost_summary_report, procurement_handler_summarydead
the *20091019.php and *_061014.php copiesdated backups, not routed

What still runs on the legacy helper

Counted on 2026-09-06: 328 calls to iw_mysql_query() against 495 uses of $pdo.

PathState where the legacy helper throws
procurement.php, procurement.inc.php, procurement_handler_browse.inc.php, procurement_handler_ajaxform.inc.php, procurement_expenditure_subgrid.php, procurement_handler_tree.inc.phpmostly $pdo, one to four legacy calls each
procurement_handler_post.inc.php (79 legacy, 139 PDO)mixed; the contract and transaction writes are PDO, several helpers are not
procurement_handler_ajax.inc.php (9 legacy, 3 PDO)mixed
procurement_accounts_payable_voucher.phpdead

Gotchas

  • The folder is procurement, the menu says Cost Control. A ticket that says "procurement module" usually means the Procurement group. Ask which screen.
  • ts_map_transact is the join table for everything. A transaction with no map row is invisible in the grid and in every report, although it exists.
  • Contract value versus line items. The contract header carries contract_value; the Order tab totals the line items. Nothing keeps them equal.
  • Two AFE registers. ts_pertamina_afe (the client's AFE) and ts_afe_internal, mapped to WBS through ts_map_cbs_pertamina_afe. Reports group by the client one.
  • The ledger import (modules/cost_control_reference/importledgercustom.php, table ts_importledger_custom) is a scheduled import of the accounting ledger. It is on the legacy helper and dead.

Instance differences

Checked on 2026-09-06.

InstanceDifference
MasterThe only instance with the module installed, for QA.
Jadestone, Medco, JOTRE, TimasNot installed in their QA databases. Code identical to master, byte for byte.