
MOSTRAR REPORTE EN FORMA HORIZONTAL
Publicado por anonymous (23 intervenciones) el 05/03/2015 17:00:52
BUENOS DIAS AMIGO TENGO UN PROBLEMITA HAGO UN REPORTE EN UN PROYECTO CON PHP Y POSTGRE DONDE EN EL MODULO DE REPORTE, ESPECIFICAMENTE DETALLADO MENSUAL DE RETENCIONES POR CUENTAS ME SALE EN VERTICAL AQUI EL CODIGO QUE HAGO MAL? ESPERO PUEDAN AYUDARME ADJUNTE LA IMAGEN DE COMO SE VE LOS NUMEROS DEBEN SALIR ABAJO EJEMPLO:
ESTADO / CIERRE DE CICLO / INICIAR Y CULMINAR EN 2015
AMAZONAS / 2 3
TACHIRA / 2 6
APURE / 3 9
MERIDA / 6 4
Y ASI SUCESIVAMENTE SE DEBEN MOSTRAR TODAS EN HORIZONTAL ASI EN FILAS
DESPUES OTRA NO COMO EN EL PRINT AHI ESTAN LOS 3 ARCHIVOS CON LOS Q ESTOY TRABAJANDO
2 ARCHIVO
3 ARCHIVO
ESTADO / CIERRE DE CICLO / INICIAR Y CULMINAR EN 2015
AMAZONAS / 2 3
TACHIRA / 2 6
APURE / 3 9
MERIDA / 6 4
Y ASI SUCESIVAMENTE SE DEBEN MOSTRAR TODAS EN HORIZONTAL ASI EN FILAS
DESPUES OTRA NO COMO EN EL PRINT AHI ESTAN LOS 3 ARCHIVOS CON LOS Q ESTOY TRABAJANDO
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
define('FPDF_FONTPATH','../font/');
require('mc_table_estado.php');
$pdf=new PDF_MC_Table('P','mm','letter');
$pdf->Open();
$pdf->AddPage();
$pdf->AliasNbPages();
$pdf->SetWidths(array(260));
$pdf->SetFont('Arial','B',11);
//$pdf->Cell(260,8,'DISTRIBUCION DE MATERIALES POR SISTEMA CONSTRUCTIVO',0,0,'C');
$pdf->Ln(15);
$pdf->SetFillColor(255,0,0);
$pdf->SetTextColor(255);
$pdf->SetFont('Arial','B',6);
$pdf->SetAligns(array('C','L','C','C','R','R','C'));
$pdf->SetWidths(array(15,105,50,20,25,25,20));
$pdf->SetDrawColor(0,0,0);
// $pdf->Row(array("Presidencial",utf8_decode("Descripción"),utf8_decode("Nº Pto Cta"),utf8_decode("Fecha Aprb."),"Monto Bs. (MM.)"));
$pdf->SetFont('Arial','',6);
$pdf->SetFillColor(255,255,255);
$pdf->SetTextColor(0);
include '../home/connect.php';
$result=pg_query("
SELECT e.nombre,SUM(ec.viviendas_totales) as viviendas,f.fase FROM estado e
join estructura_constructiva ec ON ec.estado_id=e.id
join fase f ON f.idfase= ec.fase_id
WHERE ec.eliminar=0
GROUP BY e.nombre, f.fase");
// $pdf->Ln(15);
$total = pg_num_rows($result);
$estado=0;
while($row = pg_fetch_array($result))
{
$id=$row['id'];
$nombre=$row['nombre'];
$viviendas=$row['viviendas'];
if($id==$id){
$pdf->Row(array($nombre,$viviendas));
}
}
//$pdf->SetFont('Arial','B',8);
// $pdf->Cell(20,6,'Total de registros: '.$total,0);
$pdf->Output();
?>
2 ARCHIVO
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
<?php
require('../home/fpdf.php');
class PDF_MC_Table extends FPDF
{
var $widths;
var $aligns;
//Cabecera de página
function Header()
{
//Logo
$this->Image('../img/banner_osvh.png',10,6,100);
$this->Image('../img/logo_gmvv.png',180,6,17);
$this->Ln(20);
$this->SetFont('Arial','B',10);
$this->Cell(200,5,'DISTRIBUCIÓN DE VIVIENDAS TOTALES POR ESTADO 2015',0,'','C');
$this->Ln(10);
//Primera linea
$this->SetFont('Arial','B',8);
$this->Cell(60,6,'','LT','0','J');
$this->SetFont('Arial','B',8);
$this->Cell(135,6,'TOTALES ',"1",'1','C');
//Segunda linea
$this->SetFont('Arial','',8);
$this->Cell(60,5,'',"LR",'0','L');
$this->SetFont('Arial','B',8);
$this->Cell(22.5,5,'',"LR",'0','C');
$this->SetFont('Arial','B',8);
$this->Cell(22.5,5,'',"LR",'0','C');
$this->SetFont('Arial','',8);
$this->Cell(22.5,5,'',"LR",'0','L');
$this->SetFont('Arial','',8);
$this->Cell(22.5,5,'',"LR",'0','L');
$this->SetFont('Arial','',8);
$this->Cell(22.5,5,'',"LR",'0','L');
$this->SetFont('Arial','',8);
$this->Cell(22.5,5,'',"LR",'0','L');
$this->SetFont('Arial','',8);
$this->Cell(22.5,5,'',"LR",'1','L');
//TERCERA LINEA
$this->SetFont('Arial','B',10);
$this->Cell(60,5,'ESTADO',"LR",'0','C');
$this->SetFont('Arial','B',8);
$this->Cell(22.5,4,'Cierre',"LR",'0','C');
$this->SetFont('Arial','B',8);
$this->Cell(22.5,4,'Iniciar y',"LR",'0','C');
$this->SetFont('Arial','B',8);
$this->Cell(22.5,4,'Iniciar en 2015',"LR",'0','C');
$this->SetFont('Arial','B',8);
$this->Cell(22.5,4,'Sector',"LR",'0','C');
$this->SetFont('Arial','B',8);
$this->Cell(22.5,4,'',"LR",'0','C');
$this->SetFont('Arial','B',8);
$this->Cell(22.5,4,'',"LR",'0','C');
$this->SetFont('Arial','B',8);
$this->Cell(22.5,4,'',"LR",'1','C');
//CUARTA LINEA
$this->SetFont('Arial','',8);
$this->Cell(60,5,'',"LR",'0','L');
$this->SetFont('Arial','B',8);
$this->Cell(22.5,4,'de',"LR",'0','C');
$this->SetFont('Arial','B',8);
$this->Cell(22.5,4,'culminar en',"LR",'0','C');
$this->SetFont('Arial','B',8);
$this->Cell(22.5,4,'y culminar',"LR",'0','C');
$this->SetFont('Arial','B',8);
$this->Cell(22.5,4,'privado',"LR",'0','C');
$this->SetFont('Arial','B',8);
$this->Cell(22.5,4,'TOTAL',"LR",'0','C');
$this->SetFont('Arial','B',8);
$this->Cell(22.5,4,'%',"LR",'1','C');
// QUINTA LINEA
$this->SetFont('Arial','',8);
$this->Cell(60,5,'',"LR",'0','L');
$this->SetFont('Arial','B',8);
$this->Cell(22.5,5,'ciclos',"LR",'0','C');
$this->SetFont('Arial','B',8);
$this->Cell(22.5,5,'2015',"LR",'0','C');
$this->SetFont('Arial','B',8);
$this->Cell(22.5,5,'en 2016',"LR",'0','C');
$this->SetFont('Arial','B',8);
$this->Cell(22.5,5,'',"LR",'0','L');
$this->SetFont('Arial','B',8);
$this->Cell(22.5,5,'',"LR",'0','L');
$this->SetFont('Arial','',8);
$this->Cell(22.5,5,'',"LR",'0','L');
$this->SetFont('Arial','',8);
$this->Cell(22.5,5,'',"LR",'1','L');
//6 linea
$this->SetFont('Arial','',8);
$this->Cell(60,5,'',"LRB",'0','L');
$this->SetFont('Arial','B',8);
$this->Cell(22.5,5,'',"LRB",'0','C');
$this->SetFont('Arial','B',8);
$this->Cell(22.5,5,'',"LRB",'0','C');
$this->SetFont('Arial','',8);
$this->Cell(22.5,5,'',"LRB",'0','L');
$this->SetFont('Arial','',8);
$this->Cell(22.5,5,'',"LRB",'0','L');
$this->SetFont('Arial','',8);
$this->Cell(22.5,5,'',"LRB",'0','L');
$this->SetFont('Arial','',8);
$this->Cell(22.5,5,'',"LRB",'1','L');
}
//Pie de página
function Footer()
{
//Posición: a 1,5 cm del final
$this->SetY(-20);
//Arial italic 8
$this->SetFont('Arial','',7);
//Número de página
$this->Cell(0,10,date('d/m/Y'),0,0,'L');
$this->Cell(0,10,'Página '.$this->PageNo().'/{nb}',0,0,'R');
}
function SetWidths($w)
{
//Set the array of column widths
$this->widths=$w;
}
function SetAligns($a)
{
//Set the array of column alignments
$this->aligns=$a;
}
function Row($data)
{
//Calculate the height of the row
$nb=0;
for($i=0;$i<count($data);$i++)
$nb=max($nb,$this->NbLines($this->widths[$i],$data[$i]));
$h=5*$nb;
//Issue a page break first if needed
$this->CheckPageBreak($h);
//Draw the cells of the row
for($i=0;$i<count($data);$i++)
{
$w=$this->widths[$i];
$a=isset($this->aligns[$i]) ? $this->aligns[$i] : 'L';
//Save the current position
$x=$this->GetX();
$y=$this->GetY();
//Draw the border
$this->Rect($x,$y,$w,$h);
//Print the text
$this->MultiCell($w,5,$data[$i],0,$a,true);
//Put the position to the right of the cell
$this->SetXY($x+$w,$y);
}
//Go to the next line
$this->Ln($h);
}
function Row2($data)
{
//Calculate the height of the row
$nb=0;
for($i=0;$i<count($data);$i++)
$nb=max($nb,$this->NbLines($this->widths[$i],$data[$i]));
$h=5*$nb;
//Issue a page break first if needed
$this->CheckPageBreak($h);
//Draw the cells of the row
for($i=0;$i<count($data);$i++)
{
$w=$this->widths[$i];
$a=isset($this->aligns[$i]) ? $this->aligns[$i] : 'L';
//Save the current position
$x=$this->GetX();
$y=$this->GetY();
//Draw the border
//$this->Rect($x,$y,$w,$h);
//Print the text
$this->MultiCell($w,5,$data[$i],0,$a,true);
//Put the position to the right of the cell
$this->SetXY($x+$w,$y);
}
//Go to the next line
$this->Ln($h);
}
function CheckPageBreak($h)
{
//If the height h would cause an overflow, add a new page immediately
if($this->GetY()+$h>$this->PageBreakTrigger)
$this->AddPage($this->CurOrientation);
}
function NbLines($w,$txt)
{
//Computes the number of lines a MultiCell of width w will take
$cw=&$this->CurrentFont['cw'];
if($w==0)
$w=$this->w-$this->rMargin-$this->x;
$wmax=($w-2*$this->cMargin)*1000/$this->FontSize;
$s=str_replace("\r",'',$txt);
$nb=strlen($s);
if($nb>0 and $s[$nb-1]=="\n")
$nb--;
$sep=-1;
$i=0;
$j=0;
$l=0;
$nl=1;
while($i<$nb)
{
$c=$s[$i];
if($c=="\n")
{
$i++;
$sep=-1;
$j=$i;
$l=0;
$nl++;
continue;
}
if($c==' ')
$sep=$i;
$l+=$cw[$c];
if($l>$wmax)
{
if($sep==-1)
{
if($i==$j)
$i++;
}
else
$i=$sep+1;
$sep=-1;
$j=$i;
$l=0;
$nl++;
}
else
$i++;
}
return $nl;
}
}
?>
3 ARCHIVO
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<script type="text/javascript">
function valiarestado(){
$('#fm_report002').form('submit',{
onSubmit: function(){
return $(this).form('validate');
},
success: function(){
//var idcuenta002 = $('#idcuenta002').combogrid('getValue');
// var fecha_ini02 = $('#fecha_ini02').datebox('getValue');
// var fecha_fin02 = $('#fecha_fin02').datebox('getValue');
var url2 = 'report_todoestado.php?';
window.open(url2,'Resumen de Retenciones por Cuentas','height=600,width=800');
}
});
}
</script>
<div id="p" title="Detallado Mensual de Retenciones por Cuentas" class="easyui-panel" style="height:80px; width:100%;padding:10px;background:#fafafa;">
<form id="fm_report002" method="post" novalidate>
<div style="float:right;"><a id="btnprint_report002" class="easyui-linkbutton" iconCls="icon-print" onclick="valiarestado()">Imprimir</a></div>
</form>
</div>
Valora esta pregunta


0