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

<form action="<?php echo $form_action ?>" method="post">
 <input type="hidden" name="txt_nocpv" id="txt_nocpv" value="<?php echo set_value('txt_noform', isset($txt_nocpv) ? $txt_nocpv : ''); ?>"  />
      <input type="hidden" name="txt_year" id="txt_year" value="<?php echo set_value('txt_year', isset($txt_year) ? $txt_year : ''); ?>"  />
<?php echo '<font class="title">'.$menu_path.'</font>'; ?>
<table width="100%" border="0" cellspacing="2" cellpadding="2">
  <tr>
    <td>Previous Bank Balance</td>
    <td>:</td>
    <td><?php echo $this->fungsi->format_idr($bankbalance); ?></td>
  </tr>
  <tr>
    <td>Amount to be taken</td>
    <td>:</td>
    <td><input name="txt_amount" type="hidden" id="txt_amount" value="<?php echo $txt_amount; ?>" />
      <?php echo $this->fungsi->format_idr($txt_amount); ?></td>
  </tr>
  <tr>
    <td width="14%">Current Bank Balance</td>
    <td width="1%">:</td>
    <td width="85%"><?php echo $this->fungsi->format_idr($this->fungsi->get_bank_bal($this->session->userdata('pcbankglacc')) - $this->fungsi->convert_idr_to_num($this->input->post('txt_amount')));?></td>
  </tr>
  <tr>
    <td>Posting Date</td>
    <td>:</td>
    <td><?php echo $txt_postdate; ?>
      <input name="txt_postdate2" type="hidden" id="txt_postdate2" value="<?php echo $this->input->post('txt_postdate'); ?>" /></td>
  </tr>
  <tr>
    <td>Description</td>
    <td>:</td>
    <td><?php echo $txt_desc; ?><input name="txt_desc" type="hidden" id="txt_desc" value="<?php echo $txt_desc; ?>" /></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>Bank Balance</td>
      <td>:</td>
      <td><?php echo $this->fungsi->format_idr($bankbalance); ?></td>
    </tr>
     <tr>
      <td>Petty Cash Opr Bal Trf</td>
      <td>:</td>
      <td><?php echo $this->fungsi->format_idr( $this->fungsi->get_hist_pc_bal_op($this->session->userdata('idcab'))); ?></td>
    </tr>
    <tr>
      <td width="14%">Amount</td>
      <td width="1%">:</td>
      <td width="85%"><label for="txt_ebeln"></label>
      <input name="txt_amount" type="text" id="txt_amount" value="<?php echo set_value('txt_amount', isset($default['txt_amount']) ? $default['txt_amount'] : ''); ?>" /></td>
    </tr>
    <tr>
      <td>Posting Date</td>
      <td>:</td>
      <td><input name="txt_postdate" type="text" id="txt_postdate" size="10" value="<?php echo date('d.m.Y'); ?>"  maxlength="10" /></td>
    </tr>
    <tr>
      <td>Description</td>
      <td>:</td>
      <td><label for="txt_desc"></label>
      <textarea name="txt_desc" id="txt_desc" cols="45" rows="5"><?php echo set_value('txt_desc', isset($default['txt_desc']) ? $default['txt_desc'] : ''); ?></textarea></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
}
if ( ! empty($link))
	{
		echo '<p id="bottom_link">';
		foreach($link as $links)
		{
			echo $links . ' ';
		}
		echo '</p>';
	}
$this->load->view('includes/footer.php');
	?>

