forked from KwaMoja/KwaMoja
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathEnableBranches.php
72 lines (63 loc) · 2.19 KB
/
EnableBranches.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
<?php
include ('includes/session.php');
$Title = _('Enable Customer Branches');
$ViewTopic = '';
$BookMark = '';
include ('includes/header.php');
echo '<p class="page_title_text">
<img src="', $RootPath, '/css/', $_SESSION['Theme'], '/images/maintenance.png" title="', _('Enable Customer Branches'), '" alt="" />', $Title, '
</p>';
if (isset($_POST['Submit'])) {
foreach ($_POST as $Key => $Value) {
if (substr($Key, 0, 6) == 'enable') {
$Index = substr($Key, 6);
$UpdateSQL = "UPDATE custbranch SET disabletrans=0
WHERE debtorno='" . $_POST['debtorno' . $Index] . "'
AND branchcode='" . $_POST['branchno' . $Index] . "'";
$UpdateResult = DB_query($UpdateSQL);
}
}
prnMsg(_('All updates have been applied'), 'success');
}
$SQL = "SELECT debtorsmaster.debtorno,
debtorsmaster.name,
custbranch.branchcode,
custbranch.brname
FROM custbranch
INNER JOIN debtorsmaster
ON debtorsmaster.debtorno=custbranch.debtorno
WHERE custbranch.disabletrans=1";
$Result = DB_query($SQL);
if (DB_num_rows($Result) > 0) {
echo '<form action="', basename(__FILE__), '" method="post" enctype="multipart/form-data">';
echo '<input type="hidden" name="FormID" value="', $_SESSION['FormID'], '" />';
echo '<table>
<tr>
<th>', _('Debtor Number'), '</th>
<th>', _('Debtors Name'), '</th>
<th>', _('Branch Code'), '</th>
<th>', _('Branch Name'), '</th>
</tr>';
$i = 0;
while ($MyRow = DB_fetch_array($Result)) {
echo '<input type="hidden" name="debtorno', $i, '" value="', $MyRow['debtorno'], '" />';
echo '<input type="hidden" name="branchno', $i, '" value="', $MyRow['branchcode'], '" />';
echo '<tr class="striped_row">
<td>', $MyRow['debtorno'], '</td>
<td>', $MyRow['name'], '</td>
<td>', $MyRow['branchcode'], '</td>
<td>', $MyRow['brname'], '</td>
<td><input type="checkbox" name="enable', $i, '" /></td><td>', _('Enable'), '</td>
</tr>';
++$i;
}
echo '</table>';
echo '<div class="centre">
<input type="submit" name="Submit" value="', _('Enable Customer Branches'), '" />
</div>';
echo '</form>';
} else {
prnMsg(_('There are no customer branches requiring authorisation'), 'info');
}
include ('includes/footer.php');
?>