<?php 

require 'db.php';

if(isset($_GET['sid']) && isset($_GET['token']))
{
    $shop_id = $_GET['sid'];
    $shop_code = $_GET['token'];

    include 'token_check.php';
    
    if($token_check)
    {
        $sels = $con->query("select * from due_payment where shop_id='$shop_id' and shop_code='$shop_code' order by id DESC");
        while($rows = $sels->fetch_assoc())
        {
            $p['orders'] = $rows['orders'];
        	$p['start_date'] = $rows['start_date'];
        	$p['end_date'] = $rows['end_date'];
        	$p['distance'] = $rows['distance'];
            $p['payment_name'] = $rows['payment_name'];
            $p['sales'] = $rows['sales'];
        	$p['subscription'] = $rows['subscription'];
        	$p['m_deli_charges'] = $rows['m_deli_charges'];
        	$p['c_deli_charges'] = $rows['c_deli_charges'];
        	$p['upi_charges'] = $rows['upi_charges'];
        	$p['razor_charges'] = $rows['razor_charges'];
        	$p['settlement_amount'] = $rows['settlement_amount'];
        	$p['charges_desc'] = $rows['charges_desc'];
        	$p['iconx_amount'] = $rows['iconx_amount'];
        	$p['other_charges'] = $rows['other_charges'];
        	$p['status'] = $rows['status'];
        	$cp[] = $p;
        }
        echo json_encode($cp);
    }
    else
    {
        $rows = array('status'=>"",'message' => 'Data Error');
        echo json_encode($rows);
    }
}

?>