<?php //carica report html $module_name = "Cespiti"; $search_numero = $html->form('search_numero'); $search_descrizione = $html->form('search_descrizione'); $search_gruppo = $html->form('search_gruppo'); $search_stato = $html->form('search_stato'); if( $search_stato <> '' ){ $query = "SELECT id from ms_cespitistati WHERE descrizione LIKE \"%".$search_stato."%\""; $rsit = $dbo->fetchArray($query); $add_where = " AND idtipocespite='".$rsit[0]['id']."'"; } if( $search_gruppo <> '' ){ $query = "SELECT id from ms_cespitigruppo WHERE descrizione LIKE \"%".$search_gruppo."%\""; $rsit = $dbo->fetchArray($query); $add_where = " AND idgruppocespite='".$rsit[0]['id']."'"; } if( $search_descrizione <> '' ){ $add_where = " AND descrizione like \"%".$search_descrizione."%\""; } include_once( "pdfgen_variables.php" ); $rs=$dbo->fetcharray("select numero, data , ms_cespiti.descrizione as cespite , ms_cespitigruppo.descrizione as des_gruppo , ms_cespitistati.descrizione as des_stato from ms_cespiti left join ms_cespitigruppo on ms_cespitigruppo.id=ms_cespiti.idgruppocespite left join ms_cespitistati on ms_cespitistati.id=ms_cespiti.idtipocespite WHERE CAST(data AS DATE) >= '".$_SESSION['period_start']."' AND CAST(data AS DATE) <= '".$_SESSION['period_end']."' ".$add_where); $report = file_get_contents ($docroot."/templates/cespiti/cespiti.html"); $body = file_get_contents ($docroot."/templates/cespiti/cespiti_body.html"); $totrows = sizeof($rs); $body .= "<h3>Elenco Cespiti ".date("d/m/Y")."</h3>\n"; $body .= "<table cellspacing='0' style='table-layout:fixed;'>\n"; $body .= "<col width='100'><col width='80'><col width='300'><col width='200'><col width='100'>\n"; $body .= "<tr>\n"; $body .= "<th bgcolor='#dddddd' class='full_cell1 cell-padded'>Numero</th>\n"; $body .= "<th bgcolor='#dddddd' class='full_cell cell-padded'>Data</th>\n"; $body .= "<th bgcolor='#dddddd' class='full_cell cell-padded'>Cespite</th>\n"; $body .= "<th bgcolor='#dddddd' class='full_cell cell-padded'>Gruppo</th>\n"; $body .= "<th bgcolor='#dddddd' class='full_cell cell-padded'>Stato</th>\n"; $body .= "</tr>\n"; for( $r=0; $r<sizeof($rs); $r++ ){ $body .= "<tr>\n"; $body .= " <td class='first_cell cell-padded'>".$rs[$r]['numero']."</td>\n"; $body .= " <td class='table_cell cell-padded'>".date("d/m/Y", strtotime($rs[$r]['data']) )."</td>\n"; $body .= " <td class='table_cell cell-padded'>".$rs[$r]['cespite']."</td>\n"; $body .= " <td class='table_cell cell-padded'>".$rs[$r]['des_gruppo']."</td>\n"; $body .= " <td class='table_cell cell-padded'>".$rs[$r]['des_stato']."</td>\n"; $body .= "</tr>\n"; } $body .= "</table>\n"; $orientation = "L"; $report_name = "cespiti.pdf"; ?>