<?php
session_start();
include './connection_sql.php';
if ($_SESSION["CURRENT_USER"] == "") { 
    exit('Please Logging Again..');
} 
if ($_SESSION['company'] == "") { 
    exit('Please Logging Again..');
} 
?>
<style> 
    .linehover:hover {background-color: aqua;}
</style>
<section class="content">
    <div class="box box-primary">

        <div class="box-header with-border">
            <h3 class="box-title">Bank Reconciliation</h3>
        </div>

        <form role="form" name ="form1" class="form-horizontal">
            <div class="box-body">

                <div class="row">
                    <div class="col-md-6">
                        <div class="form-group">
                            <a onclick="location.reload();" class="btn btn-default btn-sm">
                                <span class="fa fa-user-plus"></span> &nbsp; New
                            </a>
        
                            <a onclick="save_customer();" class="btn btn-success btn-sm">
                                <span class="fa fa-save"></span> &nbsp; Save
                            </a>
                            <a onclick="display();" class="btn btn-primary btn-sm">
                                <span class="fa fa-save"></span> &nbsp; Display
                            </a>
        
                            <a  onclick="print_recon();" class="btn btn-default btn-sm">
                                <span class="fa fa-print"></span> &nbsp; Print
                            </a> 
                             <a  onclick="print_un_rp();" class="btn btn-default btn-sm">
                                <span class="fa fa-print"></span> &nbsp; UnR&amp;P
                            </a> 
                             <a  onclick="update_customer();" class="btn btn-danger btn-sm">
                                <span class="fa fa-print"></span> &nbsp; Lock
                            </a> 
                    </div>
                </div>
                    <div class="col-md-5" id='lastlockmonth' style="color: red;  font-size: 26px;font-weight:bold"></div>
                        
                
                </div>
                
                 
                <input type="hidden"  id="tmpno" >
                <div id="msg_box"  class="span12 text-center"  >

                </div>



                <div class="form-group">
                        
                    <label class="col-sm-2 control-label" for="dtfrom">Reconciliation Date</label>                    
                    <div class="col-sm-2">
                        <input type="date" placeholder=""  onchange="lastmonthcal();"  id="dtpDate" value="<?php echo date('Y-m-d'); ?>" class="form-control    input-sm">
                    </div>
                    <label class="col-sm-2 control-label" for="bank">Account</label>
                    <div class="col-sm-4">
                        <select id="Com_CAS" onchange="lastmonthcal();" onclick="lastmonthcal();" class="form-control">
                            <option selected value=''>-</option>    
                            <?php
                           $sql = "select * from a_lcodes where ( CAT='B') AND COMPANY='".$_SESSION['company']."' ORDER BY C_CODE";
                            foreach ($conn->query($sql) as $row) {
                                echo "<option value='" . $row["C_CODE"] . "'>" . $row["C_CODE"] . " - " . $row["C_NAME"] . "</option>";
                            }
                            ?>

                        </select>
                    </div>
                    
                   
                </div>

                <div class="form-group">
                    <label class="col-sm-2 control-label" for="lastdt">Last Rec. Date</label>
                    <div class="col-sm-2">
                        <input type="date" placeholder="" id="dtfrom" value="<?php echo date('Y-m-d'); ?>" class="form-control    input-sm">
                    </div>
                     <label class="col-sm-2 control-label" for="bank">Balance as per Bank Statement</label>
                     <div class="col-sm-4">
                         <input type="number" placeholder="" id="txtBankClosBal"  class="form-control input-sm">
                     </div>
                </div>
 

                <div class="#">
                    <ul class="nav nav-tabs">
                        <li class="active"><a data-toggle="tab" href="#debit">DEPOSIT</a></li>
                        <li><a data-toggle="tab" href="#credit">PAYMENTS</a></li>

                    </ul>

                    <div class="tab-content">
                        <div id="debit" class="tab-pane fade in active">
                            <input type="hidden" value="0"  id="count" > 

                            <div id="flexDeb" >

                            </div>

                        </div>


                        <div id="credit" class="tab-pane fade">
                            <input type="hidden" value="0"  id="count1" >    




                            <div id="flexCre" >

                            </div>

                        </div>

                    </div>
                    
                    
                    <div class='row'>
                            <table class='table table-bordered' style="width:50%">
                                <tr>
                                    <th >#</th>
                                    <th >According to Ledger</th>
                                    <th >According to Last Rec</th>
                                </tr>
                                <tr>
                                    <th class="col-sm-2"><label  for="bank">Opening Bank Balance (Last Month End Balance)</label></th>
                                    <th><input type="text" placeholder="" id="txt_bankbal2" disabled  class="form-control    input-sm"></th>
                                    <th><input type="text" placeholder="" id="txt_bankbal" disabled  class="form-control    input-sm"></th> 
                                </tr>
                                <tr>
                                    <th class="col-sm-2"><label  for="bank">ADD- Total Amount Of Bank Deposit</label></th>
                                    <th><input type="text" placeholder="" id="txtbankdepo2" disabled  class="form-control    input-sm"></th>
                                    <th><input type="text" placeholder="" id="txtbankdepo" disabled  class="form-control    input-sm"></th> 
                                </tr>
                                <tr>
                                    <th class="col-sm-2"><label  for="bank">LESS- Total Amount Of Bank Payment</label></th>
                                    <th><input type="text" placeholder="" id="txtbankpay2" disabled  class="form-control    input-sm"></th>
                                    <th><input type="text" placeholder="" id="txtbankpay" disabled  class="form-control    input-sm"></th> 
                                </tr>
                                <tr>
                                    <th class="col-sm-2"><label  for="bank">Closing Balance As At </label></th>
                                    <th><input type="text" placeholder="" id="txtclosebal2" disabled  class="form-control    input-sm"></th>
                                    <th><input type="text" placeholder="" id="txtclosebal" disabled  class="form-control    input-sm"></th> 
                                </tr>
                                
                                <tr>
                                    <th class="col-sm-2"><label  for="bank">Actual Balancet </label></th>
                                    <th><input type="text" placeholder="" id="txtFinalBal" disabled  class="form-control    input-sm"></th>
                                </tr>
                                <tr>
                                    <th class="col-sm-2"><label  for="bank">Balance As Per Cash Book </label></th>
                                    <th><input type="text" placeholder="" id="txttot" disabled  class="form-control    input-sm"></th>
                                </tr>
                            </table>
                    </div>

 


                </div>

            </div>       
        </form>
    </div>    

</section>
<script src="js/bank_rec.js?V1">

</script>
<script>
    new_inv();
</script>
<?php
include 'login.php';
include './cancell.php';
?>
    