<?php include "layouts/menu.php"; ?>

 <?php if (isMobileDevice()) { ?>

    <form name="form22111111111" class="form-horizontal" method="post" action="" enctype="multipart/form-data">
 <div class="input-group" style='width:100%'>
    <input type="text" class="form-control" name="ss" id="ss" placeholder="A/C No or Loan No" autofocus>
    <select class="form-control" name="rctype" id="rctype">
        <option value="Daily">Daily</option>
        <option value="Weekly">Weekly</option>
        <option value="Monthly">Monthly</option>
    </select>
    <script>
    // Add an event listener to the 'ss' input field
    document.getElementById('ss').addEventListener('input', function() {
        var inputVal = this.value.trim().toLowerCase(); // Get the value of the input and convert to lowercase
        var rctypeDropdown = document.getElementById('rctype'); // Get the rctype dropdown
        
        if (inputVal.startsWith('d')) {
            rctypeDropdown.value = 'Daily'; // Set the dropdown to Daily
        } else if (inputVal.startsWith('w')) {
            rctypeDropdown.value = 'Weekly'; // Set the dropdown to Weekly
        } else if (inputVal.startsWith('m')) {
            rctypeDropdown.value = 'Monthly'; // Set the dropdown to Monthly
        } else {
            rctypeDropdown.value = ''; // Clear the dropdown if input doesn't match
        }
    });
</script>
    <div class="input-group-btn">
      <button class="btn btn-info" name="sss5555" type="submit" style="height:70px;">
        <i class="glyphicon glyphicon-search"></i>
      </button>
    </div>
    
  </div>
  
  </form>
  
<?php
	if (isset($_POST['sss5555'])) {
    extract($_POST);
    if ($rctype == "Daily") {
        header("location:mobm.php?hpl=$ss&mfin2=$mfin");
    } elseif ($rctype == "Weekly") {
        header("location:mobw.php?hpl=$ss&mfin2=$mfin");
    } elseif ($rctype == "Monthly") {
        header("location:mobme.php?hpl=$ss&mfin2=$mfin");
    } else {
        echo "Invalid option";
    }
    
    exit();
}
 } ?>
  





<style>
.count{
    position: relative;
    margin: 0 0 0 10px;
    z-index: 5;
    padding: 0;
    color: white;
    font-weight: 1100;
}
.icon
{
    color: white;

}
</style>
<?php
                    	$qry=mysqli_query($conn, "select * from customerdetails where mfin='$mfin' && status='Active'");
						$n=mysqli_num_rows($qry);
						
						$qryw=mysqli_query($conn, "select * from customerdetailsw where mfin='$mfin' && status='Active'");
						$nw=mysqli_num_rows($qryw);
						
						$qrym=mysqli_query($conn, "select * from customerdetailsm where mfin='$mfin' && status='Active'");
						$nm=mysqli_num_rows($qrym);
						
						$moqry=mysqli_query($conn, "select * from moncust where mfin='$mfin' && status='Active'");
						$mon=mysqli_num_rows($moqry);
						
						$qry343=mysqli_query($conn, "select * from moncust where mfin='$mfin'");
						$n343=mysqli_num_rows($qry343);
						
						$fqry343=mysqli_query($conn, "select * from fincust where mfin='$mfin'");
						$fn343=mysqli_num_rows($fqry343);
						
                        $qry2=mysqli_query($conn, "select * from customer");
                        $nn=mysqli_num_rows($qry2);
                        
                        $qry3=mysqli_query($conn, "select * from net where mfin='$mfin'");
						$nq=mysqli_num_rows($qry3);
						
						$qry3w=mysqli_query($conn, "select * from netw where mfin='$mfin'");
						$nqw=mysqli_num_rows($qry3w);
						
						$qry3m=mysqli_query($conn, "select * from netm where mfin='$mfin'");
						$nqm=mysqli_num_rows($qry3m);
						
						$moqry3=mysqli_query($conn, "select * from monnet where mfin='$mfin'");
						$monq=mysqli_num_rows($moqry3);
						
						$qry3343=mysqli_query($conn, "select * from monnet where mfin='$mfin'");
						$nq343=mysqli_num_rows($qry3343);
						
						$fqry3343=mysqli_query($conn, "select * from finnet where mfin='$mfin'");
						$fnq343=mysqli_num_rows($fqry3343);
						$ff = $n - $nq;
						
						$qry4=mysqli_query($conn, "select * from net2 where mfin='$mfin'");
						$nw1=mysqli_num_rows($qry4);
						
						$qry41=mysqli_query($conn, "select * from sizzing where mfin='$mfin'");
						$nww=mysqli_num_rows($qry41);
						
						$qry5=mysqli_query($conn, "select * from dc where mfin='$mfin'");
						$doc=mysqli_num_rows($qry5);
	$dataPoints = array( 
	array("label"=>"TOTAL LOANS", "y"=>$n + $nw + $nm),
	array("label"=>"ACTIVE LOANS", "y"=>$ff),
	array("label"=>"CLOSED LOANS", "y"=>$nq),
	array("label"=>"SIZZED LOANS", "y"=>$nww),
	array("label"=>"PENDING DUES", "y"=>0)
	
);

$dataPoints1 = array( 
	array("label" => "RECEIVED PRINCIPLE",  "y" => 95114 ),
	array("label" => "RECEIVED INTEREST", "y" => 50000 ),
	array("label" => "GIVEN LOAN", "isIntermediateSum" => true),
	array("label" => "SALARY", "y" => -2000 ),
	array("label" => "DEBITS",  "y" => -2206 ),
	array("label" => "RECEIVED PENALTY", "y" => 5000 ),
	array("label" => "Operating Income", "isCumulativeSum" => true ),
	array("label" => "Taxes",  "y" => -300 ),
	array("label" => "Net Income",  "isCumulativeSum" => true )
);

 ?>
<script>

window.onload = function() {
 
var chart = new CanvasJS.Chart("chartContainer", {
	theme: "dark2",
	animationEnabled: true,
	title: {
		text: "FINANCE LEDGER DIAGRAM"
	},
	data: [{
		type: "funnel",
		indexLabel: "{label} - {y}",
		yValueFormatString: "#,##0",
		showInLegend: true,
		legendText: "{label}",
		dataPoints: <?php echo json_encode($dataPoints, JSON_NUMERIC_CHECK); ?>
	}]
});
chart.render();
 

 
var chart1 = new CanvasJS.Chart("chartContainer1", {
	animationEnabled: true,
	title: {
		text: "Company Finance"
	},
	axisY: {
		title: "Amount (in INR)",
		prefix: "Rs.",
		suffix: "K",
		gridThickness: 0
	},
	data: [{
		type: "waterfall",
		risingColor: "#428CFF",
		fallingColor: "#FF8C8C",
		indexLabel: "{y}",
		indexLabelFontColor: "#292B2C",
		indexLabelFontWeight: "bolder",
		indexLabelPlacement: "inside",
		yValueFormatString: "$#,##0k",
		dataPoints: <?php echo json_encode($dataPoints1, JSON_NUMERIC_CHECK); ?>
	}]
});
chart1.render();
 
}
</script> <!-- page content -->
        <div class="right_col" role="main">
									<?php $e=0;  $s=0;  $r=0;  $t=0; $d=0; $d1=0; $i=1; $tot11 = 0; $tot22 = 0;
							$sqll = mysqli_query($conn, "select * from abc where mfin='$mfin'");
	$rowww = mysqli_fetch_array($sqll);
	$fdate = "1890-04-31";
										$fdate1 =  $rowww['date1']; 
										$tdate = $rowww['date2'];  

											$fdate1 =  $rowww['date1']; 
										$tdate = $rowww['date2'];
$qry15=mysqli_query($conn, "select sum(hpamount) from customerdetails where mfin='$mfin' && hpdate5 between '$fdate' and '$tdate'");
$row15 = mysqli_fetch_array($qry15);
$qry4415=mysqli_query($conn, "select sum(document) from customerdetails where mfin='$mfin' && hpdate5 between '$fdate' and '$tdate'");
$row4415 = mysqli_fetch_array($qry4415);
$qry45=mysqli_query($conn, "select sum(urname) from user where mfin='$mfin' &&  paydate2 between '$fdate' and '$tdate'");
$row45 = mysqli_fetch_array($qry45);
$qry4501=mysqli_query($conn, "select sum(pass) from user where mfin='$mfin' &&  paydate2 between '$fdate' and '$tdate'");
$row4501 = mysqli_fetch_array($qry4501);
$qry4502=mysqli_query($conn, "select sum(rno) from user where mfin='$mfin' &&  paydate2 between '$fdate' and '$tdate'");
$row4502 = mysqli_fetch_array($qry4502);

$qry445=mysqli_query($conn, "select sum(tot) from net where mfin='$mfin' &&  paydate2 between '$fdate' and '$tdate'");
$row445 = mysqli_fetch_array($qry445);
$qry44501=mysqli_query($conn, "select sum(amt) from net where mfin='$mfin' &&  paydate2 between '$fdate' and '$tdate'");
$row44501 = mysqli_fetch_array($qry445);
$qry44502=mysqli_query($conn, "select sum(rno) from net where mfin='$mfin' &&  paydate2 between '$fdate' and '$tdate'");
$row44502 = mysqli_fetch_array($qry445);

$qry779=mysqli_query($conn, "select sum(actamt) from hloan where mfin='$mfin' && date2 between '$fdate' and '$tdate'");
$row779 = mysqli_fetch_array($qry779);

$qry001=mysqli_query($conn, "select sum(hpamount) from fincust where mfin='$mfin' && hpdate5 between '$fdate' and '$tdate'");
$row001 = mysqli_fetch_array($qry001);
$qry002=mysqli_query($conn, "select sum(urname) from finuser where mfin='$mfin' &&  paydate2 between '$fdate' and '$tdate'");
$row002 = mysqli_fetch_array($qry002);
$qry003=mysqli_query($conn, "select sum(tot) from finnet where mfin='$mfin' &&  paydate2 between '$fdate' and '$tdate'");
$row003 = mysqli_fetch_array($qry003);


$qry145=mysqli_query($conn, "select sum(cr) from voucher where mfin='$mfin' && par='Cash A/c' && date between '$fdate' and '$tdate'");
$row145 = mysqli_fetch_array($qry145);
$qry1455=mysqli_query($conn, "select sum(dr) from voucher where mfin='$mfin' && par='Cash A/c' && date between '$fdate' and '$tdate'");
$row1455 = mysqli_fetch_array($qry1455);						$n=mysqli_num_rows($qry);



$qry0021=mysqli_query($conn, "select sum(pass) from finuser where mfin='$mfin' &&  paydate2 between '$fdate' and '$tdate'");
$row0021 = mysqli_fetch_array($qry0021);
$qry0022=mysqli_query($conn, "select sum(rno) from finuser where mfin='$mfin' &&  paydate2 between '$fdate' and '$tdate'");
$row0022 = mysqli_fetch_array($qry0022);
$qry0031=mysqli_query($conn, "select sum(dueamt) from finnet where mfin='$mfin' &&  paydate2 between '$fdate' and '$tdate'");
$row0031 = mysqli_fetch_array($qry0031);
$qry0032=mysqli_query($conn, "select sum(rno) from finnet where mfin='$mfin' &&  paydate2 between '$fdate' and '$tdate'");
$row0032 = mysqli_fetch_array($qry0032);



//Loan Liablity calc
$pass= $row0021[0] + $row0031[0];	
 $partn = $row001[0] - $pass; 

//Current lia-> Cash in Hand
$userr = $row45[0];	
$vcr = $row145[0]; 
 $vdr = $row1455[0];
 $nett = $row445[0]; 
 $fincustt = $row001[0];	
	
 $hpp = $row15[0]; 
 $finuserr = $row002[0]; 
 $finnett = $row003[0];
$doc = $row4415[0]; 
$hl = $row779[0];
$cre = $vcr+$hpp+$finuserr+$finnett+$hl;
$debb = $userr+$nett+$fincustt+$doc+$vdr;
$tot = abs($cre - $debb);

$pass2= $row4501[0] + $row44501[0];	
 $pass3 = $row15[0] - $pass2; 
 
 
$lia = $pass3;
//Capital Account Part
$sql11=mysqli_query($conn, "select sum(openbal) from ledger where mfin='$mfin' &&  under='Capital Account' && yn='Cr'");
$rrr11 = mysqli_fetch_array($sql11);
$cpp1 = $rrr11[0];

$sql1=mysqli_query($conn, "select sum(openbal) from ledger where mfin='$mfin' &&  under='Capital Account' && yn='Dr'");
$rrr1 = mysqli_fetch_array($sql1);
$cpp2 = $rrr1[0];
$banka = 0;

$sqlu = mysqli_query($conn, "select * from ledger where under='Capital Account' && mfin='$mfin'");  $capvccdr =0; $capvcccr =0;
while($rowu = mysqli_fetch_array($sqlu)){
	$ledgername = $rowu['ledger']; 
$qrya145=mysqli_query($conn, "select sum(dr) from voucher where mfin='$mfin' && vtype='Payment' && par='$ledgername' && date between '$fdate' and '$tdate'");
$rowa145 = mysqli_fetch_array($qrya145);
$qryb145=mysqli_query($conn, "select sum(cr) from voucher where mfin='$mfin' && vtype='Receipt' && par='$ledgername' && date between '$fdate' and '$tdate'");
$rowb145 = mysqli_fetch_array($qryb145);
$ff000 = $rowa145[0];

$capvccdr = $capvccdr + $rowa145[0];
$capvcccr = $capvcccr + $rowb145[0];
}

$cpp = $cpp1 - $cpp2 - $capvccdr + $capvcccr;
////	//Capital Account Part

//Curretn Assets
        $fir = 0;
$sqluu = mysqli_query($conn, "select * from ledgerg where under='Current Assets' && mfin='$mfin'");  
while($rowuu = mysqli_fetch_array($sqluu)){
		$ledg = $rowuu['ledger']; $rrf = 0;
 
$openbal = 0; $qdeb = 0; $qcre = 0;
$sqlu = mysqli_query($conn, "select * from ledger where under='$ledg' && mfin='$mfin'");   $capvccdr =0; $capvcccr =0; $fir++;
while($rowu = mysqli_fetch_array($sqlu)){
	$ledgername = $rowu['ledger'];
$openbal = $rowu['openbal'];	
$yn = $rowu['yn']; 
$ff = NULL; $led = 'Cash A/c';
$sqll = mysqli_query($conn, "select * from ledger where ledger='$led' && mfin='$mfin'");
    $roww = mysqli_fetch_array($sqll);
	$led = $roww['ledger'];
	$opening = $roww['openbal'];
$cdoc2=mysqli_query($conn, "select sum(hpamount) from customerdetails where mfin='$mfin' && pmode='$led' && hpdate5 between '$fdate' and '$tdate'");
$cdoc12 = mysqli_fetch_array($cdoc2);
$cdoc112 = $cdoc12[0];

$cdoc2w=mysqli_query($conn, "select sum(hpamount) from customerdetailsw where mfin='$mfin' && pmode='$led' && hpdate5 between '$fdate' and '$tdate'");
$cdoc12w = mysqli_fetch_array($cdoc2w);
$cdoc112w = $cdoc12w[0];

$cdoc2m=mysqli_query($conn, "select sum(hpamount) from customerdetailsm where mfin='$mfin' && pmode='$led' && hpdate5 between '$fdate' and '$tdate'");
$cdoc12m = mysqli_fetch_array($cdoc2m);
$cdoc112m = $cdoc12m[0];

//////////////
$cdoc2aa=mysqli_query($conn, "select sum(totalhpamt2) from moncust where mfin='$mfin' && pmode='$led' && hpdate5 between '$fdate' and '$tdate'");
$cdoc12aa = mysqli_fetch_array($cdoc2aa);

//////////////
$cdoc5=mysqli_query($conn, "select sum(chqamt) from customerdetails where mfin='$mfin' && pmode2='$led' && hpdate5 between '$fdate' and '$tdate'");
$cdoc15 = mysqli_fetch_array($cdoc5);
$cdoc115 = $cdoc15[0];

$cdoc5w=mysqli_query($conn, "select sum(chqamt) from customerdetailsw where mfin='$mfin' && pmode2='$led' && hpdate5 between '$fdate' and '$tdate'");
$cdoc15w = mysqli_fetch_array($cdoc5w);
$cdoc115w = $cdoc15w[0];

$cdoc5m=mysqli_query($conn, "select sum(chqamt) from customerdetailsm where mfin='$mfin' && pmode2='$led' && hpdate5 between '$fdate' and '$tdate'");
$cdoc15m = mysqli_fetch_array($cdoc5m);
$cdoc115m = $cdoc15m[0];
//////////////

//////////////

$cdoc28=mysqli_query($conn, "select sum(hpamount) from customerdetails where mfin='$mfin' && pmode!='$led' && pmode!='$ff' && hpdate5 between '$fdate' and '$tdate'");
$cdoc128 = mysqli_fetch_array($cdoc28);
$cdoc1128 = $cdoc128[0];

$cdoc28w=mysqli_query($conn, "select sum(hpamount) from customerdetailsw where mfin='$mfin' && pmode!='$led' && pmode!='$ff' && hpdate5 between '$fdate' and '$tdate'");
$cdoc128w = mysqli_fetch_array($cdoc28w);
$cdoc1128w = $cdoc128w[0];

$cdoc28m=mysqli_query($conn, "select sum(hpamount) from customerdetailsm where mfin='$mfin' && pmode!='$led' && pmode!='$ff' && hpdate5 between '$fdate' and '$tdate'");
$cdoc128m = mysqli_fetch_array($cdoc28m);
$cdoc1128m = $cdoc128m[0];
//////////////


//////////////
$cdoc58=mysqli_query($conn, "select sum(chqamt) from customerdetails where mfin='$mfin' && pmode2!='$led' && pmode2!='$ff' && hpdate5 between '$fdate' and '$tdate'");
$cdoc158 = mysqli_fetch_array($cdoc58);
$cdoc1158 = $cdoc158[0];


$cdoc58w=mysqli_query($conn, "select sum(chqamt) from customerdetailsw where mfin='$mfin' && pmode2!='$led' && pmode2!='$ff' && hpdate5 between '$fdate' and '$tdate'");
$cdoc158w = mysqli_fetch_array($cdoc58w);
$cdoc1158w = $cdoc158w[0];

$cdoc58m=mysqli_query($conn, "select sum(chqamt) from customerdetailsm where mfin='$mfin' && pmode2!='$led' && pmode2!='$ff' && hpdate5 between '$fdate' and '$tdate'");
$cdoc158m = mysqli_fetch_array($cdoc58m);
$cdoc1158m = $cdoc158m[0];
/////////////////////



$cdoc56=mysqli_query($conn, "select sum(dealeramt) from customerdetails where mfin='$mfin' && pmode='$led' && hpdate5 between '$fdate' and '$tdate'");
$cdoc156 = mysqli_fetch_array($cdoc56);
$cdoc1156 = $cdoc156[0];

$cdoc56w=mysqli_query($conn, "select sum(dealeramt) from customerdetailsw where mfin='$mfin' && pmode='$led' && hpdate5 between '$fdate' and '$tdate'");
$cdoc156w = mysqli_fetch_array($cdoc56w);
$cdoc1156w = $cdoc156w[0];

$cdoc56m=mysqli_query($conn, "select sum(dealeramt) from customerdetailsm where mfin='$mfin' && pmode='$led' && hpdate5 between '$fdate' and '$tdate'");
$cdoc156m = mysqli_fetch_array($cdoc56m);
$cdoc1156m = $cdoc156m[0];

////////////

$cdoc11  = $cdoc112 + $cdoc112w + $cdoc112m + $cdoc115  + $cdoc115w + $cdoc115m - $cdoc1156 - $cdoc1156w - $cdoc1156m - $cdoc1158 - $cdoc1158w - $cdoc1158m;

////////////////////
$qry4415=mysqli_query($conn, "select sum(document) from customerdetails where mfin='$mfin' && hpdate5 between '$fdate' and '$tdate'");
$row4415 = mysqli_fetch_array($qry4415);

$qry4415w=mysqli_query($conn, "select sum(document) from customerdetailsw where mfin='$mfin' && hpdate5 between '$fdate' and '$tdate'");
$row4415w = mysqli_fetch_array($qry4415w);

$qry4415m=mysqli_query($conn, "select sum(document) from customerdetailsm where mfin='$mfin' && hpdate5 between '$fdate' and '$tdate'");
$row4415m = mysqli_fetch_array($qry4415m);
////////////////


$ppqry4415=mysqli_query($conn, "select sum(pcharge) from customerdetails where mfin='$mfin' && hpdate5 between '$fdate' and '$tdate'");
$pprow4415 = mysqli_fetch_array($ppqry4415);

$pppqry4415=mysqli_query($conn, "select sum(preinc) from customerdetails where mfin='$mfin' && hpdate5 between '$fdate' and '$tdate'");
$ppprow4415 = mysqli_fetch_array($pppqry4415);

$pppqry4415w=mysqli_query($conn, "select sum(preinc) from customerdetailsw where mfin='$mfin' && hpdate5 between '$fdate' and '$tdate'");
$ppprow4415w = mysqli_fetch_array($pppqry4415w);

$pppqry4415m=mysqli_query($conn, "select sum(preinc) from customerdetailsm where mfin='$mfin' && hpdate5 between '$fdate' and '$tdate'");
$ppprow4415m = mysqli_fetch_array($pppqry4415m);

$qry4415aa=mysqli_query($conn, "select sum(document) from moncust where mfin='$mfin' && hpdate5 between '$fdate' and '$tdate'");
$row4415aa = mysqli_fetch_array($qry4415aa);



$qry45=mysqli_query($conn, "select sum(urname) from user where mfin='$mfin' && mode='$led' &&  paydate2 between '$fdate' and '$tdate'");
$row45 = mysqli_fetch_array($qry45);


$qry45w=mysqli_query($conn, "select sum(urname) from userw where mfin='$mfin' && mode='$led' &&  paydate2 between '$fdate' and '$tdate'");
$row45w = mysqli_fetch_array($qry45w);


$qry45m=mysqli_query($conn, "select sum(urname) from userm where mfin='$mfin' && mode='$led' &&  paydate2 between '$fdate' and '$tdate'");
$row45m = mysqli_fetch_array($qry45m);




$qry445=mysqli_query($conn, "select sum(tot) from net where mfin='$mfin' && mode='$led' &&  paydate2 between '$fdate' and '$tdate'");
$row445 = mysqli_fetch_array($qry445);

$qry445w=mysqli_query($conn, "select sum(tot) from netw where mfin='$mfin' && mode='$led' &&  paydate2 between '$fdate' and '$tdate'");
$row445w = mysqli_fetch_array($qry445w);

$qry445m=mysqli_query($conn, "select sum(tot) from netm where mfin='$mfin' && mode='$led' &&  paydate2 between '$fdate' and '$tdate'");
$row445m = mysqli_fetch_array($qry445m);




$qry779=mysqli_query($conn, "select sum(actamt2) from hloan where mfin='$mfin' && mode='$led' && date2 between '$fdate' and '$tdate'");
$row779 = mysqli_fetch_array($qry779);
$bqry4415=mysqli_query($conn, "select sum(bcommission) from customerdetails where mfin='$mfin' && hpdate5 between '$fdate' and '$tdate'");
$brow4415 = mysqli_fetch_array($bqry4415);

$mbqry4415=mysqli_query($conn, "select sum(bcommission) from customerdetailsm where mfin='$mfin' && hpdate5 between '$fdate' and '$tdate'");
$mbrow4415 = mysqli_fetch_array($mbqry4415);

$wbqry4415=mysqli_query($conn, "select sum(bcommission) from customerdetailsw where mfin='$mfin' && hpdate5 between '$fdate' and '$tdate'");
$wbrow4415 = mysqli_fetch_array($wbqry4415);

$qry001=mysqli_query($conn, "select sum(hpamount) from fincust where mfin='$mfin' && pmode='$led' && hpdate5 between '$fdate' and '$tdate'");
$row001 = mysqli_fetch_array($qry001);
$qry002=mysqli_query($conn, "select sum(urname) from finuser where mfin='$mfin' && mode='$led' &&  paydate2 between '$fdate' and '$tdate'");
$row002 = mysqli_fetch_array($qry002);
$qry003=mysqli_query($conn, "select sum(tot) from finnet where mfin='$mfin' && mode='$led' &&  paydate2 between '$fdate' and '$tdate'");
$row003 = mysqli_fetch_array($qry003);

$mqry001=mysqli_query($conn, "select sum(hpamount) from moncust where mfin='$mfin' && pmode='$led' && hpdate5 between '$fdate' and '$tdate'");
$mrow001 = mysqli_fetch_array($mqry001);
$mqry002=mysqli_query($conn, "select sum(urname) from monuser where mfin='$mfin' && mode='$led' &&  paydate2 between '$fdate' and '$tdate'");
$mrow002 = mysqli_fetch_array($mqry002);
$mqry003=mysqli_query($conn, "select sum(tot) from monnet where mfin='$mfin' && mode='$led' &&  paydate2 between '$fdate' and '$tdate'");
$mrow003 = mysqli_fetch_array($mqry003);


$qry145=mysqli_query($conn, "select sum(cr) from voucher where mfin='$mfin' && par='$led' &&  date between '$fdate' and '$tdate'");
$row145 = mysqli_fetch_array($qry145);
$qry1455=mysqli_query($conn, "select sum(dr) from voucher where mfin='$mfin' && par='$led' &&  date between '$fdate' and '$tdate'");
$row1455 = mysqli_fetch_array($qry1455);


$hbcdoc581=mysqli_query($conn, "select sum(hlamt) from customerdetails where mfin='$mfin' && hpdate5 between '$fdate' and '$tdate'");
$hbcdoc1581 = mysqli_fetch_array($hbcdoc581);
$hbcdoc11581 = $hbcdoc1581[0];	


$hbcdoc581w=mysqli_query($conn, "select sum(hlamt) from customerdetailsw where mfin='$mfin' && hpdate5 between '$fdate' and '$tdate'");
$hbcdoc1581w = mysqli_fetch_array($hbcdoc581w);
$hbcdoc11581w = $hbcdoc1581w[0];	

$hbcdoc581m=mysqli_query($conn, "select sum(hlamt) from customerdetailsm where mfin='$mfin' && hpdate5 between '$fdate' and '$tdate'");
$hbcdoc1581m = mysqli_fetch_array($hbcdoc581m);
$hbcdoc11581m = $hbcdoc1581m[0];	


$pcdoc282fd=mysqli_query($conn, "select sum(hpamount) from fdcust where mfin='$mfin' && pmode='$led' && hpdate5 between '$fdate' and '$tdate'");
$pcdoc1282fd= mysqli_fetch_array($pcdoc282fd);
$pcdoc11282fd = $pcdoc1282fd[0];

$pcdoc282fdu=mysqli_query($conn, "select sum(urname) from fduser where mfin='$mfin' && mode='$led' && paydate2 between '$fdate' and '$tdate'");
$pcdoc1282fdu= mysqli_fetch_array($pcdoc282fdu);
$pcdoc11282fdu = $pcdoc1282fdu[0];
// echo "$pcdoc11282fdu";

$pcdoc282rd=mysqli_query($conn, "select sum(urname) from rduser where mfin='$mfin' && mode='$led' && paydate2 between '$fdate' and '$tdate'");
$pcdoc1282rd= mysqli_fetch_array($pcdoc282rd);
$pcdoc11282rd = $pcdoc1282rd[0];

// echo "$pcdoc11282rd";
$pcdoc282fd2=mysqli_query($conn, "select sum(tot) from fdnet where mfin='$mfin' && mode='$led' && paydate2 between '$fdate' and '$tdate'");
$pcdoc1282fd2= mysqli_fetch_array($pcdoc282fd2);
$pcdoc11282fd2 = $pcdoc1282fd2[0];

$pcdoc282rd2=mysqli_query($conn, "select sum(tot) from rdnet where mfin='$mfin' && mode='$led' && paydate2 between '$fdate' and '$tdate'");
$pcdoc1282rd2= mysqli_fetch_array($pcdoc282rd2);
$pcdoc11282rd2 = $pcdoc1282rd2[0];
			
$userr = $row45[0] + $row45w[0] + $row45m[0] + $cdoc12aa[0];	
$vcr = $row145[0]; 
 $vdr = $row1455[0];
 $nett = $row445[0] + $row445w[0] + $row445m[0]; 
 $fincustt = $row001[0];	
  $moncustt = $mrow001[0];	
	
 $hpp = $cdoc11 + $cdoc11w + $cdoc11m; 
 $finuserr = $row002[0]; 
 $finnett = $row003[0];
  $monuserr = $mrow002[0]; 
 $monnett = $mrow003[0];
$doc = $row4415[0] + $row4415w[0] + $row4415m[0] + $row4415aa[0] + $pprow4415[0] + $ppprow4415[0] + $ppprow4415w[0] +$ppprow4415m[0]; 
$hl = $row779[0];
$bcom = $brow4415[0] + $wbrow4415[0] + $mbrow4415[0];

	$cre = $vcr+$hpp+$finuserr+$moncustt+$finnett+$hl+$bcom+$pcdoc11282fd2+$pcdoc11282rd2+$pcdoc11282fdu;
$debb = $userr+$nett+$fincustt+$monuserr+$monnett+$doc+$vdr+$hbcdoc11581+$pcdoc1128+$pcdoc11282 +$pcdoc11282fd+$pcdoc11282rd; 
$qcre =  $cre;
$qdeb =  $debb;
$qdeb = $qdeb + $opening;
$qtot = $qdeb - $qcre;
$captot = $qtot;
$cassin = $qtot;
// End of Cash A/c



///////////////Bank Accounts
if($ledg == 'Bank Accounts') { $opening = 0;
$userr = 0;	$vcr = 0; $vdr = 0; $nett = 0; $fincustt = 0; $moncustt = 0;$hpp = 0; $finuserr = 0;  $finnett = 0; $monuserr = 0; $monnett = 0; $doc = 0;  $hl = 0; $bcom = 0; $cre = 0; $debb = 0;
	$ff = NULL; $led = $ledgername;
	$sqll = mysqli_query($conn, "select * from ledger where ledger='$led' && mfin='$mfin'");
    while($roww = mysqli_fetch_array($sqll)){
	$led = $roww['ledger'];
	$opening = $roww['openbal']; 
$cdoc2=mysqli_query($conn, "select sum(hpamount) from customerdetails where mfin='$mfin' && pmode='$led' && hpdate5 between '$fdate' and '$tdate'");
$cdoc12 = mysqli_fetch_array($cdoc2);
$cdoc112 = $cdoc12[0];

$cdoc2w=mysqli_query($conn, "select sum(hpamount) from customerdetailsw where mfin='$mfin' && pmode='$led' && hpdate5 between '$fdate' and '$tdate'");
$cdoc12w = mysqli_fetch_array($cdoc2w);
$cdoc112w = $cdoc12w[0];

$cdoc2m=mysqli_query($conn, "select sum(hpamount) from customerdetailsm where mfin='$mfin' && pmode='$led' && hpdate5 between '$fdate' and '$tdate'");
$cdoc12m = mysqli_fetch_array($cdoc2m);
$cdoc112m = $cdoc12m[0];

$pppqry4415=mysqli_query($conn, "select sum(preinc) from customerdetails where mfin='$mfin' && hpdate5 between '$fdate' and '$tdate'");
$ppprow4415 = mysqli_fetch_array($pppqry4415);

$pppqry4415w=mysqli_query($conn, "select sum(preinc) from customerdetailsw where mfin='$mfin' && hpdate5 between '$fdate' and '$tdate'");
$ppprow4415w = mysqli_fetch_array($pppqry4415w);

$pppqry4415m=mysqli_query($conn, "select sum(preinc) from customerdetailsm where mfin='$mfin' && hpdate5 between '$fdate' and '$tdate'");
$ppprow4415m = mysqli_fetch_array($pppqry4415m);

$cdoc5=mysqli_query($conn, "select sum(chqamt) from customerdetails where mfin='$mfin' && pmode2='$led' && hpdate5 between '$fdate' and '$tdate'");
$cdoc15 = mysqli_fetch_array($cdoc5);
$cdoc115 = $cdoc15[0];

$cdoc5w=mysqli_query($conn, "select sum(chqamt) from customerdetailsw where mfin='$mfin' && pmode2='$led' && hpdate5 between '$fdate' and '$tdate'");
$cdoc15w = mysqli_fetch_array($cdoc5w);
$cdoc115w = $cdoc15w[0];

$cdoc5m=mysqli_query($conn, "select sum(chqamt) from customerdetailsm where mfin='$mfin' && pmode2='$led' && hpdate5 between '$fdate' and '$tdate'");
$cdoc15m = mysqli_fetch_array($cdoc5m);
$cdoc115m = $cdoc15m[0];


$cdoc28=mysqli_query($conn, "select sum(hpamount) from customerddggfetails where mfin='$mfin' && pmode!='$led' && pmode!='$ff' && hpdate5 between '$fdate' and '$tdate'");
$cdoc128 = mysqli_fetch_array($cdoc28);
$cdoc1128 = $cdoc128[0];

$cdoc58=mysqli_query($conn, "select sum(chqamt) from customerdetails where mfin='$mfin' && pmode2!='$led' && pmode2!='$ff' && hpdate5 between '$fdate' and '$tdate'");
$cdoc158 = mysqli_fetch_array($cdoc58);
$cdoc1158 = $cdoc158[0];


$cdoc56=mysqli_query($conn, "select sum(dealeramt) from customerdetails where mfin='$mfin' && pmode='$led' && hpdate5 between '$fdate' and '$tdate'");
$cdoc156 = mysqli_fetch_array($cdoc56);
$cdoc1156 = $cdoc156[0];

$cdoc56w=mysqli_query($conn, "select sum(dealeramt) from customerdetailsw where mfin='$mfin' && pmode='$led' && hpdate5 between '$fdate' and '$tdate'");
$cdoc156w = mysqli_fetch_array($cdoc56w);
$cdoc1156w = $cdoc156w[0];

$cdoc56m=mysqli_query($conn, "select sum(dealeramt) from customerdetailsm where mfin='$mfin' && pmode='$led' && hpdate5 between '$fdate' and '$tdate'");
$cdoc156m = mysqli_fetch_array($cdoc56m);
$cdoc1156m = $cdoc156m[0];



$cdoc11  = $cdoc112 + $cdoc115 + $cdoc112w + $cdoc115w + $cdoc112m + $cdoc115m - $cdoc1156 - $cdoc1158 - $cdoc1156w - $cdoc1158w - $cdoc1156m - $cdoc1158m;

$qry4415=mysqli_query($conn, "select sum(document) from customeraefadefdetails where mfin='$mfin' && pmode='$led' && hpdate5 between '$fdate' and '$tdate'");
$row4415 = mysqli_fetch_array($qry4415);


$qry45=mysqli_query($conn, "select sum(urname) from user where mfin='$mfin' && mode='$led' &&  paydate2 between '$fdate' and '$tdate'");
$row45 = mysqli_fetch_array($qry45);

$qry45w=mysqli_query($conn, "select sum(urname) from userw where mfin='$mfin' && mode='$led' &&  paydate2 between '$fdate' and '$tdate'");
$row45w = mysqli_fetch_array($qry45w);

$qry45m=mysqli_query($conn, "select sum(urname) from userm where mfin='$mfin' && mode='$led' &&  paydate2 between '$fdate' and '$tdate'");
$row45m = mysqli_fetch_array($qry45m);


$qry445=mysqli_query($conn, "select sum(tot) from net where mfin='$mfin' && mode='$led' &&  paydate2 between '$fdate' and '$tdate'");
$row445 = mysqli_fetch_array($qry445);

$qry445w=mysqli_query($conn, "select sum(tot) from netw where mfin='$mfin' && mode='$led' &&  paydate2 between '$fdate' and '$tdate'");
$row445w = mysqli_fetch_array($qry445w);

$qry445m=mysqli_query($conn, "select sum(tot) from netm where mfin='$mfin' && mode='$led' &&  paydate2 between '$fdate' and '$tdate'");
$row445m = mysqli_fetch_array($qry445m);


$qry779=mysqli_query($conn, "select sum(actamt2) from hloan where mfin='$mfin' && mode='$led' && date2 between '$fdate' and '$tdate'");
$row779 = mysqli_fetch_array($qry779);
$bqry4415=mysqli_query($conn, "select sum(bcommission) from customerdetails where mfin='$mfin' && hpdate5 between '$fdate' and '$tdate'");
$brow4415 = mysqli_fetch_array($bqry4415);
$qry001=mysqli_query($conn, "select sum(hpamount) from fincust where mfin='$mfin' && pmode='$led' && hpdate5 between '$fdate' and '$tdate'");
$row001 = mysqli_fetch_array($qry001);
$qry002=mysqli_query($conn, "select sum(urname) from finuser where mfin='$mfin' && mode='$led' &&  paydate2 between '$fdate' and '$tdate'");
$row002 = mysqli_fetch_array($qry002);
$qry003=mysqli_query($conn, "select sum(tot) from finnet where mfin='$mfin' && mode='$led' &&  paydate2 between '$fdate' and '$tdate'");
$row003 = mysqli_fetch_array($qry003);

$mqry001=mysqli_query($conn, "select sum(hpamount) from moncust where mfin='$mfin' && pmode='$led' && hpdate5 between '$fdate' and '$tdate'");
$mrow001 = mysqli_fetch_array($mqry001);
$mqry002=mysqli_query($conn, "select sum(urname) from monuser where mfin='$mfin' && mode='$led' &&  paydate2 between '$fdate' and '$tdate'");
$mrow002 = mysqli_fetch_array($mqry002);
$mqry003=mysqli_query($conn, "select sum(tot) from monnet where mfin='$mfin' && mode='$led' &&  paydate2 between '$fdate' and '$tdate'");
$mrow003 = mysqli_fetch_array($mqry003);


$qry145=mysqli_query($conn, "select sum(cr) from voucher where mfin='$mfin' && par='$led' &&  date between '$fdate' and '$tdate'");
$row145 = mysqli_fetch_array($qry145);
$qry1455=mysqli_query($conn, "select sum(dr) from voucher where mfin='$mfin' && par='$led' &&  date between '$fdate' and '$tdate'");
$row1455 = mysqli_fetch_array($qry1455);	
$hbcdoc581=mysqli_query($conn, "select sum(hlamt) from customerdetails where mfin='$mfin' && hpdate5 between '$fdate' and '$tdate'");
$hbcdoc1581 = mysqli_fetch_array($hbcdoc581);
$hbcdoc11581 = $hbcdoc1581[0];	


$pcdoc282fd=mysqli_query($conn, "select sum(hpamount) from fdcust where mfin='$mfin' && pmode='$led' && hpdate5 between '$fdate' and '$tdate'");
$pcdoc1282fd= mysqli_fetch_array($pcdoc282fd);
$pcdoc11282fd = $pcdoc1282fd[0];

$pcdoc282fdu=mysqli_query($conn, "select sum(urname) from fduser where mfin='$mfin' && mode='$led' && paydate2 between '$fdate' and '$tdate'");
$pcdoc1282fdu= mysqli_fetch_array($pcdoc282fdu);
$pcdoc11282fdu = $pcdoc1282fdu[0];
// echo "$pcdoc11282fdu";

$pcdoc282rd=mysqli_query($conn, "select sum(urname) from rduser where mfin='$mfin' && mode='$led' && paydate2 between '$fdate' and '$tdate'");
$pcdoc1282rd= mysqli_fetch_array($pcdoc282rd);
$pcdoc11282rd = $pcdoc1282rd[0];

// echo "$pcdoc11282rd";
$pcdoc282fd2=mysqli_query($conn, "select sum(tot) from fdnet where mfin='$mfin' && mode='$led' && paydate2 between '$fdate' and '$tdate'");
$pcdoc1282fd2= mysqli_fetch_array($pcdoc282fd2);
$pcdoc11282fd2 = $pcdoc1282fd2[0];

$pcdoc282rd2=mysqli_query($conn, "select sum(tot) from rdnet where mfin='$mfin' && mode='$led' && paydate2 between '$fdate' and '$tdate'");
$pcdoc1282rd2= mysqli_fetch_array($pcdoc282rd2);
$pcdoc11282rd2 = $pcdoc1282rd2[0];
			
$userr = $row45[0] + $row45w[0] + $row45m[0];	
$vcr = $row145[0]; 
 $vdr = $row1455[0];
 $nett = $row445[0] + $row445w[0] + $row445m[0]; 
 $fincustt = $row001[0];	
  $moncustt = $mrow001[0];	
	
 $hpp = $cdoc11 + $cdoc11w + $cdoc11m; 
 $finuserr = $row002[0]; 
 $finnett = $row003[0];
  $monuserr = $mrow002[0]; 
 $monnett = $mrow003[0];
$doc = $row4415[0] + $row4415w[0] + $row4415m[0]  + $ppprow4415[0] + $ppprow4415w[0] +$ppprow4415m[0]; 
$hl = $row779[0];
$bcom = $brow4415[0];

	$cre = $vcr+$hpp+$finuserr+$moncustt+$finnett+$hl+$pcdoc11282fd2+$pcdoc11282rd2+$pcdoc11282fdu;
$debb = $userr+$nett+$fincustt+$monuserr+$monnett+$vdr+$hbcdoc11581+$pcdoc1128+$pcdoc11282 +$pcdoc11282fd+$pcdoc11282rd; 

	$qqcre = $qqcre + $cre;
$qqdeb = $qqdeb + $debb  + $opening;
}
$qqtot = $qqdeb - $qqcre;
$captot = $qqtot;
$banka = $qqtot;
}
else {	
$qrya145=mysqli_query($conn, "select sum(dr) from voucher where mfin='$mfin' && vtype='Payment' && par='$ledgername' && date between '$fdate' and '$tdate'");
$rowa145 = mysqli_fetch_array($qrya145);
$qryb145=mysqli_query($conn, "select sum(cr) from voucher where mfin='$mfin' && vtype='Receipt' && par='$ledgername' && date between '$fdate' and '$tdate'");
$rowb145 = mysqli_fetch_array($qryb145);

$capvccdr = $rowa145[0];
$capvcccr = $rowb145[0];
$captot = $openbal - $capvccdr + $capvcccr;

if($rrf == 0) {
	$curasname = $ledg;
	$captot11 = $captot;
 }
}
 } }

$sqlu = mysqli_query($conn, "select * from ledger where under='Current Assets' && mfin='$mfin'");   $capvccdr =0; $capvcccr =0; $fir++;
while($rowu = mysqli_fetch_array($sqlu)){
	$ledgername = $rowu['ledger'];
$openbal = $rowu['openbal'];	
$yn = $rowu['yn'];
	
$qrya145=mysqli_query($conn, "select sum(dr) from voucher where mfin='$mfin' && vtype='Payment' && par='$ledgername' && date between '$fdate' and '$tdate'");
$rowa145 = mysqli_fetch_array($qrya145);
$qryb145=mysqli_query($conn, "select sum(cr) from voucher where mfin='$mfin' && vtype='Receipt' && par='$ledgername' && date between '$fdate' and '$tdate'");
$rowb145 = mysqli_fetch_array($qryb145);

$capvccdr = $rowa145[0];
$capvcccr = $rowb145[0];
$captot = $openbal - $capvccdr + $capvcccr;

if($rrf == 0) {
	$curasname = $ledg;
	$captot11 = $captot;
 } 
 
} 	
//Hp Customer(s)
$tdyy = date('Y-m-d');
$sdcdocd=mysqli_query($conn, "select sum(totalhpamt) from customerdetails where mfin='$mfin' && hpdate5='$tdyy'");
$sdcdoc1d = mysqli_fetch_array($sdcdocd);
$sdcdoc11d = $sdcdoc1d[0];
$sdcdocdw=mysqli_query($conn, "select sum(totalhpamt) from customerdetailsw where mfin='$mfin' && hpdate5='$tdyy'");
$sdcdoc1dw = mysqli_fetch_array($sdcdocdw);
$sdcdoc11dw = $sdcdoc1dw[0];
$sdcdocdm=mysqli_query($conn, "select sum(totalhpamt) from customerdetailsm where mfin='$mfin' && hpdate5='$tdyy'");
$sdcdoc1dm = mysqli_fetch_array($sdcdocdm);
$sdcdoc11dm = $sdcdoc1dm[0];

$sdcdocdm7=mysqli_query($conn, "select sum(hpamount) from moncust where mfin='$mfin' && hpdate5='$tdyy'");
$sdcdoc1dm7 = mysqli_fetch_array($sdcdocdm7);
$sdcdoc11dm7 = $sdcdoc1dm7[0];



$hpparty1 =  $sdcdoc11d + $sdcdoc11dw + $sdcdoc11dm + $sdcdoc11dm7;

$sdcdocdi=mysqli_query($conn, "select sum(hpamount) from moncust where mfin='$mfin' && hpdate5='$tdyy'");
$sdcdoc1di = mysqli_fetch_array($sdcdocdi);
$sdcdoc11di = $sdcdoc1di[0];
$mohpparty1 = 0 + $sdcdoc11di;

$sdcdoc=mysqli_query($conn, "select sum(hpamount) from customerdetails where mfin='$mfin' && hpdate5 between '$fdate' and '$tdate'");
$sdcdoc1 = mysqli_fetch_array($sdcdoc);

$sdcdocw=mysqli_query($conn, "select sum(hpamount) from customerdetailsw where mfin='$mfin' && hpdate5 between '$fdate' and '$tdate'");
$sdcdoc2 = mysqli_fetch_array($sdcdocw);

$sdcdocm=mysqli_query($conn, "select sum(hpamount) from customerdetailsm where mfin='$mfin' && hpdate5 between '$fdate' and '$tdate'");
$sdcdoc3 = mysqli_fetch_array($sdcdocm);

$sdcdocmf=mysqli_query($conn, "select sum(hpamount) from fincust where mfin='$mfin' && hpdate5 between '$fdate' and '$tdate'");
$sdcdoc3f = mysqli_fetch_array($sdcdocmf);
  $sdfgh = $sdcdoc3f[0];
  
  
$sdcdoc11 = $sdcdoc1[0] + $sdcdoc2[0] + $sdcdoc3[0];

$dsdcdoc=mysqli_query($conn, "select sum(dealeramt) from customerdetails where mfin='$mfin' && hpdate5 between '$fdate' and '$tdate'");
$dsdcdoc1 = mysqli_fetch_array($dsdcdoc);

$dsdcdocw=mysqli_query($conn, "select sum(dealeramt) from customerdetailsw where mfin='$mfin' && hpdate5 between '$fdate' and '$tdate'");
$dsdcdoc1w = mysqli_fetch_array($dsdcdocw);

$dsdcdocm=mysqli_query($conn, "select sum(dealeramt) from customerdetailsm where mfin='$mfin' && hpdate5 between '$fdate' and '$tdate'");
$dsdcdoc1m = mysqli_fetch_array($dsdcdocm);

$dsdcdoc11 = $dsdcdoc1[0] + $dsdcdoc1w[0] + $dsdcdoc1m[0];

$hppass=mysqli_query($conn, "select sum(pass) from user where mfin='$mfin' && paydate2 between '$fdate' and '$tdate'");
$hppass1 = mysqli_fetch_array($hppass);

$hppassw=mysqli_query($conn, "select sum(pass) from userw where mfin='$mfin' && paydate2 between '$fdate' and '$tdate'");
$hppass1w = mysqli_fetch_array($hppassw);

$hppassm=mysqli_query($conn, "select sum(pass) from userm where mfin='$mfin' && paydate2 between '$fdate' and '$tdate'");
$hppass1m = mysqli_fetch_array($hppassm);

$hppass111 = $hppass1[0] + $hppass1w[0] + $hppass1m[0];

$hppass2=mysqli_query($conn, "select sum(dueamt) from net where mfin='$mfin' && paydate2 between '$fdate' and '$tdate'");
$hppass22 = mysqli_fetch_array($hppass2);

$hppass2w=mysqli_query($conn, "select sum(dueamt) from netw where mfin='$mfin' && paydate2 between '$fdate' and '$tdate'");
$hppass22w = mysqli_fetch_array($hppass2w);

$hppass2m=mysqli_query($conn, "select sum(dueamt) from netm where mfin='$mfin' && paydate2 between '$fdate' and '$tdate'");
$hppass22m = mysqli_fetch_array($hppass2m);

$hppass222 = $hppass22[0] +$hppass22w[0] + $hppass22m[0];

$hpparty = $sdcdoc11 - $hppass111 - $hppass222;

$msdcdoc=mysqli_query($conn, "select sum(hpamount) from moncust where mfin='$mfin' && hpdate5 between '$fdate' and '$tdate'");
$msdcdoc1 = mysqli_fetch_array($msdcdoc);
$msdcdoc11 = $msdcdoc1[0];
$mdsdcdoc=mysqli_query($conn, "select sum(dealeramt) from moncust where mfin='$mfin' && hpdate5 between '$fdate' and '$tdate'");
$mdsdcdoc1 = mysqli_fetch_array($mdsdcdoc);
$mdsdcdoc11 = $mdsdcdoc1[0];


$mhppass=mysqli_query($conn, "select sum(rno) from monuser where mfin='$mfin' && paydate2 between '$fdate' and '$tdate'");
$mhppass1 = mysqli_fetch_array($mhppass);
$mhppass111 = $mhppass1[0];

$mhppassr=mysqli_query($conn, "select sum(cre) from monuser where mfin='$mfin' && paydate2 between '$fdate' and '$tdate'");
$mhppass1r = mysqli_fetch_array($mhppassr);
$mhppass111r = $mhppass1r[0];

$mhppassrf=mysqli_query($conn, "select sum(deb) from monuser where mfin='$mfin' && paydate2 between '$fdate' and '$tdate'");
$mhppass1rf = mysqli_fetch_array($mhppassrf);
$mhppass111rf = $mhppass1rf[0];



$mhppass2=mysqli_query($conn, "select sum(dueamt) from monnet where mfin='$mfin' && paydate2 between '$fdate' and '$tdate'");
$mhppass22 = mysqli_fetch_array($mhppass2);
$mhppass222 = $mhppass22[0];

$mhpparty =   $msdcdoc11 -  $mhppass111rf + $mhppass111r + $mhppass111 + $mhppass222;

if($rrf == 0) {
	$curasname = $ledg;
	$captot11 = $captot;
 }
//Sundry Deptor
$ssdcdoc=mysqli_query($conn, "select sum(hloan) from user where mfin='$mfin' && paydate2 between '$fdate' and '$tdate'");
$ssdcdoc1 = mysqli_fetch_array($ssdcdoc);
$ssdcdoc11 = $ssdcdoc1[0];
$cssdcdoc=mysqli_query($conn, "select sum(hlamt) from customerdetails where mfin='$mfin' && hpdate5 between '$fdate' and '$tdate'");
$cssdcdoc1 = mysqli_fetch_array($cssdcdoc);
$cssdcdoc11 = $cssdcdoc1[0];
$saddd=mysqli_query($conn, "select sum(hloan) from net where mfin='$mfin' && paydate2 between '$fdate' and '$tdate'");
$saddd1 = mysqli_fetch_array($saddd);
$saddd11 = $saddd1[0];
$hsaddd=mysqli_query($conn, "select sum(actamt2) from hloan where mfin='$mfin' && date2 between '$fdate' and '$tdate'");
$hsaddd1 = mysqli_fetch_array($hsaddd);
$hsaddd11 = $hsaddd1[0]; //fin loan int
$fissdcdoc=mysqli_query($conn, "select sum(rno) from finuser where mfin='$mfin' && paydate2 between '$fdate' and '$tdate'");
$fissdcdoc1 = mysqli_fetch_array($fissdcdoc);
$fissdcdoc11 = $fissdcdoc1[0];
$fisaddd=mysqli_query($conn, "select sum(amt) from finnet where mfin='$mfin' && paydate2 between '$fdate' and '$tdate'");
$fisaddd1 = mysqli_fetch_array($fisaddd);
$fisaddd11 = $fisaddd1[0];

$mfissdcdoc=mysqli_query($conn, "select sum(rno) from monuser where mfin='$mfin' && paydate2 between '$fdate' and '$tdate'");
$mfissdcdoc1 = mysqli_fetch_array($mfissdcdoc);
$mfissdcdoc11 = $mfissdcdoc1[0];
$mfisaddd=mysqli_query($conn, "select sum(amt) from monnet where mfin='$mfin' && paydate2 between '$fdate' and '$tdate'");
$mfisaddd1 = mysqli_fetch_array($mfisaddd);
$mfisaddd11 = $mfisaddd1[0];


$sdept = $hsaddd11 - $ssdcdoc11 - $saddd11 - $cssdcdoc11;
//echo $hsaddd11; echo "<>";   echo $ssdcdoc11; echo "<>";  echo $saddd11; echo "<>";   echo $fissdcdoc11; echo "<>";   echo $fisaddd11; echo "<>"; 

//total Current Asset
$curass = 	$cassin + $banka + $hpparty + $sdept ;	


// Current Liablities // Sundery Creditors
//////////////////////////////////////////////////////////// Broker 
$bdealc = 0; $bdeald = 0; $bdealo = 0;
$sqlu = mysqli_query($conn, "select * from ledger where under='Broker' && mfin='$mfin'");   $capvccdr =0; $capvcccr =0; $fir++;
while($rowu = mysqli_fetch_array($sqlu)){
	$ledgername = $rowu['ledger'];
$openbal = $rowu['openbal'];	
$yn = $rowu['yn'];
$cass11=mysqli_query($conn, "select sum(dr) from voucher where mfin='$mfin' && par='$ledgername' && date between '$fdate' and '$tdate'");
$cass1 = mysqli_fetch_array($cass11); $casss2 = 0;
$cass22=mysqli_query($conn, "select sum(cr) from voucher where mfin='$mfin' &&  par='$ledgername' && date between '$fdate' and '$tdate'");
$cass23 = mysqli_fetch_array($cass22);

$crasdr = $cass1[0];
$crascr = $cass23[0];
$bdealo = $bdealo + $openbal;
$bdeald = $bdeald + $crasdr;
$bdealc = $bdealc + $crascr;
}
$clsdcdoc=mysqli_query($conn, "select sum(bcommission) from customerdetails where mfin='$mfin' && dealeramt<='0' && hpdate5 between '$fdate' and '$tdate'");
$clsdcdoc1 = mysqli_fetch_array($clsdcdoc);
$bclsdcdoc11 = $clsdcdoc1[0];
$brkbb = $bdealo  + $bdeald - $bdealc - $bclsdcdoc11; 
//////////////////////////////////////////////////////////// Broker 





//////////////////////////////////////////////////////////// Dealer 
$dealc = 0; $deald = 0; $dealo = 0;
$sqlu = mysqli_query($conn, "select * from ledger where under='Dealer' && mfin='$mfin'");   $capvccdr =0; $capvcccr =0; $fir++;
while($rowu = mysqli_fetch_array($sqlu)){
	$ledgername = $rowu['ledger'];
$openbal = $rowu['openbal'];	
$yn = $rowu['yn'];
$cass11=mysqli_query($conn, "select sum(dr) from voucher where mfin='$mfin' && par='$ledgername' && date between '$fdate' and '$tdate'");
$cass1 = mysqli_fetch_array($cass11); $casss2 = 0;
$cass22=mysqli_query($conn, "select sum(cr) from voucher where mfin='$mfin' &&  par='$ledgername' && date between '$fdate' and '$tdate'");
$cass23 = mysqli_fetch_array($cass22);

$crasdr = $cass1[0];
$crascr = $cass23[0];
$dealo = $dealo + $openbal;
$deald = $deald + $crasdr;
$dealc = $dealc + $crascr;
}
$clsdcdoc22=mysqli_query($conn, "select sum(dealeramt) from customerdetails where mfin='$mfin' && hpdate5 between '$fdate' and '$tdate'");
$clsdcdoc122 = mysqli_fetch_array($clsdcdoc22);
$clsdcdoc1122 = $clsdcdoc122[0]; 

$ddclsdcdoc=mysqli_query($conn, "select sum(bcommission) from customerdetails where mfin='$mfin' && dealeramt>'0' && hpdate5 between '$fdate' and '$tdate'");
$ddclsdcdoc1 = mysqli_fetch_array($ddclsdcdoc);
$ddbclsdcdoc11 = $ddclsdcdoc1[0];

$dealera = $dealo  + $deald - $dealc - $clsdcdoc1122 - $ddbclsdcdoc11; 
//////////////////////////////////////////////////////////// Dealer 



//////////////////////////////////////////////////////////// Coolection Agent 
$coldealc = 0; $coldeald = 0; $coldealo = 0; $hlcolag = 0;
$sqlu = mysqli_query($conn, "select * from ledger where under='Collection Agent' && mfin='$mfin'");   $capvccdr =0; $capvcccr =0; $fir++;
while($rowu = mysqli_fetch_array($sqlu)){
	$ledgername = $rowu['ledger'];
	if($ledgername != 'DIRECT COLLECTION') {
$openbal = $rowu['openbal'];	
$yn = $rowu['yn'];
$cass11=mysqli_query($conn, "select sum(dr) from voucher where mfin='$mfin' && par='$ledgername' && date between '$fdate' and '$tdate'");
$cass1 = mysqli_fetch_array($cass11); $casss2 = 0;
$cass22=mysqli_query($conn, "select sum(cr) from voucher where mfin='$mfin' &&  par='$ledgername' && date between '$fdate' and '$tdate'");
$cass23 = mysqli_fetch_array($cass22);


$clsdcdoc22=mysqli_query($conn, "select sum(actamt2) from hloan where mfin='$mfin' && agent='$ledgername' && mode='$ledgername' && date2 between '$fdate' and '$tdate'");
$clsdcdoc122 = mysqli_fetch_array($clsdcdoc22);
$hlcolag = $hlcolag + $clsdcdoc122[0]; 


$crasdr = $cass1[0];
$crascr = $cass23[0];
$coldealo = $dealo + $coldealo;
$coldeald = $coldeald + $crasdr;
$coldealc = $coldealc + $crascr;
	}
}

$colagent = $coldealo  + $coldeald - $coldealc - $hlcolag; 
//////////////////////////////////////////////////////////// Coolection Agent  



/////////////////////////////////////////////////////////// Direct Collection
$clsdcdoc22=mysqli_query($conn, "select sum(actamt2) from hloan where mfin='$mfin' && agent='DIRECT COLLECTION' && mode='DIRECT COLLECTION' && date2 between '$fdate' and '$tdate'");
$clsdcdoc122 = mysqli_fetch_array($clsdcdoc22);
$ddcol1 = $clsdcdoc122[0];  $ddcol2 = 0;
$ddcol = $ddcol2 - $ddcol1;
/////////////////////////////////////////////////////////// Direct Collection
$suncrec = 0; $suncred = 0;
	
	if($dealera > 0) { $suncred = $suncred + $dealera;  
 } else { $suncrec = $suncrec + abs($dealera); 
 } 
 if($brkbb > 0) { $suncred = $suncred + $brkbb;  
 } else { $suncrec = $suncrec + abs($brkbb); 
 } 
 if($colagent > 0) { $suncred = $suncred + $colagent;  
 } else { $suncrec = $suncrec + abs($colagent); 
} 
 if($ddcol > 0) { $suncred = $suncred + $ddcol;  
 } else { $suncrec = $suncrec + abs($ddcol);  } 
$curlia = abs($suncred) - abs($suncrec);
?>
						
				
						<?php 
//			 Duties & Taxes		
$tddd=mysqli_query($conn, "select sum(tds) from finuser where mfin='$mfin'  && paydate2 between '$fdate' and '$tdate'");
$tdsss = mysqli_fetch_array($tddd);
$tds1 = $tdsss[0];
$tddd1=mysqli_query($conn, "select sum(tds) from finnet where mfin='$mfin' && paydate2 between '$fdate' and '$tdate'");
$tdsss1 = mysqli_fetch_array($tddd1);
$tds2 = $tdsss1[0];
$tds = $tds1 + $tds2;  $frfrfr = $curlia - $tds + $cuas;?>
<?php //Profit & Loss	
	//Direct Income 
	$dincome2 = 0; $dexp2 = 0; $inexp = 0; $ddexp = 0; $ddincome = 0; $inincome = 0;

$sqlu = mysqli_query($conn, "select * from ledger where under='Direct Incomes' && mfin='$mfin'");   $capvccdr =0; $capvcccr =0; $fir++;
while($rowu = mysqli_fetch_array($sqlu)){
$ledgername = $rowu['ledger'];
$openbal = $rowu['openbal'];	
$yn = $rowu['yn'];

$cass11=mysqli_query($conn, "select sum(dr) from voucher where mfin='$mfin' && vtype='Payment' && par='$ledgername' && date between '$fdate' and '$tdate'");
$cass1 = mysqli_fetch_array($cass11); $casss2 = 0;
$cass22=mysqli_query($conn, "select sum(cr) from voucher where mfin='$mfin' && vtype='Receipt' && par='$ledgername' && date between '$fdate' and '$tdate'");
$cass23 = mysqli_fetch_array($cass22);

$crascr = $cass1[0];
$crasdr = $cass23[0];
$ddincome = $ddincome + $openbal + $crasdr - $crascr;
$dincome2 = $dincome2 + $openbal + $crasdr - $crascr;
}
$sqlu = mysqli_query($conn, "select * from ledger where under='Indirect Incomes' && mfin='$mfin'");  
while($rowu = mysqli_fetch_array($sqlu)){
$ledgername = $rowu['ledger'];
$openbal = $rowu['openbal'];	
$yn = $rowu['yn'];

$cass11=mysqli_query($conn, "select sum(dr) from voucher where mfin='$mfin' && vtype='Payment' && par='$ledgername' && date between '$fdate' and '$tdate'");
$cass1 = mysqli_fetch_array($cass11); $casss2 = 0;
$cass22=mysqli_query($conn, "select sum(cr) from voucher where mfin='$mfin' && vtype='Receipt' && par='$ledgername' && date between '$fdate' and '$tdate'");
$cass23 = mysqli_fetch_array($cass22);

$crascr = $cass1[0];
$crasdr = $cass23[0];
$inincome = $inincome + $openbal + $crasdr - $crascr;
$dincome2 = $dincome2 + $openbal + $crasdr - $crascr;
}
$sdcdoc=mysqli_query($conn, "select sum(document) from customerdetails where mfin='$mfin' && hpdate5 between '$fdate' and '$tdate'");
$sdcdoc1 = mysqli_fetch_array($sdcdoc);
$dsdcdoc11 = $sdcdoc1[0];

$sdcdocw=mysqli_query($conn, "select sum(document) from customerdetailsw where mfin='$mfin' && hpdate5 between '$fdate' and '$tdate'");
$sdcdoc1w = mysqli_fetch_array($sdcdocw);
$dsdcdoc11w = $sdcdoc1w[0];

$sdcdocp=mysqli_query($conn, "select sum(document) from customerdetailsm where mfin='$mfin' && hpdate5 between '$fdate' and '$tdate'");
$sdcdoc1p = mysqli_fetch_array($sdcdocp);
$dsdcdoc11p = $sdcdoc1p[0];

$ddsdcdocp=mysqli_query($conn, "select sum(document) from moncust where mfin='$mfin' && hpdate5 between '$fdate' and '$tdate'");
$ddsdcdoc1p = mysqli_fetch_array($ddsdcdocp);
$dddsdcdoc11p = $ddsdcdoc1p[0];

$hppass=mysqli_query($conn, "select sum(rno) from user where mfin='$mfin' && paydate2 between '$fdate' and '$tdate'");
$hppass1 = mysqli_fetch_array($hppass);
$hppass111 = $hppass1[0];
$hppass3=mysqli_query($conn, "select sum(fine) from user where mfin='$mfin' && paydate2 between '$fdate' and '$tdate'");
$hppass13 = mysqli_fetch_array($hppass3);
$hppass1113 = $hppass13[0];
$hppass2=mysqli_query($conn, "select sum(amt) from net where mfin='$mfin' && paydate2 between '$fdate' and '$tdate'");
$hppass22 = mysqli_fetch_array($hppass2);
$hppass222 = $hppass22[0];
$hppass23=mysqli_query($conn, "select sum(fine) from net where mfin='$mfin' && paydate2 between '$fdate' and '$tdate'");
$hppass223 = mysqli_fetch_array($hppass23);
$hppass2223 = $hppass223[0];

$wwwhppass3=mysqli_query($conn, "select sum(fine) from userw where mfin='$mfin' && paydate2 between '$fdate' and '$tdate'");
$wwwhppass13 = mysqli_fetch_array($wwwhppass3);
$wwwhppass1113 = $wwwhppass13[0];
$wwwhppass23=mysqli_query($conn, "select sum(fine) from netw where mfin='$mfin' && paydate2 between '$fdate' and '$tdate'");
$wwwhppass223 = mysqli_fetch_array($wwwhppass23);
$wwwhppass2223 = $wwwhppass223[0];


$mmmhppass3=mysqli_query($conn, "select sum(fine) from userm where mfin='$mfin' && paydate2 between '$fdate' and '$tdate'");
$mmmhppass13 = mysqli_fetch_array($mmmhppass3);
$mmmhppass1113 = $mmmhppass13[0];
$mmmhppass23=mysqli_query($conn, "select sum(fine) from netm where mfin='$mfin' && paydate2 between '$fdate' and '$tdate'");
$mmmhppass223 = mysqli_fetch_array($mmmhppass23);
$mmmhppass2223 = $mmmhppass223[0];
$mpbchhqry002 = mysqli_query($conn, "select sum(rno) from monuser where mfin='$mfin' &&  paydate2 between '$fdate' and '$tdate'");
$mpbchhrow002 = mysqli_fetch_array($mpbchhqry002);
$mpbchpartuser = $mpbchhrow002[0];
$mpbchhqry003 = mysqli_query($conn, "select sum(amt) from monnet where mfin='$mfin' &&  paydate2 between '$fdate' and '$tdate'");
$mpbchhrow003 = mysqli_fetch_array($mpbchhqry003);
$mpbchpartner = $mpbchhrow003[0];

$mpbchhqry003i = mysqli_query($conn, "select sum(pass2) from netw where mfin='$mfin' &&  paydate2 between '$fdate' and '$tdate'");
$mpbchhrow003i = mysqli_fetch_array($mpbchhqry003i);
$mpbchpartneri = $mpbchhrow003i[0];

$mpbchhqry003im = mysqli_query($conn, "select sum(pass2) from netw where mfin='$mfin' &&  paydate2 between '$fdate' and '$tdate'");
$mpbchhrow003im = mysqli_fetch_array($mpbchhqry003im);
$mpbchpartnerim = $mpbchhrow003im[0];

//$pbchhqry001=mysqli_query($conn, "select sum(hpamount) from fincust where mfin='$mfin' && hpdate5 between '$fdate' and '$tdate'");
//$pbchhrow001 = mysqli_fetch_array($pbchhqry001);
//$pbchhpart = $pbchhrow001[0]; 
$ffine = $hppass1113 + + $hppass2223 + $mmmhppass1113 + $mmmhppass2223  + $wwwhppass1113 + $wwwhppass2223 + $mpbchpartnerim;
$intrcpt = $hppass111 + $mpbchpartuser  + $mpbchpartner + $hppass222 + $mpbchpartneri;

$intrcpt1 = $hppass111 + $hppass222;

$hppassw=mysqli_query($conn, "select sum(rno) from userw where mfin='$mfin' && paydate2 between '$fdate' and '$tdate'");
$hppass1w = mysqli_fetch_array($hppassw);
$nhppass111w = $hppass1w[0];
$hppass2w=mysqli_query($conn, "select sum(amt) from netw where mfin='$mfin' && paydate2 between '$fdate' and '$tdate'");
$hppass22w = mysqli_fetch_array($hppass2w);
$nhppass222w = $hppass22w[0];
$nintrcpt1w = $nhppass111w + $nhppass222w;

$hppassm=mysqli_query($conn, "select sum(rno) from userm where mfin='$mfin' && paydate2 between '$fdate' and '$tdate'");
$hppass1m = mysqli_fetch_array($hppassm);
$hppass111m = $hppass1m[0];
$hppass2m=mysqli_query($conn, "select sum(amt) from netm where mfin='$mfin' && paydate2 between '$fdate' and '$tdate'");
$hppass22m = mysqli_fetch_array($hppass2m);
$hppass222m = $hppass22m[0];

$hppass2mpre=mysqli_query($conn, "select sum(preinc) from customerdetails where mfin='$mfin' && hpdate5 between '$fdate' and '$tdate'");
$hppass22mpre = mysqli_fetch_array($hppass2mpre);
$hppass222mpre = $hppass22mpre[0];

$hppass2mpre2=mysqli_query($conn, "select sum(preinc) from customerdetailsw where mfin='$mfin' && hpdate5 between '$fdate' and '$tdate'");
$hppass22mpre2 = mysqli_fetch_array($hppass2mpre2);
$hppass222mpre2 = $hppass22mpre2[0];

$hppass2mpre3=mysqli_query($conn, "select sum(preinc) from customerdetailsm where mfin='$mfin' && hpdate5 between '$fdate' and '$tdate'");
$hppass22mpre3 = mysqli_fetch_array($hppass2mpre3);
$hppass222mpre3 = $hppass22mpre3[0];

$intrcpt1m = $hppass111m + $hppass222m;

$intrcpt2 = $mpbchpartuser  + $mpbchpartner;
$ddincome = $ddincome + $intrcpt + $ffine + $dsdcdoc11 + $dsdcdoc11w + $dsdcdoc11p + $dddsdcdoc11p + $nintrcpt1w + $intrcpt1m + $hppass222mpre + $hppass222mpre2 + $hppass222mpre3;
$dincome = $dincome2 + $intrcpt + $ffine + $dsdcdoc11 + $dsdcdoc11w + $dsdcdoc11p + $dddsdcdoc11p + $nintrcpt1w + $intrcpt1m + $hppass222mpre + $hppass222mpre2 + $hppass222mpre3;
// echo $nintrcpt1w;
//Direct Expence 
$sqlu = mysqli_query($conn, "select * from ledger where under='Direct Expenses' && mfin='$mfin'");   $capvccdr =0; $capvcccr =0; $fir++;
while($rowu = mysqli_fetch_array($sqlu)){
$ledgername = $rowu['ledger'];
$openbal = $rowu['openbal'];	
$yn = $rowu['yn'];
$cass11=mysqli_query($conn, "select sum(dr) from voucher where mfin='$mfin' && vtype='Payment' && par='$ledgername' && date between '$fdate' and '$tdate'");
$cass1 = mysqli_fetch_array($cass11); $casss2 = 0;
$cass22=mysqli_query($conn, "select sum(cr) from voucher where mfin='$mfin' && vtype='Receipt' && par='$ledgername' && date between '$fdate' and '$tdate'");
$cass23 = mysqli_fetch_array($cass22);

$crascr = $cass1[0];
$crasdr = $cass23[0];
$ddexp = $ddexp + $openbal - $crasdr + $crascr;
$dexp2 = $dexp2 + $openbal - $crasdr + $crascr;
}
$sqlu = mysqli_query($conn, "select * from ledger where under='Broker' && mfin='$mfin'");   $capvccdr =0; $capvcccr =0; $fir++;
while($rowu = mysqli_fetch_array($sqlu)){
$ledgername = $rowu['ledger'];
$openbal = $rowu['openbal'];	
$yn = $rowu['yn'];
$cass11=mysqli_query($conn, "select sum(dr) from voucher where mfin='$mfin' && vtype='Payment' && par='$ledgername' && date between '$fdate' and '$tdate'");
$cass1 = mysqli_fetch_array($cass11); $casss2 = 0;
$cass22=mysqli_query($conn, "select sum(cr) from voucher where mfin='$mfin' && vtype='Receipt' && par='$ledgername' && date between '$fdate' and '$tdate'");
$cass23 = mysqli_fetch_array($cass22);

$crascr = $cass1[0];
$crasdr = $cass23[0];
$ddexp = $ddexp + $openbal - $crasdr + $crascr;
$dexp2 = $dexp2 + $openbal - $crasdr + $crascr;
}
$sqlu = mysqli_query($conn, "select * from ledger where under='Indirect Expenses' && mfin='$mfin'");   
while($rowu = mysqli_fetch_array($sqlu)){
$ledgername = $rowu['ledger'];
$openbal = $rowu['openbal'];	
$yn = $rowu['yn'];
$cass11=mysqli_query($conn, "select sum(dr) from voucher where mfin='$mfin' && vtype='Payment' && par='$ledgername' && date between '$fdate' and '$tdate'");
$cass1 = mysqli_fetch_array($cass11); $casss2 = 0;
$cass22=mysqli_query($conn, "select sum(cr) from voucher where mfin='$mfin' && vtype='Receipt' && par='$ledgername' && date between '$fdate' and '$tdate'");
$cass23 = mysqli_fetch_array($cass22);

$crascr = $cass1[0];
$crasdr = $cass23[0];
$inexp = $inexp + $openbal - $crasdr + $crascr;
$dexp2 = $dexp2 + $openbal - $crasdr + $crascr; 
} 
$bqry4415=mysqli_query($conn, "select sum(bcommission) from customerdetails where mfin='$mfin' && hpdate5 between '$fdate' and '$tdate'");
$brow4415 = mysqli_fetch_array($bqry4415);
$mbqry4415=mysqli_query($conn, "select sum(bcommission) from customerdetailsm where mfin='$mfin' && hpdate5 between '$fdate' and '$tdate'");
$mbrow4415 = mysqli_fetch_array($mbqry4415);

$wbqry4415=mysqli_query($conn, "select sum(bcommission) from customerdetailsw where mfin='$mfin' && hpdate5 between '$fdate' and '$tdate'");
$wbrow4415 = mysqli_fetch_array($wbqry4415);

$bbccmmss = $brow4415[0] + $mbrow4415[0] + $wbrow4415[0];
$addd=mysqli_query($conn, "select sum(addless) from net where mfin='$mfin' && paydate2 between '$fdate' and '$tdate'");
$addd1 = mysqli_fetch_array($addd);
$addd11 = $addd1[0];
$lesss=mysqli_query($conn, "select sum(addless) from user where mfin='$mfin'  && paydate2 between '$fdate' and '$tdate'");
$lesss1 = mysqli_fetch_array($lesss);
$lesss11 = $lesss1[0];
$pbchhqry002=mysqli_query($conn, "select sum(rno) from finuser where mfin='$mfin'  &&  paydate2 between '$fdate' and '$tdate'");
$pbchhrow002 = mysqli_fetch_array($pbchhqry002);
$pbchpartuser = $pbchhrow002[0];
$pbchhqry003=mysqli_query($conn, "select sum(amt) from finnet where mfin='$mfin' &&  paydate2 between '$fdate' and '$tdate'");
$pbchhrow003 = mysqli_fetch_array($pbchhqry003);
$pbchpartnet = $pbchhrow003[0]; //echo $pbchhpart; echo "asas"; echo $pbchpartuser; echo "asas"; echo $pbchpartnet;
$dexp = $bbccmmss + $dexp2  + $addd11 + $lesss11 + $pbchpartuser + $pbchpartnet;
$ddexp = $bbccmmss + $ddexp + $addd11 + $lesss11 + $pbchpartuser + $pbchpartnet;
//Total P & L + $sdcdoc11 bcom

$dtot = $dincome - $dexp;   

$qwcdoc2=mysqli_query($conn, "select sum(tot) from net where mfin='$mfin' && paydate2 between '$fdate' and '$tdate'");
$qwcdoc12 = mysqli_fetch_array($qwcdoc2);
$qwcdoc112 = $qwcdoc12[0];

$qwcdoc2w=mysqli_query($conn, "select sum(tot) from netw where mfin='$mfin' && paydate2 between '$fdate' and '$tdate'");
$qwcdoc12w = mysqli_fetch_array($qwcdoc2w);
$qwcdoc112w = $qwcdoc12w[0];

$qwcdoc2m=mysqli_query($conn, "select sum(tot) from netm where mfin='$mfin' && paydate2 between '$fdate' and '$tdate'");
$qwcdoc12m = mysqli_fetch_array($qwcdoc2m);
$qwcdoc112m = $qwcdoc12m[0];

$jfghy = $qwcdoc112 + $qwcdoc112w + $qwcdoc112m ;

// $moqwcdoc2=mysqli_query($conn, "select sum(tot) from monnet where mfin='$mfin'");
// $moqwcdoc12 = mysqli_fetch_array($moqwcdoc2);
// $moqwcdoc112 = $moqwcdoc12[0];

$qwcdoc21=mysqli_query($conn, "select sum(amt) from net where mfin='$mfin' && paydate2 between '$fdate' and '$tdate'");
$qwcdoc121 = mysqli_fetch_array($qwcdoc21);
$qwcdoc1121 = $qwcdoc121[0];

$qwcdoc21w=mysqli_query($conn, "select sum(amt) from netw where mfin='$mfin' && paydate2 between '$fdate' and '$tdate'");
$qwcdoc121w = mysqli_fetch_array($qwcdoc21w);
$qwcdoc1121w = $qwcdoc121w[0];

$qwcdoc21m=mysqli_query($conn, "select sum(amt) from netm where mfin='$mfin' && paydate2 between '$fdate' and '$tdate'");
$qwcdoc121m = mysqli_fetch_array($qwcdoc21m);
$qwcdoc1121m = $qwcdoc121m[0];

$qwcdoc213=mysqli_query($conn, "select sum(preinc) from customerdetails where mfin='$mfin' && hpdate5 between '$fdate' and '$tdate'");
$qwcdoc1213 = mysqli_fetch_array($qwcdoc213);
$qwcdoc11213 = $qwcdoc1213[0];

$qwcdoc213w=mysqli_query($conn, "select sum(preinc) from customerdetailsw where mfin='$mfin' && hpdate5 between '$fdate' and '$tdate'");
$qwcdoc1213w = mysqli_fetch_array($qwcdoc213w);
$qwcdoc11213w = $qwcdoc1213w[0];

$qwcdoc213m=mysqli_query($conn, "select sum(preinc) from customerdetailsm where mfin='$mfin' && hpdate5 between '$fdate' and '$tdate'");
$qwcdoc1213m = mysqli_fetch_array($qwcdoc213m);
$qwcdoc11213m = $qwcdoc1213m[0];

$qwcdoc212=mysqli_query($conn, "select sum(rno) from user where mfin='$mfin' && paydate2 between '$fdate' and '$tdate'");
$qwcdoc1212 = mysqli_fetch_array($qwcdoc212);
$qwcdoc11212 = $qwcdoc1212[0];

$qwcdoc212w=mysqli_query($conn, "select sum(rno) from userw where mfin='$mfin' && paydate2 between '$fdate' and '$tdate'");
$qwcdoc1212w = mysqli_fetch_array($qwcdoc212w);
$qwcdoc11212w = $qwcdoc1212w[0];

$qwcdoc212m=mysqli_query($conn, "select sum(rno) from userm where mfin='$mfin' && paydate2 between '$fdate' and '$tdate'");
$qwcdoc1212m = mysqli_fetch_array($qwcdoc212m);
$qwcdoc11212m = $qwcdoc1212m[0];




$qwcdoc212wp=mysqli_query($conn, "select sum(rno) from monuser where mfin='$mfin' && paydate2 between '$fdate' and '$tdate'");
$qwcdoc1212wp = mysqli_fetch_array($qwcdoc212wp);
$qwcdoc11212wp = $qwcdoc1212wp[0];

$qwcdoc212mr=mysqli_query($conn, "select sum(dueamt) from monnet where mfin='$mfin' && paydate2 between '$fdate' and '$tdate'");
$qwcdoc1212mr = mysqli_fetch_array($qwcdoc212mr);
$qwcdoc11212mr = $qwcdoc1212mr[0];

echo "$qwcdoc11213";


$ftyut = $qwcdoc11212 + $qwcdoc1121 + $qwcdoc11213 + $qwcdoc11212w + $qwcdoc1121w + $qwcdoc11213w + $qwcdoc11212m + $qwcdoc1121m + $qwcdoc11213m + $qwcdoc11212wp + $qwcdoc11212mr; 

			$qwcdoc21=mysqli_query($conn, "select sum(amt) from net where mfin='$mfin' && paydate2 between '$fdate' and '$tdate'");
$qwcdoc121 = mysqli_fetch_array($qwcdoc21);
$qwcdoc1121 = $qwcdoc121[0];

$qwcdoc21w=mysqli_query($conn, "select sum(amt) from netw where mfin='$mfin' && paydate2 between '$fdate' and '$tdate'");
$qwcdoc121w = mysqli_fetch_array($qwcdoc21w);
$qwcdoc1121w = $qwcdoc121w[0];

$qwcdoc21m=mysqli_query($conn, "select sum(amt) from netm where mfin='$mfin' && paydate2 between '$fdate' and '$tdate'");
$qwcdoc121m = mysqli_fetch_array($qwcdoc21m);
$qwcdoc1121m = $qwcdoc121m[0];

$qwcdoc213=mysqli_query($conn, "select sum(document) from customerdetails where mfin='$mfin' && hpdate5 between '$fdate' and '$tdate'");
$qwcdoc1213 = mysqli_fetch_array($qwcdoc213);
$qwcdoc11213 = $qwcdoc1213[0];

$qwcdoc213w=mysqli_query($conn, "select sum(document) from customerdetailsw where mfin='$mfin' && hpdate5 between '$fdate' and '$tdate'");
$qwcdoc1213w = mysqli_fetch_array($qwcdoc213w);
$qwcdoc11213w = $qwcdoc1213w[0];

$qwcdoc213m=mysqli_query($conn, "select sum(document) from customerdetailsm where mfin='$mfin' && hpdate5 between '$fdate' and '$tdate'");
$qwcdoc1213m = mysqli_fetch_array($qwcdoc213m);
$qwcdoc11213m = $qwcdoc1213m[0];

$qwcdoc213mpi=mysqli_query($conn, "select sum(preinc) from customerdetails where mfin='$mfin' && hpdate5 between '$fdate' and '$tdate'");
$qwcdoc1213mpi = mysqli_fetch_array($qwcdoc213mpi);
$qwcdoc11213mpi = $qwcdoc1213mpi[0];

$qwcdoc213mpiw=mysqli_query($conn, "select sum(preinc) from customerdetailsw where mfin='$mfin' && hpdate5 between '$fdate' and '$tdate'");
$qwcdoc1213mpiw = mysqli_fetch_array($qwcdoc213mpiw);
$qwcdoc11213mpiw = $qwcdoc1213mpiw[0];

$qwcdoc213mpim=mysqli_query($conn, "select sum(preinc) from customerdetailsm where mfin='$mfin' && hpdate5 between '$fdate' and '$tdate'");
$qwcdoc1213mpim = mysqli_fetch_array($qwcdoc213mpim);
$qwcdoc11213mpim = $qwcdoc1213mpim[0];

$qwcdoc212=mysqli_query($conn, "select sum(rno) from user where mfin='$mfin' && paydate2 between '$fdate' and '$tdate'");
$qwcdoc1212 = mysqli_fetch_array($qwcdoc212);
$qwcdoc11212 = $qwcdoc1212[0];

$qwcdoc212w=mysqli_query($conn, "select sum(rno) from userw where mfin='$mfin' && paydate2 between '$fdate' and '$tdate'");
$qwcdoc1212w = mysqli_fetch_array($qwcdoc212w);
$qwcdoc11212w = $qwcdoc1212w[0];

$qwcdoc212m=mysqli_query($conn, "select sum(rno) from userm where mfin='$mfin' && paydate2 between '$fdate' and '$tdate'");
$qwcdoc1212m = mysqli_fetch_array($qwcdoc212m);
$qwcdoc11212m = $qwcdoc1212m[0];

$qwcdoc212mmon=mysqli_query($conn, "select sum(rno) from monuser where mfin='$mfin' && paydate2 between '$fdate' and '$tdate'");
$qwcdoc1212mmon = mysqli_fetch_array($qwcdoc212mmon);
$qwcdoc11212mmon = $qwcdoc1212mmon[0];

$qwcdoc212mmonn=mysqli_query($conn, "select sum(amt) from monnet where mfin='$mfin' && paydate2 between '$fdate' and '$tdate'");
$qwcdoc1212mmonn = mysqli_fetch_array($qwcdoc212mmonn);
$qwcdoc11212mmonn = $qwcdoc1212mmonn[0];

$ftyut1 = $qwcdoc11212 + $qwcdoc1121 + $qwcdoc11213 + $qwcdoc11212w + $qwcdoc11212mmon + $qwcdoc11212mmonn + $qwcdoc1121w + $qwcdoc11213w + $qwcdoc11212m + $qwcdoc1121m + $qwcdoc11213m + $qwcdoc11213mpi + $qwcdoc11213mpiw + $qwcdoc11213mpim; 					
									
						
						

//echo $dincome; echo "<>"; echo $dexp; ?>
  <div class="row top_tiles">
  <div class="">
            <div class="row top_tiles">
              <a href="allcusa.php"> <div class="animated flipInY col-lg-3 col-md-3 col-sm-6 col-xs-12">
                <div style="background: linear-gradient(110deg, #fdcd3b 60%, #ffed4b 60%);" class="tile-stats">
                  <div class="icon"><i class="fa fa-check-square-o" ></i></div>
                  <div class="count"><a href="lview.php"><font color="white"><?php echo $n; ?></a> / <a href="lvieww.php"><font color="white"><?php echo $nw; ?></a> / <a href="lviewm.php"><font color="white"><?php echo $nm; ?></a></div>
                  <h3><font color="white"><b>Active Loans</b></font></h3>
                  <p>Daily / Weekly / EMI</p>
                </div>
              </div></a>
                         <a href="allcusc.php">   <div class="animated flipInY col-lg-3 col-md-3 col-sm-6 col-xs-12">
                <div style="background: linear-gradient(110deg, #FD1C03 60%, #FF4500 60%);" class="tile-stats">
                  <div class="icon"><i class="fa fa-close"></i></div>
                  <div class="count"><a href="lviewc.php"><font color="white"><?php echo $nq; ?></a> / <a href="lviewc1.php"><font color="white"><?php echo $nqw; ?></a> / <a href="lviewc2.php"><font color="white"><?php echo $nqm; ?></a></div>

                  <h3><font color="white"><b>Closed Loans</b></font></h3>
                  <p>Daily / Weekly / EMI</p>
                </div>
              </div></a>
                         <?php 
$qry15=mysqli_query($conn, "select sum(totalhpamt) from customerdetails where mfin='$mfin'");
$row15 = mysqli_fetch_array($qry15);
$qry15qq=mysqli_query($conn, "select sum(totalhpamt) from customerdetailsm where mfin='$mfin'");
$row15qq = mysqli_fetch_array($qry15qq);
$qry15ww=mysqli_query($conn, "select sum(totalhpamt) from customerdetailsw where mfin='$mfin'");
$row15ww = mysqli_fetch_array($qry15ww);

$tothpamt = $row15[0] + $row15qq[0] + $row15ww[0];
?>
                        <a href="allcusca.php">    <div class="animated flipInY col-lg-3 col-md-3 col-sm-6 col-xs-12">
                <div style="background: linear-gradient(to left, #ff00c8 , #d8268e);" class="tile-stats">
                  <div class="icon"><i class="fa fa-motorcycle"></i></div>
                  <div class="count"><?php echo $tothpamt; ?></div>
                  <h3><font color="white"><b>Total Loan Amount</b></font></h3>
                  <p>Total</p>
                </div>
              </div></a>
                       <a href="hpbalall.php">     <div class="animated flipInY col-lg-3 col-md-3 col-sm-6 col-xs-12">
                <div style="background: linear-gradient(to left, #c94343d5 , #fd1414);" class="tile-stats">
                  <div class="icon"><i class="fa fa-hand-o-left "></"></i></div>
                  <div class="count"><?php echo $hpparty; ?></div>
                  <h3><font color="white"><b>Principal Balance</b></font></h3>
                  <p>Total</p>
                </div>
              </div></a>
         
		           <a href="bals.php">    <div class="animated flipInY col-lg-3 col-md-3 col-sm-6 col-xs-12">
                <div style="background: linear-gradient(to left, #e200f7 , #bd27b0);" class="tile-stats">
                  <div class="icon"><i class="fa fa-inr"></i></div>
                  <div class="count"><?php echo  $cassin; ?>  </div>
                  <h3><font color="white"><b>Cash Balance</b></font></h3>
                  <p>Current</p>
                </div>
              </div> </a>
              <a href="bals.php">    <div class="animated flipInY col-lg-3 col-md-3 col-sm-6 col-xs-12">
                <div style="background: linear-gradient(to left, #e200f7 , #bd27b0);" class="tile-stats">
                  <div class="icon"><i class="fa fa-inr"></i></div>
                  <div class="count">  <?php echo  $banka; ?></div>
                  <h3><font color="white"><b>Bank Balance</b></font></h3>
                  <p>Current</p>
                </div>
              </div> </a>
            <!--<a href="finlview.php">   <div class="animated flipInY col-lg-3 col-md-3 col-sm-6 col-xs-12">-->
            <!--    <div style="background: linear-gradient(to left, #2bff00 , #27bd27);" class="tile-stats">-->
            <!--      <div class="icon"><i class="fa fa-university"></i></div>-->
            <!--      <div class="count"><?php //echo $fn343; ?></div>-->
            <!--      <h3><font color="white"><b>Fixed Deposits</b></font></h3>-->
            <!--      <p>Total-Active</p>-->
            <!--    </div>-->
            <!--  </div> </a>-->
			         <!--    <a href="finlview.php">    <div class="animated flipInY col-lg-3 col-md-3 col-sm-6 col-xs-12">-->
            <!--    <div style="background: linear-gradient(to left, #01ffc8 , #27bda9);" class="tile-stats">-->
            <!--      <div class="icon"><i class="fa fa-stack-exchange"></i></div>-->
            <!--      <div class="count"><?php //echo $fnq343; ?></div>-->
            <!--      <h3><font color="white"><b>Closed FD</b></font></h3>-->
            <!--      <p>Total-Active</p>-->
            <!--    </div>-->
            <!--  </div> </a>-->
              
            <!--   <a href="lview.php">     <div class="animated flipInY col-lg-3 col-md-3 col-sm-6 col-xs-12">-->
            <!--    <div style="background: linear-gradient(to left, #d9ff00 , #adaf32);" class="tile-stats">-->
            <!--      <div class="icon"><i class="fa fa-check-square-o"></i></div>-->
            <!--      <div class="count"><?php //echo $sdfgh; ?></div>-->
            <!--      <h3><font color="white"><b>FD Loan Amount</b></font></h3>-->
            <!--      <p>Today</p>-->
            <!--    </div>-->
            <!--  </div> </a>-->
              
              
			            <a href="lview.php">     <div class="animated flipInY col-lg-3 col-md-3 col-sm-6 col-xs-12">
                <div style="background: linear-gradient(to left, #d9ff00 , #adaf32);" class="tile-stats">
                  <div class="icon"><i class="fa fa-check-square-o"></i></div>
                  <div class="count"><?php echo $hpparty1; ?></div>
                  <h3><font color="white"><b>Loan Amount</b></font></h3>
                  <p>Today</p>
                </div>
              </div> </a>
              
              
              <?php
                 $ii = date("d");
                        $qry412=mysqli_query($conn, "SELECT * FROM pending where mfin='$mfin' && ddd='$ii'");
						$tdue=mysqli_num_rows($qry412);
						
						$iiw = date("d");
						
						$qry4121=mysqli_query($conn, "SELECT * FROM pendingw where mfin='$mfin' && ddd='$iiw'");
						$tdue1=mysqli_num_rows($qry4121);
						
						$iim = date("d");
						
						$qry4122=mysqli_query($conn, "SELECT * FROM pendingm where mfin='$mfin' && ddd='$iim'");
						$tdue2=mysqli_num_rows($qry4122);
						?>
              
                  <div class="animated flipInY col-lg-3 col-md-3 col-sm-6 col-xs-12">
                <div style="background: linear-gradient(to left, #d9ff00 , #adaf32);" class="tile-stats">
                  <div class="icon"><i class="fa fa-check-square-o"></i></div>
                  
                  <div class="count"><a href="dpending.php"> <?php echo $tdue; ?></a> / <a href="dpending2.php"><?php echo $tdue1; ?></a> / <a href="dpendingm.php"><?php echo $tdue2; ?></a></div>
                  <h3><font color="white"><b>D/W/M Today Dues</b></font></h3>
                  <p>Today</p>
                </div>
              </div> 
<a href="res.php">   

 <?php 
    $tdate33 = date("Y-m-d");
    $qry452yyy=mysqli_query($conn, "select * from res where mfin='$mfin' && rdate='$tdate33'");
	$n332yyy=mysqli_num_rows($qry452yyy);
	
	$qry452yyyw=mysqli_query($conn, "select * from resw where mfin='$mfin' && rdate='$tdate33'");
	$n332yyyw=mysqli_num_rows($qry452yyyw);
	
	$qry452yyym=mysqli_query($conn, "select * from resm where mfin='$mfin' && rdate='$tdate33'");
	$n332yyym=mysqli_num_rows($qry452yyym);
	
	$qry452yyymm=mysqli_query($conn, "select * from resmm where mfin='$mfin' && rdate='$tdate33'");
	$n332yyymm=mysqli_num_rows($qry452yyymm);
	
	?>
<div class="animated flipInY col-lg-3 col-md-3 col-sm-6 col-xs-12">
                <div style="background: linear-gradient(to left, #01ffc8 , #27bda9);" class="tile-stats">
                  <div class="icon"><i class="fa fa-stack-exchange"></i></div>
                  <div class="count"><a href="res.php"><?php echo $n332yyy; ?></a> / <a href="resw.php"><?php echo $n332yyyw; ?></a> / <a href="resm.php"><?php echo $n332yyym; ?></a></div>
                  <h3><font color="white"><b>Promissed Cust D / W / M </b></font></h3>
                  <p>Total-Active</p>
                </div>
              </div> </a>
              
              
              <?php 
$tdate332 = date("Y-m-d");

// Cash A/c Collections
$daily = mysqli_query($conn, "SELECT SUM(urname) FROM user WHERE mfin='$mfin' AND paydate2='$tdate332' AND mode='Cash A/c'");
$daily1 = mysqli_fetch_array($daily);

$weekly = mysqli_query($conn, "SELECT SUM(urname) FROM userw WHERE mfin='$mfin' AND paydate2='$tdate332' AND mode='Cash A/c'");
$weekly1 = mysqli_fetch_array($weekly);

$monthly = mysqli_query($conn, "SELECT SUM(urname) FROM userm WHERE mfin='$mfin' AND paydate2='$tdate332' AND mode='Cash A/c'");
$monthly1 = mysqli_fetch_array($monthly);

$dailynet = mysqli_query($conn, "SELECT SUM(tot) FROM net WHERE mfin='$mfin' AND paydate2='$tdate332' AND mode='Cash A/c'");
$daily1net = mysqli_fetch_array($dailynet);

$weeklynet = mysqli_query($conn, "SELECT SUM(tot) FROM netw WHERE mfin='$mfin' AND paydate2='$tdate332' AND mode='Cash A/c'");
$weekly1net = mysqli_fetch_array($weeklynet);

$monthlynet = mysqli_query($conn, "SELECT SUM(tot) FROM netm WHERE mfin='$mfin' AND paydate2='$tdate332' AND mode='Cash A/c'");
$monthly1net = mysqli_fetch_array($monthlynet);


$dailyb = mysqli_query($conn, "SELECT SUM(urname) FROM user WHERE mfin='$mfin' AND paydate2='$tdate332' AND mode!='Cash A/c'");
$daily1b = mysqli_fetch_array($dailyb);

$weeklyb = mysqli_query($conn, "SELECT SUM(urname) FROM userw WHERE mfin='$mfin' AND paydate2='$tdate332' AND mode!='Cash A/c'");
$weekly1b = mysqli_fetch_array($weeklyb);

$monthlyb = mysqli_query($conn, "SELECT SUM(urname) FROM userm WHERE mfin='$mfin' AND paydate2='$tdate332' AND mode!='Cash A/c'");
$monthly1b = mysqli_fetch_array($monthlyb);

$dailynetb = mysqli_query($conn, "SELECT SUM(tot) FROM net WHERE mfin='$mfin' AND paydate2='$tdate332' AND mode!='Cash A/c'");
$daily1netb = mysqli_fetch_array($dailynetb);

$weeklynetb = mysqli_query($conn, "SELECT SUM(tot) FROM netw WHERE mfin='$mfin' AND paydate2='$tdate332' AND mode!='Cash A/c'");
$weekly1netb = mysqli_fetch_array($weeklynetb);

$monthlynetb = mysqli_query($conn, "SELECT SUM(tot) FROM netm WHERE mfin='$mfin' AND paydate2='$tdate332' AND mode!='Cash A/c'");
$monthly1netb = mysqli_fetch_array($monthlynetb);


$toturandtot = $daily1[0] + $weekly1[0] + $monthly1[0] + $daily1net[0] + $weekly1net[0] + $monthly1net[0];
$toturandtot1 = $daily1b[0] + $weekly1b[0] + $monthly1b[0] + $daily1netb[0] + $weekly1netb[0] + $monthly1netb[0];
?>

<a href="billrep.php">    <div class="animated flipInY col-lg-3 col-md-3 col-sm-6 col-xs-12">
                <div style="background: linear-gradient(to left, #e200f7 , #bd27b0);" class="tile-stats">
                  <div class="icon"><i class="fa fa-inr"></i></div>
                  <div class="count"><?php echo  $toturandtot; ?>  </div>
                  <h3><font color="white"><b>Today Loan Collection Cash</b></font></h3>
                  <p>Today</p>
                </div>
              </div> </a>
              <a href="billrep.php">    <div class="animated flipInY col-lg-3 col-md-3 col-sm-6 col-xs-12">
                <div style="background: linear-gradient(to left, #e200f7 , #bd27b0);" class="tile-stats">
                  <div class="icon"><i class="fa fa-inr"></i></div>
                  <div class="count">  <?php echo  $toturandtot1; ?></div>
                  <h3><font color="white"><b>Today Loan Collection Bank</b></font></h3>
                  <p>Today</p>
                </div>
              </div> </a>

		   </div>
		   
		   
		  
		   
		   
		<?php
						 $e=0;  $s=0;  $r=0;  $t=0; $d=0; $d1=0; $i=1;
							$sqll = mysqli_query($conn, "select * from abc where mfin='$mfin'");
	$rowww = mysqli_fetch_array($sqll);
											$fdate1 =  $rowww['date1']; 
										$tdate1 =  $rowww['date2']; 
											$fdate =  date("Y-m-d", strtotime("$fdate1")); 
										$tdate =  date("Y-m-t", strtotime("$fdate"));
										$obal = 0;
	$qcre =  0;
$qdeb =  0;
				
$quser = 0;
$qnett = 0; $iii = 0;
$qdeff = 0;
$qhpp =0;
$qtot = 0;			//	   $fdate = $fdate;  $tdate = $tdate; 
								while(strtotime($fdate)<=strtotime($tdate1)) { $iii++;
					$monthh = date('F, Y', strtotime($fdate));

$qry15=mysqli_query($conn, "select sum(hpamount) from customerdetails where mfin='$mfin'  && hpdate5 between '$fdate' and '$tdate'");
$row15 = mysqli_fetch_array($qry15);

$qry15w=mysqli_query($conn, "select sum(hpamount) from customerdetailsw where mfin='$mfin'  && hpdate5 between '$fdate' and '$tdate'");
$row15w = mysqli_fetch_array($qry15w);

$qry15m=mysqli_query($conn, "select sum(hpamount) from customerdetailsm where mfin='$mfin'  && hpdate5 between '$fdate' and '$tdate'");
$row15m = mysqli_fetch_array($qry15m);

$qry4415=mysqli_query($conn, "select sum(document) from customerdetails where mfin='$mfin'  && hpdate5 between '$fdate' and '$tdate'");
$row4415 = mysqli_fetch_array($qry4415);

$qry45=mysqli_query($conn, "select sum(pass) from user where mfin='$mfin'  &&  paydate2 between '$fdate' and '$tdate'");
$row45 = mysqli_fetch_array($qry45);

$qry45w=mysqli_query($conn, "select sum(pass) from userw where mfin='$mfin'  &&  paydate2 between '$fdate' and '$tdate'");
$row45w = mysqli_fetch_array($qry45w);

$qry45m=mysqli_query($conn, "select sum(pass) from userm where mfin='$mfin'  &&  paydate2 between '$fdate' and '$tdate'");
$row45m = mysqli_fetch_array($qry45m);


$qry452=mysqli_query($conn, "select sum(rno) from user where mfin='$mfin'  &&  paydate2 between '$fdate' and '$tdate'");
$row452 = mysqli_fetch_array($qry452);

$qry452w=mysqli_query($conn, "select sum(rno) from userw where mfin='$mfin'  &&  paydate2 between '$fdate' and '$tdate'");
$row452w = mysqli_fetch_array($qry452w);

$qry452m=mysqli_query($conn, "select sum(rno) from userm where mfin='$mfin'  &&  paydate2 between '$fdate' and '$tdate'");
$row452m = mysqli_fetch_array($qry452m);

$qry445=mysqli_query($conn, "select sum(dueamt) from net where mfin='$mfin'  &&  paydate2 between '$fdate' and '$tdate'");
$row445 = mysqli_fetch_array($qry445);

$qry445w=mysqli_query($conn, "select sum(dueamt) from netw where mfin='$mfin'  &&  paydate2 between '$fdate' and '$tdate'");
$row445w = mysqli_fetch_array($qry445w);

$qry445m=mysqli_query($conn, "select sum(dueamt) from netm where mfin='$mfin'  &&  paydate2 between '$fdate' and '$tdate'");
$row445m = mysqli_fetch_array($qry445m);

$qry4451=mysqli_query($conn, "select sum(amt) from net where mfin='$mfin'  &&  paydate2 between '$fdate' and '$tdate'");
$row4451 = mysqli_fetch_array($qry4451);

$qry4451w=mysqli_query($conn, "select sum(amt) from netw where mfin='$mfin'  &&  paydate2 between '$fdate' and '$tdate'");
$row4451w = mysqli_fetch_array($qry4451w);

$qry4451m=mysqli_query($conn, "select sum(amt) from netm where mfin='$mfin'  &&  paydate2 between '$fdate' and '$tdate'");
$row4451m = mysqli_fetch_array($qry4451m);

$qry009=mysqli_query($conn, "select sum(fine) from net where mfin='$mfin'  &&  paydate2 between '$fdate' and '$tdate'");
$row009 = mysqli_fetch_array($qry009);
$qry0099=mysqli_query($conn, "select sum(fine) from user where mfin='$mfin'  &&  paydate2 between '$fdate' and '$tdate'");
$row0099 = mysqli_fetch_array($qry0099);

$qry009w=mysqli_query($conn, "select sum(fine) from netw where mfin='$mfin'  &&  paydate2 between '$fdate' and '$tdate'");
$row009w = mysqli_fetch_array($qry009w);
$qry0099w=mysqli_query($conn, "select sum(fine) from userw where mfin='$mfin'  &&  paydate2 between '$fdate' and '$tdate'");
$row0099w = mysqli_fetch_array($qry0099w);


$qry009m=mysqli_query($conn, "select sum(fine) from netm where mfin='$mfin'  &&  paydate2 between '$fdate' and '$tdate'");
$row009m = mysqli_fetch_array($qry009m);
$qry0099m=mysqli_query($conn, "select sum(fine) from userm where mfin='$mfin'  &&  paydate2 between '$fdate' and '$tdate'");
$row0099m = mysqli_fetch_array($qry0099m);



$qry779=mysqli_query($conn, "select sum(actamt) from hloan where mfin='$mfin' && date2 between '$fdate' and '$tdate'");
$row779 = mysqli_fetch_array($qry779);

$qry001=mysqli_query($conn, "select sum(hpamount) from fincust where mfin='$mfin' && hpdate5 between '$fdate' and '$tdate'");
$row001 = mysqli_fetch_array($qry001);
$qry002=mysqli_query($conn, "select sum(urname) from finuser where mfin='$mfin' &&  paydate2 between '$fdate' and '$tdate'");
$row002 = mysqli_fetch_array($qry002);
$qry003=mysqli_query($conn, "select sum(tot) from finnet where mfin='$mfin' &&  paydate2 between '$fdate' and '$tdate'");
$row003 = mysqli_fetch_array($qry003);



  $userr = $row45[0] + $row45w[0] + $row45m[0] + $row445[0] + $row445w[0] + $row445m[0];	
  $nett = $row452[0] + $row452w[0] + $row452m[0] + $row4451[0] + $row4451w[0] + $row4451m[0]; 
  $deff = $row009[0] + $row0099[0] +  $row009w[0] + $row0099w[0] +  $row009m[0] + $row0099m[0]; 
  $hpp = $row15[0] + $row15w[0] + $row15m[0]; 
  $tot = $userr + $nett + $deff;

  $quser = $quser + $userr;
  $qnett = $qnett + $nett;
  $qdeff = $qdeff + $deff;
  $qhpp = $qhpp + $hpp;
  $qtot = $qtot + $tot; 
						$totqaa[$iii] = $hpp;
						$totq[$iii]   = $userr;
						$totqq[$iii]  = $nett;
						$totqa[$iii]  = $deff;
						$tott[$iii]   = $monthh;
						
						$fdate =  date("Y-m-d", strtotime("$fdate + " . 1 . " month"));

						$tdate = date("Y-m-t", strtotime("$fdate"));

						}
						?>
            <div class="row">
              <div class="col-md-12">
                <div class="x_panel">
                  <div class="x_title">
                    <h2>Transaction Summary <small>Weekly progress</small></h2>
                    <div class="filter">
                      <div id="reportrange" class="pull-right" style="background: #fff; cursor: pointer; padding: 5px 10px; border: 1px solid #ccc">
                        <i class="glyphicon glyphicon-calendar fa fa-calendar"></i>
                        <span>December 30, 2014 - January 28, 2015</span> <b class="caret"></b>
                      </div>
                    </div>
                    <div class="clearfix"></div>
                  </div>
                  <div class="x_content">
                    <div class="col-md-9 col-sm-12 col-xs-12">
                     <?php

	$dataPoints1 = array(
	array("label"=>$tott[1], "y"=>$totq[1]),
	array("label"=>$tott[2], "y"=>$totq[2]),
	array("label"=>$tott[3], "y"=>$totq[3]),
	array("label"=>$tott[4], "y"=>$totq[4]),
	array("label"=>$tott[5], "y"=>$totq[5]),
	array("label"=>$tott[6], "y"=>$totq[6]),
	array("label"=>$tott[7], "y"=>$totq[7]),
	array("label"=>$tott[8], "y"=>$totq[8]),
	array("label"=>$tott[9], "y"=>$totq[9]),
	array("label"=>$tott[10], "y"=>$totq[10]),
	array("label"=>$tott[11], "y"=>$totq[11]),
	array("label"=>$tott[12], "y"=>$totq[12])
	
);

	$dataPoints2 = array(
	array("label"=>$tott[1], "y"=>$totqq[1]),
	array("label"=>$tott[2], "y"=>$totqq[2]),
	array("label"=>$tott[3], "y"=>$totqq[3]),
	array("label"=>$tott[4], "y"=>$totqq[4]),
	array("label"=>$tott[5], "y"=>$totqq[5]),
	array("label"=>$tott[6], "y"=>$totqq[6]),
	array("label"=>$tott[7], "y"=>$totqq[7]),
	array("label"=>$tott[8], "y"=>$totqq[8]),
	array("label"=>$tott[9], "y"=>$totqq[9]),
	array("label"=>$tott[10], "y"=>$totqq[10]),
	array("label"=>$tott[11], "y"=>$totqq[11]),
	array("label"=>$tott[12], "y"=>$totqq[12])
	
);

	$dataPoints3 = array(
	array("label"=>$tott[1], "y"=>$totqa[1]),
	array("label"=>$tott[2], "y"=>$totqa[2]),
	array("label"=>$tott[3], "y"=>$totqa[3]),
	array("label"=>$tott[4], "y"=>$totqa[4]),
	array("label"=>$tott[5], "y"=>$totqa[5]),
	array("label"=>$tott[6], "y"=>$totqa[6]),
	array("label"=>$tott[7], "y"=>$totqa[7]),
	array("label"=>$tott[8], "y"=>$totqa[8]),
	array("label"=>$tott[9], "y"=>$totqa[9]),
	array("label"=>$tott[10], "y"=>$totqa[10]),
	array("label"=>$tott[11], "y"=>$totqa[11]),
	array("label"=>$tott[12], "y"=>$totqa[12])
	
);
$dataPoints4 = array(
	array("label"=>$tott[1], "y"=>$totqaa[1]),
	array("label"=>$tott[2], "y"=>$totqaa[2]),
	array("label"=>$tott[3], "y"=>$totqaa[3]),
	array("label"=>$tott[4], "y"=>$totqaa[4]),
	array("label"=>$tott[5], "y"=>$totqaa[5]),
	array("label"=>$tott[6], "y"=>$totqaa[6]),
	array("label"=>$tott[7], "y"=>$totqaa[7]),
	array("label"=>$tott[8], "y"=>$totqaa[8]),
	array("label"=>$tott[9], "y"=>$totqaa[9]),
	array("label"=>$tott[10], "y"=>$totqaa[10]),
	array("label"=>$tott[11], "y"=>$totqaa[11]),
	array("label"=>$tott[12], "y"=>$totqaa[12])
	
);


 ?>
<script>
window.onload = function () {
 
var chart = new CanvasJS.Chart("chartContainer", {
	title: {
		text: "Smart Collection Report"
	},
	theme: "light2",
	animationEnabled: true,
	toolTip:{
		shared: true,
		reversed: true
	},
	axisY: {
		title: "Amount In",
		suffix: " Rs"
	},
	legend: {
		cursor: "pointer",
		itemclick: toggleDataSeries
	},
	data: [
		{
			type: "stackedColumn",
			name: "Principle Received",
			showInLegend: true,
			yValueFormatString: "#,##0 Rs",
			dataPoints: <?php echo json_encode($dataPoints1, JSON_NUMERIC_CHECK); ?>
		},{
			type: "stackedColumn",
			name: "Interest Received",
			showInLegend: true,
			yValueFormatString: "#,##0 Rs",
			dataPoints: <?php echo json_encode($dataPoints2, JSON_NUMERIC_CHECK); ?>
		},{
			type: "stackedColumn",
			name: "Default Received",
			showInLegend: true,
			yValueFormatString: "#,##0 Rs",
			dataPoints: <?php echo json_encode($dataPoints3, JSON_NUMERIC_CHECK); ?>
		},{
			type: "stackedColumn",
			name: "Loan AMOUNT GIVEN",
			showInLegend: true,
			yValueFormatString: "#,##0 Rs",
			dataPoints: <?php echo json_encode($dataPoints4, JSON_NUMERIC_CHECK); ?>
		}
	]
});
 
chart.render();
 
function toggleDataSeries(e) {
	if (typeof (e.dataSeries.visible) === "undefined" || e.dataSeries.visible) {
		e.dataSeries.visible = false;
	} else {
		e.dataSeries.visible = true;
	}
	e.chart.render();
}
 
}
</script>

<div id="chartContainer" style="height: 370px; width: 100%;"></div>
<script src="https://canvasjs.com/assets/script/canvasjs.min.js"></script>
                    <!--  <div class="tiles">
                        <div class="col-md-4 tile">
                          <span>Total Interest Income</span>
                          <h2>Rs.231,809</h2>
                          <span class="sparkline11 graph" style="height: 160px;">
                               <canvas width="200" height="60" style="display: inline-block; vertical-align: top; width: 94px; height: 30px;"></canvas>
                          </span>
                        </div>
                        <div class="col-md-4 tile">
                          <span>Total Pledege Given</span>
                          <h2>Rs.231,809</h2>
                          <span class="sparkline22 graph" style="height: 160px;">
                                <canvas width="200" height="60" style="display: inline-block; vertical-align: top; width: 94px; height: 30px;"></canvas>
                          </span>
                        </div>
                        <div class="col-md-4 tile">
                          <span>Total Pledege Release</span>
                          <h2>Rs.231,809</h2>
                          <span class="sparkline11 graph" style="height: 160px;">
                                 <canvas width="200" height="60" style="display: inline-block; vertical-align: top; width: 94px; height: 30px;"></canvas>
                          </span>
                        </div>
                      </div> -->

                    </div>

                    <div class="col-md-3 col-sm-12 col-xs-12">
                    

	   
                     
                         <a href="lview.php">     <div style="background: linear-gradient(to left, #f5b14b , #bd6f27);" class="tile-stats">
                  <div class="icon"><i class="fa fa-stack-overflow"></i></div>
                  <div class="count"><?php echo $jfghy; ?></div>
                  <h3><font color="white"><b>Settlement Amount </b></font></h3>
                  <p>Today</p>
                </div></a>
              
			 
                         <a href="billrep.php">     <div style="background: linear-gradient(to left, #44350b , #bd8127);" class="tile-stats">
                  <div class="icon"><i class="fa fa-check-square-o"></i></div>
                  <div class="count"><?php echo $ftyut; ?></div>
                  <h3><font color="white"><b>Interest Income</b></font></h3>
                  <p>Total</p>
                </div></a>
           
                         <a href="pnl.php">     <div style="background: linear-gradient(to left, #c94343d5 , #fd1414);" class="tile-stats">
                  <div class="icon"><i class="fa fa-exclamation-triangle"></i></div>
                  <div class="count"><?php echo $dtot; ?></div>
                  <h3><font color="white"><b>Profit & Loss</b></font></h3>
                  <p>Total</p>
                </div></a>
					  
                    </div>

                  </div>
                </div>
              </div>
            </div>
  
 <!--<div class="row top_tiles">-->
 <!--             <a href="monlview.php"> <div class="animated flipInY col-lg-3 col-md-3 col-sm-6 col-xs-12">-->
 <!--               <div style="background: linear-gradient(110deg, #00FFFF 60%, #9AFEFF 60%);" class="tile-stats">-->
 <!--                 <div class="icon"><i class="fa fa-check-square-o" ></i></div>-->
 <!--                 <div class="count"><?php echo $mon; ?></div>-->
 <!--                 <h3><font color="white"><b>Active Loans - OD</b></font></h3>-->
 <!--                 <p>Total</p>-->
 <!--               </div>-->
 <!--             </div></a>-->
 <!--                        <a href="monlview.php">   <div class="animated flipInY col-lg-3 col-md-3 col-sm-6 col-xs-12">-->
 <!--               <div style="background: linear-gradient(110deg, #FD1C03 60%, #FF4500 60%);" class="tile-stats">-->
 <!--                 <div class="icon"><i class="fa fa-close"></i></div>-->
 <!--                 <div class="count"><?php echo $monq; ?></div>-->
 <!--                 <h3><font color="white"><b>Closed Loans - OD</b></font></h3>-->
 <!--                 <p>Total</p>-->
 <!--               </div>-->
 <!--             </div></a>-->
 <!--                          <a href="monlview.php">    -->
 <!--<div class="animated flipInY col-lg-3 col-md-3 col-sm-6 col-xs-12">-->
	<!--					   <div style="background: linear-gradient(110deg, #DAEE01 60%, #E2F516 60%);" class="tile-stats">-->
 <!--                 <div class="icon"><i class="fa fa-stack-overflow"></i></div>-->
 <!--                 <div class="count"><?php echo $moqwcdoc112; ?></div>-->
 <!--                 <h3><font color="white"><b>Settlement Amount - OD</b></font></h3>-->
 <!--                 <p>Today</p>-->
 <!--               </div> </div></a>-->
				
 <!--                    <a href="monlview.php">     <div class="animated flipInY col-lg-3 col-md-3 col-sm-6 col-xs-12">-->
 <!--               <div style="background: linear-gradient(110deg, #66CDAA 60%, #AAF0D1 60%);" class="tile-stats">-->
 <!--                 <div class="icon"><i class="fa fa-check-square-o"></i></div>-->
 <!--                 <div class="count"><?php echo $mohpparty1; ?></div>-->
 <!--                 <h3><font color="white"><b>Loan Amount - OD</b></font></h3>-->
 <!--                 <p>Today</p>-->
 <!--               </div>-->
 <!--             </div> </a>-->
			  
	<!--		  </div>-->



 <!--         <div class="row">-->
 <!--             <div class="col-md-4">-->
 <!--               <div class="x_panel">-->
 <!--                 <div class="x_title">-->
 <!--                   <h2>Top Profiles <small>Sessions</small></h2>-->
 <!--                   <ul class="nav navbar-right panel_toolbox">-->
 <!--                     <li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>-->
 <!--                     </li>-->
 <!--                     <li class="dropdown">-->
 <!--                       <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><i class="fa fa-wrench"></i></a>-->
 <!--                       <ul class="dropdown-menu" role="menu">-->
 <!--                         <li><a href="#">Settings 1</a>-->
 <!--                         </li>-->
 <!--                         <li><a href="#">Settings 2</a>-->
 <!--                         </li>-->
 <!--                       </ul>-->
 <!--                     </li>-->
 <!--                     <li><a class="close-link"><i class="fa fa-close"></i></a>-->
 <!--                     </li>-->
 <!--                   </ul>-->
 <!--                   <div class="clearfix"></div>-->
 <!--                 </div>-->
 <!--                  <ul class="list-unstyled top_profiles scroll-view">-->
 <!--                         <li class="media event">-->
 <!--                           <a class="pull-left border-aero profile_thumb">-->
 <!--                             <i class="fa fa-user aero"></i>-->
 <!--                           </a>-->
 <!--                           <div class="media-body">-->
 <!--                             <a class="title" href="#">Ms. Mary Jane</a>-->
 <!--                             <p><strong>$2300. </strong> Agent Avarage Sales </p>-->
 <!--                             <p> <small>12 Sales Today</small>-->
 <!--                             </p>-->
 <!--                           </div>-->
 <!--                         </li>-->
 <!--                         <li class="media event">-->
 <!--                           <a class="pull-left border-green profile_thumb">-->
 <!--                             <i class="fa fa-user green"></i>-->
 <!--                           </a>-->
 <!--                           <div class="media-body">-->
 <!--                             <a class="title" href="#">Ms. Mary Jane</a>-->
 <!--                             <p><strong>$2300. </strong> Agent Avarage Sales </p>-->
 <!--                             <p> <small>12 Sales Today</small>-->
 <!--                             </p>-->
 <!--                           </div>-->
 <!--                         </li>-->
 <!--                         <li class="media event">-->
 <!--                           <a class="pull-left border-blue profile_thumb">-->
 <!--                             <i class="fa fa-user blue"></i>-->
 <!--                           </a>-->
 <!--                           <div class="media-body">-->
 <!--                             <a class="title" href="#">Ms. Mary Jane</a>-->
 <!--                             <p><strong>$2300. </strong> Agent Avarage Sales </p>-->
 <!--                             <p> <small>12 Sales Today</small>-->
 <!--                             </p>-->
 <!--                           </div>-->
 <!--                         </li>-->
 <!--                         <li class="media event">-->
 <!--                           <a class="pull-left border-aero profile_thumb">-->
 <!--                             <i class="fa fa-user aero"></i>-->
 <!--                           </a>-->
 <!--                           <div class="media-body">-->
 <!--                             <a class="title" href="#">Ms. Mary Jane</a>-->
 <!--                             <p><strong>$2300. </strong> Agent Avarage Sales </p>-->
 <!--                             <p> <small>12 Sales Today</small>-->
 <!--                             </p>-->
 <!--                           </div>-->
 <!--                         </li>-->
 <!--                         <li class="media event">-->
 <!--                           <a class="pull-left border-green profile_thumb">-->
 <!--                             <i class="fa fa-user green"></i>-->
 <!--                           </a>-->
 <!--                           <div class="media-body">-->
 <!--                             <a class="title" href="#">Ms. Mary Jane</a>-->
 <!--                             <p><strong>$2300. </strong> Agent Avarage Sales </p>-->
 <!--                             <p> <small>12 Sales Today</small>-->
 <!--                             </p>-->
 <!--                           </div>-->
 <!--                         </li>-->
 <!--                       </ul>-->
 <!--               </div>-->
 <!--             </div>-->

 <!--             <div class="col-md-4">-->
 <!--               <div class="x_panel">-->
 <!--                 <div class="x_title">-->
 <!--                   <h2>Top Profiles <small>Sessions</small></h2>-->
 <!--                   <ul class="nav navbar-right panel_toolbox">-->
 <!--                     <li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>-->
 <!--                     </li>-->
 <!--                     <li class="dropdown">-->
 <!--                       <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><i class="fa fa-wrench"></i></a>-->
 <!--                       <ul class="dropdown-menu" role="menu">-->
 <!--                         <li><a href="#">Settings 1</a>-->
 <!--                         </li>-->
 <!--                         <li><a href="#">Settings 2</a>-->
 <!--                         </li>-->
 <!--                       </ul>-->
 <!--                     </li>-->
 <!--                     <li><a class="close-link"><i class="fa fa-close"></i></a>-->
 <!--                     </li>-->
 <!--                   </ul>-->
 <!--                   <div class="clearfix"></div>-->
 <!--                 </div>-->
 <!--                 <div class="x_content">-->
 <!--                   <article class="media event">-->
 <!--                     <a class="pull-left date">-->
 <!--                       <p class="month">April</p>-->
 <!--                       <p class="day">23</p>-->
 <!--                     </a>-->
 <!--                     <div class="media-body">-->
 <!--                       <a class="title" href="#">Item One Title</a>-->
 <!--                       <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>-->
 <!--                     </div>-->
 <!--                   </article>-->
 <!--                   <article class="media event">-->
 <!--                     <a class="pull-left date">-->
 <!--                       <p class="month">April</p>-->
 <!--                       <p class="day">23</p>-->
 <!--                     </a>-->
 <!--                     <div class="media-body">-->
 <!--                       <a class="title" href="#">Item Two Title</a>-->
 <!--                       <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>-->
 <!--                     </div>-->
 <!--                   </article>-->
 <!--                   <article class="media event">-->
 <!--                     <a class="pull-left date">-->
 <!--                       <p class="month">April</p>-->
 <!--                       <p class="day">23</p>-->
 <!--                     </a>-->
 <!--                     <div class="media-body">-->
 <!--                       <a class="title" href="#">Item Two Title</a>-->
 <!--                       <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>-->
 <!--                     </div>-->
 <!--                   </article>-->
 <!--                   <article class="media event">-->
 <!--                     <a class="pull-left date">-->
 <!--                       <p class="month">April</p>-->
 <!--                       <p class="day">23</p>-->
 <!--                     </a>-->
 <!--                     <div class="media-body">-->
 <!--                       <a class="title" href="#">Item Two Title</a>-->
 <!--                       <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>-->
 <!--                     </div>-->
 <!--                   </article>-->
 <!--                   <article class="media event">-->
 <!--                     <a class="pull-left date">-->
 <!--                       <p class="month">April</p>-->
 <!--                       <p class="day">23</p>-->
 <!--                     </a>-->
 <!--                     <div class="media-body">-->
 <!--                       <a class="title" href="#">Item Three Title</a>-->
 <!--                       <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>-->
 <!--                     </div>-->
 <!--                   </article>-->
 <!--                 </div>-->
 <!--               </div>-->
 <!--             </div>-->

 <!--             <div class="col-md-4">-->
 <!--               <div class="x_panel">-->
 <!--                 <div class="x_title">-->
 <!--                   <h2>Top Profiles <small>Sessions</small></h2>-->
 <!--                   <ul class="nav navbar-right panel_toolbox">-->
 <!--                     <li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>-->
 <!--                     </li>-->
 <!--                     <li class="dropdown">-->
 <!--                       <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><i class="fa fa-wrench"></i></a>-->
 <!--                       <ul class="dropdown-menu" role="menu">-->
 <!--                         <li><a href="#">Settings 1</a>-->
 <!--                         </li>-->
 <!--                         <li><a href="#">Settings 2</a>-->
 <!--                         </li>-->
 <!--                       </ul>-->
 <!--                     </li>-->
 <!--                     <li><a class="close-link"><i class="fa fa-close"></i></a>-->
 <!--                     </li>-->
 <!--                   </ul>-->
 <!--                   <div class="clearfix"></div>-->
 <!--                 </div>-->
 <!--                 <div class="x_content">-->
 <!--                   <article class="media event">-->
 <!--                     <a class="pull-left date">-->
 <!--                       <p class="month">April</p>-->
 <!--                       <p class="day">23</p>-->
 <!--                     </a>-->
 <!--                     <div class="media-body">-->
 <!--                       <a class="title" href="#">Item One Title</a>-->
 <!--                       <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>-->
 <!--                     </div>-->
 <!--                   </article>-->
 <!--                   <article class="media event">-->
 <!--                     <a class="pull-left date">-->
 <!--                       <p class="month">April</p>-->
 <!--                       <p class="day">23</p>-->
 <!--                     </a>-->
 <!--                     <div class="media-body">-->
 <!--                       <a class="title" href="#">Item Two Title</a>-->
 <!--                       <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>-->
 <!--                     </div>-->
 <!--                   </article>-->
 <!--                   <article class="media event">-->
 <!--                     <a class="pull-left date">-->
 <!--                       <p class="month">April</p>-->
 <!--                       <p class="day">23</p>-->
 <!--                     </a>-->
 <!--                     <div class="media-body">-->
 <!--                       <a class="title" href="#">Item Two Title</a>-->
 <!--                       <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>-->
 <!--                     </div>-->
 <!--                   </article>-->
 <!--                   <article class="media event">-->
 <!--                     <a class="pull-left date">-->
 <!--                       <p class="month">April</p>-->
 <!--                       <p class="day">23</p>-->
 <!--                     </a>-->
 <!--                     <div class="media-body">-->
 <!--                       <a class="title" href="#">Item Two Title</a>-->
 <!--                       <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>-->
 <!--                     </div>-->
 <!--                   </article>-->
 <!--                   <article class="media event">-->
 <!--                     <a class="pull-left date">-->
 <!--                       <p class="month">April</p>-->
 <!--                       <p class="day">23</p>-->
 <!--                     </a>-->
 <!--                     <div class="media-body">-->
 <!--                       <a class="title" href="#">Item Three Title</a>-->
 <!--                       <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>-->
 <!--                     </div>-->
 <!--                   </article>-->
 <!--                 </div>-->
 <!--               </div>-->
 <!--             </div>-->
 <!--           </div>-->
 <!--         </div> -->
 <!---->
		
           

                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
		
            </div>     </div>
                <!-- end of weather widget -->
              </div>
            </div>
          </div>
        </div>
        <!-- /page content -->

        <!-- footer content -->
   
  <script src="vendors/jquery/dist/jquery.min.js"></script>
    <!-- Bootstrap -->
    <script src="vendors/bootstrap/dist/js/bootstrap.min.js"></script>
    <!-- FastClick -->
    <script src="vendors/fastclick/lib/fastclick.js"></script>
    <!-- NProgress -->
    <script src="vendors/nprogress/nprogress.js"></script>
    <!-- Chart.js -->
    <script src="vendors/Chart.js/dist/Chart.min.js"></script>
    <!-- jQuery Sparklines -->
    <script src="vendors/jquery-sparkline/dist/jquery.sparkline.min.js"></script>
    <!-- Flot -->
    <script src="vendors/Flot/jquery.flot.js"></script>
    <script src="vendors/Flot/jquery.flot.pie.js"></script>
    <script src="vendors/Flot/jquery.flot.time.js"></script>
    <script src="vendors/Flot/jquery.flot.stack.js"></script>
    <script src="vendors/Flot/jquery.flot.resize.js"></script>
    <!-- Flot plugins -->
    <script src="vendors/flot.orderbars/js/jquery.flot.orderBars.js"></script>
    <script src="vendors/flot-spline/js/jquery.flot.spline.min.js"></script>
    <script src="vendors/flot.curvedlines/curvedLines.js"></script>
    <!-- DateJS -->
    <script src="vendors/DateJS/build/date.js"></script>
    <!-- bootstrap-daterangepicker -->
    <script src="vendors/moment/min/moment.min.js"></script>
    <script src="vendors/bootstrap-daterangepicker/daterangepicker.js"></script>
    
    <!-- Custom Theme Scripts -->
    <script src="build/js/custom.min.js"></script>
  </body>
</html>
