DEV Community

Odd_Background_328
Odd_Background_328

Posted on

Reconcile Billing Entries by Currency and Unit

Three model entries can describe a charge, a refund and a grant. How much does the account owe? A category count gives you a useful place to start looking, but the answer also depends on the units attached to each entry. This worksheet separates the question about the number of events from the question about their value.

Read the filter definitions

At revision 1c519dd of MonkeyAI, the billing details page lists model, tool, environment and other as category filters. It separately lists charge, grant, reset, refund and adjustment as entry type filters. The two lines establish the filter options. The backend calculation hasn't been verified here. Billing page at the pinned revision

Match four entries to a statement

The evidence for the following exercise is a synthetic export and statement, both version 1. Both cover account T for one complete reporting window. Money is recorded in signed cents. A positive money entry increases the amount due. Credits have a separate balance. The statement reports 100 USD cents, 90 EUR cents and 500 credits.

Entry ID Category Entry type Signed amount Unit
M1 Model Charge +120 USD cents
M2 Model Refund −20 USD cents
T1 Tool Charge +90 EUR cents
M3 Model Grant +500 Credits

Start with the unit column. In USD cents, 120 minus 20 gives 100. EUR cents and credits each have a single entry. Separately tally the categories by counting IDs. The model count includes M3 even though its 500 credits contribute nothing to either currency total.

Compare three cases against the same statement

Each case starts from the four rows above. A difference is the signed total for that unit minus its statement amount.

Change to the export USD cents total / difference EUR cents total / difference Credits total / difference Model entries Tool entries
No edits 100 / 0 90 / 0 500 / 0 3 1
Remove refund M2 120 / +20 90 / 0 500 / 0 2 1
Change M1 to +130 and M2 to −30 100 / 0 90 / 0 500 / 0 3 1

The missing-refund case tells the reviewer to inspect USD postings. A cutoff that excluded a late refund could show the same difference. Check the event time against the statement window before blaming the calculation. In the final case every displayed total and count matches the baseline, yet two signed amounts changed. Comparing M1 and M2 individually against the original export identifies both changes.

This article was generated with AI assistance. The team preparing material on MonkeyAI commissioned this article.

Top comments (0)