Closed Rafe closed 13 years ago
Jimmy, I changed the precision format when data got selected. However I think it might not be a good way to do this, no matter which one is doing this process: MySQL (currently used), PHP or JS since this is inefficient and slow down the service. I'm thinking maybe we can pre-define the precision in the database? may be all of them could be decimal(10, 2)? what do you think?
yeah. I think it's the best solution. and please notice that tax column should be able to take care .4 digits. (0.0875) so either wrap it(like times 100 before save,eg: save as 8.75) or set differently (to decimal(10,4) ) will be needed.
2011/7/18 yaxing < reply@reply.github.com>
Jimmy, I changed the precision format when data got selected. However I think it might not be a good way to do this, no matter which one is doing this process: MySQL (currently used), PHP or JS since this is inefficient and slow down the service. I'm thinking maybe we can pre-define the precision in the database? may be all of them could be decimal(10, 2)? what do you think?
Reply to this email directly or view it on GitHub:
https://github.com/gpryzby-wtt/Masxaro-Prototype/issues/19#issuecomment-1596030
I'm sorry which is the best solution? Limit the precision in database (maybe trailing 0s) or process the selected result?
I think limit the precision with .2 and save tax with percentage like 8.75 is best
2011/7/18 yaxing < reply@reply.github.com>
I'm sorry which is the best solution? Limit the precision in database (maybe trailing 0s) or process the selected result?
Reply to this email directly or view it on GitHub:
https://github.com/gpryzby-wtt/Masxaro-Prototype/issues/19#issuecomment-1598163
ok
Database has been updated, code has been updated. For now tax, discount, price are all decimal(10,2), tax, discount are percentage from 0 - 100
check the calculation in insert receipt, line 224 should change to
$totalCost += $totalCost * 0.01 * $basicInfo['tax'];
The number is showing to much 0 after dot, Please change the precision of price columns to 2, except for tax.
I can change format in front-end, but I think change in database type is simpler (for me)
about the precision of tax calculation, round up to the closest penny is the way that vendor use, so precision in 2 is okay.