<?php 
include 'dheader.php'; 
?>
	<div class="modal fade hidden-print" id="myModal" tabindex="-1" role="dialog" aria-hidden="true"></div>
	<div class="wrapper ">
		<?php include 'leftbar.php'; ?>
		<!-- left-bar -->
		<?php include 'topbar.php'; ?>
			<!-- top-bar -->
			<div class="main-content">

<form action="" method="get">
<div class="manage_buttons">
	<div class="row">
		<div class="col-md-3">
			<div class="input-group input-daterange" id="reportrange">
				
                <span class="input-group-addon bg">
                  From					                       	</span>
                <input type="text" class="form-control start_date datepicker" value="<?php echo $_GET['sdate']; ?>" name="sdate" id="sdate">
            </div>
		</div>
		<div class="col-md-3">
			<div class="input-group input-daterange" id="reportrange1">
                <span class="input-group-addon bg">
                    To			                                </span>
                <input type="text" class="form-control end_date datepicker" value="<?php echo $_GET['edate']; ?>" name="edate" id="edate">
            </div>	
		</div>
		<div class="col-md-2">
			<div class="input-group input-daterange" id="reportrange1">
		<button type="submit" title="Submit" class="btn btn-success">Submit</button>
			</div>
		</div>	
	</div>
</div>

</form>
	<div class="container-fluid">
		<div class="row manage-table">
			<div class="panel panel-piluku">
				<div class="panel-heading">
				<h3 class="panel-title">
					Customer Ledger		
					<span class="panel-options custom">
											</span>
				</h3>
			</div>
				<div class="panel-body nopadding table_holder table-responsive" >
					<table class="tablesorter table  table-hover" id="sortable_table">
						<thead>
							<tr>
								<th>Date</th>
								<th>Ref#</th>
								<th>Vou</th>
								<th>Particulars</th>
								<th>Debit</th>
								<th>Credit</th>
								<th>Balance</th>
								<th>Action</th>
							</tr>
						</thead>
						<tbody>
						<?php 
						if (isset($_GET['sdate'])) {
						?>
						<?php
							// Start date
							$date = "2020/10/31";
							
			                // End date
							$sedate = $_GET['sdate'];
							$secus_date = explode('/', $sedate);
							$seget_sdate = $secus_date[2].'/'.$secus_date[0].'/'.$secus_date[1];
			                $end_date = date ("Y/m/d", strtotime("-2 day", strtotime($seget_sdate)));
							
							//$endDate = strtotime($_GET['sdate'] . "-1 day");
							//$endDate = strftime("%Y/%m/%d",$endDate);
							//$amount = 0;
							//$remaining = 0;
							$preBal = 0;
							while (strtotime($date) <= strtotime($end_date)) {
							// "$date\n";
							$date = date ("Y/m/d", strtotime("+1 day", strtotime($date)));

							$sql = "SELECT DISTINCT invoiceNo FROM customerinvoice ";
							$sql .= "WHERE php_date = '".$date."' AND payment_type != 'Opening Balance' AND payment_type = 'Cash' AND sale_type IN ('Sale', 'Return') ";
							$sql .= "ORDER BY date, id";
							
							$run = $db->query($sql);
							while($row = $run->fetchArray()){
								$rem = "SELECT * FROM customerinvoice ";
								$rem .= "WHERE invoiceNo = '".$row['invoiceNo']."' ";
								$rem_run = $db->query($rem);
								$rem_row = $rem_run->fetchArray();

								if ($rem_row['sale_type'] == 'Sale') {
									$preBal += $rem_row['grand_total'];
								}elseif ($rem_row['sale_type'] == 'Return') {
									$preBal -= $rem_row['grand_total'];
								}
								
						}

						$sqlpr = "SELECT DISTINCT invoiceNo FROM purchases ";
						$sqlpr .= "WHERE php_date = '".$date."' AND payment_type != 'Opening Balance' AND payment_type = 'Cash' AND sale_type IN ('Purchase', 'PReturn') ";
						$sqlpr .= "ORDER BY date, id";
						
						$runpr = $db->query($sqlpr);
						while($row = $runpr->fetchArray()){
							$rempr = "SELECT * FROM purchases ";
							$rempr .= "WHERE invoiceNo = '".$row['invoiceNo']."' ";
							$rem_runpr = $db->query($rempr);
							$rem_rowpr = $rem_runpr->fetchArray();

							if ($rem_rowpr['sale_type'] == 'Purchase') {
								$preBal -= $rem_rowpr['grand_total'];
							}elseif ($rem_rowpr['sale_type'] == 'PReturn') {
								$preBal += $rem_rowpr['grand_total'];
							}
								
						}

				            $sql2 = "SELECT * FROM payments ";
				            $sql2 .= "WHERE action = '1' AND type = '1' ";
				            $sql2 .= "AND php_date = '".$date."' ";
				            $sql2 .= "ORDER BY php_date, id";
				            $run2 = $db->query($sql2);
				            while($row2 = $run2->fetchArray()){
				            	if ($row2['debcre'] == 1) {
									$preBal += $row2['amount'];
								}elseif ($row2['debcre'] == 2) {
									$preBal -= $row2['amount'];
								}
							}

				            $sql2 = "SELECT * FROM payments2 ";
				            $sql2 .= "WHERE action = '1' AND type = '1' ";
				            $sql2 .= "AND php_date = '".$date."' ";
				            $sql2 .= "ORDER BY php_date, id";
				            $run2 = $db->query($sql2);
				            while($row2 = $run2->fetchArray()){
				            	if ($row2['debcre'] == 1) {
									$preBal -= $row2['amount'];
								}elseif ($row2['debcre'] == 2) {
									$preBal += $row2['amount'];
								}
							
				           }   

							$sql2 = "SELECT * FROM expenses ";
				            $sql2 .= "WHERE php_date = '".$date."' AND type = 1 ";
				            $sql2 .= "ORDER BY php_date, id";
				            $run2 = $db->query($sql2);
				            while($row2 = $run2->fetchArray()){
				            	$preBal -= $row2['payment'];
				            	$preBal += $row2['receive'];
				            }

				           
				            $sql2 = "SELECT * FROM other_accounts ";
				            $sql2 .= "WHERE php_date = '".$date."' AND type = 1 ";
				            $sql2 .= "ORDER BY php_date, id";
				            $run2 = $db->query($sql2);
				            while($row2 = $run2->fetchArray()){
				            	if ($row2['receive'] > 0) {
				            		$preBal += $row2['receive'];
				            	}else{
				            		$preBal -= $row2['payment'];
				            	}
							}

							$sql2 = "SELECT * FROM bank_accounts ";
				            $sql2 .= "WHERE php_date = '".$date."' AND type = 1 ";
				            $sql2 .= "ORDER BY php_date, id";
				            $run2 = $db->query($sql2);
				            while($row2 = $run2->fetchArray()){
				            	if ($row2['receive'] > 0) {
				            		$preBal -= $row2['receive'];
				            	}else{
				            		$preBal += $row2['payment'];
				            	}
							}


						} // End of Opening
							//$preBal = $remaining - $amount;
						?>
		                <tr>
		                	<td>&nbsp;</td>
		                    <td>&nbsp;</td>
		                    <td>&nbsp;</td>
		                    <td>BALANCE B/F</td>
		                    <td>0</td>
		                    <td>0</td>
		                    <td><?php echo $preBal;?></td>
		                </tr>
						<?php
							// Start date
							$sdate = $_GET['sdate'];
							$scus_date = explode('/', $sdate);
							$get_sdate = $scus_date[2].'/'.$scus_date[0].'/'.$scus_date[1];
							$get_sdate = date ("Y/m/d", strtotime("-1 day", strtotime($get_sdate)));
			                
			                // End date
			             	$edate = $_GET['edate'];
							$ecus_date = explode('/', $edate);
							$get_edate = $ecus_date[2].'/'.$ecus_date[0].'/'.$ecus_date[1];
			                
			                while (strtotime($get_sdate) <= strtotime($get_edate)) {
							"$get_sdate\n";
			                $get_sdate = date ("Y/m/d", strtotime("+1 day", strtotime($get_sdate)));

			 				$sql = "SELECT DISTINCT invoiceNo FROM customerinvoice ";
							$sql .= "WHERE php_date = '".$get_sdate."' AND payment_type != 'Opening Balance' AND payment_type = 'Cash' AND sale_type IN ('Sale', 'Return') ";
							$sql .= "ORDER BY date, id";
							
							$run = $db->query($sql);
							while($row = $run->fetchArray()){
								$rem = "SELECT * FROM customerinvoice ";
								$rem .= "WHERE invoiceNo = '".$row['invoiceNo']."' ";
								$rem_run = $db->query($rem);
								$rem_row = $rem_run->fetchArray();

								if ($rem_row['sale_type'] == 'Sale') {
									$preBal += $rem_row['grand_total'];
								}elseif ($rem_row['sale_type'] == 'Return') {
									$preBal -= $rem_row['grand_total'];
								}
								
						?>	
		            	<tr>
		                	<td><?php echo $rem_row['show_date']; ?></td>
		                	<td><?php echo ($rem_row['invoiceNo']) ? $rem_row['invoiceNo'] : '-'; ?></td>
		                    <td><?php echo ($rem_row['sale_type']) ? $rem_row['sale_type'] : 'Opening Balance'; ?></td>
		                    <?php
		                    	if ($rem_row['sale_type'] == 'Sale') {
		                    ?>
		                    	<td><?php echo ($rem_row['description']) ? $rem_row['description'] : '-'; ?></td>
			                    <td><?php echo $rem_row['grand_total']; ?></td>
			                    <td>0</td>
		                    <?php }elseif ($rem_row['sale_type'] == 'Return') { ?>
		                    	<td><?php echo ($rem_row['description']) ? $rem_row['description'] : '-'; ?></td>
		                    	<td>0</td>
			                    <td><?php echo $rem_row['grand_total']; ?></td>
			                <?php } ?>

		                    <td><?php echo $preBal; ?></td>
		                    <td><?php if($rem_row['sale_type'] == 'Sale') { ?>
		                    <a href="sales.php?invoice=<?php echo $row['invoiceNo']; ?>" class="  update-person" title="Update" <?php echo (@$_SESSION['customeredit'] == '') ? 'style="display:none;"': ''; ?>>Edit</a>
		                    <?php } ?>
		                    <?php if($rem_row['sale_type'] == 'Purchase') { ?>
		                    <a href="purchase.php?invoice=<?php echo $row['invoiceNo']; ?>" class="  update-person" title="Update" <?php echo (@$_SESSION['customeredit'] == '') ? 'style="display:none;"': ''; ?>>Edit</a>
		                    <?php } ?>
		                    </td>
		                </tr>    
						<?php } ?>
						<?php
						$sqlpr = "SELECT DISTINCT invoiceNo FROM purchases ";
							$sqlpr .= "WHERE php_date = '".$get_sdate."' AND payment_type != 'Opening Balance' AND payment_type = 'Cash' AND sale_type IN ('Purchase', 'PReturn') ";
							$sqlpr .= "ORDER BY date, id";
							
							$runpr = $db->query($sqlpr);
							while($rowpr = $runpr->fetchArray()){
								$rempr = "SELECT * FROM purchases ";
								$rempr .= "WHERE invoiceNo = '".$rowpr['invoiceNo']."' ";
								$rem_runpr = $db->query($rempr);
								$rem_rowpr = $rem_runpr->fetchArray();

								if ($rem_rowpr['sale_type'] == 'Purchase') {
									$preBal -= $rem_rowpr['grand_total'];
								}elseif ($rem_rowpr['sale_type'] == 'PReturn') {
									$preBal += $rem_rowpr['grand_total'];
								}
								
						?>	
		            	<tr>
		                	<td><?php echo $rem_rowpr['show_date']; ?></td>
		                	<td><?php echo ($rem_rowpr['invoiceNo']) ? $rem_rowpr['invoiceNo'] : '-'; ?></td>
		                    <td><?php echo ($rem_rowpr['sale_type']) ? $rem_rowpr['sale_type'] : 'Opening Balance'; ?></td>
		                    <?php
		                    	if ($rem_rowpr['sale_type'] == 'Purchase') { ?>
		                    	<td><?php echo ($rem_rowpr['description']) ? $rem_rowpr['description'] : '-'; ?></td>
		                    	<td>0</td>
			                    <td><?php echo $rem_rowpr['grand_total']; ?></td>
							<?php }elseif ($rem_rowpr['sale_type'] == 'PReturn') { ?>
		                    	<td><?php echo ($rem_rowpr['description']) ? $rem_rowpr['description'] : '-'; ?></td>
			                    <td><?php echo $rem_rowpr['grand_total']; ?></td>
			                    <td>0</td>
			                <?php } ?>

		                    <td><?php echo $preBal; ?></td>
		                    <td><?php if($rem_rowpr['sale_type'] == 'Sale') { ?>
		                    <a href="sales.php?invoice=<?php echo $row['invoiceNo']; ?>" class="  update-person" title="Update" <?php echo (@$_SESSION['customeredit'] == '') ? 'style="display:none;"': ''; ?>>Edit</a>
		                    <?php } ?>
		                    <?php if($rem_rowpr['sale_type'] == 'Purchase') { ?>
		                    <a href="purchase.php?invoice=<?php echo $row['invoiceNo']; ?>" class="  update-person" title="Update" <?php echo (@$_SESSION['customeredit'] == '') ? 'style="display:none;"': ''; ?>>Edit</a>
		                    <?php } ?>
		                    </td>
		                </tr>    
						<?php } ?>
						
						<?php
				            $sql2 = "SELECT * FROM payments ";
				            $sql2 .= "WHERE action = '1' ";
				            $sql2 .= "AND php_date = '".$get_sdate."' ";
				            $sql2 .= "ORDER BY php_date, id";
				            $run2 = $db->query($sql2);
				            while($row2 = $run2->fetchArray()){
				            	if ($row2['debcre'] == 1) {
									$preBal += $row2['amount'];
								}elseif ($row2['debcre'] == 2) {
									$preBal -= $row2['amount'];
								}
							?>	
								<tr>
									<td><?php echo $row2['show_date']; ?></td>
									<td><?php echo $row2['id']; ?></td>
									<td><?php echo 'Cash Received'; ?></td>	
				                    <td><?php echo $row2['description']; ?></td>
				                <?php 
				                    if ($row2['debcre'] == 1) {
				                ?>  
				                	<td><?php echo $row2['amount']; ?></td>	
				                    <td>0</td> 
				                <?php 
				                	}elseif ($row2['debcre'] == 2) {   
				                ?>
				                    <td>0</td>
				                    <td><?php echo $row2['amount']; ?></td>
				                <?php } ?>     
				                	<td><?php echo $preBal; ?></td>
				                </tr>
				            <?php  } ?>

				            <?php
				            $sql2 = "SELECT * FROM payments ";
				            $sql2 .= "WHERE type = '2' ";
				            $sql2 .= "AND php_date = '".$get_sdate."' ";
				            $sql2 .= "ORDER BY php_date, id";
				            $run2 = $db->query($sql2);
				            while($row2 = $run2->fetchArray()){
				            	if ($row2['debcre'] == 1) {
									$preBal -= $row2['amount'];
								}elseif ($row2['debcre'] == 2) {
									$preBal += $row2['amount'];
								}
							?>	
								<tr>
									<td><?php echo $row2['show_date']; ?></td>
									<td><?php echo $row2['id']; ?></td>
									<td><?php echo $row2['bank']; ?></td>	
				                    <td><?php echo $row2['description']; ?></td>
				                <?php 
				                    if ($row2['debcre'] == 1) {
				                ?>  
				                	 <td>0</td>
				                    <td><?php echo $row2['amount']; ?></td>
				                <?php 
				                	}elseif ($row2['debcre'] == 2) {   
				                ?>
				                   
				                    <td><?php echo $row2['amount']; ?></td>	
				                    <td>0</td> 
				                <?php } ?>     
				                	<td><?php echo $preBal; ?></td>
				                </tr>
				            <?php  } ?>

				        <?php
				            $sql2 = "SELECT * FROM payments2 ";
				            $sql2 .= "WHERE action = '1'  ";
				            $sql2 .= "AND php_date = '".$get_sdate."' ";
				            $sql2 .= "ORDER BY php_date, id";
				            $run2 = $db->query($sql2);
				            while($row2 = $run2->fetchArray()){
				            	if ($row2['debcre'] == 1) {
									$preBal -= $row2['amount'];
								}elseif ($row2['debcre'] == 2) {
									$preBal += $row2['amount'];
								}
							?>	
								<tr>
									<td><?php echo $row2['show_date']; ?></td>
									<td><?php echo $row2['id']; ?></td>
									<td><?php echo 'Cash Paid'; ?></td>	
				                    <td><?php echo $row2['description']; ?></td>
				                <?php 
				                    if ($row2['debcre'] == 1) {
				                ?>  
				                	<td>0</td>
				                    <td><?php echo $row2['amount']; ?></td>
				                <?php 
				                	}elseif ($row2['debcre'] == 2) {   
				                ?>
				                    <td><?php echo $row2['amount']; ?></td>	
				                    <td>0</td> 
				                <?php } ?>     
				                	<td><?php echo $preBal; ?></td>
				                </tr>
				            <?php  } ?>

				            <?php
				            $sql2 = "SELECT * FROM payments2 ";
				            $sql2 .= "WHERE type = '2' ";
				            $sql2 .= "AND php_date = '".$get_sdate."' ";
				            $sql2 .= "ORDER BY php_date, id";
				            $run2 = $db->query($sql2);
				            while($row2 = $run2->fetchArray()){
				            	if ($row2['debcre'] == 1) {
									$preBal += $row2['amount'];
								}elseif ($row2['debcre'] == 2) {
									$preBal -= $row2['amount'];
								}
							?>	
								<tr>
									<td><?php echo $row2['show_date']; ?></td>
									<td><?php echo $row2['id']; ?></td>
									<td><?php echo $row2['bank']; ?></td>	
				                    <td><?php echo $row2['description']; ?></td>
				                <?php 
				                    if ($row2['debcre'] == 1) {
				                ?>  
				                	<td><?php echo $row2['amount']; ?></td>	
				                    <td>0</td> 
				                	
				                <?php 
				                	}elseif ($row2['debcre'] == 2) {   
				                ?>
				                  	<td>0</td>
				                    <td><?php echo $row2['amount']; ?></td>  
				                <?php } ?>     
				                	<td><?php echo $preBal; ?></td>
				                </tr>
				            <?php  } ?>

				           <?php
				            $sql2 = "SELECT * FROM expenses ";
				            $sql2 .= "WHERE php_date = '".$get_sdate."' AND (type = 1 OR type = '') ";
				            $sql2 .= "ORDER BY php_date, id";
				            $run2 = $db->query($sql2);
				            while($row2 = $run2->fetchArray()){
				            	$preBal -= $row2['payment'];
				            	$preBal += $row2['receive'];
							?>	
								<tr>
									<td><?php echo $row2['show_date']; ?></td>
									<td><?php echo $row2['id']; ?></td>
									<td><?php echo 'Expense'; ?></td>	
				                    <td><?php echo $row2['description']; ?></td>
				                	<td><?php echo ($row2['receive']) ? $row2['receive'] : 0; ?></td>
				                    <td><?php echo ($row2['payment']) ? $row2['payment'] : 0; ?></td>
				                
				                	<td><?php echo $preBal; ?></td>
				                	<td><a href="editexpense.php?edit=<?php echo $row2['id']; ?>" class="  update-person" title="Update" <?php echo (@$_SESSION['customeredit'] == '') ? 'style="display:none;"': ''; ?>>Edit</a></td>
				                </tr>
				            <?php  } ?>

				           
				            <?php
				            $sql2 = "SELECT * FROM expenses ";
				            $sql2 .= "WHERE php_date = '".$get_sdate."' AND type = 2 ";
				            $sql2 .= "ORDER BY php_date, id";
				            $run2 = $db->query($sql2);
				            while($row2 = $run2->fetchArray()){
							?>
								<tr>
									<td><?php echo $row2['show_date']; ?></td>
									<td><?php echo $row2['id']; ?></td>
									<td><?php echo 'Expense'; ?></td>	
				                    <td><?php echo $row2['description']; ?></td>
				                	<td><?php echo ($row2['receive']) ? $row2['receive'] : 0; ?></td>
				                    <td><?php echo ($row2['payment']) ? $row2['payment'] : 0; ?></td>
				                
				                	<td><?php echo $preBal; ?></td>
				                	<td><a href="editexpense.php?edit=<?php echo $row2['id']; ?>" class="  update-person" title="Update" <?php echo (@$_SESSION['customeredit'] == '') ? 'style="display:none;"': ''; ?>>Edit</a></td>
				                </tr>  
				            <?php  } ?>

				         <?php
				            $sql2 = "SELECT * FROM other_accounts ";
				            $sql2 .= "WHERE php_date = '".$get_sdate."' AND type = 1 ";
				            $sql2 .= "ORDER BY php_date, id";
				            $run2 = $db->query($sql2);
				            while($row2 = $run2->fetchArray()){
				            	if ($row2['receive'] > 0) {
				            		$preBal += $row2['receive'];
				            	}else{
				            		$preBal -= $row2['payment'];
				            	}
							?>	
								<tr>
									<td><?php echo $row2['show_date']; ?></td>
									<td><?php echo $row2['id']; ?></td>
									<td><?php echo 'Other Account'; ?></td>	
				                    <td><?php echo $row2['description']; ?></td>
				                	<td><?php echo $row2['receive']; ?></td>
				                    <td><?php echo $row2['payment']; ?></td>
				                	<td><?php echo $preBal; ?></td>
				                	<td><a href="editotheraccount.php?edit=<?php echo $row2['id'] ?>" class="  update-person" title="Update" <?php echo (@$_SESSION['customeredit'] == '') ? 'style="display:none;"': ''; ?>>Edit</a></td>
				                </tr>
				            <?php  } ?>
				            <?php
				            $sql2 = "SELECT * FROM other_accounts ";
				            $sql2 .= "WHERE php_date = '".$get_sdate."' AND type = 2 ";
				            $sql2 .= "ORDER BY php_date, id";
				            $run2 = $db->query($sql2);
				            while($row2 = $run2->fetchArray()){
							?>	
								<tr>
									<td><?php echo $row2['show_date']; ?></td>
									<td><?php echo $row2['id']; ?></td>
									<td><?php echo 'Other Account'; ?></td>	
				                    <td><?php echo $row2['description']; ?></td>
				                    <td><?php echo $row2['payment']; ?></td>
				                	<td><?php echo $row2['receive']; ?></td>
				                	<td><?php echo $preBal; ?></td>
				                	<td><a href="editotheraccount.php?edit=<?php echo $row2['id'] ?>" class="  update-person" title="Update" <?php echo (@$_SESSION['customeredit'] == '') ? 'style="display:none;"': ''; ?>>Edit</a></td>
				                </tr>
				            <?php  } ?>

				            <?php
				            $sql2 = "SELECT * FROM bank_accounts ";
				            $sql2 .= "WHERE php_date = '".$get_sdate."' AND type = 1 ";
				            $sql2 .= "ORDER BY php_date, id";
				            $run2 = $db->query($sql2);
				            while($row2 = $run2->fetchArray()){
				            	if ($row2['receive'] > 0) {
				            		$preBal -= $row2['receive'];
				            	}else{
				            		$preBal += $row2['payment'];
				            	}
							?>	
								<tr>
									<td><?php echo $row2['show_date']; ?></td>
									<td><?php echo $row2['id']; ?></td>
									<td><?php echo 'Bank Sheet'; ?></td>	
				                    <td><?php echo $row2['description']; ?></td>
				                    <td><?php echo $row2['payment']; ?></td>
				                	<td><?php echo $row2['receive']; ?></td>
				                    
				                
				                	<td><?php echo $preBal; ?></td>
				                	<td><a href="editbanksheet.php?edit=<?php echo $row2['id'] ?>" class="  update-person" title="Update" <?php echo (@$_SESSION['customeredit'] == '') ? 'style="display:none;"': ''; ?>>Edit</a></td>
				                </tr>
				            <?php  } ?>


				            <?php
				            $sql2 = "SELECT * FROM bank_accounts ";
				            $sql2 .= "WHERE php_date = '".$get_sdate."' AND type = 2 ";
				            $sql2 .= "ORDER BY php_date, id";
				            $run2 = $db->query($sql2);
				            while($row2 = $run2->fetchArray()){
				            	if ($row2['receive'] > 0) {
				            		$preBal += $row2['receive'];
				            	}else{
				            		$preBal -= $row2['payment'];
				            	}
							?>	
								<tr>
									<td><?php echo $row2['show_date']; ?></td>
									<td><?php echo $row2['id']; ?></td>
									<td><?php echo 'Bank Sheet'; ?></td>	
				                    <td><?php echo $row2['description']; ?></td>
				                    
				                	<td><?php echo $row2['receive']; ?></td>
				                	<td><?php echo $row2['payment']; ?></td>
				                    
				                
				                	<td><?php echo $preBal; ?></td>
				                	<td><a href="editbanksheet.php?edit=<?php echo $row2['id'] ?>" class="  update-person" title="Update" <?php echo (@$_SESSION['customeredit'] == '') ? 'style="display:none;"': ''; ?>>Edit</a></td>
				                </tr>
				            <?php  } ?>

				        


				            

						<?php 
							 } // While Date ?>		
						<?php } // Date Set ?>		
							</tbody>
						</table>			
				</div>	
		</div>	
				</div>
	</div>
</div>

			
<?php include 'dfooter.php'; ?>