Your IP : 216.73.216.26


Current Path : /home2/wtmwscom/www/member/report/
Upload File :
Current File : /home2/wtmwscom/www/member/report/report_income_json.php

<?php
session_start();
include "../../connection.php";
include '../../function_lib.php';
$data = array();
$uid = $_SESSION['userid'];

$query_select = " i.amount AS amount, date(i.datetime) AS datetime, i.txn_type AS txn_type";
$query = " FROM transaction AS i WHERE txn_type IN(1,3,7,11) AND uid = '$uid' ";
$query .=!empty($_REQUEST['txn_type']) ? " AND i.txn_type='" . $_REQUEST['txn_type'] . "'" : '';
//$query .=!empty($_REQUEST['name']) ? " AND u.name='" . $_REQUEST['name'] . "'" : '';


$query .= " group BY txn_type, date(datetime) ORDER BY date(i.`datetime`) DESC";

$totalRecordCount = mysqli_fetch_object(mysqli_query($connection, "SELECT COUNT(i.uid) as count ".$query))->count;
$query_limit = $_REQUEST['length'] == -1 ? '': " LIMIT ".$_REQUEST['start'].", ".$_REQUEST['length'];
$query_final = "SELECT ".$query_select.$query.$query_limit;
//echo $query_final;
$result = mysqli_query($connection, $query_final);
$sno = $_REQUEST['start'] +1;
while ($row = mysqli_fetch_assoc($result)) {
    $row['sno'] = $sno;
    $row['txn_type'] = $master_income_type_array[$row['txn_type']];
    $row['datetime'] = date("d/m/Y", strtotime($row['datetime']));
     $row['amount'] = $row['amount'];
//    $row['payment_status'] = $row['payment_status'] == 1 ? "Paid" : "Unpaid";
//    $row['payment_date'] = !empty($row['payment_date']) ? date("d/m/Y h:i A", strtotime($row['payment_date'])) : '' ;
    $data[] = $row;
    $sno++;
}

$json_array = array('data' => $data, 'recordsFiltered'=>$totalRecordCount, 'recordsTotal'=>$totalRecordCount);
echo json_encode($json_array);
?>