-
Notifications
You must be signed in to change notification settings - Fork 1
/
print_model.php
executable file
·56 lines (55 loc) · 1.74 KB
/
print_model.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
<?php
function select($transaction){
$query = mysql_query("select a.*, b.table_name, c.*, d.user_name
from transactions a
left join members c on c.member_id = a.member_id
join tables b on b.table_id = a.table_id
left join users d on d.user_id = a.user_id
where transaction_id = '".$transaction."'");
return $query;
}
function select_item($transaction){
$query = mysql_query("select b.*, c.menu_name
from transactions a
join transaction_details b on b.transaction_id = a.transaction_id
join menus c on c.menu_id = b.menu_id
where a.transaction_id = '".$transaction."' AND c.menu_price !=0");
return $query;
}
function selectbydate($start, $end){
$query = mysql_query("SELECT
a.*, b.table_name,
c.member_name, c.member_discount, d.building_name, e.user_login, e.user_name
FROM
transactions a
LEFT JOIN members c ON c.member_id = a.member_id
JOIN TABLES b ON b.table_id = a.table_id
LEFT JOIN buildings d on d.building_id = b.building_id
left join users e on e.user_id = a.user_id
WHERE
transaction_date BETWEEN '$start'
AND '$end'");
return $query;
}
function selectmenubydate($start, $end){
$query = mysql_query("SELECT
date(a.transaction_date) AS date,
b.menu_id,
sum(b.transaction_detail_qty) AS qty,
b.transaction_detail_original_price,
c.menu_name
FROM
transactions a
LEFT JOIN transaction_details b ON b.transaction_id = a.transaction_id
LEFT JOIN menus c ON c.menu_id = b.menu_id
WHERE
transaction_date BETWEEN '$start'
AND '$end'
GROUP BY
date,
menu_id
ORDER BY
date");
return $query;
}
?>