<?php

require_once __DIR__ . '/db_config.php';
$r = array();

if (isset($_POST["email"]) ) {
 
$user_id=$_POST["email"];
$company=$_POST["cname"];
date_default_timezone_set("Asia/Calcutta");   //India time (GMT+5:30)
$datetime=date('Y-m-d H:i:s');

//$user_id="7899133721@b2l.in";
//$company="Zkitchen";

$con = mysqli_connect(DB_SERVER, DB_USER, DB_PASSWORD,DB_DATABASE) or die(mysql_error());

$query="SELECT ref_num,id,type,companyname,transfer_user_id,mst_id,report_id,amount,transfer_mode,transfer_id,datetime,delete_status,delete_datetime
FROM mst_credit_debit_amount
WHERE companyname='$company' AND delete_status='0' AND mst_id='$user_id' 
ORDER BY id DESC";

$result = mysqli_query($con,$query);
if(!empty($result) && mysqli_num_rows($result) > 0){
    while ($row = mysqli_fetch_array($result,MYSQLI_ASSOC)) {
        array_push($r, $row);
    }
}

mysqli_close($con);

}

echo json_encode($r,JSON_UNESCAPED_SLASHES);


?>