• 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!

TOPIC: calculations from database

calculations from database 5 years 6 months ago #38467

I am Needing some help.


i am setting up another form in which i will select a company from a dropdown (mysql)
select number from company (mysql)
select a new tariff for the number (mysql)
select a new device (mysql)
and also add a new contract term (enter manually)

i am looking to do some maths functions:
Tariff commission + ((40% of tariff value * term) - (40% of tariff value * 19) - hardware cost

i am a bit lost as i have tried to do some simple math functions and nothing is displayed:

//<code>
$option = array();
$option = 'mysqli';
$option = '****';
$option = '****';
$option = '****';
$option = '****';
$option = '';
$db = JDatabase::getInstance( $option );
$query = $db->getQuery(true);
$query = "SELECT talkplan, upfront from tariffs";
$db->setQuery($query);
$results = $db->loadObjectList();
foreach ($results as $result) {
$value = $result->total_upfront;
$label = $result->talkplan_name;
$items[] = $value.'|'.$label;
}

$items = implode("\n", $items);
return $items;
//</code>

Same setup for the Hardware.

In the calculations i have: {Tariff:value} - {Hardware:value}

and nothing shows in the cost field.

any help would be greatly appreciated.
The administrator has disabled public write access.

calculations from database 5 years 6 months ago #38469

ok i have found a calculations guide and it state's that to specify a price for a selection you will have to use the [p] syntax with the numeric value inside the square brackets

how would i add that to the code?

//<code>
$option = array();
$option = 'mysqli';
$option = '*****';
$option = '*****';
$option = '*****';
$option = '*****';
$option = '';
$db = JDatabase::getInstance( $option );
$query = $db->getQuery(true);
$query = "SELECT talkplan_name, total_upfront from tariffs_business";
$db->setQuery($query);
$results = $db->loadObjectList();
foreach ($results as $result) {
$value = $result->total_upfront;
$label = $result->talkplan_name;
$items[] = $value.'|'.$label;

}
$items = implode("\n", $items);
return $items;
//</code>
The administrator has disabled public write access.

calculations from database 5 years 6 months ago #38470

OK i might have a simple fix:

in my database i have created a new column and i have entered all the prices again but this time like this for each tariff and hardware : [p150} ect


now the the simple calc works: {Tariff:value} - {Hardware:value}
The administrator has disabled public write access.
  • 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!