<?php
$this->load->view('includes/header.php');
?>
<script type="text/javascript">

$(function() {
$( "#adddate" ).datepicker({
changeMonth: true, // menampilkan dropdown untuk ganti bulan
changeYear: true // menampilkan dropdown untuk ganti Tahun
});
$( "#adddate" ).datepicker({ altFormat: 'yy-mm-dd' });
$( "#adddate" ).change(function() {
$( "#adddate" ).datepicker( "option", "dateFormat","dd.mm.yy" );
});
});

</script>
<script type="text/javascript">
			
			// Sample 2
			$(document).ready(function()
			{
				$('#txt_amount_trf').blur(function()
				{
					$('#txt_amount_trf').formatCurrency({ region: 'id-ID' });
				});
			});
		</script>
<?php
if ( ! empty($prev))
	{
?>


<?php
	}
else
{
echo '<font class="title">'.$menu_path.'</font>';
echo '<br>';
			/* Display system message */
			$this->fungsi->disp_sys_msg();
			echo validation_errors('<p class="field_error">', '</p>');
?>
<fieldset><legend>OIL PURCHASE</legend>
<form name="form1" method="post" action="<?php echo $form_action ?>">
  <table width="100%" border="0" cellspacing="1" cellpadding="1">
    <tr>
      <td width="16%"><strong>Purchase Requisition No.</strong></td>
      <td width="1%">:</td>
      <td width="36%"><span class="primary">
      <input type="text" name="prnumb" id="prnumb" value="<?php ?>" size="20" readonly="readonly" />
      </span>
      <input type="button" name="button3" id="button3" value="..." class="button" onclick="window.open('<?php echo base_url();?>index.php/popup/popup_pr/','popuppage','width=900,height=600,scrollbar=yes,scrollbars=yes,top=100,left=100');" /></td>
      <td width="17%"><strong>Quantity</strong></td>
      <td width="1%">:</td>
      <td width="29%"><input type="text" name="quantity" id="quantity" value="<?php echo set_value('quantity', isset($default['quantity']) ? $default['quantity'] : ''); ?>" size="10" readonly="readonly" />
        (L)</td>
    </tr>
    <tr>
      <td>Type</td>
      <td>:</td>
      <td><select name="type">
<option value="Company" selected="selected">Company</option>
<option value="Collector">Collector</option>
<option value="Others">Others</option>
</select></td>
      <td><strong>Price</strong></td>
      <td>:</td>
      <td><input type="text" name="c_amt_bapi" id="c_amt_bapi" value="<?php ?>" size="10" />
        (Rp)</td>
    </tr>
    <tr>
      <td>DO No.</td>
      <td>:</td>
      <td><input name="donumb" type="text" id="donumb" size="20" maxlength="50" value="<?php echo set_value('donumb', isset($default['donumb']) ? $default['donumb'] : ''); ?>"  /> <font class="required">*</font></td>
      <td><strong>Total PR</strong></td>
      <td>:</td>
      <td><input type="text" name="total" id="total" value="<?php echo set_value('total', isset($default['total']) ? $default['total'] : ''); ?>" size="10" readonly="readonly" />
        (Rp)</td>
    </tr>
   

<tr>
<td>Date</td>
<td>:</td>
<td><input type="text" name="adddate" id="adddate" size="20" value="<?php echo set_value('adddate', isset($default['adddate']) ? $default['adddate'] : ''); ?>" /></td>
<td><strong>Available Quantity</strong></td>
<td>:</td>
<td><input name="available" type="text" id="available" size="10" maxlength="50" value="<?php echo set_value('$available', isset($default['$available']) ? $default['available'] : ''); ?>"  /></td>
</tr>

    <tr>
      <td>Manifest No.</td>
      <td>:</td>
      <td><label for="mnfst">
        <input name="mnfst" type="text" id="mnfst" size="20" maxlength="20" value="<?php echo set_value('mnfst', isset($default['mnfst']) ? $default['mnfst'] : ''); ?>"  />
      <font class="required">*</font></label></td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td>Supplier ID</td>
      <td>:</td>
      <td><span class="primary">
      <input type="text" name="idsupp" id="idsupp" size="3" value="<?php ?>"  readonly="readonly" /><input type="text" name="nama_supp" size="15" id="nama_supp" value="<?php ?>"  readonly="readonly" />
      </span>
      <input type="button" name="button2" id="button2" value="..." class="button" onclick="window.open('<?php echo base_url();?>index.php/popup/popup_supp/','popuppage','width=900,height=600,scrollbar=yes,scrollbars=yes,top=100,left=100');" /></td>
      <td><div align="center"><strong>COST PAYMENT</strong></div></td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td>Transporter ID</td>
      <td>:</td>
      <td><span class="primary">
      <input type="text" name="idtrans" id="idtrans" size="3" value="<?php ?>"  readonly="readonly" /><input type="text" name="nama_trans" size="15" value="<?php ?>" id="nama_trans" readonly="readonly" />
      </span>
      <input type="button" name="button4" id="button4" value="..." class="button" onclick="window.open('<?php echo base_url();?>index.php/popup/popup_trans/','popuppage','width=900,height=600,scrollbar=yes,scrollbars=yes,top=100,left=100');" /></td>
      <td>Purchase Price</td>
      <td>:</td>
      <td><input name="pur" type="text" id="pur" size="15" maxlength="50" value="<?php echo set_value('pur', isset($default['pur']) ? $default['pur'] : ''); ?>"  />
        (Rp)</td>
    </tr>
    <tr>
      <td>Invoice No.</td>
      <td>:</td>
      <td><input name="invoice" type="text" id="invoice" size="20" maxlength="50" value="<?php echo set_value('invoice', isset($default['invoice']) ? $default['invoice'] : ''); ?>"  /> <font class="required">*</font></td>
      <td>Volume</td>
      <td>:</td>
      <td><input name="vol" type="text" id="vol" size="10" maxlength="50" value="<?php echo set_value('vol', isset($default['vol']) ? $default['vol'] : ''); ?>"  />
        (L) <font class="required">*</font></td>
    </tr>
    <tr>
      <td>Vehicle No.</td>
      <td>:</td>
      <td><input name="vnumb" type="text" id="vnumb" size="10" maxlength="50" value="<?php echo set_value('vnumb', isset($default['vnumb']) ? $default['vnumb'] : ''); ?>"  />
          <font class="required">*</font></td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>Fee Payment</td>
      <td>:</td>
      <td><input name="fee" type="text" id="fee" size="10" maxlength="20" value="<?php echo set_value('fee', isset($default['fee']) ? $default['fee'] : ''); ?>"  />
        Blank If no cost</td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>Freight Payment</td>
      <td>:</td>
      <td><input name="freight" type="text" id="freight" size="10" maxlength="20" value="<?php echo set_value('freight', isset($default['freight']) ? $default['freight'] : ''); ?>"  />
        Blank If no cost</td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>Others Payment</td>
      <td>:</td>
      <td><input name="other" type="text" id="other" size="10" maxlength="20" value="<?php echo set_value('other', isset($default['other']) ? $default['other'] : ''); ?>"  />
        Blank If no cost</td>
    </tr>
    <tr>
      <td>Information</td>
      <td>:</td>
      <td><textarea name="inf" cols="30" rows="5"><?php echo set_value('inf', isset($default['inf']) ? $default['inf'] : ''); ?></textarea></td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
    <!--<tr>
      <td>Storage Max Capacity</td>
      <td>:</td>
      <td><input name="txt_max_stor" type="text" id="txt_max_stor" size="20" maxlength="20" value="<?php echo set_value('txt_max_stor', isset($default['txt_max_stor']) ? $default['txt_max_stor'] : ''); ?>" onblur="this.value=addCommas(this.value)" /> 
        <em>Liter</em> <font class="required">*</font></td>
    </tr>-->
    <!--<tr>
      <td>Plant (SAP)</td>
      <td>:</td>
      <td><input name="txt_werks" type="text" id="txt_werks" value="1000" size="4" maxlength="4" readonly="readonly" /> <font class="required">*</font></td>
    </tr>
    <tr>
      <td>Storage Code (SAP)</td>
      <td>:</td>
      <td><input name="txt_lgort" type="text" id="txt_lgort" size="4" maxlength="4" value="<?php echo set_value('txt_lgort', isset($default['txt_lgort']) ? $default['txt_lgort'] : ''); ?>" />
      <font class="required">*</font></td>
    </tr>-->
    <tr>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td><input type="submit" name="button" id="button" value="Submit" class="button" /></td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
  </table>
 
 <br>
  <table width="1100" border="1">
    <tr>
      <th width="34"><div align="center">No.</div></th>
      <th width="115"><div align="center">PR Number</div></th>
      <th width="112"><div align="center">Quantity</div></th>
      <th width="86"><div align="center">Price</div></th>
      <th width="138"><div align="center">Total PR</div></th>
      <th width="100"><div align="center">Volume</div></th>
      <th width="123"><div align="center">Supplier</div></th>
      <th width="122"><div align="center">Invoice</div></th>
      <th width="89"><div align="center">Date</div></th>
      <th width="117"><div align="center">Action</div></th>
    </tr>
    <?php $i=1; $vol = 0; $total = 0;
	
	foreach ($data_op->result() as $row){ $vol +=$row->vol;$total +=$row->total;?>
    <tr>
      <td><?php echo $i;?></td>
      <td><?php echo $row->prnumb;?></td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td><?php echo $row->total;?></td>
      <td><?php echo $row->vol;?></td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
    <?php $i++;}?>
    <tr>
      <td colspan="4">TOTAL</td>
      <td><?php echo $total;?></td>
      <td><?php echo $vol;?></td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
  </table>
  <p>&nbsp;</p>
</form>


 <?php
}
if ( ! empty($link))
	{
		echo '<p id="bottom_link">';
		foreach($link as $links)
		{
			echo $links . ' ';
		}
		echo '</p>';
	}
$this->load->view('includes/footer.php');
	?>

