|
From: <ex...@us...> - 2013-05-12 05:09:29
|
Revision: 5940
http://sourceforge.net/p/web-erp/reponame/5940
Author: exsonqu
Date: 2013-05-12 05:09:27 +0000 (Sun, 12 May 2013)
Log Message:
-----------
12/5/2013 Exson: Make the sales report can be mailed via SMTP in files MailSalesReport.php and MailSalesReport_csv.php
Modified Paths:
--------------
trunk/MailSalesReport.php
trunk/MailSalesReport_csv.php
Modified: trunk/MailSalesReport.php
===================================================================
--- trunk/MailSalesReport.php 2013-05-12 03:38:06 UTC (rev 5939)
+++ trunk/MailSalesReport.php 2013-05-12 05:09:27 UTC (rev 5940)
@@ -13,15 +13,13 @@
/*The following three variables need to be modified for the report - the company database to use and the receipients */
/*The Sales report to send */
$_GET['ReportID'] = 2;
+$AllowAnyone = true;
+include('includes/session.inc');
/*The company database to use */
-$DatabaseName = 'weberpdemo';
+$DatabaseName = $_SESSION['DatabaseName'];
/*The people to receive the emailed report */
-$Recipients = array('"Root" <root@localhost>','"' . _('someone else') . '" <som...@so...>');
+$Recipients = GetMailList('SalesAnalysisReportRecipients');
-
-
-$AllowAnyone = true;
-include('includes/session.inc');
include ('includes/ConstructSQLForUserDefinedSalesReport.inc');
include ('includes/PDFSalesAnalysis.inc');
@@ -38,13 +36,22 @@
$mail->setText(_('Please find herewith sales report'));
$mail->SetSubject(_('Sales Analysis Report'));
$mail->addAttachment($attachment, 'SalesReport.pdf', 'application/pdf');
- $mail->setFrom($_SESSION['CompanyRecord']['coyname'] . '<' . $_SESSION['CompanyRecord']['email'] . '>');
- $result = $mail->send($Recipients);
+ if($_SESSION['SmtpSetting']==0){
+ $mail->setFrom($_SESSION['CompanyRecord']['coyname'] . '<' . $_SESSION['CompanyRecord']['email'] . '>');
+ $result = $mail->send($Recipients);
+ }else{
+ $result = SendmailBySmtp($mail,$Recipients);
+ }
} else {
$mail->setText(_('Error running automated sales report number') . ' ' . $ReportID);
- $mail->setFrom($_SESSION['CompanyRecord']['coyname'] . '<' . $_SESSION['CompanyRecord']['email'] . '>');
- $result = $mail->send($Recipients);
+ if($_SESSION['SmtpSetting']==0){
+ $mail->setFrom($_SESSION['CompanyRecord']['coyname'] . '<' . $_SESSION['CompanyRecord']['email'] . '>');
+ $result = $mail->send($Recipients);
+ }else{
+ $result = SendmailBySmtp($mail,$Recipients);
+ }
+
}
-?>
\ No newline at end of file
+?>
Modified: trunk/MailSalesReport_csv.php
===================================================================
--- trunk/MailSalesReport_csv.php 2013-05-12 03:38:06 UTC (rev 5939)
+++ trunk/MailSalesReport_csv.php 2013-05-12 05:09:27 UTC (rev 5940)
@@ -13,15 +13,18 @@
/*The Sales report to send */
$ReportID = 4;
-/*The company database to use */
-$DatabaseName = 'weberpdemo';
+
+
/* ----------------------------------------------------------------------------------------------*/
$AllowAnyone = true;
include('includes/session.inc');
+/*The company database to use */
+$DatabaseName = $_SESSION['DatabaseName'];
/*The people to receive the emailed report, This mail list now can be maintained in Mailing List Maintenance of Set Up */
+
$Recipients = GetMailList('SalesAnalysisReportRecipients');
include('includes/ConstructSQLForUserDefinedSalesReport.inc');
include('includes/CSVSalesAnalysis.inc');
@@ -38,6 +41,6 @@
$mail->setFrom($_SESSION['CompanyRecord']['coyname'] . '<' . $_SESSION['CompanyRecord']['email'] . '>');
$result = $mail->send($Recipients);
}else{
- $result = $mail->send($mail,$Recipients);
+ $result = SendmailBySmtp($mail,$Recipients);
}
?>
|