forked from webERP-team/webERP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Z_CheckAllocationsFrom.php
70 lines (61 loc) · 1.8 KB
/
Z_CheckAllocationsFrom.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
<?php
include ('includes/session.php');
$Title = _('Identify Allocation Stuff Ups');
include ('includes/header.php');
$sql = "SELECT debtortrans.type,
debtortrans.transno,
debtortrans.ovamount,
debtortrans.alloc,
currencies.decimalplaces AS currdecimalplaces,
SUM(custallocns.amt) AS totallocfrom
FROM debtortrans INNER JOIN custallocns
ON debtortrans.id=custallocns.transid_allocfrom
INNER JOIN debtorsmaster ON
debtortrans.debtorno=debtorsmaster.debtorno
INNER JOIN currencies ON
debtorsmaster.currcode=currencies.currabrev
GROUP BY debtortrans.type,
debtortrans.transno,
debtortrans.ovamount,
debtortrans.alloc,
currencies.decimalplaces
HAVING SUM(custallocns.amt) < -alloc";
$result =DB_query($sql);
if (DB_num_rows($result)>0){
echo '<table>
<tr>
<td>' . _('Type') . '</td>
<td>' . _('Trans No') . '</td>
<td>' . _('Ov Amt') . '</td>
<td>' . _('Allocated') . '</td>
<td>' . _('Tot Allcns') . '</td>
</tr>';
$RowCounter =0;
while ($myrow=DB_fetch_array($result)){
printf ('<tr>
<td>%s</td>
<td>%s<td class="number">%s</td>
<td class="number">%s</td>
<td class="number">%s</td>
</tr>',
$myrow['type'],
$myrow['transno'],
locale_number_format($myrow['ovamount'],$myrow['currdecimalplaces']),
locale_number_format($myrow['alloc'],$myrow['currdecimalplaces']),
locale_number_format($myrow['totallocfrom'],$myrow['currdecimalplaces']));
$RowCounter++;
if ($RowCounter==20){
echo '<tr><td>' . _('Type') . '</td>
<td>' . _('Trans No') . '</td>
<td>' . _('Ov Amt') . '</td>
<td>' . _('Allocated') . '</td>
<td>' . _('Tot Allcns') . '</td></tr>';
$RowCounter=0;
}
}
echo '</table>';
} else {
prnMsg(_('There are no inconsistent allocations') . ' - ' . _('all is well'),'info');
}
include('includes/footer.php');
?>