Jump to content
Fórum Script Brasil
  • 0

mover dados da bd


ooooBR

Question

bom, vou tentar explicar as modificações que necessito diante do codigo que tenho...

1.nessa tela preciso incluir um botão com a funcionalidade incluir, e quando clicado no incluir... fosse exibido abaixo tudo o que foi digitado, possibilitando incluir mais documentos... (posso utilizar o mesmo campo? ou é necessário inumeros campos... tipo documento1,2,3,4,5,6... etc

<?php require_once('Connections/data.php'); ?><?php require_once('Connections/data.php'); ?><?php
if (!isset($_SESSION)) {
  session_start();
}
$MM_authorizedUsers = "";
$MM_donotCheckaccess = "true";

// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) { 
  // For security, start by assuming the visitor is NOT authorized. 
  $isValid = False; 

  // When a visitor has logged into this site, the Session variable MM_Username set equal to their username. 
  // Therefore, we know that a user is NOT logged in if that Session variable is blank. 
  if (!empty($UserName)) { 
    // Besides being logged in, you may restrict access to only certain users based on an ID established when they login. 
    // Parse the strings into arrays. 
    $arrUsers = Explode(",", $strUsers); 
    $arrGroups = Explode(",", $strGroups); 
    if (in_array($UserName, $arrUsers)) { 
      $isValid = true; 
    } 
    // Or, you may restrict access to only certain users based on their username. 
    if (in_array($UserGroup, $arrGroups)) { 
      $isValid = true; 
    } 
    if (($strUsers == "") && true) { 
      $isValid = true; 
    } 
  } 
  return $isValid; 
}

$MM_restrictGoTo = "index.php";
if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {   
  $MM_qsChar = "?";
  $MM_referrer = $_SERVER['PHP_SELF'];
  if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
  if (isset($QUERY_STRING) && strlen($QUERY_STRING) > 0) 
  $MM_referrer .= "?" . $QUERY_STRING;
  $MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
  header("Location: ". $MM_restrictGoTo); 
  exit;
}
?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
  $insertSQL = sprintf("INSERT INTO ordemservico (Remetente, Data_Entrada, Hora_Entrada, setor, Equipamento, nNumero, nFornecedor, nEmissao, gFornecedor, gEmissao, mTransp, mNumero, cTransp, cNumero, pPedido, pComprador, bBanco, bValor, bVencimento, fBanco, fValor, fVencimento, rBanco, rValor, rVencimento, Descricao, mDescricao, mQuantidade, tNumero, tPeso, tData, oDescricao, oQuantidade, Problemacliente
) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
                       GetSQLValueString($_POST['Remetente'], "text"),
                       GetSQLValueString($_POST['Data_Entrada'], "text"),
                       GetSQLValueString($_POST['Hora_Entrada'], "text"),
                       GetSQLValueString($_POST['setor'], "text"),
                       GetSQLValueString($_POST['Equipamento'], "text"),
                       GetSQLValueString($_POST['nNumero'], "text"),
                       GetSQLValueString($_POST['nFornecedor'], "text"),
                       GetSQLValueString($_POST['nEmissao'], "text"),
                       GetSQLValueString($_POST['gFornecedor'], "text"),
                       GetSQLValueString($_POST['gEmissao'], "text"),
                       GetSQLValueString($_POST['mTransp'], "text"),
                       GetSQLValueString($_POST['mNumero'], "text"),
                       GetSQLValueString($_POST['cTransp'], "text"),
                       GetSQLValueString($_POST['cNumero'], "text"),
                       GetSQLValueString($_POST['pPedido'], "text"),
                       GetSQLValueString($_POST['pComprador'], "text"),
                       GetSQLValueString($_POST['bBanco'], "text"),
                       GetSQLValueString($_POST['bValor'], "text"),
                       GetSQLValueString($_POST['bVencimento'], "text"),
                       GetSQLValueString($_POST['fBanco'], "text"),
                       GetSQLValueString($_POST['fValor'], "text"),
                       GetSQLValueString($_POST['fVencimento'], "text"),
                       GetSQLValueString($_POST['rBanco'], "text"),
                       GetSQLValueString($_POST['rValor'], "text"),
                       GetSQLValueString($_POST['rVencimento'], "text"),
                       GetSQLValueString($_POST['Descricao'], "text"),
                       GetSQLValueString($_POST['mDescricao'], "text"),
                       GetSQLValueString($_POST['mQuantidade'], "text"),
                       GetSQLValueString($_POST['tNumero'], "text"),
                       GetSQLValueString($_POST['tPeso'], "text"),
                       GetSQLValueString($_POST['tData'], "text"),
                       GetSQLValueString($_POST['oDescricao'], "text"),
                       GetSQLValueString($_POST['oQuantidade'], "text"),
                       GetSQLValueString($_POST['Problemacliente'], "text"));

  mysql_select_db($database_data, $data);
  $Result1 = mysql_query($insertSQL, $data) or die(mysql_error());

  $insertGoTo = "confirma_print.php";
  if (isset($_SERVER['QUERY_STRING'])) {
    $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
    $insertGoTo .= $_SERVER['QUERY_STRING'];
  }
  header(sprintf("Location: %s", $insertGoTo));
}

if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

$maxRows_DetailRS1 = 10;
$pageNum_DetailRS1 = 0;
if (isset($_GET['pageNum_DetailRS1'])) {
  $pageNum_DetailRS1 = $_GET['pageNum_DetailRS1'];
}
$startRow_DetailRS1 = $pageNum_DetailRS1 * $maxRows_DetailRS1;

$colname_DetailRS1 = "-1";
if (isset($_GET['recordID'])) {
  $colname_DetailRS1 = $_GET['recordID'];
}
mysql_select_db($database_data, $data);
$query_DetailRS1 = sprintf("SELECT * FROM funcionario WHERE codigo = %s", GetSQLValueString($colname_DetailRS1, "int"));
$query_limit_DetailRS1 = sprintf("%s LIMIT %d, %d", $query_DetailRS1, $startRow_DetailRS1, $maxRows_DetailRS1);
$DetailRS1 = mysql_query($query_limit_DetailRS1, $data) or die(mysql_error());
$row_DetailRS1 = mysql_fetch_assoc($DetailRS1);

if (isset($_GET['totalRows_DetailRS1'])) {
  $totalRows_DetailRS1 = $_GET['totalRows_DetailRS1'];
} else {
  $all_DetailRS1 = mysql_query($query_DetailRS1);
  $totalRows_DetailRS1 = mysql_num_rows($all_DetailRS1);
}
$totalPages_DetailRS1 = ceil($totalRows_DetailRS1/$maxRows_DetailRS1)-1;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Gerenciador de Protocolos - Adicionar Protocolo</title>
<script language="javascript">

function mascara(o,f){ 
    v_obj=o 
    v_fun=f 
    setTimeout("execmascara()",1) 
} 
function execmascara(){ 
    v_obj.value=v_fun(v_obj.value) 
}
function mvalor(v){   
    v=v.replace(/\D/g,"");//Remove tudo o que não é dígito   
    v=v.replace(/(\d)(\d{8})$/,"$1.$2");//coloca o ponto dos milhões   
    v=v.replace(/(\d)(\d{5})$/,"$1.$2");//coloca o ponto dos milhares   
  
    v=v.replace(/(\d)(\d{2})$/,"$1,$2");//coloca a virgula antes dos 2 últimos dígitos   
    return v;   
} 
function svalor(v){   
    v=v.replace(/\D/g,"");//Remove tudo o que não é dígito   
    v=v.replace(/(\d)(\d{12})$/,"$1.$2");//coloca o ponto dos milhões   
    v=v.replace(/(\d)(\d{9})$/,"$1.$2");//coloca o ponto dos milhões   
    v=v.replace(/(\d)(\d{6})$/,"$1.$2");//coloca o ponto dos milhões   
    v=v.replace(/(\d)(\d{3})$/,"$1.$2");//coloca o ponto dos milhares   
    return v;   
} 
</script>

<link href="css/style.css" rel="stylesheet" type="text/css" />
<script>

function formatar(src, mask)
{
  var i = src.value.length;
  var saida = mask.substring(0,1);
  var texto = mask.substring(i)
if (texto.substring(0,1) != saida)
  {
        src.value += texto.substring(0,1);
  }
}

</script>
<script language="JavaScript">
<!--
function muda(qual)
{
uCase = qual.value.toUpperCase();
qual.value = uCase;
}
-->
</script>

<script language="Javascript">
function showDiv(div)
{
document.getElementById("NotaFiscal").className = "invisivel";
document.getElementById("GNP").className = "invisivel";
document.getElementById("Minuta").className = "invisivel";
document.getElementById("Conhecimento").className = "invisivel";
document.getElementById("Pedido").className = "invisivel";
document.getElementById("Boleto").className = "invisivel";
document.getElementById("Fatura").className = "invisivel";
document.getElementById("Recibo").className = "invisivel";
document.getElementById("Minuta").className = "invisivel";
document.getElementById("Documento").className = "invisivel";
document.getElementById("Material").className = "invisivel";
document.getElementById("Ticket").className = "invisivel";
document.getElementById("Outros").className = "invisivel";
document.getElementById(div).className = "visivel";
}

</script>
<style>
.invisivel { display: none; }
.visivel { visibility: visible; }

</style>
</head>

<body>
<table width="100%" border="0" cellpadding="0" cellspacing=" 0">
  <tr>
    <td width="15" valign="top"><div align="center"><img src="Imagens/cadeado.gif" alt="" width="30" height="30" /></div></td>
    <td><b><font color="#FF0000"><span class="style7">Intranet</span></font> -<a href="fechar.php"> Fechar Janela</a></b><p>&nbsp;</td>
  </tr>
  <tr>
    <td valign="top">&nbsp;</td>
    <td><table border="0" cellspacing="3" cellpadding="0" class="verdana" width="498" >
      <form action="<?php echo $editFormAction; ?>" method="POST" name="form1" id="form1">
        <tr>
          <td width="523" height="40" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td width="75"><p><b>Remetente: <br />
                          <td><b>
                          <input name="Remetente" type="text" id="Remetente" size="5" maxlength="15" readonly value="<?php echo $_SESSION['MM_Username']; ?>" />
                          <br />
              </b></td>
              <td valign="top"><p><b>Setor destinatário:</b><br />
                  
                <font size="3">
                <select name="setor" size="1" class="select">
                  <option>Selecione</option>
                  <option value="Almoxarifado">Almoxarifado</option>
                  <option value="Compras">Compras</option>
                  <option value="Controladoria">Controladoria</option>
                  <option value="Documentação">Documentação</option>
                  <option value="Faturamento">Faturamento</option>
                  <option value="Financeiro">Financeiro</option>
                  <option value="Fiscal">Fiscal</option>
                  <option value="Garantia">Garantia</option>
                  <option value="Planejamento">Planejamento</option>
                  <option value="Vendas">Vendas</option>
                </select></font><br /></td>
            </tr>
            </table></td>
        </tr>
        <tr>
          <td><table width="100%" border="0" cellspacing=" 0" cellpadding="0">
            <tr>
              <td width="120" valign="top">&nbsp;<p><b>Documento:</b><br />
              <b>
        <select id="Equipamento" name="Equipamento" onchange="showDiv(this.value);">
        <option>Selecione</option>
        <option value="NotaFiscal">Nota Fiscal</option>
        <option value="GNP">GNP</option>
        <option value="Minuta">Minuta</option>
        <option value="Conhecimento">Conhecimento</option>
        <option value="Pedido">Pedido</option>
        <option value="Boleto">Boleto</option>
        <option value="Fatura">Fatura</option>
        <option value="Recibo">Recibo</option>
        <option value="Documento">Documento</option>
        <option value="Material">Material</option>
        <option value="Ticket">Ticket</option>
        <option value="Outros">Outros</option>
</select></td>
        <td>
              <div id="NotaFiscal" class="invisivel"><b>&nbsp;<p>Número: <input name="nNumero" type="text" class="select" id="nNumero" size="15" maxlength="25" onkeypress="mascara(this, svalor);"/><br><br>
                  Fornecedor: <input name="nFornecedor" type="text" class="select" id="nFornecedor" size="70" maxlength="150" onKeyUp="muda(this)"/><br><br>
                  Data de Emissão: <input name="nEmissao" type="text" class="select" id="nEmissao" onkeypress="formatar(this, '##/##/####')" size="6" maxlength="10" /></div>

              <div id="GNP" class="invisivel"><b>Fornecedor: <input name="gFornecedor" type="text" class="select" id="gFornecedor" size="70" maxlength="150" onKeyUp="muda(this)"/><br><br>
                  Data de Emissão: <input name="gEmissao" type="text" class="select" id="gEmissao" onkeypress="formatar(this, '##/##/####')" size="6" maxlength="10" /></div>

              <div id="Minuta" class="invisivel"><b>Transportadora: <input name="mTransp" type="text" class="select" id="mTransp" size="55" maxlength="100" onKeyUp="muda(this)"/><br><br>
                  Número: <input name="mNumero" type="text" class="select" id="mNumero" size="15" maxlength="25" onkeypress="mascara(this, svalor);"/></div>

              <div id="Conhecimento" class="invisivel"><b>Transportadora: <input name="cTransp" type="text" class="select" id="cTransp" size="55" maxlength="100" onKeyUp="muda(this)"/><br><br>
                  Número: <input name="cNumero" type="text" class="select" id="cNumero" size="15" maxlength="25" onkeypress="mascara(this, svalor);"/></div>

              <div id="Pedido" class="invisivel"><b>Número: <input name="pPedido" type="text" class="select" id="pPedido" size="15" maxlength="25" onkeypress="mascara(this, svalor);"/><br><br>
                  Comprador: <input name="pComprador" type="text" class="select" id="pComprador" size="25" maxlength="25" onKeyUp="muda(this)"/></div>

              <div id="Boleto" class="invisivel"><b>Banco: <input name="bBanco" type="text" class="select" id="bBanco" size="55" maxlength="100" onKeyUp="muda(this)"/><br><br>
                  Valor R$: <input name="bValor" type="text" class="select" id="bValor" onkeypress="mascara(this, mvalor);" size="10" maxlength="13"><br><br>
                  Vencimento: <input name="bVencimento" type="text" class="select" id="bVencimento" onkeypress="formatar(this, '##/##/####')" size="6" maxlength="10"/></div>

              <div id="Fatura" class="invisivel"><b>Banco: <input name="fBanco" type="text" class="select" id="fBanco" size="52" maxlength="100" onKeyUp="muda(this)"/><br><br>
                  Valor R$: <input name="fValor" type="text" class="select" id="fValor" onkeypress="mascara(this, mvalor);" size="10" maxlength="13"><br><br>
                  Vencimento: <input name="fVencimento" type="text" class="select" id="fVencimento" onkeypress="formatar(this, '##/##/####')" size="6" maxlength="10"/></div>

              <div id="Recibo" class="invisivel"><b>Banco: <input name="rBanco" type="text" class="select" id="rBanco" size="52" maxlength="100" onKeyUp="muda(this)"/><br><br>
                  Valor R$: <input name="rValor" type="text" class="select" id="rValor" onkeypress="mascara(this, mvalor);" size="10" maxlength="13"><br><br>
                  Vencimento: <input name="rVencimento" type="text" class="select" id="rVencimento" onkeypress="formatar(this, '##/##/####')" size="6" maxlength="10"/></div>

              <div id="Documento" class="invisivel"><b>Descrição: <input name="Descricao" type="text" class="select" id="Descricao" size="65" maxlength="150" onKeyUp="muda(this)"/></div>

              <div id="Material" class="invisivel"><b>Descrição: <input name="mDescricao" type="text" class="select" id="mDescricao" size="65" maxlength="150" onKeyUp="muda(this)"/><br><br>
                  Quantidade: <input name="mQuantidade" type="text" class="select" id="mQuantidade" size="6" maxlength="10" onKeyUp="muda(this)"/></div>

              <div id="Ticket" class="invisivel"><b>Número: <input name="tNumero" type="text" class="select" id="tNumero" size="15" maxlength="21" onkeypress="mascara(this, svalor);"/><br><br>
                  Peso: <input name="tPeso" type="text" class="select" id="tPeso" onkeypress="mascara(this, mvalor);" size="6" maxlength="10"> Kg<br><br>
                  Data: <input name="tData" type="text" class="select" id="tData" onkeypress="formatar(this, '##/##/####')" size="6" maxlength="10"/></div>

              <div id="Outros" class="invisivel"><b>Descrição: <input name="oDescricao" type="text" class="select" id="oDescricao" size="65" maxlength="150" onKeyUp="muda(this)"/><br><br>
                  Quantidade: <input name="oQuantidade" type="text" class="select" id="oQuantidade" size="6" maxlength="10" onKeyUp="muda(this)"/><p>&nbsp;</div>
</table>
      </td>
        </tr>
        <tr>
          <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td width="92">&nbsp;<p><b>Data de envio: </b>
                                        <input name="Data_Entrada" type="text" id="Data_Entrada" onkeypress="formatar(this, '##/##/####')" size="6" maxlength="10" readonly value="<?php echo $data = date("d/m/Y "); ?>" />
               </b></td>
              <td width="92"><b>Hora de envio: </b>
                                        <input name="Hora_Entrada" type="text" id="Hora_Entrada" onkeypress="formatar(this, '##:##:##')" size="4" maxlength="10" readonly value="<?php echo $data = date("H:i:s "); ?>" />
              </b></td>
            </tr>
          </table></td>
        </tr>
        <tr>
          <td height="120"><table width="100%" border="0" cellspacing=" 0" cellpadding="0">
            <tr>
              <td></br><b>Observações:</b><br />
                                      <b>
                                      <textarea name="Problemacliente" cols="85" rows="5" class="select" id="Problemacliente" onKeyUp="muda(this)"></textarea>
                                      </b></td>
            </tr>
          </table></td>
        </tr>
        <tr align="right">
          <td height="35">&nbsp;<p><input type="submit" name="button" id="button" value=" Cadastrar Protocolo" />
            </td>
        </tr>
        <input type="hidden" name="MM_insert" value="form1" />
      </form>
    </table></td>
  </tr>
</table>



</body>
</html>
<?php
mysql_free_result($DetailRS1);
?>

2.nessa tela o projeto é incluir um botão encaminhar... no caso eu mandaria os documentos para uma outra pessoa (porém na caso de ter recebido 5 documentos... eu pudesse selecionar quais eu quisesse, por exemplo... eu encaminharia apenas 2 mais mantendo o número de identificação

<?php require_once('Connections/data.php'); ?><?php require_once('Connections/data.php'); ?><?php

if (!isset($_SESSION)) {

session_start();

}

$MM_authorizedUsers = "";

$MM_donotCheckaccess = "true";

// *** Restrict Access To Page: Grant or deny access to this page

function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) {

// For security, start by assuming the visitor is NOT authorized.

$isValid = False;

// When a visitor has logged into this site, the Session variable MM_Username set equal to their username.

// Therefore, we know that a user is NOT logged in if that Session variable is blank.

if (!empty($UserName)) {

// Besides being logged in, you may restrict access to only certain users based on an ID established when they login.

// Parse the strings into arrays.

$arrUsers = Explode(",", $strUsers);

$arrGroups = Explode(",", $strGroups);

if (in_array($UserName, $arrUsers)) {

$isValid = true;

}

// Or, you may restrict access to only certain users based on their username.

if (in_array($UserGroup, $arrGroups)) {

$isValid = true;

}

if (($strUsers == "") && true) {

$isValid = true;

}

}

return $isValid;

}

$MM_restrictGoTo = "index.php";

if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {

$MM_qsChar = "?";

$MM_referrer = $_SERVER['PHP_SELF'];

if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";

if (isset($QUERY_STRING) && strlen($QUERY_STRING) > 0)

$MM_referrer .= "?" . $QUERY_STRING;

$MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck= . urlencode($MM_referrer);

header("Location: ". $MM_restrictGoTo);

exit;

}

?>

<?php

if (!function_exists("GetSQLValueString")) {

function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")

{

$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

switch ($theType) {

case "text":

$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";

break;

case "long":

case "int":

$theValue = ($theValue != "") ? intval($theValue) : "NULL";

break;

case "double":

$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";

break;

case "date":

$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";

break;

case "defined":

$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;

break;

}

return $theValue;

}

}

$editFormAction = $_SERVER['PHP_SELF];

if (isset($_SERVER['QUERY_STRING'])) {

$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);

}

if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) {

$updateSQL = sprintf("UPDATE ordemservico SET Data_Agenda=%s, Hora_Agenda=%s, Recebedor=%s, Arquivo=%s WHERE Cod_Equipamento=%s",

GetSQLValueString($_POST['Data_Agenda'], "text"),

GetSQLValueString($_POST['Hora_Agenda'], "text"),

GetSQLValueString($_POST['Recebedor'], "text"),

GetSQLValueString($_POST['Arquivo'], "text"),

GetSQLValueString($_POST['Cod_Equipamento'], "int"));

mysql_select_db($database_data, $data);

$Result1 = mysql_query($updateSQL, $data) or die(mysql_error());

$updateGoTo = "fechar.php";

if (isset($_SERVER['QUERY_STRING'])) {

$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";

$updateGoTo .= $_SERVER['QUERY_STRING'];

}

header(sprintf("Location: %s", $updateGoTo));

}

if (!function_exists("GetSQLValueString")) {

function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")

{

$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

switch ($theType) {

case "text":

$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";

break;

case "long":

case "int":

$theValue = ($theValue != "") ? intval($theValue) : "NULL";

break;

case "double":

$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";

break;

case "date":

$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";

break;

case "defined":

$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;

break;

}

return $theValue;

}

}

if (!function_exists("GetSQLValueString")) {

function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")

{

$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

switch ($theType) {

case "text":

$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";

break;

case "long":

case "int":

$theValue = ($theValue != "") ? intval($theValue) : "NULL";

break;

case "double":

$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";

break;

case "date":

$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";

break;

case "defined":

$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;

break;

}

return $theValue;

}

}

$maxRows_DetailRS1 = 10;

$pageNum_DetailRS1 = 0;

if (isset($_GET['pageNum_DetailRS1'])) {

$pageNum_DetailRS1 = $_GET['pageNum_DetailRS1'];

}

$startRow_DetailRS1 = $pageNum_DetailRS1 * $maxRows_DetailRS1;

$colname_DetailRS1 = "-1";

if (isset($_GET['recordID'])) {

$colname_DetailRS1 = $_GET['recordID'];

}

mysql_select_db($database_data, $data);

$query_DetailRS1 = sprintf("SELECT * FROM ordemservico WHERE Cod_Equipamento = %s", GetSQLValueString($colname_DetailRS1, "int"));

$query_limit_DetailRS1 = sprintf("%s LIMIT %d, %d", $query_DetailRS1, $startRow_DetailRS1, $maxRows_DetailRS1);

$DetailRS1 = mysql_query($query_limit_DetailRS1, $data) or die(mysql_error());

$row_DetailRS1 = mysql_fetch_assoc($DetailRS1);

if (isset($_GET['totalRows_DetailRS1'])) {

$totalRows_DetailRS1 = $_GET['totalRows_DetailRS1'];

} else {

$all_DetailRS1 = mysql_query($query_DetailRS1);

$totalRows_DetailRS1 = mysql_num_rows($all_DetailRS1);

}

$totalPages_DetailRS1 = ceil($totalRows_DetailRS1/$maxRows_DetailRS1)-1;

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>Untitled Document</title>

<script type=text/javascript>

documentall = document.all;

/*

* função para formatação de valores monetários retirada de

* http://jonasgalvez.com/br/blog/2003-08/egocentrismo

*/

function formatamoney© {

var t = this; if(c == undefined) c = 2;

var p, d = (t=t.split("."))[1].substr(0, c);

for(p = (t=t[0]).length; (p-=3) >= 1;) {

t = t.substr(0,p) + "." + t.substr(p);

}

return t+"."+d+Array(c+1-d.length).join(0);

}

S

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      152.2k
    • Total Posts
      652k
×
×
  • Create New...