} $query = mysqli_query($conn, $sql) or die("02"); $totalFiltered = mysqli_num_rows($query); // when there is a search parameter then we have to modify total number filtered rows as per search result. $sql .= " ORDER BY " . (intval($requestData['order'][0]['column']) + 1) . " " . $requestData['order'][0]['dir'] . " LIMIT " . $requestData['start'] . " ," . $requestData['length'] . " "; // print $sql; /* $requestData['order'][0]['column'] contains colmun index, $requestData['order'][0]['dir'] contains order such as asc/desc */ $query = mysqli_query($conn, $sql) or die("03"); // esto es para decir cuando no se puede $editar $data = array(); while ($row = mysqli_fetch_array($query)) { $nestedData = array(); $nestedData[] = utf8_encode($row['producto']); $nestedData[] = utf8_encode($row['cliente_tipo']); $nestedData[] = utf8_encode($row['cliente_nombre']); $tmp = Utilidades::fechas_de_MysqlTimeStamp_a_string($row['fecha_entrega']); if ($tmp == '0000-00-00') { $tmp = ''; } $nestedData[] = utf8_encode('<u>Obs</u>: <div class="editable-inline line2" class=""> <a></a> <span venta_id="' . $row['venta_id'] . '" campo="fecha_entrega_observacion"> ' . $row['fecha_entrega_observacion'] . ' </span> <div style="display:none"></div> </div> <u>Fecha</u>: <div class="editable-inline line2" class=""> <a></a> <span venta_id="' . $row['venta_id'] . '" campo="fecha_entrega">
/* $pagina -= 1; */ /* if ($pagina > 0) { */ /* $pagina-= ($pagina % $requestData['length']); */ /* if ($pagina > 0) { */ /* $pagina /= $requestData['length']; */ /* } */ /* } */ /* $pagina *= $requestData['length']; */ /* } */ /* if ($pagina != '') */ /* $requestData['start'] = $pagina; */ $query = mysqli_query($conn, $sql) or die("02"); $totalFiltered = mysqli_num_rows($query); // when there is a search parameter then we have to modify total number filtered rows as per search result. $sql .= " ORDER BY " . (intval($requestData['order'][0]['column']) + 1) . " " . $requestData['order'][0]['dir'] . " LIMIT " . $requestData['start'] . " ," . $requestData['length'] . " "; // echo $sql; $query = mysqli_query($conn, $sql) or die("03"); $data = array(); while ($row = mysqli_fetch_array($query)) { $nestedData = array(); // venta_id | estado_id | row_num | $nestedData[] = Utilidades::fechas_de_MysqlTimeStamp_a_string($row['fecha']); $nestedData[] = utf8_encode($row['']); $acciones = '<a class="button edit no-margin" codigo="' . $row['venta_id'] . '" title="Editar"><i class="fi-pencil medium"></i></a>'; $acciones .= '<a class="button edit secondary no-margin" codigo="' . $row['venta_id'] . '" title="Ver"><i class="fi-info medium"></i></a>'; $nestedData[] = $acciones; $data[] = $nestedData; } $json_data = array("draw" => intval($requestData['draw']), "recordsTotal" => intval($totalData), "recordsFiltered" => intval($totalFiltered), "data" => $data, "sql" => $sql); echo json_encode($json_data); // send data as json format