a2b_entity_def_ratecard.php
来自「asterisk用 的voip记费软件」· PHP 代码 · 共 372 行 · 第 1/2 页
PHP
372 行
<?phpinclude ("../lib/defines.php");include ("../lib/module.access.php");include ("../lib/Form/Class.FormHandler.inc.php");include ("./form_data/FG_var_def_ratecard.inc");include ("../lib/smarty.php");if (! has_rights (ACX_RATECARD)){ Header ("HTTP/1.0 401 Unauthorized"); Header ("Location: PP_error.php?c=accessdenied"); die(); }getpost_ifset(array('posted', 'Period', 'frommonth', 'fromstatsmonth', 'tomonth', 'tostatsmonth', 'fromday', 'fromstatsday_sday', 'fromstatsmonth_sday', 'today', 'tostatsday_sday', 'tostatsmonth_sday', 'current_page', 'tariffplan', 'removeallrate', 'removetariffplan', 'definecredit', 'IDCust', 'mytariff_id', 'destination', 'dialprefix', 'buyrate1', 'buyrate2', 'buyrate1type', 'buyrate2type', 'rateinitial1', 'rateinitial2', 'rateinitial1type', 'rateinitial2type', 'id_trunk', "check", "type", "mode"));/********************************* BATCH UPDATE ***********************************/getpost_ifset(array('batchupdate', 'upd_id_trunk', 'upd_idtariffplan', 'upd_buyrate', 'upd_buyrateinitblock', 'upd_buyrateincrement', 'upd_rateinitial', 'upd_initblock', 'upd_billingblock', 'upd_connectcharge', 'upd_disconnectcharge', 'upd_inuse', 'upd_activated', 'upd_language', 'upd_tariff', 'upd_credit', 'upd_credittype', 'upd_simultaccess', 'upd_currency', 'upd_typepaid', 'upd_creditlimit', 'upd_enableexpire', 'upd_expirationdate', 'upd_expiredays', 'upd_runservice', "filterprefix"));/***********************************************************************************/$HD_Form -> setDBHandler (DbConnect());$HD_Form -> init();// CHECK IF REQUEST OF BATCH UPDATEif ($batchupdate == 1 && is_array($check)){ $HD_Form->prepare_list_subselection('list'); // Array ( [upd_simultaccess] => on [upd_currency] => on ) $loop_pass=0; $SQL_UPDATE = ''; foreach ($check as $ind_field => $ind_val){ //echo "<br>::> $ind_field -"; $myfield = substr($ind_field,4); if ($loop_pass!=0) $SQL_UPDATE.=','; // Standard update mode if (!isset($mode["$ind_field"]) || $mode["$ind_field"]==1){ if (!isset($type["$ind_field"])){ $SQL_UPDATE .= " $myfield='".$$ind_field."'"; }else{ $SQL_UPDATE .= " $myfield='".$type["$ind_field"]."'"; } // Mode 2 - Equal - Add - Substract }elseif($mode["$ind_field"]==2){ if (!isset($type["$ind_field"])){ $SQL_UPDATE .= " $myfield='".$$ind_field."'"; }else{ if ($type["$ind_field"] == 1){ $SQL_UPDATE .= " $myfield='".$$ind_field."'"; }elseif ($type["$ind_field"] == 2){ $SQL_UPDATE .= " $myfield = $myfield +'".$$ind_field."'"; }else{ $SQL_UPDATE .= " $myfield = $myfield -'".$$ind_field."'"; } } } $loop_pass++; } $SQL_UPDATE = "UPDATE $HD_Form->FG_TABLE_NAME SET $SQL_UPDATE"; if (strlen($HD_Form->FG_TABLE_CLAUSE)>1) { $SQL_UPDATE .= ' WHERE '; $SQL_UPDATE .= $HD_Form->FG_TABLE_CLAUSE; if ($_SESSION['def_ratecard'] != null) { $SQL_UPDATE .= ' AND '.$_SESSION['def_ratecard']; } }else{ $SQL_UPDATE .= ' WHERE '.$_SESSION['def_ratecard']; } if (! $res = $HD_Form -> DBHandle -> query($SQL_UPDATE)) $update_msg = "<center><font color=\"red\"><b>".gettext("Could not perform the batch update")."!</b></font></center>"; else $update_msg = "<center><font color=\"green\"><b>".gettext("The batch update has been successfully perform")." !</b></font></center>"; }//echo "FG_TABLE_NAME=$HD_Form->FG_TABLE_NAME :: FG_TABLE_CLAUSE=$HD_Form->FG_TABLE_CLAUSE<br>";/********************************* END BATCH UPDATE ***********************************/if ($id!="" || !is_null($id)){ $HD_Form -> FG_EDITION_CLAUSE = str_replace("%id", "$id", $HD_Form -> FG_EDITION_CLAUSE); }if (!isset($form_action)) $form_action="list"; //ask-addif (!isset($action)) $action = $form_action;if (is_string ($tariffplan) && strlen(trim($tariffplan))>0){ list($mytariff_id, $mytariffname) = split('-:-', $tariffplan); $_SESSION["mytariff_id"]= $mytariff_id; $_SESSION["mytariffname"]= $mytariffname; //$_SESSION["basetariffgroup"]= $basetariffgroup; }else{ $mytariff_id = $_SESSION["mytariff_id"]; $mytariffname = $_SESSION["mytariffname"]; //$basetariffgroup = $_SESSION["basetariffgroup"];}if ( ($form_action == "list") && ($HD_Form->FG_FILTER_SEARCH_FORM) && ($_POST['posted_search'] == 1 ) && is_numeric($mytariff_id)){ $HD_Form->FG_TABLE_CLAUSE = "idtariffplan='$mytariff_id'";}$list = $HD_Form -> perform_action($form_action);// #### HEADER SECTION$smarty->display('main.tpl');// #### HELP SECTIONif (($form_action == 'ask-add') || ($form_action == 'ask-edit')) echo $CC_help_add_rate;else echo $CC_help_def_ratecard;// DISPLAY THE UPDATE MESSAGEif (isset($update_msg) && strlen($update_msg)>0) echo $update_msg; ?><div class="toggle_hide2show"><center><a href="#" target="_self"><img class="toggle_hide2show" src="<?php echo KICON_PATH; ?>/toggle_hide2show.png" onmouseover="this.style.cursor='hand';" HEIGHT="16"> <font class="fontstyle_002"><?php echo gettext("SEARCH RATES");?> </font></a></center> <div class="tohide" style="display:none;"><?php// #### CREATE SEARCH FORMif ($form_action == "list"){ $HD_Form -> create_search_form();}?> </div></div><?php/********************************* BATCH UPDATE ***********************************/if ($form_action == "list"){ $instance_table_tariffname = new Table("cc_tariffplan", "id, tariffname"); $FG_TABLE_CLAUSE = ""; $list_tariffname = $instance_table_tariffname -> Get_list ($HD_Form->DBHandle, $FG_TABLE_CLAUSE, "tariffname", "ASC", null, null, null, null); $nb_tariffname = count($list_tariffname); $instance_table_trunk = new Table("cc_trunk", "id_trunk, trunkcode, providerip"); $FG_TABLE_CLAUSE = ""; $list_trunk = $instance_table_trunk -> Get_list ($HD_Form->DBHandle, $FG_TABLE_CLAUSE, "trunkcode", "ASC", null, null, null, null); $nb_trunk = count($list_trunk);?><!-- ** ** ** ** ** Part for the Update ** ** ** ** ** --><div class="toggle_hide2show"><center><a href="#" target="_self"><img class="toggle_hide2show" src="<?php echo KICON_PATH; ?>/toggle_hide2show.png" onmouseover="this.style.cursor='hand';" HEIGHT="16"> <font class="fontstyle_002"><?php echo gettext("BATCH UPDATE");?> </font></a></center> <div class="tohide" style="display:none;"> <center><b> <?php echo $HD_Form -> FG_NB_RECORD ?> <?php echo gettext("rates selected!"); ?> <?php echo gettext("Use the options below to batch update the selected rates.");?></b> <table align="center" border="0" width="65%" cellspacing="1" cellpadding="2"> <form name="updateForm" action="<?php echo $_SERVER['PHP_SELF']?>" method="post"> <INPUT type="hidden" name="batchupdate" value="1"> <INPUT type="hidden" name="atmenu" value="<?php echo $_GET['atmenu']?>"> <INPUT type="hidden" name="popup_select" value="<?php echo $_GET['popup_select']?>"> <INPUT type="hidden" name="popup_formname" value="<?php echo $_GET['popup_formname']?>"> <INPUT type="hidden" name="popup_fieldname" value="<?php echo $_GET['popup_fieldname']?>"> <INPUT type="hidden" name="form_action" value="<?php echo $_GET['form_action']?>"> <INPUT type="hidden" name="filterprefix" value="<?php echo $_GET['filterprefix']?>"> <INPUT type="hidden" name="filterfield" value="<?php echo $_GET['filterfield']?>"> <tr> <td align="left" class="bgcolor_001"> <input name="check[upd_id_trunk]" type="checkbox" <?php if ($check["upd_id_trunk"]=="on") echo "checked"?>> </td> <td align="left" class="bgcolor_001"> <font class="fontstyle_009">1) <?php echo gettext("TRUNK");?> :</font> <select NAME="upd_id_trunk" size="1" class="form_enter" > <?php foreach ($list_trunk as $recordset){ ?> <option class=input value='<?php echo $recordset[0]?>' <?php if ($upd_id_trunk==$recordset[0]) echo 'selected="selected"'?>><?php echo $recordset[1].' ('.$recordset[2].')'?></option> <?php } ?> </select>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?