function addUnbilled($peer, $leg = null) { $objResponse = new xajaxResponse(); if ($_SESSION['curuser']['groupid'] == "") { return $objResponse; } $records = astercc::readUnbilled($peer, $leg, $_SESSION['curuser']['groupid']); if ($leg != null) { $peer = 'local/' . $peer; } $totalprice = 0; while ($records->fetchInto($mycdr)) { $price = ''; $ratedesc = ''; //$rate = astercc::readRate($mycdr['dst'],$_SESSION['curuser']['groupid']); $jsscript = "cdr = new Array();"; $ratedesc = astercc::readRateDesc($mycdr['memo']) . ' '; if ($price == '') { $price = 0; } $mycdr['destination'] .= ' '; $totalprice += $mycdr['credit']; $jsscript .= "cdr['id'] = '" . $mycdr['id'] . "';"; $jsscript .= "cdr['clid'] = '" . $mycdr['clid'] . "';"; //check it is inbound or outbound for show Phone in booth if ($mycdr['src'] == $peer) { $jsscript .= "cdr['dst'] = '" . $mycdr['dst'] . "';"; $jsscript .= "cdr['direction'] = 'outbound';"; } else { $jsscript .= "cdr['dst'] = '" . $mycdr['src'] . "';"; $jsscript .= "cdr['direction'] = 'inbound';"; } $jsscript .= "cdr['startat'] = '" . $mycdr['calldate'] . "';"; $jsscript .= "cdr['billsec'] = '" . $mycdr['billsec'] . "';"; $jsscript .= "cdr['destination'] = '" . $mycdr['destination'] . "';"; $jsscript .= "cdr['rate'] = '" . $ratedesc . "';"; $jsscript .= "cdr['price'] = '" . astercc::creditDigits($mycdr['credit']) . "';"; $jsscript .= "appendTr('" . $peer . "-calllog-tbody',cdr);"; $objResponse->addAssign($peer . "-displayname", "style.backgroundColor", "#ff0000"); $objResponse->addScript($jsscript); } $objResponse->addAssign($peer . "-price", "innerHTML", $totalprice); $objResponse->addAssign($peer . "-unbilled", "innerHTML", $totalprice); $objResponse->addScript("calculateBalance('" . $peer . "')"); return $objResponse; }
function listCDR($aFormValues) { global $locate, $config; $reseller = astercrm::getAll('resellergroup'); while ($reseller->fetchInto($row)) { $id = $row['id']; $reseller_arr[$id] = $row['resellername']; } $group = astercrm::getAll('accountgroup'); while ($group->fetchInto($row)) { $id = $row['id']; $group_arr[$id] = $row['groupname']; } $objResponse = new xajaxResponse(); $objResponse->addAssign("divMsg", "style.visibility", "hidden"); if ($aFormValues['sltBooth'] == '' && $aFormValues['hidCurpeer'] != '') { $aFormValues['sltBooth'] = $aFormValues['hidCurpeer']; } list($syear, $smonth, $sday, $stime) = split("[ -]", $aFormValues['sdate']); $syear = (int) $syear; $smonth = (int) $smonth; $sday = (int) $sday; list($shours, $smins) = split("[ :]", $stime); $shours = (int) $shours; if ($shours == 0) { $shours = '00'; } $smins = (int) $smins; if ($smins == 0) { $smins = '00'; } list($eyear, $emonth, $eday, $etime) = split("[ -]", $aFormValues['edate']); $eyear = (int) $eyear; $emonth = (int) $emonth; $eday = (int) $eday; list($ehours, $emins) = split("[ :]", $etime); $ehours = (int) $ehours; if ($ehours == 0) { $ehours = '00'; } $emins = (int) $emins; if ($emins == 0) { $emins = '00'; } $ary = array(); if ($aFormValues['reporttype'] == "text") { $aFormValues['sdate'] = $syear . "-" . $smonth . "-" . $sday . ' ' . $shours . ':' . $smins; $aFormValues['edate'] = $eyear . "-" . $emonth . "-" . $eday . ' ' . $ehours . ':' . $emins; } else { $aFormValues['sdate'] = $syear . "-" . $smonth . "-" . $sday; $aFormValues['edate'] = $eyear . "-" . $emonth . "-" . $eday; } if ($aFormValues['listType'] == "none") { $res = astercc::readReport($aFormValues['resellerid'], $aFormValues['groupid'], $aFormValues['sltBooth'], $aFormValues['sdate'], $aFormValues['edate']); $answeredNum = astercc::readAnsweredNum($aFormValues['resellerid'], $aFormValues['groupid'], $aFormValues['sltBooth'], $aFormValues['sdate'], $aFormValues['edate']); $a2bcost = -1; if ($config['a2billing']['enable']) { $a2bcost = Customer::readA2Breport($aFormValues['resellerid'], $aFormValues['groupid'], $aFormValues['sltBooth'], $aFormValues['sdate'], $aFormValues['edate']); } if ($res->fetchInto($myreport)) { $result = parseReport($myreport, $answeredNum, $a2bcost); $html .= $result['html']; } $objResponse->addAssign("divUnbilledList", "innerHTML", $html); return $objResponse; } elseif ($aFormValues['listType'] == "sumyear") { if ($aFormValues['reporttype'] == "flash") { $objResponse->addScript("actionFlash('" . $aFormValues["resellerid"] . "','" . $aFormValues["groupid"] . "','" . $aFormValues["sltBooth"] . "','" . $aFormValues["sdate"] . "','" . $aFormValues["edate"] . "','" . $aFormValues["listType"] . "','" . $aFormValues["hidCurpeer"] . "');"); $html = ""; } else { for ($year = $syear; $year <= $eyear; $year++) { $res = astercc::readReport($aFormValues['resellerid'], $aFormValues['groupid'], $aFormValues['sltBooth'], "{$year}-1-1 00:00:00", "{$year}-12-31 23:59:59"); $answeredNum = astercc::readAnsweredNum($aFormValues['resellerid'], $aFormValues['groupid'], $aFormValues['sltBooth'], "{$year}-1-1 00:00:00", "{$year}-12-31 23:59:59"); $a2bcost = -1; if ($config['a2billing']['enable']) { $a2bcost = Customer::readA2Breport($aFormValues['resellerid'], $aFormValues['groupid'], $aFormValues['sltBooth'], "{$year}-1-1 00:00:00", "{$year}-12-31 23:59:59"); } if ($res->fetchInto($myreport)) { $html .= "<div class='box'>"; $html .= "{$year} :<br/>"; $html .= "<div>"; $result = parseReport($myreport, $answeredNum, $a2bcost); $html .= $result['html']; $html .= "</div>"; $html .= "</div>"; $ary['recordNum'] += $result['data']['recordNum']; $ary['seconds'] += $result['data']['seconds']; $ary['credit'] += $result['data']['credit']; $ary['callshopcredit'] += $result['data']['callshopcredit']; $ary['resellercredit'] += $result['data']['resellercredit']; $ary['billsec_leg_a'] += $myreport['billsec_leg_a']; $answeredNumTotal += $answeredNum; if ($config['a2billing']['enable']) { $a2bcostTotal += $a2bcost; } } } if (!$config['a2billing']['enable']) { $a2bcostTotal = -1; } $html .= "<div class='box'>"; $html .= "total :<br/>"; $html .= "<div>"; $result = parseReport($ary, $answeredNumTotal, $a2bcostTotal); $html .= $result['html']; $html .= "</div>"; $html .= "</div>"; $html .= "<div style='clear:both;'></div>"; $objResponse->addAssign("divUnbilledList", "innerHTML", $html); } return $objResponse; } elseif ($aFormValues['listType'] == "summonth") { if ($aFormValues['reporttype'] == "flash") { $objResponse->addScript("actionFlash('" . $aFormValues["resellerid"] . "','" . $aFormValues["groupid"] . "','" . $aFormValues["sltBooth"] . "','" . $aFormValues["sdate"] . "','" . $aFormValues["edate"] . "','" . $aFormValues["listType"] . "','" . $aFormValues["hidCurpeer"] . "');"); } else { //for ($year = $syear; $year<=$eyear;$year++){ $year = $syear; for ($month = 1; $month <= 12; $month++) { $res = astercc::readReport($aFormValues['resellerid'], $aFormValues['groupid'], $aFormValues['sltBooth'], "{$year}-{$month}-1 00:00:00", "{$year}-{$month}-31 23:59:59"); $answeredNum = astercc::readAnsweredNum($aFormValues['resellerid'], $aFormValues['groupid'], $aFormValues['sltBooth'], "{$year}-{$month}-1 00:00:00", "{$year}-{$month}-31 23:59:59"); $a2bcost = -1; if ($config['a2billing']['enable']) { $a2bcost = Customer::readA2Breport($aFormValues['resellerid'], $aFormValues['groupid'], $aFormValues['sltBooth'], "{$year}-{$month}-1 00:00:00", "{$year}-{$month}-31 23:59:59"); } if ($res->fetchInto($myreport)) { $html .= "<div class='box'>"; $html .= "{$year}-{$month} :<br/>"; $html .= "<div>"; $result = parseReport($myreport, $answeredNum, $a2bcost); $html .= $result['html']; $html .= "</div>"; $html .= "</div>"; $ary['recordNum'] += $result['data']['recordNum']; $ary['seconds'] += $result['data']['seconds']; $ary['credit'] += $result['data']['credit']; $ary['callshopcredit'] += $result['data']['callshopcredit']; $ary['resellercredit'] += $result['data']['resellercredit']; $answeredNumTotal += $answeredNum; if ($config['a2billing']['enable']) { $a2bcostTotal += $a2bcost; } } } //} if (!$config['a2billing']['enable']) { $a2bcostTotal = -1; } $html .= "<div class='box'>"; $html .= "total :<br/>"; $html .= "<div>"; $result = parseReport($ary, $answeredNumTotal, $a2bcostTotal); $html .= $result['html']; $html .= "</div>"; $html .= "</div>"; $html .= "<div style='clear:both;'></div>"; $objResponse->addAssign("divUnbilledList", "innerHTML", $html); } return $objResponse; } elseif ($aFormValues['listType'] == "sumday") { if ($aFormValues['reporttype'] == "flash") { $objResponse->addScript("actionFlash('" . $aFormValues["resellerid"] . "','" . $aFormValues["groupid"] . "','" . $aFormValues["sltBooth"] . "','" . $aFormValues["sdate"] . "','" . $aFormValues["edate"] . "','" . $aFormValues["listType"] . "','" . $aFormValues["hidCurpeer"] . "');"); } else { for ($day = $sday; $day <= 31; $day++) { $res = astercc::readReport($aFormValues['resellerid'], $aFormValues['groupid'], $aFormValues['sltBooth'], "{$syear}-{$smonth}-{$day} 00:00:00", "{$syear}-{$smonth}-{$day} 23:59:59"); $answeredNum = astercc::readAnsweredNum($aFormValues['resellerid'], $aFormValues['groupid'], $aFormValues['sltBooth'], "{$syear}-{$smonth}-{$day} 00:00:00", "{$syear}-{$smonth}-{$day} 23:59:59"); $a2bcost = -1; if ($config['a2billing']['enable']) { $a2bcost = Customer::readA2Breport($aFormValues['resellerid'], $aFormValues['groupid'], $aFormValues['sltBooth'], "{$syear}-{$smonth}-{$day} 00:00:00", "{$syear}-{$smonth}-{$day} 23:59:59"); } if ($res->fetchInto($myreport)) { $html .= "<div class='box'>"; $html .= "{$syear}-{$smonth}-{$day} :<br/>"; $html .= "<div>"; $result = parseReport($myreport, $answeredNum, $a2bcost); $html .= $result['html']; $html .= "</div>"; $html .= "</div>"; $ary['recordNum'] += $result['data']['recordNum']; $ary['seconds'] += $result['data']['seconds']; $ary['credit'] += $result['data']['credit']; $ary['callshopcredit'] += $result['data']['callshopcredit']; $ary['resellercredit'] += $result['data']['resellercredit']; $answeredNumTotal += $answeredNum; if ($config['a2billing']['enable']) { $a2bcostTotal += $a2bcost; } } } if (!$config['a2billing']['enable']) { $a2bcostTotal = -1; } $html .= "<div class='box'>"; $html .= "total :<br/>"; $html .= "<div>"; $result = parseReport($ary, $answeredNumTotal, $a2bcostTotal); $html .= $result['html']; $html .= "</div>"; $html .= "</div>"; $html .= "<div style='clear:both;'></div>"; $objResponse->addAssign("divUnbilledList", "innerHTML", $html); } return $objResponse; } elseif ($aFormValues['listType'] == "sumhour") { if ($aFormValues['reporttype'] == "flash") { $objResponse->addScript("actionFlash('" . $aFormValues["resellerid"] . "','" . $aFormValues["groupid"] . "','" . $aFormValues["sltBooth"] . "','" . $aFormValues["sdate"] . "','" . $aFormValues["edate"] . "','" . $aFormValues["listType"] . "','" . $aFormValues["hidCurpeer"] . "');"); } else { for ($hour = 0; $hour <= 23; $hour++) { $res = astercc::readReport($aFormValues['resellerid'], $aFormValues['groupid'], $aFormValues['sltBooth'], "{$syear}-{$smonth}-{$sday} {$hour}:00:00", "{$syear}-{$smonth}-{$sday} {$hour}:59:59"); $answeredNum = astercc::readAnsweredNum($aFormValues['resellerid'], $aFormValues['groupid'], $aFormValues['sltBooth'], "{$syear}-{$smonth}-{$sday} {$hour}:00:00", "{$syear}-{$smonth}-{$sday} {$hour}:59:59"); $a2bcost = -1; if ($config['a2billing']['enable']) { $a2bcost = Customer::readA2Breport($aFormValues['resellerid'], $aFormValues['groupid'], $aFormValues['sltBooth'], "{$syear}-{$smonth}-{$sday} {$hour}:00:00", "{$syear}-{$smonth}-{$sday} {$hour}:59:59"); } if ($res->fetchInto($myreport)) { $html .= "<div class='box'>"; $html .= "{$syear}-{$smonth}-{$sday} {$hour}:<br/>"; $html .= "<div>"; $result = parseReport($myreport, $answeredNum, $a2bcost); $html .= $result['html']; $html .= "</div>"; $html .= "</div>"; $ary['recordNum'] += $result['data']['recordNum']; $ary['seconds'] += $result['data']['seconds']; $ary['credit'] += $result['data']['credit']; $ary['callshopcredit'] += $result['data']['callshopcredit']; $ary['resellercredit'] += $result['data']['resellercredit']; $answeredNumTotal += $answeredNum; if ($config['a2billing']['enable']) { $a2bcostTotal += $a2bcost; } } } if (!$config['a2billing']['enable']) { $a2bcostTotal = -1; } $html .= "<div class='box'>"; $html .= "total :<br/>"; $html .= "<div>"; $result = parseReport($ary, $answeredNumTotal, $a2bcostTotal); $html .= $result['html']; $html .= "</div>"; $html .= "</div>"; $html .= "<div style='clear:both;'></div>"; $objResponse->addAssign("divUnbilledList", "innerHTML", $html); } return $objResponse; } elseif ($aFormValues['listType'] == "sumdest") { $res = astercc::readReport($aFormValues['resellerid'], $aFormValues['groupid'], $aFormValues['sltBooth'], $aFormValues['sdate'], $aFormValues['edate'], 'destination'); $html .= '<form action="" name="f" id="f">'; $html .= '<table width="99%">'; if ($_SESSION['curuser']['usertype'] == 'admin' || $_SESSION['curuser']['usertype'] == 'reseller') { $html .= '<tr> <td width="60"></td> <td width="160">' . $locate->Translate("Destination") . '</td> <td width="120">' . $locate->Translate("Calls") . '</td> <td width="120">' . $locate->Translate("Billsec") . '</td> <td width="120">' . $locate->Translate("Sells") . '</td> <td width="70">' . $locate->Translate("Callshop Cost") . '</td> <td width="90">' . $locate->Translate("Reseller Cost") . '</td> <td width="90">' . $locate->Translate("Markup") . '</td> </tr>'; } else { if ($_SESSION['curuser']['usertype'] == 'groupadmin') { $html .= '<tr> <td width="60"></td> <td width="160">' . $locate->Translate("Destination") . '</td> <td width="120">' . $locate->Translate("Calls") . '</td> <td width="120">' . $locate->Translate("Billsec") . '</td> <td width="120">' . $locate->Translate("Sells") . '</td> <td width="70">' . $locate->Translate("Callshop Cost") . '</td> <td width="90">' . $locate->Translate("Markup") . '</td> </tr>'; } else { if ($_SESSION['curuser']['usertype'] == 'operator') { $html .= '<tr> <td width="60"></td> <td width="160">' . $locate->Translate("Destination") . '</td> <td width="120">' . $locate->Translate("Calls") . '</td> <td width="120">' . $locate->Translate("Billsec") . '</td> <td width="120">' . $locate->Translate("Sells") . '</td> </tr>'; } } } while ($res->fetchInto($row)) { if ($_SESSION['curuser']['usertype'] == 'admin' || $_SESSION['curuser']['usertype'] == 'reseller') { $html .= '<tr> <td width="60"></td> <td width="160">' . $row['destination'] . '</td> <td width="120">' . $row['recordNum'] . '</td> <td width="120">' . astercrm::FormatSec($row['seconds']) . '</td> <td width="120">' . $row['credit'] . '</td> <td width="120">' . $row['callshopcredit'] . '</td> <td width="120">' . $row['resellercredit'] . '</td> <td width="120">' . ($row['callshopcredit'] - $row['resellercredit']) . '</td> </tr>'; } else { if ($_SESSION['curuser']['usertype'] == 'groupadmin') { $html .= '<tr> <td width="60"></td> <td width="160">' . $row['destination'] . '</td> <td width="120">' . $row['recordNum'] . '</td> <td width="120">' . astercrm::FormatSec($row['seconds']) . '</td> <td width="120">' . $row['credit'] . '</td> <td width="120">' . $row['callshopcredit'] . '</td> <td width="120">' . ($row['credit'] - $row['callshopcredit']) . '</td> </tr>'; } else { if ($_SESSION['curuser']['usertype'] == 'operator') { $html .= '<tr> <td width="60"></td> <td width="160">' . $row['destination'] . '</td> <td width="120">' . $row['recordNum'] . '</td> <td width="120">' . astercrm::FormatSec($row['seconds']) . '</td> <td width="120">' . $row['credit'] . '</td> </tr>'; } } } } $html .= '</table>'; $html .= '</form>'; if ($_SESSION['curuser']['usertype'] == 'admin' || $_SESSION['curuser']['usertype'] == 'reseller') { if ($aFormValues['reporttype'] == "flash") { $objResponse->addScript("actionPie1('" . $aFormValues["resellerid"] . "','" . $aFormValues["groupid"] . "','" . $aFormValues["sltBooth"] . "','" . $aFormValues["sdate"] . "','" . $aFormValues["edate"] . "','" . $aFormValues["listType"] . "','" . $aFormValues["hidCurpeer"] . "');"); $html = ''; } else { $objResponse->addAssign("divUnbilledList", "innerHTML", $html); } } else { if ($_SESSION['curuser']['usertype'] == 'groupadmin') { if ($aFormValues['reporttype'] == "flash") { $objResponse->addScript("actionPie2('" . $aFormValues["resellerid"] . "','" . $aFormValues["groupid"] . "','" . $aFormValues["sltBooth"] . "','" . $aFormValues["sdate"] . "','" . $aFormValues["edate"] . "','" . $aFormValues["listType"] . "','" . $aFormValues["hidCurpeer"] . "');"); $html = ''; } else { $objResponse->addAssign("divUnbilledList", "innerHTML", $html); } } else { if ($_SESSION['curuser']['usertype'] == 'operator') { if ($aFormValues['reporttype'] == "flash") { $objResponse->addScript("actionPie3('" . $aFormValues["resellerid"] . "','" . $aFormValues["groupid"] . "','" . $aFormValues["sltBooth"] . "','" . $aFormValues["sdate"] . "','" . $aFormValues["edate"] . "','" . $aFormValues["listType"] . "','" . $aFormValues["hidCurpeer"] . "');"); $html = ''; } else { $objResponse->addAssign("divUnbilledList", "innerHTML", $html); } } } } return $objResponse; } elseif ($aFormValues['listType'] == "sumgroup") { if ($aFormValues['reporttype'] == "flash") { $objResponse->addScript("actionPieGroup('" . $aFormValues["resellerid"] . "','" . $aFormValues["groupid"] . "','" . $aFormValues["sltBooth"] . "','" . $aFormValues["sdate"] . "','" . $aFormValues["edate"] . "','" . $aFormValues["listType"] . "','" . $aFormValues["hidCurpeer"] . "');"); } else { $res = astercc::readReportPie($aFormValues['resellerid'], $aFormValues['groupid'], $aFormValues['sltBooth'], $aFormValues['sdate'], $aFormValues['edate'], 'destination', $aFormValues['action'], 'limit'); while ($res->fetchInto($row)) { $iid = $row['gid']; if ($aFormValues['resellerid'] == 0 || $aFormValues['resellerid'] == '') { $title = "" . $reseller_arr[$iid]; } else { if ($aFormValues['groupid'] == 0 || $aFormValues['groupid'] == '') { $title = "" . $group_arr[$iid]; } else { $title = "" . $iid; } } $html .= "<div class='box'>"; $html .= "{$title} :<br/>"; $html .= "<div>"; $result = parseReport($row); $html .= $result['html']; $html .= "</div>"; $html .= "</div>"; $ary['recordNum'] += $result['data']['recordNum']; $ary['seconds'] += $result['data']['seconds']; $ary['credit'] += $result['data']['credit']; $ary['callshopcredit'] += $result['data']['callshopcredit']; $ary['resellercredit'] += $result['data']['resellercredit']; } $html .= "<div class='box'>"; $html .= "total :<br/>"; $html .= "<div>"; $result = parseReport($ary); $html .= $result['html']; $html .= "</div>"; $html .= "</div>"; $html .= "<div style='clear:both;'></div>"; $objResponse->addAssign("divUnbilledList", "innerHTML", $html); } return $objResponse; } $records = astercc::readAll($aFormValues['resellerid'], $aFormValues['groupid'], $aFormValues['sltBooth'], $aFormValues['sdate'], $aFormValues['edate']); $html .= '<form action="" name="f" id="f">'; $html .= '<table width="99%">'; $html .= '<tr> <td width="60"></td> <td width="120">' . $locate->Translate("Calldate") . '</td> <td width="120">' . $locate->Translate("Clid") . '</td> <td width="120">' . $locate->Translate("Dst") . '</td> <td width="70">' . $locate->Translate("Duration") . '</td> <td width="90">' . $locate->Translate("Disposition") . '</td> <td width="70">' . $locate->Translate("Billsec") . '</td> <td width="160">' . $locate->Translate("Destination") . '</td> <td width="360">' . $locate->Translate("Rate") . '</td> <td width="120">' . $locate->Translate("Price") . '</td> <td width="70">' . $locate->Translate("Status") . '</td> <td width="300">' . $locate->Translate("Note") . '</td> </tr>'; $html .= '<tr> <td width="60"> <input type="checkbox" onclick="ckbAllOnClick(this);" id="ckbAll[]" name="ckbAll[]">' . $locate->Translate("All") . ' </td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> </tr>'; while ($records->fetchInto($mycdr)) { $price = ''; $ratedesc = ''; $trstyle = ''; $ratedesc = astercc::readRateDesc($mycdr['memo']); $callshop_cost = 0; $reseller_cost = 0; if ($_SESSION['curuser']['usertype'] == 'operator') { } else { if ($_SESSION['curuser']['usertype'] == 'groupadmin') { $callshop_cost = $mycdr['callshopcredit']; } else { if ($_SESSION['curuser']['usertype'] == 'admin') { $callshop_cost = $mycdr['callshopcredit']; $reseller_cost = $mycdr['resellercredit']; } } } if ($mycdr['setfreecall'] == 'yes') { $trstyle = 'style="background:#d5c59f;"'; } $html .= ' <tr align="left" id="tr-' . $mycdr['id'] . '" ' . $trstyle . '> <td align="right"> <input type="checkbox" id="ckb[]" name="ckb[]" value="' . $mycdr['id'] . '" onclick="ckbOnClick(this);"> <input type="hidden" id="price-' . $mycdr['id'] . '" name="price-' . $mycdr['id'] . '" value="' . $mycdr['credit'] . '"> <input type="hidden" id="callshop-' . $mycdr['id'] . '" name="callshop-' . $mycdr['id'] . '" value="' . $callshop_cost . '"> <input type="hidden" id="reseller-' . $mycdr['id'] . '" name="reseller-' . $mycdr['id'] . '" value="' . $reseller_cost . '"> <input type="hidden" id="free-' . $mycdr['id'] . '" name="free-' . $mycdr['id'] . '" value="' . $mycdr['setfreecall'] . '"> </td> <td>' . $mycdr['calldate'] . '</td> <td>' . $mycdr['src'] . '</td> <td>' . $mycdr['dst'] . '</td> <td>' . astercrm::FormatSec($mycdr['duration']) . '</td> <td>' . $mycdr['disposition'] . '</td> <td>' . astercrm::FormatSec($mycdr['billsec']) . '</td> <td>' . $mycdr['destination'] . '</td> <td>' . $ratedesc . '</td>'; if ($_SESSION['curuser']['usertype'] == 'operator') { $html .= '<td>' . $mycdr['credit'] . '</td>'; } else { if ($_SESSION['curuser']['usertype'] == 'groupadmin') { $html .= '<td>' . $mycdr['credit'] . '<br>' . '(' . $callshop_cost . ')' . '</td>'; } else { if ($_SESSION['curuser']['usertype'] == 'admin') { $html .= '<td>' . $mycdr['credit'] . '<br>' . '(' . $callshop_cost . ')' . '<br>' . '(' . $reseller_cost . ')</td>'; } } } if ($peer == '-1') { if ($mycdr['dst'] == $mycdr['src']) { //lega $addon = ' [lega]'; } else { //legb $addon = ' [legb]'; } } if ($mycdr['userfield'] == 'UNBILLED') { $html .= '<td bgcolor="red">' . $mycdr['userfield'] . $addon . '</td>'; } else { $html .= '<td>' . $mycdr['userfield'] . $addon . '</td>'; } $html .= '<td>' . $mycdr['note'] . '</td></tr> <tr bgcolor="gray"> <td colspan="12" height="1"></td> </tr> '; $i++; } $html .= '<tr> <td width="60"> <input type="checkbox" onclick="ckbAllOnClick(this);" id="ckbAll[]" name="ckbAll[]">' . $locate->Translate("All") . ' </td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> </tr>'; $html .= '</table>'; $html .= '</form>'; $objResponse->addAssign("divUnbilledList", "innerHTML", $html); $objResponse->addAssign("spanTotal", "innerHTML", 0); $objResponse->addAssign("spanrealTotal", "innerHTML", 0); $objResponse->addAssign("spanCallshopCost", "innerHTML", 0); $objResponse->addAssign("spanResellerCost", "innerHTML", 0); return $objResponse; }
</th> <th width="10%" align="center"><?php echo $locate->Translate("Discount"); ?> </th> </tr> <?php $total_price = 0; $records = astercc::readUnbilled($peer, $leg, $_SESSION['curuser']['groupid']); while ($records->fetchInto($myreceipt)) { $bgcolor = ''; if ($myreceipt['setfreecall'] == 'yes') { $bgcolor = 'bgcolor="#d5c59f"'; $myreceipt['credit'] = '0.00'; } $ratedesc = astercc::readRateDesc($myreceipt['memo']) . ' '; $content = '<tr id="rcdr-' . $myreceipt['id'] . '" ' . $bgcolor . '>'; if ($peer == $myreceipt['dst']) { if ($myreceipt['billsec'] == 0) { $content .= '<td><div><UL id="extenBtnU"><LI><a href="###"><img src="images/noanswer.gif">' . $myreceipt['src'] . '</a><UL><A href="javascript:void(null)" onclick="javascript:xajax_removeReceipt(\'' . $myreceipt['id'] . '\');"> <font size="2px">' . $locate->Translate("Hidden") . '</font></A></UL></LI></UL></div></td>'; } else { $content .= '<td><UL id="extenBtnU"><LI><a href="###"><img src="images/inbound.gif">' . $myreceipt['src'] . '</a><UL><A href="javascript:void(null)" onclick="javascript:xajax_setFreeCallPage(\'' . $myreceipt['id'] . '\')"> <font size="2px">' . $locate->Translate("Free call") . '</font></A><A href="javascript:void(null)" onclick="javascript:xajax_removeReceipt(\'' . $myreceipt['id'] . '\');"> <font size="2px">' . $locate->Translate("Hidden") . '</font></A></UL></LI></UL></td>'; } } else { if ($myreceipt['billsec'] == 0) { $content .= '<td><UL id="extenBtnU"><LI><a href="###"><img src="images/noanswer.gif">' . $myreceipt['dst'] . '</a><UL><A href="javascript:void(null)" onclick="javascript:xajax_removeReceipt(\'' . $myreceipt['id'] . '\');"> <font size="2px">' . $locate->Translate("Hidden") . '</font></A></UL></LI></UL></td>'; } else { $content .= '<td><UL id="extenBtnU"><LI><a href="###"><img src="images/outbound.gif">' . $myreceipt['dst'] . '</a><UL><A href="javascript:void(null)" onclick="javascript:xajax_setFreeCallPage(\'' . $myreceipt['id'] . '\')"> <font size="2px">' . $locate->Translate("Free call") . '</font></A><A href="javascript:void(null)" onclick="javascript:xajax_removeReceipt(\'' . $myreceipt['id'] . '\');"> <font size="2px">' . $locate->Translate("Hidden") . '</font></A></UL></LI></UL></td>'; } } $content .= '
function showBuyRate($prefix) { global $locate; $objResponse = new xajaxResponse(); //echo $prefix;exit; if ($_SESSION['curuser']['usertype'] == 'reseller') { $buyrate = astercc::searchRate($prefix, $_SESSION['curuser']['groupid'], $_SESSION['curuser']['resellerid'], 'resellerrate', "prefix"); if ($buyrate['id'] != '') { $buyrateDesc = astercc::readRateDesc($buyrate); $objResponse->assign("spanShowBuyRate", "innerHTML", $locate->Translate("Buy Rate") . ":" . $buyrate['destination'] . "(" . $buyrateDesc . ")"); } else { $objResponse->assign("spanShowBuyRate", "innerHTML", ""); } } return $objResponse; }