Beispiel #1
0
/**
 *
 * @param object $smarty objeto smarty.
 * @param array $arrCamposBloque arreglo con los campos.
 */
function getCamposTPL($arrCamposBloque, $arrItemsBloque, $arrTotales)
{
    /*
    echo "<pre>"; print_r($arrCamposBloque); echo "</pre>";
    echo "<pre>"; print_r($arrItemsBloque); echo "</pre>";
    echo "<pre>"; print_r($arrTotales); echo "</pre>";
    die;
    */
    $sContent = '<html>
                 <body>
				<script type="text/php">
				if ( isset($pdf) ) { 
			        $font = Font_Metrics::get_font("helvetica", "normal");    
			        $pdf->page_text(560, 26, "{PAGE_NUM}/{PAGE_COUNT}", $font, 12, array(0,0,0));
			        $font = Font_Metrics::get_font("sans-serif", "normal");
					$pdf->page_text(245, 25,"{CABECERA}", $font, 10, array(0,0,0),0,0,"' . $arrCamposBloque[1] . " " . $arrCamposBloque[2] . '");
				} 
				</script>
                 ';
    //----------------------------
    //divido observaciones en bloques de 2500 caracteres  las observaciones
    if (strlen($arrCamposBloque[21]) > 125) {
        $arrCamposBloque21 = wordwrap($arrCamposBloque[21], 125, "@@@@@");
        $arrCamposBloque21 = explode('@@@@@', $arrCamposBloque21);
    } else {
        $arrCamposBloque21 = 0;
    }
    //----------------------------
    /*echo "<pre>";
      print_r($arrCamposBloque21);
      echo "</pre>";die;*/
    if ($arrCamposBloque[30] != '') {
        $reemplaza_a = "(REEMPLAZA A {$arrCamposBloque['1']} {$arrCamposBloque['30']})";
    } else {
        $reemplaza_a = "";
    }
    $sContent .= "\n                <style type='text/css'>\n\t                body{\n\t                \tfont-size: 9pt;\n\t                \tfont-family: sans-serif;\n\t    \t\t\t}\n\t    \t\t\t.nume{\n\t    \t\t\t\t/*width: 10px;*/\n\t    \t\t\t\ttext-align: left;\n\t    \t\t\t}\n\t    \t\t\t.nume2{\n\t    \t\t\t\t/*width: 10px;*/\n\t    \t\t\t\ttext-align: right;\n\t    \t\t\t}\n                    .nume3{\n\t    \t\t\t\t/*width: 10px;*/\n                        text-align: left;\n\t    \t\t\t\tvertical-align:text-top;\n\t    \t\t\t}\n\t    \t\t\t.tabla{\n\t    \t\t\t\tpadding:0px 0px 0px 0px;\n\t    \t\t\t\tmargin:0px 0px 0px 0px;\n\t    \t\t\t}\n\t    \t\t\tTD{\n\t    \t\t\t\tpadding:0px 0px 0px 0px;\n\t    \t\t\t\tmargin:0px 0px 0px 0px;\n\t    \t\t\t}\n    \t\t\t</style>        \n                <div style='width:800px;margin:0 auto;' id='container'>\n                <table width='550'>\n                        <tr>\n                            <td colspan='1' align='right'><img src=" . getLogoLocation() . " width=\"610\" /><br /><br />{$arrCamposBloque['0']}</td>\n                        </tr>\n                        <tr>\n                            <td align='center' colspan='2'>{$arrCamposBloque['1']} {$arrCamposBloque['2']} {$reemplaza_a}</td>\n                        </tr>\n                </table>\n                \n                <!--datos generales-->                \n                \n                <table width='550' CELLPADDING='0'>\n                    <thead>\n                        <tr>\n                            <th colspan='4' align='left' height='10'>{$arrCamposBloque['3']}</th>\n                        </tr>\n                    </thead>\n                    <tbody>\n                    <tr>\n                        <td width='80'>Tomador:</td>\n                        <td>{$arrCamposBloque['4']}</td>\n                        <td width='80'>Asegurado:</td>\n                        <td>{$arrCamposBloque['5']}</td>\n                    </tr>\n                    <tr>\n                        <td width='80'>P&oacute;liza Nro:</td>\n                        <td>{$arrCamposBloque['6']}</td>\n                        <td width='80'>Certificado Nro:</td>\n                        <td>{$arrCamposBloque['7']}</td>\n                    </tr>\n                    <tr>\n                        <td width='80'>Nro. Siniestro:</td>\n                        <td>{$arrCamposBloque['8']}</td>\n                        <td width='80'>Fecha Ocurrencia:</td>\n                        <td>{$arrCamposBloque['9']}</td>\n                    </tr>\n                    <tr>\n                        <td>Analista:</td>\n                        <td>{$arrCamposBloque['10']}</td>\n                        <td></td>\n                        <td></td>\n                    </tr>\n                    </tbody>\n                    \n                </table>\n                \n                 <!--datos del vehiculo-->  \n                \n                <table width='600' CELLPADDING='0'>\n                    <thead>\n                        <tr>\n                            <th colspan='3' align='left' height='10'>{$arrCamposBloque['11']}</th>\n                        </tr>\n                    </thead>\n                    <tbody>\n                        <tr>\n                            <td width='50'><label>A&ntilde;o:</label></td>\n                            <td>{$arrCamposBloque['12']}</td>\n                            <td width='50'><label>Marca:</label></td>\n                            <td>{$arrCamposBloque['13']}</td>\n                        </tr>\n                        <tr>\n                            <td width='50'><label>Modelo:</label></td>\n                            <td>{$arrCamposBloque['14']}</td>\n                            <td width='50'><label>L&iacute;nea:</label></td>\n                            <td>{$arrCamposBloque['15']}</td>\n                        </tr>\n                        <tr>\n                            <td width='50'><label>Transmisi&oacute;n:</label></td>\n                            <td></td>\n                            <td width='50'><label>Placa:</label></td>\n                            <td>{$arrCamposBloque['17']}</td>\n                        </tr>\n                        <tr>\n                            <td width='50'><label>Serial:</label></td>\n                            <td>{$arrCamposBloque['19']}</td>\n                            <td width='50'><label></label></td>\n                            <td></td>\n                        </tr>\n                    </tbody>\n                </table>\n                \n                <!--datos de ajuste-->  \n        \n                <table width='550'>\n                    <thead>\n                        <tr>\n                            <th  align='left' height='10'>{$arrCamposBloque['20']}</th>\n                        </tr>\n                    </thead>\n                    <tbody>\n                        <tr>";
    if ($arrCamposBloque21 == 0) {
        $sContent .= "<td><strong>Observaciones:</strong><br />" . replaceBreakLine($arrCamposBloque[21]) . "</td></tr>";
    } else {
        $sContent .= "<td><strong>Observaciones:</strong><br /></td></tr>";
        for ($rds = 0; $rds < count($arrCamposBloque21); $rds++) {
            $sContent .= "<tr><td>" . replaceBreakLine($arrCamposBloque21[$rds]) . "</td></tr>";
        }
    }
    $sContent .= "\n                    </tbody>\n                </table>\n                \n                <!--datos proveedor-->\n                \n                <table width='550'>\n                    <thead>\n                        <tr>\n                            <th align='left' height='10' colspan='2'>{$arrCamposBloque['22']}</th>\n                        </tr>\n                    </thead>\n                    <tbody>\n                        <tr>\n                            <td  width='80'><label>Nombre:</label></td>\n                            <td><strong>{$arrCamposBloque['23']}</strong></td>\n                        </tr>\n                    </tbody>\n                </table>\n                \n                <!--sirvase...-->\n                \n                <table width='540'>\n                    <thead>\n                        <tr>\n                            <th align='left' colspan='2'>{$arrCamposBloque['24']}</th>\n                        </tr>\n                    </thead>\n                    <tbody>\n                        <tr>\n                            <td  width='80'><label>Nombre:</label></td>\n                            <td>{$arrCamposBloque['25']}</td>\n                        </tr>\n                        <tr>    \n                            <td  width='80'><label>Direcci&oacute;n:</label></td>\n                            <td>{$arrCamposBloque['26']}</td>\n                        </tr>\n                        <tr>\n                            <td  width='80'><label>Persona Contacto:</label></td>\n                            <td>{$arrCamposBloque['27']}</td>\n                        </tr>\n                        <tr>      \n                            <td  width='80'><label>Tel&eacute;fono:</label></td>\n                            <td>{$arrCamposBloque['28']}</td>\n                        </tr>\n                    </tbody>\n                </table>\n               \n                <!--  -->\n    \n                <table width='550'>\n                    <!--<thead><tr>-->\n                        <!--<tr><td><strong>{$arrCamposBloque['29']} PRUEBA5</strong></td></tr>-->\n                        <!--<td><strong>{$arrCamposBloque['30']}</strong></td>-->\n                       <!-- <td><strong>{$arrCamposBloque['31']}</strong></td>-->\n                    <!--</tr></thead>-->";
    /////////////
    for ($nroMO = 0; $nroMO < count($arrItemsBloque); $nroMO++) {
        $items = $arrItemsBloque[$nroMO];
        /*echo "<pre>";
          print_r($items);
          echo "</pre>";die;*/
        //------------
        //divido observaciones en bloques de 2500 caracteres  las observaciones
        $items[0] = "<strong>{$arrCamposBloque['29']} " . ($nroMO + 1) . ":</strong>" . $items[0];
        if (strlen($items[0]) > 125) {
            $itemSeg = wordwrap($items[0], 125, "@@@@@");
            $itemSeg = explode('@@@@@', $itemSeg);
        } else {
            $itemSeg = 0;
        }
        //------------
        if ($itemSeg == 0) {
            $sContent .= "<tr><td width='450'>" . replaceBreakLine($items[0]) . "</td></tr>";
        } else {
            // $sContent .= "<tr>
            //                   <td><table border=1 >";
            for ($rdx = 0; $rdx < count($itemSeg); $rdx++) {
                if ($rdx == 0) {
                    $sContent .= "<tr><td width='500'>" . replaceBreakLine($itemSeg[$rdx]) . "</td></tr>";
                } else {
                    $sContent .= "<tr><td width='500'>" . replaceBreakLine($itemSeg[$rdx]) . "</td></tr>";
                }
            }
        }
        $sContent .= "<tr><td class='nume' width='50'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\n                                              Total {$arrCamposBloque['29']} " . ($nroMO + 1) . "......................................................................................\n                                              BsF " . replaceBreakLine($items[1]) . "</td></tr>\n                                              <tr><td>&nbsp;&nbsp;&nbsp;</td></tr>";
        //------------
    }
    ////////////////
    /*foreach($arrItemsBloque as $items){
          $sContent .= "<tr>";
          if ($i++ % 2 == 0) { foreach($items as $item){ if ($i2++ == 1) {  $sContent .= "";$i3=0;//"<td class='nume2' style='background-color:#DDDDDD;' ><!--".replaceBreakLine($item)."--></td>";   }
                  else{  $sContent .= "<td class='nume' width='550'>".replaceBreakLine($item)."</td>";$i3=0;  }  }  
              } else{ foreach($items as $item){ if ($i3++ != 1) {  $sContent .= "<td class='nume' width='550'>".replaceBreakLine($item)."</td>";$i2=0;  }
                  else{ $sContent .= "";$i2=0;//"<td class='nume2'><!--".replaceBreakLine($item)."--></td>";$i2=0;  } } }
          
          $sContent .= "<td class='nume' width='550'>".replaceBreakLine($item)."</td>";
          $sContent .= "</tr>";                        
      }*/
    $sContent .= "</table>";
    $sContent .= "<BR>\n                \t\t<table><tr><td>\n                \t\t\t<table width='200' height='500'>\n                                <tr>\n                                    <td colspan='2' height='20'></td>\n                                </tr>\n                                <tr>\n                                    <td>{$arrTotales['0']}</td>\n                                    <td class='nume2'>" . replaceBreakLine($arrTotales[6]) . "</td>\n                                </tr>\n                                <tr>\n                                    <td>{$arrTotales['1']}</td>\n                                    <td class='nume2'>" . replaceBreakLine($arrTotales[7]) . "</td>\n                                </tr>\n                                <tr>\n                                    <td>{$arrTotales['2']}</td>\n                                    <td class='nume2'>" . replaceBreakLine($arrTotales[8]) . "</td>\n                                </tr>\n                                <tr>\n                                    <td>{$arrTotales['3']}</td>\n                                    <td class='nume2'>" . replaceBreakLine($arrTotales[9]) . "</td>\n                                </tr>\n                                <tr>\n                                    <td>{$arrTotales['4']}</td>\n                                    <td class='nume2'>" . replaceBreakLine($arrTotales[10]) . "</td>\n                                </tr>\n                                <tr>\n                                    <td>{$arrTotales['5']}</td>\n                                    <td class='nume2'>" . replaceBreakLine($arrTotales[11]) . "</td>\n                                </tr>\n                            </table>\n\t\t\t\t\t\t</td></tr></table>\n\t\t\t\t\t\t<table width='550' align='center'><tr><td align='center'>\n                            <table width='420'>    \n                            <tr>\n                            \t<td align='center'><img src=" . getSingLocation() . " width=\"60\" /><br />" . replaceBreakLine($arrTotales[13]) . "</td>\n                            </tr>\n                            </table>\n\t\t\t\t\t\t</td></tr></table>\n                            ";
    $sContent .= "</div></body></html>";
    return $sContent;
}
Beispiel #2
0
/**
 *
 * @param object $smarty objeto smarty.
 * @param array $arrCamposBloque arreglo con los campos.
 */
function getCamposTPL($arrCamposBloque, $arrItemsBloque, $arrTotales)
{
    $sContent = '<html>
                 <body>
                 <script type="text/php">
					if ( isset($pdf) ) { 
						$font = Font_Metrics::get_font("helvetica", "normal");    
						$pdf->page_text(560, 26, "{PAGE_NUM}/{PAGE_COUNT}", $font, 12, array(0,0,0));
						//Agrego los datos de la cabecera, en la primer pagina no se muestran
						$font = Font_Metrics::get_font("sans-serif", "normal");
						$pdf->page_text(245, 25,"{CABECERA}", $font, 10, array(0,0,0),0,0,"' . $arrCamposBloque[1] . " " . $arrCamposBloque[2] . '");
					} 
				</script>
                 ';
    //----------------------------
    //divido observaciones en bloques de 2500 caracteres  las observaciones
    if (strlen($arrCamposBloque[21]) > 125) {
        $arrCamposBloque21 = wordwrap($arrCamposBloque[21], 125, "@@@@@");
        $arrCamposBloque21 = explode('@@@@@', $arrCamposBloque21);
    } else {
        $arrCamposBloque21 = 0;
    }
    //----------------------------
    /*echo "<pre>";
      print_r($arrCamposBloque21);
      echo "</pre>";die;*/
    if ($arrCamposBloque[32] != '') {
        $reemplaza_a = "(REEMPLAZA A {$arrCamposBloque['1']} {$arrCamposBloque['32']})";
    } else {
        $reemplaza_a = "";
    }
    $sContent .= "\n                <style type='text/css'>\n                \tbody{\n                \t\tfont-size: 9pt;\n                \t\tfont-family: sans-serif;\n    \t\t\t\t}\n    \t\t\t\t.nume{\n    \t\t\t\t\ttext-align: right;\n    \t\t\t\t}\n    \t\t\t</style>        \n                <div style='width:800px;margin:0 auto;' id='container'>\n                <table width='550'>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td colspan='1' align='right'><img src=" . getLogoLocation() . " width=\"610\" /><br /><br />{$arrCamposBloque['0']}</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td align='center' colspan='2'>{$arrCamposBloque['1']} {$arrCamposBloque['2']} {$reemplaza_a}</td>\n\t\t\t\t\t</tr>\n                </table>\n                \n                <table width='550' CELLPADDING='0'>\n                    <thead>\n                        <tr>\n                            <th colspan='4' align='left' height='10'>{$arrCamposBloque['3']}</th>\n                        </tr>\n                    </thead>\n                    <tbody>\n                    <tr>\n                        <td  width='80'><label>Tomador:</label></td>\n                        <td>{$arrCamposBloque['4']}</td>\n                        <td  width='80'><label>Asegurado:</label></td>\n                        <td>{$arrCamposBloque['5']}</td>\n                    </tr>\n                    <tr>\n                        <td  width='80'><label>P&oacute;liza:</label></td>\n                        <td>{$arrCamposBloque['6']}</td>\n                        <td  width='80'><label>Certificado Nro:</label></td>\n                        <td>{$arrCamposBloque['7']}</td>\n                    </tr>\n                    <tr>\n                        <td  width='80'><label>Nro. Siniestro:</label></td>\n                        <td>{$arrCamposBloque['8']}</td>\n                        <td  width='80'><label>Fecha Ocurrencia:</label></td>\n                        <td>{$arrCamposBloque['9']}</td>\n                    </tr>\n                    <tr>\n                        <td><label>Analista:</label></td>\n                        <td>{$arrCamposBloque['10']}</td>\n                    </tr>\n                    </tbody>\n                </table>\n                <table width='600' CELLPADDING='0'>\n                    <thead>\n                        <tr>\n                            <th colspan='3' align='left' height='10'>{$arrCamposBloque['11']}</th>\n                        </tr>\n                    </thead>\n                        <tbody>\n                            <tr>\n                                <td width='50'><label>A&ntilde;o:</label></td>\n                                <td>{$arrCamposBloque['12']}</td>\n                                <td width='50'><label>Marca:</label></td>\n                                <td>{$arrCamposBloque['13']}</td>\n                            </tr>\n                            <tr>\n                                <td width='50'><label>Modelo:</label></td>\n                                <td>{$arrCamposBloque['14']}</td>\n                                <td width='50'><label>L&iacute;nea:</label></td>\n                                <td>{$arrCamposBloque['15']}</td>\n                            </tr>\n                            <tr>\n                                <td width='50'><label>Transmisi&oacute;n:</label></td>\n                                <td></td>\n                                <td width='50'><label>Placa:</label></td>\n                                <td>{$arrCamposBloque['17']}</td>\n                            </tr>\n                            <tr>\n                                <td width='50'><label>Serial:</label></td>\n                                <td>{$arrCamposBloque['19']}</td>\n                                <td width='50'><label></label></td>\n                                <td></td>\n                            </tr>\n                        </tbody>\n                    </table>\n                \n        \n\t\t\t\t<table width='550'>\n\t\t\t\t\t<thead>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<th  align='left' height='10'>{$arrCamposBloque['20']}</th>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</thead>\n\t\t\t\t\t<tbody>\n\t\t\t\t\t\t<tr>";
    if ($arrCamposBloque21 == 0) {
        $sContent .= "<td><strong>Observaciones:</strong><br />" . replaceBreakLine($arrCamposBloque[21]) . "</td></tr>";
    } else {
        $sContent .= "<td><strong>Observaciones:</strong><br /></td></tr>";
        for ($rds = 0; $rds < count($arrCamposBloque21); $rds++) {
            $sContent .= "<tr><td>" . replaceBreakLine($arrCamposBloque21[$rds]) . "</td></tr>";
        }
    }
    $sContent .= "\n                    </tbody>\n \t\t\t\t</table>\n        \n                <table width='600'>\n                    <thead>\n                        <tr>\n                            <th align='left' height='10' colspan='2'>{$arrCamposBloque['22']}</th>\n                        </tr>\n                    </thead>\n                    <tbody>\n                        <tr>\n                            <td  width='80'><label>Nombre:</label></td>\n                            <td><strong>{$arrCamposBloque['23']}</strong></td>\n                        </tr>\n                    </tbody>\n                </table>\n        \n                <table width='540'>\n                    <thead>\n                        <tr>\n                            <th align='left' colspan='2'>{$arrCamposBloque['24']}</th>\n                        </tr>\n                    </thead>\n                    <tbody>\n                        <tr>\n                            <td  width='80'><label>Nombre:</label></td>\n                            <td>{$arrCamposBloque['25']}</td>\n                        </tr>\n                        <tr>    \n                            <td  width='80'><label>Direcci&oacute;n:</label></td>\n                            <td>{$arrCamposBloque['26']}</td>\n                        </tr>\n                        <tr>\n                            <td  width='80'><label>Persona Contacto:</label></td>\n                            <td>{$arrCamposBloque['27']}</td>\n                        </tr>\n                        <tr>      \n                            <td  width='80'><label>Tel&eacute;fono:</label></td>\n                            <td>{$arrCamposBloque['28']}</td>\n                        </tr>\n                    </tbody>\n                </table>\n\n                <table width='400'>\n                    <thead><tr>\n                        <td width='50'><strong>{$arrCamposBloque['29']}</strong></td>\n                        <td><strong>{$arrCamposBloque['30']}</strong></td>\n                         <td class='nume' width='60'><strong>{$arrCamposBloque['31']}</strong></td>\n                    </tr></thead>";
    foreach ($arrItemsBloque as $items) {
        $sContent .= "<tbody><tr>";
        if ($i++ % 2 == 0) {
            foreach ($items as $item) {
                $i2++;
                if ($i2 == 1 || $i2 == 2) {
                    $sContent .= "<td>{$item}</td>";
                    $i3 = 0;
                } else {
                    $sContent .= "<td class='nume'>{$item}</td>";
                    $i3 = 0;
                }
            }
        } else {
            foreach ($items as $item) {
                $i3++;
                if ($i3 == 1 || $i3 == 2) {
                    $sContent .= "<td>{$item}</td>";
                    $i2 = 0;
                } else {
                    $sContent .= "<td class='nume'>{$item}</td>";
                    $i2 = 0;
                }
            }
        }
        $sContent .= "</tr></tbody>";
    }
    $sContent .= "</table>";
    $sContent .= "<BR>\n                \t\t<table><tr><td>\n                \t\t\t<table width='200' height='500'>\n                                <tr>\n                                    <td colspan='2' height='20'></td>\n                                    \n                                </tr>\n                                <tr>\n                                    <td>{$arrTotales['0']}</td>\n                                    <td class='nume'>" . replaceBreakLine($arrTotales[5]) . "</td>\n                                </tr>\n                                <tr>\n                                    <td>{$arrTotales['1']}</td>\n                                    <td class='nume'>" . replaceBreakLine($arrTotales[6]) . "</td>\n                                </tr>\n                                <tr>\n                                    <td>{$arrTotales['2']}</td>\n                                    <td class='nume'>" . replaceBreakLine($arrTotales[7]) . "</td>\n                                </tr>\n                                <tr>\n                                    <td>{$arrTotales['3']}</td>\n                                    <td class='nume'>" . replaceBreakLine($arrTotales[8]) . "</td>\n                                </tr>\n                                <tr>\n                                    <td>{$arrTotales['4']}</td>\n                                    <td class='nume'>" . replaceBreakLine($arrTotales[9]) . "</td>\n                                </tr>\n                            </table>\n\t\t\t\t\t\t</td></tr></table>\n\t\t\t\t\t\t<table width='550' align='center'><tr><td align='center'>\n                            <table width='400'> \n                            \t<tr>\n                                    <td align='center'><img src=" . getSingLocation() . " width=\"60\" /><br />" . replaceBreakLine($arrTotales[10]) . "</td>\n                                </tr>\n                            </table>\n\t\t\t\t\t\t</td></tr></table>";
    $sContent .= '</div></body></html>';
    return $sContent;
}