Reconcile split invoice payments
Partial payments and overpayments must remain distinguishable when an invoice is reconciled. Two invoice lines total 300 minor units. The payments total 325, leaving 25 as credit.
Run the framework with your own input
Install Blyx 0.2.1 and a Rust toolchain with a host linker, then run the versioned project. Each positional argument is a number or a comma-separated numerical vector. The CLI accepts up to 16 entries per vector. The imported module accepts longer inputs.
git clone --depth 1 --branch v0.1.1 https://github.com/Rahulchaube1/blyx-ibis.git
cd blyx-ibis
blyxc native-run project.blyx -- "2,1" "125,50" "200,125"API and return values
Returns [subtotal, applied payment, open balance, credit]. Use a single currency and already-posted amounts. Invalid input returns an empty vector.
| Argument | Accepted input |
|---|---|
| units | Vector of: nonnegative exact integer |
| prices | Vector of: nonnegative exact integer |
| payments | Vector of: nonnegative exact integer |
Use the libraries independently
The framework vendors the same library source published in these two repositories. Each module has its own package page, input contract and regression suite.
Try the program
Expected output
300 300 0 25
Practice
Change units = [2], prices = [10], payments = [4]. Predict the result, then run the program.
Hint
Returns [subtotal, applied payment, open balance, credit]. Use a single currency and already-posted amounts.
Worked solution
The result vector is [20, 4, 16, 0]. Compare its fields with the return layout in the API section.
Find
let units = [2, 1];Replace with
let units = [2];Find
let prices = [125, 50];Replace with
let prices = [10];Find
let payments = [200, 125];Replace with
let payments = [4];Output after the change
20 4 16 0
