Conjunto 9dbb666 en sipes
- Fecha y hora:
- 03/10/2017 11:01:51 (hace 7 años)
- Branches:
- stable
- Children:
- de509b8
- Parents:
- 6926c6e
- Ubicación:
- 0.3-modules/reportes_sipes_views
- Ficheros:
-
- 2 borrados
- 1 editado
Leyenda
- No modificado
- Añadido
- Eliminado
-
0.3-modules/reportes_sipes_views/reportes_sipes_views.module
r6926c6e r9dbb666 65 65 */ 66 66 function reporte_sipes_views_page() { 67 $content = '';68 67 $view_id = 'reporte_poan_anual'; 69 68 $view = views_get_view($view_id); … … 74 73 $view->execute(); 75 74 // $output = $view->render(); 76 75 $year = variable_get('proyectos_operativos_anho_creacion', 0); 76 $header = '<table border="1" cellpadding="4" style="text-align: justify">'; 77 $header .= '<tr>'; 78 $header .= '<th rowspan = "2" style="width: 5%; text-align: center">' . t('Cod.') . '</th>'; 79 $header .= '<th rowspan = "2" style="width: 10%; text-align: center">' . t('Nombre del Proyecto.') . '</th>'; 80 $header .= '<th rowspan = "2" style="width: 10%; text-align: center">' . t('Objetivo EspecÃfico del Proyecto') . '</th>'; 81 $header .= '<th rowspan = "2" style="width: 10%; text-align: center">' . t('Ejecutor') . '</th>'; 82 $header .= '<th rowspan = "2" style="width: 10%; text-align: center">' . t('Localización') . '</th>'; 83 $header .= '<th colspan = "2" style="width: 20%; text-align: center">' . t('Resultado de las Acciones Especificas del Proyecto @year', array('@year' => $year)) . '</th>'; 84 $header .= '<th colspan = "3" style="width: 35%; text-align: center">' . t('Asignación Presupuestaria @year (En Millones de Bolivares)', array('@year' => $year)) . '</th>'; 85 $header .= '</tr>'; 86 $header .= '<tr>'; 87 $header .= '<th style="text-align: center">' . t('Bien o Servicio') . '</th>'; 88 $header .= '<th style="text-align: center">' . t('Cantidad/Meta') . '</th>'; 89 $header .= '<th style="text-align: center">' . t('Fuente') . '</th>'; 90 $header .= '<th style="text-align: center">' . t('Monto') . '</th>'; 91 $header .= '<th style="text-align: center">' . t('Total') . '</th>'; 92 $header .= '</tr>'; 93 $plan_nombre = t('Plan Operativo Anual: @anho', array('@anho' => $year)); 94 $begin = ''; 95 $output = ''; 96 $nid = 0; 77 97 foreach ($view->result as $key => $values) { 78 $items[$values->node_ente_planificador_hierarchical_nid][] = $values; 79 } 80 81 //items 82 $html = ''; 83 foreach ($items as $nid => $item) { 84 $node = node_load($nid); 85 $output = '<p></p><p>' . t('Plan Operativo Anual: @anho', array('@anho' => 2018)) . '</p>'; 86 $output .= '<p>' . t('ORGANISMO RESPONSABLE: @ente', array('@ente' => $node->title)) . '</p>'; 87 88 $output .= '<table border="1" cellpadding="5">'; 89 $output .= '<tr><th style="width: 50px;">' . t('Cod.') . '</th>'; 90 $output .= '<th style="width: 100px;">' . t('Nombre del Proyecto') . '</th>'; 91 $output .= '<th style="width: 100px;">' . t('Objetivo EspecÃfico del Proyecto') . '</th>'; 92 $output .= '<th style="width: 100px;">' . t('Ejecutor') . '</th>'; 93 $output .= '<th style="width: 100px;">' . t('Localización') . '</th>'; 94 $output .= '<th style="width: 250px;">' . t('Resultado de las Acciones Especificas del Proyecto 2007') . '</th>'; 95 $output .= '<th style="width: 250px;">' . t('Asignación Presupuestaria 2007 (En Millones de Bolivares)') . '</th></tr>'; 96 97 98 foreach ($item as $id => $fields) { 99 $output .= '<tr>'; 100 //field codigo 101 $output .= '<td>'; 102 $output .= $fields->node_title; 103 $output .= '</td>'; 104 //nombre del proyecto 105 $output .= '<td>'; 106 $output .= $fields->node_data_field_proyecto_titulo_field_proyecto_titulo_value; 107 $output .= '</td>'; 108 //field objetivo 109 $output .= '<td>'; 110 $output .= $fields->node_data_field_proyecto_titulo_field_proyecto_og_value; 111 $output .= '</td>'; 112 //field ejecutor 113 $output .= '<td>'; 114 $output .= $fields->node_node_data_field_proyecto_ente_title; 115 $output .= '</td>'; 116 //field localizacion 117 // $ubicacion = '<ul>'; 118 foreach ($fields->views_php_6 as $id => $tid) { 119 $ubicacion .= '<p>' . $tid . '</p>'; 120 // $ubicacion .= '<li>' . $tid . '</li>'; 121 } 122 // $ubicacion .= '</ul>'; 123 $output .= '<td>'; 124 $output .= $ubicacion; 125 $output .= '</td>'; 126 127 //field resultados de las acciones especificas del proyecto 2018 128 $accion = '<table border="1" cellpadding="5">'; 129 $accion .= '<tr><th width="60%">' . t('Bien o Servicio') . '</th>'; 130 $accion .= '<th width="40%">' . t('Cantidad/Meta') . '</th></tr>'; 131 132 $accion .= '<tr>'; 133 $accion .= '<td>'; 134 // $accion .= '<ul>'; 135 foreach ($fields->views_php_7['bien'] as $name => $value) { 136 // $accion .= '<li>' . $value . '</li>'; 137 $accion .= '<p>' . $value . '</p>'; 138 } 139 // $accion .= '</ul>'; 140 $accion .= '</td>'; 141 142 $accion .= '<td>'; 143 // $accion .= '<ul>'; 144 foreach ($fields->views_php_7['unidades'] as $name => $value) { 145 //$accion .= '<li>' . $value . '</li>'; 146 $accion .= '<p>' . $value . '</p>'; 147 } 148 // $accion .= '</ul>'; 149 $accion .= '</td>'; 150 $accion .= '</tr>'; 151 $accion .= '</table>'; 152 153 $output .= '<td>'; 154 $output .= $accion; 155 $output .= '</td>'; 156 157 //asignacion presupuestaria 2018 158 159 $asignacion = '<table border="1" cellpadding="5">'; 160 $asignacion .= '<tr><th>' . t('Fuente') . '</th>'; 161 $asignacion .= '<th>'. t('Monto') . '</th>'; 162 $asignacion .= '<th>'. t('Total') . '</th></tr>'; 163 164 $asignacion .= '<tr>'; 165 $asignacion .= '<td>'; 166 // $asignacion .= '<td><ul>'; 167 foreach ($fields->views_php_10['fuentes'] as $id => $value) { 168 $asignacion .= '<p>' . $value . '</p>'; 169 // $asignacion .= '<li>' . $value . '</li>'; 170 } 171 $asignacion .= '</td>'; 172 //$asignacion .= '</ul></td>'; 173 $asignacion .= '<td>'; 174 //$asignacion .= '<td><ul>'; 175 foreach ($fields->views_php_10['valores'] as $id => $value) { 176 $asignacion .= '<p>' . $value . '</p>'; 177 // $asignacion .= '<li>' . $value . '</li>'; 178 } 179 //$asignacion .= '</ul></td>'; 180 $asignacion .= '</td>'; 181 $asignacion .= '<td>' . $fields->views_php_10['total'] . '</td>'; 182 $asignacion .= '</tr>'; 183 184 $asignacion .= '</table>'; 185 186 $output .= '<td>'; 187 $output .= $asignacion; 188 $output .= '</td>'; 189 $output .= '</tr>'; 190 98 if ($values->node_ente_planificador_hierarchical_nid != $nid) { 99 $output .= $begin . '<p></p><p>' . $plan_nombre . '<br>'; 100 $output .= t('ORGANISMO RESPONSABLE: @ente', array('@ente' => $values->node_ente_planificador_hierarchical_title)) . '</p>'; 101 $output .= $header; 102 $begin = '</table><br>'; 191 103 } 192 $output .= '</table>'; 193 $content .= $output; 194 } 195 196 $html .= '<br>' . $content; 197 //pdf 198 104 105 $output .= '<tr>'; 106 //field codigo 107 $output .= '<td>' . $values->node_title . '</td>'; 108 $output .= '<td>' . $values->node_data_field_proyecto_poan_field_proyecto_titulo_value . '</td>'; 109 $output .= '<td>' . $values->node_data_field_proyecto_poan_field_proyecto_og_value . '</td>'; 110 $output .= '<td>' . $values->node_node_data_field_proyecto_ente_title . '</td>'; 111 $output .= '<td>' . implode('<hr><br>', $values->views_php_6) . '</td>'; 112 $output .= '<td>' . implode('<hr><br>', $values->views_php_7['bien']) . '</td>'; 113 $output .= '<td>' . implode('<hr><br>', $values->views_php_7['unidades']) . '</td>'; 114 $output .= '<td>' . implode('<hr><br>', $values->views_php_10['fuentes']) . '</td>'; 115 $output .= '<td>' . implode('<hr><br>', $values->views_php_10['valores']) . '</td>'; 116 $output .= '<td align="center">' . $values->views_php_10['total'] . '</td>'; 117 $output .= '</tr>'; 118 } 119 $output .= $begin; 199 120 $author = variable_get('site_name', ''); 200 121 module_load_include('module', 'libraries', 'libraries'); … … 217 138 return FALSE; 218 139 } 140 219 141 // create new PDF documentsite_slogan 220 142 $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); … … 231 153 $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); 232 154 //set margins 233 // $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);155 $pdf->SetMargins(10, 17, 10); 234 156 $pdf->SetHeaderMargin(PDF_MARGIN_HEADER); 235 157 $pdf->SetFooterMargin(PDF_MARGIN_FOOTER); … … 242 164 // --------------------------------------------------------- 243 165 // set font 244 $pdf->SetFont('dejavusans', '', 8); 166 //$pdf->SetFont('dejavusans', '', 8); 167 $pdf->SetFont('times', '', 8); 245 168 // add a page 246 $pdf->AddPage();247 169 //$pdf->AddPage(); 170 $pdf->AddPage('L', 'Legal'); 248 171 if ($pdf) { 249 $title = 'Reporte Anual POAN 2018';172 $title = t('Reporte Anual POAN @year', array('@year' => $year)); 250 173 $pdf->SetTitle($title); 251 174 $pdf->SetSubject($title); 252 $pdf->writeHTML($ html, true, false, true, false, '');175 $pdf->writeHTML($output, true, false, true, false, ''); 253 176 $pdf->lastPage(); 254 177 header('Content-type: text/plain'); 255 $name = 'reporte_anual_poan_ 2018.pdf';178 $name = 'reporte_anual_poan_' . $year . '.pdf'; 256 179 header('Content-Disposition: attachment; filename="' . $name . '"'); 257 180 print $pdf->Output($name, 'I'); 258 181 } 259 182 260 return $ content;183 return $output; 261 184 } 262 263 264 185 265 186 /** … … 275 196 $view->pre_execute(); 276 197 $view->execute(); 198 $year = variable_get('proyectos_operativos_anho_creacion', 0); 277 199 // $output = $view->render(); 278 200 $header = '"' . t('Cod.') . '"' ."\t"; 201 $header .= '"' . t('Nombre del Proyecto') . '"' ."\t"; 202 $header .= '"' . t('Objetivo EspecÃfico del Proyecto') . '"' ."\t"; 203 $header .= '"' . t('Ejecutor') . '"' ."\t"; 204 $header .= '"' . t('Localización') . '"' ."\t"; 205 $header .= '"' . t('Resultado de las Acciones Especificas del Proyecto @year', array('@year' => $year)) . '"' ."\t"; 206 $header .="\t"; 207 $header .= '"' . t('Asignación Presupuestaria @year (En Millones de Bolivares)', array('@year' => $year)) . '"' ."\t"; 208 $header .="\t"; 209 $header .="\t"; 210 $header. "\n"; 211 $header .="\t"; 212 $header .="\t"; 213 $header .="\t"; 214 $header .="\t"; 215 $header .="\t"; 216 $header .= '"' . t('Bien o Servicio') . '"' ."\t"; 217 $header .= '"' . t('Cantidad/Meta') . '"' ."\t"; 218 $header .= '"' . t('Fuente') . '"' ."\t"; 219 $header .= '"' . t('Monto') . '"' ."\t"; 220 $header .= '"' . t('Total') . '"' ."\t"; 221 $header. "\n"; 222 $html = ''; 223 $nid = 0; 224 $output = ''; 279 225 foreach ($view->result as $key => $values) { 280 $items[$values->node_node_data_field_proyecto_ente__ente_planificador_hierar][] = $values; 281 } 282 283 //items 284 $html = ''; 285 foreach ($items as $nid => $item) { 286 $node = node_load($nid); 287 $content = ''; 288 $header = t('ORGANISMO RESPONSABLE: @ente', array('@ente' => $node->title)) . "\n"; 289 290 $header .= t('Cod.') . "\t" . t('Nombre del Proyecto') ."\t" . t('Objetivo EspecÃfico del Proyecto') ."\t" . t('Ejecutor') ."\t". t('Localización') . "\t". t('Resultado de las Acciones Especificas del Proyecto 2007') . "\t\t" . t('Asignación Presupuestaria 2007 (En Millones de Bolivares)') . "\r\n"; 291 $header .="\t" . "\t" . "\t". "\t". "\t". t('Bien o Servicio') . "\t". t('Cantidad/Meta') . "\t" . t('Fuente') . "\t". t('Monto') . "\t" . t("Total") . "\n"; 292 293 $Name = 'Reporte_UltimaCuotaPaga.csv'; 294 //Descarga el archivo desde el navegador 295 header('Expires: 0'); 296 header('Cache-control: private'); 297 header('Content-Type: application/x-octet-stream'); // Archivo de Excel 298 header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); 299 header('Content-Description: File Transfer'); 300 header('Last-Modified: '.date('D, d M Y H:i:s')); 301 header('Content-Disposition: attachment; filename="'.$Name.'"'); 302 header("Content-Transfer-Encoding: binary"); 303 304 $content = $header; 305 306 foreach ($item as $id => $fields) { 307 308 $content .= $fields->node_title . "\t" . $fields->node_data_field_proyecto_titulo_field_proyecto_titulo_value . "\t" . $fields->node_data_field_proyecto_titulo_field_proyecto_og_value . "\t" . $fields->node_node_data_field_proyecto_ente_title . "\t" . implode(', ', $fields->views_php_6) . "\t\n"; 309 $content .= "\t" . "\t" . "\t". "\t". "\t" . implode(', ', $fields->views_php_7['bien']) . "\t" . implode(', ', $fields->views_php_7['unidades']) . "\t" . implode(', ', $fields->views_php_10['fuentes']) . "\t" . implode(', ', $fields->views_php_10['valores']) . "\t" . $fields->views_php_10['total'] ."\n"; 310 311 $output .= $content . '\n'; 226 if ($values->node_ente_planificador_hierarchical_nid != $nid) { 227 $node = node_load($values->node_ente_planificador_hierarchical_nid); 228 $nid = $node->nid; 229 $header_organismo = '"'. t('ORGANISMO RESPONSABLE: @ente', array('@ente' => $node->title)) . '"' . "\n"; 230 $output .= $header_organismo . $header .$content; 231 $content = ''; 232 } 233 $content .= '"' . $values->node_title . '"' . "\t"; 234 $content .= '"' . $values->node_data_field_proyecto_titulo_field_proyecto_titulo_value . '"' . "\t"; 235 $content .= '"' . $values->node_data_field_proyecto_titulo_field_proyecto_og_value . '"' . "\t"; 236 $content .= '"' . $values->node_node_data_field_proyecto_ente_title . '"' . "\t"; 237 $content .= '"' . implode(', ', $values->views_php_6) . '"' . "\t"; 238 $content .= '"' . implode(', ', $values->views_php_7['bien']) . '"' . "\t"; 239 $content .= '"' . implode(', ', $values->views_php_7['unidades']) . '"' . "\t"; 240 $content .= '"' . implode(', ', $values->views_php_10['fuentes']) . '"' . "\t"; 241 $content .= '"' . implode(', ', $values->views_php_10['valores']) . '"' . "\t"; 242 $content .= '"' . implode(', ', $values->views_php_10['total']) . '"'; 243 $output .= $content . "\n"; 244 } 245 $Name = 'Reporte_UltimaCuotaPaga' . $year . '.csv'; 246 header('Expires: 0'); 247 header('Cache-control: private'); 248 header('Content-Type: application/x-octet-stream'); // Archivo de Excel 249 header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); 250 header('Content-Description: File Transfer'); 251 header('Last-Modified: '.date('D, d M Y H:i:s')); 252 header('Content-Disposition: attachment; filename="'.$Name.'"'); 253 header("Content-Transfer-Encoding: binary"); 254 print $output; 312 255 } 313 314 315 }316 print $output;317 }
Nota: Vea TracChangeset
para ayuda en el uso del visor de conjuntos de cambios.