$thismenucode = "2k302"; require "../include/common.inc.php"; $db = new db_test(); $db2 = new db_test(); $db3 = new db_test(); if ($type == "check") { $gourl = "tb_author_b.php"; } if ($type == "author_sp") { $gourl = "tb_author_sp_b.php"; } $gotourl = $gourl . $tempurl; $t = new Template(".", "keep"); $t->set_file("template", "checkauthorpaycard.html"); $arr_paytype = getauthorpaycardmenu(); $arr_text = array('刷卡器设备号', "刷卡器每笔限额", "刷卡次数", "日额度(元)", "月额度(元)", '刷卡器所在代理商', '刷卡器刷卡总次数', '刷卡金额', "最后一次刷卡时间"); foreach ($arr_paytype as $value) { $arr_text[] = $value; } $arr_text1 = array("刷卡金额", "刷卡次数"); for ($i = 0; $i < count($arr_text); $i++) { $max = count($arr_text) - 1; if (8 < $i) { $colspan = "colspan=2"; foreach ($arr_text1 as $value) { $theadth1 .= ' <th>' . $value . '</th>'; } } else { $colspan = ""; $theadth1 .= '<th></th>';
$sWhere .= ')'; } /* Individual column filtering */ for ($i = 1; $i < count($aColumns); $i++) { $b_s = "bSearchable_" . $i; $s_s = "sSearch_" . $i; if (${$b_s} == "true" && ${$s_s} != '') { if ($sWhere == "") { $sWhere = "AND "; } else { $sWhere .= " AND "; } $sWhere .= $aColumns[$i] . " LIKE '%" . trim(${$s_s}) . "%' "; } } $arr_appmnu = getauthorpaycardmenu(); $nowdate = date("Y-m", time()); $query = "select sum(fd_agpm_paymoney) as paymoney,COUNT(fd_agpm_paycardid) as paycardcount ,\n\t\tfd_agpm_paytype as paytype ,fd_agpm_paycardid as paycardid\n\t\tfrom tb_agentpaymoneylist \n\t\tgroup by fd_agpm_paycardid ,fd_agpm_paytype "; $db->query($query); if ($db->nf()) { while ($db->next_record()) { $paycardid = $db->f(paycardid); $paytype = $db->f(paytype); $arr_data[$paycardid][$paytype]['paymoney'] = $db->f(paymoney); $arr_data[$paycardid][$paytype]['paycardcount'] = $db->f(paycardcount); } } $query = "select\n\t\tgroup_concat(fd_agpm_paytype) as paytype,\n\t\tfd_paycard_newspaydata as newspaydata,\n\t\tsum(fd_agpm_paymoney) as paymoney,\t\n\t\tCOUNT(fd_agpm_paycardid) as paycardcount,\n\t\tfd_paycard_key as paycardkey ,\n\t\tfd_cus_allname as allname ,\n\t\tfd_agpm_paycardid as paycardid,\n\t\tfd_paycard_everymoney as everymoney ,\n\t\tfd_paycard_everycounts as everycounts,\n\t\tfd_paycard_neverymoney as neverymoney,\n\t\tfd_paycard_nallmoney as nallmoney\n\t\tfrom tb_paycard \n\t\tleft join tb_agentpaymoneylist on fd_paycard_id = fd_agpm_paycardid\n\t\tleft join tb_customer on fd_paycard_cusid = fd_cus_id\t\t\t \n\t\t where fd_agpm_payrq='00' and fd_paycard_authorid='{$authorid}' and DATE_FORMAT(fd_agpm_paydate,'%Y-%m')='{$nowdate}' {$sWhere} group by fd_agpm_paycardid "; $db->query($query); $totoalcount = $db->nf() + 0; $count = 0;