Пример #1
0
 public static function printCarteraPorCliente($rowid_tercero, $id_sucursal)
 {
     include "custom/opalo/params/param_cartera_edades.php";
     $edades = $edades_cliente;
     $data = FnErp::getCarteraPorCliente($rowid_tercero, $id_sucursal);
     $html = "<table id='tablaCarteraCliente' class='table_toggle table table-striped table-bordered table-condensed' style='min-width:600px'><thead><tr class='info'>";
     $Totales = array(0 => 0, 1 => 0, 2 => 0, 3 => 0, 4 => 0, 5 => 0);
     for ($i = 0; $i <= count($edades) - 1; $i++) {
         if ($i == 0) {
             $html .= "<th>Documento</th>";
             $html .= "<th><= {$edades[$i]}</th>";
         } elseif ($i >= count($edades) - 1) {
             $html .= "<th>> {$edades[$i]}</th>";
         } else {
             $html .= "<th> <= {$edades[$i]}</th>";
         }
     }
     $html .= "</tr></thead><tbody>";
     foreach ($data as $key => $row) {
         $id = explode("&sep;", $key);
         $DOC = $id[1];
         $html .= "<tr>";
         $html .= "<td><b><i>" . date('Y/m/d', strtotime($id[0])) . ": </i></b> {$DOC}</td>";
         for ($i = 0; $i <= count($edades) - 1; $i++) {
             $html .= "<td style='text-align:right;'>\$ " . number_format($data[$key][$i], 2) . "</td>";
             $Totales[$i] += $data[$key][$i];
         }
         $html .= "</tr>";
     }
     $html .= "\n\t    </tbody>\n\t\t    <tfoot>\n\t\t\t    <tr class='text-right'>\n\t\t\t    \t<th style='text-align:left;'>\n\t\t\t    \t\t<b>Total:</b>\n\t\t    \t\t</th>\n\t\t    \t\t<th style='text-align:right;'>\n\t\t    \t\t\t\$ " . number_format($Totales[0], 2) . "\n\t\t    \t\t</th>\n\t\t    \t\t<th style='text-align:right;'>\n\t\t    \t\t\t\$ " . number_format($Totales[1], 2) . "\n\t\t    \t\t</th>\n\t\t    \t\t<th style='text-align:right;'>\n\t\t    \t\t\t\$ " . number_format($Totales[2], 2) . "\n\t\t    \t\t</th>\n\t\t    \t\t<th style='text-align:right;'>\n\t\t    \t\t\t\$ " . number_format($Totales[3], 2) . "\n\t\t    \t\t</th>\n\t\t    \t\t<th style='text-align:right;'>\n\t\t    \t\t\t\$ " . number_format($Totales[4], 2) . "\n\t\t    \t\t</th>\n    \t\t\t</tr>\n\t    \t</tfoot>\n\t    </table>";
     return $html;
 }