| 
      
      
      From: <dai...@us...> - 2011-04-02 09:40:58
      
     | 
| Revision: 4536
          http://web-erp.svn.sourceforge.net/web-erp/?rev=4536&view=rev
Author:   daintree
Date:     2011-04-02 09:40:49 +0000 (Sat, 02 Apr 2011)
Log Message:
-----------
SQL and xhtml fixes
Modified Paths:
--------------
    trunk/PO_Header.php
    trunk/PO_Items.php
    trunk/PricesByCost.php
    trunk/PrintCustTransPortrait.php
    trunk/RecurringSalesOrdersProcess.php
    trunk/SalesGLPostings.php
    trunk/SalesGraph.php
    trunk/SelectAsset.php
    trunk/SelectCreditItems.php
    trunk/SelectCustomer.php
    trunk/SelectOrderItems.php
    trunk/SelectProduct.php
Modified: trunk/PO_Header.php
===================================================================
--- trunk/PO_Header.php	2011-04-02 01:42:42 UTC (rev 4535)
+++ trunk/PO_Header.php	2011-04-02 09:40:49 UTC (rev 4536)
@@ -2,8 +2,6 @@
 
 /* $Id PO_Header.php 4183 2010-12-14 09:30:20Z daintree $ */
 
-//$PageSecurity = 4; now read in from from DB into $_SESSION['PageSecurity'] array and retrieved into a $PageSecuirity variable for the script by session.inc
-
 include('includes/DefinePOClass.php');
 include('includes/session.inc');
 
@@ -86,13 +84,13 @@
 		
 		if ($_POST['Status'] == 'Authorised') {
 			if ($AuthorityLevel > $OrderTotal) {
-				$_SESSION['PO'.$identifier]->StatusComments = date($_SESSION['DefaultDateFormat']) . ' - ' . _('Authorised by') . $UserChangedStatus . $_POST['StatusComments'] . '<br>' . html_entity_decode($_POST['StatusCommentsComplete']);
+				$_SESSION['PO'.$identifier]->StatusComments = date($_SESSION['DefaultDateFormat']) . ' - ' . _('Authorised by') . $UserChangedStatus . $_POST['StatusComments'] . '<br />' . html_entity_decode($_POST['StatusCommentsComplete']);
 				$_SESSION['PO'.$identifier]->AllowPrintPO=1;
 			} else {
 				$OKToUpdateStatus=0;
-				prnMsg( _('You do not have permission to authorise this purchase order').'.<br>'. _('This order is for').' '.
+				prnMsg( _('You do not have permission to authorise this purchase order').'.<br />'. _('This order is for').' '.
 					$_SESSION['PO'.$identifier]->CurrCode.' '.$OrderTotal.'. '.
-					_('You can only authorise up to').' '.$_SESSION['PO'.$identifier]->CurrCode.' '.$AuthorityLevel.'.<br>'.
+					_('You can only authorise up to').' '.$_SESSION['PO'.$identifier]->CurrCode.' '.$AuthorityLevel.'.<br />'.
 					_('If you think this is a mistake please contact the systems administrator') , 'warn');
 			}
 		}
@@ -111,12 +109,12 @@
 			}
 			if ($OKToUpdateStatus==1){ // none of the order has been received
 				if ($AuthorityLevel>$OrderTotal) {
-					$_SESSION['PO'.$identifier]->StatusComments = date($_SESSION['DefaultDateFormat']).' - ' . $_POST['Status'] . ' ' . _('by') . $UserChangedStatus  . $_POST['StatusComments'].'<br>' . $_POST['StatusCommentsComplete'];	
+					$_SESSION['PO'.$identifier]->StatusComments = date($_SESSION['DefaultDateFormat']).' - ' . $_POST['Status'] . ' ' . _('by') . $UserChangedStatus  . $_POST['StatusComments'].'<br />' . $_POST['StatusCommentsComplete'];	
 				} else {
 					$OKToUpdateStatus=0;
-					prnMsg( _('You do not have permission to reject this purchase order').'.<br>'. _('This order is for').' '.
+					prnMsg( _('You do not have permission to reject this purchase order').'.<br />'. _('This order is for').' '.
 						$_SESSION['PO'.$identifier]->CurrCode.' '.$OrderTotal.'. '.
-						_('Your authorisation limit is set at').' '.$_SESSION['PO'.$identifier]->CurrCode.' '.$AuthorityLevel.'.<br>'.
+						_('Your authorisation limit is set at').' '.$_SESSION['PO'.$identifier]->CurrCode.' '.$AuthorityLevel.'.<br />'.
 						_('If you think this is a mistake please contact the systems administrator') , 'warn');
 				}
 			}
@@ -131,11 +129,11 @@
 			
 			if (($AuthorityLevel>$OrderTotal OR $_SESSION['UserID']==$_SESSION['PO'.$identifier]->Initiator ) AND $OKToUpdateStatus==1) {
 				
-				$_SESSION['PO'.$identifier]->StatusComments = date($_SESSION['DefaultDateFormat']).' - ' . _('Order set to pending status by') . $UserChangedStatus  . $_POST['StatusComments']. '<br>' .$_POST['StatusCommentsComplete'];
+				$_SESSION['PO'.$identifier]->StatusComments = date($_SESSION['DefaultDateFormat']).' - ' . _('Order set to pending status by') . $UserChangedStatus  . $_POST['StatusComments']. '<br />' .$_POST['StatusCommentsComplete'];
 				
 			} elseif ($AuthorityLevel<$OrderTotal AND $_SESSION['UserID']!=$_SESSION['PO'.$identifier]->Initiator) {
 				$OKToUpdateStatus=0;
-				prnMsg( _('You do not have permission to change the status of this purchase order').'.<br>'. _('This order is for').' '. $_SESSION['PO'.$identifier]->CurrCode.' '.$OrderTotal.'. '. _('Your authorisation limit is set at').' '.$_SESSION['PO'.$identifier]->CurrCode.' '.$AuthorityLevel.'.<br>'. _('If you think this is a mistake please contact the systems administrator') , 'warn');
+				prnMsg( _('You do not have permission to change the status of this purchase order').'.<br />'. _('This order is for').' '. $_SESSION['PO'.$identifier]->CurrCode.' '.$OrderTotal.'. '. _('Your authorisation limit is set at').' '.$_SESSION['PO'.$identifier]->CurrCode.' '.$AuthorityLevel.'.<br />'. _('If you think this is a mistake please contact the systems administrator') , 'warn');
 			}
 		}
 
@@ -221,7 +219,7 @@
 		$_SESSION['PO'.$identifier]->AllowPrintPO=1;
 
 		$sql = "UPDATE purchorders
-						SET purchorders.allowprint=1
+						SET purchorders.allowprint='1'
 						WHERE purchorders.orderno='" . $_SESSION['PO'.$identifier]->OrderNo ."'";
 
 		$ErrMsg = _('An error occurred updating the purchase order to allow reprints') . '. ' . _('The error says');
@@ -256,7 +254,8 @@
 	 * code above if a modification to an existing order. Also
 	 * $ExistingOrder would be set to 1. The delivery check screen
 	 * is where the details of the order are either updated or
-	 * inserted depending on the value of ExistingOrder */
+	 * inserted depending on the value of ExistingOrder 
+	 * */
 
 		$_SESSION['ExistingOrder']=0;
 		$_SESSION['PO'.$identifier] = new PurchOrder;
@@ -282,9 +281,9 @@
 		if ($_SESSION['PO'.$identifier]->Any_Already_Received()==0){
 			$_SESSION['RequireSupplierSelection']=1;
 			$_SESSION['PO'.$identifier]->Status = 'Pending';
-			$_SESSION['PO'.$identifier]->StatusComments==date($_SESSION['DefaultDateFormat']).' - ' . _('Supplier changed by') . ' <a href="mailto:'. $_SESSION['UserEmail'] .'">'.$_SESSION['UserID']. '</a> - '.$_POST['StatusComments'].'<br>'.$_POST['StatusCommentsComplete'];
+			$_SESSION['PO'.$identifier]->StatusComments==date($_SESSION['DefaultDateFormat']).' - ' . _('Supplier changed by') . ' <a href="mailto:'. $_SESSION['UserEmail'] .'">'.$_SESSION['UserID']. '</a> - '.$_POST['StatusComments'].'<br />'.$_POST['StatusCommentsComplete'];
 		} else {
-			echo '<br><br>';
+			echo '<br /><br />';
 			prnMsg(_('Cannot modify the supplier of the order once some of the order has been received'),'warn');
 		}
 	}
@@ -407,8 +406,8 @@
 
 	if (($AuthRow=DB_fetch_array($AuthResult) and $AuthRow['cancreate']==0 ) ) {
 		$_POST['SupplierName'] = $myrow['suppname'];
-		$_POST['CurrCode'] = 	$myrow['currcode'];
-		$_POST['ExRate'] = 	$myrow['rate'];
+		$_POST['CurrCode'] = $myrow['currcode'];
+		$_POST['ExRate'] = $myrow['rate'];
 		$_POST['PaymentTerms']=	$myrow['paymentterms'];
 		$_POST['SuppDelAdd1'] = $myrow['address1'];
 		$_POST['SuppDelAdd2'] = $myrow['address2'];
@@ -434,7 +433,7 @@
 		$_SESSION['PO'.$identifier]->SuppTel = $_POST['SuppTel'];
 		$_SESSION['PO'.$identifier]->Port = $_POST['Port'];
 	} else {
-		prnMsg( _('You do not have the authority to raise Purchase Orders for') . ' ' . $myrow['suppname'] .'. ' . _('Please Consult your system administrator for more information.') . '<br>' . _('You can setup authorisations'). ' ' . '<a href="PO_AuthorisationLevels.php">' . _('here') . '</a>', 'warn');
+		prnMsg( _('You do not have the authority to raise Purchase Orders for') . ' ' . $myrow['suppname'] .'. ' . _('Please Consult your system administrator for more information.') . '<br />' . _('You can setup authorisations'). ' ' . '<a href="PO_AuthorisationLevels.php">' . _('here') . '</a>', 'warn');
 		include('includes/footer.inc');
 		exit;
 	}
@@ -507,7 +506,7 @@
 
 	echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' .
 		_('Purchase Order') . '" alt="">' . ' ' . _('Purchase Order: Select Supplier') . '';
-	echo "<form action='" . $_SERVER['PHP_SELF'] . '?' . SID . "identifier=".$identifier."' method=post name='choosesupplier'>";
+	echo '<form action="' . $_SERVER['PHP_SELF'] . '?identifier=' . $identifier . '" method="post" name="choosesupplier">';
 	echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />';
 
 	echo '<table cellpadding=3 colspan=4 class=selection>
@@ -518,7 +517,7 @@
 	<td><font size=1>' . _('Enter text extract in the supplier code') . ':</font></td>
 	<td><input type="text" name="SuppCode" size="15"	maxlength="18"></td>
 	</tr>
-	</table><br><div class="centre">
+	</table><br /><div class="centre">
 	<input type="submit" name="SearchSuppliers" value="' . _('Search Now') . '">
 	<input type="submit" action="reset" value="' . _('Reset') . '"></div>';
 
@@ -526,7 +525,7 @@
 
 	if (isset($result_SuppSelect)) {
 
-		echo '<br><table cellpadding=3 colspan=7 class=selection>';
+		echo '<br /><table cellpadding=3 colspan=7 class=selection>';
 
 		$tableheader = '<tr>
 						<th>' . _('Code') . '</th>
@@ -573,7 +572,7 @@
 } else {
 /* everything below here only do if a supplier is selected */
 
-	echo '<form name="form1" action="' . $_SERVER['PHP_SELF'] . '?' . SID . 'identifier=' . $identifier . '" method=post>';
+	echo '<form name="form1" action="' . $_SERVER['PHP_SELF'] . '?identifier=' . $identifier . '" method="post">';
 	echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />';
 
 	echo '<p class="page_title_text">
@@ -591,12 +590,12 @@
 		prnMsg(_('Purchase Item(s) with this code') . ': ' .  $Purch_Item,'info');
 
 		echo '<div class="centre">';
-		echo '<br><table class="table_index"><tr><td class="menu_group_item">';
+		echo '<br /><table class="table_index"><tr><td class="menu_group_item">';
 
 		/* the link */
 		echo '<li><a href="'.$rootpath.'/PO_Items.php?NewItem=' . $Purch_Item . '&identifier=' . $identifier . '">' . 	_('Enter Line Item to this purchase order') . '</a></li>';
 
-		echo '</td></tr></table></div><br>';
+		echo '</td></tr></table></div><br />';
 
 		if (isset($_GET['Quantity'])) {
 			$Qty=$_GET['Quantity'];
@@ -686,7 +685,7 @@
 		$_POST['PaymentTerms']=$_SESSION['PO'.$identifier]->PaymentTerms;
 	}
 
-	echo '<br><table colspan=1 width=80%>
+	echo '<br /><table colspan=1 width=80%>
 		<tr>
 			<th><font color=blue size=4><b>' . _('Order Initiation Details') . '</b></font></th>
 			<th><font color=blue size=4><b>' . _('Order Status') . '</b></font></th>
@@ -717,12 +716,12 @@
 	}
 
 	echo '<tr><td>' . _('Version'). ' #' . ':</td>
-						<td><input type="hidden" name="Version" size="16" maxlength="15" value="' . $_POST['Version'] . '" />' . $_POST['Version'] . '</td></tr>';
+			<td><input type="hidden" name="Version" size="16" maxlength="15" value="' . $_POST['Version'] . '" />' . $_POST['Version'] . '</td></tr>';
 	echo '<tr><td>' . _('Revised') . ':</td>
-						<td><input type="hidden" name="Revised" size="11" maxlength="15" value="' . 	date($_SESSION['DefaultDateFormat']) . '" />' . date($_SESSION['DefaultDateFormat']) . '</td></tr>';
+			<td><input type="hidden" name="Revised" size="11" maxlength="15" value="' . 	date($_SESSION['DefaultDateFormat']) . '" />' . date($_SESSION['DefaultDateFormat']) . '</td></tr>';
 
 	echo '<tr><td>' . _('Delivery Date') . ':</td>
-						<td><input type="text" class="date" alt="' .$_SESSION['DefaultDateFormat'] .'" name="DeliveryDate" size="11" value="' . $_POST['DeliveryDate'] . '" /></td></tr>';
+			<td><input type="text" class="date" alt="' .$_SESSION['DefaultDateFormat'] .'" name="DeliveryDate" size="11" value="' . $_POST['DeliveryDate'] . '" /></td></tr>';
 
 	if (!isset($_POST['Initiator'])) {
 		$_POST['Initiator'] = $_SESSION['UserID'];
@@ -733,7 +732,7 @@
 			<td><input type="hidden" name="Initiator" size="11" maxlength="10" value="' .
 			$_POST['Initiator'] . '" />' . $_POST['Initiator'] . '</td></tr>';
 	echo '<tr><td>' . _('Requisition Ref') . ':</td>
-					<td><input type="text" name="Requisition" size="16" maxlength="15" value="' . $_POST['Requisition'] . '" /></td></tr>';
+			<td><input type="text" name="Requisition" size="16" maxlength="15" value="' . $_POST['Requisition'] . '" /></td></tr>';
 
 	echo '<tr><td>' . _('Date Printed') . ':</td><td>';
 	if (isset($_SESSION['PO'.$identifier]->DatePurchaseOrderPrinted) AND strlen($_SESSION['PO'.$identifier]->DatePurchaseOrderPrinted)>6){
@@ -751,13 +750,13 @@
 
 	if ($_SESSION['PO'.$identifier]->AllowPrintPO==0 AND empty($_POST['RePrint'])){
 		echo '<tr><td>' . _('Allow Reprint') . ':</td>
-							<td><select name="RePrint" onChange="ReloadForm(form1.AllowRePrint)">
-									<option selected value="0">' . _('No') . '</option>
-									<option value="1">' . _('Yes') . '</option>
-									</select></td>';
+				<td><select name="RePrint" onChange="ReloadForm(form1.AllowRePrint)">
+					<option selected value="0">' . _('No') . '</option>
+					<option value="1">' . _('Yes') . '</option>
+				</select></td>';
 		echo '<td><input type=submit name="AllowRePrint" value="Update"></td></tr>';
 	} elseif ($Printed) {
-		echo '<tr><td colspan=2><a target="_blank"  href="' . $rootpath . '/PO_PDFPurchOrder.php?' . SID . 'OrderNo=' . $_SESSION['ExistingOrder'] . '&identifier='.$identifier. '">' . _('Reprint Now') . '</a></td></tr>';
+		echo '<tr><td colspan=2><a target="_blank"  href="' . $rootpath . '/PO_PDFPurchOrder.php?OrderNo=' . $_SESSION['ExistingOrder'] . '&identifier='.$identifier. '">' . _('Reprint Now') . '</a></td></tr>';
 	}
 
 	echo '</table>';
@@ -812,7 +811,7 @@
 						<td><input type=text name="StatusComments" size=50></td></tr>
 					<tr><td colspan=2><b>' . $_SESSION['PO'.$identifier]->StatusComments .'</b></td></tr>';
 		//need to use single quotes as double quotes inside the string of StatusComments
-		echo "<input type='hidden' name='StatusCommentsComplete' value='" . $_SESSION['PO'.$identifier]->StatusComments ."'>";
+		echo '<input type="hidden" name="StatusCommentsComplete" value="' . $_SESSION['PO'.$identifier]->StatusComments .'">';
 		echo '<tr><td><input type="submit" name="UpdateStatus" value="' . _('Status Update') .'"></td>';
 	} //end its not a new order
 	
@@ -965,7 +964,7 @@
 
 	while ($ShipperRow=DB_fetch_array($ShipperResult)){
 		if (isset($_POST['DeliveryBy']) and ($_POST['DeliveryBy'] == $ShipperRow['shipper_id'])) {
-			echo '<option selected value="' . $ShipperRow['shipper_id'] . "'>" . $ShipperRow['shippername'] . '</option>';
+			echo '<option selected value="' . $ShipperRow['shipper_id'] . '">' . $ShipperRow['shippername'] . '</option>';
 		} else {
 			echo '<option value="' . $ShipperRow['shipper_id'] . '">' . $ShipperRow['shippername'] . '</option>';
 		}
@@ -1010,21 +1009,21 @@
 	echo '</select> ';
 	echo '</td></tr>';
 
-	echo '<tr><td>' . _('Address') . " 1 :</td>
-		</td><td><input type='text' name=SuppDelAdd1 size=41 maxlength=40 value='" . $_POST['SuppDelAdd1'] . "'></td>
-		</tr>";
-	echo '<tr><td>' . _('Address') . " 2 :</td>
-		</td><td><input type='text' name=SuppDelAdd2 size=41 maxlength=40 value='" . $_POST['SuppDelAdd2'] . "'></td>
-		</tr>";
-	echo '<tr><td>' . _('Address') . " 3 :</td>
-		</td><td><input type='text' name=SuppDelAdd3 size=41 maxlength=40 value='" . $_POST['SuppDelAdd3'] . "'></td>
-		</tr>";
-	echo '<tr><td>' . _('Address') . " 4 :</td>
-		</td><td><input type='text' name=SuppDelAdd5 size=21 maxlength=20 value='" . $_POST['SuppDelAdd5'] . "'></td>
-		</tr>";
-	echo '<tr><td>' . _('Address') . " 5 :</td>
-		</td><td><input type='text' name=SuppDelAdd4 size=41 maxlength=40 value='" . $_POST['SuppDelAdd4'] . "'></td>
-		</tr>";
+	echo '<tr><td>' . _('Address') . ' 1 :</td>
+		</td><td><input type="text" name="SuppDelAdd1" size="41" maxlength="40" value="' . $_POST['SuppDelAdd1'] . '"></td>
+		</tr>';
+	echo '<tr><td>' . _('Address') . ' 2 :</td>
+		</td><td><input type="text" name="SuppDelAdd2" size="41" maxlength="40" value="' . $_POST['SuppDelAdd2'] . '"></td>
+		</tr>';
+	echo '<tr><td>' . _('Address') . ' 3 :</td>
+		</td><td><input type="text" name="SuppDelAdd3" size="41" maxlength="40" value="' . $_POST['SuppDelAdd3'] . '"></td>
+		</tr>';
+	echo '<tr><td>' . _('Address') . ' 4 :</td>
+		</td><td><input type="text" name="SuppDelAdd5" size="21" maxlength="20" value="' . $_POST['SuppDelAdd5'] . '"></td>
+		</tr>';
+	echo '<tr><td>' . _('Address') . ' 5 :</td>
+		</td><td><input type="text" name="SuppDelAdd4" size="41" maxlength="40" value="' . $_POST['SuppDelAdd4'] . '"></td>
+		</tr>';
 	echo '<tr><td>' . _('Phone') . ':
 		</td><td><input type="text" name="SuppTel" size="31" maxlength="30" value="' . $_SESSION['PO'.$identifier]->SuppTel  . '"></td>
 		</tr>';
Modified: trunk/PO_Items.php
===================================================================
--- trunk/PO_Items.php	2011-04-02 01:42:42 UTC (rev 4535)
+++ trunk/PO_Items.php	2011-04-02 09:40:49 UTC (rev 4536)
@@ -694,7 +694,7 @@
 
 /* This is where the order as selected should be displayed  reflecting any deletions or insertions*/
 
-echo '<form name="form1" action="' . $_SERVER['PHP_SELF'] . '?' . SID . 'identifier=' . $identifier . '" method=post>';
+echo '<form name="form1" action="' . $_SERVER['PHP_SELF'] . '?identifier=' . $identifier . '" method=post>';
 echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />';
 
 /*need to set up entry for item description where not a stock item and GL Codes */
@@ -777,12 +777,12 @@
 
 if (isset($_POST['NonStockOrder'])) {
 
-	echo '<br /><table class=selection><tr><td>'._('Item Description').'</td>';
+	echo '<br /><table class=selection><tr><td>' . _('Item Description') . '</td>';
 	echo '<td><input type=text name=ItemDescription size=40></td></tr>';
-	echo '<tr><td>'._('General Ledger Code').'</td>';
+	echo '<tr><td>' . _('General Ledger Code') . '</td>';
 	echo '<td><select name="GLCode">';
 	$sql='SELECT accountcode,
-							accountname
+				  accountname
 				FROM chartmaster
 				ORDER BY accountcode ASC';
 
@@ -848,7 +848,7 @@
 				AND (purchdata.supplierno='" . $_SESSION['PO'.$identifier]->SupplierID."' 
 							OR purchdata.supplierno IS NULL)
 				ORDER BY stockmaster.stockid
-				LIMIT ".$_SESSION['DefaultDisplayRecordsMax'];
+				LIMIT " .$_SESSION['DefaultDisplayRecordsMax'];
 		} else {
 			$sql = "SELECT stockmaster.stockid,
 							stockmaster.description,
@@ -985,7 +985,7 @@
 
 if (!isset($_GET['Edit'])) {
 	$sql="SELECT categoryid,
-					categorydescription
+				categorydescription
 		FROM stockcategory
 		WHERE stocktype<>'L'
 		AND stocktype<>'D'
@@ -1027,12 +1027,11 @@
 		<td><input type='text' name='StockCode' size=15 maxlength=18 value='" . $_POST['StockCode'] . "'></td>
 		</tr>
 		<tr><td></td>
-		<td><font size=3><b>" . _('OR') . ' </b></font><a target="_blank" href="'.$rootpath.'/Stocks.php?"' . SID .
-			 '">' . _('Create a New Stock Item') . "</a></td></tr>
+		<td><font size=3><b>" . _('OR') . ' </b></font><a target="_blank" href="'.$rootpath.'/Stocks.php?">' . _('Create a New Stock Item') . '</a></td></tr>
 		</table><br />
-		<div class='centre'><input type=submit name='Search' value='" . _('Search Now') . "'>
-		<input type=submit name='NonStockOrder' value='" . _('Order a non stock item') . "'>
-		</div><br />";
+		<div class="centre"><input type="submit" name="Search" value="' . _('Search Now') . '">
+		<input type="submit" name="NonStockOrder" value="' . _('Order a non stock item') . '">
+		</div><br />';
 
 	$PartsDisplayed =0;
 }
@@ -1066,9 +1065,7 @@
 
 		$FileName = $myrow['stockid'] . '.jpg';
 		if (file_exists( $_SESSION['part_pics_dir'] . '/' . $FileName) ) {
-			$ImageSource = '<img src="'.$rootpath . '/' . $_SESSION['part_pics_dir'] . '/' . $myrow['stockid'] .
-				'.jpg" width="50" height="50">';
-
+			$ImageSource = '<img src="'.$rootpath . '/' . $_SESSION['part_pics_dir'] . '/' . $myrow['stockid'] . '.jpg" width="50" height="50">';
 		} else {
 			$ImageSource = '<i>'._('No Image').'</i>';
 		}
Modified: trunk/PricesByCost.php
===================================================================
--- trunk/PricesByCost.php	2011-04-02 01:42:42 UTC (rev 4535)
+++ trunk/PricesByCost.php	2011-04-02 09:40:49 UTC (rev 4536)
@@ -1,7 +1,6 @@
 <?php
 /* $Id$ */
 
-//$PageSecurity = 11; Now from DB
 include ('includes/session.inc');
 $title = _('Update of Prices By A Multiple Of Cost');
 include ('includes/header.inc');
@@ -46,48 +45,48 @@
 		$PriceCounter =0;
 		while ($myrow = DB_fetch_array($result)) {
 
-            $SQLTestExists = "SELECT price FROM prices
-        							WHERE stockid = '" . $_POST['StockID_' . $PriceCounter] . "'
-               			      		AND prices.typeabbrev ='" . $_POST['SalesType'] . "'
-			                    	AND prices.currabrev ='" . $_POST['CurrCode'] . "'
-                        			AND prices.debtorno ='" . $_POST['DebtorNo_' . $PriceCounter] . "'
-						        	AND prices.branchcode ='" . $_POST['BranchCode_' . $PriceCounter] . "'
-							        AND prices.startdate ='" . date('Y-m-d') . "'";
-             $TestExistsResult = DB_query($SQLTestExists,$db);
-             if (DB_num_rows($TestExistsResult)==1){
+			$SQLTestExists = "SELECT price FROM prices
+	        							WHERE stockid = '" . $_POST['StockID_' . $PriceCounter] . "'
+	               			      		AND prices.typeabbrev ='" . $_POST['SalesType'] . "'
+				                    	AND prices.currabrev ='" . $_POST['CurrCode'] . "'
+	                        			AND prices.debtorno ='" . $_POST['DebtorNo_' . $PriceCounter] . "'
+							AND prices.branchcode ='" . $_POST['BranchCode_' . $PriceCounter] . "'
+							AND prices.startdate ='" . date('Y-m-d') . "'";
+			$TestExistsResult = DB_query($SQLTestExists,$db);
+			if (DB_num_rows($TestExistsResult)==1){
                  //then we are updating
-                $SQLUpdate = "UPDATE prices	SET price = '" . $_POST['Price_' . $PriceCounter] . "'
-				             WHERE stockid = '" . $_POST['StockID_' . $PriceCounter] . "'
-				      		AND prices.typeabbrev ='" . $_POST['SalesType'] . "'
+	                $SQLUpdate = "UPDATE prices	SET price = '" . $_POST['Price_' . $PriceCounter] . "'
+					             WHERE stockid = '" . $_POST['StockID_' . $PriceCounter] . "'
+					      		AND prices.typeabbrev ='" . $_POST['SalesType'] . "'
 							AND prices.currabrev ='" . $_POST['CurrCode'] . "'
 							AND prices.debtorno ='" . $_POST['DebtorNo_' . $PriceCounter] . "'
 							AND prices.branchcode ='" . $_POST['BranchCode_' . $PriceCounter] . "'
 							AND prices.startdate ='" . date('Y-m-d') . "'
 							AND prices.enddate ='" . $_POST['EndDate_' . $PriceCounter] . "'";
-			    $ResultUpdate = DB_query($SQLUpdate, $db);
-             } else {
-                 //we need to add a new price from today
-                 $SQLInsert = "INSERT INTO prices (
-							stockid,
-							price,
-							typeabbrev,
-							currabrev,
-							debtorno,
-							branchcode,
-							startdate
-						) VALUES (
-							'" . $_POST['StockID_' . $PriceCounter] . "',
-							'" . $_POST['Price_' . $PriceCounter] . "',
-							'" . $_POST['SalesType'] . "',
-							'" . $_POST['CurrCode'] . "',
-							'" . $_POST['DebtorNo_' . $PriceCounter] . "',
-							'" . $_POST['BranchCode_' . $PriceCounter] . "',
-							'" . date('Y-m-d') . "'
-						)";
-			      $ResultInsert = DB_query($SQLInsert, $db);
-             }
+			$ResultUpdate = DB_query($SQLUpdate, $db);
+			} else {
+	                 //we need to add a new price from today
+	                 $SQLInsert = "INSERT INTO prices (
+								stockid,
+								price,
+								typeabbrev,
+								currabrev,
+								debtorno,
+								branchcode,
+								startdate
+							) VALUES (
+								'" . $_POST['StockID_' . $PriceCounter] . "',
+								'" . $_POST['Price_' . $PriceCounter] . "',
+								'" . $_POST['SalesType'] . "',
+								'" . $_POST['CurrCode'] . "',
+								'" . $_POST['DebtorNo_' . $PriceCounter] . "',
+								'" . $_POST['BranchCode_' . $PriceCounter] . "',
+								'" . date('Y-m-d') . "'
+							)";
+				      $ResultInsert = DB_query($SQLInsert, $db);
+			}
 			$PriceCounter++;
-		}
+		}//end while loop
 		DB_free_result($result); //clear the old result
 		$result = DB_query($sql, $db); //re-run the query with the updated prices
 		$numrow = DB_num_rows($result); // get the new number - should be the same!!
@@ -116,24 +115,24 @@
 	if ($numrow > 0) { //the number of prices returned from the main prices query is
 		echo '<table class=selection>';
 		echo '<tr><th>' . _('Code') . '</th>
-						<th>' . _('Description') . '</th>
-						<th>' . _('Customer') . '</th>
-						<th>' . _('Branch') . '</th>
-						<th>' . _('Start Date') . '</th>
-						<th>' . _('End Date') . '</th>
-						<th>' . _('Cost') . '</th>
-						<th>' . _('GP %') . '</th>
-						<th>' . _('Price Proposed') . '</th>
-						<th>' . _('List Price') . '</th>
-					<tr>';
+				<th>' . _('Description') . '</th>
+				<th>' . _('Customer') . '</th>
+				<th>' . _('Branch') . '</th>
+				<th>' . _('Start Date') . '</th>
+				<th>' . _('End Date') . '</th>
+				<th>' . _('Cost') . '</th>
+				<th>' . _('GP %') . '</th>
+				<th>' . _('Price Proposed') . '</th>
+				<th>' . _('List Price') . '</th>
+			<tr>';
 		$k = 0; //row colour counter
 		echo '<form action="' .$_SERVER['PHP_SELF'] .'" method="POST" name="update">';
 		echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />';
 		echo'<input type="hidden" value=' . $_POST['StockCat'] . ' name="StockCat">
-					<input type="hidden" value=' . $_POST['Margin'] . ' name="Margin">
-					<input type="hidden" value=' . $_POST['CurrCode'] . ' name="CurrCode">
-					<input type="hidden" value=' . $_POST['Comparator'] . ' name="Comparator">
-					<input type="hidden" value=' . $_POST['SalesType'] . ' name="SalesType">';
+			<input type="hidden" value=' . $_POST['Margin'] . ' name="Margin">
+			<input type="hidden" value=' . $_POST['CurrCode'] . ' name="CurrCode">
+			<input type="hidden" value=' . $_POST['Comparator'] . ' name="Comparator">
+			<input type="hidden" value=' . $_POST['SalesType'] . ' name="SalesType">';
 
 		$PriceCounter =0;
 		while ($myrow = DB_fetch_array($result)) {
@@ -154,10 +153,10 @@
 
 			//variables for update
 			echo '<input type="hidden" value=' . $myrow['stockid'] . ' name="StockID_' . $PriceCounter .'">
-					<input type="hidden" value=' . $myrow['debtorno'] . ' name="DebtorNo_' . $PriceCounter .'">
-					<input type="hidden" value=' . $myrow['branchcode'] . ' name="BranchCode_' . $PriceCounter .'">
-					<input type="hidden" value=' . $myrow['startdate'] . ' name="StartDate_' . $PriceCounter .'">
-					<input type="hidden" value=' . $myrow['enddate'] . ' name="EndDate_' . $PriceCounter .'">';
+				<input type="hidden" value=' . $myrow['debtorno'] . ' name="DebtorNo_' . $PriceCounter .'">
+				<input type="hidden" value=' . $myrow['branchcode'] . ' name="BranchCode_' . $PriceCounter .'">
+				<input type="hidden" value=' . $myrow['startdate'] . ' name="StartDate_' . $PriceCounter .'">
+				<input type="hidden" value=' . $myrow['enddate'] . ' name="EndDate_' . $PriceCounter .'">';
 			//variable for current margin
 			if ($myrow['price'] != 0){
 				$CurrentGP = ($myrow['price']-$Cost)*100 / $myrow['price'];
@@ -172,25 +171,25 @@
 				$EndDateDisplay = ConvertSQLDate($myrow['enddate']);
 			}
 			echo '   <td>' . $myrow['stockid'] . '</td>
-						<td>' . $myrow['description'] . '</td>
-						<td>' . $myrow['customer'] . '</td>
-						<td>' . $myrow['branch'] . '</td>
-						<td>' . ConvertSQLDate($myrow['startdate']) . '</td>
-						<td>' . $EndDateDisplay . '</td>
-						<td class="number">' . number_format($Cost, 2) . '</td>
-						<td class="number">' . number_format($CurrentGP, 1) . '%</td>
-						<td class="number">' . number_format($Proposed, 2) . '</td>
-						<td><input type="text" class="number" name="Price_' . $PriceCounter . '" maxlength=14 size=10 value="' . $myrow['price'] . '"></td>
-					</tr> ';
+					<td>' . $myrow['description'] . '</td>
+					<td>' . $myrow['customer'] . '</td>
+					<td>' . $myrow['branch'] . '</td>
+					<td>' . ConvertSQLDate($myrow['startdate']) . '</td>
+					<td>' . $EndDateDisplay . '</td>
+					<td class="number">' . number_format($Cost, 2) . '</td>
+					<td class="number">' . number_format($CurrentGP, 1) . '%</td>
+					<td class="number">' . number_format($Proposed, 2) . '</td>
+					<td><input type="text" class="number" name="Price_' . $PriceCounter . '" maxlength=14 size=10 value="' . $myrow['price'] . '"></td>
+				</tr> ';
 			$PriceCounter++;
 		} //end of looping
 		echo '<tr>
 			<td style="text-align:right" colspan=4><input type=submit name=submit value=' . _('Update') . '></td>
-			<td style="text-align:left" colspan=3><a href="' . $_SERVER['PHP_SELF'] . '?' . SID . '"><input type=submit  value=' . _('Back') . '><a/></td>
+			<td style="text-align:left" colspan=3><a href="' . $_SERVER['PHP_SELF'] . '"><input type=submit  value=' . _('Back') . '><a/></td>
 			 </tr></form>';
 	} else {
 		prnMsg(_('There were no prices meeting the criteria specified to review'),'info');
-		echo '<p><div class="centre"><a href="' . $_SERVER['PHP_SELF'] . '?' . SID . '">' . _('Back') . '<a/></div><p>';
+		echo '<p><div class="centre"><a href="' . $_SERVER['PHP_SELF'] . '">' . _('Back') . '<a/></div><p>';
 	}
 } else { /*The option to submit was not hit so display form */
 	echo '<div class="page_help_text">' . _('Use this report to display price list with the cost.') . '</div><br>';
@@ -206,13 +205,13 @@
 			<td><select name="StockCat">';
 	echo '<option value="all">' . _('All Categories') . '';
 	while ($myrow1 = DB_fetch_array($result1)) {
-		echo '<option value="' . $myrow1['categoryid'] . '">' . $myrow1['categorydescription'];
+		echo '<option value="' . $myrow1['categoryid'] . '">' . $myrow1['categorydescription'] . '</option>';
 	}
 	echo '</select></td></tr>';
 	echo '<tr><td>' . _('Price') . '
 				<select name="Comparator">';
-	echo '<option value="1">' . _('Less than or equal to') . '';
-	echo '<option value="2">' . _('Greater than or equal to') . '';
+	echo '<option value="1">' . _('Less than or equal to') . '</option>';
+	echo '<option value="2">' . _('Greater than or equal to') . '</option>';
 	if ($_SESSION['WeightedAverageCosting']==1) {
 		echo '</select>'.' '. _('Average Cost') . ' x </td>';
 	} else {
@@ -221,23 +220,22 @@
 	if (!isset($_POST['Margin'])){
 		$_POST['Margin']=1;
 	}
-	echo '<td>
-				<input type="text" class="number" name="Margin" MAXLENGTH =8 size=8 value=' .$_POST['Margin'] . '></td></tr>';
+	echo '<td><input type="text" class="number" name="Margin" MAXLENGTH =8 size=8 value=' .$_POST['Margin'] . '></td></tr>';
 	$result = DB_query('SELECT typeabbrev, sales_type FROM salestypes ', $db);
-	echo '<tr><td>' . _('Sales Type') . '/' . _('Price List') . ":</td>
-		<td><select name='SalesType'>";
+	echo '<tr><td>' . _('Sales Type') . '/' . _('Price List') . ':</td>
+		<td><select name="SalesType">';
 	while ($myrow = DB_fetch_array($result)) {
 		if ($_POST['SalesType'] == $myrow['typeabbrev']) {
-			echo "<option selected value='" . $myrow['typeabbrev'] . "'>" . $myrow['sales_type'] . '</option>';
+			echo '<option selected value="' . $myrow['typeabbrev'] . '">' . $myrow['sales_type'] . '</option>';
 		} else {
-			echo "<option value='" . $myrow['typeabbrev'] . "'>" . $myrow['sales_type'] . '</option>';
+			echo '<option value="' . $myrow['typeabbrev'] . '">' . $myrow['sales_type'] . '</option>';
 		}
 	} //end while loop
 	DB_data_seek($result, 0);
 	$result = DB_query('SELECT currency, currabrev FROM currencies', $db);
 	echo '</select></td></tr>
-		<tr><td>' . _('Currency') . ":</td>
-		<td><select name='CurrCode'>";
+		<tr><td>' . _('Currency') . ':</td>
+		<td><select name="CurrCode">';
 	while ($myrow = DB_fetch_array($result)) {
 		if (isset($_POST['CurrCode']) and $_POST['CurrCode'] == $myrow['currabrev']) {
 			echo '<option selected value=' . $myrow['currabrev'] . '>' . $myrow['currency'] . '</option>';
@@ -247,7 +245,8 @@
 	} //end while loop
 	DB_data_seek($result, 0);
 	echo '</select></td></tr>';
-	echo "</table></br><p><div class='centre'><input type=submit name='submit' value='" . _('Submit') . "'></div></p>";
+	echo '</table>
+		</br><p><div class="centre"><input type="submit" name="submit" value="' . _('Submit') . '"></div></p>';
 } /*end of else not submit */
 include ('includes/footer.inc');
 ?>
\ No newline at end of file
Modified: trunk/PrintCustTransPortrait.php
===================================================================
--- trunk/PrintCustTransPortrait.php	2011-04-02 01:42:42 UTC (rev 4535)
+++ trunk/PrintCustTransPortrait.php	2011-04-02 09:40:49 UTC (rev 4536)
@@ -2,8 +2,6 @@
 
 /* $Id$ */
 
-//$PageSecurity = 1;
-
 include('includes/session.inc');
 
 if (isset($_GET['FromTransNo'])) {
@@ -81,9 +79,11 @@
 	nobble the invoice reprints */
 
 	// check if the user has set a default bank account for invoices, if not leave it blank
-		$sql = 'SELECT bankaccounts.invoice, bankaccounts.bankaccountnumber, bankaccounts.bankaccountcode
-				from bankaccounts
-				WHERE bankaccounts.invoice = 1';
+		$sql = "SELECT bankaccounts.invoice, 
+					bankaccounts.bankaccountnumber, 
+					bankaccounts.bankaccountcode
+				FROM bankaccounts
+				WHERE bankaccounts.invoice = '1'";
 		$result=DB_query($sql,$db,'','',false,false);
 		if (DB_error_no($db)!=1) {
 			if (DB_num_rows($result)==1){
@@ -233,7 +233,7 @@
 
 			prnMsg( _('There was a problem retrieving the invoice or credit note details for note number') . ' ' . $InvoiceToPrint . ' ' . _('from the database') . '. ' . _('To print an invoice, the sales order record, the customer transaction record and the branch record for the customer must not have been purged') . '. ' . _('To print a credit note only requires the customer, transaction, salesman and branch records be available'),'error');
 			if ($debug==1){
-			    prnMsg (_('The SQL used to get this information that failed was') . "<br>" . $sql,'error');
+			    prnMsg (_('The SQL used to get this information that failed was') . "<br />" . $sql,'error');
 			}
 			include ('includes/footer.inc');
 			exit;
@@ -284,9 +284,9 @@
 		if (DB_error_no($db)!=0) {
 			$title = _('Transaction Print Error Report');
 			include ('includes/header.inc');
-			echo '<br>' . _('There was a problem retrieving the invoice or credit note stock movement details for invoice number') . ' ' . $FromTransNo . ' ' . _('from the database');
+			echo '<br />' . _('There was a problem retrieving the invoice or credit note stock movement details for invoice number') . ' ' . $FromTransNo . ' ' . _('from the database');
 			if ($debug==1){
-			    echo '<br>' . _('The SQL used to get this information that failed was') . "<br>$sql";
+			    echo '<br />' . _('The SQL used to get this information that failed was') . '<br />' . $sql;
 			}
 			include('includes/footer.inc');
 			exit;
@@ -329,9 +329,10 @@
 
 				if ($myrow2['controlled']==1){
 
-					$GetControlMovts = DB_query('SELECT moveqty, serialno
+					$GetControlMovts = DB_query("SELECT moveqty, 
+														serialno
 												 FROM   stockserialmoves
-												 WHERE  stockmoveno=' . $myrow2['stkmoveno'],$db);
+												 WHERE  stockmoveno='" . $myrow2['stkmoveno'] . "'",$db);
 
 					if ($myrow2['serialised']==1){
 						while ($ControlledMovtRow = DB_fetch_array($GetControlMovts)){
@@ -469,7 +470,7 @@
 			}
 /* Add Images for Visa / Mastercard / Paypal */
 			if (file_exists('companies/' . $_SESSION['DatabaseName'] . '/payment.jpg')) {
-            	$pdf->addJpegFromFile('companies/' . $_SESSION['DatabaseName'] . '/payment.jpg',$Page_Width/2 -60,$YPos-15,0,20);
+				$pdf->addJpegFromFile('companies/' . $_SESSION['DatabaseName'] . '/payment.jpg',$Page_Width/2 -60,$YPos-15,0,20);
 			}
 // Print Bank acount details if available and default for invoices is selected
             $pdf->addText($Page_Width-$Right_Margin-450, $YPos - ($line_height*3)+22,$FontSize, $DefaultBankAccountCode . '  ' . $DefaultBankAccountNumber);
@@ -503,12 +504,12 @@
 
 		$title = _('Emailing') . ' ' .$InvOrCredit . ' ' . _('Number') . ' ' . $FromTransNo;
 		include('includes/header.inc');
-		echo '<p>' . $InvOrCredit . ' '  . _('number') . ' ' . $_GET['FromTransNo'] . ' ' . _('has been emailed to') . ' ' . $_GET['Email'];
+		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 . '_' . $_GET['FromTransNo'] . '.pdf');
+		$pdf->OutputD($_SESSION['DatabaseName'] . '_' . $InvOrCredit . '_' . $FromTransNo . '.pdf');
 		
 	}
 	$pdf->__destruct();
@@ -522,56 +523,56 @@
 
 	/*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="' . $_SERVER['PHP_SELF'] . '?' . SID . '" method="POST"><table class="selection">';
+		echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="POST"><table class="selection">';
 		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>';
-		echo '<tr><td>' . _('Print Invoices or Credit Notes') . '</td><td><select name=InvOrCredit>';
+		echo '<tr><td>' . _('Print Invoices or Credit Notes') . '</td>
+			<td><select name="InvOrCredit">';
 		if ($InvOrCredit=='Invoice' OR !isset($InvOrCredit)){
 
-		   echo "<option selected VALUE='Invoice'>" . _('Invoices');
-		   echo "<option VALUE='Credit'>" . _('Credit Notes');
-
+		   echo '<option selected value="Invoice">' . _('Invoices') . '</option>';
+		   echo '<option value="Credit">' . _('Credit Notes') . '</option>';
 		} else {
-
-		   echo "<option selected VALUE='Credit'>" . _('Credit Notes');
-		   echo "<option VALUE='Invoice'>" . _('Invoices');
-
+		   echo '<option selected value="Credit">' . _('Credit Notes') . '</option>';
+		   echo '<option VALUE="Invoice">' . _('Invoices') . '</option>';
 		}
-
 		echo '</select></td></tr>';
 
-		echo '<tr><td>' . _('Print EDI Transactions') . '</td><td><select name=PrintEDI>';
+		echo '<tr><td>' . _('Print EDI Transactions') . '</td><td><select name="PrintEDI">';
 		if ($InvOrCredit=='Invoice' OR !isset($InvOrCredit)){
 
-		   echo "<option selected VALUE='No'>" . _('Do not Print PDF EDI Transactions');
-		   echo "<option VALUE='Yes'>" . _('Print PDF EDI Transactions Too');
+		   echo '<option selected value="No">' . _('Do not Print PDF EDI Transactions') . '</option>';
+		   echo '<option VALUE="Yes">' . _('Print PDF EDI Transactions Too') . '</option>';
 
 		} else {
 
-		   echo "<option VALUE='No'>" . _('Do not Print PDF EDI Transactions');
-		   echo "<option selected VALUE='Yes'>" . _('Print PDF EDI Transactions Too');
+		   echo '<option VALUE="No">' . _('Do not Print PDF EDI Transactions') . '</option>';
+		   echo '<option selected value="Yes">' . _('Print PDF EDI Transactions Too') . '</option>';
 
 		}
 
 		echo '</select></td></tr>';
-		echo '<tr><td>' . _('Start invoice/credit note number to print') . '</td><td><input class=number type=text max=6 size=7 name=FromTransNo></td></tr>';
-		echo '<tr><td>' . _('End invoice/credit note number to print') . "</td><td><input class=number type=text max=6 size=7 name='ToTransNo'></td></tr></table>";
-		echo "<div class='centre'><br><input type=Submit Name='Print' Value='" . _('Print Preview') . "'><p>";
-		echo "<input type=Submit Name='PrintPDF' Value='" . _('Print PDF') . "'></div>";
+		echo '<tr><td>' . _('Start invoice/credit note number to print') . '</td>
+				<td><input class="number" type="text" max="6" size="7" name="FromTransNo"></td></tr>';
+		echo '<tr><td>' . _('End invoice/credit note number to print') . '</td>
+				<td><input class="number" type="text" max="6" size="7" name="ToTransNo"></td></tr>
+			</table>';
+		echo '<div class="centre"><br /><input type="submit" name="Print" value="' . _('Print Preview') . '"><p>';
+		echo '<input type="submit" name="PrintPDF" value="' . _('Print PDF') . '"></div>';
 
 		$sql = 'SELECT typeno FROM systypes WHERE typeid=10';
 
 		$result = DB_query($sql,$db);
 		$myrow = DB_fetch_row($result);
 
-		echo '<div class="page_help_text"><b>' . _('The last invoice created was number') . ' ' . $myrow[0] . '</b><br>' . _('If only a single invoice is required') . ', ' . _('enter the invoice number to print in the Start transaction number to print field and leave the End transaction number to print field blank') . '. ' . _('Only use the end invoice to print field if you wish to print a sequential range of invoices') . '';
+		echo '<div class="page_help_text"><b>' . _('The last invoice created was number') . ' ' . $myrow[0] . '</b><br />' . _('If only a single invoice is required') . ', ' . _('enter the invoice number to print in the Start transaction number to print field and leave the End transaction number to print field blank') . '. ' . _('Only use the end invoice to print field if you wish to print a sequential range of invoices') . '';
 
-		$sql = 'SELECT typeno FROM systypes WHERE typeid=11';
+		$sql = "SELECT typeno FROM systypes WHERE typeid='11'";
 
 		$result = DB_query($sql,$db);
 		$myrow = DB_fetch_row($result);
 
-		echo '<br><b>' . _('The last credit note created was number') . ' ' . $myrow[0] . '</b><br>' . _('A sequential range can be printed using the same method as for invoices above') . '. ' . _('A single credit note can be printed by only entering a start transaction number') . '</DIV';
+		echo '<br /><b>' . _('The last credit note created was number') . ' ' . $myrow[0] . '</b><br />' . _('A sequential range can be printed using the same method as for invoices above') . '. ' . _('A single credit note can be printed by only entering a start transaction number') . '</DIV';
 
 	} else {
 
@@ -677,7 +678,7 @@
 			if (DB_num_rows($result)==0 OR DB_error_no($db)!=0) {
 				echo '<p>' . _('There was a problem retrieving the invoice or credit note details for note number') . ' ' . $InvoiceToPrint . ' ' . _('from the database') . '. ' . _('To print an invoice, the sales order record, the customer transaction record and the branch record for the customer must not have been purged') . '. ' . _('To print a credit note only requires the customer, transaction, salesman and branch records be available');
 				if ($debug==1){
-					echo _('The SQL used to get this information that failed was') . "<br>$sql";
+					echo _('The SQL used to get this information that failed was') . "<br />$sql";
 				}
 				break;
 				include('includes/footer.inc');
@@ -694,33 +695,41 @@
 				$ExchRate = $myrow['rate'];
 				$PageNumber = 1;
 
-				echo '<table class="table1"><tr><td VALIGN=TOP WIDTH=10%><img src="' . $_SESSION['LogoFile'] . '"></td><td bgcolor="#bbb"><b>';
+				echo '<table class="table1">
+						<tr><td valign=top width=10%><img src="' . $_SESSION['LogoFile'] . '"></td><td bgcolor="#bbb"><b>';
 
 				if ($InvOrCredit=='Invoice') {
 				   echo '<font size=4>' . _('TAX INVOICE') . ' ';
 				} else {
 				   echo '<font color=RED size=4>' . _('TAX CREDIT NOTE') . ' ';
 				}
-				echo '</b>' . _('Number') . ' ' . $FromTransNo . '</font><br><font size=1>' . _('Tax Authority Ref') . '. ' . $_SESSION['CompanyRecord']['gstno'] . '</td></tr></table>';
+				echo '</b>' . _('Number') . ' ' . $FromTransNo . '</font><br /><font size=1>' . _('Tax Authority Ref') . '. ' . $_SESSION['CompanyRecord']['gstno'] . '</td></tr></table>';
 
 	/*Now print out the logo and company name and address */
-				echo '<table class"table1"><tr><td><font size=4 color="#333"><b>' . $_SESSION['CompanyRecord']['coyname'] . '</b></font><br>';
-				echo $_SESSION['CompanyRecord']['regoffice1'] . '<br>';
-				echo $_SESSION['CompanyRecord']['regoffice2'] . '<br>';
-				echo $_SESSION['CompanyRecord']['regoffice3'] . '<br>';
-				echo $_SESSION['CompanyRecord']['regoffice4'] . '<br>';
-				echo $_SESSION['CompanyRecord']['regoffice5'] . '<br>';
-				echo $_SESSION['CompanyRecord']['regoffice6'] . '<br>';
-				echo _('Telephone') . ': ' . $_SESSION['CompanyRecord']['telephone'] . '<br>';
-				echo _('Facsimile') . ': ' . $_SESSION['CompanyRecord']['fax'] . '<br>';
-				echo _('Email') . ': ' . $_SESSION['CompanyRecord']['email'] . '<br>';
+				echo '<table class"table1"><tr><td><font size=4 color="#333"><b>' . $_SESSION['CompanyRecord']['coyname'] . '</b></font><br />';
+				echo $_SESSION['CompanyRecord']['regoffice1'] . '<br />';
+				echo $_SESSION['CompanyRecord']['regoffice2'] . '<br />';
+				echo $_SESSION['CompanyRecord']['regoffice3'] . '<br />';
+				echo $_SESSION['CompanyRecord']['regoffice4'] . '<br />';
+				echo $_SESSION['CompanyRecord']['regoffice5'] . '<br />';
+				echo $_SESSION['CompanyRecord']['regoffice6'] . '<br />';
+				echo _('Telephone') . ': ' . $_SESSION['CompanyRecord']['telephone'] . '<br />';
+				echo _('Facsimile') . ': ' . $_SESSION['CompanyRecord']['fax'] . '<br />';
+				echo _('Email') . ': ' . $_SESSION['CompanyRecord']['email'] . '<br />';
 
 				echo '</td><td width=50% class=number>';
 
 	/*Now the customer charged to details in a sub table within a cell of the main table*/
 
 				echo '<table class="table1"><tr><td align="left" bgcolor="#bbb"><b>' . _('Charge To') . ':</b></td></tr><tr><td bgcolor="#eee">';
-				echo $myrow['name'] . '<br>' . $myrow['address1'] . '<br>' . $myrow['address2'] . '<br>' . $myrow['address3'] . '<br>' . $myrow['address4'] . '<br>' . $myrow['address5'] . '<br>' . $myrow['address6'];
+				echo $myrow['name'] . 
+					'<br />' . $myrow['address1'] . 
+					'<br />' . $myrow['address2'] . 
+					'<br />' . $myrow['address3'] . 
+					'<br />' . $myrow['address4'] . 
+					'<br />' . $myrow['address5'] . 
+					'<br />' . $myrow['address6'];
+				
 				echo '</td></tr></table>';
 				/*end of the small table showing charge to account details */
 				echo _('Page') . ': ' . $PageNumber;
@@ -735,9 +744,23 @@
 							<td align=left bgcolor="#bbb"><b>' . _('Delivered To') . ':</b></td>
 						</tr>';
 				   echo '<tr>
-				   		<td bgcolor="#eee">' .$myrow['brname'] . '<br />' . $myrow['braddress1'] . '<br />' . $myrow['braddress2'] . '<br />' . $myrow['braddress3'] . '<br />' . $myrow['braddress4'] . '<br />' . $myrow['braddress5'] . '<br />' . $myrow['braddress6'] . '</td>';
+				   		<td bgcolor="#eee">' .$myrow['brname'] . 
+									'<br />' . $myrow['braddress1'] . 
+									'<br />' . $myrow['braddress2'] . 
+									'<br />' . $myrow['braddress3'] . 
+									'<br />' . $myrow['braddress4'] . 
+									'<br />' . $myrow['braddress5'] . 
+									'<br />' . $myrow['braddress6'] . 
+						'</td>';
 
-				   echo '<td bgcolor="#eee">' . $myrow['deliverto'] . '<br />' . $myrow['deladd1'] . '<br />' . $myrow['deladd2'] . '<br />' . $myrow['deladd3'] . '<br />' . $myrow['deladd4'] . '<br />' . $myrow['deladd5'] . '<br />' . $myrow['deladd6'] . '</td>';
+				   echo '<td bgcolor="#eee">' . $myrow['deliverto'] . 
+									'<br />' . $myrow['deladd1'] . 
+									'<br />' . $myrow['deladd2'] . 
+									'<br />' . $myrow['deladd3'] . 
+									'<br />' . $myrow['deladd4'] . 
+									'<br />' . $myrow['deladd5'] . 
+									'<br />' . $myrow['deladd6'] . 
+						'</td>';
 				   echo '</tr>
 				   </table><hr>';
 
@@ -751,16 +774,16 @@
 							<td align=left bgcolor="#bbb"><b>' . _('Shipper') . '</b></td>
 							<td align=left bgcolor="#bbb"><b>' . _('Consignment Ref') . '</b></td>
 						</tr>';
-				   	echo "<tr>
-							<td bgcolor='#EEEEEE'>" . $myrow['customerref'] . "</td>
-							<td bgcolor='#EEEEEE'>" .$myrow['orderno'] . "</td>
-							<td bgcolor='#EEEEEE'>" . ConvertSQLDate($myrow['orddate']) . "</td>
-							<td bgcolor='#EEEEEE'>" . ConvertSQLDate($myrow['trandate']) . "</td>
-							<td bgcolor='#EEEEEE'>" . $myrow['salesmanname'] . "</td>
-							<td bgcolor='#EEEEEE'>" . $myrow['shippername'] . "</td>
-							<td bgcolor='#EEEEEE'>" . $myrow['consignment'] . "</td>
+				   	echo '<tr>
+							<td bgcolor="#EEEEEE">' . $myrow['customerref'] . '</td>
+							<td bgcolor="#EEEEEE">' .$myrow['orderno'] . '</td>
+							<td bgcolor="#EEEEEE">' . ConvertSQLDate($myrow['orddate']) . '</td>
+							<td bgcolor="#EEEEEE">' . ConvertSQLDate($myrow['trandate']) . '</td>
+							<td bgcolor="#EEEEEE">' . $myrow['salesmanname'] . '</td>
+							<td bgcolor="#EEEEEE">' . $myrow['shippername'] . '</td>
+							<td bgcolor="#EEEEEE">' . $myrow['consignment'] . '</td>
 						</tr>
-					</table>";
+					</table>';
 
 				   $sql ="SELECT stockmoves.stockid,
 				   		stockmaster.description,
@@ -780,19 +803,26 @@
 
 				} else { /* then its a credit note */
 
-				   echo "<table WIDTH=50%><tr>
-				   		<td align=left bgcolor='#BBBBBB'><b>" . _('Branch') . ":</b></td>
-						</tr>";
-				   echo "<tr>
-				   		<td bgcolor='#EEEEEE'>" .$myrow['brname'] . '<br>' . $myrow['braddress1'] . '<br>' . $myrow['braddress2'] . '<br>' . $myrow['braddress3'] . '<br>' . $myrow['braddress4'] . '<br>' . $myrow['braddress5'] . '<br>' . $myrow['braddress6'] . '</td>
+				   echo '<table WIDTH=50%><tr>
+				   		<td align=left bgcolor="#BBBBBB"><b>' . _('Branch') . ':</b></td>
+						</tr>';
+				   echo '<tr>
+				   		<td bgcolor="#EEEEEE">' .$myrow['brname'] . 
+										'<br />' . $myrow['braddress1'] . 
+										'<br />' . $myrow['braddress2'] . 
+										'<br />' . $myrow['braddress3'] . 
+										'<br />' . $myrow['braddress4'] . 
+										'<br />' . $myrow['braddress5'] . 
+										'<br />' . $myrow['braddress6'] . 
+								'</td>
 					</tr></table>';
 				   echo '<hr><table class="table1"><tr>
-				   		<td align=left bgcolor="#bbb"><b>' . _('Date') . "</b></td>
-						<td align=left bgcolor='#BBBBBB'><b>" . _('Sales Person') . "</font></b></td>
-					</tr>";
-				   echo "<tr>
-				   		<td bgcolor='#EEEEEE'>" . ConvertSQLDate($myrow['trandate']) . "</td>
-						<td bgcolor='#EEEEEE'>" . $myrow['salesmanname'] . '</td>
+				   		<td align=left bgcolor="#bbbbbb"><b>' . _('Date') . '</b></td>
+						<td align=left bgcolor="#BBBBBB"><b>' . _('Sales Person') . '</font></b></td>
+					</tr>';
+				   echo '<tr>
+				   		<td bgcolor="#EEEEEE">' . ConvertSQLDate($myrow['trandate']) . '</td>
+						<td bgcolor="#EEEEEE">' . $myrow['salesmanname'] . '</td>
 					</tr></table>';
 
 
@@ -801,7 +831,8 @@
 						stockmoves.qty as quantity,
 						stockmoves.discountpercent, ((1 - stockmoves.discountpercent) * stockmoves.price * " . $ExchRate . " * stockmoves.qty) AS fxnet,
 						(stockmoves.price * " . $ExchRate . ") AS fxprice,
-						stockmaster.units
+						stockmaster.units,
+						stockmoves.narrative
 					FROM stockmoves,
 						stockmaster
 					WHERE stockmoves.stockid = stockmaster.stockid
@@ -815,22 +846,22 @@
 
 				$result=DB_query($sql,$db);
 				if (DB_error_no($db)!=0) {
-					echo '<br>' . _('There was a problem retrieving the invoice or credit note stock movement details for invoice number') . ' ' . $FromTransNo . ' ' . _('from the database');
+					echo '<br />' . _('There was a problem retrieving the invoice or credit note stock movement details for invoice number') . ' ' . $FromTransNo . ' ' . _('from the database');
 					if ($debug==1){
-						 echo '<br>' . _('The SQL used to get this information that failed was') . "<br>$sql";
+						 echo '<br />' . _('The SQL used to get this information that failed was') . '<br />' . $sql;
 					}
 					exit;
 				}
 
 				if (DB_num_rows($result)>0){
 					echo '<table class="table1">
-						<tr><th>' . _('Item Code') . "</th>
-						<th>" . _('Item Description') . "</th>
-						<th>" . _('Quantity') . "</th>
-						<th>" . _('Unit') . "</th>
-						<th>" . _('Price') . "</th>
-						<th>" . _('Discount') . "</th>
-						<th>" . _('Net') . '</th></tr>';
+						<tr><th>' . _('Item Code') . '</th>
+						<th>' . _('Item Description') . '</th>
+						<th>' . _('Quantity') . '</th>
+						<th>' . _('Unit') . '</th>
+						<th>' . _('Price') . '</th>
+						<th>' . _('Discount') . '</th>
+						<th>' . _('Net') . '</th></tr>';
 
 					$LineCounter =17;
 					$k=0;	//row colour counter
@@ -891,29 +922,29 @@
 						   } else {
 							    echo '<font color=RED size=4>' . _('TAX CREDIT NOTE') . ' ';
 						   }
-						   echo '</b>' . _('Number') . ' ' . $FromTransNo . '</font><br><font size=1>' . _('GST Number') . ' - ' . $_SESSION['CompanyRecord']['gstno'] . '</td></tr></table>';
+						   echo '</b>' . _('Number') . ' ' . $FromTransNo . '</font><br /><font size=1>' . _('GST Number') . ' - ' . $_SESSION['CompanyRecord']['gstno'] . '</td></tr></table>';
 
 	/*Now print out company name and address */
 						    echo '<table class="table1"><tr>
-						    	<td><font size=4 color="#333"><b>' . $_SESSION['CompanyRecord']['coyname'] . '</b></font><br>';
-						    echo $_SESSION['CompanyRecord']['regoffice1'] . '<br>';
-						    echo $_SESSION['CompanyRecord']['regoffice2'] . '<br>';
-						    echo $_SESSION['CompanyRecord']['regoffice3'] . '<br>';
-						    echo $_SESSION['CompanyRecord']['regoffice4'] . '<br>';
-						    echo $_SESSION['CompanyRecord']['regoffice5'] . '<br>';
-						    echo $_SESSION['CompanyRecord']['regoffice6'] . '<br>';
-						    echo _('Telephone') . ': ' . $_SESSION['CompanyRecord']['telephone'] . '<br>';
-						    echo _('Facsimile') . ': ' . $_SESSION['CompanyRecord']['fax'] . '<br>';
-						    echo _('Email') . ': ' . $_SESSION['CompanyRecord']['email'] . '<br>';
-						    echo '</td><td class=number>' . _('Page') . ": $PageNumber</td></tr></table>";
+						    	<td><font size=4 color="#333"><b>' . $_SESSION['CompanyRecord']['coyname'] . '</b></font><br />';
+						    echo $_SESSION['CompanyRecord']['regoffice1'] . '<br />';
+						    echo $_SESSION['CompanyRecord']['regoffice2'] . '<br />';
+						    echo $_SESSION['CompanyRecord']['regoffice3'] . '<br />';
+						    echo $_SESSION['CompanyRecord']['regoffice4'] . '<br />';
+						    echo $_SESSION['CompanyRecord']['regoffice5'] . '<br />';
+						    echo $_SESSION['CompanyRecord']['regoffice6'] . '<br />';
+						    echo _('Telephone') . ': ' . $_SESSION['CompanyRecord']['telephone'] . '<br />';
+						    echo _('Facsimile') . ': ' . $_SESSION['CompanyRecord']['fax'] . '<br />';
+						    echo _('Email') . ': ' . $_SESSION['CompanyRecord']['email'] . '<br />';
+						    echo '</td><td class=number>' . _('Page') . ': ' .  $PageNumber . '</td></tr></table>';
 						    echo '<table class="table1"><tr>
-						    	<th>' . _('Item Code') . "</th>
-							<th>" . _('Item Description') . "</th>
-							<th>" . _('Quantity') . "</th>
-							<th>" . _('Unit') . "</th>
-							<th>" . _('Price') . "</th>
-							<th>" . _('Discount') . "</th>
-							<th>" . _('Net') . "</th></tr>";
+						    	<th>' . _('Item Code') . '</th>
+							<th>' . _('Item Description') . '</th>
+							<th>' . _('Quantity') . '</th>
+							<th>' . _('Unit') . '</th>
+							<th>' . _('Price') . '</th>
+							<th>' . _('Discount') . '</th>
+							<th>' . _('Net') . '</th></tr>';
 
 						    $LineCounter = 10;
 
@@ -936,28 +967,28 @@
 					} else {
 					      echo '<font color=RED size=4>' . _('TAX CREDIT NOTE') . ' ';
 					}
-					echo '</b>' . _('Number') . ' ' . $FromTransNo . '</font><br><font size=1>' . _('GST Number') . ' - ' . $_SESSION['CompanyRecord']['gstno'] . '</td></tr></table>';
+					echo '</b>' . _('Number') . ' ' . $FromTransNo . '</font><br /><font size=1>' . _('GST Number') . ' - ' . $_SESSION['CompanyRecord']['gstno'] . '</td></tr></table>';
 
 	/*Print out the logo and company name and address */
-					echo '<table class="table1"><tr><td><font size=4 color="#333"><b>' . $_SESSION['CompanyRecord']['coyname'] . '</b></font><br>';
-					echo $_SESSION['CompanyRecord']['regoffice1'] . '<br>';
-					echo $_SESSION['CompanyRecord']['regoffice2'] . '<br>';
-					echo $_SESSION['CompanyRecord']['regoffice3'] . '<br>';
-					echo $_SESSION['CompanyRecord']['regoffice4'] . '<br>';
-					echo $_SESSION['CompanyRecord']['regoffice5'] . '<br>';
-					echo $_SESSION['CompanyRecord']['regoffice6'] . '<br>';
-					echo _('Telephone') . ': ' . $_SESSION['CompanyRecord']['telephone'] . '<br>';
-					echo _('Facsimile') . ': ' . $_SESSION['CompanyRecord']['fax'] . '<br>';
-					echo _('Email') . ': ' . $_SESSION['CompanyRecord']['email'] . '<br>';
+					echo '<table class="table1"><tr><td><font size=4 color="#333"><b>' . $_SESSION['CompanyRecord']['coyname'] . '</b></font><br />';
+					echo $_SESSION['CompanyRecord']['regoffice1'] . '<br />';
+					echo $_SESSION['CompanyRecord']['regoffice2'] . '<br />';
+					echo $_SESSION['CompanyRecord']['regoffice3'] . '<br />';
+					echo $_SESSION['CompanyRecord']['regoffice4'] . '<br />';
+					echo $_SESSION['CompanyRecord']['regoffice5'] . '<br />';
+					echo $_SESSION['CompanyRecord']['regoffice6'] . '<br />';
+					echo _('Telephone') . ': ' . $_SESSION['CompanyRecord']['telephone'] . '<br />';
+					echo _('Facsimile') . ': ' . $_SESSION['CompanyRecord']['fax'] . '<br />';
+					echo _('Email') . ': ' . $_SESSION['CompanyRecord']['email'] . '<br />';
 					echo '</td><td class=number>' . _('Page') . ": $PageNumber</td></tr></table>";
 					echo '<table class="table1"><tr>
-						<th>' . _('Item Code') . "</th>
-						<th>" . _('Item Description') . "</th>
-						<th>" . _('Quantity') . "</th>
-						<th>" . _('Unit') . "</th>
-						<th>" . _('Price') . "</th>
-						<th>" . _('Discount') . "</th>
-						<th>" . _('Net') . '</th></tr></table>';
+						<th>' . _('Item Code') . '</th>
+						<th>' . _('Item Description') . '</th>
+						<th>' . _('Quantity') . '</th>
+						<th>' . _('Unit') . '</th>
+						<th>' . _('Price') . '</th>
+						<th>' . _('Discount') . '</th>
+						<th>' . _('Net') . '</th></tr></table>';
 
 					$LineCounter = 10;
 				}
@@ -988,18 +1019,18 @@
 				}
 	/*Print out the invoice text entered */
 				echo '<table class="table1"><tr>
-					<td class=number>' . _('Sub Total') . "</td>
-					<td class=number bgcolor='#EEEEEE' WIDTH='15%'>$DisplaySubTot</td></tr>";
-				echo '<tr><td class=number>' . _('Freight') . "</td>
-					<td class=number bgcolor='#EEEEEE'>$DisplayFreight</td></tr>";
-				echo '<tr><td class=number>' . _('Tax') . "</td>
-					<td class=number bgcolor='#EEEEEE'>$DisplayTax</td></tr>";
+					<td class="number">' . _('Sub Total') . '</td>
+					<td class="number" bgcolor="#EEEEEE" WIDTH="15%">' . $DisplaySubTot . '</td></tr>';
+				echo '<tr><td class="number">' . _('Freight') . '</td>
+					<td class="number" bgcolor="#EEEEEE">' . $DisplayFreight . '</td></tr>';
+				echo '<tr><td class="number">' . _('Tax') . '</td>
+					<td class="number" bgcolor="#EEEEEE">' . $DisplayTax . '</td></tr>';
 				if ($InvOrCredit=='Invoice'){
-				     echo '<tr><td class=number><b>' . _('TOTAL INVOICE') . "</b></td>
-				     	<td class=number bgcolor='#EEEEEE'><U><b>$DisplayTotal</b></U></td></tr>";
+				     echo '<tr><td class="number"><b>' . _('TOTAL INVOICE') . '</b></td>
+				     	<td class="number" bgcolor="#EEEEEE"><U><b>' . $DisplayTotal . '</b></U></td></tr>';
 				} else {
-				     echo '<tr><td class=number><font color=RED><b>' . _('TOTAL CREDIT') . "</b></font></td>
-				     		<td class=number bgcolor='#EEEEEE'><font color=RED><U><b>$DisplayTotal</b></U></font></td></tr>";
+				     echo '<tr><td class=number><font color=RED><b>' . _('TOTAL CREDIT') . '</b></font></td>
+				     		<td class="number" bgcolor="#EEEEEE"><font color="red"><U><b>' . $DisplayTotal . '</b></u></font></td></tr>';
 				}
 				echo '</table>';
 			} /* end of check to see that there was an invoice record to print */
Modified: trunk/RecurringSalesOrdersProcess.php
===================================================================
--- trunk/RecurringSalesOrdersProcess.php	2011-04-02 01:42:42 UTC (rev 4535)
+++ trunk/RecurringSalesOrdersProcess.php	2011-04-02 09:40:49 UTC (rev 4536)
@@ -85,7 +85,7 @@
 while ($RecurrOrderRow = DB_fetch_array($RecurrOrdersDueResult)){
 
 	$EmailText ='';
-	echo '<br>' . _('Rec...
 
[truncated message content] |