<?php
session_start();
include './connection_sql.php';
if ($_SESSION["CURRENT_USER"] == "") { 
    exit('Please Logging Again..');
} 
if ($_SESSION['company'] == "") { 
    exit('Please Logging Again..');
} 
?>
<!-- Main content -->
<section class="content">

    <div class="box box-primary">
        <div class="box-header with-border">
            <h3 class="box-title">Bank Deposit</h3>
        </div>
        <form role="form" name="form1" class="form-horizontal">

            <div class="box-body">

                <div class="form-group">
                    <a onclick="sess_chk('new', 'rec');" class="btn btn-default btn-sm">
                        <span class="fa fa-user-plus"></span> &nbsp; New
                    </a>

                    <a onclick="sess_chk('save', 'rec');" class="btn btn-success btn-sm">
                        <span class="fa fa-save"></span> &nbsp; Save
                    </a>

                    

                    <a onclick="sess_chk('cancel', 'rec');" class="btn btn-danger btn-sm">
                        <span class="fa fa-trash-o"></span> &nbsp; Cancel
                    </a>

                </div>

                <input type="hidden"  id="tmpno" >
                <div id="msg_box" class="span12 text-center"  ></div>

                <div class="form-group">

                    <label class="col-sm-1 control-label" for="carrier_code">Entry No</label>
                    <div class="col-sm-2">
                        <input type="text" placeholder="Entry No" disabled id="txt_entno" class="form-control input-sm">
                    </div>
                    <div class="col-sm-1">
                        <a onfocus="this.blur()" onclick="NewWindow('serach_bdep.php', 'mywin', '800', '700', 'yes', 'center');
                                return false" href="">
                            <input type="button" class="btn btn-default btn-sm" value="..." id="searchcust" name="searchcust">
                        </a>
                    </div>


                    <label class="col-sm-1 control-label" for="entrydate">Date</label>
                    <div class="col-sm-2">
                        <input type="date" placeholder="Date" onchange="getno1();" id="invdate" value="<?php echo date('Y-m-d'); ?>" class="form-control    input-sm">
                    </div>

                    <label class="col-sm-1 control-label" for="contact">Currency</label>
                    <div class="col-sm-1">
                        <select id="currency"  onchange='loadcur();' 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="" id="txt_rate" value="1"  class="form-control  input-sm">
                    </div>

                </div>
                <input type="hidden" placeholder="Heading" id="txt_heading" class="form-control input-sm">


                <div class="form-group">
                    <label class="col-sm-1 control-label">Naration</label>
                    <div class="col-sm-5">
                        <textarea class="form-control  input-sm"  rows="2" id="txt_narration" placeholder="Naration"></textarea>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-1 control-label" for="bank">Account</label>
                    <div class="col-sm-5">
                        <select id="bank" class="form-control input-sm">

                            <?php
                            $sql = "select * from a_lcodes where cat = 'B'  "; 
                            foreach ($conn->query($sql) as $row) {
                                echo "<option value='" . $row["C_CODE"] . "'>" . $row["C_NAME"] . "</option>";
                            }
                            ?>

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





                <table class="table table-striped">

                    <tr class="success">
                        <th colspan="5">Credit</th>
                    </tr>
                    <tr>
                        <th style="width: 120px;">Code</th>
                        <th>Description</th>
                        <th style="width: 10px;"></th>
                        <th style="width: 120px;">Amount</th>
                        <th style="width: 10px;"></th>
                    </tr>

                    <tr>

                        <td>
                            <input type="text" placeholder="Code"  id="txt_gl_code" class="form-control  input-sm">
                        </td>
                        <td>
                            <input type="text" placeholder="Description" disabled id="txt_gl_name" class="form-control  input-sm">
                        </td>
                        <td>
                            <a  href="search_ledg.php"  id="cmd_glcode"  onClick="NewWindow(this.href, 'mywin', '800', '700', 'yes', 'center');
                                    return false" class="btn btn-default btn-sm"> <span class="fa fa-circle-o"></span> &nbsp; </a>
                        </td>
                        <td>
                            <input type="number" placeholder="Amount" id="itemPrice" class="form-control  input-sm">
                        </td>
                        <td><a onclick="add_tmp();" class="btn btn-default btn-sm"> <span class="fa fa-plus"></span> &nbsp; </a></td>
                    </tr>
                </table>

                <div id="itemdetails" >

                </div>
                <table class="table">
                    <tr>
                        <td></td>
                        <td></td>
                         <td></td>
                        <th>Total</th>
                        <td style="width: 180px;"><input type="text" placeholder="Total" id="subtot" disabled class="form-control  input-sm"></td>
                        <td></td>
                    </tr>
                </table>





                <table class="table table-striped">

                    <tr class="info">
                        <th colspan="8">Cheques</th>
                    </tr>
                    <tr>
                        <th style="width: 120px;">Cheque No</th>
                        <th style="width: 120px;">Cheque Date</th>
                        <th style="width: 120px;">Naration</th>
                        <th style="width: 120px;">Bank</th>
                        <th style="width: 10px;"></th>
                        <th style="width: 120px;">Amount</th>
                        <th style="width: 10px;"></th>
                        <th style="width: 10px;"></th>
                    </tr>

                    <tr>

                        <td>
                            <input type="amount" placeholder="Cheque No"   id="chqno" class="form-control  input-sm">
                        </td>
                        <td>
                            <input type="text" placeholder="Date"  id="chqdate" class="form-control  input-sm">
                        </td>          
                         <td>
                            <input type="text" placeholder="Naration" disabled id="narration" class="form-control  input-sm">
                        </td>
                        <td>
                            <input type="text" placeholder="Bank" disabled id="bankc" class="form-control  input-sm">
                        </td>
                        <td>
                            <a href="search_chq_acc.php?stname=bankdepo" onclick="NewWindow(this.href, 'mywin', '800', '700', 'yes', 'center');return false" class="btn btn-default btn-sm"  onfocus="this.blur()">
                                <span class="fa fa-circle-o"></span> &nbsp; 
                            </a>
                        </td>
                        <td>
                            <input type="amount" placeholder="Amount" id="chqamt"  class="form-control  input-sm">
                        </td>
                        <input type="hidden" placeholder="id" id="id" class="form-control  input-sm">

                        <td><a onclick="setcheq();" class="btn btn-default btn-sm"> <span class="fa fa-plus"></span> &nbsp; </a></td>
                    </tr>
                </table>

                <div id="itemdetails1" >

                </div>
                <table class="table">
                    <tr>
                        <td></td>
                         <td></td>
                        <td></td>
                        <th>Total</th>
                        <td style="width: 180px;"><input type="text" placeholder="Total" id="subtot1" disabled class="form-control  input-sm"></td>
                        <td></td>
                    </tr>
                </table>



                <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>  
        </form>
    </div>

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

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