Exemple #1
0
         echo json_encode($objtipo_unidad->updateDB());
         break;
     case 'del':
         $objtipo_unidad->setVar('id', $_POST['id']);
         echo json_encode($objtipo_unidad->deleteDB());
         break;
     case 'get':
         $res = $objtipo_unidad->searchDB($_POST['id'], 'id', 1);
         if (is_array($res)) {
             echo json_encode($res[0]);
         } else {
             echo json_encode(0);
         }
         break;
     case 'list':
         $res = $objtipo_unidad->listDB();
         if (is_array($res)) {
             echo json_encode($res);
         } else {
             echo json_encode(0);
         }
         break;
     case 'search':
         $res = $objtipo_unidad->searchDB($_POST['data'], $_POST['value'], $_POST['type']);
         if (is_array($res)) {
             echo json_encode($res);
         } else {
             echo json_encode(0);
         }
         break;
 }
<div class='control-group'>
    <label>Tipo Unidad</label>
    <select class='form-control' id='tipo_unidad' name='tipo_unidad'>
        <option value="0" <?php 
if (isset($_GET["tu"])) {
    if ($_GET["tu"] === "0") {
        echo " selected";
    }
}
?>
>Todas</option>
        <?php 
require_once 'nucleo/tipo_unidad.php';
$objtipo_unidad = new tipo_unidad();
$ltu = $objtipo_unidad->listDB();
if (is_array($ltu)) {
    foreach ($ltu as $tu) {
        echo '<option value="' . $tu["id"] . '"';
        if (isset($_GET["tu"])) {
            if ($_GET["tu"] === $tu["id"]) {
                echo " selected";
            }
        }
        echo '>' . $tu["nombre"] . '</option>';
    }
}
?>
    </select>
</div>
Exemple #3
0
</div>
<div class='control-group'>
    <label>Precio Variable</label>
    <input class='form-control' placeholder='0.00' id='precio_variable' name='precio_variable' type="number"/>
</div>
<div class='control-group'>
    <p></p>
    <button type='button' class='btn btn-primary' onclick='save()'>Guardar</button>
    <button type='reset' class='btn'>Limpiar</button>
</div>
</form>
<hr/>
<?php 
include_once 'nucleo/tipo_unidad.php';
$obj = new tipo_unidad();
$objs = $obj->listDB();
?>
<div class='contenedor-tabla'>
    <table id='tb' class='display' cellspacing='0' width='100%'>
        <thead>
            <tr>
                <th>Id</th><th>Nombre</th><th>Carga Minima</th><th>Carga Maxima</th><th>Precio Fijo</th><th>Precio Variable</th>
                <th>OPC</th>
            </tr>
        </thead>
        <tbody>
            <?php 
if (is_array($objs)) {
    foreach ($objs as $o) {
        ?>
                    <tr><td><?php