Skip to content

Commit a7f6756

Browse files
committed
First commit
0 parents  commit a7f6756

File tree

1,004 files changed

+176972
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,004 files changed

+176972
-0
lines changed

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Auto detect text files and perform LF normalization
2+
* text=auto

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# v2
2+

admin/dep.php

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
<?php
2+
3+
include('include/conn.php');
4+
include('include/thaidate.php');
5+
include('include/navbar.php')
6+
?>
7+
<!DOCTYPE html>
8+
<html>
9+
<head>
10+
<meta charset="utf-8">
11+
<title></title>
12+
<link rel="stylesheet" href="../assets/css/bootstrap.min.css">
13+
<link rel="stylesheet" href="../assets/font-awesome/css/font-awesome.min.css">
14+
</head>
15+
<style>
16+
body{
17+
background-color:#BEBEBE;
18+
background-size: cover;
19+
}
20+
div{
21+
padding:5px;
22+
}
23+
table{
24+
font-size: 16px;
25+
}
26+
div.table{
27+
padding-left: 10px;
28+
padding-right: 10px;
29+
}
30+
a {
31+
color: dimgray;
32+
33+
}
34+
a:link {
35+
text-decoration: none;
36+
37+
}
38+
a:hover {
39+
color: black;
40+
}
41+
</style>
42+
43+
<body>
44+
<div class="p-3 mb-2 bg-dark text-white border-top" style="text-align: center;font-size: 25px;"><b>ค่าเสื่อมวัสดุ</b></div>
45+
46+
<div class="col-sm-6">
47+
<ol class="breadcrumb float-sm-left">
48+
<li class="breadcrumb-item "><a href="dep.php">จัดการค่าเสื่อม</a></li>
49+
<li class="breadcrumb-item "><a href="dep_sell.php">รายการจำหน่าย</a></li>
50+
<li class="breadcrumb-item "><a href="dep_use.php">รายการใช้งานปกติ</a></li>
51+
</div><!-- /.col -->
52+
53+
<div class="table">
54+
<table class="table table-hover table-light">
55+
<thead class="thead thead-dark">
56+
<tr>
57+
<th scope="col">ลำดับ</th>
58+
<th scope="col">ชื่อประเภท</th>
59+
<th scope="col">ยี่ห้อ ขนาด</th>
60+
<th scope="col">วันเดือนปีที่ส่งของ</th>
61+
<th scope="col">อายุ(ปี : ปัจจุบัน)</th>
62+
<th scope="col">ราคาต่อหน่วย</th>
63+
<th scope="col">ค่าเสื่อมสะสม</th>
64+
<th scope="col">มูลค่าคงเหลือ</th>
65+
<th width="100px" scope="col">สถานะ</th>
66+
<th width="100px" scope="col">จัดการ</th>
67+
68+
</tr>
69+
</thead>
70+
<tbody>
71+
72+
<?php
73+
$sql = "SELECT tb_type.id_type AS sid, tb_type.name_type, tb_type.brand, tb_doc.date_item, ROUND((datediff(curdate(),tb_doc.date_item) /365),0) AS 'dep_now' ,tb_da.price, tb_dep.dep_age, ROUND((tb_da.price / tb_dep.dep_age) * (datediff(curdate(),tb_doc.date_item) /365),0) AS 'dep_y', ROUND(tb_da.price - ((tb_da.price / tb_dep.dep_age) * (datediff(curdate(),tb_doc.date_item) /365)),0) AS 'dep_del', dep_status FROM tb_type, tb_doc, tb_da, tb_dep
74+
WHERE tb_type.id_type = tb_doc.id_doc AND tb_type.id_type = tb_da.id_item AND tb_type.id_type = tb_dep.id_dep
75+
ORDER BY `sid` DESC";
76+
77+
//$dep_d = date("Y-m-d");
78+
79+
$query = $conn->query($sql);
80+
while($row = $query->fetch_assoc()){
81+
82+
if ($row["dep_status"] == "ใช้งานปกติ") {
83+
$bg = "success";
84+
} elseif ($row["dep_status"] == "จำหน่าย") {
85+
$bg = "danger";
86+
} elseif ($row["dep_status"] == "") {
87+
$bg = "warning";
88+
} else {
89+
$bg = "";
90+
}
91+
92+
93+
94+
?>
95+
<tr>
96+
<tr>
97+
<td><?php echo $row['sid']; ?></td>
98+
<td><?php echo $row['name_type']; ?></td>
99+
<td><?php echo $row['brand']; ?></td>
100+
<td><?php echo $row['date_item']; ?></td>
101+
<td align="center"><?php echo $row['dep_now']; ?></td>
102+
<td align='center'><?php echo number_format($row['price']); ?></td>
103+
<td align='center'><?php echo number_format($row['dep_y']); ?></td>
104+
<td align='center'><?php echo number_format($row['dep_del']); ?></td>
105+
<td><span class="badge badge-<?php echo $bg; ?> badge-pill"><?php echo $row["dep_status"]; ?></span></td>
106+
<td>
107+
<button class="btn w3-blue btn-flat" onclick="window.location.href='dep_update.php?id_dep=<?php echo $row["sid"]; ?>'"><i class="fa fa-edit"></i> เพิ่ม</button>
108+
</td>
109+
</tr>
110+
<?php
111+
112+
}
113+
?>
114+
<?php
115+
//Join ฐานข้อมูล ในตาราง tb_fix กับ tb_type โดยใช้ sid กำหนด
116+
$sql = "SELECT SUM(dep_y) FROM tb_cal";
117+
118+
$query = $conn->query($sql);
119+
while($row = $query->fetch_assoc()){
120+
?>
121+
<tr class="table-secondary">
122+
123+
<td align="center"></td>
124+
<td align="center"></td>
125+
<td align="center"></td>
126+
<td align="center"></td>
127+
<td align="center"></td>
128+
<td align="center"></td>
129+
<td align="center"></td>
130+
<td align="right"><b>รวมมูลค่าสุทธิ</b></td>
131+
<td><b><?php echo number_format($row['SUM(dep_y)']); ?></b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>บาท</b></td>
132+
<td align="center"></td>
133+
134+
135+
</tr>
136+
<?php
137+
}
138+
?>
139+
</tbody>
140+
</table>
141+
</div>
142+
</body>
143+
</html>

admin/dep_sell.php

Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
<?php
2+
3+
include('include/conn.php');
4+
include('include/thaidate.php');
5+
include('include/navbar.php')
6+
?>
7+
<!DOCTYPE html>
8+
<html>
9+
<head>
10+
<meta charset="utf-8">
11+
<title></title>
12+
<link rel="stylesheet" href="../assets/css/bootstrap.min.css">
13+
<link rel="stylesheet" href="../assets/font-awesome/css/font-awesome.min.css">
14+
15+
</head>
16+
<style>
17+
body{
18+
background-color:#BEBEBE;
19+
background-size: cover;
20+
}
21+
div{
22+
padding:5px;
23+
}
24+
table{
25+
font-size: 16px;
26+
}
27+
div.table{
28+
padding-left: 10px;
29+
padding-right: 10px;
30+
}
31+
a {
32+
color: dimgray;
33+
34+
}
35+
a:link {
36+
text-decoration: none;
37+
38+
}
39+
a:hover {
40+
color: black;
41+
}
42+
</style>
43+
<body>
44+
<div class="p-3 mb-2 bg-dark text-white border-top" style="text-align: center;font-size: 25px;"><b>รายการจำหน่าย</b></div>
45+
<!-- link/link -->
46+
<div class="col-sm-6">
47+
<ol class="breadcrumb float-sm-left">
48+
<li class="breadcrumb-item "><a href="dep.php">จัดการค่าเสื่อม</a></li>
49+
<li class="breadcrumb-item "><a href="dep_sell.php">รายการจำหน่าย</a></li>
50+
<li class="breadcrumb-item "><a href="dep_use.php">รายการใช้งานปกติ</a></li>
51+
</div><!-- /.col -->
52+
53+
<div align="right">
54+
<input onclick="javascript:window.print()" type="button" class="btn btn-info btn-lg " value="พิมพ์" name="print123">
55+
</div>
56+
57+
<div class="table">
58+
<table class="table table-hover table-light">
59+
<thead class="thead thead-dark">
60+
<tr>
61+
<th scope="col">ลำดับ</th>
62+
<th scope="col">ชื่อประเภท</th>
63+
<th scope="col">ยี่ห้อ</th>
64+
<th scope="col">วันเดือนปีที่ส่งของ</th>
65+
<th style="text-align: center;" scope="col">อายุ(ปี : ปัจจุบัน)</th>
66+
<th scope="col">ราคาต่อหน่วย</th>
67+
<th scope="col">สถานะ</th>
68+
<th scope="col" style="text-align: center;" width="14%">มูลค่าคงเหลือ</th>
69+
70+
</tr>
71+
</thead>
72+
<tbody>
73+
74+
<?php
75+
$sql = "SELECT *, tb_doc.id_doc AS sid FROM tb_doc
76+
LEFT JOIN tb_da ON tb_da.id_item=tb_doc.id_doc
77+
LEFT JOIN tb_type ON tb_type.id_type=tb_da.id_item
78+
LEFT JOIN tb_dep ON tb_dep.id_dep=tb_type.id_type
79+
LEFT JOIN tb_cal ON tb_cal.id_type=tb_dep.id_dep
80+
WHERE tb_dep.dep_status ='จำหน่าย'";
81+
82+
//$dep_d = date("Y-m-d");
83+
84+
$query = $conn->query($sql);
85+
while($row = $query->fetch_assoc()){
86+
?>
87+
<tr>
88+
<tr>
89+
<td><?php echo $row['sid']; ?></td>
90+
<td><?php echo $row['name_type']; ?></td>
91+
<td><?php echo $row['brand']; ?></td>
92+
<td><?php echo $row['date_item']; ?></td>
93+
<td align="center"><?php echo $row['dep_now']; ?></td>
94+
<td ><?php echo number_format($row['price']); ?></td>
95+
<td><?php echo $row['dep_status']; ?></td>
96+
<td style="text-align: center;"><?php echo number_format($row['dep_del']); ?></td>
97+
98+
</tr>
99+
<?php
100+
101+
}
102+
?>
103+
<?php
104+
//Join ฐานข้อมูล ในตาราง tb_fix กับ tb_type โดยใช้ sid กำหนด
105+
$sql = "SELECT SUM(tb_cal.dep_del), SUM(tb_da.price), COUNT(tb_type.id_type), tb_doc.id_doc AS sid FROM tb_doc
106+
LEFT JOIN tb_da ON tb_da.id_item=tb_doc.id_doc
107+
LEFT JOIN tb_type ON tb_type.id_type=tb_da.id_item
108+
LEFT JOIN tb_dep ON tb_dep.id_dep=tb_type.id_type
109+
LEFT JOIN tb_cal ON tb_cal.id_type=tb_dep.id_dep
110+
WHERE tb_dep.dep_status ='จำหน่าย'";
111+
112+
$query = $conn->query($sql);
113+
while($row = $query->fetch_assoc()){
114+
?>
115+
<tr class="table-secondary">
116+
117+
<td align="center"><b>จำนวน</td>
118+
<td align="left"><b><?php echo $row['COUNT(tb_type.id_type)']; ?></b> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>รายการ</b></td>
119+
<td align="center"></td>
120+
<td align="center"></td>
121+
<td align="center"></td>
122+
<td align="left"><b>รวม&nbsp;&nbsp;</b><b><?php echo number_format($row['SUM(tb_da.price)']); ?></b>&nbsp;&nbsp;<b>บาท</b></td>
123+
<td align="center"></td>
124+
<td align="center"><b>รวม&nbsp;&nbsp;</b><b><?php echo number_format($row['SUM(tb_cal.dep_del)']); ?></b>&nbsp;&nbsp;<b>บาท</b></td>
125+
126+
127+
128+
</tr>
129+
<?php
130+
}
131+
?>
132+
133+
</tbody>
134+
</table>
135+
</div>
136+
</body>
137+
</html>

0 commit comments

Comments
 (0)