1<?php 2 3 4include('includes/session.php'); 5 6include('includes/PDFStarter.php'); 7$pdf->addInfo('Title', _('Inventory Negatives Listing') ); 8$pdf->addInfo('Subject', _('Inventory Negatives Listing')); 9$FontSize=9; 10$PageNumber=1; 11$line_height=15; 12 13$Title = _('Negative Stock Listing Error'); 14$ErrMsg = _('An error occurred retrieving the negative quantities.'); 15$DbgMsg = _('The sql that failed to retrieve the negative quantities was'); 16 17$sql = "SELECT stockmaster.stockid, 18 stockmaster.description, 19 stockmaster.categoryid, 20 stockmaster.decimalplaces, 21 locstock.loccode, 22 locations.locationname, 23 locstock.quantity 24 FROM stockmaster INNER JOIN locstock 25 ON stockmaster.stockid=locstock.stockid 26 INNER JOIN locations 27 ON locstock.loccode = locations.loccode 28 INNER JOIN locationusers ON locationusers.loccode=locations.loccode AND locationusers.userid='" . $_SESSION['UserID'] . "' AND locationusers.canview=1 29 WHERE locstock.quantity < 0 30 ORDER BY locstock.loccode, 31 stockmaster.categoryid, 32 stockmaster.stockid, 33 stockmaster.decimalplaces"; 34 35$result = DB_query($sql, $ErrMsg, $DbgMsg); 36 37If (DB_num_rows($result)==0){ 38 include ('includes/header.php'); 39 prnMsg(_('There are no negative stocks to list'),'error'); 40 include ('includes/footer.php'); 41 exit; 42} 43 44$NegativesRow = DB_fetch_array($result); 45 46include ('includes/PDFStockNegativesHeader.inc'); 47$line_height=15; 48$FontSize=10; 49 50do { 51 52 $LeftOvers = $pdf->addTextWrap($Left_Margin,$YPos,130,$FontSize, $NegativesRow['loccode'] . ' - ' . $NegativesRow['locationname'], 'left'); 53 $LeftOvers = $pdf->addTextWrap(170,$YPos,350,$FontSize,$NegativesRow['stockid'] . ' - ' .$NegativesRow['description'], 'left'); 54 $LeftOvers = $pdf->addTextWrap(520,$YPos,30,$FontSize,locale_number_format($NegativesRow['quantity'],$NegativesRow['decimalplaces']), 'right'); 55 56 $pdf->line($Left_Margin, $YPos-2,$Page_Width-$Right_Margin, $YPos-2); 57 58 $YPos -= $line_height; 59 60 if ($YPos < $Bottom_Margin + $line_height) { 61 $PageNumber++; 62 include('includes/PDFStockNegativesHeader.inc'); 63 } 64 65} while ($NegativesRow = DB_fetch_array($result)); 66 67if (DB_num_rows($result)>0){ 68 $pdf->OutputD($_SESSION['DatabaseName'] . '_NegativeStocks_' . date('Y-m-d') . '.pdf'); 69 $pdf->__destruct(); 70} else { 71 $Title = _('Negative Stock Listing Problem'); 72 include('includes/header.php'); 73 prnMsg(_('There are no negative stocks to list'),'info'); 74 include('includes/footer.php'); 75} 76?>