Jump to content

Subtracting from invoice total


esoteric

Recommended Posts

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

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.