<?php
$this->load->view('includes/header.php');
?>
<script type="text/javascript">
			
			// Sample 2
			$(document).ready(function()
			{
				$('#pur').blur(function()
				{
					$('#pur').formatCurrency({ region: 'id-ID' });
				});
			});
		</script>

<script type="text/javascript">

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

</script>

<script type="text/javascript">
			//Plugin to reload data table
			(function($) {
				$.prnumbChange = function(prnumb) {
					$.ajax({
					type: 'GET',
					url: '<?php echo site_url()?>ajax/branchAjax/reloadTable/'+prnumb,
					dataType: 'html',
					success: function (data, textStatus) {
						$('#content-table').html(data);
					},
					error: function (xhr, err, e) {
						alert("Error: " + err);
					}
				});				
				}
			})(jQuery);
			
			// Sample 2
			$(document).ready(function()
			{
			
			var prnumb = '';
			$('#form1').hover(function(){
				if($('#prnumb').val()!=prnumb){
					prnumb = $('#prnumb').val();
					$.prnumbChange(prnumb);
				}
			})
				$('#txt_amount_trf').blur(function()
				{
					$('#txt_amount_trf').formatCurrency({ region: 'id-ID' });
				});
			
				<?php if($this->session->flashdata('prnumb')!=""){?>
					$.prnumbChange('<?php echo $this->session->flashdata('prnumb');?>');
				<?php }?>
			});
		</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 ?>" id="form1">
  <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" 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>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td width="16%"><strong>Receive Goods No.</strong></td>
      <td width="1%">:</td>
      <td width="36%"><span class="primary">
      <input type="text" name="idstb" id="idstb" 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_stb_qa/','popuppage','width=900,height=600,scrollbar=yes,scrollbars=yes,top=100,left=100');" /></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>Type</td>
      <td>:</td>
      <td><input name="type" type="text" id="type" size="20" maxlength="50" readonly="readonly" value="<?php echo set_value('type', isset($default['type']) ? $default['type'] : ''); ?>"  /></td>
      <td><strong>Price</strong></td>
      <td>:</td>
      <td><input type="text" name="c_amt_bapi" id="c_amt_bapi" value="<?php ?>" size="10" readonly="readonly"/>
        (Rp)</td>
    </tr>
    <tr>
      <td>DO No.</td>
      <td>:</td>
      <td><input name="donumb" type="text" id="donumb" size="20" maxlength="50" readonly="readonly" value="<?php echo set_value('donumb', isset($default['donumb']) ? $default['donumb'] : ''); ?>"  />
     </td>
      <td><strong>Quantity</strong></td>
      <td>:</td>
      <td><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>Posting Date</td>
<td>:</td>
<td><input type="text" name="posting" id="posting" size="20" value="<?php echo date('d.m.Y'); ?>" /></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>

    <tr>
      <td>Manifest No.</td>
      <td>:</td>
      <td><label for="mnfst">
        <input name="mnfst" type="text" id="mnfst" size="20" maxlength="20" readonly="readonly" value="<?php echo set_value('mnfst', isset($default['mnfst']) ? $default['mnfst'] : ''); ?>"  />
      </label></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'] : ''); ?>" readonly="readonly" />
        (L)</td>
    </tr>
    <tr>
      <td>Supplier</td>
      <td>:</td>
      <td><input name="idsupp" type="text" id="idsupp" size="4" maxlength="4" readonly="readonly" value="<?php echo set_value('idsupp', isset($default['idsupp']) ? $default['idsupp'] : ''); ?>"  />
      <input name="suppname" type="text" id="suppname" size="20" maxlength="20" readonly="readonly" value="<?php echo set_value('suppname', isset($default['suppname']) ? $default['suppname'] : ''); ?>"  /></td>
      <!--<td><strong>Available Balance</strong></td>
      <td>&nbsp;</td>
      <td><input name="avail" type="text" id="avail" size="10" maxlength="50" value="<?php echo $this->fungsi->format_idr($this->fungsi->get_pc_bal($this->session->userdata('idcab'))); ?>" readonly="readonly" />
        (Rp)</td>-->
    </tr>
    <tr>
      <td>Transporter</td>
      <td>:</td>
      <td><input name="idtrans" type="text" id="idtrans" size="4" maxlength="4" readonly="readonly" value="<?php echo set_value('idtrans', isset($default['idtrans']) ? $default['idtrans'] : ''); ?>"  />
      <input name="transname" type="text" id="transname" size="20" maxlength="20" readonly="readonly" value="<?php echo set_value('transname', isset($default['transname']) ? $default['transname'] : ''); ?>"  /></td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td>Invoice No. / Receipt 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><div align="center"><strong>COST PAYMENT</strong></div></td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td>Vehicle No.</td>
      <td>:</td>
      <td><input name="vnumb" type="text" id="vnumb" size="8" maxlength="8"  value="<?php echo set_value('vnumb', isset($default['vnumb']) ? $default['vnumb'] : ''); ?>"  />        <font class="required">*</font></td>
      <td>Purchase Price</td>
      <td>:</td>
      <td><input name="pur" type="text" id="pur" size="10" maxlength="50" value="<?php echo set_value('pur', isset($default['pur']) ? $default['pur'] : ''); ?>"  />
        (Rp)<font class="required">*</font></td>
    </tr>
    <tr>
      <td>Payment By</td>
      <td>:</td>
      <td><select name="type2">
        <option value="1">Petty Cash Used Oil</option>
        <option value="2" disabled="disabled">Bank BCA WGI</option>
        
      </select></td>
      <td>Volume</td>
      <td>:</td>
      <td><input name="vol" type="text" id="vol" size="10" maxlength="50" readonly="readonly" value="<?php echo set_value('vol', isset($default['vol']) ? $default['vol'] : ''); ?>"  onblur="this.value=addCommas(this.value)" />
        (L)<font class="required">*</font></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 width="19%">&nbsp;</td>
      <td width="1%">&nbsp;</td>
      <td width="27%">&nbsp;</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>
    <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>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
  </table>
</form>
 <br>
<form name="form2" action="<?php echo $form_action2 ?>">
  <div id="content-table">
	
  </div>
  <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');
	?>

