$YPos -= 2 * $line_height; } $YPos -= 2 * $line_height; /*Print out the grand totals */ $LeftOvers = $pdf->addTextWrap(80, $YPos, 260 - $Left_Margin, $FontSize, _('Grand Total Value'), 'right'); $DisplayTotalVal = locale_money_format($Tot_Val, $_SESSION['CompanyRecord']['currencydefault']); $LeftOvers = $pdf->addTextWrap(500, $YPos, 60, $FontSize, $DisplayTotalVal, 'right'); if ($_POST['DetailedReport'] == 'Yes') { $pdf->line($Left_Margin, $YPos + $line_height - 2, $Page_Width - $Right_Margin, $YPos + $line_height - 2); $YPos -= 2 * $line_height; } if ($ListCount == 0) { $title = _('Print Inventory Valuation Error'); include 'includes/header.inc'; echo '<br />' . _('There were no items with any value to print out for the location specified'); echo '<br /><a href="' . $rootpath . '/index.php">' . _('Back to the menu') . '</a>'; include 'includes/footer.inc'; exit; // Javier: needs check } else { include 'includes/htmlMimeMail.php'; $pdf->Output($_SESSION['reports_dir'] . '/InventoryReport.pdf', 'F'); $pdf->__destruct(); $mail = new htmlMimeMail(); $attachment = $mail->getFile($_SESSION['reports_dir'] . '/InventoryReport.pdf'); $mail->setText(_('Please find herewith the stock valuation report')); $mail->setSubject(_('Inventory Valuation Report')); $mail->addAttachment($attachment, 'InventoryReport.pdf', 'application/pdf'); $mail->setFrom($_SESSION['CompanyRecord']['coyname'] . "<" . $_SESSION['CompanyRecord']['email'] . ">"); $result = $mail->send($Recipients); }
} $LeftOvers = $pdf->addTextWrap($Page_Width - $Left_Margin - 72, $Bottom_Margin + 5, 72, $FontSize, $DisplayTotal, 'right'); } /* end of check to see that there was an invoice record to print */ $FromTransNo++; } /* end loop to print invoices */ /* Put the transaction number back as would have been incremented by one after last pass */ $FromTransNo--; if (isset($_GET['Email'])) { //email the invoice to address supplied include 'includes/htmlMimeMail.php'; $FromTransNo--; //reverse the increment to retain the correct transaction number $FileName = $_SESSION['reports_dir'] . '/' . $_SESSION['DatabaseName'] . '_' . $InvOrCredit . '_' . $_GET['FromTransNo'] . '.pdf'; $pdf->Output($FileName, 'F'); $mail = new htmlMimeMail(); $Attachment = $mail->getFile($FileName); $mail->setText(_('Please find attached') . ' ' . $InvOrCredit . ' ' . $_GET['FromTransNo']); $mail->SetSubject($InvOrCredit . ' ' . $_GET['FromTransNo']); $mail->addAttachment($Attachment, $FileName, 'application/pdf'); if ($_SESSION['SmtpSetting'] == 0) { $mail->setFrom($_SESSION['CompanyRecord']['coyname'] . ' <' . $_SESSION['CompanyRecord']['email'] . '>'); $result = $mail->send(array($_GET['Email'])); } else { $result = SendmailBySmtp($mail, array($_GET['Email'])); } unlink($FileName); //delete the temporary file $Title = _('Emailing') . ' ' . $InvOrCredit . ' ' . _('Number') . ' ' . $FromTransNo; include 'includes/header.inc';