<?php
include('../../Server/connection.php');
if(isset($_GET['year'])&&isset($_GET['proj_id'])){
$proj_id = $_GET['proj_id'];
$year = $_GET['year'];
//$proj_id = 1;
//$year = 2021;
$sqlQuery2 = "SELECT payment_voucher.approval_month,count(*) as AllPayVouchers FROM payment_voucher where payment_voucher.approval_year = '$year' and payment_voucher.proj_id='$proj_id'";
$result2 = $connect12->query($sqlQuery2);
$data21 = array();
foreach ($result2 as $row2){
	$data21[] = $row2;
}
echo json_encode($data21);
}else if(isset($_GET['year'])&&!isset($_GET['proj_id'])){
//$proj_id = $_GET['proj_id'];
$year = $_GET['year'];
//$proj_id = 1;
//$year = 2021;
$sqlQuery2 = "SELECT payment_voucher.approval_month,count(*) as AllPayVouchers FROM payment_voucher where payment_voucher.approval_year = '$year'";
$result2 = $connect12->query($sqlQuery2);
$data21 = array();
foreach ($result2 as $row2){
	$data21[] = $row2;
}
echo json_encode($data21);		
}






















include('../Server/connection.php');
$sqlQuery1 = "SELECT Designation,count(*) as AllStaff,count(case when gender = 'MALE' then 1 end) as MALES,count(case when gender = 'FEMALE' then 1 end) as FEMALES,count(case when MaritalStatus = 'MARRIED' then 1 end) as MARRIED,count(case when MaritalStatus = 'SINGLE' then 1 end) as SINGLE FROM staff where  status = 'CURRENT' and (StaffId!='STF/1') GROUP BY Designation ORDER BY AllStaff DESC";
$result1 = $conn->query($sqlQuery1);
$data22 = array();
foreach ($result1 as $row1){
	$data22[] = $row1;
}
echo json_encode($data22);
?>