-
Notifications
You must be signed in to change notification settings - Fork 1
/
sale_report_process.php
134 lines (132 loc) · 3.93 KB
/
sale_report_process.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
<?php
$page_title = 'Reporte de ventas';
$results = '';
require_once('include/load.php');
// Checkin What level user has permission to view this page
page_require_level(3);
?>
<?php
if(isset($_POST['submit'])){
$req_dates = array('start-date','end-date');
validate_fields($req_dates);
if(empty($errors)):
$start_date = remove_junk($db->escape($_POST['start-date']));
$end_date = remove_junk($db->escape($_POST['end-date']));
$results = find_sale_by_dates($start_date,$end_date);
else:
$session->msg("d", $errors);
redirect(SITE_URL.'sales_report.php', false);
endif;
} else {
$session->msg("d", "Select dates");
redirect(SITE_URL.'sales_report.php', false);
}
?>
<!doctype html>
<html lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Reporte de Salidas</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css"/>
<style>
@media print {
html,body{
font-size: 9.5pt;
margin: 0;
padding: 0;
}.page-break {
page-break-before:always;
width: auto;
margin: auto;
}
}
.page-break{
width: 980px;
margin: 0 auto;
}
.sale-head{
margin: 40px 0;
text-align: center;
}.sale-head h1,.sale-head strong{
padding: 10px 20px;
display: block;
}.sale-head h1{
margin: 0;
border-bottom: 1px solid #212121;
}.table>thead:first-child>tr:first-child>th{
border-top: 1px solid #000;
}
table thead tr th {
text-align: center;
border: 1px solid #ededed;
}table tbody tr td{
vertical-align: middle;
}.sale-head,table.table thead tr th,table tbody tr td,table tfoot tr td{
border: 1px solid #212121;
white-space: nowrap;
}.sale-head h1,table thead tr th,table tfoot tr td{
background-color: #f8f8f8;
}tfoot{
color:#000;
text-transform: uppercase;
font-weight: 500;
}
</style>
</head>
<body>
<?php if($results): ?>
<div class="page-break">
<div class="sale-head pull-right">
<h1>Reporte de Salidas</h1>
<strong><?php if(isset($start_date)){ echo $start_date;}?> a <?php if(isset($end_date)){echo $end_date;}?> </strong>
</div>
<table class="table table-border">
<thead>
<tr>
<th>Fecha</th>
<th>Producto</th>
<th>Destino </th>
<th>Cantidad total</th>
<!--<th>TOTAL</th>-->
</tr>
</thead>
<tbody>
<?php foreach($results as $result): ?>
<tr>
<td class=""><?php echo remove_junk($result['date']);?></td>
<td class="desc">
<h6><?php echo remove_junk(ucfirst($result['name']));?></h6>
</td>
<td class="text-right"><?php echo remove_junk($result['destination']);?></td>
<td class="text-right"><?php echo remove_junk($result['total_qty']);?></td>
<!--<td class="text-right"><?php echo remove_junk($result['total_saleing_price']);?></td>-->
</tr>
<?php endforeach; ?>
</tbody>
<!--
<tfoot>
<tr class="text-right">
<td colspan="3"></td>
<td colspan="1"> Total </td>
<td> $
<?php echo number_format(@total_price($results)[0], 2);?>
</td>
</tr>
<tr class="text-right">
<td colspan="3"></td>
<td colspan="1">Utilidad</td>
<td> $<?php echo number_format(@total_price($results)[1], 2);?></td>
</tr>
</tfoot>
-->
</table>
</div>
<?php
else:
$session->msg("d", "No se encontraron salidas. ");
redirect(SITE_URL.'sales_report.php', false);
endif;
?>
</body>
</html>
<?php if(isset($db)) { $db->db_disconnect(); } ?>