<?php
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: POST, GET, OPTIONS');
header('Access-Control-Max-Age: 1000');
header('Access-Control-Allow-Headers: Content-Type');
require_once('../lib/dbclass.php');

$id = $_REQUEST['id'];




$data = findQuery("select ifnull(sum(`Received`),0) Received from tbl_transaction where volunteer=$id and Received>0");

$datarcpt = findQuery("select ifnull(sum(`amount`),0) Received from ca_receipt where userid=$id");









if ($data) {
    $message = 'true';

    $data2[] = [



            'Amount' => $data[0]['Received'] - $datarcpt[0]['Received'],




        ];
} else {
    $message = 'false';
    $data2[] = ['error' => 'Not Found'];
}

echo json_encode(['Status' => $message, 'data' => $data2]);

return;

?>

