[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUe-dev] AppServer - list datatype
From: |
kilo |
Subject: |
[GNUe-dev] AppServer - list datatype |
Date: |
Thu, 21 Oct 2004 18:10:18 +0200 |
Hello folks
Playing with invoicing I decided to store only the net value
of a product and it's VAT percentage. Given these two datae I can
compute the VAT value and the gross value of an invoice item. These
computations are done by calculated fields in the invoice.gcd. There are
3 procedures also, that make up the totals of net, VAT, gross values of
invoice lines. When displaying all these information about an invoice
(with several lines, or better, items), the following calls are done:
getTotalNet Item1.getNet
Item2.getNet
...
ItemX.getNet
return sum(net values)
getTotalVat
Item1.getVAT
Product1.getVatPercent
Item1.getNet
compute vatValue1
return vatValue1
Item2.getVAT
Product2.getVatPercent
Item2.getNet
compute vatValue2
return vatValue2
...
ItemX.getVAT
ProductX.getVatPercent
ItemX.getNet
compute vatValueX
return vatValueX
return sum(VAT values)
getTotalGross
Item1.getGross
Item1.getNet
Item1.getVAT
Product1.getVatPercent
Item1.getNet
compute vatValue1
return vatValue1
compute gross value1
return gross value1
Item1.getGross
Item2.getNet
Item2.getVAT
Product2.getVatPercent
Item2.getNet
compute vatValue2
return vatValue2
compute gross value2
return gross value2
...
ItemX.getGross
ItemX.getNet
ItemX.getVAT
ProductX.getVatPercent
ItemX.getNet
compute vatValueX
return vatValueX
compute gross valueX
return gross valueX
return sum(gross values)
If I could implement procedures, that return 3 values I am interested
in, the above procedure could become much simpler: getTotals
list1 = Item1.getValues
Product1.getVatPercent
Item1.getNet
compute vatValue and gross
return net, vatValue, gross as list
list2 = Item2.getValues
Product2.getVatPercent
Item2.getNet
compute vatValue and gross
return net, vatValue, gross as list
...
listX = ItemX.getValues
ProductX.getVatPercent
ItemX.getNet
compute vatValue and gross
return net, vatValue, gross as list
and here I could sum up the net, vat and gross values stored in
the lists. Or tuples.
As it can be seen on the above example, it would become much more
efficient if procedures could return lists or tuples or dictionaries.
Of course the above example is an example only. It could be solved with
redundant data stored in the DB - which in reality should be done that
way for other reasons also. So it is only an example.
kilo
Kmetykó Gábor
- [GNUe-dev] AppServer - list datatype,
kilo <=