<?php include "layouts/menu.php"; ?>
   <style>
   .button1 {
    box-shadow: 0 8px 16px 0 rgba(0,0,0,0.2), 0 6px 20px 0 rgba(0,0,0,0.19);
}

.button2:hover {
    box-shadow: 0 12px 12px 0 rgba(0,0,0,0.24),0 17px 40px 0 rgba(0,0,0,0.19);
}


.coloramt{
    color:white;
}

.coloramt:hover{
    color:green;
}
   </style>
    <?php
                    	$qry=mysqli_query($conn, "select * from moncust where mfin='$mfin' && status='Active'");
						$n=mysqli_num_rows($qry);
						
					
						
					
						
					
						
						$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 monnet where mfin='$mfin'");
						$nq=mysqli_num_rows($qry3);
						
					
						
					
						$moqry3=mysqli_query($conn, "select * from monmonnet where mfin='$mfin'");
						$monq=mysqli_num_rows($moqry3);
						
						$qry3343=mysqli_query($conn, "select * from monmonnet where mfin='$mfin'");
						$nq343=mysqli_num_rows($qry3343);
						
						$fqry3343=mysqli_query($conn, "select * from finmonnet where mfin='$mfin'");
						$fnq343=mysqli_num_rows($fqry3343);
						$ff = $n - $nq;
						
						$qry4=mysqli_query($conn, "select * from monnet2 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),
	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" => "monnet 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>
        <div class="right_col" role="main">
          <!-- top tiles -->
         
		  <?php 
			  $sqll = mysqli_query($conn, "select * from abc where mfin='$mfin'");
	$rowww = mysqli_fetch_array($sqll);
// 	$fdate = "1890-04-31";
										$fdate =  $rowww['date1']; 
										$tdate = $rowww['date2'];  

											$fdate =  $rowww['date1']; 
										$tdate = $rowww['date2'];
   $qryfffr=mysqli_query($conn, "select * from moncust where mfin='$mfin' && status='Active'");
						$n700=mysqli_num_rows($qryfffr);
						
						   $qryfffr=mysqli_query($conn, "select sum(total) from moncust where mfin='$mfin' && status='Active' && hpdate!='$tdate'");
						$row44=mysqli_fetch_array($qryfffr);
						$amtt1 = $row44[0];
						
							   $qryfffr=mysqli_query($conn, "select sum(urname) from monuser where mfin='$mfin'");
						$row44=mysqli_fetch_array($qryfffr);
						$amtt12 = $row44[0];
						
							   $qryfffr=mysqli_query($conn, "select sum(tot) from monnet where mfin='$mfin'");
						$row44=mysqli_fetch_array($qryfffr);
						$amtt13 = $row44[0];
						$amtt = $amtt12 + $amtt13;
						
						  $qryfffr3=mysqli_query($conn, "select sum(urname) from monuser where mfin='$mfin'  && paydate='$tdate'");
						$row443=mysqli_fetch_array($qryfffr3);
						$amtt123 = $row443[0];
						
							   $qryfffr3=mysqli_query($conn, "select sum(tot) from monnet where mfin='$mfin'  && paydate='$tdate'");
						$row443=mysqli_fetch_array($qryfffr3);
						$amtt133 = $row443[0];
						$amtt3 = $amtt123 + $amtt133;
						
						
						
						
		$qry707=mysqli_query($conn, "select * from memo where edate='$tdate'");
						$n707=mysqli_num_rows($qry707);					
	$qry=mysqli_query($conn, "select * from monuser where mfin='$mfin' && paydate='$tdate'");
						$n=mysqli_num_rows($qry);
						$qryr=mysqli_query($conn, "select * from monuser where mfin='$mfin' && status='Reloan' && paydate='$tdate'");
						$nr=mysqli_num_rows($qryr);

                        	
					
					
					    
						
						 $qryfffr1=mysqli_query($conn, "select sum(hpamount) from moncust where mfin='$mfin'");
						 $row441=mysqli_fetch_array($qryfffr1);
					 	 $lntt1 = $row441[0];
						
						$qryfffr33=mysqli_query($conn, "select sum(pass) from monuser where mfin='$mfin'");
						$row4433=mysqli_fetch_array($qryfffr33);
						$amtt1233 = $row4433[0];
						
						$qryfffr34=mysqli_query($conn, "select sum(dueamt) from monnet where mfin='$mfin'");
						$row4434=mysqli_fetch_array($qryfffr34);
						$amtt1334 = $row4434[0];
				
					
					
						$adss = $lntt1 - $amtt1233 - $amtt1334;
						
						
						
						
						
						
					//	$ff = $n - $nq;
						$qry4=mysqli_query($conn, "select * from monnet2 where mfin='$mfin'&& bmnt='$tdate'");
						$nw=mysqli_num_rows($qry4);
						$qry41=mysqli_query($conn, "select * from sizzing where mfin='$mfin'&& sizdate='$tdate'");
						$nww=mysqli_num_rows($qry41);
						$ii = date("d");
						
						$qry412=mysqli_query($conn, "SELECT * FROM moncust where mfin='$mfin' && dd=$ii && status='Active' order by id desc");
						$tdue=mysqli_num_rows($qry412);
						
				        $qry412=mysqli_query($conn, "SELECT * FROM pending where mfin='$mfin' && penamt>0");
						$f3=mysqli_num_rows($qry412);
						
						$qry400=mysqli_query($conn, "select sum(penamt) from pending where mfin='$mfin'");
						$row400=mysqli_fetch_array($qry400);
						$f31 = $row400[0];
						
						$qry4000=mysqli_query($conn, "select sum(tot) from monnet where mfin='$mfin'&& paydate='$tdate'");
						$row4000=mysqli_fetch_array($qry4000);
						$f2 = $row4000[0];
						//$f3 = $f1 + $f2;
						
						
						
					
						  ?>
						  
				 <div class="row top_tiles">
                 <div class="">
            <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: #626567 " class="tile-stats">
                  <div class="icon"><i class="fa fa-check-square-o" ></i></div>
                  <div class="count coloramt"><?php echo $n343; ?> </div>
                  <h3><font color="white"><b>Total Loans</b></font></h3>
                  <p>Total</p>
                </div>
              </div></a>
              <?php
               $tdate = date("Y-m-d");
              $qryfffr33t=mysqli_query($conn, "select sum(urname) from monuser where mfin='$mfin' && paydate2='$tdate'");
						$row4433t=mysqli_fetch_array($qryfffr33t);
						$amtt1233t = $row4433t[0];
						
						$qryfffr34t=mysqli_query($conn, "select sum(tot) from monnet where mfin='$mfin' && paydate2='$tdate'");
						$row4434t=mysqli_fetch_array($qryfffr34t);
						$amtt1334t = $row4434t[0];
						
						$trec = $amtt1233t + $amtt1334t;
						
						
						
						$qry3=mysqli_query($conn, "select * from monuser where mfin='$mfin' && paydate2='$tdate'");
						$nq=mysqli_num_rows($qry3);
						
						$qry3w=mysqli_query($conn, "select * from monnet where mfin='$mfin' && paydate2='$tdate'");
						$nqw=mysqli_num_rows($qry3w);
						
					    
						
						
						
						?>
                         <a href="monbillrep.php">   <div class="animated flipInY col-lg-3 col-md-3 col-sm-6 col-xs-12">
                <div style="background: #626567" class="tile-stats">
                  <div class="icon"><i class="fa fa-close"></i></div>
                  <div class="count coloramt"><font color="white"><?php echo $nq; ?></div>
                  <h3><font color="white"><b>Total Recpts</b></font></h3>
                  <p>Today</p>
                </div>
              </div></a>
               <?php 
              $qry15=mysqli_query($conn, "select sum(totalhpamt) from moncust where mfin='$mfin'");
              $row15 = mysqli_fetch_array($qry15);
              $tothpamt = $row15[0];
               ?>
               
               <a href="allcusca.php">    <div class="animated flipInY col-lg-3 col-md-3 col-sm-6 col-xs-12">
                <div style="background: #626567" class="tile-stats">
                  <div class="icon"><i class="fa fa-motorcycle"></i></div>
                  <div class="count coloramt"><font color="white"><?php echo $tothpamt; ?></div>
                  <h3><font color="white"><b>Total Loan Amount</b></font></h3>
                  <p>Total</p>
                </div>
              </div></a>
                 <a href="hpbalp.php">     <div class="animated flipInY col-lg-3 col-md-3 col-sm-6 col-xs-12">
                <div style="background: #626567" class="tile-stats">
                  <div class="icon"><i class="fa fa-hand-o-left "></"></i></div>
                  <div class="count coloramt"><font color="white"><?php echo $adss; ?></div>
                  <h3><font color="white"><b>Principal Balance</b></font></h3>
                  <p>Total</p>
                </div>
              </div></a>
              
                        <a href="monbillrep.php">    <div class="animated flipInY col-lg-3 col-md-3 col-sm-6 col-xs-12">
                <div style="background:#626567" class="tile-stats">
                  <div class="icon"><i class="fa fa-motorcycle"></i></div>
                  <div class="count coloramt"><font color="white"><?php echo $trec; ?></div>
                  <h3><font color="white"><b> Amount Recvd</b></font></h3>
                  <p>Today</p>
                </div>
              </div></a>
                       <a href="lviewc.php">     <div class="animated flipInY col-lg-3 col-md-3 col-sm-6 col-xs-12">
                <div style="background: #626567" class="tile-stats">
                  <div class="icon"><i class="fa fa-hand-o-left "></"></i></div>
                  <div class="count coloramt"><font color="white"><?php echo $nqw; ?> </div>
                  <h3><font color="white"><b>Closed Loans</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:#626567" class="tile-stats">
                  <div class="icon"><i class="fa fa-university"></i></div>
                  <div class="count coloramt"><font color="white"><?php echo $amtt; ?></div>
                  <h3><font color="white"><b>Total Collection</b></font></h3>
                  <p>Total</p>
                </div>
              </div> </a>
              <a href="dpending.php">    <div class="animated flipInY col-lg-3 col-md-3 col-sm-3 col-xs-3">
                <div style="background: #626567;" class="tile-stats">
                  <div class="icon"><i class="fa fa-inr"></i></div>
                  <div class="count coloramt"><font color="white"> <?php
                  	$ii = date("d");
						
						$qry412=mysqli_query($conn, "SELECT * FROM moncust where mfin='$mfin' && dd=$ii && status='Active' order by id desc");
						$tdue=mysqli_num_rows($qry412);
                  echo $tdue; ?></div>
                  <h3><font color="white"><b>Today Dues</b></font></h3>
                  <p>Current</p>
                </div>
              </div> </a>
</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>
