<?php $url = 'http://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];?>
<div id="tb">
    <div title="Transaction" data-options="closable:false" style="padding:10px">
        <div style="height:50%;padding-bottom:10px">
        <table id="dg_hdr"></table> 
        
        <div id="toolbar_hdr">  
          <!-- Material -->
          <?php if($this->url == site_url('matopn')){ ?>
          <?php if ($this->session->userdata('t12') == 1 && $this->session->userdata('t32') == 1 && $this->session->userdata('t33') == 1 ){ ?>
          <a href="javascript:void(0)" id="btnTbh" class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="addForm()">Add</a>  
          <?php }?>
          <?php if ($this->session->userdata('u12') == 1 && $this->session->userdata('u32') == 1 && $this->session->userdata('u33') == 1 ){ ?>
          <a href="javascript:void(0)" id="btnUbh" class="easyui-linkbutton" iconCls="icon-edit" plain="true" onclick="editForm()">Edit</a> 
          <?php }?>
          <?php if ($this->session->userdata('h12') == 1 && $this->session->userdata('h32') == 1 && $this->session->userdata('h33') == 1 ){ ?>
          <a href="javascript:void(0)" id="btnHps" class="easyui-linkbutton" iconCls="icon-remove" plain="true">Delete</a>  
          <?php }?> 
          <?php } ?>
          <!-- Finished Goods-->
          <?php if($this->url == site_url('fgopn')){ ?>
          <?php if ($this->session->userdata('t12') == 1 && $this->session->userdata('t32') == 1 && $this->session->userdata('t34') == 1 ){ ?>
          <a href="javascript:void(0)" id="btnTbh" class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="addForm()">Add</a>  
          <?php }?>
          <?php if ($this->session->userdata('u12') == 1 && $this->session->userdata('u32') == 1 && $this->session->userdata('u34') == 1 ){ ?>
          <a href="javascript:void(0)" id="btnUbh" class="easyui-linkbutton" iconCls="icon-edit" plain="true" onclick="editForm()">Edit</a> 
          <?php }?>
          <?php if ($this->session->userdata('h12') == 1 && $this->session->userdata('h32') == 1 && $this->session->userdata('h34') == 1 ){ ?>
          <a href="javascript:void(0)" id="btnHps" class="easyui-linkbutton" iconCls="icon-remove" plain="true">Delete</a>  
          <?php }?> 
          <?php } ?>
          <!-- Machine & Equipments-->
          <?php if($this->url == site_url('macopn')){ ?>
          <?php if ($this->session->userdata('t12') == 1 && $this->session->userdata('t32') == 1 && $this->session->userdata('t35') == 1 ){ ?>
          <a href="javascript:void(0)" id="btnTbh" class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="addForm()">Add</a>  
          <?php }?>
          <?php if ($this->session->userdata('u12') == 1 && $this->session->userdata('u32') == 1 && $this->session->userdata('u35') == 1 ){ ?>
          <a href="javascript:void(0)" id="btnUbh" class="easyui-linkbutton" iconCls="icon-edit" plain="true" onclick="editForm()">Edit</a> 
          <?php }?>
          <?php if ($this->session->userdata('h12') == 1 && $this->session->userdata('h32') == 1 && $this->session->userdata('h35') == 1 ){ ?>
          <a href="javascript:void(0)" id="btnHps" class="easyui-linkbutton" iconCls="icon-remove" plain="true">Delete</a>  
          <?php }?> 
          <?php } ?>
          <!-- Scraps-->
          <?php if($this->url == site_url('scopn')){ ?>
          <?php if ($this->session->userdata('t12') == 1 && $this->session->userdata('t32') == 1 && $this->session->userdata('t36') == 1 ){ ?>
          <a href="javascript:void(0)" id="btnTbh" class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="addForm()">Add</a>  
          <?php }?>
          <?php if ($this->session->userdata('u12') == 1 && $this->session->userdata('u32') == 1 && $this->session->userdata('u36') == 1 ){ ?>
          <a href="javascript:void(0)" id="btnUbh" class="easyui-linkbutton" iconCls="icon-edit" plain="true" onclick="editForm()">Edit</a> 
          <?php }?>
          <?php if ($this->session->userdata('h12') == 1 && $this->session->userdata('h32') == 1 && $this->session->userdata('h36') == 1 ){ ?>
          <a href="javascript:void(0)" id="btnHps" class="easyui-linkbutton" iconCls="icon-remove" plain="true">Delete</a>  
          <?php }?>
          <?php } ?>
          <!-- WIP-->
          <?php if($this->url == site_url('wipopn')){ ?>
          <?php if ($this->session->userdata('t12') == 1 && $this->session->userdata('t32') == 1 && $this->session->userdata('t37') == 1 ){ ?>
          <a href="javascript:void(0)" id="btnTbh" class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="addForm()">Add</a>  
          <?php }?>
          <?php if ($this->session->userdata('u12') == 1 && $this->session->userdata('u32') == 1 && $this->session->userdata('u37') == 1 ){ ?>
          <a href="javascript:void(0)" id="btnUbh" class="easyui-linkbutton" iconCls="icon-edit" plain="true" onclick="editForm()">Edit</a> 
          <?php }?>
          <?php if ($this->session->userdata('h12') == 1 && $this->session->userdata('h32') == 1 && $this->session->userdata('h37') == 1 ){ ?>
          <a href="javascript:void(0)" id="btnHps" class="easyui-linkbutton" iconCls="icon-remove" plain="true">Delete</a>  
          <?php }?> 
          <?php } ?>
          <!-- All In -->
          <a href="javascript:void(0)" id="btnPrint" class="easyui-linkbutton" iconCls="icon-print" plain="true" title="Print">Print DO</a>
          <span style="display:inline-block;">
          &nbsp; &nbsp; &nbsp;
          <input id="q">
          </span>
        </div>
        
        <div id="dlg" class="easyui-dialog" style="width:70%;" inline="true" closed="true" buttons="#dlg-buttons">
        <form id="fm"class="form-horizontal" role="form" method="post" style="padding:10px;">
            <input type="submit" id="btnSubmit" name="btnSubmit" style="display:none">
            <input type="hidden" id="opname_id" name="opname_id">
            <div class="form-group">
              <label class="control-label col-md-2">Opname No.</label>
              <div class="col-md-2">
                <input class="form-control easyui-textbox" id="opname_no" name="opname_no" style="width:90%" required>
              </div>
              <label class="control-label col-md-2">Opname Date</label>            
              <div class="col-md-2">          
                <input class="form-control easyui-datebox" id="opname_date" name="opname_date" maxlength="10" style="width:90%" required>
              </div>
              <label class="control-label col-md-1">Opname Type</label>            
              <div class="col-md-2">          
                <input class="form-control easyui-textbox" id="opname_type" name="opname_type" maxlength="10" style="width:90%" required>
              </div>
            </div>
        </form>
        </div>
        <div id="dlg-buttons">
            <a href="#" id="btnSim" class="easyui-linkbutton c6" iconCls="icon-ok">Simpan</a>
            <a href="javascript:void(0)" id="btnReset" class="easyui-linkbutton" iconCls="icon-cancel">Kosongkan</a>
        </div>

        </div>
        <div style="height:50%">
            <table id="dg_det"></table>
            <div id="toolbar_det">  
              <!-- Material -->
              <?php if($this->url == site_url('matopn')){ ?>
              <?php if ($this->session->userdata('t12') == 1 && $this->session->userdata('t32') == 1 && $this->session->userdata('t33') == 1 ){ ?>
              <a href="javascript:void(0)" id="btnTbh2" class="easyui-linkbutton" iconCls="icon-add" plain="true">Add</a>  
              <?php } ?>
              <!-- <?php if ($this->session->userdata('u12') == 1 && $this->session->userdata('u32') == 1 && $this->session->userdata('u33') == 1 ){ ?>
              <a href="javascript:void(0)" id="btnUbh2" class="easyui-linkbutton" iconCls="icon-edit" plain="true">Edit Qty</a> 
              <?php } ?> -->
              <?php if ($this->session->userdata('h12') == 1 && $this->session->userdata('h32') == 1 && $this->session->userdata('h33') == 1 ){ ?>
              <a href="javascript:void(0)" id="btnHps2" class="easyui-linkbutton" iconCls="icon-remove" plain="true">Delete</a>  
              <?php }?>
              <?php }?>
              <!-- Finished Goods -->
              <?php if($this->url == site_url('fgopn')){ ?>
              <?php if ($this->session->userdata('t12') == 1 && $this->session->userdata('t32') == 1 && $this->session->userdata('t34') == 1 ){ ?>
              <a href="javascript:void(0)" id="btnTbh2" class="easyui-linkbutton" iconCls="icon-add" plain="true">Add</a>  
              <?php } ?>
              <!-- <?php if ($this->session->userdata('u12') == 1 && $this->session->userdata('u32') == 1 && $this->session->userdata('u34') == 1 ){ ?>
              <a href="javascript:void(0)" id="btnUbh2" class="easyui-linkbutton" iconCls="icon-edit" plain="true">Edit Qty</a> 
              <?php } ?> -->
              <?php if ($this->session->userdata('h12') == 1 && $this->session->userdata('h32') == 1 && $this->session->userdata('h34') == 1 ){ ?>
              <a href="javascript:void(0)" id="btnHps2" class="easyui-linkbutton" iconCls="icon-remove" plain="true">Delete</a>  
              <?php }?>
              <?php }?>
              <!-- Machine and Equipments -->
              <?php if($this->url == site_url('macopn')){ ?>
              <?php if ($this->session->userdata('t12') == 1 && $this->session->userdata('t32') == 1 && $this->session->userdata('t35') == 1 ){ ?>
              <a href="javascript:void(0)" id="btnTbh2" class="easyui-linkbutton" iconCls="icon-add" plain="true">Add</a>  
              <?php } ?>
              <!-- <?php if ($this->session->userdata('u12') == 1 && $this->session->userdata('u32') == 1 && $this->session->userdata('u35') == 1 ){ ?>
              <a href="javascript:void(0)" id="btnUbh2" class="easyui-linkbutton" iconCls="icon-edit" plain="true">Edit Qty</a> 
              <?php } ?> -->
              <?php if ($this->session->userdata('h12') == 1 && $this->session->userdata('h32') == 1 && $this->session->userdata('h35') == 1 ){ ?>
              <a href="javascript:void(0)" id="btnHps2" class="easyui-linkbutton" iconCls="icon-remove" plain="true">Delete</a>  
              <?php }?>
              <?php }?>
              <!-- Scrap -->
              <?php if($this->url == site_url('scopn')){ ?>
              <?php if ($this->session->userdata('t12') == 1 && $this->session->userdata('t32') == 1 && $this->session->userdata('t36') == 1 ){ ?>
              <a href="javascript:void(0)" id="btnTbh2" class="easyui-linkbutton" iconCls="icon-add" plain="true">Add</a>  
              <?php } ?>
              <!-- <?php if ($this->session->userdata('u12') == 1 && $this->session->userdata('u32') == 1 && $this->session->userdata('u36') == 1 ){ ?>
              <a href="javascript:void(0)" id="btnUbh2" class="easyui-linkbutton" iconCls="icon-edit" plain="true">Edit Qty</a> 
              <?php } ?> -->
              <?php if ($this->session->userdata('h12') == 1 && $this->session->userdata('h32') == 1 && $this->session->userdata('h36') == 1 ){ ?>
              <a href="javascript:void(0)" id="btnHps2" class="easyui-linkbutton" iconCls="icon-remove" plain="true">Delete</a>  
              <?php }?>
              <?php }?>
              <!-- WIP -->
              <?php if($this->url == site_url('wipopn')){ ?>
              <?php if ($this->session->userdata('t12') == 1 && $this->session->userdata('t32') == 1 && $this->session->userdata('t37') == 1 ){ ?>
              <a href="javascript:void(0)" id="btnTbh2" class="easyui-linkbutton" iconCls="icon-add" plain="true">Add</a>  
              <?php } ?>
              <!-- <?php if ($this->session->userdata('u12') == 1 && $this->session->userdata('u32') == 1 && $this->session->userdata('u37') == 1 ){ ?>
              <a href="javascript:void(0)" id="btnUbh2" class="easyui-linkbutton" iconCls="icon-edit" plain="true">Edit Qty</a> 
              <?php } ?> -->
              <?php if ($this->session->userdata('h12') == 1 && $this->session->userdata('h32') == 1 && $this->session->userdata('h37') == 1 ){ ?>
              <a href="javascript:void(0)" id="btnHps2" class="easyui-linkbutton" iconCls="icon-remove" plain="true">Delete</a>  
              <?php }?>
              <?php }?>
              <span style="display:inline-block;">
              &nbsp; &nbsp; &nbsp;
              <input id="q_det">
              </span>
            </div>
            <div id="dlg2" class="easyui-dialog" style="width:40%;" closed="true" buttons="#dlg2-buttons">
            <form id="fm2"class="form-horizontal" role="form" method="post" style="padding:10px;">
                <input type="submit" id="btnSubmit2" name="btnSubmit2" style="display:none">
                <input type="hidden" id="child_no" name="child_no">
                <div class="form-group">
                    <label class="control-label col-md-3">Item Code</label>
                  <div class="col-md-2">
                    <!-- <input class="form-control" id="mat_id" name="mat_id" style="width:90%" required> -->
                    <?php if($this->url == site_url('matopn')){ ?>
                    <td colspan="3"><input class="form-control" id="mat_idms" name="mat_id" style="width:100%" required></td>
                    <?php } else { ?>
                    <td colspan="3"><input class="form-control" id="mat_id" name="mat_id" style="width:100%" required></td>
                    <?php }  ?>
                  </div>
                </div>
                <div class="form-group">
                    <label class="control-label col-md-3">Item Description</label>
                  <div class="col-md-9">
                    <input class="form-control easyui-textbox" id="NmBarang" name="NmBarang" style="width:100%" readonly>
                  </div>
                </div>
                <div class="form-group">
                    <label class="control-label col-md-3">UOM</label>
                  <div class="col-md-2">
                    <input class="form-control" id="Sat" name="Sat" style="width:90%" readonly>
                  </div>
                </div>
                <div class="form-group">
                    <label class="control-label col-md-3">Qty.</label>
                  <div class="col-md-3">
                    <input class="form-control" id="qty" name="qty" style="width:100%">
                  </div>
                </div>                
                <div class="form-group">
                    <label class="control-label col-md-3">Adjust In.</label>
                  <div class="col-md-3">
                    <input class="form-control" id="qty_in" name="qty_in" style="width:100%">
                  </div>
                </div>                
                <div class="form-group">
                    <label class="control-label col-md-3">Adjust Out.</label>
                  <div class="col-md-3">
                    <input class="form-control" id="qty_out" name="qty_out" style="width:100%">
                  </div>
                </div>                
            </form>
            </div>
            <div id="dlg2-buttons">
                <a href="#" id="btnSim2" class="easyui-linkbutton c6" iconCls="icon-ok">Simpan</a>
                <a href="javascript:void(0)" id="btnReset2" class="easyui-linkbutton" iconCls="icon-cancel">Kosongkan</a>
            </div>
        </div>
    </div>
    <div title="List View" data-options="closable:false" style="padding:10px">
        <table id="dg_hdrdet"></table>
        <div id="toolbar_hdrdet">  
            <a href="javascript:void(0)" id="btnPrint2" class="easyui-linkbutton" iconCls="icon-print" plain="true" title="Print">Print</a> 
            <a href="javascript:void(0)" id="btnExcel" class="easyui-linkbutton" iconCls="icon-xls" plain="true" title="Excel">Excel</a>
            <span style="display:inline-block;">
            &nbsp; &nbsp; &nbsp;
            <input id="q2">
            </span>
        </div> 
    </div>    
</div>