On Tue, Feb 7, 2012 at 2:00 AM, herman vierendeels <
[email protected]> wrote:
> Hello Chris,
>
> One last general question.
>
> When a db-field can easily be calculated from another db-field, why
> should we store it ?
>
> Like in OE.pm:
> decimalplaces is re-calculated from fetched sellprice. (not set from
> also fetched precision)
> ($decimalplaces) = ( $ref->{sellprice} =~ /\.(\d+)/ );
>
It's not always easily calculated. Here's the problem:
enter unit price of 4.0000000 to force discount rounding to a high
precision.
db stores '4'
Trailing zeroes are not stored in a numeric field. So ideally we keep the
greater of the decimal places or the stored precision.
Best Wishes,
Chris Travers
>
> Best Wishes,
> Herman
>
> 2012/2/3 Chris Travers <[email protected]>:
> >
> >
> > On Fri, Feb 3, 2012 at 3:36 AM, Chris Travers <[email protected]>
> > wrote:
> >>
> >>
> >>
> >> On Fri, Feb 3, 2012 at 3:26 AM, herman vierendeels
> >> <[email protected]> wrote:
> >>>
> >>> yes, i agree, the field precision is fetched from db; but , as far as
> >>> i can see, never used!
> >>>
> >> The old code is hard to follow but from there it goes onto the $ref
> >> hashrefs that get pushed onto @{$form->{form_details}} and from there
> these
> >> get expanded to $form->{...._$i} (i.e. $form->{"precision_$i"}.
> >>
> > BTW, this is an important reason to replace the old code.
> >
> > Best Wishes,
> > Chris Travers
> >
> >
> ------------------------------------------------------------------------------
> > Try before you buy = See our experts in action!
> > The most comprehensive online learning library for Microsoft developers
> > is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
> > Metro Style Apps, more. Free future releases when you subscribe now!
> > http://p.sf.net/sfu/learndevnow-dev2
> > _______________________________________________
> > Ledger-smb-devel mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/ledger-smb-devel
> >
>
>
> ------------------------------------------------------------------------------
> Keep Your Developer Skills Current with LearnDevNow!
> The most comprehensive online learning library for Microsoft developers
> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
> Metro Style Apps, more. Free future releases when you subscribe now!
> http://p.sf.net/sfu/learndevnow-d2d
> _______________________________________________
> Ledger-smb-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/ledger-smb-devel
>
------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
Ledger-smb-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ledger-smb-devel