예제 #1
0
function generateSipFile()
{
    global $locate, $db;
    $objResponse = new xajaxResponse();
    if ($_SESSION['curuser']['usertype'] == 'reseller') {
        astercc::generatePeersFile($_SESSION['curuser']['resellerid']);
        $objResponse->addAlert($locate->Translate("sip conf file generated"));
    } elseif ($_SESSION['curuser']['usertype'] == 'admin') {
        $res = astercrm::getAll("resellergroup");
        while ($res->fetchInto($row)) {
            astercc::generatePeersFile($row['id']);
        }
        $objResponse->addAlert($locate->Translate("all reseller sip conf files generated"));
    }
    return $objResponse;
}
예제 #2
0
$aFormValues['edate'] = $arr_action[5];
$aFormValues['listType'] = $arr_action[6];
$aFormValues['hidCurpeer'] = $arr_action[7];
if ($aFormValues['sltBooth'] == '' && $aFormValues['hidCurpeer'] != '') {
    $aFormValues['sltBooth'] = $aFormValues['hidCurpeer'];
}
list($syear, $smonth, $sday) = split("[ -]", $aFormValues['sdate']);
$syear = (int) $syear;
$smonth = (int) $smonth;
$sday = (int) $sday;
list($eyear, $emonth, $eday) = split("[ -]", $aFormValues['edate']);
$eyear = (int) $eyear;
$emonth = (int) $emonth;
$eday = (int) $eday;
$color = array('#1F8FA1', '#1F8FA1', '#848484', '#ffccff', '#CACFBE', '#DEF799', '#FF33C9', '#FF653F', '#669900', '#ffcc99', '#ffccff', '#99ccff', '#ffcc00');
$res = astercc::readReportPie($aFormValues['resellerid'], $aFormValues['groupid'], $aFormValues['sltBooth'], $aFormValues['sdate'], $aFormValues['edate'], 'destination', $aFormValues['action'], 'limit');
$ii = 1;
while ($res->fetchInto($row)) {
    //print_r($row);
    $row['markup'] = $row['callshopcredit'] - $row['resellercredit'];
    $col = $color[$ii];
    $title = "" . $row['gid'];
    $iid = $row['gid'];
    if ($aFormValues['resellerid'] == 0 || $aFormValues['resellerid'] == '') {
        $title = "" . $reseller_arr[$iid];
    } else {
        if ($aFormValues['groupid'] == 0 || $aFormValues['groupid'] == '') {
            $title = "" . $group_arr[$iid];
        }
    }
    switch ($action_value) {
예제 #3
0
    function shortUpdateGrid($groupid, $resellerid)
    {
        global $locate;
        $html = '<table border="0" width="99%" style="line-height: 30px;" class="adminlist"><tbody><tr><th class="title" ><b>' . $locate->Translate("Shortcut update rate") . '</b></th></tr><tbody></table>
				<table border="0" width="99%" style="line-height: 25px; padding: 0px;" class="adminlist" ><tbody>';
        $ratelist = astercc::searchRateForShortUpdate($groupid, $resellerid);
        $flag = 0;
        $class = "row0";
        foreach ($ratelist as $rate_row) {
            $flag++;
            if ($flag % 2 == 0) {
                $tr .= '<td style="cursor: pointer;" width="10%">&nbsp;&nbsp;</td>';
            }
            $tr .= '<td style="cursor: pointer;" width="10%">' . $rate_row['mdialprefix'] . '</td><td style="cursor: pointer;" width="10%">' . $rate_row['mdestination'] . '</td><td style="cursor: pointer;" width="10%">' . $rate_row['crateinitial'] . '</td><td style="cursor: pointer;" width="10%"><input type="text" value="' . $rate_row['mrateinitial'] . '" size="10" id="' . $rate_row['mid'] . '-mrateinitial" onKeyUp="filedFilter(this,\'numeric\');"></td><td style="cursor: pointer;" width="10%"><input type="button" value="' . $locate->Translate("Update") . '" onclick="shortcutUpdateSave(\'' . $rate_row['mid'] . '\');"></td>';
            if ($flag % 2 != 0) {
                $tr = '<tr class="' . $class . '">' . $tr;
                if ($class == 'row1') {
                    $class = 'row0';
                } else {
                    $class = 'row1';
                }
            } else {
                $tr = $tr . '</tr>';
                $html .= $tr;
                $tr = '';
            }
        }
        if ($flag % 2 != 0) {
            $html .= $tr . '<td></td><td colspan="5"></td></tr>';
        }
        $html .= '</tbody></table>';
        return $html;
    }
예제 #4
0
function setFreeCall($id, $hiddenrecord, $note, $total, $discount)
{
    global $db;
    //$discount = 0.5;
    $objResponse = new xajaxResponse();
    $query = "SELECT * FROM mycdr WHERE id = {$id}";
    $row = $db->getRow($query);
    //print_r($row);exit;
    if ($row['credit'] > 0 && $row['setfreecall'] != 'yes') {
        $total = $total - $row['credit'];
    }
    $query = "UPDATE mycdr SET note = '" . $note . "', setfreecall = 'yes' WHERE id = {$id}";
    if ($db->query($query)) {
        if ($hiddenrecord == 'true') {
            $objResponse->addRemove('rcdr-' . $id);
        } else {
            $objResponse->addAssign("rprice-" . $id, "innerHTML", '0.00');
            $objResponse->addAssign("rcdr-" . $id, "style.background", '#d5c59f');
        }
    }
    $total_price = $total * (1 - $discount);
    $total_price = astercc::creditDigits($total_price, 2);
    $objResponse->addAssign("total_price", "innerHTML", $total_price);
    $objResponse->addAssign("total_price_ori", "value", $total);
    $objResponse->addAssign("formDiv", "style.visibility", "hidden");
    $objResponse->addAssign("formDiv", "innerHTML", '');
    return $objResponse;
}
예제 #5
0
                case "cost":
                    $title = $locate->Translate("Reseller Cost");
                    $data[] = intval($ary['resellercredit']);
                    break;
                case "gain":
                    $title = $locate->Translate("Markup");
                    $data[] = intval($ary['markup']);
                    break;
            }
        }
    }
} elseif ($aFormValues['listType'] == "sumhour") {
    $x_title = $locate->Translate("Sum by Hour");
    for ($hour = 0; $hour <= 23; $hour++) {
        $x_date[] = "" . $hour;
        $res = astercc::readReport($aFormValues['resellerid'], $aFormValues['groupid'], $aFormValues['sltBooth'], "{$syear}-{$smonth}-{$sday} {$hour}:00:00", "{$syear}-{$smonth}-{$sday} {$hour}:59:59");
        if ($res->fetchInto($myreport)) {
            $result = parseReport($myreport);
            $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['markup'] = $ary['callshopcredit'] - $ary['resellercredit'];
            switch ($aFormValues['action']) {
                case "num":
                    $title = $locate->Translate("Calls");
                    $data[] = intval($ary['recordNum']);
                    break;
                case "time":
                    $title = $locate->Translate("Billsec");
예제 #6
0
function checkOut($aFormValues)
{
    $objResponse = new xajaxResponse();
    if ($aFormValues['ckb']) {
        foreach ($aFormValues['ckb'] as $id) {
            $res = astercc::setBilled($id);
        }
        $objResponse->addScript("listReport();");
    }
    return $objResponse;
}
예제 #7
0
파일: receipt.php 프로젝트: ljhcj/IRISCC
    $content .= '
					<td>' . $myreceipt['calldate'] . '</td>
					<td align="right">' . astercrm::FormatSec($myreceipt['billsec']) . '</td>
					<td align="right">' . $myreceipt['destination'] . '</td>
					<td align="right">' . $ratedesc . '</td>
					<td id="rprice-' . $myreceipt['id'] . '" align="right">' . astercc::creditDigits($myreceipt['credit']) . '</td>
					<td align="right">' . astercc::creditDigits($_REQUEST['discount'], 3) . '</td>
				</tr>';
    echo $content;
    if ($myreceipt['setfreecall'] == 'no') {
        $total_price += $myreceipt['credit'];
    }
}
$total_price_ori = $total_price;
$total_price = $total_price * (1 - $_REQUEST['discount']);
$total_price = astercc::creditDigits($total_price, 2);
?>
	<tr><td><?php 
echo $locate->Translate("Total");
?>
:</td>
		<td colspan="5" align="right" id="total_price"><?php 
echo $total_price;
?>
</td><input id="total_price_ori" type="hidden" value="<?php 
echo $total_price_ori;
?>
"><input id="discount" type="hidden" value="<?php 
echo $_REQUEST['discount'];
?>
">
예제 #8
0
function checkoutAll($resellerid, $groupid, $clidid)
{
    global $locate;
    $objResponse = new xajaxResponse();
    $res = astercc::setAllBilled($resellerid, $groupid, $clidid);
    $objResponse->addAlert($locate->Translate("booth_cleared"));
    return $objResponse;
}
예제 #9
0
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;
}
예제 #10
0
 function searchRateForShortUpdate($groupid, $resellerid)
 {
     global $db;
     $sql = "SELECT myrate.id as mid,myrate.dialprefix as mdialprefix,myrate.destination as mdestination,myrate.connectcharge as mconnectcharge,myrate.initblock as minitblock,myrate.rateinitial as mrateinitial,myrate.rateinitial as mrateinitial,myrate.billingblock as mbillingblock,myrate.groupid as mgroupid,myrate.resellerid as mresellerid,callshoprate.id as cid,callshoprate.dialprefix as cdialprefix,callshoprate.connectcharge as cconnectcharge,callshoprate.initblock as cinitblock,callshoprate.rateinitial as crateinitial,callshoprate.rateinitial as crateinitial,callshoprate.billingblock as cbillingblock,callshoprate.groupid as cgroupid,callshoprate.resellerid as cresellerid FROM myrate LEFT JOIN callshoprate ON myrate.dialprefix = callshoprate.dialprefix WHERE callshoprate.dialprefix != '' AND myrate.dialprefix != 'default' ";
     astercc::events($sql);
     $rates =& $db->query($sql);
     $allprefix = array();
     $ratelist = array();
     while ($rates->fetchInto($list)) {
         if (in_array($list['mdialprefix'], $allprefix)) {
             if ($list['cgroupid'] != $gruopid && $list['cresellerid'] != $resellerid) {
                 //echo $list['cresellerid'].$groupid;
                 continue;
             } else {
                 foreach ($allprefix as $key => $value) {
                     if ($list['mdialprefix'] == $value) {
                         $curkey = $key;
                         break;
                     }
                 }
                 if ($ratelist[$curkey]['cresellerid'] == $resellerid) {
                     if ($ratelist[$curkey]['cgroupid'] == $gruopid) {
                         continue;
                     }
                 }
                 $ratelist[$curkey] = $list;
                 continue;
             }
         }
         $ratelist[] = $list;
         $allprefix[] = $list['mdialprefix'];
     }
     return $ratelist;
 }
예제 #11
0
/**
*  save group record
*  @param	f			array		group record
*  @return	objResponse	object		xajax response object
*/
function save($f)
{
    global $locate, $db, $config;
    $objResponse = new xajaxResponse();
    //print_r($f);exit;
    if (trim($f['resellername']) == '') {
        $objResponse->addAlert($locate->Translate("please enter the resellername"));
        return $objResponse;
    }
    $f['creditlimit'] = trim($f['creditlimit']);
    if ($f['creditlimit'] == '' or !is_numeric($f['creditlimit'])) {
        $f['creditlimit'] = 0;
    }
    //print_r($f);exit;
    //	if($f['routetype'] == 'customize') {
    //		$f['trunkname'] = trim($f['trunkname']);
    //		if($f['trunkname'] == '') {
    //			$objResponse->addAlert($locate->Translate("please enter the trunkname"));
    //			return $objResponse;
    //		}
    //		$f['detail'] = trim($f['detail']);
    //		if($f['detail'] == '') {
    //			$objResponse->addAlert($locate->Translate("please enter the detail"));
    //			return $objResponse;
    //		}
    //		if(trim($f['timeout']) == '') {
    //			$f['timeout'] = 0;
    //		}
    //		$pin = Customer::generateUniquePin(10);
    //		$n = array('trunkname'=>$f['trunkname'],'trunkprotocol'=>$f['protocoltype'],'registrystring'=>$f['registrystring'],'detail'=>$f['detail'],'timeout'=>$f['timeout'],'trunkprefix'=>$f['trunkprefix'],'removeprefix'=>$f['removeprefix'],'trunkidentity'=>$pin);
    //		$resTrunk = Customer::insertNewTrunk($n);
    //		$f['trunk_id'] = $resTrunk;
    //	} else if($f['routetype'] == 'default') {
    //$f['trunk_id'] = -1;
    //	} else if($f['routetype'] == 'auto'){
    //$f['trunk_id'] = 0;
    //	}
    if ($f['trunk1_id'] != $f['tmptrunk1id'] && $f['tmptrunk1id'] > 0) {
        Customer::deleteRecord($f['tmptrunk1id'], 'trunks');
    }
    if ($f['trunk2_id'] != $f['tmptrunk2id'] && $f['tmptrunk2id'] > 0) {
        Customer::deleteRecord($f['tmptrunk2id'], 'trunks');
    }
    if ($config['synchronize']['id_autocrement_byset']) {
        $local_lastid = astercrm::getLocalLastId('resellergroup');
        $f['id'] = intval($local_lastid + 1);
    }
    $respOk = Customer::insertNewResellergroup($f);
    // add a new group
    if ($respOk) {
        $html = createGrid(0, ROWSXPAGE);
        $objResponse->addAssign("grid", "innerHTML", $html);
        $objResponse->addAssign("msgZone", "innerHTML", $locate->Translate("Add Reseller"));
        $objResponse->addAssign("formDiv", "style.visibility", "hidden");
        $objResponse->addClear("formDiv", "innerHTML");
    } else {
        $objResponse->addAssign("msgZone", "innerHTML", $locate->Translate("rec_cannot_insert"));
    }
    //generate include file
    if ($_SESSION['curuser']['usertype'] == 'admin') {
        astercc::generateResellerFile();
    }
    return $objResponse->getXML();
}