dolibarr-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Dolibarr-dev] Question about Price column into llx_facturedet and M


From: Laurent Destailleur (eldy)
Subject: Re: [Dolibarr-dev] Question about Price column into llx_facturedet and Margin Module
Date: Fri, 03 May 2013 11:21:59 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130308 Thunderbird/17.0.4

I submit into comment of your pull request the way to change calculation
into request to have good value.


Le 03/05/2013 11:19, Florian Henry a écrit :
> Ok, but the calculation of marge is done into SQL request.
> I'll fix it.
>
> Regards.
>
> Florian HENRY
> address@hidden
> +33 6 03 76 48 07
> http://www.open-concept.pro
> Twitter : @_Open_Concept_
>
> Le 03/05/2013 11:05, Laurent Destailleur (eldy) a écrit :
>> Le 03/05/2013 10:37, Florian Henry a écrit :
>>> Hello all,
>>>
>>>      I'm currently bugs hunting and I try the margin module. I fix some
>>> little thing, but my question is more about usage of "price" column
>>> into llx_facturedet.
>>>
>>>      In margin module the column llx_facturedet.price is use to
>>> calculated the margin per invoice line. But this column is always
>>> empty, (NULL) since 3.2 as I see.
>>>      This column description into
>>> htdocs/install/mysql/table/llx_facturedet.sql we have this comment
>>> price   double(24,8), -- P.U. HT apres remise % de ligne (Unit price
>>> afer % discount per line)
>>>
>>>      I cannot see anywhere line of code that update this column (in 3.3
>>> or in 3.4) Did I miss something ?
>>>
>>>      So if we have to change it, how do we do that ? put in this column
>>> a relevant information or calculated the margin on total_ht or on
>>> subprice ?
>>>
>>> Regards
>>>
>> Yes, the field price is no more update since 3.2.
>> This is because value inside this field was always wrong due to rounding
>> rules (qty * price was sometimes not equal to total_ht) and was used
>> sometimes by some code, this was making calculation wrong.
>> Reliable field are:   qty, total_ht, total_ttc, subprice
>> I think you should find or be able to make calculation of what margin
>> module need with this field.
>> I think (if you need a unit price with a percent discount) you can use:
>> price2num(total_ht / qty, 'MU')  to get value you need. Storing this
>> value into database is not recommanded as it is a duplicate information
>> that lead to not coherent data (depending on rounding rule you want,
>> value will differs).
>> So it is better to calcucate it dynamically when you need a "Unit price
>> that include the % discount". But not that you must not multiplicate
>> this field with qty, result will be wrong, you must use total_xxx field
>> instead if you need total price on line that include the % discount.
>>
>>
>>
>
>
> _______________________________________________
> Dolibarr-dev mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/dolibarr-dev


-- 
Eldy (Laurent Destailleur).

EMail: address@hidden
Web: http://www.destailleur.fr

Dolibarr (Project leader): http://www.dolibarr.org
To make a donation for Dolibarr project via Paypal: address@hidden
AWStats (Author) : http://awstats.sourceforge.net
To make a donation for AWStats project via Paypal: address@hidden
AWBot (Author) : http://awbot.sourceforge.net
CVSChangeLogBuilder (Author) : http://cvschangelogb.sourceforge.net




reply via email to

[Prev in Thread] Current Thread [Next in Thread]