Build logic: Invoice detail columns

From Catglobe Wiki
Jump to: navigation, search



Build logic: Invoice detail columns

When we are generating caches for invoices it is important that we understand one major difference -- caches may have more than one row per invoice! This will happen when we choose to include columns that take information from the invoice detail records. The number of rows in our cache that an invoice will create will then be one for each invoice detail record that exists in the invoice.

The columns that belong to the invoice details are:

Below is a small example, where we choose to make a resource cache with just IDs of six invoice resources.

RCS58-1

As you will notice, the addition of six invoices will create six rows in our resource cache, since we have not added any invoice detail columns.

Now let us try to add the 'Cost' column, which is one of the invoice detail columns, and see what will happen.

RCS58-2

Now, with the same number of included resources, we have seven rows rather than only six as before. If we look at the data, we will see that the invoice with Id = 85007 actually possesses two rows. The reason is that it needs to show information from two invoice detail records that exist in it. The other 5 invoices obviously only has one detail invoice record each and do therefore not need an extra row to present their information.

It is therefore important to understand which data relates to invoice details and which relates to the invoice. Invoice detail information will always only be shown once in a resource cache, whereas invoice information may be shown multiple times if the invoice has more than one detail invoice row.