/
reports.php
355 lines (331 loc) · 15.2 KB
/
reports.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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
<!DOCTYPE html>
<!--[if lt IE 7]>
<html class="lt-ie9 lt-ie8 lt-ie7" lang="en">
<![endif]-->
<!--[if IE 7]>
<html class="lt-ie9 lt-ie8" lang="en">
<![endif]-->
<!--[if IE 8]>
<html class="lt-ie9" lang="en">
<![endif]-->
<!--[if gt IE 8]>
<!-->
<html lang="en">
<!--
<![endif]-->
<head>
<meta charset="utf-8">
<title>
রিপোর্ট ও প্রোফাইল | অভিযাত্রী সুজ
</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<link href="icomoon/style.css" rel="stylesheet">
<link href="css/modal-window.css" rel="stylesheet">
<link rel="icon" type="image/ico" href="img/ico/favicon.ico"></link>
<!--[if lte IE 7]>
<script src="css/icomoon-font/lte-ie7.js">
</script>
<![endif]-->
<link href="css/main.css" rel="stylesheet"> <!-- Important. For Theming change primary-color variable in main.css -->
</head>
<body>
<header>
<a href="#" class="logo">
<img src="img/Regainers_final.jpg" alt="Logo" />
</a>
<div class="btn-group">
<button class="btn btn-primary">
ইউজার
</button>
<button data-toggle="dropdown" class="btn btn-primary dropdown-toggle">
<span class="caret">
</span>
</button>
<ul class="dropdown-menu pull-right">
<li>
<a href="#">
Edit Profile
</a>
</li>
<li>
<a href="#">
Account Settings
</a>
</li>
<li>
<a href="#">
Logout
</a>
</li>
</ul>
</div>
</header>
<div class="container-fluid">
<div class="dashboard-container">
<?php
include 'top_nav.php';
selected('reports');
?>
</div>
<div class="sub-nav">
<ul>
<li>
<a href="inventory_view.php" class="heading">ইনভেন্টরি</a>
</li>
<li>
<a href="new_staff.php">
স্টাফ তালিকাভুক্তি
</a>
</li>
<li>
<a href="new_bank.php">
ব্যাংক তালিকাভুক্তি
</a>
</li>
<li>
<a href="new_expenses.php">
অন্যান্য খরচ তালিকাভুক্তি
</a>
</li>
<li>
<a href="reports.php">
মাসিক রিপোর্ট
</a>
</li>
<li>
<a href="annual_report.php">
বাৎসরিক রিপোর্ট
</a>
</li>
<li>
<a href="custom_report.php">
কাস্টম রিপোর্ট
</a>
</li>
</ul>
</div>
<div class="dashboard-wrapper">
<div class="left-sidebar">
<div class="row-fluid">
<div class="span12">
<div class="widget">
<div class="widget-header">
<div class="title">
<a id="dynamicTable">মাসিক রিপোর্ট</a>
</div>
<span class="tools">
<a class="fs1" aria-hidden="true" data-icon="" href = "javascript:void(0)" onclick = "document.getElementById('light').style.display='block';document.getElementById('fade').style.display='block'"></a>
</span>
</div>
<div class="widget-body">
<form action="reports.php" method="post">
<label for="month" class="width_fix">মাস সিলেক্ট করুন</label>
<select name="month" id="month">
<?php
include "monthName.php";
echo "<option value=\"".date('m')."\" selected=\"selected\">".monthName(date('m'))."</option>";
for($month = 1; $month <= 12 ; $month++){
$datestring = $month;
if ($month<10){
$month_string = '0'.$month;
echo "<option value=\"".$month_string."\">".monthName($month_string)."</option>";
} else{
$month_string = $month;
echo "<option value=\"".$month_string."\">".monthName($month_string)."</option>";
}
}
?>
</select>
<input type="submit" class="btn-info btn" value="দেখুন">
</form>
<table class="table table-condensed table-striped table-hover table-bordered" >
<thead>
<tr>
<th>তারিখ</th>
<th>বিক্রি </th>
<th>তাগাদা</th>
<th>ব্যাংক জমা</th>
<th>স্টাফ খরচ</th>
<?php
require_once "conn.php";
//making room for marked entries
$listed_categ = array();
$categ_exp = array();
$expense_listed = mysqli_query($con,"SELECT * FROM other_expenses WHERE report = 1");
while($listed = mysqli_fetch_array($expense_listed)){
echo "<th>$listed[expense_name]</th>";
$listed_categ[] = $listed['expense_name'];
$categ_exp[] = 0;
}
?>
<!-- <th>স্টাফ খরচ</th> -->
<th>বিবিধ</th>
</tr>
</thead>
<tbody>
<?php
include 'reports_functions.php';
require_once "conn.php";
$fromMonth = date('m');
$toMonth = date('m');
if(isset($_POST['month'])){
$month = $_POST['month'];
}
$next_month = $month + 1;
if($month==12){
$next_month = 01;
}
$next_month = str_pad($next_month, 2, "0", STR_PAD_LEFT);
//echo $next_month;
$fromYear = date('Y');
$toYear = date('Y');
//integrating custom reports
$fromDay = 1;
$toDay = 31;
if(isset($_POST['fromDay'])){
$fromDay = $_POST['fromDay'];
}
if(isset($_POST['toDay'])){
$toDay = $_POST['toDay'];
}
if(isset($_POST['fromMonth'])){
$fromMonth = $_POST['fromMonth'];
}
if(isset($_POST['toMonth'])){
$toMonth = $_POST['toMonth'];
}
if(isset($_POST['fromYear'])){
$fromYear = $_POST['fromYear'];
}
if(isset($_POST['toYear'])){
$toYear = $_POST['toYear'];
}
for($day = $fromDay; $day <= $toDay ; $day++){
$day = str_pad($day, 2, "0", STR_PAD_LEFT);
/* $fromdate = "$year-$month-01 00:00:00";//for annual report
$todate = "$year-$next_month-01 00:00:00";*/
$fromdate = "$fromYear-$fromMonth-$day 00:00:00";
$todate = "$toYear-$toMonth-$day 23:59:59";
$sell_memos_result = mysqli_query($con, "SELECT * FROM sell_memos WHERE date_sold BETWEEN '$fromdate' AND '$todate'");
$bikri = 0;
while($sell_memos = mysqli_fetch_array($sell_memos_result)){
if ($sell_memos['sell_type'] == "client" || $sell_memos['sell_type'] == "return" ){
$bikri = $bikri + $sell_memos['paid'] ;//$sell_memos['grand_total'] - $sell_memos['extra_cost'] + $sell_memos['carry_cost'];
}
}
$purchase_memos_result = mysqli_query($con, "SELECT * FROM purchase_memos WHERE date_bought BETWEEN '$fromdate' AND '$todate'");
$tagada = 0;
$bank_joma = 0;
$staff_exp = 0 ;
$other_exp = 0 ;
$categ_exp_count = 0;
while($purchase_memos = mysqli_fetch_array($purchase_memos_result)){
if ($purchase_memos['purchase_type'] == 'factory' ){//|| $purchase_memos['purchase_type'] == 'return' ){ //gotta ask if returned money from factories should be included
$tagada = $tagada + $purchase_memos['paid'];
}else if ($purchase_memos['purchase_type'] == 'client'){
$bank_joma = $bank_joma + $purchase_memos['paid'];
}else if ($purchase_memos['purchase_type'] == 'staff'){// && is_listed("$purchase_memos[factory_name]") == false ){
$staff_exp = $staff_exp + $purchase_memos['paid'];
}else if ($purchase_memos['purchase_type'] == 'other_expenses' && is_listed("$purchase_memos[factory_name]") == false ){
$other_exp = $other_exp + $purchase_memos['paid'];
}
foreach ($listed_categ as $index => $categ) {
if ($purchase_memos['factory_name'] == $categ){
$categ_exp_count++;
$categ_exp[$index]=$categ_exp[$index]+ $purchase_memos['paid'];
}
}
}
$bikri = $bikri - $bank_joma; //reducing the bank joma from general sells
if($bikri != 0 || $tagada != 0 || $staff_exp != 0 || $categ_exp_count){
echo "<tr>
<td>$day-$fromMonth-$fromYear</td>
<td>$bikri</td>
<td>$tagada</td>
<td>$bank_joma</td>
<td>$staff_exp</td>";
//make room for marked items
foreach ($listed_categ as $index => $categ) {
echo "<td>$categ_exp[$index]</td>";
}
echo "<td>$other_exp</td>
</tr>";
}
}
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div id="light" class="white_content"><a class=pull-right href = "javascript:void(0)" onclick = "document.getElementById('light').style.display='none';document.getElementById('fade').style.display='none'">[X]</a>
<form action="post_categ_list.php" method="post">
<h3>রিপোর্টে দেখানোর জন্যে টিক চিহ্ন দিন</h3>
<?php
$all_expenses = mysqli_query($con,"SELECT * FROM other_expenses");
while($expenses = mysqli_fetch_array($all_expenses)){
if($expenses['report']==1){
echo "<p><input name=categs[] value=$expenses[expense_name] type=\"checkbox\" checked><span id=name-tag>$expenses[expense_name]</span></p>";
} else{
echo "<p><input name=categs[] value=$expenses[expense_name] type=\"checkbox\"><span id=name-tag>$expenses[expense_name]</span></p>";
}
}
?>
<input type="submit" class="btn-info btn" value="সেভ">
</form>
</div>
<div id="fade" class="black_overlay"></div>
</div>
</div>
</div>
<!--/.fluid-container-->
</div>
<footer>
<p>
© CodeCharley
</p>
</footer>
<script src="js/jquery.min.js">
</script>
<script src="js/bootstrap.js">
</script>
<script src="js/jquery.scrollUp.js">
</script>
<script src="js/jquery.datanew_staff.js">
</script>
<script type="text/javascript">
//ScrollUp
$(function () {
$.scrollUp({
scrollName: 'scrollUp', // Element ID
topDistance: '300', // Distance from top before showing element (px)
topSpeed: 300, // Speed back to top (ms)
animation: 'fade', // Fade, slide, none
animationInSpeed: 400, // Animation in speed (ms)
animationOutSpeed: 400, // Animation out speed (ms)
scrollText: 'Scroll to top', // Text for element
activeOverlay: false, // Set CSS color to display scrollUp active point, e.g '#00FFFF'
});
});
//Tooltip
$('a').tooltip('hide');
//Data new_staff
$(document).ready(function () {
$('#data-table').dataTable({
"sPaginationType": "full_numbers"
});
});
jQuery('.delete-row').click(function () {
var conf = confirm('Continue delete?');
if (conf) jQuery(this).parents('tr').fadeOut(function () {
jQuery(this).remove();
});
return false;
});
</script>
</script>
</body>
</html>