[Gambas-user] Financial program

Benoît Minisini gambas at ...1...
Mon Dec 14 21:45:09 CET 2009


> Benoît Minisini a écrit :
> >> Benoît Minisini a écrit :
> >>>> Fabien Bodard a écrit :
> >>>>> you have Laurux at http://laurux.fr/
> >>>>>
> >>>>> but the code is not perfect has it was on the start a code learning
> >>>>> programme.. but at the end it's a true accounting program... in
> >>>>> french (Gb2)
> >>>>
> >>>> BTW, do you plan to have an equivalent of postgresql or python
> >>>> decimal(n,n) into GB3?
> >>>> It would be *very* interesting (otherwise you have to filter every
> >>>> line through Format$)
> >>>>
> >>>> JY
> >>>
> >>> You mean a fixed-point decimal datatype? Or a currency datatype?
> >>
> >> A fixed-point decimal
> >>
> >>> It cannot be done in Gambas 3. So, in Gambas 4 ?
> >>
> >> Hu?
> >> That's too bad because it is needed to ease accounting purposes.
> >
> > Why not storing currencies in cents, or fraction of cents, with a Long
> > datatype?
> 
> No, this is the best way to make mistakes (ie: invoice hardware with
> 2 decimals, but invoice telephone seconds with 8 & connections w/ 3 or 4
> on the same invoice, oeuf corse).
> 
> Format$ is not very useful because of conversions it involves.
> 
> Using integer arithmetics is muuuch tooo slooow.
> 
> So the less worse is still Format$.
> 

I think you are mixing a lot of different things:

- When storing a amount of money in memory, you store it in a Long integer in 
1/10th of cents. For example, storing 1234,56€ will be stored as 1234560.

- When displaying an amount of money, you use Format$(), or your own function.

- When getting an amount of money from the user, you have to convert a string 
into an amount of 1/10th of cents.

- When getting an amount of money from the outside, or exporting an amount of 
money to the outside, you must use an standard exchange format based on a 
string.

So I don't see any problem with that. Why are you talking about telephone 
seconds? We are talking about money, aren't we? Or there is something I didn't 
understand?

-- 
Benoît Minisini




More information about the User mailing list