<?php
include "../../include/config.php";
include "../../function/inc_function.php";
header('Content-Type: application/vnd.ms-excel');
header('Content-Disposition: attachment;filename="data_jurnal_Umum_'.get_datetime().'.xls"');
header('Cache-Control: max-age=0');

$fromdate= isset($_REQUEST['fromdate']) ? $_REQUEST['fromdate'] : $date;
$todate  = isset($_REQUEST['todate']) ? $_REQUEST['todate'] : $date; 
$sqlShow 	= mysql_query("SELECT prof_name FROM profil");
$dataShow 	= mysql_fetch_array($sqlShow);

?>
<table width="100%" border="0">
    <tr>
  		<td colspan="8">DATA JURNAL UMUM</td>
    </tr>
    <tr>
  		<td colspan="8">PERIOD : <?=$fromdate;?>~<?=$todate;?></td>
    </tr>
</table>	
<table width="100%" border="1">	
	<thead>
	<tr>
	<th>No</th>
	<th>No Jurnal</th>
	<th>Tanggal</th>
	<th>Tipe</th>
	<th>No Invoice</th>
	<th>Supplier/Customer</th>
	<th>NPWP</th>
	<th>Currency</th>
	<th>Status</th>
  </tr>
  </thead>
	<tbody>
  <?php
	$no=1;
	$qd = mysql_query("SELECT * FROM jurnal WHERE jurnal_status<>100 AND jurnal_date BETWEEN '$fromdate' AND '$todate' AND jurnal_menu='UMUM' ORDER BY id DESC");
	while($dd=mysql_fetch_object($qd)){		
	   if($dd->jurnal_status==10){$status = "Baru";}
	   else{$status = "Posting";}
	   if(!empty($dd->jurnal_idsupp) && empty($dd->junal_idcust)){ $nama=$dd->jurnal_suppname;}else{$nama=$dd->jurnal_custname;}
	?> 
	  <tr onmouseover="setTrColor(this, '#FF9900');">
		<td align="center"><?=$no;?>.</td>
		<td align="center"><?=$dd->jurnal_no;?></td>
		<td align="center"><?=$dd->jurnal_date;?></td>
		<td align="center"><?=$dd->jurnal_type;?></td>
		<td><?=$dd->jurnal_invno;?></td>
		<td align="left"><?=$nama;?></td>
		<td align="center"><?=$dd->jurnal_idpemasok;?></td>
		<td align="center"><?=$dd->jurnal_currency;?></td>
		<td align="center"><?=$status;?></td>		
	  </tr>
  <?php $no++; }  ?>
	  </tbody>
</table>