Jump to content

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.