-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrate.grid.inc.php
587 lines (500 loc) · 21.3 KB
/
rate.grid.inc.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
<?php
/*******************************************************************************
* rate.grid.inc.php
* @author Solo Fu <[email protected]>
* @classVersion 1.0
* @date 18 Oct 2007
* Functions List
* Revision 0.01 2007/11/21 13:15:00 last modified by solo
* Desc: page created
********************************************************************************/
require_once 'db_connect.php';
require_once 'rate.common.php';
require_once 'include/astercrm.class.php';
class Customer extends astercrm
{
/**
* Inserta un nuevo registro en la tabla.
*
* @param $f (array) Arreglo que contiene los datos del formulario pasado.
* @return $res (object) Devuelve el objeto con la respuesta de la sentencia SQL ejecutada del INSERT.
*/
function insertNewRate($f){
global $db,$config;
$f = astercrm::variableFiler($f);
$sql= "INSERT INTO myrate SET "
."dialprefix = '".$f['dialprefix']."', "
."numlen = '".$f['numlen']."', "
."destination = '".$f['destination']."', "
."rateinitial = '".$f['rateinitial']."', "
."initblock = '".$f['initblock']."', "
."billingblock = '".$f['billingblock']."',"
."connectcharge = '".$f['connectcharge']."', "
."addtime = now(), "
."groupid = '".$f['groupid']."', "
."resellerid = '".$f['resellerid']."' ";
if($config['synchronize']['id_autocrement_byset']){
$sql .= ",id='".$f['id']."' ";
}
Customer::events($sql);
$res =& $db->query($sql);
return $res;
}
function updateRateRecord($f){
global $db;
$f = astercrm::variableFiler($f);
$sql= "UPDATE myrate SET "
."dialprefix = '".$f['dialprefix']."', "
."numlen = '".$f['numlen']."', "
."destination = '".$f['destination']."', "
."rateinitial = '".$f['rateinitial']."', "
."initblock = '".$f['initblock']."', "
."billingblock = '".$f['billingblock']."', "
."connectcharge= '".$f['connectcharge']."', "
."groupid = '".$f['groupid']."', "
."resellerid = '".$f['resellerid']."', "
."addtime= now() "
."WHERE id = ".$f['id'];
astercrm::events($sql);
$res =& $db->query($sql);
return $res;
}
/**
* Obtiene todos los registros de la tabla paginados.
*
* @param $start (int) Inicio del rango de la página de datos en la consulta SQL.
* @param $limit (int) Límite del rango de la página de datos en la consultal SQL.
* @param $order (string) Campo por el cual se aplicará el orden en la consulta SQL.
* @return $res (object) Objeto que contiene el arreglo del resultado de la consulta SQL.
*/
function &getAllRecords($start, $limit, $order = null, $creby = null){
global $db;
$sql = "SELECT myrate.*, groupname,resellername FROM myrate LEFT JOIN accountgroup ON accountgroup.id = myrate.groupid LEFT JOIN resellergroup ON resellergroup.id = myrate.resellerid WHERE ";
if ($_SESSION['curuser']['usertype'] == 'admin'){
$sql .= " 1 ";
}elseif ($_SESSION['curuser']['usertype'] == 'reseller'){
$sql .= " (myrate.resellerid = ".$_SESSION['curuser']['resellerid']." OR myrate.resellerid = 0)";
}else{
$sql .= " ( (myrate.groupid = ".$_SESSION['curuser']['groupid']." OR myrate.groupid = 0) AND (myrate.resellerid = ".$_SESSION['curuser']['resellerid']." OR myrate.resellerid = 0) )";
}
// if ($creby != null)
// $sql .= " WHERE note.creby = '".$_SESSION['curuser']['username']."' ";
if($order == null){
$sql .= " LIMIT $start, $limit";//.$_SESSION['ordering'];
}else{
$sql .= " ORDER BY $order ".$_SESSION['ordering']." LIMIT $start, $limit";
}
Customer::events($sql);
$res =& $db->query($sql);
return $res;
}
/**
* Obtiene todos registros de la tabla paginados y aplicando un filtro
*
* @param $start (int) Es el inicio de la página de datos en la consulta SQL
* @param $limit (int) Es el limite de los datos páginados en la consultal SQL.
* @param $filter (string) Nombre del campo para aplicar el filtro en la consulta SQL
* @param $content (string) Contenido a filtrar en la conslta SQL.
* @param $order (string) Campo por el cual se aplicará el orden en la consulta SQL.
* @return $res (object) Objeto que contiene el arreglo del resultado de la consulta SQL.
*/
function &getRecordsFilteredMore($start, $limit, $filter, $content, $order,$table, $ordering = ""){
global $db;
$i=0;
$joinstr='';
foreach ($content as $value){
$value = preg_replace("/'/","\\'",$value);
$value=trim($value);
if (strlen($value)!=0 && strlen($filter[$i]) != 0){
$joinstr.="AND $filter[$i] like '%".$value."%' ";
}
$i++;
}
$sql = "SELECT myrate.*, groupname,resellername FROM myrate LEFT JOIN accountgroup ON accountgroup.id = myrate.groupid LEFT JOIN resellergroup ON resellergroup.id = myrate.resellerid WHERE ";
if ($_SESSION['curuser']['usertype'] == 'admin'){
$sql .= " 1 ";
}elseif ($_SESSION['curuser']['usertype'] == 'reseller'){
$sql .= " (myrate.resellerid = ".$_SESSION['curuser']['resellerid']." OR myrate.resellerid = 0) ";
}else{
$sql .= " ( (myrate.groupid = ".$_SESSION['curuser']['groupid']." OR myrate.groupid = 0) AND (myrate.resellerid = ".$_SESSION['curuser']['resellerid']." OR myrate.resellerid = 0) ) ";
}
if ($joinstr!=''){
$joinstr=ltrim($joinstr,'AND'); //去掉最左边的AND
$sql .= " AND ".$joinstr." "
." ORDER BY ".$order
." ".$_SESSION['ordering']
." LIMIT $start, $limit $ordering";
}
Customer::events($sql);
$res =& $db->query($sql);
return $res;
}
/**
* Devuelte el numero de registros de acuerdo a los parámetros del filtro
*
* @param $filter (string) Nombre del campo para aplicar el filtro en la consulta SQL
* @param $order (string) Campo por el cual se aplicará el orden en la consulta SQL.
* @return $row['numrows'] (int) Número de registros (líneas)
*/
function &getNumRows($filter = null, $content = null){
global $db;
if ($_SESSION['curuser']['usertype'] == 'admin'){
$sql .= " SELECT COUNT(*) FROM myrate ";
}elseif ($_SESSION['curuser']['usertype'] == 'reseller'){
$sql .= " SELECT COUNT(*) FROM myrate WHERE resellerid = ".$_SESSION['curuser']['resellerid']." OR resellerid = 0 ";
}else{
$sql .= " SELECT COUNT(*) FROM myrate WHERE (groupid = ".$_SESSION['curuser']['groupid']." OR groupid = 0) AND (myrate.resellerid = ".$_SESSION['curuser']['resellerid']." OR myrate.resellerid = 0)";
}
Customer::events($sql);
$res =& $db->getOne($sql);
return $res;
}
function &getNumRowsMore($filter = null, $content = null,$table){
global $db;
$i=0;
$joinstr='';
foreach ($content as $value){
$value = preg_replace("/'/","\\'",$value);
$value=trim($value);
if (strlen($value)!=0 && strlen($filter[$i]) != 0){
$joinstr.="AND $filter[$i] like '%".$value."%' ";
}
$i++;
}
$sql = "SELECT COUNT(*) AS numRows FROM myrate LEFT JOIN accountgroup ON accountgroup.id = myrate.groupid LEFT JOIN resellergroup ON resellergroup.id = myrate.resellerid WHERE";
if ($_SESSION['curuser']['usertype'] == 'admin'){
$sql .= " 1 ";
}elseif ($_SESSION['curuser']['usertype'] == 'reseller'){
$sql .= " (myrate.resellerid = ".$_SESSION['curuser']['resellerid']." OR myrate.resellerid = 0) ";
}else{
$sql .= " ( (myrate.groupid = ".$_SESSION['curuser']['groupid']." OR myrate.groupid = 0) AND (myrate.resellerid = ".$_SESSION['curuser']['resellerid']." OR myrate.resellerid = 0) )";
}
if ($joinstr!=''){
$joinstr=ltrim($joinstr,'AND'); //去掉最左边的AND
$sql .= " AND ".$joinstr." ";
}else {
$sql .= " 1 ";
}
Customer::events($sql);
$res =& $db->getOne($sql);
return $res;
}
function &getRecordsFilteredMorewithstype($start, $limit, $filter, $content, $stype,$order,$table){
global $db;
$joinstr = astercrm::createSqlWithStype($filter,$content,$stype);
$sql = "SELECT myrate.*, groupname,resellername FROM myrate LEFT JOIN accountgroup ON accountgroup.id = myrate.groupid LEFT JOIN resellergroup ON resellergroup.id = myrate.resellerid WHERE ";
if ($_SESSION['curuser']['usertype'] == 'admin'){
$sql .= " 1 ";
}elseif ($_SESSION['curuser']['usertype'] == 'reseller'){
$sql .= " (myrate.resellerid = ".$_SESSION['curuser']['resellerid']." OR myrate.resellerid = 0) ";
}else{
$sql .= " ( (myrate.groupid = ".$_SESSION['curuser']['groupid']." OR myrate.groupid = 0) AND (myrate.resellerid = ".$_SESSION['curuser']['resellerid']." OR myrate.resellerid = 0) ) ";
}
if ($joinstr!=''){
$joinstr=ltrim($joinstr,'AND'); //去掉最左边的AND
$sql .= " AND ".$joinstr." "
." ORDER BY ".$order
." ".$_SESSION['ordering']
." LIMIT $start, $limit $ordering";
}
Customer::events($sql);
$res =& $db->query($sql);
return $res;
}
function &getNumRowsMorewithstype($filter, $content,$stype,$table){
global $db;
$joinstr = astercrm::createSqlWithStype($filter,$content,$stype);
$sql = "SELECT COUNT(*) AS numRows FROM myrate LEFT JOIN accountgroup ON accountgroup.id = myrate.groupid LEFT JOIN resellergroup ON resellergroup.id = myrate.resellerid WHERE";
if ($_SESSION['curuser']['usertype'] == 'admin'){
$sql .= " 1 ";
}elseif ($_SESSION['curuser']['usertype'] == 'reseller'){
$sql .= " (myrate.resellerid = ".$_SESSION['curuser']['resellerid']." OR myrate.resellerid = 0) ";
}else{
$sql .= " ( (myrate.groupid = ".$_SESSION['curuser']['groupid']." OR myrate.groupid = 0) AND (myrate.resellerid = ".$_SESSION['curuser']['resellerid']." OR myrate.resellerid = 0) )";
}
if ($joinstr!=''){
$joinstr=ltrim($joinstr,'AND'); //去掉最左边的AND
$sql .= " AND ".$joinstr." ";
}else {
$sql .= " 1 ";
}
Customer::events($sql);
$res =& $db->getOne($sql);
return $res;
}
function formAdd(){
global $locate,$config;
$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']);
}
$reselleroptions .= "<OPTION value='".$row['id']."'>".$row['resellername']."</OPTION>";
}
$reselleroptions .= '</select>';
}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;
}
}
}
$group = astercrm::getAll('accountgroup','resellerid',$_SESSION['curuser']['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']);
}
$groupoptions .= "<OPTION value='".$row['id']."'>".$row['groupname']."</OPTION>";
}
$groupoptions .= '</select>';
}else{
while ($group->fetchInto($row)){
if ($row['id'] == $_SESSION['curuser']['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="text" id="dialprefix" name="dialprefix" size="15" maxlength="30" onKeyUp="xajax_showBuyRate(this.value);" onclick="xajax_showBuyRate(this.value);"> <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="0"></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"></td>
</tr>
<tr>
<td nowrap align="left">'.$locate->Translate("Connect Charge").'</td>
<td align="left"><input type="text" id="connectcharge" name="connectcharge" size="25" maxlength="30"></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"></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"></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="5" value="60"></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_save(xajax.getFormValues("f"));return false;\'>'.$locate->Translate("Continue").'</button>
</td>
</tr>
</table>
';
$html .='
</form>
*'.$locate->Translate("Obligatory Fields").'
';
return $html;
}
/**
* 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);"> <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;
}
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%"> </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;
}
}
?>