<?php
$this->load->view('includes/header.php');
?>
<script type="text/javascript">
 
 //Date picker
	$(function() {
		 
		$( "#txt_cancel_date" ).datepicker({
			changeMonth: true,
			changeYear: true
		});
		$( "#txt_cancel_date" ).datepicker( "option", "dateFormat", "dd.mm.yy");
		$( "#txt_cancel_date" ).datepicker( "setDate", "<?php echo date('d.m.Y'); ?>" );
		
	});

</script>
<script>
function validateForm()
{
var x=document.forms["form1"]["txt_cancel"].value;
if (x==null || x=="")
  {
  alert("Reason For Cancel Cannot Be Empty!");
  return false;
  }
}
</script>
<?php
if ( !empty($prev))
	{
?>

<form action="<?php echo $form_action ?>" method="post" name="form1" onsubmit="return validateForm()">
<?php echo '<font class="title">'.$menu_path.'</font>'; ?>
<table width="100%" border="0" cellspacing="2" cellpadding="2">
  <tr>
    <td>No. PR</td>
    <td>:</td>
    <td><?php echo $txt_preq_no; ?>
      <input type="hidden" name="txt_preq_no" id="txt_preq_no"  value="<?php echo $txt_preq_no; ?>"/></td>
  </tr>
  <tr>
    <td>No. PO</td>
    <td>:</td>
    <td><?php echo $txt_ebeln; ?>
      <label for="txt_ebeln"></label>
      <input type="hidden" name="txt_ebeln" id="txt_ebeln"  value="<?php echo $txt_ebeln; ?>"/></td>
  </tr>
  <tr>
    <td>No. MIGO</td>
    <td>:</td>
    <td><?php echo $txt_migo; ?>
      <input type="hidden" name="txt_migo" id="txt_migo"  value="<?php echo $txt_migo; ?>"/></td>
  </tr>
  <tr>
    <td>Cancel Date</td>
    <td>:</td>
    <td><label for="txt_cancel_date"></label>
      <input name="txt_cancel_date" type="text" id="txt_cancel_date" size="10" maxlength="10" /></td>
  </tr>
  <tr>
    <td>Vendor</td>
    <td>:</td>
    <td><?php echo $txt_vendor; ?></td>
  </tr>
  <tr>
    <td width="14%">Net Price</td>
    <td width="1%">:</td>
    <td width="85%"><?php echo $this->fungsi->format_idr($txt_net_price); ?></td>
  </tr>
  <tr>
    <td>Quantity</td>
    <td>:</td>
    <td><?php echo number_format($txt_qty); ?> L<input type="hidden" name="txt_qty" id="txt_qty"  value="<?php echo $txt_qty; ?>"/>
      <input type="hidden" name="txt_year" id="txt_year"  value="<?php echo $txt_year; ?>"/></td>
  </tr>
  <tr>
    <td>Rounding Discount</td>
    <td>:</td>
    <td><?php echo $this->fungsi->format_idr($txt_disc); ?>
      <input type="hidden" name="txt_disc" id="txt_disc" value="<?php echo $txt_disc; ?>"/></td>
  </tr>
  <tr>
    <td>Total Before PPN</td>
    <td>:</td>
    <td><?php echo $this->fungsi->format_idr( $txt_total); ?>
      <input type="hidden" name="txt_total" id="txt_total" value="<?php echo $txt_total; ?>"/></td>
  </tr>
  <tr>
    <td>PPN</td>
    <td>:</td>
    <td><?php echo $this->fungsi->format_idr($txt_ppn); ?>
      <input type="hidden" name="txt_ppn" id="txt_ppn" value="<?php echo $txt_ppn; ?>"/></td>
  </tr>
  <tr>
    <td>Total After PPN</td>
    <td>:</td>
    <td><?php echo $this->fungsi->format_idr($txt_totalall); ?></td>
  </tr>
  <tr>
    <td>Cancel Reason</td>
    <td>:</td>
    <td><font class="required">
      <textarea name="txt_cancel" cols="50" rows="5" id="txt_cancel"></textarea>
      *</font></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td><input type="button" name="button3" onclick="goBack()" id="button3" value="Back" class="button" /> 
            <input type="submit" name="button2" id="button2" value="Submit" class="button" /></td>
  </tr>
</table>
</form>
<?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>');
?>
<form name="form1" method="post" action="<?php echo $form_action ?>">
  <table width="100%" border="0" cellspacing="1" cellpadding="1">
    <tr>
      <td width="14%">PO. Number</td>
      <td width="1%">:</td>
      <td width="85%"><label for="txt_ebeln"></label>
      <input name="txt_ebeln" type="text" id="txt_ebeln" value="<?php echo set_value('txt_amount', isset($default['txt_ebeln']) ? $default['txt_ebeln'] : ''); ?>" size="10" maxlength="10" />
      <font class="required">*</font></td>
    </tr>
    <tr>
      <td>Year</td>
      <td>:</td>
      <td><label for="txt_desc">
        <input name="txt_year" type="text" id="txt_year" value="<?php echo set_value('txt_year', isset($default['txt_year']) ? $default['txt_year'] : ''); ?>" size="4" maxlength="4" />
      <font class="required">*</font></label></td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td><input type="submit" name="button" id="button" value="Submit" class="button" /></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');
	?>

