function actualiza_totales() { $llave = TEFieldKey($GLOBALS["table"]); $descuento = $_POST["DESC_P"]; if ($_POST["ESTATUS_PEDIDO_ID"] == 2) { $sql = "update " . $GLOBALS["table"] . " \n set MONTO=0,\n\t\tIVA=0,\n\t\tTOTAL=0\n\t\twhere " . $llave . "=" . ID; $result = mysql_db_query(DB_NAME, $sql); $sql = "update " . $GLOBALS["table"] . "_detalle \n set PRECIO=0,\n\t\tCOSTO=0,\n\t\tCANTIDAD=0\n\t\twhere " . $llave . "=" . ID; $result = mysql_db_query(DB_NAME, $sql); } else { $sql = "update " . $GLOBALS["table"] . " \n set MONTO=(SELECT SUM(CANTIDAD*PRECIO) FROM " . $GLOBALS["table"] . "_detalle where " . $llave . "=" . ID . "),\n\t\tIVA=(SELECT (SUM(CANTIDAD*PRECIO)-DESCUENTO)*.16 FROM " . $GLOBALS["table"] . "_detalle where " . $llave . "=" . ID . "),\n\t\tTOTAL=(SELECT (SUM(CANTIDAD*PRECIO)-DESCUENTO)*1.16 FROM " . $GLOBALS["table"] . "_detalle where " . $llave . "=" . ID . ")\n\t\twhere " . $llave . "=" . ID; $result = mysql_db_query(DB_NAME, $sql); //echo $sql; exit(); } }
function handleAddEditCopy($id = null) { if (!is_null($id)) { $id = $this->dbQuote($id); } if (!empty($_POST)) { $table = $GLOBALS["table"]; $add = $GLOBALS["add"]; $edit = $GLOBALS["edit"]; $idcopy = $GLOBALS["idcopy"]; $useFunctions = $this->getConfig('useFunctions'); foreach ($this->fields as $field => $value) { if (!empty($value['noEdit']) and !isset($value['default']) or $field == $this->pk and !$this->getConfig('allowPKEditing')) { continue; } if (!empty($value['noEdit']) and isset($value['default'])) { $unQuoted[$field] = $value['default']; $quoted[$field] = $this->dbQuote($value['default']); continue; } if ($useFunctions) { $function = $_POST['function'][$field]; if (!empty($function) and !empty($this->config['functions'][$function])) { $_POST[$field] = call_user_func($this->config['functions'][$function], $_POST[$field]); } } // if(!empty($this->fields[$field]['required']) AND ($_POST[$field]==='' OR !isset($_POST[$field]))) if (!empty($this->fields[$field]['required']) and ($_POST[$field] === '' and isset($_POST[$field]))) { if ($this->fields[$field]['input'] == 'file' && ($_FILES[$field . 'Change']['tmp_name'] != "" || $_FILES[$field]['tmp_name'] != "")) { } else { $this->setContextualError($field, TERequired . ' - ' . $this->fields[$field]['input'] . ' ' . $_FILES[$field . 'Change']['tmp_name']); } // Raul 26-Dic-2007 } switch ($this->fields[$field]['input']) { case 'file': // Raul 02-Ene-2008 $FileName = ''; if (isset($_FILES[$field]['tmp_name'])) { $FieldFile = $_FILES[$field]['tmp_name']; $FileName = $_FILES[$field]['name']; } else { $FieldFile = ''; } if (isset($_FILES[$field . 'Change']['tmp_name'])) { $FieldFileChange = $_FILES[$field . 'Change']['tmp_name']; $FileName = $_FILES[$field . 'Change']['name']; } else { $FieldFileChange = ''; } if (isset($_POST[$field])) { $OldFile = $_POST[$field]; } else { $OldFile = ''; } if ($FileName) { $DownloadType = 0; $Ext = TEDocumentType($FileName, 1); if ($this->fields[$field]['DownloadType']) { $AcceptedTypes = ''; foreach ($this->fields[$field]['DownloadType'] as $Exts) { if ($Exts == $Ext) { $DownloadType = 1; break; } else { $AcceptedTypes .= ' .' . $Exts . '; '; } } } if ($DownloadType == 0 && $this->fields[$field]['DownloadType']) { $this->setContextualError($field, TEFieldErrorDownloadType . ' ' . $AcceptedTypes . ''); } } break; case 'password': // Raul 08-Dic-2007 if (isset($_POST[$field])) { $FieldPassword = $_POST[$field]; } else { $FieldPassword = ''; } if (isset($_POST[$field . 'Change'])) { $FieldPasswordChange = $_POST[$field . 'Change']; } else { $FieldPasswordChange = ''; } if (isset($_POST[$field . 'Confirm'])) { $FieldPasswordConfirm = $_POST[$field . 'Confirm']; } else { $FieldPasswordConfirm = ''; } if ($add) { if ($FieldPassword != $FieldPasswordConfirm) { $this->setContextualError($field, TEErrorPassword); } } elseif (($FieldPasswordChange || $FieldPasswordConfirm) && $FieldPasswordChange != $FieldPasswordConfirm) { $this->setContextualError($field, TEErrorPassword); } break; case 'email': if ($_POST[$field] && !TEEmailValidate($_POST[$field])) { $this->setContextualError($field, TEErrorEmail); } break; // Raul 08-Dic-2007 // Raul 08-Dic-2007 case 'int': if ($_POST[$field] && !TEIntValidate($_POST[$field])) { $this->setContextualError($field, TEErrorInt); } break; // Raul 08-Dic-2007 // Raul 08-Dic-2007 case 'bitmask': $v = 0; if (!empty($_POST[$field])) { foreach ($_POST[$field] as $bit) { $v |= $bit; } } $_POST[$field] = $v; break; } if (!empty($this->validationCallbacks[$field])) { foreach ($this->validationCallbacks[$field] as $c) { $_POST[$field] = call_user_func($c, &$this, $_POST[$field]); } } $unQuoted[$field] = $_POST[$field]; $quoted[$field] = $this->dbQuote($_POST[$field]); $fields[] = $field; } if (!empty($this->errors) or !empty($this->contextErrors)) { $this->displayAddEditCopyPage($id); } foreach ($fields as $f) { if ($this->fields[$f]['FieldHidden']) { $sets[] = "{$f} = {$quoted[$f]}"; } else { switch ($this->fields[$f]['input']) { case 'password': // Raul 08-Dic-2007 if ($add) { $sets[] = "{$f} = md5({$quoted[$f]})"; } else { if (isset($_POST[$f])) { $FPassword = $_POST[$f]; } else { $FPassword = ''; } if (isset($_POST[$f . 'Change'])) { $FPasswordChange = $_POST[$f . 'Change']; } else { $FPasswordChange = ''; } if (isset($_POST[$f . 'Confirm'])) { $FPasswordConfirm = $_POST[$f . 'Confirm']; } else { $FPasswordConfirm = ''; } if (($FPasswordChange || $FPasswordConfirm) && $FPasswordChange == $FPasswordConfirm) { $PassNew = "'" . md5($FPasswordChange) . "'"; $sets[] = "{$f} = {$PassNew}"; } else { $sets[] = "{$f} = {$quoted[$f]}"; } } break; case 'file': // Raul 10-Dic-2007 if (isset($_FILES[$f]['tmp_name'])) { $FieldFile = $_FILES[$f]['tmp_name']; } else { $FieldFile = ''; } if (isset($_FILES[$f . 'Change']['tmp_name'])) { $FieldFileChange = $_FILES[$f . 'Change']['tmp_name']; } else { $FieldFileChange = ''; } if (isset($_POST[$f])) { $OldFile = $_POST[$f]; } else { $OldFile = ''; } if ($this->fields[$f]['DownloadPath'] && file_exists($this->fields[$f]['DownloadPath'])) { $TEDownloadPath = $this->fields[$f]['DownloadPath']; } else { $TEDownloadPath = TEDownloadsPath; } if ($add) { if ($FieldFile) { $TableName = str_replace(' ', '', TETablesNames($table)); $CurrenDateTime = str_replace('-', '', str_replace(':', '', str_replace(' ', '', TECurrentDateTime()))); $TEFileNewName = $TableName . $CurrenDateTime; $TEfile = "'" . TEDownloadFile($f, $TEDownloadPath, $TEFileNewName) . "'"; if ($TEfile) { $sets[] = "{$f} = {$TEfile}"; } } } elseif ($FieldFileChange) { $TableName = str_replace(' ', '', TETablesNames($table)); $CurrenDateTime = str_replace('-', '', str_replace(':', '', str_replace(' ', '', TECurrentDateTime()))); $TEFileNewName = $TableName . $CurrenDateTime; $TEfile = "'" . TEDownloadFile($f . 'Change', $TEDownloadPath, $TEFileNewName) . "'"; if ($TEfile) { if ($OldFile && file_exists($TEDownloadPath . $OldFile)) { unlink($TEDownloadPath . $OldFile); } $sets[] = "{$f} = {$TEfile}"; } } elseif ($idcopy) { $auxiliar = substr_replace($quoted[$f], "", 0, 1); $auxiliar = substr_replace($auxiliar, "", -1, 1); $extension = substr($auxiliar, -3, 3); $imagen = $this->fields[$f]['DownloadPath'] . $auxiliar; $TableName = str_replace(' ', '', TETablesNames($table)); $CurrenDateTime = str_replace('-', '', str_replace(':', '', str_replace(' ', '', TECurrentDateTime()))); $TEFileNewName = $TableName . $CurrenDateTime . '.' . $extension; switch ($extension) { case 'jpg': $original = imagecreatefromjpeg($imagen); break; case 'gif': $original = imagecreatefromgif($imagen); break; case 'png': $original = imagecreatefrompng($imagen); break; } $ancho = imagesx($original); $alto = imagesy($original); $copia = $this->fields[$f]['DownloadPath'] . $TEFileNewName; $medio = imagecreatetruecolor($ancho, $alto); imagecopy($medio, $original, 0, 0, 0, 0, $ancho, $alto); switch ($extension) { case 'jpg': imagejpeg($medio, $copia, 90); break; // 90 es la calidad de compresión // 90 es la calidad de compresión case 'gif': imagegif($medio, $copia); break; case 'png': imagepng($medio, $copia, 0); break; } $TEfile = "'" . $TEFileNewName . "'"; $sets[] = "{$f} = {$TEfile}"; } else { $sets[] = "{$f} = {$quoted[$f]}"; } if ($TEfile) { $auxiliar = substr_replace($TEfile, "", 0, 1); $auxiliar = substr_replace($auxiliar, "", -1, 1); $extension = substr($auxiliar, -3, 3); $imagen = $this->fields[$f]['DownloadPath'] . $auxiliar; $imagen_adjust = substr_replace($imagen, "_adjust.", -4, 1); $adjust = 0; switch ($extension) { case 'jpg': $original = imagecreatefromjpeg($imagen); break; case 'gif': $original = imagecreatefromgif($imagen); break; case 'png': $original = imagecreatefrompng($imagen); break; } $ancho = imagesx($original); $alto = imagesy($original); if ($this->fields[$f]['ImageWidth']) { if ($this->fields[$f]['ImageHeight']) { if ($ancho > $this->fields[$f]['ImageWidth'] or $alto > $this->fields[$f]['ImageHeight']) { if (!file_exists($imagen_adjust)) { $medio = imagecreatetruecolor($this->fields[$f]['ImageWidth'], $this->fields[$f]['ImageHeight']); imagecopyresampled($medio, $original, 0, 0, 0, 0, $this->fields[$f]['ImageWidth'], $this->fields[$f]['ImageHeight'], $ancho, $alto); $adjust = 1; } } } else { if ($ancho > $this->fields[$f]['ImageWidth']) { if (!file_exists($imagen_adjust)) { $alto_medio = $this->fields[$f]['ImageWidth'] * $alto / $ancho; $medio = imagecreatetruecolor($this->fields[$f]['ImageWidth'], $alto_medio); imagecopyresampled($medio, $original, 0, 0, 0, 0, $this->fields[$f]['ImageWidth'], $alto_medio, $ancho, $alto); $adjust = 1; } } } } elseif ($this->fields[$f]['ImageHeight']) { if ($alto > $this->fields[$f]['ImageHeight']) { if (!file_exists($imagen_adjust)) { $ancho_medio = $this->fields[$f]['ImageHeight'] * $ancho / $alto; $medio = imagecreatetruecolor($ancho_medio, $this->fields[$f]['ImageHeight']); imagecopyresampled($medio, $original, 0, 0, 0, 0, $ancho_medio, $this->fields[$f]['ImageHeight'], $ancho, $alto); $adjust = 1; } } } if ($adjust == 1) { switch ($extension) { case 'jpg': imagejpeg($medio, $imagen_adjust, 90); break; // 90 es la calidad de compresión // 90 es la calidad de compresión case 'gif': imagegif($medio, $imagen_adjust); break; case 'png': imagepng($medio, $imagen_adjust, 0); break; } unlink($imagen); rename($imagen_adjust, $imagen); } } break; case 'wysiwyg': $Value = "'" . utf8_decode($_POST[$f]) . "'"; $sets[] = "{$f} = {$Value}"; break; case 'date': $DateAux = str_replace("'", "", $quoted[$f]); $DateAux = "'" . TEDateToMysql($DateAux) . "'"; $sets[] = "{$f} = {$DateAux}"; break; case 'int': $DecAux = str_replace("'", "", $quoted[$f]); $DecAux = str_replace("\$", "", $quoted[$f]); $DecAux = str_replace(",", "", $quoted[$f]); $sets[] = "{$f} = {$DecAux}"; break; case 'decimal': $DecAux = str_replace("'", "", $quoted[$f]); $DecAux = str_replace("\$", "", $quoted[$f]); $DecAux = str_replace(",", "", $quoted[$f]); $sets[] = "{$f} = {$DecAux}"; //if ($value["display"]=="DESCUENTO") {echo ""; exit();} break; case 'binary': $aux_binary = str_replace("'", "", $quoted[$f]); if ($aux_binary == "on") { $aux = 1; } else { $aux = 0; } $sets[] = "{$f} = {$aux}"; break; case 'datetime': $DateTimeAux = str_replace("'", "", $quoted[$f]); $DateTimeAux = "'" . TEDatetimeToMysql($DateTimeAux) . "'"; $sets[] = "{$f} = {$DateTimeAux}"; break; // default: $sets[]="$f = UPPER({$quoted[$f]})"; break; // default: $sets[]="$f = UPPER({$quoted[$f]})"; break; default: $sets[] = "{$f} = {$quoted[$f]}"; break; } } } $sets_original = $sets; $sets = implode(', ', $sets); if (isset($_GET['edit'])) { if (!empty($this->dataFilters)) { $filters = implode(' AND ', $this->dataFilters); } else { $filters = 1; } list($tables, $joinClause) = $this->getQueryTables(); $sql = "UPDATE {$tables} SET {$sets} WHERE {$joinClause} AND {$filters} AND {$this->pk} = {$id}"; // echo print_r($_POST); $res = $this->dbQuery($sql); //echo $sql.""; exit(); define("ID", $id); include "" . TEIncludesPath . "AdditionalEdit.php"; if (!$res) { $error_2 = $this->dbError(); $this->errors[] = TEErrorUpdateRecord . ": " . $error_2; } else { if (!empty($this->editCallbacks)) { foreach ($this->editCallbacks as $c) { call_user_func($c, $unQuoted); } } } } elseif (!empty($_GET['add']) or isset($_GET['idcopy'])) { $sql = "INSERT INTO {$this->table} SET {$sets}"; //echo $sql."+++<br><br>"; //exit(); $res = $this->dbQuery($sql); if (!$res) { $this->errors[] = TEErrorAddRecord . ": " . $this->dbError(); } else { $id = $this->dbGetOne("SELECT LAST_INSERT_ID()"); if ($id == "" or $id == 0) { define("ID", $_POST[TEFieldKey($this->table)]); } else { define("ID", $id); } include "" . TEIncludesPath . "AdditionalAdd.php"; //exit(); if (!empty($_GET['add'])) { if (!empty($this->addCallbacks)) { foreach ($this->addCallbacks as $c) { call_user_func($c, $unQuoted); } } } elseif (isset($_GET['idcopy'])) { if (!empty($this->copyCallbacks)) { foreach ($this->copyCallbacks as $c) { call_user_func($c, $unQuoted); } } } } } if ($id == "" or $id == 0) { foreach ($sets_original as $value) { $aux = explode("=", $value); if (trim($aux[0]) == TEFieldKey($table)) { $id = trim($aux[1]); } } } // echo $id; exit(); if (empty($this->errors)) { include '' . TEIncludesPath . 'TERedirection.php'; TERedirection($LocationUrl); exit; } } $this->displayAddEditCopyPage($id); }
<?php // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< TABLA HIJO global $TABLA_HIJO, $input_size, $editor_hijo, $NUEVO_editor_hijo; $llave_tabla_padre = TEFieldKey($table); $llave_tabla_hijo = TEFieldKey($TABLA_HIJO["TABLA_HIJO"]); $sql_campos = "SELECT " . $llave_tabla_hijo . ", " . $TABLA_HIJO["CAMPOS"] . " FROM " . $TABLA_HIJO["TABLA_HIJO"]; $result_campos = mysql_db_query(DB_NAME, $sql_campos); // echo $sql_campos."<br><br>"; for ($i = 0; $i < mysql_num_fields($result_campos); $i++) { $campos[] = mysql_field_name($result_campos, $i); } if ($TABLA_HIJO["TABLA_HIJO"] != "") { $registros = sizeof($_POST[$campos[0]]); for ($i = 0; $i < $registros + 1; $i++) { if ($_POST["borrar"][$i] == "on") { if (file_exists("" . TEditorPath . "TE_HIJO_TODAS_LAS_TABLAS_borrado.php")) { include "" . TEditorPath . "TE_HIJO_TODAS_LAS_TABLAS_borrado.php"; } else { $x_borrar = consulta("select * from " . $TABLA_HIJO["TABLA_HIJO"] . " where " . $llave_tabla_hijo . "=" . $_POST[$llave_tabla_hijo][$i] . " limit 1"); $sql_borrar = "delete from " . $TABLA_HIJO["TABLA_HIJO"] . " WHERE " . $llave_tabla_hijo . "=" . $_POST[$llave_tabla_hijo][$i] . " limit 1"; $result = mysql_db_query(DB_NAME, $sql_borrar); //echo $sql_borrar; if (!empty($NUEVO_editor_hijo[$TABLA_HIJO["TABLA_HIJO"]]->deleteCallbacks)) { foreach ($NUEVO_editor_hijo[$TABLA_HIJO["TABLA_HIJO"]]->deleteCallbacks as $c) { call_user_func($c, $x_borrar); } } } } else { $arma_campos = "";
<?php include "../config/config.php"; include "../TableEditor/TEditorFunctions/Functions.php"; include "CNumeroaLetra.php"; include "../admin/TE_TODAS_LAS_TABLAS_print.php"; if (!defined("SQL_PRINT")) { echo "No existe definicion query en archivo TE_TODAS_LAS_TABLAS_print.php"; exit; } mysql_connect(DB_HOST, DB_USER, DB_PASS); # connect to the database $llave_tabla = TEFieldKey($table); $where = " where " . $llave_tabla . "='" . $id . "'"; $sql = SQL_PRINT . $where; // echo $sql; $imagen = consulta("select IMAGEN from print_formatos where TABLA='" . $table . "'"); list($width, $height, $type, $attr) = getimagesize("../formatos/" . $imagen["IMAGEN"]); $alto_resize = $height * 800 / $width; ?> <script language="javascript"> window.focus() </script> <basefont face="arial, verdana, courier" size="2"> <?php // if(1==0) if ($imprime != "1" and $imagen != "") { ?> <div id="Layer9" style="position:absolute; left:-0.8cm; top:-0.2cm;"><img src="<?php echo "../formatos/" . $imagen["IMAGEN"]; ?>
function actualiza_tiempo_respuesta() { $llave = TEFieldKey($GLOBALS["table"]); $sql = "select * from " . $GLOBALS["table"] . " where {$llave}=" . ID; $aux_diferencia = consulta($sql); if ($aux_diferencia["PM_HORA_LLEGADA_EVENTO"] != "" and $aux_diferencia["PM_HORA_SALIDA_EVENTO"] != "") { //-----|/\ $inicio = $aux_diferencia["PM_HORA_LLEGADA_EVENTO"]; // print_r($aux_diferencia); $fin = $aux_diferencia["PM_HORA_SALIDA_EVENTO"]; $dif = date("H:i:s", strtotime("00:00:00") + strtotime($fin) - strtotime($inicio)); $sql_update = "update " . $GLOBALS["table"] . " set DURACION_DEL_EVENTO='" . $dif . "' where {$llave}=" . ID; } else { $sql_update = "update " . $GLOBALS["table"] . " set DURACION_DEL_EVENTO=NULL where {$llave}=" . ID; } // echo $sql_update; exit(); consulta($sql_update); }
<?php // $table es la tabla destino(actual) // $importa_tabla es la tabla origen // $importa_id es el ID de la tabla origen // $sel, arreglo con los id's de las partidas seleccionadas, si existe $sel, $importa_tabla es la tabla hijo origen if ($importa_tabla and $importa_id || $sel) { switch ($table) { case "_sample_ndc_p_notas_credito": $consulta = consulta("select *, FOLIO_FISCAL AS FACTURA, '" . HOY . "' as FECHA from {$importa_tabla} where " . TEFieldKey($importa_tabla) . "=" . $importa_id); $editor->setDefaultValues($consulta); break; default: if ($sel) { if ($importa_id) { $consulta = consulta("select * from {$importa_tabla} where " . TEFieldKey($importa_tabla) . "=" . $importa_id); $editor->setDefaultValues($consulta); } $sql_copia_hijo = "select * from " . $importa_tabla . " where " . TEFieldKey($importa_tabla) . " in (" . implode(", ", $sel) . ")"; //echo $sql_copia_hijo; } else { $consulta = consulta("select * from {$importa_tabla} where " . TEFieldKey($importa_tabla) . "=" . $importa_id); $editor->setDefaultValues($consulta); $sql_copia_hijo = "select * from " . $importa_tabla . "_detalle where " . TEFieldKey($importa_tabla) . "=" . $importa_id; //echo $sql_copia_hijo; } break; } }
foreach ($NUEVO_editor_hijo[$TABLA_HIJO["TABLA_HIJO"]]->extraFunc as $title => $datos) { if ($datos['DESPUES_DE'] == $valor) { echo '<th><span class="TEDefaultTit"/>' . $title . '</span></th>'; } } } } if (!empty($this->extraFunc)) { foreach ($this->extraFunc as $title => $function) { if ($datos['DESPUES_DE'] == "") { $TEMainList .= '<th><span class="TEDefaultTit"/>' . $title . '</span></th>'; } } } echo "</tr>"; $llave = TEFieldKey($table); $input_size = $GLOBALS["input_size"]; // Si hay error conserva los capturados $registros_posteados = sizeof($_POST[$campos[1]]); // print_r($_POST); if ($registros_posteados > 0) { for ($i = 1; $i < $registros_posteados; $i++) { $conta++; echo '<tr id="tabla_hijo_' . $conta . '">'; echo "<td>" . ++$conta_partidas . "</td>"; if ($HIJO_ActionButtons) { $TEMainList = '<td class="TETdFieldsList">'; $TEMainList .= '<input type="checkbox" name="rowSelector" id="rowSelector" onclick="TERowHighlight(this.parentNode.parentNode, this, \'' . ($k % 2 == 1 ? 'TEaltRow' : 'TERow') . '\');" '; $TEMainList .= 'style="cursor:hand;" value="' . $dato[$llave_tabla_hijo] . '" title="' . TECheckboxSelect . '">'; $TEMainList .= '</td>'; echo $TEMainList;
$url = new TableEditor_URL(); $url->removeQueryString('edit'); $url->removeQueryString('add'); $url->removeQueryString('idcopy'); //if(isset($_POST["ActionRedirection"]) && (TEChangeRedirection==1)) if (isset($_POST["ActionRedirection"]) && TEChangeRedirection == 1) { $RecordId = str_replace("'", "", $id); $RedirectionUrl = $url->getURL(true); $url->addQueryString('edit', $RecordId); $RedirectionEditUrl = $url->getURL(true); $url->removeQueryString('edit'); $url->removeQueryString('idcopy'); $url->addQueryString('add', '1'); $RedirectionAddURL = $url->getURL(true); if (defined("ADD_REDIRECCION") and $add > 0) { $LocationUrl = "" . TEditorPath . "?table=" . ADD_REDIRECCION . "&" . strtolower(TEFieldKey($table)) . "=" . $RecordId; } else { if ($_POST["ActionRedirection"] == 1) { TERedirection($RedirectionUrl); exit; } if ($_POST["ActionRedirection"] == 2) { TERedirection($RedirectionEditUrl); exit; } if ($_POST["ActionRedirection"] == 3) { TERedirection($RedirectionAddURL); exit; } } } else {
// print_r($TABLA_HIJO); //echo $_GET["campo"]."++"; //if(file_exists("".TEditorPath."TE_TODAS_LAS_TABLAS_ajax_maestro.php")) { include("".TEditorPath."TE_TODAS_LAS_TABLAS_ajax_maestro.php"); } //echo $_GET["campo"]."++".$campo; //echo $_GET["campo"]; //print_r($NUEVO_editor_hijo[$TABLA_HIJO["TABLA_HIJO"]]); //echo $NUEVO_editor_hijo[$TABLA_HIJO["TABLA_HIJO"]]->ajax_field[$campo]['SQL']; if ($editor->ajax_field[$campo]['SQL']) { $sql = $editor->ajax_field[$campo]['SQL']; } if (isset($_GET["Type"])) { $Type = $_GET["Type"]; switch ($Type) { case "guarda_celda": //echo "hi"; $sql = "update " . $table . " set " . $campo . "=trim('" . $valor . "') where " . TEFieldKey($table) . "=" . trim($id); // echo $sql; $result = mysql_db_query(DB_NAME, $sql); break; case "universal": // ------------------------------------------------------------------------------------------------------------------------------------ require "../../admin/TE_AJAX_actualiza_campos_sql.php"; // echo $sql."++"; // logea("hi"); $result = mysql_db_query(DB_NAME, $sql); if (mysql_num_rows($result) > 0) { while ($row = mysql_fetch_array($result)) { $i = count($row) / 2; for ($aux = 0; $aux < $i; $aux++) { $campo = mysql_field_name($result, $aux); $enviar .= "Request['" . $campo . "']='" . $row[$aux] . "';";
mysql_connect(DB_HOST, DB_USER, DB_PASS); // Borra Hijos global $TABLA_HIJO, $BORRAR_HIJOS, $editor_hijo, $NUEVO_editor_hijo; $aux_para_borrar = array(); if ($TABLA_HIJO["TABLA_HIJO"] != "") { $aux_para_borrar[] = $TABLA_HIJO["TABLA_HIJO"]; } if ($BORRAR_HIJOS) { $aux_para_borrar = array_merge($aux_para_borrar, $BORRAR_HIJOS); } if ($NUEVO_editor_hijo) { $aux_para_borrar = array_merge($aux_para_borrar, array_keys($NUEVO_editor_hijo)); } foreach ($aux_para_borrar as $tabla_hijo) { $llave_tabla_padre = TEFieldKey($table); $llave_tabla_hijo = TEFieldKey($tabla_hijo); $sql_borra_hijo = "select {$llave_tabla_hijo} from " . $tabla_hijo . " where " . $llave_tabla_padre . " IN (" . implode(", ", $_GET["delete"]) . ")"; // echo $sql_borra_hijo."---".$llave_tabla_hijo."<br><br><br>"; $result = mysql_query($sql_borra_hijo); while ($dato = mysql_fetch_assoc($result)) { $extrae[] = $dato[$llave_tabla_hijo]; } if ($editor_hijo->table == $tabla_hijo and sizeof($extrae) > 0) { $editor_hijo->deleteRow_hijos($extrae); } // ejecuta callbacks de hijos, este es para hacer compatible la anterior definicion de hijo.. // antes $editor_hijo = new TableEditor($link , $table."_facturas"); // ahora $NUEVO_editor_hijo[$table."_egresos"] = new TableEditor($link , $table."_egresos"); // echo "hi";exit(); if ($NUEVO_editor_hijo[$tabla_hijo]) { if (array_key_exists($tabla_hijo, $NUEVO_editor_hijo) and sizeof($extrae) > 0) {
function TENextRecord($Id) { if (isset($GLOBALS["table"])) { $Tbl = $GLOBALS["table"]; } else { $Tbl = ""; } $Field = TEFieldKey($Tbl); $IdNext = ""; if ($Tbl && $Field) { $sql = "SELECT " . $Field . " FROM " . $Tbl . " WHERE " . $Field . ">'" . $Id . "' ORDER BY " . $Field . " ASC LIMIT 1 "; $result = mysql_db_query(DB_NAME, $sql); if (mysql_num_rows($result) > 0) { $dato = mysql_fetch_array($result); $IdNext = $dato[$Field]; } } return $IdNext; }
<?php if ($edit) { $llave = TEFieldKey($GLOBALS["table"]); $sql = "select * from " . $GLOBALS["table"] . " where {$llave}=" . $edit; $aux = consulta($sql); if ($aux["PM_HORA_DESPACHO"] == 0) { echo $aux; } } //$horaInicio = mktime(20,0,0,0,0,0); //hora, minutos, segundos, mes, dia, año //$horaFin = mktime(21,30,0,0,0,0); //echo abs(($horaInicio - $horaFin)/60/60); ?>