Пример #1
0
 if (sizeOf($RejectsArray) > 0) {
     $MailText = _('This email has been automatically generated by the webERP installation at') . ' ' . $_SESSION['CompanyRecord']['coyname'] . "\n";
     $MailText .= _('The following offers you made have been rejected') . "\n\n";
     foreach ($RejectsArray as $RejectID) {
         $sql = "SELECT offers.quantity,\n\t\t\t\t\t\t\toffers.price,\n\t\t\t\t\t\t\tstockmaster.description\n\t\t\t\t\t\tFROM offers\n\t\t\t\t\t\tLEFT JOIN stockmaster\n\t\t\t\t\t\t\tON offers.stockid=stockmaster.stockid\n\t\t\t\t\t\tWHERE offerid='" . $RejectID . "'";
         $result = DB_query($sql);
         $myrow = DB_fetch_array($result);
         $MailText .= $myrow['description'] . "\t" . _('Quantity') . ' ' . $myrow['quantity'] . "\t" . _('Price') . ' ' . locale_number_format($myrow['price']) . "\n";
         $sql = "DELETE FROM offers WHERE offerid='" . $RejectID . "'";
         $result = DB_query($sql);
     }
     $mail = new htmlMimeMail();
     $mail->setSubject(_('Your offer to') . ' ' . $_SESSION['CompanyRecord']['coyname'] . ' ' . _('has been rejected'));
     $mail->setText($MailText);
     $mail->setFrom($_SESSION['CompanyRecord']['coyname'] . ' <' . $_SESSION['CompanyRecord']['email'] . '>');
     $Recipients = GetMailList('OffersReceivedResultRecipients');
     if (sizeOf($Recipients) == 0) {
         prnMsg(_('There are no members of the Offers Received Result Recipients email group'), 'warn');
         include 'includes/footer.inc';
         exit;
     }
     array_push($Recipients, $Email);
     if ($_SESSION['SmtpSetting'] == 0) {
         $mail->setFrom($_SESSION['CompanyRecord']['coyname'] . ' <' . $_SESSION['CompanyRecord']['email'] . '>');
         $result = $mail->send($Recipients);
     } else {
         $result = SendmailBySmtp($mail, $Recipients);
     }
     if ($result) {
         prnMsg(_('The rejected offers from') . ' ' . $SupplierName . ' ' . _('have been removed from the system and an email sent to') . ' ' . $Email, 'success');
     } else {
    }
    /*end of new page header  */
}
/* end of while there are customer receipts in the batch to print */
$YPos -= $line_height;
$LeftOvers = $pdf->addTextWrap($Left_Margin, $YPos, 60, $FontSize, locale_number_format($TotalCheques, 2), 'right');
$LeftOvers = $pdf->addTextWrap($Left_Margin + 65, $YPos, 300, $FontSize, _('TOTAL') . ' ' . $Currency . ' ' . _('CHEQUES'), 'left');
$ReportFileName = $_SESSION['DatabaseName'] . '_ChequeListing_' . date('Y-m-d') . '.pdf';
$pdf->Output($_SESSION['reports_dir'] . '/' . $ReportFileName, 'F');
$pdf->OutputD($ReportFileName);
$pdf->__destruct();
if ($_POST['Email'] == 'Yes') {
    include 'includes/htmlMimeMail.php';
    $mail = new htmlMimeMail();
    $attachment = $mail->getFile($_SESSION['reports_dir'] . '/' . $ReportFileName);
    $mail->setSubject(_('Payments check list'));
    $mail->setText(_('Please find herewith payments listing from') . ' ' . $_POST['FromDate'] . ' ' . _('to') . ' ' . $_POST['ToDate']);
    $mail->addAttachment($attachment, 'PaymentListing.pdf', 'application/pdf');
    $ChkListingRecipients = GetMailList('ChkListingRecipients');
    if (sizeOf($ChkListingRecipients) == 0) {
        prnMsg(_('There are no member in Check Listing Recipients email group,  no mail will be sent'), 'error');
        include 'includes/footer.inc';
        exit;
    }
    if ($_SESSION['SmtpSetting'] == 0) {
        $mail->setFrom(array('"' . $_SESSION['CompanyRecord']['coyname'] . '" <' . $_SESSION['CompanyRecord']['email'] . '>'));
        $result = $mail->send($ChkListingRecipients);
    } else {
        $result = SendmailBySmtp($mail, $ChkListingRecipients);
    }
}
<?php

/* $Id: PDFWeeklyOrders.php 1 2014-11-11 03:26:23Z agaluski $*/
$DatabaseName = 'weberp';
$AllowAnyone = true;
include 'includes/session.inc';
include 'includes/SQL_CommonFunctions.inc';
include 'includes/class.pdf.php';
$_POST['FromDate'] = date('Y-m-01');
$_POST['ToDate'] = FormatDateForSQL(Date($_SESSION['DefaultDateFormat']));
$WeekStartDate = Date($_SESSION['DefaultDateFormat'], strtotime($WeekStartDate . ' - 7 days'));
$Recipients = GetMailList('WeeklyOrders');
if (sizeOf($Recipients) == 0) {
    $Title = _('Weekly Orders') . ' - ' . _('Problem Report');
    include 'includes/header.inc';
    prnMsg(_('There are no members of the Weekly Orders Recipients email group'), 'warn');
    include 'includes/footer.inc';
    exit;
}
$sql = "SELECT salesorders.orderno,\n\t\t\t  salesorders.orddate,\n\t\t\t  salesorderdetails.stkcode,\n\t\t\t  salesorderdetails.unitprice,\n\t\t\t  stockmaster.description,\n\t\t\t  stockmaster.units,\n\t\t\t  stockmaster.decimalplaces,\n\t\t\t  salesorderdetails.quantity,\n\t\t\t  salesorderdetails.qtyinvoiced,\n\t\t\t  salesorderdetails.completed,\n\t\t\t  salesorderdetails.discountpercent,\n\t\t\t  stockmaster.materialcost+stockmaster.labourcost+stockmaster.overheadcost AS standardcost,\n\t\t\t  debtorsmaster.name\n\t\t FROM salesorders\n\t\t\t INNER JOIN salesorderdetails\n\t\t\t ON salesorders.orderno = salesorderdetails.orderno\n\t\t\t INNER JOIN stockmaster\n\t\t\t ON salesorderdetails.stkcode = stockmaster.stockid\n\t\t\t INNER JOIN debtorsmaster\n\t\t\t ON salesorders.debtorno=debtorsmaster.debtorno\n\t\t WHERE salesorders.orddate >='" . FormatDateForSQL($WeekStartDate) . "'\n\t\t\t  AND salesorders.orddate <='" . $_POST['ToDate'] . "'\n\t\t AND salesorders.quotation=0\n\t\t ORDER BY salesorders.orderno";
$Result = DB_query($sql, $db, '', '', false, false);
//dont trap errors here
if (DB_error_no($db) != 0) {
    include 'includes/header.inc';
    echo '<br />' . _('An error occurred getting the orders details');
    if ($debug == 1) {
        echo '<br />' . _('The SQL used to get the orders that failed was') . '<br />' . $sql;
    }
    include 'includes/footer.inc';
    exit;
}
Пример #4
0
 * The intention is that this script is called from cron at intervals defined with a command like:
 *
 * /usr/bin/wget http://localhost/web-erp/MailSalesReport.php
 *
 * The configuration of this script requires the id of the sales analysis report to send
 * and an array of the receipients and the company database to use
 */
/*The Sales report to send */
$ReportID = 4;
/* ----------------------------------------------------------------------------------------------*/
$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');
if (sizeOf($Recipients) == 0) {
    $Title = _('Inventory Valuation') . ' - ' . _('Problem Report');
    include 'includes/header.inc';
    prnMsg(_('There are no members of the Sales Analysis Report Recipients email group'), 'warn');
    include 'includes/footer.inc';
    exit;
}
include 'includes/ConstructSQLForUserDefinedSalesReport.inc';
include 'includes/CSVSalesAnalysis.inc';
include 'includes/htmlMimeMail.php';
$mail = new htmlMimeMail();
$attachment = $mail->getFile($_SESSION['reports_dir'] . '/SalesAnalysis.csv');
$mail->setText(_('Please find herewith the comma separated values sales report'));
$mail->addAttachment($attachment, 'SalesAnalysis.csv', 'application/csv');
$mail->setSubject(_('Sales Analysis') . ' - ' . _('CSV Format'));
<?php

/* $Id: PDFSalesBySalesperson.php 1 2014-11-11 03:26:23Z agaluski $*/
$DatabaseName = 'weberp';
$AllowAnyone = true;
include 'includes/session.inc';
include 'includes/SQL_CommonFunctions.inc';
include 'includes/class.pdf.php';
$_POST['FromDate'] = date('Y-m-01');
$_POST['ToDate'] = FormatDateForSQL(Date($_SESSION['DefaultDateFormat']));
$WeekStartDate = Date($_SESSION['DefaultDateFormat'], strtotime($WeekStartDate . ' - 7 days'));
$Recipients = GetMailList('salesbysalesperson');
if (sizeOf($Recipients) == 0) {
    $Title = _('Weekly Orders') . ' - ' . _('Problem Report');
    include 'includes/header.inc';
    prnMsg(_('There are no members of the Weekly Orders Recipients email group'), 'warn');
    include 'includes/footer.inc';
    exit;
}
$sql = "SELECT salesorders.orderno,\n\t\t\t  salesorders.orddate,\n\t\t\t  salesorderdetails.stkcode,\n\t\t\t  salesorderdetails.unitprice,\n\t\t\t  stockmaster.description,\n\t\t\t  stockmaster.units,\n\t\t\t  stockmaster.decimalplaces,\n\t\t\t  salesorderdetails.quantity,\n\t\t\t  salesorderdetails.qtyinvoiced,\n\t\t\t  salesorderdetails.completed,\n\t\t\t  salesorderdetails.discountpercent,\n\t\t\t  stockmaster.materialcost+stockmaster.labourcost+stockmaster.overheadcost AS standardcost,\n\t\t\t  debtorsmaster.name,\n\t\t\t  salesman.salesmanname\n\t\t FROM salesorders\n\t\t\t INNER JOIN salesorderdetails\n\t\t\t ON salesorders.orderno = salesorderdetails.orderno\n\t\t\t INNER JOIN stockmaster\n\t\t\t ON salesorderdetails.stkcode = stockmaster.stockid\n\t\t\t INNER JOIN debtorsmaster\n\t\t\t ON salesorders.debtorno=debtorsmaster.debtorno\n\t\t\t INNER JOIN custbranch ON custbranch.debtorno=salesorders.debtorno \n\t\t\t AND custbranch.branchcode=salesorders.branchcode\n\t\t\t INNER JOIN salesman ON salesman.salesmancode=custbranch.salesman\n\t\t WHERE salesorders.orddate >='" . FormatDateForSQL($WeekStartDate) . "'\n\t\t\t  AND salesorders.orddate <='" . $_POST['ToDate'] . "'\n\t\t AND salesorders.quotation=0\n\t\t ORDER BY custbranch.salesman, salesorders.orderno";
$Result = DB_query($sql, $db, '', '', false, false);
//dont trap errors here
if (DB_error_no($db) != 0) {
    include 'includes/header.inc';
    echo '<br />' . _('An error occurred getting the orders details');
    if ($debug == 1) {
        echo '<br />' . _('The SQL used to get the orders that failed was') . '<br />' . $sql;
    }
    include 'includes/footer.inc';
    exit;
}
/*Category To */
$Location = 'All';
/* Location to report on */
$DetailedReport = 'Yes';
/* Total by category or complete listing */
$_POST['DetailedReport'] = $DetailedReport;
/* so PDFInventoryValnPageHeader.inc works too */
$_POST['FromCriteria'] = $FromCriteria;
/* so PDFInventoryValnPageHeader.inc works too */
$_POST['ToCriteria'] = $ToCriteria;
/* so PDFInventoryValnPageHeader.inc works too */
$_POST['Location'] = $Location;
/* so PDFInventoryValnPageHeader.inc works too */
include 'includes/session.inc';
include 'includes/class.pdf.php';
$Recipients = GetMailList('InventoryValuationRecipients');
if (sizeOf($Recipients) == 0) {
    $Title = _('Inventory Valuation') . ' - ' . _('Problem Report');
    include 'includes/header.inc';
    prnMsg(_('There are no members of the Inventory Valuation Recipients email group'), 'warn');
    include 'includes/footer.inc';
    exit;
}
/* A4_Portrait */
$Page_Width = 595;
$Page_Height = 842;
$Top_Margin = 30;
$Bottom_Margin = 30;
$Left_Margin = 40;
$Right_Margin = 30;
// Javier: now I use the native constructor