$sql_where .= " AND r.facturado = '" . $_GET["fac"] . "'";
    }
    if (isset($_GET["nfac"])) {
        if ($_GET["nfac"] !== "") {
            $sql_where .= " AND r.numero_facturacion = '" . $_GET["nfac"] . "'";
        }
    }
}
$col1 = 0;
$col2 = 0;
$col3 = 0;
$col4 = 0;
if (isset($_GET["fi"])) {
    $objunidad = new unidad();
    $uns = null;
    $pesos = $objunidad->consulta_arreglo("Select sum(r.peso_neto) as kil from registro r, configuracion_vehiculo cv, unidad u where r.id_configuracion_vehiculo = cv.id AND u.id = cv.id_unidad " . $sql_where);
    $total_mes = round(floatval($pesos["kil"]), 2);
    if (isset($_GET["tu"])) {
        if ($_GET["tu"] !== "0") {
            $uns = $objunidad->searchDB($_GET["tu"], "id_tipo_unidad");
        } else {
            $uns = $objunidad->listDB();
        }
    } else {
        $uns = $objunidad->listDB();
    }
    if (is_array($uns)) {
        foreach ($uns as $u) {
            echo "<tr>";
            echo "<td>" . $u["placa"] . "</td>";
            $objtu = new tipo_unidad();
 case 'mod':
     $objconfiguracion_vehiculo->setVar('id', $_POST['id']);
     $objconfiguracion_vehiculo->setVar('id_unidad', $_POST['id_unidad']);
     $objconfiguracion_vehiculo->setVar('fecha', $_POST['fecha']);
     echo json_encode($objconfiguracion_vehiculo->updateDB());
     break;
 case 'del':
     $objconfiguracion_vehiculo->setVar('id', $_POST['id']);
     echo json_encode($objconfiguracion_vehiculo->deleteDB());
     break;
 case 'get':
     $res = $objconfiguracion_vehiculo->searchDB($_POST['id'], 'id', 1);
     if (is_array($res)) {
         $res[0]['id_unidad'] = $objunidad->searchDB($res[0]['id_unidad'], 'id', 1);
         $res[0]['id_unidad'] = $res[0]['id_unidad'][0];
         $r1 = $objunidad->consulta_arreglo("Select * from tipo_unidad where id = '" . $res[0]["id_unidad"]["id_tipo_unidad"] . "'");
         $res[0]['tipo'] = $r1;
         $objacople = new acople();
         $acos = $objacople->consulta_matriz("Select a.placa,ta.nombre from acoples_configuracion ac, acople a, tipo_acople ta where ac.id_configuracion_vehiculo = '" . $res[0]["id"] . "' AND ac.id_acople = a.id AND a.id_tipo_acople = ta.id");
         $txt_acoples = "";
         if (is_array($acos)) {
             foreach ($acos as $ac) {
                 $txt_acoples .= "" . $ac["placa"] . "(" . $ac["nombre"] . "), ";
             }
         }
         $res[0]["acoples"] = $txt_acoples;
         echo json_encode($res[0]);
     } else {
         echo json_encode(0);
     }
     break;