15-I-1995.: Automatic binding

As the generated date in a modal form says (or so we call it today, it's an upitig2.prg which created a little window with text fields), the last version of my automatic binding routine was written on this date, at 00:23 on this sunday, though the filedate is 19-III-1997., so there must have been changes to it later. This must have been one of the weekends we spent at home, between our working weeks in Hungary. The evening of the next day I was over there in Gemenc again.

What is this automatic binding? In simplest terms, which payment is for which invoice. Which should be simple, there's an invoice and then it gets paid and that's it. Ah but it's not "then", there's often more other invoices before this one gets paid, and then the amount is not exactly that, it may include payments for some of those other invoices, one of them partially. Which is a nightmare for accountants, they specifically meet with "lists of open items" as they call it here, i.e. lists of the invoices and payments which weren't matched (usually many completely unpaid invoices among them). To reduce the clutter, we attempted to write an automatic binder. I wrote the first version of this back in 1987 or 88, in Cobol on the Vaha, after seeing that the existing code didn't do much. The accountants loved me for that.

The trick I employed was to get all the invoices, payments etc for one account into one cursor (while keeping the recno() of the original record as an extra field). Then I'd index this in several ways. First by invoice number, then by date, then by due date, and eventually by abs(amount) descending. Each time, I'd go down the cursor and total it up. I'd stop if it zeroed out at any moment, and marked the scanned records by writing a number in the BindNr field (which served exactly that purpose, and both us and the accountants called it 'the bundle number'). Then in the next scans these records would be skipped. The first pass may catch some; the second may catch some, etc. This took out between 50% and 90% of possible bindings, depending on how precisely (or on precisely how) the payments were made.

Later I added some thresholds. One was the roundoff - any balance below that amount would be automatically credited and debited, which created two records. One would bind, the other would be the remainder, usually carrying the date of the last real record in a bundle. The same threshold applied to scanning - the bundling by amount ignored amounts below this threshold.

At some point (the only date on the version is 1996-09-01) I also had a semi-manual version of this, where the users could manually mark candidate records and bind them with or without remainder. Code handled everything.

On this date there's also an auto_p3.prg, in Acc157, where the debits of a cooperant are closed, it's just that instead of the amount there's now quantity, and instead of invoice number there's the material's code... which isn't even changed in the code, it's just redefined in the header.

A dozen years later I proposed to write something similar but it turned out impossible by definition, because not all invoices are equal. The contractual obligations on them may differ, so an automatic binding may find an old invoice and a recent payment and bind them wrongly, because what was paid was a newer invoice with the same amount but far stricter conditions in case of late payment, including fines. Not all invoices are born equal.

Looking at the logs, one dialog for a report (something about analytics, but also used in this auto_p*.prg) was copied over and over into apps of quite diverse nature - the parameters it was asking for were from customer code to customer code, time period, and whether to start each on a new page or not.

Nowadays it seems incredible that we already took over an DBA customer from that rich village on the border, two of them actually, in the same building - the agricultural production firm* and the cooperation. The farm's was rich and well managed, and their side of the building seems to have been once a castle of the local landlord, about a century old, with tall ceilings and proportionally tall doors, where the handle is not at waist height but rather shoulder, and accordingly large. The work there went smoothly, there weren't any bigger problems, and they paid neatly and on time.

In the other, lower wing of the building, literally one door facing the other, was this cooperation, where we didn't even replace any apps, just kept maintaining DBA's installed ones, including their version of Acc157. By style I'd say it was done by Blaža (there's no dialog for the code of the cooperant for whom a report is to be run, it's typed in command line at a prompt; the report scrolls over the screen and the screen is restored afterwards, all the 1989 tech). The ceilings were low, the floor... planks, strewn with the so-called 'warm floor', which is a bit stronger plastic oilcloth underlaid with a layer of felt, torn long ago and due a replacement for a decade at least. The furniture, some old decrepit desks, which haven't met a brush for years, written off school chairs. Electrical wiring very suspect, the machines 386 (just one, that we sold them) and the rest at least four years old and all of them speak exclusively juski, having the hercules video cards. The personnel wasn't much better, not too literate and not eager to learn anything new, just keep this working and don't change anything.

The only trace that we did anything is a launcher script in Acc157, with my tricks in it (global variables with name, address and phones of the firm, but still no defg.prg), dated sixteenth. Didn't touch the rest, maybe later but this is what remained on my disk. The dates on the files are from june-july 1993.

The director was, as I remember her, a Ličanka, known in the village as an SPS politician, quite likable, must have been gorgeous ten years ago, but later turned out to have a snake in her pocket, paid late and after lots of phone calls. Later some affair emerged, she was involved in some scheme with someone in the end. So the payment, so the maintenance, and we'd barely ever visit them were they not the neighbors of the farm, where we visited gladly and would get the work done quickly, so we'd drop by for a coffee.

Later in the evening, crossed the border over Horgoš into Hungary.

----

* the actual name is „imanje“, literally „a having“ or „a posession“, which implies lots of land with buildings and equipment. Basically a production plant in the fields.


Mentions: 08-III-1992., 19-III-1997., pašteta recipe, Acc157, Blagoje Vrbović (Blaža), DBA, defg.prg, Gemenc, juski, upitig2.prg, VAX (Vaha), in serbian

17-IX-2007 - 1-VIII-2025