function displayHeader() { $headerfile = $this->getConfig('headerfile'); if ($headerfile) { require $headerfile; return; } $table = $this->table; echo '<div class="TEmainbody" align="center">'; if ($this->errors) { foreach ($this->errors as $e) { $aux_error = split(":", $e); if (strpos($aux_error[1], "Duplicate entry")) { $aux_1 = split(" ", trim($aux_error[1])); $NumberArray = count($aux_1); $aux_2 = $aux_1[5]; $aux = TEgetPrimaryKeyOf($this->table); $valor_duplicado = $aux_1[2]; $ElementDuplicate = (int) $aux_1[$NumberArray - 1]; $campo_duplicado = $aux[$ElementDuplicate]; $ArrayErrorTxt = split("'", trim($aux_error[1])); $valor_duplicado = $ArrayErrorTxt[1]; if ($campo_duplicado != "") { $RecordId = nombre_id($this->table, $campo_duplicado, str_replace("'", "", $valor_duplicado), $aux[1]); } $DuplicateErrorTxt = TEErrorDuplicateEntry . " "; $url = new TableEditor_URL(); $url->removeQueryString('edit'); $url->removeQueryString('add'); $url->addQueryString('view', $RecordId); $PopupUrl = $url->getURL(true); $DuplicateErrorButton .= '<img src="' . TEImagesPath . 'TEActionView.gif" srcover="' . TEImagesPath . 'TEActionViewOver.gif" class="TEInputButton" '; if (file_exists("" . TEditorPath . "TEPopupForm.php")) { $DuplicateErrorButton .= 'onclick="TEWindowOpenPopup(\'' . $TEditorPath . 'TEPopupForm.php?table=' . $this->table . '&view=' . $RecordId . '&TEPopup=1\', \'DuplicateEntry\', \'500\', \'500\', \'0\', \'0\')" '; $DuplicateErrorButton .= 'title="' . TEButtonAdd . '" alt="' . TEButtonAdd . '"> '; } else { $url = new TableEditor_URL(); $url->removeQueryString('edit'); $url->removeQueryString('add'); $url->addQueryString('view', $RecordId); $PopupUrl = $url->getURL(true); $DuplicateErrorButton .= 'onclick="TEWindowOpenPopup(\'' . $PopupUrl . '\', \'DuplicateEntry\', \'769\', \'400\', \'0\', \'1\')" title="' . TEButtonView . '" alt="' . TEButtonView . '"> '; } echo '<script language="javascript"> alert("ERROR: ' . $DuplicateErrorTxt . '\\n");</script><div class="TEditorError">ERROR: ' . $DuplicateErrorTxt . '<br>' . $DuplicateErrorButton . '</div>'; } else { echo '<script language="javascript"> alert("ERROR: ' . htmlspecialchars($e) . '"); </script><div class="TEditorError">ERROR: ' . htmlspecialchars($e) . '</div>'; } } } }
$tipo_consulta = "select CONCEPTO_TIPO_ID FROM c_conceptos c, p_recepcion_partidas p where c.CONCEPTO_ID = p.CONCEPTO_ID and RECEPCION_PARTIDAS_ID= '" . $_GET["recepcion_partidas_id"] . "'"; //echo $tipo_consulta; $res_tipo = mysql_query($tipo_consulta); $tipo = mysql_fetch_array($res_tipo); //echo $tipo['CONCEPTO_TIPO_ID']; if (!$_GET['cultivo_id']) { $sql_cul = "SELECT CULTIVO_ID FROM `p_analisis_resultados` WHERE `RECEPCION_PARTIDAS_ID` =" . $_GET["recepcion_partidas_id"]; $res_cul = mysql_query($sql_cul); $fetch_cul = mysql_fetch_object($res_cul); $cul_guardado = $fetch_cul->CULTIVO_ID; } else { $cul_guardado = $_GET['cultivo_id']; } //echo $cul_guardado; if ($tipo['CONCEPTO_TIPO_ID'] == 4) { $url = new TableEditor_URL(); $url->removeQueryString('cultivo_id'); $clearURL = $url->getURL(true); $TEMainList .= '<tr><td colspan=2>'; $TEMainList .= combo_universal_var("cultivo_id", "select CULTIVO_ID, NOMBRE from c_cultivos order by NOMBRE", $cul_guardado); $TEMainList .= '<input type=button value="ver" onclick=consulta()>'; $TEMainList .= '</td></tr>'; ?> <script language="javascript"> function consulta() { var searchStr=document.getElementById('cultivo_id').value; location.href = '<?php echo $clearURL; ?> ' + '&'+'cultivo_id=' + searchStr;
echo '><option value="">' . TESelectStandar . '</option>'; if ($NUEVO_editor_hijo[$TABLA_HIJO["TABLA_HIJO"]]->fields[$field]['values']) { foreach ($NUEVO_editor_hijo[$TABLA_HIJO["TABLA_HIJO"]]->fields[$field]['values'] as $k => $v) { $TESelect = (string) $k === $value ? ' selected' : ''; echo '<option value="' . htmlspecialchars($k) . '"' . $TESelect . '>' . htmlspecialchars($v) . '</option>'; } } echo '</select>'; if (!$NUEVO_editor_hijo[$TABLA_HIJO["TABLA_HIJO"]]->ArrayHiddenTables[$NUEVO_editor_hijo[$TABLA_HIJO["TABLA_HIJO"]]->fields[$field]['LinkTable']] && $NUEVO_editor_hijo[$TABLA_HIJO["TABLA_HIJO"]]->fields[$field]['LinkTable'] && ($edit || $add)) { echo ' <img src="' . TEImagesPath . 'TEActionAdd.gif" srcover="' . TEImagesPath . 'TEActionAddOver.gif" class="TEInputButton" '; if (file_exists("" . TEditorPath . "TEPopupForm.php")) { //Url, Name, Width, Height, Align, Bars) echo 'onclick="TEWindowOpenPopup(\'' . $TEditorPath . 'TEPopupForm.php?table=' . $NUEVO_editor_hijo[$TABLA_HIJO["TABLA_HIJO"]]->fields[$field]['LinkTable'] . '&add=1&TEPopup=1\', \'PopupAdd\', \'500\', \'500\', \'0\', \'0\')" '; echo 'title="' . TEButtonAdd . '" alt="' . TEButtonAdd . '"> '; } else { $UrlLinkAdd = new TableEditor_URL(); if ($edit) { $TxtRemove = 'edit'; } elseif ($add == 1) { $TxtRemove = 'add'; } $UrlLinkAdd->removeQueryString($TxtRemove); $UrlLinkAdd->removeQueryString($table); $UrlLinkAdd->addQueryString('table', $NUEVO_editor_hijo[$TABLA_HIJO["TABLA_HIJO"]]->fields[$field]['LinkTable']); $UrlLinkAdd->addQueryString('add', '1'); $UrlLinkAdd = $UrlLinkAdd->getURL(true); echo 'onclick="window.open(\'' . $UrlLinkAdd . '\');" title="' . TEButtonAdd . '" alt="' . TEButtonAdd . '"> '; } } } else { // para select deshabilitado
if (!empty($this->extraFunc)) { foreach ($this->extraFunc as $title => $function) { if ($datos['DESPUES_DE'] == "") { $TEMainList .= '<th><span class="TEDefaultTit"/>' . $title . '</span></th>'; } } } // Begin - 18 Nov 2008 - Titles Icons Bg if (!empty($this->icons[$this->table]['icon'])) { foreach ($this->icons[$this->table]['icon'] as $icon => $html_icon) { $TEMainList .= '<th> </th>'; } } // End - 18 Nov 2008 - Titles Icons Bg $TEMainList .= '</tr>'; $url = new TableEditor_URL(); if (!empty($results)) { foreach ($results as $k => $row) { $url->removeQueryString('edit'); $url->addQueryString('edit', $nonFilteredData[$k][$this->pk]); $UrlEdit = $url->getURL(true); $url->removeQueryString('edit'); $url->addQueryString('view', $nonFilteredData[$k][$this->pk]); $UrlView = $url->getURL(true); $url->removeQueryString('view'); $TEMainList .= '<tr onmouseover="this.className=\'TERowOver\';" ' . ($k % 2 == 1 ? 'class="TEaltRow" onmouseout="this.className=\'TEaltRow\';"' : 'class="TERow" onmouseout="this.className=\'TERow\';"') . ' '; if (TERowOnClickEdit == false || !$this->getConfig('allowEdit')) { $TEMainList .= ' onclick="TERowHighlight(this, this.firstChild.firstChild, \'' . ($k % 2 == 1 ? 'TEaltRow' : 'TERow') . '\');"'; } elseif ($this->getConfig('allowEdit')) { $TEMainList .= 'style="cursor:pointer;"'; }
/** * Called when a row is to be edited * * @param mixed $id Optional ID of row to edit */ function displayAddEditCopyPage($id) { foreach (array_keys($this->fields) as $field) { if (empty($this->fields[$field]['noEdit'])) { $fields[] = $field; } } // Edit/copy specific if (isset($_GET['edit']) or isset($_GET['copy'])) { /** * Data filters */ if (!empty($this->dataFilters)) { $filters = implode(' AND ', $this->dataFilters); } else { $filters = 1; } $fields = implode(', ', $fields); list($tables, $joinClause) = $this->getQueryTables(); // Get row data $row = $this->dbGetRow("SELECT {$fields} FROM {$tables} WHERE {$joinClause} AND {$filters} AND {$this->pk} = {$id}"); if ($row === false) { $this->errors[] = 'Failed to find specified row in database'; return; } // If copying, nuke the primary key so we don't get conflicts on insert if (isset($_GET['copy'])) { $row[$this->pk] = '0'; } $title = isset($_GET['edit']) ? 'Edit' : 'Copy'; // Add specific } else { $row = array_flip($fields); foreach ($row as $k => $v) { $row[$k] = isset($this->fields[$k]['default']) ? $this->fields[$k]['default'] : null; } $title = 'Add'; } /** * Use the posted data if we're displaying an error */ if ((!empty($this->errors) or !empty($this->contextErrors)) and !empty($_POST)) { foreach ($row as $k => $v) { if (isset($_POST[$k])) { $row[$k] = $_POST[$k]; } } } $url = new TableEditor_URL(); $actionURL = $url->getURL(true); $this->displayHeader(); ?> <h2><?php echo $title; ?> Row</h2> <form action="<?php echo $actionURL; ?> " method="post"> <table border="0"> <?if($row):?> <?foreach($row as $field => $value):?> <tr> <th><?php echo !empty($this->fields[$field]['required']) ? '<span class="requiredAsterisk">*</span>' : ''; ?> <?php echo $this->fields[$field]['display']; ?> </th> <?if($this->config['useFunctions']):?> <td valign="top"> <select name="function[<?php echo $field; ?> ]" onchange="enableApply()"> <option></option> <?foreach(array_keys($this->config['functions']) as $f):?> <option value="<?php echo $f; ?> "><?php echo $f; ?> </option> <?endforeach?> </select> </td> <?endif?> <td> <?php switch ($this->fields[$field]['input']) { case 'textarea': printf('<textarea name="%s" cols="50" rows="12" onkeyup="enableApply()" %s>%s</textarea>', htmlspecialchars($field), $field == $this->pk && !$this->getConfig('allowPKEditing') ? 'disabled' : '', $value); break; case 'select': printf('<select name="%s" %s onchange="enableApply()"><option value="">Select...</option>', htmlspecialchars($field), $field == $this->pk && !$this->getConfig('allowPKEditing') ? 'disabled' : ''); // Print option tags foreach ($this->fields[$field]['values'] as $k => $v) { printf('<option value="%s" %s>%s</option>', htmlspecialchars($k), (string) $k === $value ? 'selected' : '', $v); } echo '</select>'; break; case 'bitmask': printf('<select name="%s[]" %s onchange="enableApply()" size="7" multiple>', htmlspecialchars($field), $field == $this->pk && !$this->getConfig('allowPKEditing') ? 'disabled' : ''); // Print option tags foreach ($this->fields[$field]['values'] as $k => $v) { printf("<option value=\"%s\" %s>%s</option>\n", htmlspecialchars($k), $k & $value ? 'selected' : '', htmlspecialchars($v)); } echo '</select>'; break; case 'date': printf('<input type="text" name="%s" value="%s" onkeyup="enableApply()" %s> <a href="javascript: void(document.forms[0].elements[\'%s\'].value = currentDate())" onclick="enableApply()" title="Click to set current date">Now</a>', htmlspecialchars($field), htmlspecialchars($value), $field == $this->pk && !$this->getConfig('allowPKEditing') ? 'disabled' : '', htmlspecialchars($field)); break; case 'time': printf('<input type="text" name="%s" value="%s" onkeyup="enableApply()" %s> <a href="javascript: void(document.forms[0].elements[\'%s\'].value = currentTime())" onclick="enableApply()" title="Click to set current time">Now</a>', htmlspecialchars($field), htmlspecialchars($value), $field == $this->pk && !$this->getConfig('allowPKEditing') ? 'disabled' : '', htmlspecialchars($field)); break; case 'datetime': printf('<input type="text" name="%s" value="%s" onkeyup="enableApply()" %s> <a href="javascript: void(document.forms[0].elements[\'%s\'].value = currentDateTime())" onclick="enableApply()" title="Click to set current date and time">Now</a>', htmlspecialchars($field), htmlspecialchars($value), $field == $this->pk && !$this->getConfig('allowPKEditing') ? 'disabled' : '', htmlspecialchars($field)); break; case 'password': printf('<input type="password" name="%s" onkeyup="enableApply()"><br><input type="password" name="%s_confirm" onkeyup="enableApply()"> <i>(confirm)</i><br><input type="checkbox" value="1" name="%s_blank" id="%s_blank"> <label for="%s_blank">Set blank password?</label>', htmlspecialchars($field), htmlspecialchars($field), htmlspecialchars($field), htmlspecialchars($field), htmlspecialchars($field)); break; case 'text': // Technically not need, but here for clarity // Technically not need, but here for clarity default: printf('<input type="text" name="%s" value="%s" onkeyup="enableApply()" %s>', htmlspecialchars($field), $value, $field == $this->pk && !$this->getConfig('allowPKEditing') ? 'disabled' : ''); break; } if (!empty($this->contextErrors[$field])) { printf('<br><span class="contextError">%s</span>', $this->contextErrors[$field]); } ?> </td> </tr> <?endforeach?> <?endif?> <tr> <td colspan="3"> <span class="requiredAsterisk">*</span> Required fields </td> </tr> <tr> <td colspan="3" align="right"> <input type="submit" name="action" style="width: 65px" value="OK"> <input type="submit" name="action" style="width: 65px" value="Cancel"> <input type="submit" name="action" style="width: 65px" value="Apply" disabled> </td> </tr> </table> </form> <?php $this->displayFooter(); exit; }
echo '><option value="">' . TESelectStandar . '</option>'; if ($this->fields[$field]['values']) { foreach ($this->fields[$field]['values'] as $k => $v) { $TESelect = (string) $k === $value ? ' selected' : ''; echo '<option value="' . htmlspecialchars($k) . '"' . $TESelect . '>' . htmlspecialchars($v) . '</option>'; } } echo '</select>'; if (!$this->ArrayHiddenTables[$this->fields[$field]['LinkTable']] && $this->fields[$field]['LinkTable'] && ($edit || $add)) { echo ' <img src="' . TEImagesPath . 'TEActionAdd.gif" srcover="' . TEImagesPath . 'TEActionAddOver.gif" class="TEInputButton" '; if (file_exists("" . TEditorPath . "TEPopupForm.php")) { //Url, Name, Width, Height, Align, Bars) echo 'onclick="TEWindowOpenPopup(\'' . $TEditorPath . 'TEPopupForm.php?table=' . $this->fields[$field]['LinkTable'] . '&add=1&TEPopup=1\', \'PopupAdd\', \'500\', \'500\', \'0\', \'0\')" '; echo 'title="' . TEButtonAdd . '" alt="' . TEButtonAdd . '"> '; } else { $UrlLinkAdd = new TableEditor_URL(); if ($edit) { $TxtRemove = 'edit'; } elseif ($add == 1) { $TxtRemove = 'add'; } $UrlLinkAdd->removeQueryString($TxtRemove); $UrlLinkAdd->removeQueryString($table); $UrlLinkAdd->addQueryString('table', $this->fields[$field]['LinkTable']); $UrlLinkAdd->addQueryString('add', '1'); $UrlLinkAdd = $UrlLinkAdd->getURL(true); echo 'onclick="window.open(\'' . $UrlLinkAdd . '\');" title="' . TEButtonAdd . '" alt="' . TEButtonAdd . '"> '; } } break; case 'file':
{ var Request=new Array(); // alert(ajax.responseText); eval(ajax.responseText); for (key in Request) document.getElementById(key).value=Request[key]; } } } } </script> <?php } break; case "ban_p_bancos": if ($FieldName == "TIPO_MOV_BANCO_ID") { $FieldAction = ' OnChange="recarga_bancos_movimiento(this);" '; $UrlLinkAdd = new TableEditor_URL(); if ($edit) { $TxtRemove = 'edit'; } elseif ($add == 1) { $TxtRemove = 'add'; } $UrlLinkAdd->removeQueryString($TxtRemove); $UrlLinkAdd->removeQueryString("tipo_mov_banco_id"); $UrlLinkAdd->removeQueryString($table); $UrlLinkAdd->addQueryString('table', $table); $UrlLinkAdd->addQueryString('add', '1'); $UrlLinkAdd = $UrlLinkAdd->getURL(true); ?> <script language="javascript"> function recarga_bancos_movimiento(elemento) {
<?php $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; }
function TEButtonsPreviousNext($Id, $Action) { $url = new TableEditor_URL(); $Buttons = ''; $Buttons .= '<table cellpadding="0" cellspacing="0" align="center" width="100%">'; $Buttons .= '<tr>'; $Buttons .= '<td width="50%" style="text-align:left;">'; if (TEPreviousRecord($Id)) { $url->removeQueryString($Action); $url->addQueryString($Action, TEPreviousRecord($Id)); $UrlPrevious = $url->getURL(true); $Buttons .= '<img src="' . TEImagesPath . 'TEActionPrevius.png" srcover="' . TEImagesPath . 'TEActionPreviusOver.png" class="TEInputButton" '; $Buttons .= 'onclick="document.location=\'' . $UrlPrevious . '\';" title="' . TEButtonPrevious . '" alt="' . TEButtonPrevious . '"> '; } $Buttons .= '</td>'; $Buttons .= '<td width="50%" style="text-align:right;">'; if (TENextRecord($Id)) { $url->removeQueryString($Action); $url->addQueryString($Action, TENextRecord($Id)); $UrlNext = $url->getURL(true); $Buttons .= '<img src="' . TEImagesPath . 'TEActionNext.png" srcover="' . TEImagesPath . 'TEActionNextOver.png" class="TEInputButton" '; $Buttons .= 'onclick="document.location=\'' . $UrlNext . '\';" title="' . TEButtonNext . '" alt="' . TEButtonNext . '"> '; } $Buttons .= '</td>'; $Buttons .= '</tr>'; $Buttons .= '</table>'; return $Buttons; }
case "Agregar otro registro": $aux_3 = " checked "; break; default: $aux_1 = " checked "; break; } echo '<input type="radio" name="ActionRedirection" id="ActionRedirection" value="1" ' . $aux_1 . '>Ver todos los registros'; echo ' <input type="radio" name="ActionRedirection" id="ActionRedirection" value="2" ' . $aux_2 . '>Editar este registro'; echo ' <input type="radio" name="ActionRedirection" id="ActionRedirection" value="3" ' . $aux_3 . '>Agregar otro registro'; echo '</td>'; echo '</tr>'; } echo '<tr>'; echo '<td colspan="3" align="center">'; $url = new TableEditor_URL(); if ($edit) { $TxtRemove = 'edit'; } elseif ($add == 1) { $TxtRemove = 'add'; } $url->removeQueryString($TxtRemove); $url->removeQueryString("importa_tabla"); $url->removeQueryString("importa_id"); $okURL = $url->getURL(false); if ($edit) { $url->addQueryString('view', $edit); $ViewURL = $url->getURL(true); $url->removeQueryString('view'); } $url->addQueryString('add', '1');
<?php //if($edit>0 || $add>0) if ($table == "cip") { if ($edit > 0) { $URL_cip = new TableEditor_URL(); $URL_cip->removeQueryString("menu_opcion"); $URL_cip->removeQueryString($table); $URL_cip = $URL_cip->getURL(true); if ($menu_opcion == "") { $menu_opcion = "datos"; } $menu = array(array($URL_cip . "&menu_opcion=datos", "Datos", $menu_opcion == "datos"), array($URL_cip . "&menu_opcion=pi", "Pedido Interno", $menu_opcion == "pi"), array($URL_cip . "&menu_opcion=oc", "OC", $menu_opcion == "oc"), array($URL_cip . "&menu_opcion=facturacion", "Facturacion", $menu_opcion == "facturacion"), array($URL_cip . "&menu_opcion=entregas", "Entregas", $menu_opcion == "entregas"), array($URL_cip . "&menu_opcion=comisiones", "Comisiones", $menu_opcion == "comisiones"), array($URL_cip . "&menu_opcion=garantias", "Garantias", $menu_opcion == "garantias")); muestra_menu_interno($menu); } else { } }
$("[id=tr_PM_HORA_LLEGADA_DESTINO_2]").slideUp(); } else { $("[id=tr_PM_HORA_LLEGADA_DESTINO_2]").slideDown() $("[id=tr_PM_HORA_SALIDA_DESTINO_2]").slideDown(); } } </script> <?php } if ($FieldName == "SERVICIO") { $FieldAction = ' OnChange="recarga_tipo_servicio(this);" '; $UrlLinkAdd = new TableEditor_URL(); if ($edit) { $TxtRemove = 'edit'; } elseif ($add == 1) { $TxtRemove = 'add'; } $UrlLinkAdd->removeQueryString($TxtRemove); $UrlLinkAdd->removeQueryString("servicio"); $UrlLinkAdd->removeQueryString($table); $UrlLinkAdd->addQueryString('table', $table); $UrlLinkAdd->addQueryString('add', '1'); $UrlLinkAdd = $UrlLinkAdd->getURL(true); ?> <script language="javascript"> function recarga_tipo_servicio(elemento) {
<script language="javascript"> function consulta() { var searchStr=document.getElementById('cuenta_id').value; location.href = '<?php echo $clearURL; ?> ' + '&'+'cuenta_id=' + searchStr; } </script> <?php break; case "_sample_vta_p_facturas": $url = new TableEditor_URL(); $url->removeQueryString('folio_fiscal'); $nuevoURL = $url->getURL(true); $url_detalle = new TableEditor_URL(); $url_detalle->removeQueryString('table'); $url_detalle->addQueryString('table', "_sample_vta_p_facturas_detalle"); $nuevoURL_detalle = $url_detalle->getURL(true); $TEMainList .= '<tr><td colspan=2>'; $TEMainList .= '<input name="folio_fiscal" type text>'; $TEMainList .= '<input type=button value="Buscar factura" onclick=consulta()>'; $TEMainList .= '</td><td colspan=2>'; $TEMainList .= '<input name="buscar_en_partidas" type text>'; $TEMainList .= '<input type=button value="Buscar en partidas" onclick=consulta_partidas()>'; $TEMainList .= '</td></tr>'; ?> <script language="javascript"> function consulta() { var searchStr=document.getElementById('folio_fiscal').value;