<div class="col-xs-12">
<div class="box">
<div class="box-header">
<h3 class="box-title">Tambah Purchase Requisition (PR)</h3>
</div><!-- /.box-header -->
<div class="box-body">
<?php
$attributes = array('class'=>'form-horizontal','role'=>'form');
echo form_open_multipart('administrator/pr_user',$attributes);
?>
<table class='table table-condensed table-bordered'>
<tbody>
<tr>
<th scope='row'>Kategori</th>
<td>
<select class='form-control' name='kategori_pr' placeholder="Cari Kategori">
<option selected disabled value="">Cari Kategori</option>
<option value='Projek'>Projek</option>
<option value='Non Projek'>Non Projek</option>
</select>
</td>
</tr>
<tr>
<th scope='row'>Tipe Purchase</th>
<td>
<select class='form-control' name='type_pr' placeholder="Cari Tipe">
<option selected disabled value="">Cari Tipe</option>
<option value='Boms'>Boms</option>
<option value='Non Boms'>Non Boms</option>
</select>
</td>
</tr>
<tr>
<tr><th width='140px' scope='row'>No Vip</th> <td><input type='text' class='form-control' value='<?php echo "$no_projek"; ?>' name='no_projek'>
</td></tr>
<tr>
<th scope='row'>Lokasi</th>
<td>
<select class='form-control' name='lokasi_projek' placeholder="Cari Lokasi">
<option selected disabled value="">Cari Lokasi</option>
<option value='Office'>Office</option>
<option value='Workshop'>Workshop</option>
<option value='Insitu'>Insitu</option>
<option value='Workshop'>Workshop</option>
</select>
</td>
</tr>
<tr>
<th scope='row'>Status</th>
<td>
<select class='form-control' name='status_pr' placeholder="Pilih Status">
<option selected disabled value="">Pilih Status</option>
<option value='Boms'>Boms</option>
<option value='Non Boms'>Non Boms</option>
</select>
</td>
</tr>
<tr>
<tr><th width='140px' scope='row'>Tanggal Dibutuhkan</th> <td><input type='date' class='form-control' value='<?php echo "$tgl_kebutuhan"; ?>' name='tgl_kebutuhan'>
</td></tr>
</tbody>
</table>
<input class='btn btn-primary btn-sm' type="submit" name='submit' value='Simpan Data'>
<?php if ($this->session->kode_pr !=''){ ?>
<a class='btn btn-default btn-sm' href='<?php echo base_url(); ?>administrator/pembelian'>Selesai / Kembali</a>
<hr>
<table id="example2" class="table table-bordered table-striped">
<thead>
<tr>
<th style='width:40px'>No</th>
<th>Description Material</th>
<th>Dimension</th>
<th>Jumlah</th>
<th>Satuan</th>
<th>Action</th>
</tr>
</thead>
<?php
echo "<tr>
<td></td>
<input type='hidden' value='".$this->uri->segment(3)."' name='idpd'>
<td><input class='form-control' type='text' name='deskripsi_item' value='$row[deskripsi_item]' id='deskripsi_item'> </td>
<td><input class='form-control' type='text' name='dimension_item' value='$row[dimension_item]' id='dimension_item'> </td>
<td><input class='form-control' type='number' name='jumlah_item' value='$row[jumlah_item]'></td>
<td><input class='form-control' type='text' name='satuan_item' id='satuan_item' value='$row[satuan_item]'> </td>
<td><button type='submit' name='submit1' class='btn btn-success btn-xs'><span class='glyphicon glyphicon-ok' aria-hidden='true'></span></button>
<a class='btn btn-danger btn-xs' title='Delete Data' href='".base_url()."administrator/tambah_pembelian'><span class='glyphicon glyphicon-remove'></span></a>
</td>
</tr>";
?>
<tbody>
<?php
$no = 1;
foreach ($record as $row){
echo "<tr><td>$no</td>
<td>$row[nama_produk]</td>
<td>Rp ".rupiah($row['harga_pesan'])."</td>
<td>$row[jumlah_pesan]</td>
<td>$row[satuan]</td>
<td>Rp ".rupiah($row['harga_pesan']*$row['jumlah_pesan'])."</td>
<td>
<a class='btn btn-warning btn-xs' title='Edit Data' href='".base_url()."administrator/tambah_pembelian/$row[id_pembelian_detail]'><span class='glyphicon glyphicon-edit'></span></a>
<a class='btn btn-danger btn-xs' title='Delete Data' href='".base_url()."administrator/delete_pembelian_tambah_detail/$row[id_pembelian_detail]' onclick=\"return confirm('Apa anda yakin untuk hapus Data ini?')\"><span class='glyphicon glyphicon-remove'></span></a>
</td>
</tr>";
$no++;
}
$total = $this->db->query("SELECT sum(a.harga_pesan*a.jumlah_pesan) as total FROM `rb_pembelian_detail` a where a.id_pembelian='".$this->session->idp."'")->row_array();
echo "<tr class='success'>
<td colspan='5'><b>Total</b></td>
<td><b>Rp ".rupiah($total['total'])."</b></td>
</tr>";
?>
</tbody>
</table>
<?php } ?>
</div>
</div>
</div>
</div>
<script type="text/javascript">
<?php echo $jsArray; ?>
function changeValue(id){
document.getElementById('harga').value = prdName[id].name;
document.getElementById('satuan').value = prdName[id].desc;
};
</script>