Monthly close from 3 days to 4 hours

One delivery

A collector unloads a truck of copper scrap, gets a handwritten ticket with weight and grade, and sends a photo of it on WhatsApp. The advance against that load was agreed by phone two weeks earlier. A week later the collector writes to say the grade discount was too high: the yard graded it as burnt copper, and he says it was bright. That is one delivery, recorded in three places, and the bank statement mentions none of them.

The client

The client buys copper, aluminium and brass scrap from about 200 suppliers, from single-truck collectors to industrial plants, and sells sorted material to smelters and exporters. Suppliers are paid on weight and grade, often through partial advances.

At 2,500 transactions a month, the two accountants matched what they could against bank movements and weighbridge records in 3 days and carried the rest forward: about 18% of items at each close. Nobody knew any supplier’s true balance, and overpaid advances surfaced months later. Reconciliation products had not helped. They expect bank statements and ERP exports, so they matched the bank side perfectly and the supplier side not at all.

Reading, matching, asking

The system reads the client’s WhatsApp Business account, email and scanned tickets. A vision model reads the handwritten tickets, and each figure it reads stays beside the photo until a rule or an accountant accepts it.

Matching is done by rules written in Prolog, covering partial advances, split payments and grade discounts. The accountants read and change these rules themselves. A simplified one:

% An advance is settled by a delivery from the same supplier
% made within 30 days after it, once the grade discount is taken off.
settles(Advance, Delivery) :-
    advance(Advance, Supplier, Amount, AdvanceDate),
    delivery(Delivery, Supplier, Value, DeliveryDate),
    days_between(AdvanceDate, DeliveryDate, Days),
    Days >= 0, Days =< 30,
    grade_discount(Delivery, Discount),
    Value - Discount >= Amount.

When no rule matches a message to a delivery, an advance or a payment, nothing is posted to the ledger. The system asks the supplier instead.

At first, most suppliers ignored those questions. A message from an unfamiliar business number looked like spam, and the single-truck collectors almost never replied. Each question now goes out under the name of the buyer the supplier already deals with, with the photo of the ticket in question, and most are answered the same day.

Results

Since go-live, the accountants have added and changed rules without calling us.