-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheditInvoiceForm.php
More file actions
50 lines (43 loc) · 2.19 KB
/
Copy patheditInvoiceForm.php
File metadata and controls
50 lines (43 loc) · 2.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
include 'header.php';
echo '<div id="conteudo">
<div class="texto">';
if ($_SESSION['permission'] == "reader")
{
echo 'Precisa de ter permissões de writer para editar documentos!';
exit();
}
$db = new PDO('sqlite:database/documents.db');
$invoices = $db->query('SELECT * FROM Invoice WHERE InvoiceNo = ?');
$invoices->execute(array($_GET['InvoiceNo']));
$invoice = $invoices->fetch();
$idGets = $db->query('SELECT id FROM Invoice WHERE InvoiceNo = ?');
$idGets->execute(array($_GET['InvoiceNo']));
$idGet = $idGets->fetch();
$lines = $db->query('SELECT * FROM Line WHERE idInvoice = ?');
$lines->execute(array($idGet[0]));
$line = $lines->fetchAll();
echo '<form action="editInvoice.php" method="POST">
<h2>Editar Fatura:</h2><br>
Numero de Fatura: <br><input type="text" name="InvoiceNo" value='. $invoice['InvoiceNo'] .' readonly><br><br>
Data da Fatura: <br><input type="date" name="InvoiceDate" value="' . $invoice['InvoiceDate'] .'"><br><br>
ID do Cliente: <br><input type="number" name="CustomerID" value=' . $invoice['CustomerID'] .'><br><br><br>';
$LineNumber = array();
foreach($line as $row)
{
array_push($LineNumber, $row['LineNumber']);
echo '<br>
Numero da Linha: <br><input type="text" name="LineNumber" value='. $row['LineNumber'] .' readonly><br><br>
ID do Produto: <br><input type="number" name="ProductCode[]" value=' . $row['ProductCode'] .'><br><br>
Quantidade Vendida: <br><input type="number" name="Quantity[]" value=' . $row['Quantity'] .'><br><br>
Preço Unitário: <br><input type="number" name="UnitPrice[]" value=' . $row['UnitPrice'] .'><br><br>
Tipo de Taxa: <br><input type="text" name="TaxType[]" value=' . $row['TaxType'] .'><br><br>
Percentagem da Taxa: <br><input type="text" name="TaxPercentage[]" value=' . $row['TaxPercentage'] .'>%<br><br><br>';
}
echo '<br>Total de Imposto: <br><input type="number" name="TaxPayable" value=' . $invoice['TaxPayable'] .'><br><br>
Total sem Imposto: <br><input type="number" name="NetTotal" value=' . $invoice['NetTotal'] .'><br><br>
<input type="submit" value="Editar Fatura">
</form>';
?>
</div>
</div>