<?php

ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
include("db_connect.php");
include("db_functions.php");
$db=new DB_Functions();
$dc = new DB_Connect();         
$link1 = $dc->connect();
$ei = $_REQUEST['collect_by']; 

$a=array();
$b=array();

$bank_row=mysqli_fetch_assoc(mysqli_query($link1,"select sum(collect_amt) as bank_total from collect_data where collect_by='".$ei."' and collection_mode='BANK' and status='pending' and collect_date>'2022-01-31'"));
$cash_row=mysqli_fetch_assoc(mysqli_query($link1,"select sum(collect_amt) as cash_total from collect_data where collect_by='".$ei."' and collection_mode='CASH' and status='pending' and collect_date>'2022-01-31'"));

$bank_total=$bank_row['bank_total'];
$cash_total=$cash_row['cash_total'];

$b['BANK']=$bank_total;
$b["CASH"]=$cash_total;
   
   echo json_encode($b);
?>