esoteric Posted February 12, 2012 Share Posted February 12, 2012 Hi, im trying to work out a point based credit system on my site but require your expertise, The variable containing the total price of the invoice is called $TOTAL The amount of credit points a user has is saved as $credit My credit 'exchange' rate is 1000 credit points equal to £1 So my question is how do i go about subtracting the correct value from my total? I assume i have to divide the $credit variable by 1000 then do i simply just subtract this from the total? So something like // 1000 points £1 $credit_value = $credit / 1000; // set new total - credits $REDUCED_TOTAL = $TOTAL - $credit_value; or am i miles off? Thanks very much for any help, i urgently need to get this fixed. Link to comment https://forums.phpfreaks.com/topic/256976-subtracting-from-invoice-total/ Share on other sites More sharing options...
AyKay47 Posted February 13, 2012 Share Posted February 13, 2012 this seems more like a common sense question, simple math. Have you tried your solution? Was the value what you expected? There are factors that may go into this as well: 1. are the credit values rounded? e.g if I have 1,500 credits would that equal 2 credit points? 2. is the total rounded? please explain the requirements more thoroughly. Link to comment https://forums.phpfreaks.com/topic/256976-subtracting-from-invoice-total/#findComment-1317400 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.