Support A2Billing :

provided by Star2Billing S.L.

Support A2Billing :
It is currently Tue Aug 21, 2018 5:39 pm
Hosted Voice Broadcast


All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Rounding up cost of call
PostPosted: Tue Apr 17, 2018 11:32 am 
Offline

Joined: Tue Apr 17, 2018 11:18 am
Posts: 2
Hi,
I'm using A2Billing v2.2.0, and looking for information about rounding call sell price to 2 digits.
My Rate is:
Image

For 8s duration call, A2B bills it for 0.013 PLN:
Image

I need to round it to 2 digits and bill this call for 0.02 PLN.

Is there any configurable option to do this?
Thx in advice!


Top
 Profile  
 
 Post subject: Re: Rounding up cost of call
PostPosted: Wed Apr 18, 2018 10:04 am 
Offline

Joined: Tue Apr 17, 2018 11:18 am
Posts: 2
I've solved it like that:
Code:
[email protected]:/var/lib/asterisk/agi-bin/lib# diff Misc.php.20180418 Misc.php
36a37,56
>
> //koteckit: rounding up after 2 digits
> //round_up
> //a2b_round_up
> function round_up($value, $places=0)
> {
>     $value=-($value);
>     if ($places < 0) { $places = 0; }
>     $mult = pow(10, $places);
>     $result=-(ceil($value * $mult) / $mult);
>     return $result;
> }
>
> function a2b_round_up($number)
> {
>     $PRECISION = 2;
>
>     return round_up($number, $PRECISION);
> }
>
[email protected]:/var/lib/asterisk/agi-bin/lib# diff Class.RateEngine.php.20180418 Class.RateEngine.php
972c972,976
<         $cost = a2b_round($cost);
---
>         //$A2B->debug(DEBUG, $agi, __FILE__, __LINE__, "[CC_RATE_ENGINE_CALCULCOST_tmptk: K=$K - BUYCOST:$buyratecost - SELLING COST:$cost]");
>         //koteckit: rounding up after 2 digits
>         //$cost = a2b_round($cost);
>         $cost = a2b_round_up($cost);
>         //$A2B->debug(DEBUG, $agi, __FILE__, __LINE__, "[CC_RATE_ENGINE_CALCULCOST_tmptk: K=$K - BUYCOST:$buyratecost - SELLING COST:$cost]");
[email protected]:/var/lib/asterisk/agi-bin/lib#


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 
Auto Dialer Software


All times are UTC


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group