Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Fala Galera!
To com um probleminha aki! :angry:
Estou desenvolvendo um sistema aki para empresa onde trabalho: agencia de turismo!
Ja fiz varios cadastros para o sistema, como CADASTRO DE RESERVAS! Mais agora estou com dificuldade no cadastro de OS!(Ordem de Serviço).
A idéia é a seguinte:
1- Pagina adicionar_os.php:
Essa pagina contem dados das reservas cadastradas carregadas por um RecordSet!
Contem tambem dados adiocionais referente a ordem de serviço.
Até ai tudo ok!
O problema é que nao estou conseguindo, na verdade nao tenho nem ideia de como fazer para que quando eu cadastre uma OS, nao possa cadastra-la de novo com a mesma reserva.
Pagina adicionar_os.php:
<?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;
}
}
$currentPage = $_SERVER["PHP_SELF"];
$maxRows_Recordset1 = 1;
$pageNum_Recordset1 = 1;
if (isset($_GET['pageNum_Recordset1'])) {
$pageNum_Recordset1 = $_GET['pageNum_Recordset1'];
}
$startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;
mysql_select_db($database_data, $data);
$query_Recordset1 = "SELECT * FROM reserva";
$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);
$Recordset1 = mysql_query($query_limit_Recordset1, $data) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
if (isset($_GET['totalRows_Recordset1'])) {
$totalRows_Recordset1 = $_GET['totalRows_Recordset1']; $all_Recordset1 = mysql_query($query_Recordset1);
$totalRows_Recordset1 = mysql_num_rows($all_Recordset1);
}
$totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1;
$queryString_Recordset1 = "";
if (!empty($_SERVER['QUERY_STRING'])) {
$params = explode("&", $_SERVER['QUERY_STRING']);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "pageNum_Recordset1") == false &&
stristr($param, "totalRows_Recordset1") == false) {
array_push($newParams, $param);
}
}
if (count($newParams) != 0) {
$queryString_Recordset1 = "&" . htmlentities(implode("&", $newParams));
}
}
$queryString_Recordset1 = sprintf("&totalRows_Recordset1=%d%s", $totalRows_Recordset1, $queryString_Recordset1);
?><html xmlns="[http://www.w3.org/1999/xhtml">](http://www.w3.org/1999/xhtml)
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<table width="100%" border="0" cellpadding="0" cellspacing=" 0">
<tr>
<td width="15"><div align="center"><img src="Imagens/7513_32x32.png" alt="OS" width="32" height="32" /></div></td>
<td><font color="#666666"><b>Incluir OS -<font color="#666666"><b><b><a href="fechar.php"> Fechar Janela</a></b></b></font></b></font></td>
</tr>
</table>
<form action="cadastrar3.php" method="post" enctype="multipart/form-data" name="form1" id="form1">
<fieldset>
<legend class="titulo">Dados da OS</legend>
<table width="78" border="0" align="left">
<tr>
<td>OS N°</td>
</tr>
<tr>
<td><font color="#666666"><b>
<input name="codigo" type="text" disabled="disabled" class="select" id="codigo" size="12" maxlength="12" readonly="readonly" />
</b></font></td>
</tr>
</table>
<table width="66" border="0" align="left">
<tr>
<td>Data</td>
</tr>
<tr>
<td><font color="#666666"><b>
<input type="text" name="data" class="select" onkeypress="formatar(this, '##/##/####')" maxlength="10" size="10" id="data" />
</b></font></td>
</tr>
</table>
<p> </p>
</fieldset>
<fieldset>
<legend class="titulo">Dados da Reserva</legend>
<table width="78" border="0" align="left">
<tr>
<td>RESERVA N°</td>
</tr>
<tr>
<td><font color="#666666"><b>
<input name="codigo2" type="text" disabled="disabled" class="select" id="codigo2" value="<?php echo $row_Recordset1['codigo']; ?>" size="12" maxlength="12" readonly="readonly" />
</b></font></td>
</tr>
</table>
<table width="190" border="0" align="left">
<tr>
<td width="184">Pax:</td>
</tr>
<tr>
<td><font color="#666666"><b>
<input name="pax" type="text" class="select" id="pax" value="<?php echo $row_Recordset1['pax']; ?>" size="30" maxlength="30" readonly="readonly" />
</b></font></td>
</tr>
</table>
<table width="78" border="0" align="left">
<tr>
<td>Check-In</td>
</tr>
<tr>
<td><font color="#666666"><b>
<input name="check_in" type="text" class="select" id="check_in" value="<?php echo $row_Recordset1['check_in']; ?>" onkeypress="formatar(this, '##/##/####')" size="10" maxlength="10" readonly="readonly" />
</b></font></td>
</tr>
</table>
<table width="78" border="0" align="left">
<tr>
<td>Check-Out</td>
</tr>
<tr>
<td><font color="#666666"><b>
<input name="check_out" type="text" class="select" id="check_out" value="<?php echo $row_Recordset1['check_out']; ?>" onkeypress="formatar(this, '##/##/####')" size="10" maxlength="10" readonly="readonly" />
</b></font></td>
</tr>
</table>
<table width="87" border="0" align="left">
<tr>
<td>N° de PAX:</td>
</tr>
<tr>
<td><font color="#666666"><b>
<input name="qntpax" type="text" class="select" id="qntpax" value="<?php echo $row_Recordset1['check_out']; ?>" size="12" maxlength="12" readonly="readonly" />
</b></font></td>
</tr>
</table>
<p> </p>
<p> </p>
<table width="107" border="0" align="left">
<tr>
<td>SERVIÇO:</td>
</tr>
<tr>
<td width="108"><select name="servico" id="servico">
<option value="0">Selecione</option>
<?php
mysql_connect("dbmy0029.whservidor.com", "user", "senha");
mysql_select_db("banco");
$sql = "SELECT * FROM servico ORDER BY nome ASC";
$qr = mysql_query($sql) or die(mysql_error());
while($ln = mysql_fetch_assoc($qr)) {
echo '<option value="'.$ln['codigo'].'">'.$ln['nome'].'</option>';
}
?>
</select>
</td>
</tr>
</table>
<table width="156" border="0">
<tr>
<td>Tipo de Serviço:</td>
</tr>
<tr>
<td><font color="#666666"><b>
<input name="servico2" type="text" class="select" id="servico2" value="<?php echo $row_Recordset1['servico']; ?>" size="25" maxlength="25" readonly="readonly" />
</b></font></td>
</tr>
</table>
</fieldset>
<fieldset>
<legend class="titulo">Comissões</legend>
<table width="107" border="0" align="left">
<tr>
<td>Funcionário:</td>
</tr>
<tr>
<td width="108"><select name="funcionario" id="funcionario">
<option value="0">Selecione</option>
<?php
mysql_connect("servidor", "user", "senha");
mysql_select_db("banco");
$sql = "SELECT * FROM funcionario ORDER BY nome ASC";
$qr = mysql_query($sql) or die(mysql_error());
while($ln = mysql_fetch_assoc($qr)) {
echo '<option value="'.$ln['codigo'].'">'.$ln['nome'].'</option>';
}
?>
</select>
</td>
</tr>
</table>
<table width="106" border="0" align="left">
<tr>
<td>Valor</td>
</tr>
<tr>
<td><font color="#666666"><b>
<input type="text" name="valor_func" class="select" maxlength="12" size="12" id="valor_func" />
</b></font></td>
</tr>
</table>
<table width="107" border="0" align="left">
<tr>
<td>Vendedor:</td>
</tr>
<tr>
<td width="108"><select name="vendedor" id="vendedor">
<option value="0">Selecione</option>
<?php
mysql_connect("servidor", "user", "senha");
mysql_select_db("banco");
$sql = "SELECT * FROM funcionario ORDER BY nome ASC";
$qr = mysql_query($sql) or die(mysql_error());
while($ln = mysql_fetch_assoc($qr)) {
echo '<option value="'.$ln['codigo'].'">'.$ln['nome'].'</option>';
}
?>
</select>
</td>
</tr>
</table>
<table width="106" border="0" align="left">
<tr>
<td>Valor</td>
</tr>
<tr>
<td><font color="#666666"><b>
<input type="text" name="valor_vend" class="select" maxlength="12" size="12" id="valor_vend" />
</b></font></td>
</tr>
</table>
<p> </p>
<p> </p>
<p> </p>
<table width="107" border="0" align="left">
<tr>
<td>Guia:</td>
</tr>
<tr>
<td width="108"><select name="guia" id="guia">
<option value="0">Selecione</option>
<?php
mysql_connect("servidor", "user", "senha");
mysql_select_db("banco");
$sql = "SELECT * FROM funcionario ORDER BY nome ASC";
$qr = mysql_query($sql) or die(mysql_error());
while($ln = mysql_fetch_assoc($qr)) {
echo '<option value="'.$ln['codigo'].'">'.$ln['nome'].'</option>';
}
?>
</select>
</td>
</tr>
</table>
<table width="106" border="0" align="left">
<tr>
<td>Valor</td>
</tr>
<tr>
<td><font color="#666666"><b>
<input type="text" name="valor_guia" class="select" maxlength="12" size="12" id="valor_guia" />
</b></font></td>
</tr>
</table>
<table width="107" border="0" align="left">
<tr>
<td>Motorista:</td>
</tr>
<tr>
<td width="108"><select name="motorista" id="motorista">
<option value="0">Selecione</option>
<?php
mysql_connect("servidor", "user", "senha");
mysql_select_db("banco");
$sql = "SELECT * FROM funcionario ORDER BY nome ASC";
$qr = mysql_query($sql) or die(mysql_error());
while($ln = mysql_fetch_assoc($qr)) {
echo '<option value="'.$ln['codigo'].'">'.$ln['nome'].'</option>';
}
?>
</select>
</td>
</tr>
</table>
<table width="106" border="0" align="left">
<tr>
<td>Valor</td>
</tr>
<tr>
<td><font color="#666666"><b>
<input type="text" name="valor_mot" class="select" maxlength="12" size="12" id="valor_mot" />
</b></font></td>
</tr>
</table>
<p></p>
<p> </p>
</fieldset>
<fieldset>
<legend class="titulo">Dados Adicionais</legend>
<table width="142" border="0" align="left">
<tr>
<td>Valor Total da Nota</td>
</tr>
<tr>
<td><font color="#666666"><b>
<input type="text" name="valor_total" class="select" maxlength="18" size="18" id="valor_total" />
</b></font></td>
</tr>
</table>
<table width="117" border="0" align="left">
<tr>
<td>Total Comissões</td>
</tr>
<tr>
<td><font color="#666666"><b>
<input type="text" name="total_comissoes" class="select" maxlength="18" size="18" id="total_comissoes" />
</b></font></td>
</tr>
</table>
<p> </p>
<p> </p>
<p> </p>
<table width="142" border="0" align="left">
<tr>
<td>Pagar Fornecedor</td>
</tr>
<tr>
<td><font color="#666666"><b>
<input type="text" name="valor_fornecedor" class="select" maxlength="18" size="18" id="valor_fornecedor" />
</b></font></td>
</tr>
</table>
<table width="117" border="0" align="left">
<tr>
<td>Valor Retido</td>
</tr>
<tr>
<td><font color="#666666"><b>
<input type="text" name="valor_retido" class="select" maxlength="18" size="18" id="valor_retido" />
</b></font></td>
</tr>
</table>
<p> </p>
</fieldset>
<p> </p>
<p>
<input type="submit" name="Submit" id="Submit" value="Efetuar Cadastro" />
</p>
<input type="hidden" name="codigo" value="<?php echo $row_Recordset1['codigo']; ?>" />
<table border="0">
<tr>
<td><?php if ($pageNum_Recordset1 > 0) { // Show if not first page ?>
<a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, 0, $queryString_Recordset1); ?>"><img src="Imagens/First.gif" alt="1121w" border="0" /></a>
<?php } // Show if not first page ?></td>
<td><?php if ($pageNum_Recordset1 > 0) { // Show if not first page ?>
<a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, max(0, $pageNum_Recordset1 - 1), $queryString_Recordset1); ?>"><img src="Imagens/Previous.gif" alt="321213" border="0" /></a>
<?php } // Show if not first page ?></td>
<td><?php if ($pageNum_Recordset1 < $totalPages_Recordset1) { // Show if not last page ?>
<a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, min($totalPages_Recordset1, $pageNum_Recordset1 + 1), $queryString_Recordset1); ?>"><img src="Imagens/Next.gif" border="0" /></a>
<?php } // Show if not last page ?></td>
<td><?php if ($pageNum_Recordset1 < $totalPages_Recordset1) { // Show if not last page ?>
<a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, $totalPages_Recordset1, $queryString_Recordset1); ?>"><img src="Imagens/Last.gif" border="0" /></a>
<?php } // Show if not last page ?></td>
</tr>
</table>
</form>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>
Quem puder me ajudar, desde ja agradeço.
Abraços.
http://forum.imasters.com.br/public/style_emoticons/default/joia.gif
Carregando comentários...