<?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>
<?php
if ( empty($prev))
	{
		/* 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 ?>">
  <p><?php echo '<font class="title">'.$menu_path.'</font>'; ?></p>
  <table width="100%" border="0" cellspacing="1" cellpadding="1">
    <tr>
      <td>Branch</td>
      <td>:</td>
      <td>
        <select name="cb_idcab" id="cb_idcab">
      <?php 

foreach ($cab as $cabs)
{ 
?>
<option value="<?php echo $cabs->idcab; ?>" ><?php echo $cabs->cabname; ?></option>
<?php
}
?>  
      </select></td>
    </tr>
    <tr>
      <td width="14%">Phys. inventory doc.</td>
      <td width="1%">:</td>
      <td width="85%">
      <input name="txt_invdoc" type="text" id="txt_invdoc" value="<?php echo set_value('txt_invdoc', isset($default['txt_invdoc']) ? $default['txt_invdoc'] : ''); ?>" size="10" maxlength="10" /></td>
    </tr>
    <tr>
      <td>Fiscal year</td>
      <td>:</td>
      <td><input name="txt_year" type="text" id="txt_year" size="4" maxlength="4" value="<?php echo date('Y'); ?>" /></td>
    </tr>
    <tr>
      <td>Posting date</td>
      <td>:</td>
      <td><label for="txt_year"></label>
        <input name="txt_postdate" type="text" id="txt_postdate" size="10" value="<?php echo date('d.m.Y'); ?>"  maxlength="10" /></td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td><input type="submit" name="button" id="button" value="Preview" 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>Branch</td>
      <td>:</td>
      <td><?php echo $txt_cab_desc; ?>
        ( <?php echo $txt_cab_stor; ?> )
        <input type="hidden" name="txt_idcab" id="txt_idcab" value="<?php echo $txt_idcab; ?>" />
      <input type="hidden" name="txt_cab_stor" id="txt_cab_stor" value="<?php echo $txt_cab_stor; ?>"/></td>
    </tr>
    <tr>
      <td width="14%">Phys. inventory doc.</td>
      <td width="1%">:</td>
      <td width="85%"><?php echo $txt_invdoc; ?>
      <input type="hidden" name="txt_invdoc" id="txt_invdoc" value="<?php echo $txt_invdoc; ?>" /></td>
    </tr>
    <tr>
      <td>Fiscal year</td>
      <td>:</td>
      <td><?php echo $txt_year; ?>
      <input type="hidden" name="txt_year" id="txt_year" value="<?php echo $txt_year; ?>"/></td>
    </tr>
    <tr>
      <td>Posting date</td>
      <td>:</td>
      <td><?php echo $txt_postdate; ?>
      <input type="hidden" name="txt_postdate2" id="txt_postdate2" value="<?php echo $txt_postdate; ?>" /></td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td><table width="34%" border="1">
        <tr>
          <th width="10%">Item</th>
          <th width="38%">Material</th>
          <th width="37%">Difference qty.</th>
          <th width="15%">UOM</th>
          <th width="15%">Storage</th>
          </tr>
       <?php $this->fungsi_sap->fm_display_post_inv_dif($txt_invdoc, $txt_year); ?>
      </table></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
}
if ( ! empty($link))
	{
		echo '<p id="bottom_link">';
		foreach($link as $links)
		{
			echo $links . ' ';
		}
		echo '</p>';
	}
$this->load->view('includes/footer.php');
	?>

