예제 #1
0
function init()
{
    global $locate;
    $objResponse = new xajaxResponse();
    $peers = array();
    if ($_SESSION['curuser']['usertype'] == 'admin') {
        // set all group first
        $group = astercrm::getAll('astercrm_accountgroup');
        //print_r($group);exit;
        $objResponse->addScript("addOption('groupid',0,'" . $locate->Translate("All") . "');");
        while ($group->fetchInto($row)) {
            $objResponse->addScript("addOption('groupid','" . $row['id'] . "','" . $row['groupname'] . "');");
        }
        $objResponse->addScript("addOption('agent_username','" . "" . "','" . $locate->Translate("All") . "');");
    } else {
        // set one group
        $objResponse->addScript("addOption('groupid','" . $_SESSION['curuser']['groupid'] . "','" . $_SESSION['curuser']['group']['groupname'] . "');");
        // set all agent
        $agent = getAgentRecords($_SESSION['curuser']['groupid']);
        $objResponse->addScript("addOption('agent_username','" . "" . "','" . $locate->Translate("All") . "');");
        while ($agent->fetchInto($row)) {
            $objResponse->addScript("addOption('agent_username','" . $row['username'] . "','" . $row['username'] . "');");
        }
    }
    $objResponse->addAssign("divNav", "innerHTML", common::generateManageNav($skin, $_SESSION['curuser']['country'], $_SESSION['curuser']['language']));
    $objResponse->addAssign("divCopyright", "innerHTML", common::generateCopyright($skin));
    return $objResponse;
}
예제 #2
0
function setAccount($groupid)
{
    global $locate;
    $objResponse = new xajaxResponse();
    $res = astercrm::getAll("astercrm_account", 'groupid', $groupid);
    //添加option
    $objResponse->addScript("addOption('accountid','" . "0" . "','" . $locate->Translate("All") . "');");
    while ($res->fetchInto($row)) {
        $objResponse->addScript("addOption('accountid','" . $row['id'] . "','" . $row['username'] . "');");
    }
    return $objResponse;
}
예제 #3
0
	<?php 
require_once "checkout.common.php";
require_once "db_connect.php";
require_once 'include/asterevent.class.php';
require_once 'include/astercrm.class.php';
require_once 'include/common.class.php';
include 'openflash/php-ofc-library/open-flash-chart.php';
global $locate;
$color = array('#1F8FA1', '#848484', '#ffccff', '#CACFBE', '#DEF799', '#FF33C9', '#FF653F', '#669900', '#ffcc99', '#ffccff', '#99ccff', '#ffcc00');
//reseller array();
$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'];
}
function parseReport($myreport)
{
    global $locate;
    $ary['recordNum'] = $myreport['recordNum'];
    $ary['seconds'] = $myreport['seconds'];
    $ary['credit'] = $myreport['credit'];
    $ary['callshopcredit'] = $myreport['callshopcredit'];
    $ary['resellercredit'] = $myreport['resellercredit'];
    if ($_SESSION['curuser']['usertype'] == 'admin' || $_SESSION['curuser']['usertype'] == 'reseller') {
        $ary['markup'] = $myreport['callshopcredit'] - $myreport['resellercredit'];
    } else {
예제 #4
0
function predictiveDialer($f)
{
    global $config, $db, $locate;
    $objResponse = new xajaxResponse();
    //print_r($f);exit;
    $aDyadicArray[] = array($locate->Translate("src"), $locate->Translate("dst"), $locate->Translate("srcchan"), $locate->Translate("dstchan"), $locate->Translate("starttime"), $locate->Translate("answertime"), $locate->Translate("disposition"));
    $cDyadicArray[] = array($locate->Translate("src"), $locate->Translate("dst"), $locate->Translate("srcchan"), $locate->Translate("dstchan"), $locate->Translate("starttime"), $locate->Translate("first answertime"), $locate->Translate("answertime"), $locate->Translate("disposition"));
    // 检查系统目前的通话情况
    //if($_SESSION['curuser']['usertype'] == 'admin'){
    $sql = "SELECT curcdr.*,dialedlist.id as did,dialedlist.dialednumber,dialedlist.campaignid,dialedlist.dialedby,dialedlist.channel FROM curcdr LEFT JOIN dialedlist ON curcdr.srcchan=dialedlist.channel OR curcdr.dstchan=dialedlist.channel WHERE curcdr.id > 0 AND dialedlist.channel != '' ORDER by curcdr.id desc";
    $curdiledlist = $db->query($sql);
    //$curcdr = astercrm::getAll("curcdr");
    //}elseif($_SESSION['curuser']['usertype'] == 'groupadmin'){
    //	$curcdr = astercrm::getGroupCurcdr();
    //}
    $curdidlist = array();
    while ($curdiledlist->fetchInto($row)) {
        if ($row['did'] > 0) {
            if (in_array($row['did'], $curdidlist)) {
                continue;
            } else {
                $curdidlist[] = $row['did'];
                $campaignCDR[$row['campaignid']][] = array($row["src"], $row["dst"], $row["srcchan"], $row["dstchan"], $row["starttime"], $row["calldate"], $row["answertime"], $row["disposition"]);
            }
        } else {
            $query = "SELECT groupid FROM astercrm_account WHERE extension = '" . $row['dst'] . "' OR extension = '" . $row['dst'] . "'  GROUP BY groupid ORDER BY groupid DESC LIMIT 0,1";
            $groupid = $db->getOne($query);
            if ($groupid > 0) {
                $groupCDR[$groupid][] = array($row["src"], $row["dst"], $row["srcchan"], $row["dstchan"], $row["starttime"], $row["answertime"], $row["disposition"]);
            } elseif ($_SESSION['curuser']['usertype'] == 'admin') {
                //print_r($row);exit;
                $systemCDR[] = array($row["src"], $row["dst"], $row["srcchan"], $row["dstchan"], $row["starttime"], $row["answertime"], $row["disposition"]);
            }
        }
    }
    if ($_SESSION['curuser']['usertype'] == 'admin') {
        $systemChannels = common::generateTabelHtml(array_merge($aDyadicArray, $systemCDR));
    }
    $objResponse->addAssign("idvUnknowChannels", "innerHTML", nl2br(trim($systemChannels)));
    // clear all group
    $groups = astercrm::getAll("astercrm_accountgroup");
    while ($groups->fetchInto($group)) {
        $objResponse->addAssign("unknown" . $group['groupid'], "innerHTML", "");
    }
    // clear all campaign
    $campaigns = astercrm::getAll("campaign");
    while ($campaigns->fetchInto($campaign)) {
        $campaign_queue_name[$campaign['id']] = $campaign['queuename'];
        $objResponse->addAssign("campaign" . $campaign['id'], "innerHTML", "");
    }
    // start assign all CDRs
    foreach ($groupCDR as $key => $value) {
        if (is_array($value)) {
            $groupChannels = common::generateTabelHtml(array_merge($aDyadicArray, $value));
            $objResponse->addAssign("unknown{$key}", "innerHTML", nl2br(trim($groupChannels)));
        } else {
            $objResponse->addAssign("unknown{$key}", "innerHTML", "");
        }
    }
    foreach ($campaignCDR as $key => $value) {
        if (is_array($value)) {
            $campaignChannels = common::generateTabelHtml(array_merge($cDyadicArray, $value));
            $objResponse->addAssign("campaign{$key}", "innerHTML", nl2br(trim($campaignChannels)));
        } else {
            $objResponse->addAssign("campaign{$key}", "innerHTML", "");
        }
    }
    /*
    // 将$f按组别分类
    foreach ($f as $key => $value){
    	list ($campaignid, $field) = split("-",$key);
    	$predial_campaigns[$campaignid][$field] = $value;
    }
    
    foreach ($predial_campaigns as $key => $value){
    	if ($value['ckb'] == "on"){
    		// 查找是否还有待拨号码
    		$diallist_num[$key] = astercrm::getCountByField("campaignid", $key, "diallist");
    		$num = 0;
    		if ($diallist_num[$key]  > 0){
    			if ($value['limittpye'][0] == "channel"){
    				// 根据并发限制
    				// 检查目前该campaign的并发通道
    				$exp = $value['maxchannel'] - count($campaignCDR[$key]);
    				if (  $exp > 0 ){
    					// 可以发起呼叫, 规则为 (差额 +2)/3
    					$num = intval(($exp + 2)/3);
    					$i = 0;
    					while ($i<$num && placeCall($key)) $i++;
    				}else{
    					// skip this campaign
    				}
    			}else{
    				// 根据agent限制
    				// 获取目前agent的数目
    				$query = "SELECT COUNT(*) FROM queue_agent WHERE status = 'In use' AND queuename = '".$campaign_queue_name[$key]."' ";
    				$busy_agent_num = $db->getOne($query);
    
    				$query = "SELECT COUNT(*) FROM queue_agent WHERE status = 'Not in use' AND queuename = '".$campaign_queue_name[$key]."' ";
    				$free_agent_num = $db->getOne($query);
    				$totalagent = ($busy_agent_num + $free_agent_num);
    				if (is_numeric($value['rate'])){
    					$myagent = intval($totalagent * (1+$rate/100));
    				}
    
    				$exp = $myagent - count($campaignCDR[$key]);
    				if (  $exp > 0 ){
    					// 可以发起呼叫, 规则为 (差额 +2)/3
    					$num = intval(($exp + 2)/3);
    					$i = 0;
    					while ($i<$num && placeCall($key)) $i++;
    				}else{
    					// skip this campaign
    				}
    			}
    		}
    		// refresh campaing number
    		$objResponse->addAssign("numbers-$key","innerHTML",$diallist_num[$key] - $i);
    
    	}else{
    		unset($predial_campaigns[$key]);
    	}
    }
    */
    //exit;
    $check_interval = 2000;
    if (is_numeric($config['system']['status_check_interval'])) {
        $check_interval = $config['system']['status_check_interval'] * 1000;
    }
    $objResponse->addScript("setTimeout(\"startDial()\", " . $check_interval . ");");
    return $objResponse;
}
예제 #5
0
    /**
     *  Imprime la forma para editar un nuevo registro sobre el DIV identificado por "formDiv".
     *
     *	@param $id		(int)		Identificador del registro a ser editado.
     *	@return $html	(string) Devuelve una cadena de caracteres que contiene la forma con los datos 
     *									a extraidos de la base de datos para ser editados 
     */
    function formEdit($id)
    {
        global $locate, $config;
        $rate =& Customer::getRecordByID($id, 'myrate');
        /*
        $group = astercrm::getAll('accountgroup');
        
        if ($_SESSION['curuser']['usertype'] == 'admin'){
        	$groupoptions .= '<select id="groupid" name="groupid">';
        	while	($group->fetchInto($row)){
        		if ($row['id'] == $rate['groupid']){
        			$groupoptions .= "<OPTION value='".$row['id']."' selected>".$row['groupname']."</OPTION>";
        		}else{
        			$groupoptions .= "<OPTION value='".$row['id']."'>".$row['groupname']."</OPTION>";
        		}
        	}
        	$groupoptions .= '</select>';
        }else{
        	while	($group->fetchInto($row)){
        		if ($row['id'] == $_SESSION['curuser']['groupid']){
        			$groupoptions .= $row['groupname'].'<input type="hidden" value="'.$row['id'].'" name="groupid" id="groupid">';
        			break;
        		}
        	}
        }
        */
        $reselleroptions = '';
        $reseller = astercrm::getAll('resellergroup');
        if ($_SESSION['curuser']['usertype'] == 'admin') {
            $reselleroptions .= '<select id="resellerid" name="resellerid" onchange="setGroup();">';
            $reselleroptions .= '<option value="0"></option>';
            while ($reseller->fetchInto($row)) {
                if ($config['synchronize']['display_synchron_server']) {
                    $row['resellername'] = astercrm::getSynchronDisplay($row['id'], $row['resellername']);
                }
                if ($row['id'] == $rate['resellerid']) {
                    $reselleroptions .= "<OPTION value='" . $row['id'] . "' selected>" . $row['resellername'] . "</OPTION>";
                } else {
                    $reselleroptions .= "<OPTION value='" . $row['id'] . "' >" . $row['resellername'] . "</OPTION>";
                }
            }
            $reselleroptions .= '</select>';
        } else {
            while ($reseller->fetchInto($row)) {
                if ($row['id'] == $rate['resellerid']) {
                    if ($config['synchronize']['display_synchron_server']) {
                        $row['resellername'] = astercrm::getSynchronDisplay($row['id'], $row['resellername']);
                    }
                    $reselleroptions .= $row['resellername'] . '<input type="hidden" value="' . $row['id'] . '" name="resellerid" id="resellerid">';
                    break;
                }
            }
        }
        $group = astercrm::getAll('accountgroup', 'resellerid', $rate['resellerid']);
        if ($_SESSION['curuser']['usertype'] == 'admin' || $_SESSION['curuser']['usertype'] == 'reseller') {
            $groupoptions .= '<select id="groupid" name="groupid">';
            $groupoptions .= "<OPTION value='0'></OPTION>";
            while ($group->fetchInto($row)) {
                if ($config['synchronize']['display_synchron_server']) {
                    $row['groupname'] = astercrm::getSynchronDisplay($row['id'], $row['groupname']);
                }
                if ($row['id'] == $rate['groupid']) {
                    $groupoptions .= "<OPTION value='" . $row['id'] . "' selected>" . $row['groupname'] . "</OPTION>";
                } else {
                    $groupoptions .= "<OPTION value='" . $row['id'] . "' >" . $row['groupname'] . "</OPTION>";
                }
            }
            $groupoptions .= '</select>';
        } else {
            while ($group->fetchInto($row)) {
                if ($row['id'] == $rate['groupid']) {
                    if ($config['synchronize']['display_synchron_server']) {
                        $row['groupname'] = astercrm::getSynchronDisplay($row['id'], $row['groupname']);
                    }
                    $groupoptions .= $row['groupname'] . '<input type="hidden" value="' . $row['id'] . '" name="groupid" id="groupid">';
                    break;
                }
            }
        }
        $html = '
			<!-- No edit the next line -->
			<form method="post" name="f" id="f">
			
			<table border="1" width="100%" class="adminlist">
				<tr>
					<td nowrap align="left">' . $locate->Translate("prefix") . '</td>
					<td align="left"><input type="hidden" id="id" name="id" value="' . $rate['id'] . '"><input type="text" id="dialprefix" name="dialprefix" size="25" maxlength="30" value="' . $rate['dialprefix'] . '" onKeyUp="xajax_showBuyRate(this.value);" onclick="xajax_showBuyRate(this.value);">&nbsp;<span id="spanShowBuyRate" name="spanShowBuyRate"></span></td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("length") . '</td>
					<td align="left"><input type="text" id="numlen" name="numlen" size="10" maxlength="10" value="' . $rate['numlen'] . '"></td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Destination") . '</td>
					<td align="left"><input type="text" id="destination" name="destination" size="25" maxlength="30" value="' . $rate['destination'] . '"></td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Connect charge") . '</td>
					<td align="left"><input type="text" id="connectcharge" name="connectcharge" size="20" maxlength="20" value="' . $rate['connectcharge'] . '"></td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Init block") . '</td>
					<td align="left"><input type="text" id="initblock" name="initblock" size="25" maxlength="100" value="' . $rate['initblock'] . '"></td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Rate") . '</td>
					<td align="left"><input type="text" id="rateinitial" name="rateinitial" size="25" maxlength="30" value="' . $rate['rateinitial'] . '"></td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Billing block") . '</td>
					<td align="left"><input type="text" id="billingblock" name="billingblock" size="25" maxlength="30" value="' . $rate['billingblock'] . '"></td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Reseller") . '</td>
					<td align="left">' . $reselleroptions . '</td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Group") . '</td>
					<td align="left">
					' . $groupoptions . '
					</td>
				</tr>
				<tr>
					<td colspan="2" align="center">
						<button id="submitButton" onClick=\'xajax_update(xajax.getFormValues("f"));return false;\'>' . $locate->Translate("Continue") . '</button>
					</td>
				</tr>

			 </table>
			';
        $html .= '
				</form>
				*' . $locate->Translate("obligatory_fields") . '
				';
        return $html;
    }
예제 #6
0
    function formMutiEdit($searchContent, $searchField, $searchType, $table)
    {
        global $locate;
        $reselleroptions = '';
        $reseller = astercrm::getAll('resellergroup');
        if ($_SESSION['curuser']['usertype'] == 'admin') {
            $reselleroptions .= '<select id="resellerid" name="resellerid"';
            if ($table != "resellerrate") {
                $reselleroptions .= 'onchange="setGroup();"';
            }
            $reselleroptions .= '><option value=""></option>';
            $reselleroptions .= '<option value="0">' . $locate->Translate("All") . '</option>';
            while ($reseller->fetchInto($row)) {
                $reselleroptions .= "<OPTION value='" . $row['id'] . "'>" . $row['resellername'] . "</OPTION>";
            }
            $reselleroptions .= '</select>';
        } else {
            while ($reseller->fetchInto($row)) {
                if ($row['id'] == $_SESSION['curuser']['resellerid']) {
                    $reselleroptions .= $row['resellername'] . '<input type="hidden" value="' . $row['id'] . '" name="resellerid" id="resellerid">';
                    break;
                }
            }
        }
        if ($table != "resellerrate") {
            $group = astercrm::getAll('accountgroup', 'resellerid', $_SESSION['curuser']['resellerid']);
            if ($_SESSION['curuser']['usertype'] == 'admin' || $_SESSION['curuser']['usertype'] == 'reseller') {
                $groupoptions .= '<select id="groupid" name="groupid">';
                if ($_SESSION['curuser']['usertype'] == 'reseller') {
                    $groupoptions .= "<OPTION value=''></OPTION>";
                }
                $groupoptions .= "<OPTION value='0'>" . $locate->Translate("All") . "</OPTION>";
                while ($group->fetchInto($row)) {
                    $groupoptions .= "<OPTION value='" . $row['id'] . "'>" . $row['groupname'] . "</OPTION>";
                }
                $groupoptions .= '</select>';
            } else {
                while ($group->fetchInto($row)) {
                    if ($row['id'] == $_SESSION['curuser']['groupid']) {
                        $groupoptions .= $row['groupname'] . '<input type="hidden" value="' . $row['id'] . '" name="groupid" id="groupid">';
                        break;
                    }
                }
            }
        }
        //可修改字段
        $tableField = astercrm::getTableStructure('myrate');
        foreach ($tableField as $row) {
            if ($row['name'] != 'id' && $row['name'] != 'resellerid' && $row['name'] != 'groupid' && $row['name'] != 'addtime') {
                $fieldOption .= '<option value="' . $row['name'] . ',' . $row['type'] . '">' . $row['name'] . '</option>';
            }
        }
        //将条件重置成字符串,通过post传递
        $i = 0;
        foreach ($searchContent as $content) {
            if (trim($content) != '' && trim($searchField[$i]) != '') {
                $searchContentStr .= $content . ",";
                $searchFieldStr .= $searchField[$i] . ",";
                $searchTypeStr .= $searchType[$i] . ",";
            }
            $i++;
        }
        //echo $searchContentStr.$searchFieldStr.$searchTypeStr;exit;
        //print_r($searchField);exit;
        $html = '
			<!-- No edit the next line -->
			<form method="post" name="f" id="f">
			
			<table border="1" width="100%" class="adminlist">
				<tr>
					<td nowrap align="left">' . $locate->Translate("Option") . '</td>
					<td align="left"><input type="radio" name="multioption" id="multioption" value="modify" checked>&nbsp;' . $locate->Translate("Modify") . '&nbsp;&nbsp;<input type="radio" name="multioption" id="multioption" value="duplicate">&nbsp;' . $locate->Translate("Duplicate") . '</td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Change") . '</td>
					<td align="left"><select id="multieditField" name="multieditField" onchange=\'xajax_setMultieditType(this.value)\'>' . $fieldOption . '</select>&nbsp;&nbsp;
					<select id="multieditType" name="multieditType" >
						<option value="to">' . $locate->Translate("to") . '</option>
					</select>&nbsp;&nbsp;<input type="text" id="multieditcontent" name="multieditcontent" size="15"></td>
				</tr>
				
				<tr>
					<td nowrap align="left">' . $locate->Translate("Reseller") . '</td>
					<td align="left">' . $reselleroptions . '</td>
				</tr>';
        if ($table != "resellerrate") {
            $html .= '<tr><td nowrap align="left">' . $locate->Translate("Group") . '</td><td align="left">' . $groupoptions . '</td></tr>';
        }
        $html .= '<tr>
					<td colspan="2" align="center">
						<button id="submitButton" onClick=\'xajax_multiEditUpdate("' . $searchContentStr . '","' . $searchFieldStr . '","' . $searchTypeStr . '","' . $table . '",xajax.getFormValues("f"));return false;\'>' . $locate->Translate("Continue") . '</button>
					</td>
				</tr>

			 </table>
			';
        $html .= '
			</form>';
        //echo $html;exit;
        return $html;
    }
예제 #7
0
    /**
     *  Imprime la forma para editar un nuevo registro sobre el DIV identificado por "formDiv".
     *
     *	@param $id		(int)		Identificador del registro a ser editado.
     *	@return $html	(string) Devuelve una cadena de caracteres que contiene la forma con los datos 
     *									a extraidos de la base de datos para ser editados 
     */
    function formEdit($id)
    {
        global $locate;
        $account =& Customer::getRecordByID($id, 'account');
        /*
        		$group = astercrm::getAll('accountgroup');
        
        		if ($_SESSION['curuser']['usertype'] == 'admin'){
        			$groupoptions .= '<select id="groupid" name="groupid">';
        			while	($group->fetchInto($row)){
        				if ($row['id'] == $account['groupid']){
        					$groupoptions .= "<OPTION value='".$row['id']."' selected>".$row['groupname']."</OPTION>";
        				}else{
        					$groupoptions .= "<OPTION value='".$row['id']."'>".$row['groupname']."</OPTION>";
        				}
        			}
        			if ($account['groupid'] == 0 ){
        				$groupoptions .= "<OPTION value='0' selected></OPTION>";
        			}else{
        				$groupoptions .= "<OPTION value='0'></OPTION>";
        			}
        			$groupoptions .= '</select>';
        		}else{
        			while	($group->fetchInto($row)){
        				if ($row['id'] == $account['groupid']){
        					$groupoptions .= $row['groupname'].'<input type="hidden" value="'.$row['id'].'" name="groupid" id="groupid">';
        					break;
        				}
        			}
        		}
        */
        $reselleroptions = '';
        $reseller = astercrm::getAll('resellergroup');
        if ($_SESSION['curuser']['usertype'] == 'admin') {
            $reselleroptions .= '<select id="resellerid" name="resellerid" onchange="setGroup();">';
            $reselleroptions .= '<option value="0"></option>';
            while ($reseller->fetchInto($row)) {
                if ($row['id'] == $account['resellerid']) {
                    $reselleroptions .= "<OPTION value='" . $row['id'] . "' selected>" . $row['resellername'] . "</OPTION>";
                } else {
                    $reselleroptions .= "<OPTION value='" . $row['id'] . "' >" . $row['resellername'] . "</OPTION>";
                }
            }
            $reselleroptions .= '</select>';
        } else {
            while ($reseller->fetchInto($row)) {
                if ($row['id'] == $account['resellerid']) {
                    $reselleroptions .= $row['resellername'] . '<input type="hidden" value="' . $row['id'] . '" name="resellerid" id="resellerid">';
                    break;
                }
            }
        }
        $group = astercrm::getAll('accountgroup', 'resellerid', $account['resellerid']);
        if ($_SESSION['curuser']['usertype'] == 'admin' || $_SESSION['curuser']['usertype'] == 'reseller') {
            $groupoptions .= '<select id="groupid" name="groupid">';
            $groupoptions .= "<OPTION value='0'></OPTION>";
            while ($group->fetchInto($row)) {
                if ($row['id'] == $account['groupid']) {
                    $groupoptions .= "<OPTION value='" . $row['id'] . "' selected>" . $row['groupname'] . "</OPTION>";
                } else {
                    $groupoptions .= "<OPTION value='" . $row['id'] . "' >" . $row['groupname'] . "</OPTION>";
                }
            }
            $groupoptions .= '</select>';
        } else {
            while ($group->fetchInto($row)) {
                if ($row['id'] == $account['groupid']) {
                    $groupoptions .= $row['groupname'] . '<input type="hidden" value="' . $row['id'] . '" name="groupid" id="groupid">';
                    break;
                }
            }
        }
        $html = '
			<!-- No edit the next line -->
			<form method="post" name="f" id="f">
			
			<table border="1" width="100%" class="adminlist">
				<tr>
					<td nowrap align="left">' . $locate->Translate("username") . '</td>
					<td align="left"><input type="hidden" id="id" name="id" value="' . $account['id'] . '"><input type="text" id="username" name="username" size="25" maxlength="30" value="' . $account['username'] . '"></td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("password") . '</td>
					<td align="left"><input type="text" id="password" name="password" size="25" maxlength="30" value="' . $account['password'] . '"></td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("usertype") . '</td>
					<td align="left">
					<select id="usertype" name="usertype">
						<option value="" ';
        if ($account['usertype'] == '') {
            $html .= ' selected ';
        }
        $html .= '></option>';
        if ($_SESSION['curuser']['usertype'] == 'admin') {
            $html .= '<option value="admin"';
            if ($account['usertype'] == 'admin') {
                $html .= ' selected ';
            }
            $html .= ' >' . $locate->Translate("Admin") . '</option>';
            $html .= '<option value="reseller"';
            if ($account['usertype'] == 'reseller') {
                $html .= ' selected ';
            }
            $html .= ' >' . $locate->Translate("Reseller") . '</option>';
        }
        if ($_SESSION['curuser']['usertype'] == 'admin' || $_SESSION['curuser']['usertype'] == 'reseller') {
            $html .= '<option value="groupadmin"';
            if ($account['usertype'] == 'groupadmin') {
                $html .= ' selected ';
            }
            $html .= ' >' . $locate->Translate("Group Admin") . '</option>';
        }
        $html .= ' <option value="operator"';
        if ($account['usertype'] == 'operator') {
            $html .= ' selected ';
        }
        $html .= '>' . $locate->Translate("Operator") . '</option>';
        $html .= '</select>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Reseller") . '</td>
					<td align="left">' . $reselleroptions . '</td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Group") . '</td>
					<td align="left">
					' . $groupoptions . '
					</td>
				</tr>
				<tr>
					<td colspan="2" align="center"><button id="submitButton" onClick=\'xajax_update(xajax.getFormValues("f"));return false;\'>' . $locate->Translate("Continue") . '</button></td>
				</tr>

			 </table>
			';
        $html .= '
				</form>
				' . $locate->Translate("obligatory fields") . '
				';
        return $html;
    }
예제 #8
0
function setGroup($resellerid)
{
    global $locate, $config;
    $objResponse = new xajaxResponse();
    $res = astercrm::getAll("accountgroup", 'resellerid', $resellerid);
    //添加option
    while ($res->fetchInto($row)) {
        if ($config['synchronize']['display_synchron_server']) {
            $row['groupname'] = astercrm::getSynchronDisplay($row['id'], $row['groupname']);
        }
        $objResponse->addScript("addOption('groupid','" . $row['id'] . "','" . $row['groupname'] . "');");
    }
    return $objResponse;
}
예제 #9
0
    /**
     *  Imprime la forma para editar un nuevo registro sobre el DIV identificado por "formDiv".
     *
     *	@param $id		(int)		Identificador del registro a ser editado.
     *	@return $html	(string) Devuelve una cadena de caracteres que contiene la forma con los datos 
     *									a extraidos de la base de datos para ser editados 
     */
    function formEdit($id)
    {
        global $locate, $config;
        $clid =& Customer::getRecordByID($id, 'clid');
        if ($clid['isshow'] == 'yes') {
            $selecty = "selected";
            $selectn = "";
        } else {
            if ($clid['isshow'] == 'no') {
                $selecty = "";
                $selectn = "selected";
            }
        }
        $reselleroptions = '';
        $reseller = astercrm::getAll('resellergroup');
        if ($_SESSION['curuser']['usertype'] == 'admin') {
            $reselleroptions .= '<select id="resellerid" name="resellerid" onchange="setGroup();">';
            $reselleroptions .= '<option value="0"></option>';
            while ($reseller->fetchInto($row)) {
                if ($config['synchronize']['display_synchron_server']) {
                    $row['resellername'] = astercrm::getSynchronDisplay($row['id'], $row['resellername']);
                }
                if ($row['id'] == $clid['resellerid']) {
                    $reselleroptions .= "<OPTION value='" . $row['id'] . "' selected>" . $row['resellername'] . "</OPTION>";
                } else {
                    $reselleroptions .= "<OPTION value='" . $row['id'] . "' >" . $row['resellername'] . "</OPTION>";
                }
            }
            $reselleroptions .= '</select>';
        } else {
            while ($reseller->fetchInto($row)) {
                if ($row['id'] == $clid['resellerid']) {
                    if ($config['synchronize']['display_synchron_server']) {
                        $row['resellername'] = astercrm::getSynchronDisplay($row['id'], $row['resellername']);
                    }
                    $reselleroptions .= $row['resellername'] . '<input type="hidden" value="' . $row['id'] . '" name="resellerid" id="resellerid">';
                    break;
                }
            }
        }
        $group = astercrm::getAll('accountgroup', 'resellerid', $clid['resellerid']);
        if ($_SESSION['curuser']['usertype'] == 'admin' || $_SESSION['curuser']['usertype'] == 'reseller') {
            $groupoptions .= '<select id="groupid" name="groupid">';
            $groupoptions .= "<OPTION value='0'></OPTION>";
            while ($group->fetchInto($row)) {
                if ($config['synchronize']['display_synchron_server']) {
                    $row['groupname'] = astercrm::getSynchronDisplay($row['id'], $row['groupname']);
                }
                if ($row['id'] == $clid['groupid']) {
                    $groupoptions .= "<OPTION value='" . $row['id'] . "' selected>" . $row['groupname'] . "</OPTION>";
                } else {
                    $groupoptions .= "<OPTION value='" . $row['id'] . "' >" . $row['groupname'] . "</OPTION>";
                }
            }
            $groupoptions .= '</select>';
        } else {
            while ($group->fetchInto($row)) {
                if ($row['id'] == $clid['groupid']) {
                    if ($config['synchronize']['display_synchron_server']) {
                        $row['groupname'] = astercrm::getSynchronDisplay($row['id'], $row['groupname']);
                    }
                    $groupoptions .= $row['groupname'] . '<input type="hidden" value="' . $row['id'] . '" name="groupid" id="groupid">';
                    break;
                }
            }
        }
        if ($clid['status'] == 1) {
            $statusoptions = '
							<option value="1" selected>' . $locate->Translate("Avaiable") . '</option>
							<option value="-1">' . $locate->Translate("Lock") . '</option>
						';
        } else {
            $statusoptions = '
							<option value="1">' . $locate->Translate("Avaiable") . '</option>
							<option value="-1" selected>' . $locate->Translate("Lock") . '</option>
						';
        }
        $configstatus = common::read_ini_file($config['system']['astercc_path'] . '/astercc.conf', $asterccConfig);
        if ($configstatus == -2) {
            $html = "(fail to read " . $config['system']['astercc_path'] . "/astercc.conf)";
            return $html;
        } else {
            $billingfield = trim($asterccConfig['system']['billingfield']);
        }
        if ($_SESSION['curuser']['usertype'] == 'clid') {
            $readonly = "readonly";
        }
        $html = '
			<!-- No edit the next line -->
			<form method="post" name="f" id="f">
			
			<table border="1" width="100%" class="adminlist">
				<tr>
					<td nowrap align="left">';
        if ($billingfield == 'accountcode') {
            $html .= $locate->Translate("Accountcode");
        } else {
            $html .= $locate->Translate("Caller ID");
        }
        $html .= '*</td>
					<td align="left"><input type="hidden" id="id" name="id" value="' . $clid['id'] . '"><input type="text" id="clid" name="clid" size="25" maxlength="30" value="' . $clid['clid'] . '" ' . $readonly . ' onblur="document.getElementById(\'accountcode\').value = this.value;"></td>
				</tr>';
        if ($billingfield == 'callerid') {
            $html .= '
				<tr>
					<td nowrap align="left">' . $locate->Translate("Account Code") . '*</td>
					<td align="left"><input type="text" id="accountcode" name="accountcode" size="25" maxlength="40" value="' . $clid['accountcode'] . '"></td>
				</tr>';
        } else {
            $html .= '
				<tr style="display:none;">
					<td nowrap align="left">' . $locate->Translate("Account Code") . '*</td>
					<td align="left"><input type="text" id="accountcode" name="accountcode" size="25" maxlength="40" value="' . $clid['accountcode'] . '" readonly></td>
				</tr>';
        }
        $html .= '<tr>
					<td nowrap align="left">' . $locate->Translate("Pin") . '*</td>
					<td align="left"><input type="text" id="pin" name="pin" size="25" maxlength="30" value="' . $clid['pin'] . '" readonly><input type="hidden" id="pin" name="pin" value="' . $clid['pin'] . '"></td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Display") . '</td>
					<td align="left"><input type="text" id="display" name="display" size="25" maxlength="20" value="' . $clid['display'] . '" ' . $readonly . '></td>
				</tr>';
        if ($config['system']['setclid'] == 1) {
            $html .= '<tr>
						<td nowrap align="left">' . $locate->Translate("Credit Limit") . '*</td>
						<td align="left"><input type="text" id="creditlimit" name="creditlimit" size="25" maxlength="30" value="' . $clid['creditlimit'] . '" ' . $readonly . '></td>
					</tr>

					<tr>
						<td nowrap align="left">' . $locate->Translate("Cur Credit") . '</td>
						<td align="left">
						<input type="text" id="curcreditshow" name="curcreditshow" size="25" maxlength="100" value="' . $clid['curcredit'] . '" readonly>
						<input type="hidden" id="curcredit" name="curcredit" value="' . $clid['curcredit'] . ' ">
					</td>
					</tr>';
            if ($_SESSION['curuser']['usertype'] != 'clid') {
                $html .= '<tr>
							<td nowrap align="left">' . $locate->Translate("Operate") . '</td>
							<td align="left">
								<select id="creditmodtype" name="creditmodtype" onchange="showComment(this)">
									<option value="">' . $locate->Translate("No change") . '</option>
									<option value="add">' . $locate->Translate("Refund") . '</option>
									<option value="reduce">' . $locate->Translate("Charge") . '</option>
								</select>
								<input type="text" id="creditmod" name="creditmod" size="15" maxlength="100" value="" disabled><p>' . $locate->Translate("Comment") . ' :&nbsp;<input type="text" id="comment" name="comment" size="18" maxlength="20" value="" disabled></p>
							</td>
						</tr>
						<tr>';
            }
            $html .= '<td nowrap align="left">' . $locate->Translate("Limit Type") . '</td>
					<td align="left">
					<select id="limittype" name="limittype" ' . $readonly . '>';
            if ($clid['limittype'] == "postpaid") {
                $html .= '
							<option value="">' . $locate->Translate("No limit") . '</option>
							<option value="prepaid">' . $locate->Translate("Prepaid") . '</option>
							<option value="postpaid" selected>' . $locate->Translate("Postpaid") . '</option>';
            } elseif ($clid['limittype'] == "prepaid") {
                $html .= '
							<option value="">' . $locate->Translate("No limit") . '</option>
							<option value="prepaid" selected>' . $locate->Translate("Prepaid") . '</option>
							<option value="postpaid">' . $locate->Translate("Postpaid") . '</option>';
            } else {
                $html .= '
							<option value="" selected>' . $locate->Translate("No limit") . '</option>
							<option value="prepaid">' . $locate->Translate("Prepaid") . '</option>
							<option value="postpaid">' . $locate->Translate("Postpaid") . '</option>';
            }
        }
        $html .= '<tr>
					<td nowrap align="left">' . $locate->Translate("Reseller") . '</td>
					<td align="left">' . $reselleroptions . '</td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Group") . '</td>
					<td align="left">
					' . $groupoptions . '
					</td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Status") . '</td>
					<td align="left">
						<select id="status" name="status"  ' . $readonly . '>' . $statusoptions . '</select>
					</td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Is Show") . '</td>
					<td align="left">
						<select id="isshow" name="isshow"  ' . $readonly . '><option value="yes" ' . $selecty . '>' . $locate->Translate("yes") . '</option><option value="no" ' . $selectn . '>' . $locate->Translate("no") . '</option></select>
					</td>
				</tr>';
        if ($_SESSION['curuser']['usertype'] != 'clid') {
            $html .= '<tr>
					<td colspan="2" align="center"><button id="submitButton" onClick=\'xajax_update(xajax.getFormValues("f"));return false;\'>' . $locate->Translate("Continue") . '</button></td>
				</tr>';
        }
        $html .= '</table>
			';
        $html .= '
				</form>
				*' . $locate->Translate("Obligatory Fields") . '
				';
        return $html;
    }
예제 #10
0
function setGroup($resellerid)
{
    global $locate, $config;
    $objResponse = new xajaxResponse();
    $res = astercrm::getAll("accountgroup", 'resellerid', $resellerid);
    $objResponse->addScript("addOption('groupid','0','" . $locate->Translate("All") . "');");
    //添加option
    while ($res->fetchInto($row)) {
        if ($config['synchronize']['id_autocrement_byset'] && ($row['id'] < $config['local_host']['minId'] || $row['id'] > $config['local_host']['maxId'])) {
            continue;
        }
        $objResponse->addScript("addOption('groupid','" . $row['id'] . "','" . $row['groupname'] . "');");
    }
    return $objResponse;
}
예제 #11
0
    function showItem($optionid)
    {
        global $locate, $db;
        $html = '
				<!-- No edit the next line -->
				<form method="post" name="fItem" id="fItem" method="post">
				
				<table border="1" width="100%" class="adminlist" id="tblItem">
				';
        $surveyoption = astercrm::getRecordById($optionid, "surveyoptions");
        $html .= "<tr><td>" . $locate->translate("Option") . "</td><td>" . $surveyoption['surveyoption'] . "(" . $locate->Translate($surveyoption['optiontype']) . ")" . "</td></tr>";
        $items = astercrm::getAll("surveyoptionitems", "optionid", $optionid);
        $i = 0;
        while ($row = $items->fetchRow()) {
            //65
            $html .= "<tr><td>" . chr(65 + $i) . '(<a href="?" onclick="deleteItem(\'' . $row['id'] . '\',\'' . $optionid . '\');return false;"><img src="skin/default/images/trash.png"></a>)</td><td>' . $row['itemcontent'] . "</td></tr>";
            $i++;
        }
        $html .= "<tr><td>" . chr(65 + $i) . "</td><td>\r\n\t\t\t\t\t\t\t\t\t\t<input type=hidden id=optionid name=optionid value=\"{$optionid}\"/>\r\n\t\t\t\t\t\t\t\t\t\t<input type=hidden id=optiontype name=optiontype value=\"" . $surveyoption['optiontype'] . "\"/>\r\n\t\t\t\t\t\t\t\t\t\t<input type=text id=itemcontent name=itemcontent size=40 maxlength=254/>\r\n\t\t\t\t\t\t\t\t\t\t<input type=\"button\" value=\"" . $locate->Translate("Add Item") . "\" onclick=\"addItem();\">\r\n\t\t\t\t\t\t\t\t\t</td></tr>";
        $html .= "</table></form>";
        return $html;
    }
예제 #12
0
/**
*  initialize page elements
*  @return	objResponse		object		xajax response object
*/
function showChannelsInfo()
{
    global $locate, $config, $db;
    $aDyadicArray[] = array($locate->Translate("src"), $locate->Translate("dst"), $locate->Translate("srcchan"), $locate->Translate("dstchan"), $locate->Translate("starttime"), $locate->Translate("answertime"), $locate->Translate("disposition"));
    $objResponse = new xajaxResponse();
    if ($config['system']['eventtype'] == 'curcdr') {
        if ($_SESSION['curuser']['usertype'] == 'admin') {
            $curcdr = astercrm::getAll("curcdr");
        } else {
            //print_r($_SESSION['curuser']['memberExtens']);exit;
            $curcdr = astercrm::getGroupCurcdr();
        }
        while ($curcdr->fetchInto($row)) {
            $systemCDR[] = array($row["src"], $row["dst"], $row["srcchan"], $row["dstchan"], $row["starttime"], $row["answertime"], $row["disposition"]);
        }
        $activeCalls = "&nbsp;&nbsp;" . count($systemCDR) . "&nbsp;" . $locate->Translate("active calls");
        $objResponse->addAssign("divActiveCalls", "innerHTML", $activeCalls);
        $systemChannels = common::generateTabelHtml(array_merge($aDyadicArray, $systemCDR));
        $objResponse->addAssign("channels", "innerHTML", nl2br(trim($systemChannels)));
        return $objResponse;
    }
    $channels = split(chr(13), asterisk::getCommandData('show channels verbose'));
    /*
    	if ($channels == null){
    			$objResponse->addAssign("channels", "innerHTML", "can not connect to AMI, please check config.php");
    			return $objResponse;
    	}
    */
    $channels = split(chr(10), $channels[1]);
    //trim the first two records and the last three records
    //	array_pop($channels);
    array_pop($channels);
    $activeCalls = array_pop($channels);
    $activeChannels = array_pop($channels);
    array_shift($channels);
    $title = array_shift($channels);
    $title = split("_", implode("_", array_filter(split(" ", $title))));
    $myInfo[] = $title;
    foreach ($channels as $channel) {
        if (strstr($channel, " Dial")) {
            $myItem = split("_", implode("_", array_filter(split(" ", $channel))));
            $myInfo[] = $myItem;
        }
    }
    $myChannels = common::generateTabelHtml($myInfo);
    $objResponse->addAssign("divActiveCalls", "innerHTML", $activeCalls);
    $objResponse->addAssign("channels", "innerHTML", nl2br(trim($myChannels)));
    return $objResponse;
}
예제 #13
0
function setGroup($resellerid)
{
    global $locate;
    $objResponse = new xajaxResponse();
    $res = astercrm::getAll("accountgroup", 'resellerid', $resellerid);
    $objResponse->addScript("addOption('groupid','0','');");
    //添加option
    while ($res->fetchInto($row)) {
        $objResponse->addScript("addOption('groupid','" . $row['id'] . "','" . $row['groupname'] . "');");
    }
    return $objResponse;
}
예제 #14
0
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;
}
예제 #15
0
    /**
     *  Imprime la forma para editar un nuevo registro sobre el DIV identificado por "formDiv".
     *
     *	@param $id		(int)		Identificador del registro a ser editado.
     *	@return $html	(string) Devuelve una cadena de caracteres que contiene la forma con los datos 
     *									a extraidos de la base de datos para ser editados 
     */
    function formEdit($id)
    {
        global $locate, $config;
        $group =& Customer::getRecordByID($id, 'accountgroup');
        $reselleroptions = '';
        $reseller = astercrm::getAll('resellergroup');
        if ($_SESSION['curuser']['usertype'] == 'admin') {
            $reselleroptions .= '<select id="resellerid" name="resellerid">';
            $reselleroptions .= '<option value="0"></option>';
            while ($reseller->fetchInto($row)) {
                if ($config['synchronize']['display_synchron_server']) {
                    $row['resellername'] = astercrm::getSynchronDisplay($row['id'], $row['resellername']);
                }
                if ($row['id'] == $group['resellerid']) {
                    $reselleroptions .= "<OPTION value='" . $row['id'] . "' selected>" . $row['resellername'] . "</OPTION>";
                } else {
                    $reselleroptions .= "<OPTION value='" . $row['id'] . "'>" . $row['resellername'] . "</OPTION>";
                }
            }
            $reselleroptions .= '</select>';
            //the admin has the reset group button
            $resetBtnStr = '<input type="button" onclick="if(confirm(&quot;' . $locate->Translate("Make Sure To Reset The Relate Data By Group") . '?&quot;)) xajax_resetGroup(&quot;' . $group['id'] . '&quot;);return false;" value="' . $locate->Translate("Reset Group") . '">';
        } else {
            while ($reseller->fetchInto($row)) {
                if ($row['id'] == $_SESSION['curuser']['resellerid']) {
                    if ($config['synchronize']['display_synchron_server']) {
                        $row['resellername'] = astercrm::getSynchronDisplay($row['id'], $row['resellername']);
                    }
                    $reselleroptions .= $row['resellername'] . '<input type="hidden" value="' . $row['id'] . '" name="resellerid" id="resellerid">';
                    break;
                }
            }
            //except the admin,other don't have the reset group button
            $resetBtnStr = '';
        }
        $html = '
			<!-- No edit the next line -->
			<form method="post" name="f" id="f">
			<input type="hidden" id="groupid" name="groupid" value=' . $group['id'] . '>
			<table border="1" width="100%" class="adminlist">
				<tr>
					<td nowrap align="left">' . $locate->Translate("Reseller") . '*</td>
					<td align="left">' . $reselleroptions . '</td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Group Name") . '*</td>
					<td align="left"><input type="text" id="groupname" name="groupname" size="25" maxlength="30" value="' . $group['groupname'] . '">&nbsp;' . $resetBtnStr . '</td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Title") . '</td>
					<td align="left"><input type="text" id="grouptitle" name="grouptitle" size="25" maxlength="50" value="' . $group['grouptitle'] . '"></td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Tagline") . '</td>
					<td align="left"><input type="text" id="grouptagline" name="grouptagline" size="25" maxlength="80" value="' . $group['grouptagline'] . '"></td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Account Code") . '</td>
					<td align="left"><input type="text" id="accountcode" name="accountcode" size="25" maxlength="30" value="' . $group['accountcode'] . '">' . "(" . $locate->Translate("might be useful for callback") . ")" . '</td>
				</tr>
				<!--<tr>
					<td nowrap align="left">' . $locate->Translate("Allow Callback") . '</td>
					<td align="left">
					<select id="allowcallback" name="allowcallback">';
        if ($_SESSION['curuser']['usertype'] == 'admin' || $_SESSION['curuser']['allowcallback'] == 'yes') {
            if ($group['allowcallback'] == "yes") {
                $html .= '<option value="yes" selected>' . $locate->Translate("Yes") . '</option>';
                $html .= '<option value="no">' . $locate->Translate("No") . '</option>';
            } else {
                $html .= '<option value="yes">' . $locate->Translate("Yes") . '</option>';
                $html .= '<option value="no" selected>' . $locate->Translate("No") . '</option>';
            }
        } else {
            $html .= '<option value="no">' . $locate->Translate("No") . '</option>';
        }
        $html .= '
					</select>
					</td>
				</tr>-->
				<tr>
					<td nowrap align="left">' . $locate->Translate("Credit Limit") . '*</td>
					<td align="left"><input type="text" id="creditlimit" name="creditlimit" size="25" maxlength="30" value="' . $group['creditlimit'] . '"></td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Cur Credit") . '</td>
					<td align="left">
					<input type="text" id="curcreditshow" name="curcreditshow" size="25" maxlength="100" value="' . $group['curcredit'] . '" readonly>
					<input type="hidden" id="curcredit" name="curcredit" value="' . $group['curcredit'] . '">
				</td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Operate") . '</td>
					<td align="left" id="tdOperate">
						<select id="creditmodtype" name="creditmodtype" onchange="showComment(this)">
							<option value="">' . $locate->Translate("No change") . '</option>
							<option value="add">' . $locate->Translate("Refund") . '</option>
							<option value="reduce">' . $locate->Translate("Charge") . '</option>
						</select>
						<input type="text" id="creditmod" name="creditmod" size="15" maxlength="100" value="" disabled><p>
						' . $locate->Translate("Comment") . ' :&nbsp;<input type="text" id="comment" name="comment" size="18" maxlength="20" value="" disabled></p>
					</td>
				</tr>

				<tr>
					<td nowrap align="left">' . $locate->Translate("Limit Type") . '</td>
					<td align="left">
					<select id="limittype" name="limittype">';
        if ($group['limittype'] == "postpaid") {
            $html .= '
						<option value="">' . $locate->Translate("No limit") . '</option>
						<option value="prepaid">' . $locate->Translate("Prepaid") . '</option>
						<option value="postpaid" selected>' . $locate->Translate("Postpaid") . '</option>';
        } elseif ($group['limittype'] == "prepaid") {
            $html .= '
						<option value="">' . $locate->Translate("No limit") . '</option>
						<option value="prepaid" selected>' . $locate->Translate("Prepaid") . '</option>
						<option value="postpaid">' . $locate->Translate("Postpaid") . '</option>';
        } else {
            $html .= '
						<option value="" selected>' . $locate->Translate("No limit") . '</option>
						<option value="prepaid">' . $locate->Translate("Prepaid") . '</option>
						<option value="postpaid">' . $locate->Translate("Postpaid") . '</option>';
        }
        $html .= '</select>
					</td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Group Billsec Multiple") . '</td>
					<td align="left">
						<input type="text" id="group_multiple" name="group_multiple" size="6" maxlength="6" value="' . $group['group_multiple'] . '">
					</td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Customer Billsec Multiple") . '</td>
					<td align="left">
						<input type="text" id="customer_multiple" name="customer_multiple" size="6" maxlength="6" value="' . $group['customer_multiple'] . '">
					</td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Display Logo") . '</td>
					<td align="left"><input type="radio" id="grouplogostatus" name="grouplogostatus" value="1" ';
        if ($group['grouplogostatus'] == 1) {
            $html .= 'checked';
        }
        $html .= '>enable&nbsp;&nbsp;<input type="radio" id="grouplogostatus" name="grouplogostatus" value="0"';
        if ($group['grouplogostatus'] == 0) {
            $html .= 'checked';
        }
        $html .= '>disable</td>
				</tr>
				</table>
				</form>';
        $html .= '<form action="upload.php" method="post" enctype="multipart/form-data" name="formLogoUpload" id="formLogoUpload" target="iframeForUpload">
				<table border="1" width="100%" class="adminlist">
					<tr>
					<td nowrap align="left">' . $locate->Translate("Upload New Logo") . '</td>
					<td><input type="file" name="callshopLogo" id="callshopLogo" size="35"/><input type="hidden" id="LogoUploadFlag" name="LogoUploadFlag" value="1">
					<input type="hidden" id="group_id" name="group_id" value=' . $group['id'] . '></td>
					<tr>
					<tr>
						<td  colspan="2" align="center"><button id="submitButton" onClick=\'xajax_update(xajax.getFormValues("f")); document.getElementById("formLogoUpload").submit();return false;\'>' . $locate->Translate("continue") . '</button></td>
					</tr>
				</table>
				</form>
			';
        $html .= '				
				*' . $locate->Translate("Obligatory Fields") . '
				';
        return $html;
    }
예제 #16
0
    /**
     *  Imprime la forma para editar un nuevo registro sobre el DIV identificado por "formDiv".
     *
     *	@param $id		(int)		Identificador del registro a ser editado.
     *	@return $html	(string) Devuelve una cadena de caracteres que contiene la forma con los datos 
     *									a extraidos de la base de datos para ser editados 
     */
    function formEdit($id)
    {
        global $locate, $config;
        $rate =& Customer::getRecordByID($id, 'resellerrate');
        $reseller = astercrm::getAll('resellergroup');
        $options .= '<select id="resellerid" name="resellerid">';
        $flag = false;
        while ($reseller->fetchInto($row)) {
            if ($config['synchronize']['display_synchron_server']) {
                $row['resellername'] = astercrm::getSynchronDisplay($row['id'], $row['resellername']);
            }
            if ($row['id'] == $rate['resellerid']) {
                $options .= "<OPTION value='" . $row['id'] . "' selected>" . $row['resellername'] . "</OPTION>";
                $flag = true;
            } else {
                $options .= "<OPTION value='" . $row['id'] . "'>" . $row['resellername'] . "</OPTION>";
            }
        }
        if ($flag == true) {
            $options .= "<OPTION value='0'>" . $locate->Translate("All") . "</OPTION>";
        } else {
            $options .= "<OPTION value='0' selected>" . $locate->Translate("All") . "</OPTION>";
        }
        $options .= '</select>';
        $html = '
			<!-- No edit the next line -->
			<form method="post" name="f" id="f">
			
			<table border="1" width="100%" class="adminlist">
				<tr>
					<td nowrap align="left">' . $locate->Translate("Prefix") . '</td>
					<td align="left"><input type="hidden" id="id" name="id" value="' . $rate['id'] . '"><input type="text" id="dialprefix" name="dialprefix" size="25" maxlength="30" value="' . $rate['dialprefix'] . '"></td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Length") . '</td>
					<td align="left"><input type="text" id="numlen" name="numlen" size="10" maxlength="10" value="' . $rate['numlen'] . '"></td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Dest") . '</td>
					<td align="left"><input type="text" id="destination" name="destination" size="25" maxlength="30" value="' . $rate['destination'] . '"></td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Connect Charge") . '</td>
					<td align="left"><input type="text" id="connectcharge" name="connectcharge" size="20" maxlength="20" value="' . $rate['connectcharge'] . '"></td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Init Block") . '</td>
					<td align="left"><input type="text" id="initblock" name="initblock" size="25" maxlength="100" value="' . $rate['initblock'] . '"></td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Rate") . '</td>
					<td align="left"><input type="text" id="rateinitial" name="rateinitial" size="25" maxlength="30" value="' . $rate['rateinitial'] . '"></td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Billing Block") . '</td>
					<td align="left"><input type="text" id="billingblock" name="billingblock" size="25" maxlength="30" value="' . $rate['billingblock'] . '"></td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Reseller") . '</td>
					<td align="left">
					' . $options . '
					</td>
				</tr>
				<tr>
					<td colspan="2" align="center"><button id="submitButton" onClick=\'xajax_update(xajax.getFormValues("f"));return false;\'>' . $locate->Translate("Continue") . '</button></td>
				</tr>

			 </table>
			';
        $html .= '
				</form>
				*' . $locate->Translate("obligatory_fields") . '
				';
        return $html;
    }