00001 <?php
00002
00032 function doc($result, $sumArray, $title, $weighArray, $headerArray){
00033
00034 $config = Config::read("config.ini");
00035 $active_app = Router::get_application();
00036 $file = md5(uniqid());
00037
00038 $content = "
00039 <html>
00040 <head>
00041 <title>REPORTE DE ".strtoupper($title)."</title>
00042 </head>
00043 <body bgcolor='white'>
00044 <div style='font-size:20px;font-family:Verdana;color:#000000'>".strtoupper($config->$active_app->name)."</div>\n
00045 <div style='font-size:18px;font-family:Verdana;color:#000000'>REPORTE DE ".strtoupper($title)."</div>\n
00046 <div style='font-size:18px;font-family:Verdana;color:#000000'>".date("Y-m-d")."</div>\n
00047 <br/>
00048 <table cellspacing='0' border=1 style='border:1px solid #969696'>
00049 ";
00050 $content.= "<tr bgcolor='#F2F2F2'>\n";
00051 for($i=0;$i<=count($headerArray)-1;$i++){
00052 $content.= "<th style='font-family:Verdana;font-size:12px'>".$headerArray[$i]."</th>\n";
00053 }
00054 $content.= "</tr>\n";
00055
00056 $l = 5;
00057 foreach($result as $row){
00058 $content.= "<tr bgcolor='white'>\n";
00059 for($i=0;$i<=count($row)-1;$i++){
00060 if(is_numeric($row[$i])){
00061 $content.= "<td style='font-family:Verdana;font-size:12px' align='center'>{$row[$i]}</td>";
00062 } else {
00063 $content.= "<td style='font-family:Verdana;font-size:12px'>{$row[$i]} </td>";
00064 }
00065 }
00066 $content.= "</tr>\n";
00067 $l++;
00068 }
00069
00070 file_put_contents("public/temp/$file.doc", $content);
00071 if(isset($raw_output)){
00072 print "<script type='text/javascript'> window.open('".KUMBIA_PATH."temp/".$file.".doc', null); </script>";
00073 } else {
00074 Generator::forms_print("<script type='text/javascript'> window.open('".KUMBIA_PATH."temp/".$file.".doc', null); </script>");
00075 }
00076
00077 }
00078
00079 ?>