forked from KwaMoja/KwaMoja
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathEmailCustStatements.php
51 lines (43 loc) · 2.17 KB
/
EmailCustStatements.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
<?php
/* $Id: EmailCustTrans.php 6310 2013-08-29 10:42:50Z daintree $*/
include ('includes/session.php');
include ('includes/SQL_CommonFunctions.php');
if (!isset($_GET['FromCust'])) {
$_GET['FromCust'] = $_SESSION['CustomerID'];
}
$Title = _('Email Customer Statement For Customer No.') . ' ' . $_GET['FromCust'];
if (isset($_POST['DoIt']) and IsEmailAddress($_POST['EmailAddr'])) {
echo '<meta http-equiv="Refresh" content="0; url=' . $RootPath . '/PrintCustStatements.php?FromCust=' . $_SESSION['CustomerID'] . '&ToCust=' . $_SESSION['CustomerID'] . '&PrintPDF=Yes&Email=' . $_POST['EmailAddr'] . '">';
prnMsg(_('The customer statement should have been emailed off') . '. ' . _('If this does not happen') . ' (' . _('if the browser does not support META Refresh') . ')' . '<a href="' . $RootPath . '/PrintCustStatements.php?FromCust=' . $_SESSION['CustomerID'] . '&PrintPDF=Yes&Email=' . $_POST['EmailAddr'] . '">' . _('click here') . '</a> ' . _('to email the customer statement'), 'success');
exit;
} elseif (isset($_POST['DoIt'])) {
prnMsg(_('The email address does not appear to be a valid email address. The statement was not emailed'), 'warn');
}
include ('includes/header.php');
echo '<form action="' . htmlspecialchars(basename(__FILE__), ENT_QUOTES, 'UTF-8') . '" method="post">';
echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />';
$SQL = "SELECT custbranch.email
FROM custbranch
INNER JOIN debtorsmaster
ON custbranch.debtorno= debtorsmaster.debtorno
WHERE debtorsmaster.debtorno='" . $_SESSION['CustomerID'] . "' LIMIT 1";
$ErrMsg = _('There was a problem retrieving the contact details for the customer');
$ContactResult = DB_query($SQL, $ErrMsg);
if (DB_num_rows($ContactResult) > 0) {
$EmailAddrRow = DB_fetch_row($ContactResult);
$EmailAddress = $EmailAddrRow[0];
} else {
$EmailAddress = '';
}
echo '<table>
<tr>
<td>' . _('Email to') . ':</td>
<td><input type="email" name="EmailAddr" autofocus="autofocus" maxlength="60" size="60" value="' . $EmailAddress . '" /></td>
</tr>
</table>';
echo '<div class="centre">
<input type="submit" name="DoIt" value="' . _('OK') . '" />
</div>';
echo '</form>';
include ('includes/footer.php');
?>