<?php
session_start();
include './connection_sql.php';
if ($_SESSION["CURRENT_USER"] == "") { 
    exit('Please Logging Again..');
} 
if ($_SESSION['company'] == "") { 
    exit('Please Logging Again..');
} 
?>
<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="form-group">
                    <a onclick="sess_chk('new', 'crn');" class="btn btn-default btn-sm">
                        <span class="fa fa-user-plus"></span> &nbsp; New
                    </a>

                    <a onclick="sess_chk('save', 'crn');" 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="sess_chk('print', 'crn');" class="btn btn-default btn-sm">
                        <span class="fa fa-print"></span> &nbsp; Print
                    </a> 
 

                </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">Date</label>                    
                    <div class="col-sm-2">
                        <input type="date" placeholder=""  onchange="getrecdt();"  id="dtto" value="<?php echo date('Y-m-d'); ?>" class="form-control    input-sm">
                    </div>

                    <label class="col-sm-2 control-label" for="currency1">Currency</label>
                    <div class="col-sm-1">
                        <select id="currency1"    onchange='loadcur1();' class="form-control input-sm">
                            <option value='LKR'>LKR</option>
                            <?php
                            $sql = "select * from a_mastercurrancy where currancy <> 'LKR'";
                            foreach ($conn->query($sql) as $row) {
                                echo "<option value='" . $row["currancy"] . "'>" . $row["currancy"] . "</option>";
                            }
                            ?>
                        </select>

                    </div>
                    <div class="col-sm-1">
                        <input type="number" placeholder="Rate" id="txt_rate1" value='1' disabled="disabled" class="form-control input-sm">
                    </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="lastdt" value="<?php echo date('Y-m-d'); ?>" class="form-control    input-sm">
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-2 control-label" for="bank">Account</label>
                    <div class="col-sm-5">
                        <select id="bank" onchange="getrecdt();" onclick="getrecdt();" class="form-control">
                            <option selected value=''>-</option>    
                            <?php
                            $sql = "select * from a_lcodes where ( CAT='B') 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>
                     <label class="col-sm-2 control-label" for="bank">Closing Balance</label>
                     <div class="col-sm-2">
                     <input type="number" placeholder="" id="bank_bal"  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="itemdetails" >

                            </div>

                        </div>


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




                            <div id="itemdetails1" >

                            </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="number" placeholder="" id="txt_bankbal2" disabled  class="form-control    input-sm"></th>
                                    <th><input type="number" 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="number" placeholder="" id="txtbankdepo2" disabled  class="form-control    input-sm"></th>
                                    <th><input type="number" 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="number" placeholder="" id="txtbankpay2" disabled  class="form-control    input-sm"></th>
                                    <th><input type="number" 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="number" placeholder="" id="txtclosebal2" disabled  class="form-control    input-sm"></th>
                                    <th><input type="number" 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="number" 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="number" placeholder="" id="txttot" disabled  class="form-control    input-sm"></th>
                                </tr>
                            </table>
                    </div>


                    <div class="form-group"  style="visibility: hidden" id="filup">
                        <label class="col-sm-1 control-label" for="file-3">File Box</label>
                        <label class="btn btn-default" for="file-3">
                            <input id="file-3" name="file-3" multiple="true" type="file" >
                            Select Files

                        </label>
                        <a  class="btn btn-primary" onclick="uploadfile('crn');" class="btn"/>Upload</a>
                    </div>




                    <div id="filebox" >

                    </div>


                </div>

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

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

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