<?php include "layouts/menu.php"; ?> <div class="right_col" role="main">
            <div class="row">
                 <!-- page header -->
                <div class="col-lg-12">
                    <h1 class="page-header  alert alert-info">Tally Debit</h1>
                </div>
                <!--end page header -->
            </div>
            <div class="row">
                <div class="col-lg-12">
                    <!-- Form Elements -->
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            Details
                        </div>
                        <div class="panel-body">
                            <div class="row">
 <input type="button" value="Print" onclick="PrintElem('#mydiv')"  style="margin:20px;">
  <div class="alert alert-info">Tally For Debit</div>
    <form class="form-horizontal" method="post" action="" enctype="multipart/form-data">
   <div id="mydiv">
    <div class="alert alert-success">
	  <b><p style="color:#1928CF;margin:10px;"><?php
									
									
									echo '<br>';
									echo 'Credit';
									echo '<br>';
									echo '------------------------------------------------------------------------------------------------------------------------------';
									echo '<br>';
                                    $sql = "SELECT SUM(invest) FROM invest where mfin='$mfin'";
                                    $q = mysqli_query($conn, $sql);
                                    $row1 = mysqli_fetch_array($q);
									
                                    echo 'Total Investment: ' . $row1[0];
									echo '<br>';
									echo '<br>';
									$sql = "SELECT SUM(rno) FROM user where mfin='$mfin'";
                                    $qy = mysqli_query($conn, $sql);
                                    $row2 = mysqli_fetch_array($qy);

                                    echo 'interest: ' . $row2[0];	
									
									echo '<br>';
									echo '<br>';
									$sql = "SELECT SUM(amt) FROM net where mfin='$mfin'";
                                    $q = mysqli_query($conn, $sql);
                                    $row21 = mysqli_fetch_array($q);

                                    echo 'Settle interest: ' . $row21[0];echo '<br>';
									echo '<br>';	
									$sql = "SELECT SUM(fin) FROM net where mfin='$mfin'";
                                    $q = mysqli_query($conn, $sql);
                                    $row212 = mysqli_fetch_array($q);

                                    echo 'Settle fine: ' . $row212[0];	
									
									echo '<br>';
									echo '<br>';
									
									$sql = "SELECT SUM(bal) FROM dc where mfin='$mfin'";
                                    $q = mysqli_query($conn, $sql);
                                    $row3 = mysqli_fetch_array($q);

                                    echo 'Total Document Charge Balance: ' . $row3[0];	
									echo '<br>';
									echo '<br>';
									$sql = "SELECT SUM(fine) FROM user where mfin='$mfin'";
                                    $q = mysqli_query($conn, $sql);
                                    $row4 = mysqli_fetch_array($q);

                                    echo 'Fine: ' . $row4[0];	
									echo '<br>';
									echo '<br>';
																		
                					$sql = "SELECT SUM(urname) FROM user2 where mfin='$mfin'";
                                    $q = mysqli_query($conn, $sql);
                                    $row7 = mysqli_fetch_array($q);
													

                                    echo 'Total Monthly Due Interest: ' . $row7[0];	
									echo '<br>';
									echo '<br>';
									$sql = "SELECT SUM(amt) FROM net2 where mfin='$mfin'";
                                    $q = mysqli_query($conn, $sql);
                                    $row71 = mysqli_fetch_array($q);

                                    echo 'Settle Monthly Due Interest: ' . $row71[0];	
									echo '<br>';
									echo '<br>';
									
                					$sql = "SELECT SUM(bal) FROM bank";
                                    $q = mysqli_query($conn, $sql);
                                    $row5 = mysqli_fetch_array($q);

                                    echo 'Total Bank Account Balance: ' . $row5[0];	
									echo '<br>';
									echo '<br>';
									$sql = "SELECT SUM(bal) FROM insur where mfin='$mfin'";
                                    $q = mysqli_query($conn, $sql);
                                    $row511 = mysqli_fetch_array($q);

                                    echo 'Total INSURANCE Income: ' . $row511[0];	
									echo '<br>';
									echo '<br>';
									$sql = "SELECT SUM(urname) FROM user where mfin='$mfin'";
                                    $q = mysqli_query($conn, $sql);
                                    $row666 = mysqli_fetch_array($q);
                                    $row6[0] = $row666[0] -  $row2[0] - $row4[0];
                                    echo 'Total Principal Amount: ' . $row6[0];	
									echo '<br>';
									echo '<br>';
									$sql = "SELECT SUM(tot) FROM net where mfin='$mfin'";
                                    $q = mysqli_query($conn, $sql);
                                    $row519 = mysqli_fetch_array($q);
									$sql = "SELECT SUM(amt) FROM net where mfin='$mfin'";
                                    $q = mysqli_query($conn, $sql);
                                    $row419 = mysqli_fetch_array($q);
									$row59 = $row519[0]-$row419[0] - $row212[0];;
									echo 'Total H.P Received Via Settle: ' . $row59;
									echo '<br>';
									echo '<br>';
										$sql = "SELECT SUM(dueamt) FROM net2 where mfin='$mfin'";
                                    $q = mysqli_query($conn, $sql);
                                    $row144 = mysqli_fetch_array($q);
										$sql = "SELECT SUM(cre) FROM user2 where mfin='$mfin'";
                                    $q = mysqli_query($conn, $sql);
                                    $q = mysqli_query($conn, $sql);
                                    $row778 = mysqli_fetch_array($q);
									$tgbo = $row144[0] + $row778[0];
									echo 'Total Monthly Due H.P Amount Received: ' . $tgbo;
									$credit = $row1[0]+$row2[0]+$row3[0]+$row4[0]+$row5[0]+$row7[0]+$row6[0]+$row21[0]+$row59+$row71[0]+$tgbo+$row212[0]+$row511[0];
									$varr=$row2[0] + $row21[0] + $row212[0] + $row3[0] + $row4[0] + $row7[0] + $row71[0];
									echo  '<br>';
									echo  '<br>';
									echo 'Total Credit Amount=' .$credit;
									echo '<br>';
									echo '------------------------------------------------------------------------------------------------------------------------------';?></p>
									<p style="color:
rgb(20, 167, 20);margin:10px;"><?php
									echo '<br>';
									echo 'Debit';
									echo '<br>';
									echo '------------------------------------------------------------------------------------------------------------------------------';
								
									echo '<br>';
									$sql = "SELECT SUM(debit) FROM debit where mfin='$mfin'";
                                    $q = mysqli_query($conn, $sql);
                                    $row7 = mysqli_fetch_array($q);

                                    echo 'Total Debit: ' . $row7[0];	
									echo '<br>';
									echo '<br>';
									$sql = "SELECT SUM(debit) FROM kai where mfin='$mfin'";
                                    $q = mysqli_query($conn, $sql);
                                    $row75 = mysqli_fetch_array($q);
									$sql = "SELECT SUM(varr) FROM kai where mfin='$mfin'";
                                    $q = mysqli_query($conn, $sql);
                                    $row755 = mysqli_fetch_array($q);
$gh = $row75[0]-$row755[0];
                                    echo 'Total Suspense: ' .$gh ;	
									echo '<br>';
									echo '<br>';
									$sql = "SELECT SUM(debit) FROM salary where mfin='$mfin'";
                                    $q = mysqli_query($conn, $sql);
                                    $row8 = mysqli_fetch_array($q);
									echo 'Total Salary Debit: ' . $row8[0];	
									echo '<br>';
									echo '<br>';
									$sql = "SELECT SUM(hpamount) FROM customerdetails";
                                    $q = mysqli_query($conn, $sql);
                                    $row9 = mysqli_fetch_array($q);
									echo 'Total H.P Amount: ' . $row9[0];	
									echo '<br>';
									echo '<br>';
									
									$sql = "SELECT SUM(hpamount) FROM customer where mfin='$mfin'";
                                    $q = mysqli_query($conn, $sql);
                                    $row14 = mysqli_fetch_array($q);
										$sql = "SELECT SUM(deb) FROM user2 where mfin='$mfin'";
                                    $q = mysqli_query($conn, $sql);
                                    $row977 = mysqli_fetch_array($q);
										$tgb = $row14[0] + $row977[0] ;
									echo 'Total Monthly Due H.P Amount: ' . $tgb;	
					
							
								
									$debit=$row7[0]+$row75[0]+$row8[0]+$row9[0]+$tgb-$row755[0];
									
									echo '<br>';echo '<br>';
									echo 'Total Debit Amount=' .$debit;echo '<br>';
									echo '------------------------------------------------------------------------------------------------------------------------------';
									echo '<br>';
									$bal=$credit-$debit;
									echo 'Balance Amount='.$bal;
									echo '<br>';
									echo '------------------------------------------------------------------------------------------------------------------------------';
									echo '<br>';
									
									echo 'Income = '.$varr;
									echo '<br>';
									echo '------------------------------------------------------------------------------------------------------------------------------';
									echo '<br>';
							?></p></b>
			</form>
			</div>
			</div>
</div>
</div></div>
</div></div></div><?php include "layouts/footer.php"; ?></body></html>
