Monday, October 8, 2012
membuat export data ods versi html
<?php
require_once 'MasterlistDoc/masterlist.jmd';
$masterlist = new masterlist();
$section = $_REQUEST['section'];
$date = date("Y-m-d");
$lastupdate = date('Y-m-d');
$username = $_SESSION['username'];
$judul = 'Distribute('.$lastupdate.').ods';
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: private");
header('Content-type: application/vnd.ms-excel');
header("Content-Disposition: attachment; filename= $judul");
if(!empty($section))
{$condition="$condition ( TBMD_section like '%$section%') AND";}
if($condition != "") { $condition=substr($condition,0,strlen($condition)-strlen(" AND")); }
if($condition != "")
{ $condition=" where $condition";}
?>
<table cellpadding="1" cellspacing="1" align="center">
<tr>
<td colspan="10">Distribute to <?php echo $section?></td>
</tr>
<tr>
<td width="160" valign="middle" align="center">Department</td>
<td width="170" valign="middle" align="center">Section</td>
<td width="90" valign="middle" align="center">Document No.</td>
<td valign="middle" align="center" colspan="2">Revision / Review</td>
<td width="300" valign="middle" align="center">Tittle</td>
<td width="90" valign="middle" align="center">Effective Date</td>
<td width="60" valign="middle" align="center">Copy A3</td>
<td width="60" valign="middle" align="center">Copy A4</td>
<td width="60" valign="middle" align="center">Copy A5</td>
</tr>
<?php
$q = $masterlist->distribute_to($condition);
$res = mssql_query($q);
$num = mssql_num_rows($res);
if( $num > 0)
{
$i = $batasmin;
while ($row=mssql_fetch_object($res))
{
?>
<tr>
<td valign="middle" align="left"><?php echo $row->TBM_dept;?></td>
<td valign="middle" align="left"><?php echo $row->TBM_section;?></td>
<td valign="middle" align="center"><?php echo $row->TBM_DocNo;?></td>
<td width="30" valign="middle" align="center"><?php echo $row->TBM_revision;?></td>
<td width="30" valign="middle" align="center"><?php echo $row->TBM_review;?></td>
<td valign="middle" align="left"><?php echo $row->TBM_title;?></td>
<td valign="middle" align="center"><?php echo substr($row->TBM_EffectiveDate,0,10);?></td>
<td width="30" valign="middle" align="center"><?php echo $row->TBMD_copyA3;?></td>
<td width="30" valign="middle" align="center"><?php echo $row->TBMD_copyA4;?></td>
<td width="30" valign="middle" align="center"><?php echo $row->TBMD_copyA5;?></td>
</tr>
<?php
$i++;}
}
else
{
?>
<tr bgcolor="<?php echo $bgcolor_row1 ;?>">
<td colspan="10" align="center" class="warn">TIDAK ADA DATA !!!</td>
</tr>
<?php }?>
</table>
Labels:
PHP
Subscribe to:
Post Comments (Atom)
About Me
|
No comments:
Post a Comment