Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once "../../../library/adodb5/adodb.inc.php";
- require_once '../../../config/config.php';
- require_once '../../../function/function.php';
- require_once '../../session_login.php';
- //require_once '../session_group.php';
- date_default_timezone_set("Asia/Jakarta");
- $current_date = date('Y-m-d');
- ini_set('memory_limit','-1');
- error_reporting(0);
- $aColumns = array('ACCTNO','ACTYPE','SNAME', 'CFNA2','CFNA5','CFSSCD','CFSSNO','CFCLAS');
- $aColumns_sorting = array('ACCTNO','ACTYPE','SNAME', 'CFNA2','CFNA5','CFSSCD','CFSSNO','ACCTNO');
- /* Indexed column (used for fast and accurate table cardinality) */
- $sIndexColumn = "ACCTNO";
- /*
- * Ordering
- */
- if ( isset( $_GET['iSortCol_0'] ) )
- {
- $sOrder = "ORDER BY ";
- for ( $i=0 ; $i<intval( $_GET['iSortingCols'] ) ; $i++ )
- {
- if ( $_GET[ 'bSortable_'.intval($_GET['iSortCol_'.$i]) ] == "true" )
- {
- $sOrder .= $aColumns_sorting[ intval( $_GET['iSortCol_'.$i] ) ]."
- ".($_GET['sSortDir_'.$i]==='asc' ? 'asc' : 'desc').", ";
- }
- }
- $sOrder = substr_replace( $sOrder, "", -2 );
- if ( $sOrder == "ORDER BY" )
- {
- $sOrder = "";
- }
- }
- /* Filtering */
- $sWhere = "";
- if ( isset($_GET['sSearch']) && $_GET['sSearch'] != "" ) {
- $sWhere = "WHERE (";
- for ( $i=0 ; $i<count($aColumns) ; $i++ ) {
- $sWhere .= $aColumns[$i]." LIKE '%".addslashes( $_GET['sSearch'] )."%' OR ";
- }
- $sWhere = substr_replace( $sWhere, "", -3 );
- $sWhere .= ')';
- }
- /* Individual column filtering */
- for ( $i=0 ; $i<count($aColumns) ; $i++ ) {
- if ( isset($_GET['bSearchable_'.$i]) && $_GET['bSearchable_'.$i] == "true" && $_GET['sSearch_'.$i] != '' ) {
- if ( $sWhere == "" ) {
- $sWhere = "WHERE ";
- } else {
- $sWhere .= " AND ";
- }
- $sWhere .= $aColumns[$i]." LIKE '%".addslashes($_GET['sSearch_'.$i])."%' ";
- }
- }
- /* Paging */
- $top = (isset($_GET['iDisplayStart']))?((int)$_GET['iDisplayStart']):0 ;
- $limit = (isset($_GET['iDisplayLength']))?((int)$_GET['iDisplayLength'] ):10;
- $sQuery = "SELECT TOP $limit "." * "."
- FROM PPATK3
- $sWhere ".(($sWhere=="")?" WHERE ":" AND ")." $sIndexColumn NOT IN
- (
- SELECT $sIndexColumn FROM
- (
- SELECT TOP $top "." * "."
- FROM PPATK3
- $sWhere
- $sOrder
- )
- as [virtTable]
- )
- $sOrder";
- //$db->SetFetchMode(ADODB_FETCH_ASSOC);
- $rResult = $db->Execute($sQuery);
- $sQueryCnt = "SELECT count ($sIndexColumn) as jml FROM PPATK3 $sWhere ";
- $rResultTotal = $db->Execute($sQueryCnt);
- $iFilteredTotal = $rResultTotal->fields["jml"];;
- $sQuery = " SELECT count ($sIndexColumn) as jml2 FROM PPATK3 ";
- $rResultTotal2 = $db->Execute($sQuery);
- $iTotal = $rResultTotal2->RecordCount();
- $output = array(
- "sEcho" => intval($_GET['sEcho']),
- "iTotalRecords" => $iTotal,
- "iTotalDisplayRecords" => $iFilteredTotal,
- "aaData" => array()
- );
- /*
- * Output
- */
- $output = array(
- "sEcho" => intval($_GET['sEcho']),
- "iTotalRecords" => $iTotal,
- "iTotalDisplayRecords" => $iFilteredTotal,
- "aaData" => array()
- );
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement