<?php 

//$sqlAStockQuery = mysqli_query($conn,"SELECT sum(litres) as astock   FROM purchase_dieselinvoice WHERE isdelete=1 ");
//$AStockrow = mysqli_fetch_array($sqlAStockQuery,MYSQLI_ASSOC);
//
//$sqlinternalstockQuery = mysqli_query($conn,"SELECT sum(litres) as iastock   FROM internalpro_diesel WHERE isdelete=1 ");
//$internalstockrow = mysqli_fetch_array($sqlinternalstockQuery,MYSQLI_ASSOC);
//
//
//$sqlinternalunfillstockQuery = mysqli_query($conn,"SELECT sum(litres) as iaunfillstock   FROM internalunfillpro_diesel WHERE isdelete=1 ");
//$internalunfillstockrow = mysqli_fetch_array($sqlinternalunfillstockQuery,MYSQLI_ASSOC);
//
//$stk=$internalstockrow['iastock']+$internalunfillstockrow['iaunfillstock'];
//
//$AStock =($AStockrow['astock']-$stk);
//
//$sql =	"SELECT a.id,a.sparename,a.sparetype,a.sparemodel,a.brand_name,sum(a.spareqty)  as spareqty, sum(a.ser_spareqty) as ser_spareqty, sum(a.serw_spareqty) as serw_spareqty,sum(a.spareqty)-(sum(a.ser_spareqty)+sum(a.serw_spareqty)) as asapreQty
//		FROM(
//			   SELECT sm.id,sm.sparename,sm.sparetype,sm.sparemodel,bm.brand_name as brand_name,sum(psd.spareqty)  as spareqty , 0 as ser_spareqty,0 as serw_spareqty ,0  as asapreQty
//			FROM spare_master sm 
//			LEFT JOIN  brand_master as bm ON sm.brand_id = bm.id 
//			LEFT JOIN  purchase_spareinvoice_dtl as psd ON sm.id=psd.spareID
//			   WHERE psd.isdelete=1  GROUP BY sm.id 
//			
//			UNION ALL
//			
//			SELECT sm.id,sm.sparename,sm.sparetype,sm.sparemodel,bm.brand_name as brand_name,0 as spareqty,sum(isd.spareqty)  as ser_spareqty ,0 as  serw_spareqty ,0 as asapreQty
//			FROM spare_master sm 
//			LEFT JOIN  brand_master as bm ON sm.brand_id = bm.id 
//			LEFT JOIN  internalpro_spare_dtl as isd ON sm.id=isd.spareID
//			   WHERE isd.isdelete=1  GROUP BY sm.id 
//			
//			
//			UNION ALL
//			
//			SELECT sm.id,sm.sparename,sm.sparetype,sm.sparemodel,bm.brand_name as brand_name,0 as spareqty,0 as ser_spareqty, sum(swd.spareqty) as serw_spareqty , 0 as asapreQty
//			FROM spare_master sm 
//			LEFT JOIN  brand_master as bm ON sm.brand_id = bm.id 
//			LEFT JOIN  service_workshop_dtl as swd ON sm.id=swd.spareID
//			   WHERE swd.isdelete=1  GROUP BY sm.id 
//				
//			
//        ) a   GROUP BY a.id";
//$totalData_temp = 0;
//$query          =   mysqli_query($conn, $sql);
//while($row=mysqli_fetch_array($query) ) { 
//	
//	if($row['asapreQty']==0) {
//		$totalData_temp++;	
//    }
//}
//
//
//$totalData_INS ='';
//$sql_ins = 'SELECT vr.vehicleno,vm.vehicleno, vr.ins_policynumber, vr.ins_policyfrom, vr.ins_policyto, vr.ins_policyremindon,vr.insurancecompany
//FROM vehicle_renewal as vr
//LEFT JOIN vehicle_master as vm ON vm.id=vr.vehicleno
//WHERE  vr.isdelete=1 AND vr.ins_policyto <= (CURDATE() + INTERVAL 1 MONTH )';
//
//$query_ins=mysqli_query($conn, $sql_ins);
//$totalData_INS = mysqli_num_rows($query_ins);
//
//$totalData_fc ='';
//$sql_fc = 'SELECT vr.vehicleno,vm.vehicleno, vr.fcnumber, vr.fcfrom, vr.fcto, vr.fcremindon
//FROM vehicle_renewal as vr
//LEFT JOIN vehicle_master as vm ON vm.id=vr.vehicleno
//WHERE  vr.isdelete=1 AND vr.fcto <= (CURDATE() + INTERVAL 1 MONTH )';
//
//$query_fc=mysqli_query($conn, $sql_fc);
//$totalData_fc = mysqli_num_rows($query_fc);
//
//$totalData_permit ='';
//$sql_permit = 'SELECT vr.vehicleno,vm.vehicleno, vr.permitnumber, vr.permitfrom, vr.permitto, vr.permitremindon
//FROM vehicle_renewal as vr
//LEFT JOIN vehicle_master as vm ON vm.id=vr.vehicleno
//WHERE  vr.isdelete=1 AND vr.permitto <= (CURDATE() + INTERVAL 1 MONTH )';
//
//$query_permit=mysqli_query($conn, $sql_permit);
//$totalData_permit = mysqli_num_rows($query_permit);
//
//$totalData_tax ='';
//$sql_tax = 'SELECT vr.vehicleno,vm.vehicleno, vr.taxfrom, vr.taxto, vr.taxremindon
//FROM vehicle_renewal as vr
//LEFT JOIN vehicle_master as vm ON vm.id=vr.vehicleno
//WHERE  vr.isdelete=1 AND vr.taxto <= (CURDATE() + INTERVAL 1 MONTH )';
//
//$query_tax=mysqli_query($conn, $sql_tax);
//$totalData_tax = mysqli_num_rows($query_tax);
//




?>