0
I wonder if you can help me eliminate the repeat tables, all of which are occupied and still appear in green.
Each table I occupy appears one more of each, that is, if I only have one table occupied, a table 1 appears in red and a table of each, 2, 3 and 4 in green.
If it occupies two tables appear 2 tables one, one in green another in red, equally for table 2 and table 3 and 4 appear 2 each in green. I don’t understand what’s wrong.
.button {
background-color:#60b0df;
width:157px;
height:95px;
margin-right:5px;
margin-top:5px;
margin-bottom:5px;
margin-left:5px;
float:left;
}
.button1 {
width:90px;
height:90px;
float:left;
border-color:#000000;
border-style:solid;
}
.button2 {
margin-top:0px;
}
.button3 {
width:100%;
float: left;
margin-top:15px;
margin-left:10px;
}
.button4 {
height:100%;
margin-left:10px;
float: left;
margin-top:5px;
position:relative;
border-right: 4px solid;
}
.button5 {
width:500px;
float:left;
position:relative;
margin-top:20px;
margin-left:5px;
}
.button6{
width:100%;
float: left;
margin-top:15px;
}
.bt5 {
background-color:#60b0df;
width:157px;
height:40px;
margin-right:5px;
margin-top:0px;
margin-bottom:0px;
float:left;
}
.bt6 {
background-color:#60b0df;
width:70px;
height:40px;
margin-right:0px;
margin-top:0px;
margin-bottom:0px;
margin-left:0px;
float: left;
}
.botao1 {
margin-top:15px;
background-image: url('open.png');
}
.botao2 {
position:absolute;
bottom:5px;
background-image: url('trocar.png');
width:30px;
height:30px;
float:right;
margin-bottom:15px;
right:5px;
margin-top:15px;
}
.botao3 {
margin-top:15px;
background-image: url('save.png');
}
.botao4 {
width:30px;
height:30px;
float: right;
margin-bottom: 15px;
position: absolute;
right: 5px;
bottom: 5px;
margin-top:15px;
background-image: url('exit.png');
}
.botao5 {
margin-top:15px;
background-image: url('incluirComanda.png');
}
.fonts {
font:19px arial, sans-serif;
padding:0px;
text-align:center;
color:#ffffff;
display:flex;
justify-content:center;
align-items:center;
text-decoration:none;
}
.font {
font:12px arial, sans-serif;
padding:0px;
text-align:center;
color:#000000;
display:flex;
justify-content:center;
align-items:center;
}
.linha {
background-color:#60b0df;
width:100%;
height:30px;
margin-top:5px;
margin-bottom:5px;
margin-right:35px;
float:left;
}
.linhafont {
font:15px arial, sans-serif;
color:#ffffff;
text-align:left;
}
.login {
width:100%;
height:100%;
}
.centrar {
text-align: center ;
}
.centrar2 {
text-align: center;
margin-top:50px;
}
.logo1 {
margin-top:5px;
}
.conexao {
width:100%;
height:100%;
}
.total {
margin-bottom:19px;
}
.total1 {
width:100%;
height:100%;
margin-left:5px;
margin-top:5px;
float:left;
padding: 4px;
}
.cabecalho {
width:100%
}
.opcao1 {
float:left;
color:#87CEFA;
margin-left: 15px;
}
.mesas {
float:left;
text-align:center;
margin-right:10px;
}
<?php
include"first_connect.php";
$id = $_GET['id'];
?>
<html>
<head>
<link rel="stylesheet" type="text/css" href="css/styles.css">
<link rel="shortcut icon" href="img/erbonlogo.png"/>
<?php
if($id == 6) {
?>
<title>Banquetes</title>
<?php
}
if($id == 2) {
?>
<title>Bar</title>
<?php
}
if($id == 3) {
?>
<title>Frigobar</title>
<?php
}
if($id == 1) {
?>
<title>Restaurante</title>
<?php
}
if($id == 5) {
?>
<title>Room Service</title>
<?php
}
?>
</head>
<?php
$sql = "SELECT Ac.id AS IdPointOfSaleAccount,
P.id AS IdPointOfSale, P.[pointOfSale] AS PointOfSaleDescription,
Ac.number AS Number, Ac.total AS TotalValue, Ac.isClosed AS IsClosed, Ac.isActive AS IsActive,
T.id AS IdTable, T.tableDescription AS TableDescription, Ac.comments AS Comments,
AcDetail.id AS IdDetails, AcDetail.quantity AS QuantityDetail, AcDetail.valueTotal AS ValueTotalDetails,
AcDetail.isActive AS IsActiveDetail, AcDetail.updatedBy AS UpdateLine,
S.id AS Id, S.[description] AS [Description], S.idServiceAccounts AS IdServiceAccount,
SR.idServiceDepartments AS IdDepartment, (CASE WHEN SR.priceSale = 0 OR SR.priceSale is null
THEN S.priceSale ELSE SR.priceSale END) AS Price,
S.icms AS Tax6, S.iss AS Tax1, S.ir AS Tax2, S.csll AS Tax3, S.pis AS Tax4, S.cofins AS Tax5,
S.isProductKitchen AS IsProductKitchen, S.isServiceTax AS IsServiceTax,
PrinterConfig.printerKitchen1 AS PrinterKitchen1,
PrinterConfig.printerKitchen1FonteTicket AS PrinterKitchen1Font,
PrinterConfig.printerKitchen2 AS PrinterKitchen2,
PrinterConfig.printerKitchen2FonteTicket AS PrinterKitchen2Font,
PrinterConfig.printerKitchen3 AS PrinterKitchen3,
PrinterConfig.printerKitchen3FonteTicket AS PrinterKitchen3Font
FROM PointOfSaleAccount Ac
INNER JOIN PointOfSaleAccountDetails AcDetail ON Ac.id = AcDetail.idPointOfSaleaccount
AND AcDetail.isActive = 1 INNER JOIN Services S ON AcDetail.idService = S.id
LEFT JOIN ServicesPointOfSalePrinterKitchen Printer
ON S.id = Printer.idProduct AND Printer.isActive = 1 AND Printer.idPointOfSale = $id
LEFT JOIN ServicesPrinterKitchen PrinterConfig ON Printer.idServicesPrinterKitchen = PrinterConfig.id
INNER JOIN ServicesDepartmentsRelationship SR ON S.id = SR.idServices AND SR.isActive = 1
AND SR.idServiceDepartments = (SELECT P2.idDepartment FROM PointOfSale P2 WHERE P2.id = Ac.idPointOfSale)
INNER JOIN PointOfSale P ON Ac.idPointOfSale = P.id LEFT JOIN PointOfSalesTables T
ON Ac.idPointOfSaleTable = T.id
WHERE Ac.isClosed = 0 AND Ac.isActive = 1 AND Ac.idPointOfSale = $id
ORDER BY Ac.number";
$result = sqlsrv_query($conn, $sql);
$sql1 = "SELECT P.id AS Id, P.pointOfSale AS [Description], P.printerExtrat1 AS PrinterExtrat1,
P.printerExtrat1FonteTicket AS PrinterExtrat1Font,
P.printerExtrat2 AS PrinterExtrat2, P.printerExtrat2FonteTicket AS PrinterExtrat2Font,
P.printerExtrat3 AS PrinterExtrat3, P.printerExtrat3FonteTicket AS PrinterExtrat3Font,
T.id AS IdTable, T.tableDescription AS TableDescription FROM PointOfSale P
LEFT JOIN PointOfSalesTables T ON P.id = T.idPointOfSale AND T.isActive = 1
WHERE P.isActive = 1 ORDER BY P.pointOfSale";
$result1 = sqlsrv_query($conn, $sql1);
?>
<form action="" method="post">
<div class="button2">
<input type="image" src="image/trocarPDV.png" value="Trocar" name="TrocarPDV">
</div>
<span class="linha linhafont">
<?php
if($id == 6) {
echo "BANQUETES";
}
if($id == 2) {
echo "BAR";
}
if($id == 3) {
echo "FRIGOBAR";
}
if($id == 1) {
echo "RESTAURANTE";
}
if($id == 5) {
echo "ROOM SERVICE";
}
?>
</span>
<div class="button7">
<input style="float:left" type="image" src="image/incluirComanda.png" value="Incluir" name="IncluirComanda">
<?php
if(isset($_POST["TrocarPDV"])) {
header("Location: pag2.php");
}
if(isset($_POST["IncluirComanda"])) {
header("Location: banquetes.php?id=$id");
}
$row[0] = "";
$i = 0;
$conf = 0;
$row12[0] = "";
$i1 = 0;
$conf1 = 0;
$nrow = 0;
while($row1 = sqlsrv_fetch_array($result, SQLSRV_FETCH_NUMERIC)) {
for($j = 0; $j < $i; $j++) {
if($row[$j] == $row1[3]) {
$conf = 1;
}
else {
}
}
if($conf == 1) {
$conf = 0;
}
else {
$resultado3 = $row1[8];
if($id == 2 || $id == 1) {
if($resultado3 == "") {
$resultado1 = $row1[3];
$resultado2 = $row1[4];
$row[$i] = $row1[3];
?>
<span class="button fonts"><?php echo $resultado1;echo "</br>";echo $resultado2;?></span>
</div>
</form>
<?php
$i = $i + 1;
}
else {
for($j1 = 0; $j1 < $i1; $j1++) {
if($row12[$j1] == $resultado3) {
$conf1 = 1;
}
else {
}
}
if($conf1 == 1) {
$conf1 = 0;
}
else {
$row12[$i1] = $resultado3;
$nrow = $i1;
$i1 = $i1 + 1;
}
}
}
else {
$resultado1 = $row1[3];
$resultado2 = $row1[4];
$row[$i] = $row1[3];
?>
<span class="button fonts"><?php echo $resultado1;echo "</br>";echo $resultado2;?></span>
<?php
}
}
}
if($id == 2 || $id == 1) {
?>
<span class="linha linhafont">MESAS</span>
<form action="" method="post">
<div class="button7">
<?php
while($row2 = sqlsrv_fetch_array($result1, SQLSRV_FETCH_NUMERIC)) {
$mesa = $row2[9];
$id2 = $row2[0];
if($id2 == $id) {
for($s = 0; $s <= $nrow; $s ++) {
if($mesa == $row12[$s]) {
?>
<div class="mesas">
<input style="float:left" type="image" src="img/ocupada.jpg"
value="<?php echo $mesa?>" name="<?php echo $mesa?>" height="100">
<p><?php echo $mesa;?>
</div>
<?php
}
else {
?>
<div class="mesas">
<input style="float:left" type="image" src="img/vazia.jpg"
value=<?php echo $mesa?> name=<?php echo $mesa?> height="100">
<p><?php echo $mesa;?>
</div>
<?php
}
?>
</div>
</form>
<?php
}
}
}
}
?>
</html>
How do I debug?
– Melissa Sousa
var_dump($result1); var_dump($result2);
– Alessandro Gonçalves
Result:Resource(4) of type (SQL Server Statement) Resource(5) of type (SQL Server Statement)
– Melissa Sousa
Try print_r($result1), instead of var_dump(), it still wasn’t enough.
– Alessandro Gonçalves
Result: Resource id #4Resource id #5
– Melissa Sousa