<?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>');
?>

<form action="<?php echo $form_action ?>" method="post">
  <p><?php echo '<font class="title">'.$menu_path.'</font>'; ?></p>
  <table width="100%" border="0" cellspacing="0" cellpadding="1">
    <tr>
      <td>Previous Petty Cash Opr Balance</td>
      <td>:</td>
      <td><b><?php echo $this->fungsi->format_idr($pettycashbalance); ?></b></td>
    </tr>
    <tr>
      <td>Amount To Be Taken</td>
      <td>:</td>
      <td><b><?php echo $this->fungsi->format_idr($totalamount); ?></b></td>
    </tr>
    <tr>
      <td>Current Petty Cash Opr Balance</td>
      <td>:</td>
      <td><b><?php echo $this->fungsi->format_idr($currpettycashbalance); ?>
        <input type="hidden" name="txt_idpcoprtyp" id="txt_idpcoprtyp" value="<?php echo $pcoprtyp; ?>"  />
      </b></td>
    </tr>
    <tr>
      <td>Petty Cash Opr Type</td>
      <td>:</td>
      <td><b><?php echo $pcoprtyp_desc; ?></b></td>
    </tr>
    <tr>
      <td width="21%">Posting Date</td>
      <td width="1%">:</td>
      <td width="78%"><b><?php echo $txt_postdate; ?>
        <input type="hidden" name="txt_postdate2" id="txt_postdate2" value="<?php echo $txt_postdate; ?>"  />
      </b></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="441">URAIAN</th>
          <th width="232">G/L ACCOUNT</th>
          <th width="204">JUMLAH</th>
        </tr>
        <?php echo $table; ?>
         <tr bgcolor="#FFFF33">
          <td height="28" colspan="2" align="left"><strong>TERBILANG : # <?php echo $this->fungsi->terbilang($totalamount); ?> Rupiah #</strong></td>
          <td align="right">TOTAL :</td>
          <td align="right"><b><?php echo $this->fungsi->format_idr($totalamount); ?></b></td>
        </tr>
      </table></td>
    </tr>
    <tr>
      <td colspan="3"><input type="button" name="button3" onclick="goBack()" id="button3" value="Back" class="button" />        <?php echo $submit; ?>
      <input type="hidden" name="txt_total" id="txt_total" value="<?php echo $totalamount; ?>"  /></td>
    </tr>
  </table>
  <p>&nbsp;</p>
</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>Petty Cash Opr Balance</td>
      <td>:</td>
      <td><?php echo $this->fungsi->format_idr($pettycashbalance); ?></td>
    </tr>
    <tr>
      <td>Petty Cash Opr 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">G/L ACCOUNT</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');
	?>

