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

  //Date picker
	$(function() {
		 
		$( "#txt_postdate" ).datepicker({
			changeMonth: true,
			changeYear: true
		});
		$( "#txt_postdate" ).datepicker( "option", "dateFormat", "dd.mm.yy");
		$( "#txt_postdate" ).datepicker( "setDate", "<?php echo date('d.m.Y'); ?>" );
		
	});

</script>
<script type="text/javascript">
			//$('#chk1').prop('checked', true);
			// Sample 2
			$(document).ready(function()
			{
				$('#txt_amount1').blur(function()
				{
					$('#txt_amount1').formatCurrency({ region: 'id-ID' });
				});
				$('#txt_amount2').blur(function()
				{
					$('#txt_amount2').formatCurrency({ region: 'id-ID' });
				});
				$('#txt_amount3').blur(function()
				{
					$('#txt_amount3').formatCurrency({ region: 'id-ID' });
				});
				$('#txt_amount4').blur(function()
				{
					$('#txt_amount4').formatCurrency({ region: 'id-ID' });
				});
			});
			
			/*$(document).ready(function()
			{
				$('#txt_uraian1').focus(function()
				{
					$('#chk1').prop('checked', true);
				});
				
				$('#txt_uraian2').focus(function()
				{
					$('#chk2').prop('checked', true);
				});
				
				$('#txt_uraian3').focus(function()
				{
					$('#chk3').prop('checked', true);
				});
				
				$('#txt_uraian4').focus(function()
				{
					$('#chk4').prop('checked', true);
				});
			});*/
			
		</script>
<?php
if ( ! empty($prev))
	{
		/* Display system message */
			$this->fungsi->disp_sys_msg();
			echo validation_errors('<p class="field_error">', '</p>');
?>
<p>
  <?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>');
?>
</p>
<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="button2" id="button2" 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>
</table>
<p>&nbsp; </p>
<form name="form1" method="post" action="<?php echo $form_action ?>">
  <table width="100%" border="0" cellspacing="1" cellpadding="1">
    <tr>
      <td>Purchase Type</td>
      <td>:</td>
      <td><select name="cb_pcoprtyp" id="cb_pcoprtyp">
        <?php echo $cb_pcoprtyp; ?>
      </select></td>
    </tr>
    <tr>
      <td width="14%">Posting Date</td>
      <td width="1%">:</td>
      <td width="85%"><h3>
        <input name="txt_postdate" type="text" id="txt_postdate" size="10" value="<?php echo date('d.m.Y'); ?>"  maxlength="10" />
      </h3></td>
    </tr>
    <tr>
      <td colspan="3"><strong>NOTE :</strong> <em>Leave empty uraian or jumlah if you want to exclude from list</em></td>
    </tr>
    <tr>
      <td colspan="3"><table width="942" border="0" cellpadding="0" cellspacing="0">
        <tr>
          <th width="65" height="28">NO</th>
          <th width="505">URAIAN</th>
          <th width="168">PURCHASE TYPE</th>
          <th width="204">JUMLAH</th>
        </tr>
        <tr >
          <td align="center">1.
            
            <label for="chk1"></label></td>
          <td><label for="textfield"></label>
            <input name="txt_uraian1" type="text" id="txt_uraian1" size="80" maxlength="44" value="<?php echo strtoupper($this->session->userdata('cabshorttxt'));	 ?>-" /></td>
          <td align="center"><label for="select"></label>
            <select name="cb_gl1" id="cb_gl1">
            <?php echo $cb_gl; ?>
            </select></td>
          <td align="center"><input name="txt_amount1" type="text" id="txt_amount1" size="15" maxlength="15" /></td>
        </tr>
        <tr>
          <td align="center">2.            </td>
          <td><input name="txt_uraian2" type="text" id="txt_uraian2" size="80" maxlength="44" value="<?php echo strtoupper($this->session->userdata('cabshorttxt'));	 ?>-"/></td>
          <td align="center"><select name="cb_gl2" id="cb_gl2">
           <?php echo $cb_gl; ?>
          </select></td>
          <td align="center"><input name="txt_amount2" type="text" id="txt_amount2" size="15" maxlength="15" /></td>
        </tr>
        <tr>
          <td align="center">3.            </td>
          <td><input name="txt_uraian3" type="text" id="txt_uraian3" size="80" maxlength="44" value="<?php echo strtoupper($this->session->userdata('cabshorttxt'));	 ?> -" /></td>
          <td align="center"><select name="cb_gl3" id="cb_gl3">
           <?php echo $cb_gl; ?>
          </select></td>
          <td align="center"><input name="txt_amount3" type="text" id="txt_amount3" size="15" maxlength="15" /></td>
        </tr>
        <tr>
          <td align="center">4.            </td>
          <td><input name="txt_uraian4" type="text" id="txt_uraian4" size="80" maxlength="44" value="<?php echo strtoupper($this->session->userdata('cabshorttxt'));	 ?> -" /></td>
          <td align="center"><select name="cb_gl4" id="cb_gl4">
           <?php echo $cb_gl; ?>
          </select></td>
          <td align="center"><input name="txt_amount4" type="text" id="txt_amount4" size="15" maxlength="15" /></td>
        </tr>
      </table></td>
    </tr>
    <tr>
      <td><input type="submit" name="button" id="button" value="Preview" class="button" /></td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
  </table>
 
</form>

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

