-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathajax_reportprofit.php
49 lines (35 loc) · 1.29 KB
/
ajax_reportprofit.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
<?php
error_reporting('E_ALL');
// подключение path
require_once $_SERVER['DOCUMENT_ROOT'].'/administrator/zinit.php';
$torder = NEW TZOrder();
//$pt = json_decode($_POST['pt'],true);
$id_customer = (int)$_POST['id_customer'];
$data = array();
if($id_customer) {
$data['id_customer'] = $id_customer;
}
$parr = $torder->getProfitReport($data);
//print_r($parr);
$out = '';
$out .='<table id="table_order" class="w100">';
$out .='<tr><th>№</th><th>Дата</th><th>Покупатель</th><th>План</th><th>Факт</th><th>Наценка</th><th>Оплата</th><th>Долг</th><th>Ответственный</th></tr>';
foreach($parr AS $row) {
$plan = $row['sumplanprice'];
$fact = $row['sumprice'];
$pay = $row['sumpay'];
$out .='<tr>'
.'<td title="Открыть заказ"><a href="/administrator/z/zorder.php?mode=edit&id='.$row['id'].'">'.$row['id'].'</a></td>'
.'<td>'.$row['orderdate'].'</td>'
.'<td>'.$row['customername'].'</td>'
.'<td>'.$plan.'</td>'
.'<td>'.$fact.'</td>'
.'<td>'.($fact-$plan).'</td>'
.'<td>'.$pay.'</td>'
.'<td>'.($fact-$pay).'</td>'
.'<td>'.$row['username'].'</td>
</tr>';
}
$out .='</table>';
echo $out;
?>