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'; echo '<p>' . $InvOrCredit . ' ' . _('number') . ' ' . $FromTransNo . ' ' . _('has been emailed to') . ' ' . $_GET['Email']; include 'includes/footer.inc'; exit; } else { //its not an email just print the invoice to PDF $pdf->OutputD($_SESSION['DatabaseName'] . '_' . $InvOrCredit . '_' . $FromTransNo . '.pdf'); } $pdf->__destruct(); //Change the language back to the user's language $_SESSION['Language'] = $UserLanguage; include 'includes/LanguageSetup.php'; } else { /*The option to print PDF was not hit */ $Title = _('Select Invoices/Credit Notes To Print'); include 'includes/header.inc'; if (!isset($FromTransNo) or $FromTransNo == '') { /*if FromTransNo is not set then show a form to allow input of either a single invoice number or a range of invoices to be printed. Also get the last invoice number created to show the user where the current range is up to */ echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '" method="post">'; echo '<div>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<p class="page_title_text"><img src="' . $RootPath . '/css/' . $Theme . '/images/printer.png" title="' . _('Print') . '" alt="" />' . ' ' . _('Print Invoices or Credit Notes (Portrait Mode)') . '</p>';
$PageNumber++; include 'includes/PDFInventoryPlanPageHeader.inc'; } } /*end inventory valn while loop */ $YPos -= 2 * $line_height; $pdf->line($Left_Margin, $YPos + $line_height, $Page_Width - $Right_Margin, $YPos + $line_height); if ($ListCount == 0) { $Title = _('Print Inventory Planning Report Empty'); include 'includes/header.inc'; prnMsg(_('There were no items in the range and location specified'), 'error'); echo '<br /><a href="' . $RootPath . '/index.php">' . _('Back to the menu') . '</a>'; include 'includes/footer.inc'; exit; } else { $pdf->OutputD($_SESSION['DatabaseName'] . '_Inventory_Planning_' . Date('Y-m-d') . '.pdf'); $pdf->__destruct(); } } else { /*The option to print PDF was not hit */ $Title = _('Inventory Planning Reporting'); include 'includes/header.inc'; echo '<p class="page_title_text"> <img src="' . $RootPath . '/css/' . $Theme . '/images/inventory.png" title="' . _('Search') . '" alt="" />' . ' ' . $Title . '</p>'; echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '" method="post">'; echo '<div>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<table class="selection"> <tr> <td>' . _('Select Inventory Categories') . ':</td> <td><select autofocus="autofocus" required="required" minlength="1" size="12" name="Categories[]"multiple="multiple">';
while ($myrow2 = DB_fetch_array($result)) { $DisplayQty = locale_number_format($myrow2['quantity'], $myrow2['decimalplaces']); $DisplayPrevDel = locale_number_format($myrow2['qtyinvoiced'], $myrow2['decimalplaces']); $DisplayQtySupplied = locale_number_format($myrow2['quantity'] - $myrow2['qtyinvoiced'], $myrow2['decimalplaces']); $LeftOvers = $pdf->addTextWrap(13, $YPos, 135, $FontSize, $myrow2['stkcode']); $LeftOvers = $pdf->addTextWrap(148, $YPos, 239, $FontSize, $myrow2['description']); $LeftOvers = $pdf->addTextWrap(387, $YPos, 90, $FontSize, $DisplayQty, 'right'); $LeftOvers = $pdf->addTextWrap(505, $YPos, 90, $FontSize, $DisplayQtySupplied, 'right'); $LeftOvers = $pdf->addTextWrap(604, $YPos, 90, $FontSize, $DisplayPrevDel, 'right'); if ($YPos - $line_height <= 136) { /* We reached the end of the page so finsih off the page and start a newy */ $PageNumber++; include 'includes/PDFOrderPageHeader.inc'; } //end if need a new page headed up /*increment a line down for the next line item */ $YPos -= $line_height; } //end while there are line items to print out $pdf->OutputD($_SESSION['DatabaseName'] . '_Customer_Order_' . $_GET['TransNo'] . '_' . Date('Y-m-d') . '.pdf'); $pdf->__destruct(); $sql = "UPDATE salesorders SET printedpackingslip=1, datepackingslipprinted='" . Date('Y-m-d') . "' WHERE salesorders.orderno='" . $_GET['TransNo'] . "'"; $result = DB_query($sql, $db); } else { $title = _('Print Packing Slip Error'); include 'includes/header.inc'; echo '<br />' . _('There were no outstanding items on the order to deliver. A dispatch note cannot be printed') . '<br /><a href="' . $rootpath . '/SelectSalesOrder.php">' . _('Print Another Packing Slip/Order') . '</a>' . '<br />' . '<a href="' . $rootpath . '/index.php">' . _('Back to the menu') . '</a>'; include 'includes/footer.inc'; exit; } /*end if there are order details to show on the order*/