PORTMAN PAYMENTS - GO-LIVE (20 Oct 2026, updated 21 Oct 2026) ============================================================== Take a BACKUP of the website files and the database first (cPanel > Backup). 1. Upload into the site's includes/ folder: payment_link.php, hub_core.php, whatsapp_notifiers.php, approval_levels.php 2. Upload to the site root (replace the old ones): payments.php (NEW), finance_hub-2.php, trace.php, records_dashboard.php, border_finance_dashboard.php, border_payment_functions.php, fixed_payment_details.php, lot_payment_details.php, final_mileage.php, approve_voucher.php, confirm_payment.php 3. Open the Records page once (it creates the opening-balance history table). 4. phpMyAdmin > SQL: run sql/payment_audit_setup.sql, then sql/disable_links.sql. 5. Open includes/db_connect.php on the server and paste the content of includes/db_connect_ADD_TO_END.php at the very END (after $conn is created). 6. Test with 3 people: one approver, the Busy Ref person, one paying agent: portmanltd.com/payments.php THE APPROVAL RULE (all pages: Payments, old Vouchers, Fixed Cost, Lot Payment, Final Mileage) - Every level is kept. Nothing is skipped. - Every level is done by a DIFFERENT person: the requester can never approve any level of his own request, and nobody can approve two levels of the same payment (admins included). 3 levels = requester + 3 other people. - NO ADMIN SHORTCUT: being admin does not allow approving. Only the people set as approvers (Approval Settings; Accounts / Shilpa on Fixed Cost and Lot Payment; the stage list on Final Mileage) can approve. Admins can still view everything and manage the settings. - "Retry credit note" (it picks the paying agent) is now allowed only to a Level 2 / Level 3 approver of that type - before, anyone logged in could press it. - Check Approval Settings: each type needs enough different approvers, or payments wait. WHAT ELSE CHANGED - payments.php: each person sees only their own work (approve / Busy Ref / pay / my requests) and can find any payment with its full record. - WhatsApp: notices only, NO links. Old links are closed and do nothing. - "Guest" fixed: Fixed Cost and Lot Payment now find the real logged-in person (the old lookup missed full-name logins and saved them as "Guest"). - Office payments (Records > Request Payment) go through approval like everything else. - Every credit note gets its payment voucher: one number from request to paid. - Vouchers, credit notes and opening balances can never be deleted, only cancelled. - Change log in the database: who changed what, when, from which page. ===================================================================== ADDED 21 Oct 2026 - FIXED COST STARTS BY ITSELF + TRIP BUDGET ===================================================================== Upload (after the files above): includes/ fixed_cost_auto.php, trip_budget.php, hub_core.php (newer copy) site root: trip_budget.php (NEW), cron_fixed_cost.php (NEW), fixed_destinations.php, fixed_payment_details.php, payments.php, trace.php (newer copies) Then: a) cPanel > Cron Jobs > every 5 minutes: /usr/local/bin/php /home/USER/public_html/cron_fixed_cost.php >/dev/null 2>&1 (without the cron, the Payments / Reports pages still run it every 15 minutes) b) Open trip_budget.php and fixed_destinations.php once (they create their tables), then phpMyAdmin > SQL: run sql/budget_setup.sql (history can never be deleted). c) Approval Settings: put the Level 1 person of FIXED COST (call type fixed_cost, role approver_1) - he gets ONE WhatsApp summary per run, no link. d) Trip budget > Rules: type the driver allowance and loading / offloading rates and switch them on, tick the BUDGET APPROVER(S). Choose someone who is NOT the usual final approver: the budget approver can never approve a level of the same payment. e) Trip budget > Prices: enter this month's fuel price (one "* Budget price", or per fuel point). 1. FIXED COST STARTS BY ITSELF - IMPORT: button READY TO GO TO LOAD on the Fixed Payment page (per truck, or all import trucks of the lot), because part of the money is used on the way to the loading point. The person who presses it is the REQUESTER: he can never do Level 1 or Level 2 of it. L1 APPROVE only appears after it is requested. Safety net: if nobody pressed it, it starts by itself when the loading date is entered (requester SYSTEM). - EXPORT: when the truck is confirmed loaded (requester SYSTEM). Approvals unchanged: Level 1 Accounts -> Level 2 Shilpa, different people. - Only import trips loaded from 21/10/2026 start by themselves. Older import trucks still waiting need READY TO GO TO LOAD pressed once before Level 1 can approve them. 2. EACH TRIP KEEPS ITS OWN PRICE LIST - The price list is frozen the moment the trip starts. A new price applies only to trips that start after it. Trips already started keep the price they started with. - A price change can be dated: "applies from 01/11" - the system changes it that day. - Every change (who, when, old -> new, reason) is kept. Mine price items are no longer deleted, only switched off. 3. TRIP BUDGET (trip_budget.php) - Each trip: fixed cost + lot payment list + flat rates + allowed extra, against what is spent. - Fuel is in LITERS (zone ration, same rule as Return Mileage). Money value = liters x that month's fuel price. - Budget plan: cash needed per mine / agent / currency per week from the real truck flow, and "what if this price changes" before changing it. 4. HARD BUDGET LIMIT - A voucher that takes its trip above the budget cannot get its final approval (the one that makes the credit note) until a budget approver allows the extra, with a reason (Payments > Over budget). Breakdown, parking, facilitation are not stopped. Extra fuel is checked in liters.