<!-- Main content -->
<section class="content">
    <div class="box box-primary">
        <div class="box-header with-border">
            <h3 class="box-title">DAG GIN TRANSFER</h3>
            <h4 style="float: right;height: 3px;"><b id="time"></b></h4>
        </div>
        <form role="form" class="form-horizontal">
            <div class="box-body">
                <div class="form-group">
                    <a onclick="new_inv();" class="btn btn-default">
                        <span class="fa fa-user-plus"></span> &nbsp; New
                    </a>
                    <a onclick="save_inv();" class="btn btn-success">
                        <span class="fa fa-save"></span> &nbsp; Save
                    </a> 
                    <a onclick="print_inv();" class="btn btn-default">
                        <span class="fa fa-print"></span> &nbsp; Print
                    </a>
                    <a onclick="NewWindow('dag_gin_transfer_search.php', 'mywin', '800', '700', 'yes', 'center');" class="btn btn-info  ">
                        <span class="glyphicon glyphicon-search"></span> &nbsp; FIND
                    </a>
                    <a onclick="cancel_inv();" class="btn btn-danger">
                        <span class="fa fa-trash"></span> &nbsp; Cancel
                    </a>

                </div>

                <input type="hidden" id="uniq" class="form-control">

                <div id="msg_box"  class="span12 text-center"  >  </div>

            </div>

<div id="msg_box"  class="span12 text-center"  ></div>

            <input type="hidden"  disabled id="tmpno" class="form-control">
            <input type="hidden" id="item_count" class="form-control">

            <div class="form-group">
                <label class="col-sm-1 control-label" for="firstname_hidden">Ref No</label>
                <div class="col-sm-2">
                    <input type="text" placeholder="Ref No"  disabled="" id="invno" class="form-control">
                </div> 
                <label class="col-sm-1 control-label" for="firstname_hidden">Date</label>
                <div class="col-sm-2">
                    <input type="date" placeholder="Ref No"    id="sdate" class="form-control">
                </div> 

            </div>

            <div class="form-group">
                <label for="firstname_hidden" class="col-sm-1 control-label">To Department</label>
                <div class="col-sm-2">
                    <select id="to_dep"   class="form-control col-sm-1" >

                        <?php
                        $sql = "select * from s_stomas where act='1' order by CODE";
                        $result = mysqli_query($GLOBALS['dbinv'], $sql);
                        while ($row = mysqli_fetch_array($result)) {
                                //echo "<option value='" . $row["barnd_name"] . "'>" . $row["barnd_name"] . "</option>";
                            if ($row["CODE"] == "01") {
                                echo "<option selected value='" . $row["CODE"] . "'>" . $row["DESCRIPTION"] . "</option>";
                            } else {
                                echo "<option value='" . $row["CODE"] . "'>" . $row["DESCRIPTION"] . "</option>";
                            }
                        }
                        ?>
                    </select>
                </div> 
                <div class="col-sm-5"></div>
                <div class="col-sm-1">
<label hidden>Above 90 Days Qty</label>
                </div>
                <div id="unsold" class="col-sm-1">

                </div>
            </div>
            
            <div class="col-sm-12">
                <table class="table">
                    <tr>
                        <th style="width: 13%;">From Department</th>
                        <th style="width: 13%;">Job No</th>
                        <th style="width: 6%;"></th>
                        <th style="width: 13%;">Serial No</th>
                        <th style="width: 13%;">Make</th>
                        <th style="width: 13%;">Size</th>
                        <th style="width: 13%;">Casing Cost</th>
                        <th style="width: 10%;">Quantity</th>
                        <th style="width: 6%;"></th>
                    </tr>

                    <tr>
                        <td>
                            <select id="from_dep" onblur="itno_ind();" class="form-control col-sm-1" >

                                <?php
                                 if ($_SESSION["CURRENT_DEP"] != "") {
                                   $sql="select * from s_stomas where  act='1' and CODE='".$_SESSION["CURRENT_DEP"] ."' order by CODE";
                                }else{
                                  $sql="select * from s_stomas where  act='1'  order by CODE";
                                } 
         
                                $result = mysqli_query($GLOBALS['dbinv'], $sql);
                                while ($row = mysqli_fetch_array($result)) {
                                        //echo "<option value='" . $row["barnd_name"] . "'>" . $row["barnd_name"] . "</option>";
                                    if ($row["CODE"] == "01") {
                                        echo "<option selected value='" . $row["CODE"] . "'><strong>" . $row["DESCRIPTION"] . "<strong></option>";
                                    } else {
                                        echo "<option value='" . $row["CODE"] . "'>" . $row["DESCRIPTION"] . "</option>";
                                    }
                                }
                                ?>
                            </select>

                        </td>
                        <td>
                            <input type="text"  onkeypress="keyset('qty', event);" onblur="itno_ind();" disabled    placeholder="Job No" id="jobno" class="form-control">
                            <input type="text"  onkeypress="keyset('qty', event);" onblur="itno_ind();" disabled    placeholder="Item Code" id="itemCode" class="form-control hidden" >
                        </td>
                        <td><a align="center" onclick="search_item();" onfocus="this.blur()" class="btn btn-info">
                        <span class="fa fa-search"></span> &nbsp;  
                    </a> 
                </td>
                <td>
                    <input type="text" placeholder="Serial No" id="serialno" disabled class="form-control">
                </td>
                <td>
                    <input type="text" onkeypress="keyset('add_tmp_it', event);" placeholder="Make" id="make" class="form-control" disabled>
                </td>
                <td>
                    <input type="text" onkeypress="keyset('add_tmp_it', event);" placeholder="Size" id="size" class="form-control" disabled>
                </td>
                <td>
                    <input type="number" onkeypress="keyset('add_tmp_it', event);" placeholder="Casing Cost" id="rate" class="form-control" >
                </td>
                <td>
                    <input type="number"  placeholder="Quantity" id="qty" class="form-control" disabled>
                </td>
                <td>
                    <a onclick="add_tmp();" id="add_tmp_it" value= "+"  class="btn btn-success">
                        <span class="fa fa-plus"></span>&nbsp;    
                    </a>
                    
                    <!--<b><input type="button"  onclick="add_tmp();" id="add_tmp_it" value= "+"  class="btn btn-default" ></input></b>-->

                </td>
                <td><input id="itemPrice" type= "hidden">

                </td>
            </tr>

        </table>
        <div class="span6 pull-right">
            <div id="submas">

            </div>
        </div>
        <div id="itemdetails" class="col-sm-12" >

        </div>
    </div>


<div class="form-group"></div>
<div class="form-group"></div>

<table class="table">
        <tr>
             <div class="form-group">
                 
                <div class="col-sm-8"></div>
                <label for="firstname_hidden" class="col-sm-1 control-label">Total Amount</label>
                <div class="col-sm-2">
                    <input type="text"   name="totamount" id="totamount" disabled=""  class="form-control"> 
                </div>
            </div>
        </tr>


    <tr>
      <div class="form-group" hidden>
          <label for="firstname_hidden" class="col-sm-1 control-label">Available Qty</label>
                <div class="col-sm-2">
                    <input type="text" disabled="" style="color: red" name='qtyinhand'  id="qtyinhand" class="form-control">
                </div>
        <label for="firstname_hidden" class="col-sm-1 control-label">ARN No</label>
        <div class="col-sm-2">
            <input type="text"   name="txtarno" id="txtarno" disabled=""  class="form-control"> 
        </div> 
        <div class="col-sm-1">
            <a align="center" onclick="NewWindow('../serach_arn.php?mstatus=gin', 'mywin', '800', '700', 'yes', 'center');
            return false" onfocus="this.blur()" class="btn btn-primary">
            <span class="fa fa-search"></span> &nbsp;  
            </a>
        </div> 
        <div class="col-sm-1">
           <a onclick="update();"class="btn btn-success">
                <span class="fa fa-edit"></span> &nbsp; Update ARN
            </a>
        </div>
</div>
</tr>

</table>  




<div class="form-group" hidden>
   <label for="firstname_hidden" class="col-sm-1 control-label">ARN Date</label>
   <div class="col-sm-2">
     <input type="text" disabled class="form-control" name="DTARdate" id="DTARdate"/>
 </div> 

</div> 

</div>

</form>
</div>

</section>

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

<script src="js/dag_gin_transfer.js"></script>
<script>new_inv();</script>