-
Notifications
You must be signed in to change notification settings - Fork 1
/
dispatch.php
118 lines (114 loc) · 3.27 KB
/
dispatch.php
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<?php
session_start();
include("class.dispatch.dao.php");
include("class.company.dao.php");
include_once("header.php");
$dao = new DAOdispatch();
$daoCompany = new DAOcompany();
?>
<center><b><u><font face ="Britannic Bold"><h1>Dispatch</h1></font></u></b></center><br>
<a href="form.dispatch.php" class="btn btn-info">Add dispatch</a><br>
<table class="table table-striped">
<tr class ="info">
<td>#</td>
<td>Creation Date</td>
<td>Carrier</td>
<td>Pick Up Number</td>
<td>Pieces</td>
<td>Space</td>
<td>Actual Weight</td>
<td>Assumed Weight</td>
<td>Type</td>
<td>Pallets</td>
<td>Temp</td>
<td>Miles</td>
<td>Load#</td>
<td>Terms</td>
<td>Attention</td>
<td>Reference</td>
<td>Trailer Id</td>
<td>Truck Id</td>
<td>Pay Code</td>
<td>Pay Type</td>
<td>Rate</td>
<td>Advance</td>
<td>Total</td>
<td>Bill To</td>
<td>From Address</td>
<td>To Address</td>
<td><b>Edit</b></td>
<td><b>Delete</b></td>
<td><b>Generate Invoice</b></td>
</tr>
<?php
$rec_per_page = 10;
if(isset($_GET['page']))
$page = $_GET['page'];
else
$page = 1;
$limit1 = ($page-1)*$rec_per_page;
$limit2 = ($page)*$rec_per_page;
$total_recs = $dao->getCount();
$rec = $dao->getAllByUser($_SESSION["uid"],$limit1, $limit2);
$pages = ceil($total_recs/$rec_per_page);
if($page==1) $prev = $page;
else $prev=$page-1;
if($page==$pages) $next = $page;
else $next=$page+1;
$i = 0;
if($rec) foreach($rec as $row) {
$i++;
?>
<tbody>
<tr>
<td><? echo $i ?> </td>
<td><? echo $row->creation_date ?> </td>
<td><? echo $row->carrier ?> </td>
<td><? echo $row->pickup_num ?> </td>
<td><? echo $row->pieces ?> </td>
<td><? echo $row->space ?> </td>
<td><? echo $row->act_wgt ?> </td>
<td><? echo $row->as_wgt ?> </td>
<td><? echo $row->type ?> </td>
<td><? echo $row->pallets ?> </td>
<td><? echo $row->temp ?> </td>
<td><? echo $row->miles ?> </td>
<td><? echo $row->load_num ?> </td>
<td><? echo $row->load_terms ?> </td>
<td><? echo $row->attention ?> </td>
<td><? echo $row->reference ?> </td>
<td><? echo $row->trailer_id ?> </td>
<td><? echo $row->truck_id ?> </td>
<td><? echo $row->pay_code ?> </td>
<td><? echo $row->pay_type ?> </td>
<td><? echo $row->rate ?> </td>
<td><? echo $row->advance ?> </td>
<td><? echo $row->total ?> </td>
<td><? echo $row->bill_to ?> </td>
<td><? echo $row->from_address ?> </td>
<td><? echo $row->to_address ?> </td>
<th><a href='form.dispatch.php?id=<? echo $row->did ?>'><img src="img/edit.png" width = 20 height = 20 /></a></th>
<th><a href='delete.dispatch.php?id=<? echo $row->did ?>'><img src="img/del.png" width = 20 height = 20/></a></th>
<th><a href='invoice1.php?id=<? echo $row->did ?>&cid=<? echo $cid ?> ' target="_blank">INVOICE</a></th>
</tr>
</tbody>
<?}
else echo "<tr><td colspan='16'><center><br><br><br><b>No Dispatches are added yet.</b></center></td></tr>";
?>
</table>
<?
if($page != 1){
?> <a href="dispatch.php?page=<?=$prev?>" style="margin-right:20px">Prev</a>
<?}
for ($p =1; $p<=$pages ; $p++){
?> <a href="dispatch.php?page=<?=$p?>"><?=$p."/".$pages?></a>
<?
}
if($page != $pages){
?><a href="dispatch.php?page=<?=$next?>" style="margin-left:20px">Next</a>
<a href="dispatch.php?page=<?=$pages?>"style="margin-left:12px">Last</a><br />
<?}
?>
<?php
include("footer.php");
?>