<br />
<br />
<br />
<br />
<br />
<?php if($this->session->userdata('idcab') != 1)
{
?>
<table width="884" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#000000">
  <tr>
    <td colspan="5" align="center"><h1>SYSTEM DASHBOARD<br /><?php echo $this->session->userdata('idcab').' - '.strtoupper($this->session->userdata('namacab')); ?></h1></td>
  </tr>
  <tr>
    <th width="214">BANK BALANCE</th>
    <th width="214">PETTY CASH UO BALANCE</th>
    <th width="230">PETTY CASH OP BALANCE</th>
    <th width="204">STOCK BALANCE</th>
    <th width="204">WASTE BALANCE</th>
  </tr>
  <tr>
    <td align="right" valign="middle" bgcolor="#FFFF00"><h1><?php echo $this->fungsi->format_idr( $this->fungsi->get_bank_bal($this->session->userdata('pcbankglacc'))); ?></h1></td>
    <td align="right" valign="middle" bgcolor="#FFFF00"><h1><?php echo $this->fungsi->format_idr($this->fungsi->get_pc_bal($this->session->userdata('idcab'))); ?></h1></td>
    <td align="right" valign="middle" bgcolor="#FFFF00"><h1><?php echo $this->fungsi->format_idr($this->fungsi->get_pc_bal_op($this->session->userdata('idcab'))); ?></h1></td>
    <td align="center" bgcolor="#FFFF00"><h1><?php echo number_format($this->fungsi->get_stock_bal($this->session->userdata('idcab'))); ?></h1>
	</td>
    <td align="center" valign="middle" bgcolor="#FFFF00"><h1><?php echo number_format($this->fungsi_sap->fm_get_stock_waste($this->session->userdata('lgort'))); ?></h1></td>
  </tr>
</table>
<center>
<h3>
  LAST 10 BANK TRANSACTIONS
  </h3>
<table width="890" border="1" cellpadding="1" cellspacing="1" bordercolor="#000000">
  <tr>
    <th width="144" bgcolor="#CCCCCC">No. CPDU</th>
    <th width="379" bgcolor="#CCCCCC">Description</th>
    <th width="160" bgcolor="#CCCCCC">Amount</th>
    <th width="80" bgcolor="#CCCCCC">Status</th>
  </tr>
<?php 
$bg =0;
foreach($this->fungsi->display_last10_banktrans($this->session->userdata('idcab')) as $row)
					{ 
					
					if($bg==0)
											   {
											   echo '<tr style=background-color:#eeeeee;>';
											   $bg++;
											   }
											else
												{
												echo '<tr style=background-color:#;>';
												$bg--;
												}	
						//Check journal posting
						if($this->fungsi_sap->fm_check_gl_post($this->session->userdata('pcbankglacc'),$row->nocpdu) == 'X')
						{
							$status_jurnal = '<font color="#00CC00"><b>OK</b></font>';
						}
						else
						{
							$status_jurnal = '<font color="#FF0000"><b>NOT OK</b></font>';
						}	
						echo
								'<td>'.$row->nocpdu.'</td>
								<td>'.$row->desc.'</td>
								<td align="right">'.$this->fungsi->format_idr($row->amount_trf).'</td>
								<td align="center">'.$status_jurnal.'</td>
							  </tr>';
					}
?>
</table>
</center>
<?php } 
else
{ 
echo '<center>';
echo 'PO yang belum di MIGO :';
echo '<br>';
//Check apakah ada no. po yang migo nya = 0
$query_po = $this->db->query("select * from t_po where mblnr = 0")->result();
foreach($query_po as $row_po)
	{
		echo '<font color="#FF0000">'.$row_po->ebeln.'</font>';
		echo '<br>';
	}
echo '</center>';
echo $this->fungsi->display_all_saldo_cab();
}
?>