Irish SEO,  Marketing & Webmaster Discussion
 

 

Go Back   Irish SEO, Marketing & Webmaster Discussion > Webmaster Help > Coding Help


Notices

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 22-05-2008, 03:18 PM
Frontpage User
 
Join Date: Aug 2007
Posts: 23
Nominated 0 Times in 0 Posts
TOTW/F/M Award(s): 0
squibs will become famous soon enough
Default Accounting for rounding errors

I posted this as an accountancy question on another forum. Perhaps it is more of a coding issue.

I'm writing an invoicing system in PHP/mySQL at the moment, for my own use, to suit my own business rules. A major premise is that when a quote is accepted, the invoices are generated from that quote, as stage-payment percentages of the overall cost. There can be as many stages as required, each with an abitrary percentage specified (not exceeding 100, obviously).

If I quote somebody for €1075.50 and invoice them in 3 stages for 17%, 50% and 33% of the total, these values work out at
182.83500000
537.75000000 and
354.91500000

On an invoice, I believe nobody issues invoices for a fraction of a penny, so these would be rounded to the penny, giving
182.83
537.75 and
354.91
if I round down giving a total invoiced of 1075.49, and

182.84
537.75 and
354.92
if I round up giving a total invoiced of 1075.51

Both these values differ from the quote value of 1075.50
How can I reconcile the error?


I could calculate when the last invoice had reached 100 percent and make it's value = totalcost - amount already invoiced. But this adds an unwieldy special case with lots of extra programming.

Can anybody suggest a more elegant solution?
__________________
Ones and zeros - which are you?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #2 (permalink)  
Old 31-05-2008, 04:48 PM
d-tour's Avatar
Coder
 
Join Date: Apr 2007
Location: Cork
Posts: 81
Nominated 0 Times in 0 Posts
TOTW/F/M Award(s): 0
d-tour will become famous soon enough
Default

The answer sometimes aint in the software but the way you look at the problem.
value = totalcost - amount is the only way im afraid, but it shouldnt be that much more php.
Just add an extra field in your table for amount paid and update this for every payment.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
coding errors bennyhill Coding Help 3 27-10-2007 04:59 PM
webmaster tools verification errors blacknight Google 4 24-10-2007 09:27 PM
Spamhaus errors blocking my email? ButtermilkJack Server / Technical Administration Tips and Queries 3 07-03-2007 03:42 PM
Accounting Package Amateur The Business Aspects of Web Work 4 29-11-2006 10:26 PM


All times are GMT +1. The time now is 12:25 AM.


Powered by: vBulletin Version 3.7.2, Copyright ©2000 - 2008, Jelsoft Enterprises Limited.

Search Engine Friendly URLs by vBSEO 3.2.0