| 
      
      
      From: <dai...@us...> - 2011-03-30 09:06:41
      
     | 
| Revision: 4526
          http://web-erp.svn.sourceforge.net/web-erp/?rev=4526&view=rev
Author:   daintree
Date:     2011-03-30 09:06:33 +0000 (Wed, 30 Mar 2011)
Log Message:
-----------
SQL fixing quotes - not many, fixing gettext a few strings, Tims Reprint GRN
Modified Paths:
--------------
    trunk/EDIMessageFormat.php
    trunk/EDISendInvoices.php
    trunk/FixedAssetCategories.php
    trunk/FixedAssetDepreciation.php
    trunk/FixedAssetItems.php
    trunk/GLAccountCSV.php
    trunk/GLBudgets.php
    trunk/GLCodesInquiry.php
    trunk/GLJournal.php
    trunk/PDFGrn.php
    trunk/doc/Change.log.html
    trunk/includes/ConnectDB.inc
    trunk/index.php
    trunk/sql/mysql/upgrade3.11.1-4.00.sql
Modified: trunk/EDIMessageFormat.php
===================================================================
--- trunk/EDIMessageFormat.php	2011-03-29 13:55:41 UTC (rev 4525)
+++ trunk/EDIMessageFormat.php	2011-03-30 09:06:33 UTC (rev 4526)
@@ -1,9 +1,7 @@
 <?php
-/* $Revision: 1.10 $ */
+
 /* $Id$*/
 
-//$PageSecurity = 10;
-
 include('includes/session.inc');
 $title = _('EDI Message Format');
 include('includes/header.inc');
@@ -92,7 +90,7 @@
 
 	$sql="DELETE FROM edimessageformat WHERE id='" . $_GET['delete']."'";
 	$result = DB_query($sql,$db);
-	$msg='The selected message line has been deleted';
+	$msg=_('The selected message line has been deleted');
 
 }
 if (isset($msg)) {
@@ -174,13 +172,13 @@
 if (isset($SelectedMessageLine)) {
 	//editing an existing message line
 
-	$sql = 'SELECT messagetype,
+	$sql = "SELECT messagetype,
 			partnercode,
 			section,
 			sequenceno,
 			linetext
 		FROM edimessageformat
-		WHERE id=' . $SelectedMessageLine;
+		WHERE id='" . $SelectedMessageLine . "'";
 
 	$result = DB_query($sql, $db);
 	$myrow = DB_fetch_array($result);
@@ -206,25 +204,25 @@
 	echo '<tr><th colspan=2><font size=3>' . _('Definition of') . ' ' . $myrow['messagetype'] . ' ' . _('for') . ' ' . $myrow['partnercode'].'</font></th></tr>';
 }
 
-echo '<tr><td>Section:</td>';
+echo '<tr><td>' . _('Section') . ':</td>';
 echo '<td>';
 echo '<select tabindex=2 name="Section">';
 
 if ($_POST['Section']=='Heading') {
-	echo "<option selected VALUE='Heading'>" . _('Heading');
+	echo "<option selected VALUE='Heading'>" . _('Heading') . '</option>';
 } else {
-	echo "<option value='Heading'>" . _('Heading');
+	echo "<option value='Heading'>" . _('Heading') . '</option>';
 }
 
 if (isset($_POST['Section']) and $_POST['Section']=='Detail') {
-	echo "<option selected VALUE='Detail'>" . _('Detail');
+	echo "<option selected VALUE='Detail'>" . _('Detail') . '</option>';
 } else {
-	echo "<option value='Detail'>" . _('Detail');
+	echo "<option value='Detail'>" . _('Detail') . '</option>';
 }
 if (isset($_POST['Section']) and $_POST['Section']=='Summary') {
-	echo "<option selected VALUE='Summary'>" . _('Summary');
+	echo "<option selected VALUE='Summary'>" . _('Summary') . '</option>';
 } else {
-	echo "<option value='Summary'>" . _('Summary');
+	echo "<option value='Summary'>" . _('Summary') . '</option>';
 }
 
 echo '</select>';
Modified: trunk/EDISendInvoices.php
===================================================================
--- trunk/EDISendInvoices.php	2011-03-29 13:55:41 UTC (rev 4525)
+++ trunk/EDISendInvoices.php	2011-03-30 09:06:33 UTC (rev 4526)
@@ -1,10 +1,7 @@
 <?php
 
-/* $Revision: 1.11 $ */
 /* $Id$*/
 
-//$PageSecurity =15;
-
 include ('includes/session.inc');
 include ('includes/header.inc');
 include('includes/SQL_CommonFunctions.inc'); //need for EDITransNo
@@ -100,7 +97,11 @@
 			then replace variable names with data
 			write the output to a file one line at a time */
 
-		$sql = "SELECT section, linetext FROM edimessageformat WHERE partnercode='" . $CustDetails['debtorno'] . "' AND messagetype='INVOIC' ORDER BY sequenceno";
+		$sql = "SELECT section, 
+                       linetext 
+                FROM edimessageformat 
+                WHERE partnercode='" . $CustDetails['debtorno'] . "' 
+                AND messagetype='INVOIC' ORDER BY sequenceno";
 		$ErrMsg =  _('An error occurred in getting the EDI format template for') . ' ' . $CustDetails['debtorno'] . ' ' . _('because');
 		$MessageLinesResult = DB_query($sql, $db,$ErrMsg);
 
@@ -145,7 +146,7 @@
 								stockmaster
 							WHERE stockmoves.stockid = stockmaster.stockid
 							AND stockmoves.type=10
-							AND stockmoves.transno=" . $TransNo . "
+							AND stockmoves.transno='" . $TransNo . "'
 							AND stockmoves.show_on_inv_crds=1";
 					} else {
 					/* credit note */
@@ -160,7 +161,7 @@
 							FROM stockmoves,
 								stockmaster
 							WHERE stockmoves.stockid = stockmaster.stockid
-							AND stockmoves.type=11 and stockmoves.transno=" . $TransNo . "
+							AND stockmoves.type=11 and stockmoves.transno='" . $TransNo . "'
 							AND stockmoves.show_on_inv_crds=1";
 					}
 					$TransLinesResult = DB_query($sql,$db);
@@ -218,10 +219,10 @@
 				$MessageSent = $mail->send(array($CustDetails['ediaddress']));
 
 				if ($MessageSent==True){
-					echo '<br><br>';
+					echo '<br /><br />';
 					prnMsg(_('EDI Message') . ' ' . $EDITransNo . ' ' . _('was successfully emailed'),'success');
 				} else {
-					echo '<br><br>';
+					echo '<br /><br />';
 					prnMsg(_('EDI Message') . ' ' . $EDITransNo . _('could not be emailed to') . ' ' . $CustDetails['ediaddress'],'error');
 				}
 			} else { /*it must be ftp transport */
@@ -230,16 +231,16 @@
 				$conn_id = ftp_connect($CustDetails['ediaddress']); // login with username and password
 				$login_result = ftp_login($conn_id, $CustDetails['ediserveruser'], $CustDetails['ediserverpwd']); // check connection
 				if ((!$conn_id) || (!$login_result)) {
-					prnMsg( _('Ftp connection has failed'). '<br>' . _('Attempted to connect to') . ' ' . $CustDetails['ediaddress'] . ' ' ._('for user') . ' ' . $CustDetails['ediserveruser'],'error');
+					prnMsg( _('Ftp connection has failed'). '<br />' . _('Attempted to connect to') . ' ' . $CustDetails['ediaddress'] . ' ' ._('for user') . ' ' . $CustDetails['ediserveruser'],'error');
 					include('includes/footer.inc');
 					exit;
 				}
 				$MessageSent = ftp_put($conn_id, $_SESSION['EDI_MsgPending'] . '/EDI_INV_' . $EDITransNo, 'EDI_INV_' . $EDITransNo, FTP_ASCII); // check upload status
 				if (!$MessageSent) {
-					echo '<br><br>';
+					echo '<br /><br />';
 					prnMsg(_('EDI Message') . ' ' . $EDITransNo . ' ' . _('could not be sent via ftp to') .' ' . $CustDetails['ediaddress'],'error');
 		 		} else {
-					echo '<br><br>';
+					echo '<br /><br />';
 					prnMsg( _('Successfully uploaded EDI_INV_') . $EDITransNo . ' ' . _('via ftp to') . ' ' . $CustDetails['ediaddress'],'success');
 				} // close the FTP stream
 				ftp_quit($conn_id);
Modified: trunk/FixedAssetCategories.php
===================================================================
--- trunk/FixedAssetCategories.php	2011-03-29 13:55:41 UTC (rev 4525)
+++ trunk/FixedAssetCategories.php	2011-03-30 09:06:33 UTC (rev 4526)
@@ -1,7 +1,6 @@
 <?php
-/* $Revision: 1.1 $ */
 
-//$PageSecurity = 11;
+/* $Id$*/
 
 include('includes/session.inc');
 
@@ -93,18 +92,18 @@
 	} elseif ($InputError !=1) {
 
 		$sql = "INSERT INTO fixedassetcategories (categoryid,
-																					categorydescription,
-																					costact,
-																					depnact,
-																					disposalact,
-																					accumdepnact)
-																					VALUES (
-																					'" . $_POST['CategoryID'] . "',
-																					'" . $_POST['CategoryDescription'] . "',
-																					'" . $_POST['CostAct'] . "',
-																					'" . $_POST['DepnAct'] . "',
-																					'" . $_POST['DisposalAct'] . "',
-																					'" . $_POST['AccumDepnAct'] . "')";
+											categorydescription,
+											costact,
+											depnact,
+											disposalact,
+											accumdepnact)
+											VALUES (
+											'" . $_POST['CategoryID'] . "',
+											'" . $_POST['CategoryDescription'] . "',
+											'" . $_POST['CostAct'] . "',
+											'" . $_POST['DepnAct'] . "',
+											'" . $_POST['DisposalAct'] . "',
+											'" . $_POST['AccumDepnAct'] . "')";
 		$ErrMsg = _('Could not insert the new fixed asset category') . $_POST['CategoryDescription'] . _('because');
 		$result = DB_query($sql,$db,$ErrMsg);
 		prnMsg(_('A new fixed asset category record has been added for') . ' ' . $_POST['CategoryDescription'],'success');
@@ -129,7 +128,7 @@
 	$myrow = DB_fetch_row($result);
 	if ($myrow[0]>0) {
 		prnMsg(_('Cannot delete this fixed asset category because fixed assets have been created using this category') .
-			'<br> ' . _('There are') . ' ' . $myrow[0] . ' ' . _('fixed assets referring to this category code'),'warn');
+			'<br /> ' . _('There are') . ' ' . $myrow[0] . ' ' . _('fixed assets referring to this category code'),'warn');
 
 	} else {
 		$sql="DELETE FROM fixedassetcategories WHERE categoryid='" . $SelectedCategory . "'";
@@ -147,15 +146,15 @@
 or deletion of the records*/
 
 	$sql = 'SELECT categoryid,
-								categorydescription,
-								costact,
-								depnact,
-								disposalact,
-								accumdepnact
-								FROM fixedassetcategories';
+				categorydescription,
+				costact,
+				depnact,
+				disposalact,
+				accumdepnact
+				FROM fixedassetcategories';
 	$result = DB_query($sql,$db);
 
-	echo "<br><table class=selection>\n";
+	echo "<br /><table class=selection>\n";
 	echo '<tr><th>' . _('Cat Code') . '</th>
 			<th>' . _('Description') . '</th>
 			<th>' . _('Cost GL') . '</th>
@@ -200,7 +199,7 @@
 //end of ifs and buts!
 
 if (isset($SelectedCategory)) {
-	echo "<br><div class='centre'><a href='" . $_SERVER['PHP_SELF'] . '?' . SID . ">" ._('Show All Fixed Asset Categories') . "</a></div>";
+	echo "<br /><div class='centre'><a href='" . $_SERVER['PHP_SELF'] . '?' . SID . ">" ._('Show All Fixed Asset Categories') . "</a></div>";
 }
 
 echo '<form name="CategoryForm" method="post" action="' . $_SERVER['PHP_SELF'] . '?' . SID . '">';
@@ -240,23 +239,23 @@
 }
 
 //SQL to poulate account selection boxes
-$sql = "SELECT accountcode,
+$sql = 'SELECT accountcode,
 				 accountname
 				 FROM chartmaster,
 					  accountgroups
 				 WHERE chartmaster.group_=accountgroups.groupname and
 					   accountgroups.pandl=0
-				 ORDER BY accountcode";
+				 ORDER BY accountcode';
 
 $BSAccountsResult = DB_query($sql,$db);
 
-$sql = "SELECT accountcode,
+$sql = 'SELECT accountcode,
 				 accountname
 				 FROM chartmaster,
 					  accountgroups
 				 WHERE chartmaster.group_=accountgroups.groupname and
 					   accountgroups.pandl!=0
-				 ORDER BY accountcode";
+				 ORDER BY accountcode';
 
 $PnLAccountsResult = DB_query($sql,$db);
 
@@ -323,7 +322,7 @@
 } //end while loop
 
 
-echo '</select></td></tr></table><br>';
+echo '</select></td></tr></table><br />';
 
 echo '<div class="centre"><input type="Submit" name="submit" value="' . _('Enter Information') . '"></div>';
 
Modified: trunk/FixedAssetDepreciation.php
===================================================================
--- trunk/FixedAssetDepreciation.php	2011-03-29 13:55:41 UTC (rev 4525)
+++ trunk/FixedAssetDepreciation.php	2011-03-30 09:06:33 UTC (rev 4526)
@@ -1,8 +1,6 @@
 <?php
-
 /* $Id: FixedAssetDepreciation.php 4213 2010-12-22 14:33:20Z tim_schofield $*/
 
-//$PageSecurity = 10; Now from DB
 include('includes/session.inc');
 $title = _('Depreciation Journal Entry');
 
@@ -12,12 +10,12 @@
 
 /*Get the last period depreciation (depn is transtype =44) was posted for */
 $result = DB_query('SELECT periods.lastdate_in_period,
-											max(fixedassettrans.periodno)
-									FROM fixedassettrans INNER JOIN periods
-									ON fixedassettrans.periodno=periods.periodno
-									WHERE transtype=44
-									GROUP BY periods.lastdate_in_period
-									ORDER BY periods.lastdate_in_period DESC',$db);
+							max(fixedassettrans.periodno)
+					FROM fixedassettrans INNER JOIN periods
+					ON fixedassettrans.periodno=periods.periodno
+					WHERE transtype=44
+					GROUP BY periods.lastdate_in_period
+					ORDER BY periods.lastdate_in_period DESC',$db);
 
 $LastDepnRun = DB_fetch_row($result);
 
@@ -44,30 +42,30 @@
 
 /* Get list of assets for journal */
 $sql="SELECT fixedassets.assetid,
-						fixedassets.description,
-						fixedassets.depntype,
-						fixedassets.depnrate,
-						fixedassets.datepurchased,
-						fixedassetcategories.accumdepnact,
-						fixedassetcategories.depnact,
-						fixedassetcategories.categorydescription,
-						SUM(CASE WHEN fixedassettrans.fixedassettranstype='cost' THEN fixedassettrans.amount ELSE 0 END) AS costtotal,
-						SUM(CASE WHEN fixedassettrans.fixedassettranstype='depn' THEN fixedassettrans.amount ELSE 0 END) AS depnbfwd
-			FROM fixedassets
-			INNER JOIN fixedassetcategories
-				ON fixedassets.assetcategoryid=fixedassetcategories.categoryid
-			INNER JOIN fixedassettrans
-				ON fixedassets.assetid=fixedassettrans.assetid
-			WHERE fixedassettrans.transdate<='" . FormatDateForSQL($_POST['ProcessDate']) . "'
-			GROUP BY fixedassets.assetid,
-						fixedassets.description,
-						fixedassets.depntype,
-						fixedassets.depnrate,
-						fixedassets.datepurchased,
-						fixedassetcategories.accumdepnact,
-						fixedassetcategories.depnact,
-						fixedassetcategories.categorydescription
-			ORDER BY assetcategoryid, assetid";
+			fixedassets.description,
+			fixedassets.depntype,
+			fixedassets.depnrate,
+			fixedassets.datepurchased,
+			fixedassetcategories.accumdepnact,
+			fixedassetcategories.depnact,
+			fixedassetcategories.categorydescription,
+			SUM(CASE WHEN fixedassettrans.fixedassettranstype='cost' THEN fixedassettrans.amount ELSE 0 END) AS costtotal,
+			SUM(CASE WHEN fixedassettrans.fixedassettranstype='depn' THEN fixedassettrans.amount ELSE 0 END) AS depnbfwd
+		FROM fixedassets
+		INNER JOIN fixedassetcategories
+			ON fixedassets.assetcategoryid=fixedassetcategories.categoryid
+		INNER JOIN fixedassettrans
+			ON fixedassets.assetid=fixedassettrans.assetid
+		WHERE fixedassettrans.transdate<='" . FormatDateForSQL($_POST['ProcessDate']) . "'
+		GROUP BY fixedassets.assetid,
+			fixedassets.description,
+			fixedassets.depntype,
+			fixedassets.depnrate,
+			fixedassets.datepurchased,
+			fixedassetcategories.accumdepnact,
+			fixedassetcategories.depnact,
+			fixedassetcategories.categorydescription
+ORDER BY assetcategoryid, assetid";
 $AssetsResult=DB_query($sql, $db);
 
 $InputError = false; //always hope for the best
@@ -83,15 +81,15 @@
 
 echo '<p></p><table>';
 $Heading = '<tr><th>' . _('Asset ID') . '</th>
-								<th>' . _('Description') . '</th>
-								<th>' . _('Date Purchased') . '</th>
-								<th>' . _('Cost') . '</th>
-								<th>' . _('Accum Depn') . '</th>
-								<th>' . _('B/fwd Book Value') . '</th>
-								<th>'. _('Depn Type') . '</th>
-								<th>'. _('Depn Rate') . '</th>
-								<th>' . _('New Depn') . '</th>
-							</tr>';
+				<th>' . _('Description') . '</th>
+				<th>' . _('Date Purchased') . '</th>
+				<th>' . _('Cost') . '</th>
+				<th>' . _('Accum Depn') . '</th>
+				<th>' . _('B/fwd Book Value') . '</th>
+				<th>'. _('Depn Type') . '</th>
+				<th>'. _('Depn Rate') . '</th>
+				<th>' . _('New Depn') . '</th>
+			</tr>';
 echo $Heading;
 
 $AssetCategoryDescription ='0';
@@ -106,12 +104,12 @@
 	if ($AssetCategoryDescription != $AssetRow['categorydescription'] OR $AssetCategoryDescription =='0'){
 		if ($AssetCategoryDescription !='0'){ //then print totals
 			echo '<tr><th colspan=3 align="right">' . _('Total for') . ' ' . $AssetCategoryDescription . ' </th>
-								<th class="number">' . number_format($TotalCategoryCost,2) . '</th>
-								<th class="number">' . number_format($TotalCategoryAccumDepn,2) . '</th>
-								<th class="number">' . number_format(($TotalCategoryCost-$TotalCategoryAccumDepn),2) . '</th>
-								<th colspan=2></th>
-								<th class="number">' . number_format($TotalCategoryDepn,2) . '</th>
-								</tr>';
+					<th class="number">' . number_format($TotalCategoryCost,2) . '</th>
+					<th class="number">' . number_format($TotalCategoryAccumDepn,2) . '</th>
+					<th class="number">' . number_format(($TotalCategoryCost-$TotalCategoryAccumDepn),2) . '</th>
+					<th colspan=2></th>
+					<th class="number">' . number_format($TotalCategoryDepn,2) . '</th>
+					</tr>';
 		}
 		echo '<tr><th colspan=9 align="left">' . $AssetRow['categorydescription']  . '</th></tr>';
 		$AssetCategoryDescription = $AssetRow['categorydescription'];
@@ -147,15 +145,15 @@
 		$k++;
 	}
 	echo '<td>' . $AssetRow['assetid'] . '</td>
-				<td>' . $AssetRow['description'] . '</td>
-				<td>' . ConvertSQLDate($AssetRow['datepurchased']) . '</td>
-				<td class="number">' . number_format($AssetRow['costtotal'],2) . '</td>
-				<td class="number">' . number_format($AssetRow['depnbfwd'],2) . '</td>
-				<td class="number">' . number_format($AssetRow['costtotal']-$AssetRow['depnbfwd'],2) . '</td>
-				<td align="center">' . $DepreciationType . '</td>
-				<td class="number">' . $AssetRow['depnrate']  . '</td>
-				<td class="number">' . number_format($NewDepreciation ,2) . '</td>
-			</tr>';
+		<td>' . $AssetRow['description'] . '</td>
+		<td>' . ConvertSQLDate($AssetRow['datepurchased']) . '</td>
+		<td class="number">' . number_format($AssetRow['costtotal'],2) . '</td>
+		<td class="number">' . number_format($AssetRow['depnbfwd'],2) . '</td>
+		<td class="number">' . number_format($AssetRow['costtotal']-$AssetRow['depnbfwd'],2) . '</td>
+		<td align="center">' . $DepreciationType . '</td>
+		<td class="number">' . $AssetRow['depnrate']  . '</td>
+		<td class="number">' . number_format($NewDepreciation ,2) . '</td>
+	</tr>';
 	$TotalCategoryCost +=$AssetRow['costtotal'];
 	$TotalCategoryAccumDepn +=$AssetRow['depnbfwd'];
 	$TotalCategoryDepn +=$NewDepreciation;
@@ -167,62 +165,62 @@
 
 		//debit depreciation expense
 		$SQL = "INSERT INTO gltrans (type,
-																typeno,
-																trandate,
-																periodno,
-																account,
-																narrative,
-																amount)
-												VALUES (44,
-															'" . $TransNo . "',
-															'" . FormatDateForSQL($_POST['ProcessDate']) . "',
-															'" . $PeriodNo . "',
-															'" . $AssetRow['depnact'] . "',
-															'" . $AssetRow['assetid'] . "',
-															'" . $NewDepreciation ."')";
+									typeno,
+									trandate,
+									periodno,
+									account,
+									narrative,
+									amount)
+						VALUES (44,
+								'" . $TransNo . "',
+								'" . FormatDateForSQL($_POST['ProcessDate']) . "',
+								'" . $PeriodNo . "',
+								'" . $AssetRow['depnact'] . "',
+								'" . $AssetRow['assetid'] . "',
+								'" . $NewDepreciation ."')";
 		$ErrMsg = _('Cannot insert a depreciation GL entry for the depreciation because');
 		$DbgMsg = _('The SQL that failed to insert the GL Trans record was');
 		$result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true);
 		$SQL = "INSERT INTO gltrans (type,
-																typeno,
-																trandate,
-																periodno,
-																account,
-																narrative,
-																amount)
-												VALUES (44,
-															'" . $TransNo . "',
-															'" . FormatDateForSQL($_POST['ProcessDate']) . "',
-															'" . $PeriodNo . "',
-															'" . $AssetRow['accumdepnact'] . "',
-															'" . $AssetRow['assetid'] . "',
-															'" . -$NewDepreciation ."')";
+									typeno,
+									trandate,
+									periodno,
+									account,
+									narrative,
+									amount)
+						VALUES (44,
+								'" . $TransNo . "',
+								'" . FormatDateForSQL($_POST['ProcessDate']) . "',
+								'" . $PeriodNo . "',
+								'" . $AssetRow['accumdepnact'] . "',
+								'" . $AssetRow['assetid'] . "',
+								'" . -$NewDepreciation ."')";
 		$result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true);
 
 		//insert the fixedassettrans record
 		$SQL = "INSERT INTO fixedassettrans (assetid,
-																			transtype,
-																			transno,
-																			transdate,
-																			periodno,
-																			inputdate,
-																			fixedassettranstype,
-																			amount)
-															VALUES ('" . $AssetRow['assetid'] . "',
-																			'44',
-																			'" . $TransNo . "',
-																			'" . FormatDateForSQL($_POST['ProcessDate']) . "',
-																			'" . $PeriodNo . "',
-																			'" . Date('Y-m-d') . "',
-																			'depn',
-																			'" . $NewDepreciation . "')";
+											transtype,
+											transno,
+											transdate,
+											periodno,
+											inputdate,
+											fixedassettranstype,
+											amount)
+							VALUES ('" . $AssetRow['assetid'] . "',
+											'44',
+											'" . $TransNo . "',
+											'" . FormatDateForSQL($_POST['ProcessDate']) . "',
+											'" . $PeriodNo . "',
+											'" . Date('Y-m-d') . "',
+											'depn',
+											'" . $NewDepreciation . "')";
 		$ErrMsg = _('Cannot insert a fixed asset transaction entry for the depreciation because');
 		$DbgMsg = _('The SQL that failed to insert the fixed asset transaction record was');
 		$result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true);
 
 		/*now update the accum depn in fixedassets */
 		$SQL = "UPDATE fixedassets SET accumdepn = accumdepn + " . $NewDepreciation  . "
-												WHERE assetid = '" . $AssetRow['assetid'] . "'";
+				WHERE assetid = '" . $AssetRow['assetid'] . "'";
 		$ErrMsg = _('CRITICAL ERROR! NOTE DOWN THIS ERROR AND SEEK ASSISTANCE. The fixed asset accumulated depreciation could not be updated:');
 		$DbgMsg = _('The following SQL was used to attempt the update the accumulated depreciation of the asset was:');
 		$Result = DB_query($SQL,$db,$ErrMsg, $DbgMsg, true);
@@ -249,7 +247,7 @@
 	$result = DB_Txn_Commit($db);
 	prnMsg(_('Depreciation') . ' ' . $TransNo . ' ' . _('has been successfully entered'),'success');
 	unset($_POST['ProcessDate']);
-	echo '<br><a href="index.php' . '?' . SID . '">' ._('Return to main menu').'</a>';
+	echo '<br /><a href="index.php' . '?' . SID . '">' ._('Return to main menu').'</a>';
 	/*And post the journal too */
 	include ('includes/GLPostings.inc');
 } else {
@@ -265,7 +263,7 @@
 					<td>' . $_POST['ProcessDate'] .'</td>';
 	}
 	echo '<td><div class="centre"><input type="submit" name="CommitDepreciation" value="'._('Commit Depreciation').'"></div>';
-	echo '</tr></table><br>';
+	echo '</tr></table><br />';
 	echo '</form>';
 }
 include('includes/footer.inc');
Modified: trunk/FixedAssetItems.php
===================================================================
--- trunk/FixedAssetItems.php	2011-03-29 13:55:41 UTC (rev 4525)
+++ trunk/FixedAssetItems.php	2011-03-30 09:06:33 UTC (rev 4526)
@@ -1,16 +1,13 @@
 <?php
 
 /* $Id$ */
-/* $Revision: 1.3 $ */
 
-//$PageSecurity = 11;
-
 include('includes/session.inc');
 $title = _('Fixed Assets');
 include('includes/header.inc');
 include('includes/SQL_CommonFunctions.inc');
 
-echo '<a href="' . $rootpath . '/SelectAsset.php?' . SID . '">' . _('Back to Select') . '</a><br>' . "\n";
+echo '<a href="' . $rootpath . '/SelectAsset.php">' . _('Back to Select') . '</a><br />' . "\n";
 
 echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/money_add.png" title="' .
 		_('Fixed Asset Items') . '" alt="" />' . ' ' . $title . '</p>';
@@ -132,7 +129,10 @@
 
 				$PeriodNo = GetPeriod(Date($_SESSION['DefaultDateFormat']),$db);
 				/* Get the new account codes for the new asset category */
-				$result = DB_query("SELECT costact, accumdepnact FROM fixedassetcategories WHERE categoryid='" . $_POST['AssetCategoryID'] . "'",$db);
+				$result = DB_query("SELECT costact, 
+										accumdepnact 
+									FROM fixedassetcategories 
+									WHERE categoryid='" . $_POST['AssetCategoryID'] . "'",$db);
 				$NewAccounts = DB_fetch_array($result);
 
 				$TransNo = GetNextTransNo( 42, $db); /* transaction type is asset category change */
@@ -144,75 +144,75 @@
 								periodno,
 								account,
 								narrative,
-								amount) ";
-				$SQL= $SQL . "VALUES (42,
-							'" . $TransNo . "',
-							'" . Date('Y-m-d') . "',
-							'" . $PeriodNo . "',
-							'" . $OldDetails['costact'] . "',
-							'" . $AssetID . ' ' . _('change category') . ' ' . $OldDetails['assetcategoryid'] . ' - ' . $_POST['AssetCategoryID'] . "',
-							'" . -$OldDetails['cost']. "'
-							)";
+								amount) 
+						VALUES ('42',
+								'" . $TransNo . "',
+								'" . Date('Y-m-d') . "',
+								'" . $PeriodNo . "',
+								'" . $OldDetails['costact'] . "',
+								'" . $AssetID . ' ' . _('change category') . ' ' . $OldDetails['assetcategoryid'] . ' - ' . $_POST['AssetCategoryID'] . "',
+								'" . -$OldDetails['cost']. "'
+								)";
 				$ErrMsg = _('Cannot insert a GL entry for the change of asset category because');
 				$DbgMsg = _('The SQL that failed to insert the cost GL Trans record was');
 				$result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true);
 
 				//debit cost for the new category
 				$SQL = "INSERT INTO gltrans (type,
-																	typeno,
-																	trandate,
-																	periodno,
-																	account,
-																	narrative,
-																	amount) ";
-				$SQL= $SQL . "VALUES (42,
-							'" . $TransNo . "',
-							'" . Date('Y-m-d') . "',
-							'" . $PeriodNo . "',
-							'" . $NewAccounts['costact'] . "',
-							'" . $AssetID . ' ' . _('change category') . ' ' . $OldDetails['assetcategoryid'] . ' - ' . $_POST['AssetCategoryID'] . "',
-							'" . $OldDetails['cost']. "'
-							)";
+										typeno,
+										trandate,
+										periodno,
+										account,
+										narrative,
+										amount) 
+							VALUES ('42',
+									'" . $TransNo . "',
+									'" . Date('Y-m-d') . "',
+									'" . $PeriodNo . "',
+									'" . $NewAccounts['costact'] . "',
+									'" . $AssetID . ' ' . _('change category') . ' ' . $OldDetails['assetcategoryid'] . ' - ' . $_POST['AssetCategoryID'] . "',
+									'" . $OldDetails['cost']. "'
+									)";
 				$ErrMsg = _('Cannot insert a GL entry for the change of asset category because');
 				$DbgMsg = _('The SQL that failed to insert the cost GL Trans record was');
 				$result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true);
 				if ($OldDetails['accumdepn']!=0) {
 					//debit accumdepn for the old category
 					$SQL = "INSERT INTO gltrans (type,
-									typeno,
-									trandate,
-									periodno,
-									account,
-									narrative,
-									amount) ";
-					$SQL= $SQL . "VALUES (42,
-								'" . $TransNo . "',
-								'" . Date('Y-m-d') . "',
-								'" . $PeriodNo . "',
-								'" . $OldDetails['accumdepnact'] . "',
-								'" . $AssetID . ' ' . _('change category') . ' ' . $OldDetails['assetcategoryid'] . ' - ' . $_POST['AssetCategoryID'] . "',
-								'" . $OldDetails['accumdepn']. "'
-								)";
+												typeno,
+												trandate,
+												periodno,
+												account,
+												narrative,
+												amount)
+									VALUES ('42',
+											'" . $TransNo . "',
+											'" . Date('Y-m-d') . "',
+											'" . $PeriodNo . "',
+											'" . $OldDetails['accumdepnact'] . "',
+											'" . $AssetID . ' ' . _('change category') . ' ' . $OldDetails['assetcategoryid'] . ' - ' . $_POST['AssetCategoryID'] . "',
+											'" . $OldDetails['accumdepn']. "'
+											)";
 					$ErrMsg = _('Cannot insert a GL entry for the change of asset category because');
 					$DbgMsg = _('The SQL that failed to insert the cost GL Trans record was');
 					$result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true);
 
 					//credit accum depn for the new category
 					$SQL = "INSERT INTO gltrans (type,
-									typeno,
-									trandate,
-									periodno,
-									account,
-									narrative,
-									amount) ";
-					$SQL= $SQL . "VALUES (42,
-								'" . $TransNo . "',
-								'" . Date('Y-m-d') . "',
-								'" . $PeriodNo . "',
-								'" . $NewAccounts['accumdepnact'] . "',
-								'" . $AssetID . ' ' . _('change category') . ' ' . $OldDetails['assetcategoryid'] . ' - ' . $_POST['AssetCategoryID'] . "',
-								'" . $OldDetails['accumdepn']. "'
-								)";
+												typeno,
+												trandate,
+												periodno,
+												account,
+												narrative,
+												amount) 
+									VALUES ('42',
+											'" . $TransNo . "',
+											'" . Date('Y-m-d') . "',
+											'" . $PeriodNo . "',
+											'" . $NewAccounts['accumdepnact'] . "',
+											'" . $AssetID . ' ' . _('change category') . ' ' . $OldDetails['assetcategoryid'] . ' - ' . $_POST['AssetCategoryID'] . "',
+											'" . $OldDetails['accumdepn']. "'
+											)";
 					$ErrMsg = _('Cannot insert a GL entry for the change of asset category because');
 					$DbgMsg = _('The SQL that failed to insert the cost GL Trans record was');
 					$result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true);
@@ -234,25 +234,25 @@
 			$result = DB_query($sql,$db,$ErrMsg,$DbgMsg);
 
 			prnMsg( _('Asset') . ' ' . $AssetID . ' ' . _('has been updated'), 'success');
-			echo '<br>';
+			echo '<br />';
 		} else { //it is a NEW part
 			$sql = "INSERT INTO fixedassets (description,
-																		longdescription,
-																		assetcategoryid,
-																		assetlocation,
-																		depntype,
-																		depnrate,
-																		barcode,
-																		serialno)
-																	VALUES (
-																		'" . $_POST['Description'] . "',
-																		'" . $_POST['LongDescription'] . "',
-																		'" . $_POST['AssetCategoryID'] . "',
-																		'" . $_POST['AssetLocation'] . "',
-																		'" . $_POST['DepnType'] . "',
-																		'" . $_POST['DepnRate']. "',
-																		'" . $_POST['BarCode'] . "',
-																		'" . $_POST['SerialNo'] . "' )";
+											longdescription,
+											assetcategoryid,
+											assetlocation,
+											depntype,
+											depnrate,
+											barcode,
+											serialno)
+										VALUES (
+											'" . $_POST['Description'] . "',
+											'" . $_POST['LongDescription'] . "',
+											'" . $_POST['AssetCategoryID'] . "',
+											'" . $_POST['AssetLocation'] . "',
+											'" . $_POST['DepnType'] . "',
+											'" . $_POST['DepnRate']. "',
+											'" . $_POST['BarCode'] . "',
+											'" . $_POST['SerialNo'] . "' )";
 			$ErrMsg =  _('The asset could not be added because');
 			$DbgMsg = _('The SQL that was used to add the asset failed was');
 			$result = DB_query($sql,$db, $ErrMsg, $DbgMsg);
@@ -272,7 +272,7 @@
 			$result = DB_Txn_Commit($db);
 		}
 	} else {
-		echo '<br>'. "\n";
+		echo '<br />'. "\n";
 		prnMsg( _('Validation failed, no updates or deletes took place'), 'error');
 	}
 
@@ -282,12 +282,12 @@
 	$CancelDelete = 0;
 	//what validation is required before allowing deletion of assets ....  maybe there should be no deletion option?
 	$result = DB_query("SELECT cost,
-														accumdepn,
-														accumdepnact,
-														costact
-											FROM fixedassets INNER JOIN fixedassetcategories
-											ON fixedassets.assetcategoryid=fixedassetcategories.categoryid
-											WHERE assetid='" . $AssetID . "'", $db);
+								accumdepn,
+								accumdepnact,
+								costact
+						FROM fixedassets INNER JOIN fixedassetcategories
+						ON fixedassets.assetcategoryid=fixedassetcategories.categoryid
+						WHERE assetid='" . $AssetID . "'", $db);
 	$AssetRow = DB_fetch_array($result);
 	$NBV = $AssetRow['cost'] -$AssetRow['accumdepn'];
 	if ($NBV!=0) {
@@ -313,40 +313,40 @@
 		if ($AssetRow['cost'] > 0){
 			//credit cost for the asset deleted
 			$SQL = "INSERT INTO gltrans (type,
-																typeno,
-																trandate,
-																periodno,
-																account,
-																narrative,
-																amount) ";
-												$SQL= $SQL . "VALUES (43,
-															'" . $TransNo . "',
-															'" . Date('Y-m-d') . "',
-															'" . $PeriodNo . "',
-															'" . $AssetRow['costact'] . "',
-															'" . _('Delete asset') . ' ' . $AssetID . "',
-															'" . -$AssetRow['cost']. "'
-															)";
+										typeno,
+										trandate,
+										periodno,
+										account,
+										narrative,
+										amount) 
+							VALUES ('43',
+									'" . $TransNo . "',
+									'" . Date('Y-m-d') . "',
+									'" . $PeriodNo . "',
+									'" . $AssetRow['costact'] . "',
+									'" . _('Delete asset') . ' ' . $AssetID . "',
+									'" . -$AssetRow['cost']. "'
+									)";
 			$ErrMsg = _('Cannot insert a GL entry for the deletion of the asset because');
 			$DbgMsg = _('The SQL that failed to insert the cost GL Trans record was');
 			$result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true);
 
 			//debit accumdepn for the depreciation removed on deletion of this asset
 			$SQL = "INSERT INTO gltrans (type,
-																typeno,
-																trandate,
-																periodno,
-																account,
-																narrative,
-																amount) ";
-												$SQL= $SQL . "VALUES (43,
-															'" . $TransNo . "',
-															'" . Date('Y-m-d') . "',
-															'" . $PeriodNo . "',
-															'" . $AssetRow['accumdepnact'] . "',
-															'" . _('Delete asset') . ' ' . $AssetID . "',
-															'" . $Asset['accumdepn']. "'
-															)";
+										typeno,
+										trandate,
+										periodno,
+										account,
+										narrative,
+										amount) 
+								VALUES ('43',
+									'" . $TransNo . "',
+									'" . Date('Y-m-d') . "',
+									'" . $PeriodNo . "',
+									'" . $AssetRow['accumdepnact'] . "',
+									'" . _('Delete asset') . ' ' . $AssetID . "',
+									'" . $Asset['accumdepn']. "'
+									)";
 			$ErrMsg = _('Cannot insert a GL entry for the reversal of accumulated depreciation on deletion of the asset because');
 			$DbgMsg = _('The SQL that failed to insert the cost GL Trans record was');
 			$result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true);
@@ -467,7 +467,7 @@
 	}
 
 	if ($AssetImgLink!=_('No Image')) {
-		echo '<td>' . _('Image') . '<br>'.$AssetImgLink . '</td></tr>';
+		echo '<td>' . _('Image') . '<br />'.$AssetImgLink . '</td></tr>';
 	} else {
 		echo '</td></tr>';
 	}
@@ -484,13 +484,13 @@
 
 while ($myrow=DB_fetch_array($result)){
 	if (!isset($_POST['AssetCategoryID']) or $myrow['categoryid']==$_POST['AssetCategoryID']){
-		echo '<option selected VALUE="'. $myrow['categoryid'] . '">' . $myrow['categorydescription'];
+		echo '<option selected VALUE="'. $myrow['categoryid'] . '">' . $myrow['categorydescription'] . '</option>';
 	} else {
-		echo '<option VALUE="'. $myrow['categoryid'] . '">' . $myrow['categorydescription'];
+		echo '<option VALUE="'. $myrow['categoryid'] . '">' . $myrow['categorydescription']. '</option>';
 	}
 	$category=$myrow['categoryid'];
 }
-echo '</select><a target="_blank" href="'. $rootpath . '/FixedAssetCategories.php?' . SID . '">'.' ' . _('Add or Modify Asset Categories') . '</a></td></tr>';
+echo '</select><a target="_blank" href="'. $rootpath . '/FixedAssetCategories.php">'.' ' . _('Add or Modify Asset Categories') . '</a></td></tr>';
 if (!isset($_POST['AssetCategoryID'])) {
 	$_POST['AssetCategoryID']=$category;
 }
@@ -545,12 +545,12 @@
 echo '<tr><td>' . _('Net Book Value') . ':</td><td class="number">' . number_format($AssetRow['cost']-$AssetRow['accumdepn'],2) . '</td></tr>';
 
 $result = DB_query('SELECT periods.lastdate_in_period, 
-												max(fixedassettrans.periodno) 
-									FROM fixedassettrans INNER JOIN periods 
-									ON fixedassettrans.periodno=periods.periodno 
-									WHERE transtype=44 
-									GROUP BY periods.lastdate_in_period
-									ORDER BY periods.lastdate_in_period DESC',$db);
+								max(fixedassettrans.periodno) 
+					FROM fixedassettrans INNER JOIN periods 
+					ON fixedassettrans.periodno=periods.periodno 
+					WHERE transtype=44 
+					GROUP BY periods.lastdate_in_period
+					ORDER BY periods.lastdate_in_period DESC',$db);
 									
 $LastDepnRun = DB_fetch_row($result);
 if(DB_num_rows($result)==0){
@@ -563,13 +563,13 @@
 
 
 if (isset($New)) {
-	echo '<div class=centre><br><input type="Submit" name="submit" value="' . _('Insert New Fixed Asset') . '">';
+	echo '<div class=centre><br /><input type="Submit" name="submit" value="' . _('Insert New Fixed Asset') . '">';
 
 } else {
 
-	echo '<br><div class=centre><input type="submit" name="submit" value="' . _('Update') . '"></div>';
+	echo '<br /><div class=centre><input type="submit" name="submit" value="' . _('Update') . '"></div>';
 	prnMsg( _('Only click the Delete button if you are sure you wish to delete the asset. Only assets with a zero book value can be deleted'), 'warn', _('WARNING'));
-	echo '<br><div class=centre><input type="Submit" name="delete" value="' . _('Delete This Asset') . '" onclick="return confirm(\'' . _('Are You Sure? Only assets with a zero book value can be deleted.') . '\');"></div>';
+	echo '<br /><div class=centre><input type="Submit" name="delete" value="' . _('Delete This Asset') . '" onclick="return confirm(\'' . _('Are You Sure? Only assets with a zero book value can be deleted.') . '\');"></div>';
 }
 
 echo '</form></div>';
Modified: trunk/GLAccountCSV.php
===================================================================
--- trunk/GLAccountCSV.php	2011-03-29 13:55:41 UTC (rev 4525)
+++ trunk/GLAccountCSV.php	2011-03-30 09:06:33 UTC (rev 4526)
@@ -1,9 +1,8 @@
 <?php
 
-/* $Id: $*/
-/* $Revision: 1.00 $ */
 
-//$PageSecurity = 8;
+/* $Id: GLAccountCSV.php 4492 2011-02-18 09:56:52Z daintree $ */
+
 include ('includes/session.inc');
 $title = _('General Ledger Account Report');
 include('includes/header.inc');
@@ -19,7 +18,7 @@
 
 echo '<div class="page_help_text">' . _('Use the keyboard Shift key to select multiple accounts and periods') . '</div><br>';
 
-echo "<form method='POST' action=" . $_SERVER['PHP_SELF'] . '?'  . SID . '>';
+echo '<form method="POST" action="' . $_SERVER['PHP_SELF'] . '">';
 echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />';
 
 /*Dates in SQL format for the last day of last month*/
@@ -35,10 +34,10 @@
 $i=0;
 while ($myrow=DB_fetch_array($AccountsResult,$db)){
 	if(isset($_POST['Account'][$i]) AND $myrow['accountcode'] == $_POST['Account'][$i]){
-		echo '<option selected VALUE=' . $myrow['accountcode'] . '>' . $myrow['accountcode'] . ' ' . $myrow['accountname'];
+		echo '<option selected VALUE=' . $myrow['accountcode'] . '>' . $myrow['accountcode'] . ' ' . $myrow['accountname'] . '</option>';
 		$i++;
 	} else {
-		echo '<option VALUE=' . $myrow['accountcode'] . '>' . $myrow['accountcode'] . ' ' . $myrow['accountname'];
+		echo '<option VALUE=' . $myrow['accountcode'] . '>' . $myrow['accountcode'] . ' ' . $myrow['accountname'] . '</option>';
 	}
 }
 echo '</select></td>';
@@ -51,10 +50,10 @@
 
 while ($myrow=DB_fetch_array($Periods,$db)){
 	if (isset($SelectedPeriod[$id]) and $myrow['periodno'] == $SelectedPeriod[$id]){
-		echo '<option selected VALUE=' . $myrow['periodno'] . '>' . _(MonthAndYearFromSQLDate($myrow['lastdate_in_period']));
+		echo '<option selected VALUE=' . $myrow['periodno'] . '>' . _(MonthAndYearFromSQLDate($myrow['lastdate_in_period'])) . '</option>';
 		$id++;
 	} else {
-		echo '<option VALUE=' . $myrow['periodno'] . '>' . _(MonthAndYearFromSQLDate($myrow['lastdate_in_period']));
+		echo '<option VALUE=' . $myrow['periodno'] . '>' . _(MonthAndYearFromSQLDate($myrow['lastdate_in_period'])) . '</option>';
 	}
 }
 echo '</select></td></tr>';
@@ -71,9 +70,9 @@
 echo '<option value=0>0 - '._('All tags');
 while ($myrow=DB_fetch_array($result)){
 	if (isset($_POST['tag']) and $_POST['tag']==$myrow['tagref']){
-	   echo '<option selected value=' . $myrow['tagref'] . '>' . $myrow['tagref'].' - ' .$myrow['tagdescription'];
+	   echo '<option selected value=' . $myrow['tagref'] . '>' . $myrow['tagref'].' - ' .$myrow['tagdescription'] . '</option>';
 	} else {
-	   echo '<option value=' . $myrow['tagref'] . '>' . $myrow['tagref'].' - ' .$myrow['tagdescription'];
+	   echo '<option value=' . $myrow['tagref'] . '>' . $myrow['tagref'].' - ' .$myrow['tagdescription'] . '</option>';
 	}
 }
 echo '</select></td></tr>';
@@ -95,7 +94,6 @@
 		prnMsg(_('An account or range of accounts must be selected from the list box'),'info');
 		include('includes/footer.inc');
 		exit;
-
 	}
 
 	if (!file_exists($_SESSION['reports_dir'])){
@@ -115,10 +113,10 @@
 	foreach ($_POST['Account'] as $SelectedAccount){
 		/*Is the account a balance sheet or a profit and loss account */
 		$result = DB_query("SELECT chartmaster.accountname,
-					accountgroups.pandl
-     				    FROM accountgroups
-				    INNER JOIN chartmaster ON accountgroups.groupname=chartmaster.group_
-				    WHERE chartmaster.accountcode=$SelectedAccount",$db);
+								accountgroups.pandl
+							    FROM accountgroups
+							    INNER JOIN chartmaster ON accountgroups.groupname=chartmaster.group_
+							    WHERE chartmaster.accountcode=$SelectedAccount",$db);
 		$AccountDetailRow = DB_fetch_row($result);
 		$AccountName = $AccountDetailRow[1];
 		if ($AccountDetailRow[1]==1){
@@ -140,11 +138,11 @@
 				      gltrans.periodno,
 				      gltrans.tag
 				FROM gltrans, systypes
-				WHERE gltrans.account = $SelectedAccount
+				WHERE gltrans.account = '$SelectedAccount'
 				AND systypes.typeid=gltrans.type
 				AND posted=1
-				AND periodno>=$FirstPeriodSelected
-				AND periodno<=$LastPeriodSelected
+				AND periodno>='$FirstPeriodSelected'
+				AND periodno<='$LastPeriodSelected'
 				ORDER BY periodno, gltrans.trandate, counterindex";
 
 		} else {
@@ -157,11 +155,11 @@
 				      gltrans.periodno,
 				      gltrans.tag
 				FROM gltrans, systypes
-				WHERE gltrans.account = $SelectedAccount
+				WHERE gltrans.account = '$SelectedAccount'
 				AND systypes.typeid=gltrans.type
 				AND posted=1
-				AND periodno>=$FirstPeriodSelected
-				AND periodno<=$LastPeriodSelected
+				AND periodno>='$FirstPeriodSelected'
+				AND periodno<='$LastPeriodSelected'
                                 AND tag='".$_POST['tag']."'
                                 ORDER BY periodno, gltrans.trandate, counterindex";
 		}
@@ -177,8 +175,8 @@
 					actual,
 					period
 				FROM chartdetails
-				WHERE chartdetails.accountcode= $SelectedAccount
-				AND chartdetails.period=" . $FirstPeriodSelected;
+				WHERE chartdetails.accountcode= '$SelectedAccount'
+				AND chartdetails.period='" . $FirstPeriodSelected . "'";
 
 			$ErrMsg = _('The chart details for account') . ' ' . $SelectedAccount . ' ' . _('could not be retrieved');
 			$ChartDetailsResult = DB_query($sql,$db,$ErrMsg);
@@ -206,8 +204,8 @@
 							actual,
 							period
 						FROM chartdetails
-						WHERE chartdetails.accountcode= $SelectedAccount
-						AND chartdetails.period=" . $PeriodNo;
+						WHERE chartdetails.accountcode= '$SelectedAccount'
+						AND chartdetails.period='" . $PeriodNo . "'";
 
 					$ErrMsg = _('The chart details for account') . ' ' . $SelectedAccount . ' ' . _('could not be retrieved');
 					$ChartDetailsResult = DB_query($sql,$db,$ErrMsg);
@@ -225,7 +223,6 @@
 			$RunningTotal += $myrow['amount'];
 			$PeriodTotal += $myrow['amount'];
 
-
 			$FormatedTranDate = ConvertSQLDate($myrow['trandate']);
 
 			$tagsql="SELECT tagdescription FROM tags WHERE tagref='".$myrow['tag'] . "'";
@@ -264,4 +261,4 @@
 } /* end of if CreateCSV button hit */
 
 include('includes/footer.inc');
-?>
+?>
\ No newline at end of file
Modified: trunk/GLBudgets.php
===================================================================
--- trunk/GLBudgets.php	2011-03-29 13:55:41 UTC (rev 4525)
+++ trunk/GLBudgets.php	2011-03-30 09:06:33 UTC (rev 4526)
@@ -1,7 +1,5 @@
 <?php
-
 /* $Id$*/
-//$PageSecurity = 10;
 
 include('includes/session.inc');
 include('includes/SQL_CommonFunctions.inc');
@@ -23,12 +21,12 @@
 }
 
 if (isset($_POST['update'])) {
-	prnMsg('Budget updated successfully', 'success');
+	prnMsg(_('Budget updated successfully'), 'success');
 }
 
 //If an account hasn't been selected then select one here.
 echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/maintenance.png" title="' . _('Search') . '" alt="" />' . ' ' . $title.'</p>';
-echo '<form action=' . $_SERVER['PHP_SELF'] . '?' . SID . ' method=post name="selectaccount">';
+echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post" name="selectaccount">';
 echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />';
 echo '<table>';
 
@@ -36,9 +34,9 @@
 		onChange='ReloadForm(selectaccount.Select)'>";
 
 $SQL = 'SELECT accountcode,
-						accountname
-					FROM chartmaster
-					ORDER BY accountcode';
+				accountname
+			FROM chartmaster
+			ORDER BY accountcode';
 
 $result=DB_query($SQL,$db);
 if (DB_num_rows($result)==0){
@@ -48,10 +46,10 @@
 	while ($myrow=DB_fetch_array($result)){
 		$account = $myrow['accountcode'] . ' - ' . $myrow['accountname'];
 		if (isset($SelectedAccount) and isset($LastCode) and $SelectedAccount==$myrow['accountcode']){
-			echo '<option selected value=' . $myrow['accountcode'] . '>' . $account;
+			echo '<option selected value=' . $myrow['accountcode'] . '>' . $account . '</option>';
 			$PrevCode=$LastCode;
 		} else {
-			echo '<option value=' . $myrow['accountcode'] . '>' . $account;
+			echo '<option value=' . $myrow['accountcode'] . '>' . $account . '</option>';
 			if (isset($SelectedAccount) and isset($LastCode) and $SelectedAccount == $LastCode) {
 				$NextCode=$myrow['accountcode'];
 			}
@@ -148,7 +146,7 @@
 
 // Table Headers
 
-	echo '<form name="form" action=' . $_SERVER['PHP_SELF'] . '?' . SID . ' method=post>';
+	echo '<form name="form" action="' . $_SERVER['PHP_SELF'] . '" method=post>';
 	echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />';
 	echo '<br /><table class=selection>';
 	echo '<tr><th colspan=3>'. _('Last Financial Year') .'</th>';
@@ -156,7 +154,7 @@
 	echo '<th colspan=3>'. _('Next Financial Year') .'</th></tr>';
 
 	echo '<tr><th colspan=3>'. _('Year ended').' - '.
-		Date($_SESSION['DefaultDateFormat'],YearEndDate($_SESSION['YearEnd'], -1)) .'</th>';
+		Date($_SESSION['DefaultDateFormat'],YearEndDate($_SESSION['YearEnd'],-1)) .'</th>';
 	echo '<th colspan=3>'. _('Year ended').' - '.
 		Date($_SESSION['DefaultDateFormat'],YearEndDate($_SESSION['YearEnd'],0)) .'</th>';
 	echo '<th colspan=3>'. _('Year ended').' - '.
@@ -170,7 +168,6 @@
 	}
 	echo '</tr>';
 
-
 // Main Table
 
 	for ($i=1; $i<=12; $i++) {
Modified: trunk/GLCodesInquiry.php
===================================================================
--- trunk/GLCodesInquiry.php	2011-03-29 13:55:41 UTC (rev 4525)
+++ trunk/GLCodesInquiry.php	2011-03-30 09:06:33 UTC (rev 4526)
@@ -1,9 +1,7 @@
 <?php
 
 /* $Id$*/
-/* $Revision: 1.9 $ */
 
-//$PageSecurity = 8;
 include ('includes/session.inc');
 
 $title = _('GL Codes Inquiry');
@@ -13,20 +11,20 @@
 $SQL = 'SELECT group_,
 		accountcode ,
 		accountname
-	FROM chartmaster INNER JOIN accountgroups ON chartmaster.group_ = accountgroups.groupname
-	ORDER BY sequenceintb,
-		accountcode';
+		FROM chartmaster INNER JOIN accountgroups ON chartmaster.group_ = accountgroups.groupname
+		ORDER BY sequenceintb,
+				accountcode';
 
 $ErrMsg = _('No general ledger accounts were returned by the SQL because');
 $AccountsResult = DB_query($SQL,$db,$ErrMsg);
 
 /*show a table of the orders returned by the SQL */
 
-echo "<table cellpadding=2 colspan=2>
+echo '<table cellpadding=2 colspan=2>
 		<tr>
-			<th>"._('Group')."</font></th>
-			<th>"._('Code')."</font></th>
-			<th>"._('Account Name').'</font></th>
+			<th>' . _('Group') . '</font></th>
+			<th>' . _('Code') . '</font></th>
+			<th>' . _('Account Name') . '</font></th>
 		</tr>';
 
 $j = 1;
@@ -63,7 +61,5 @@
 //end of while loop
 
 echo '</table>';
-
 include('includes/footer.inc');
-
-?>
+?>
\ No newline at end of file
Modified: trunk/GLJournal.php
===================================================================
--- trunk/GLJournal.php	2011-03-29 13:55:41 UTC (rev 4525)
+++ trunk/GLJournal.php	2011-03-30 09:06:33 UTC (rev 4526)
@@ -1,11 +1,9 @@
 <?php
 
 /* $Id$*/
-/* $Revision: 1.27 $ */
 
 include('includes/DefineJournalClass.php');
 
-//$PageSecurity = 10;
 include('includes/session.inc');
 $title = _('Journal Entry');
 
@@ -24,7 +22,7 @@
 	Journals cannot be entered against bank accounts GL postings involving bank accounts must be done using
 	a receipt or a payment transaction to ensure a bank trans is available for matching off vs statements */
 
-	$SQL = "SELECT accountcode FROM bankaccounts";
+	$SQL = 'SELECT accountcode FROM bankaccounts';
 	$result = DB_query($SQL,$db);
 	$i=0;
 	while ($Act = DB_fetch_row($result)){
@@ -68,8 +66,8 @@
 						account,
 						narrative,
 						amount,
-						tag) ";
-		$SQL= $SQL . "VALUES (0,
+						tag)
+				VALUES ('0',
 					'" . $TransNo . "',
 					'" . FormatDateForSQL($_SESSION['JournalDetail']->JnlDate) . "',
 					'" . $PeriodNo . "',
@@ -90,8 +88,8 @@
 							account,
 							narrative,
 							amount,
-							tag) ";
-			$SQL= $SQL . "VALUES (0,
+							tag) 
+					VALUES ('0',
 						'" . $TransNo . "',
 						'" . FormatDateForSQL($_SESSION['JournalDetail']->JnlDate) . "',
 						'" . ($PeriodNo + 1) . "',
@@ -104,7 +102,6 @@
 			$ErrMsg =_('Cannot insert a GL entry for the reversing journal because');
 			$DbgMsg = _('The SQL that failed to insert the GL Trans record was');
 			$result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true);
-
 		}
 	}
 
@@ -120,7 +117,7 @@
 	unset($_SESSION['JournalDetail']);
 
 	/*Set up a newy in case user wishes to enter another */
-	echo "<br /><a href='" . $_SERVER['PHP_SELF'] . '?' . SID . "&NewJournal=Yes'>"._('Enter Another General Ledger Journal').'</a>';
+	echo '<br /><a href="' . $_SERVER['PHP_SELF'] . '?NewJournal=Yes">'._('Enter Another General Ledger Journal').'</a>';
 	/*And post the journal too */
 	include ('includes/GLPostings.inc');
 	include ('includes/footer.inc');
@@ -132,21 +129,17 @@
 	$_SESSION['JournalDetail']->Remove_GLEntry($_GET['Delete']);
 
 } elseif (isset($_POST['Process']) and $_POST['Process']==_('Accept')){ //user hit submit a new GL Analysis line into the journal
-	if($_POST['GLCode']!='')
-	{
+	if ($_POST['GLCode']!='') {
 		$extract = explode(' - ',$_POST['GLCode']);
 		$_POST['GLCode'] = $extract[0];
 	}
-	if($_POST['Debit']>0)
-	{
+	if ($_POST['Debit']>0) {
 		$_POST['GLAmount'] = $_POST['Debit'];
-	}
-	elseif($_POST['Credit']>0)
-	{
+	} elseif ($_POST['Credit']>0) {
 		$_POST['GLAmount'] = '-' . $_POST['Credit'];
 	}
 	if ($_POST['GLManualCode'] != '' AND is_numeric($_POST['GLManualCode'])){
-				// If a manual code was entered need to check it exists and isnt a bank account
+		// If a manual code was entered need to check it exists and isnt a bank account
 		$AllowThisPosting = true; //by default
 		if ($_SESSION['ProhibitJournalsToControlAccounts'] == 1){
 			if ($_SESSION['CompanyRecord']['gllink_debtors'] == '1' AND $_POST['GLManualCode'] == $_SESSION['CompanyRecord']['debtorsact']){
@@ -228,18 +221,10 @@
 	unset($_POST['GLManualCode']);
 }
 
-// set up the form whatever
-/*
-if (!isset($_SESSION['JournalDetail']->JnlDate)){
-	 $_POST['JournalProcessDate']= Date($_SESSION['DefaultDateFormat']);
-	 $_SESSION['JournalDetail']->JnlDate = $_POST['JournalProcessDate'];
-}
-*/
 
-echo '<form action="' . $_SERVER['PHP_SELF'] . '?' . SID . '" method="post" name="form">';
+echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post" name="form">';
 echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />';
 
-
 echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/maintenance.png" title="' . _('Search') . '" alt="" />' . ' ' . $title.'</p>';
 
 // A new table in the first column of the main table
@@ -287,8 +272,8 @@
 
 $SQL = 'SELECT tagref,
 			tagdescription
-	FROM tags
-	ORDER BY tagref';
+		FROM tags
+		ORDER BY tagref';
 
 $result=DB_query($SQL,$db);
 echo '<option value="0">0 - None</option>';
@@ -309,10 +294,10 @@
 	"'".'The account code '."'".'+ this.value+ '."'".' doesnt exist'."'".')"' .
 		' value="'. $_POST['GLManualCode'] .'"  /></td>';
 
-$sql="SELECT accountcode,
+$sql='SELECT accountcode,
 			accountname
 		FROM chartmaster
-		ORDER BY accountcode";
+		ORDER BY accountcode';
 
 $result=DB_query($sql, $db);
 echo '<td><select name="GLCode" onChange="return assignComboToInput(this,'.'GLManualCode'.')">';
@@ -336,15 +321,14 @@
 	$_POST['Debit'] = '';
 }
 
-
 echo '</tr><tr><th>' . _('Debit') . '</th>'.'<td><input type="text" class="number" Name = "Debit" ' .
 			'onChange="eitherOr(this, '.'Credit'.')"'.
 			' Maxlength="12" size="10" value="' . $_POST['Debit'] . '" /></td>';
-echo '</tr><tr><th>' . _('Credit') . "</th>".'<td><input type="text" class="number" Name = "Credit" ' .
+echo '</tr><tr><th>' . _('Credit') . '</th><td><input type="text" class="number" Name = "Credit" ' .
 			'onChange="eitherOr(this, '.'Debit'.')"'.
 			' Maxlength="12" size="10" value="' . $_POST['Credit'] . '" /></td>';
 echo '</tr><tr><td></td><td></td><th>'. _('Narrative'). '</th>';
-echo '</tr><tr><th></th><th>' . _('GL Narrative') . "</th>";
+echo '</tr><tr><th></th><th>' . _('GL Narrative') . '</th>';
 
 echo '<td><input type="text" name="GLNarrative" maxlength="100" size="100" value="' . $_POST['GLNarrative'] . '" /></td>';
 
@@ -398,22 +382,22 @@
 	}
 
 	echo '<td>' . $JournalItem->Narrative  . "</td>
-			<td><a href='" . $_SERVER['PHP_SELF'] . '?' . SID . '&Delete=' . $JournalItem->ID . "'>"._('Delete').'</a></td>
+			<td><a href='" . $_SERVER['PHP_SELF'] . '?Delete=' . $JournalItem->ID . "'>"._('Delete').'</a></td>
 	</tr>';
 }
 
 echo '<tr class="EvenTableRows"><td></td>
-		<td class="number"><b> Total </b></td>
+		<td class="number"><b>' . _('Total') .  '</b></td>
 		<td class="number"><b>' . number_format($debittotal,2) . '</b></td>
 		<td class="number"><b>' . number_format($credittotal,2) . '</b></td></tr>';
 if ($debittotal!=$credittotal) {
-	echo '<td align="center" style="background-color: #fddbdb"><b>Required to balance - </b>' .
+	echo '<td align="center" style="background-color: #fddbdb"><b>' . _('Required to balance') .' - </b>' .
 		number_format(abs($debittotal-$credittotal),2);
 }
 if ($debittotal>$credittotal) {
-	echo ' Credit</td></tr>';
+	echo ' ' . _('Credit') . '</td></tr>';
 } else if ($debittotal<$credittotal) {
-	echo ' Debit</td></tr>';
+	echo ' ' . _('Debit') . '</td></tr>';
 }
 echo '</table>';
 
Modified: trunk/PDFGrn.php
===================================================================
--- trunk/PDFGrn.php	2011-03-29 13:55:41 UTC (rev 4525)
+++ trunk/PDFGrn.php	2011-03-30 09:06:33 UTC (rev 4526)
@@ -2,7 +2,6 @@
 
 /* $Id$*/
 
-//$PageSecurity = 2; Now comes from DB - read in from session
 include('includes/session.inc');
 
 if (isset($_GET['GRNNo'])) {
Modified: trunk/doc/Change.log.html
===================================================================
--- trunk/doc/Change.log.html	2011-03-29 13:55:41 UTC (rev 4525)
+++ trunk/doc/Change.log.html	2011-03-30 09:06:33 UTC (rev 4526)
@@ -1,5 +1,8 @@
 <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p>
-<p>
+<p />
+<p>30/3/11 Tim - New ReprintGRN.php script takes a purchase order and allows any line received to have GRN(s) reprinted</p>
+<p>29/3/11 Phil - checking for unquoted SQL and for SQL where literals quoted with double quotes rather than single - double quotes are not ANSI compatible - so making the SQL more ANSI compatible by doing this as suggested by Tim. Many many scripts involved will take a week or so</p>
+<p />
 <p>27/3/11 - Version 4.03.5 Release
 <p>
 <p>27/3/11: Phil fixed SQL upgrade script to add the Z_ChangeSupplierCode.php script is added to the scripts table</p>
Modified: trunk/includes/ConnectDB.inc
===================================================================
--- trunk/includes/ConnectDB.inc	2011-03-29 13:55:41 UTC (rev 4525)
+++ trunk/includes/ConnectDB.inc	2011-03-30 09:06:33 UTC (rev 4526)
@@ -4,7 +4,7 @@
  * this value is saved in the $_SESSION['Versionumber'] when includes/GetConfig.php is run
  * if  VersionNumber is < $Version  then the DB update script is run */
 
-$Version='4.03.5'; //must update manually every time there is a DB change
+$Version='4.03.6'; //must update manually every time there is a DB change
 
 require_once ($PathPrefix .'includes/MiscFunctions.php');
 
Modified: trunk/index.php
===================================================================
--- trunk/index.php	2011-03-29 13:55:41 UTC (rev 4525)
+++ trunk/index.php	2011-03-30 09:06:33 UTC (rev 4526)
@@ -605,17 +605,17 @@
 						<table width="100%" class="table_index">
 							<tr>
 							<td class="menu_group_item">
-								<?php echo '<p>• <a href="' . $rootpath . "/StockSerialItemResearch.php?" . SID . '">' . _('Serial Item Research Tool') . '</a></p>'; ?>
+								<?php echo '<p>• <a href="' . $rootpath . '/StockSerialItemResearch.php">' . _('Serial Item Research Tool') . '</a></p>'; ?>
 							</td>
 							</tr>
 							<tr>
 							<td class="menu_group_item">
-								<?php echo '<p>• <a href="' . $rootpath . "/PDFPrintLabel.php?" . SID . '">' . _('Print Price Labels') . '</a></p>'; ?>
+								<?php echo '<p>• <a href="' . $rootpath . '/PDFPrintLabel.php">' . _('Print Price Labels') . '</a></p>'; ?>
 							</td>
 							</tr>
 							<tr>
 							<td class="menu_group_item">
-								<?php echo '<p>• <a href="' . $rootpath . "/StockMovements.php?" . SID . '">' . _('Inventory Item Movements') . '</a></p>'; ?>
+								<?php echo '<p>• <a href="' . $rootpath . '/StockMovements.php">' . _('Inventory Item Movements') . '</a></p>'; ?>
 							</td>
 							</tr>
 							<tr>
@@ -705,6 +705,11 @@
 							</tr>
 							<tr>
 							<td class="menu_group_item">
+								<?php echo '<p>• <a href="' . $rootpath . '/ReprintGRN.php">' . _('Reprint GRN') . '</a></p>'; ?>
+							</td>
+							</tr>
+							<tr>
+							<td class="menu_group_item">
 								<?php echo GetRptLinks('inv'); ?>
 							</td>
 							</tr>
Modified: trunk/sql/mysql/upgrade3.11.1-4.00.sql
===================================================================
--- trunk/sql/mysql/upgrade3.11.1-4.00.sql	2011-03-29 13:55:41 UTC (rev 4525)
+++ trunk/sql/mysql/upgrade3.11.1-4.00.sql	2011-03-30 09:06:33 UTC (rev 4526)
@@ -835,4 +835,6 @@
 ALTER TABLE `locations` CHANGE `cashsalecustomer` `cashsalecustomer` VARCHAR( 10 ) DEFAULT '';
 UPDATE config SET confvalue='4.03.3' WHERE confname='VersionNumber';
 INSERT INTO `scripts` (`script`, `pagesecurity`, `description`) VALUES ('Z_ChangeSupplierCode.php', '15', 'Script to change a supplier code accross all tables necessary');
-UPDATE config SET confvalue='4.03.5' WHERE confname='VersionNumber';
\ No newline at end of file
+UPDATE config SET confvalue='4.03.5' WHERE confname='VersionNumber';
+INSERT INTO `scripts` (`script` ,`pagesecurity` ,`description`) VALUES ( 'ReprintGRN.php', '11', 'Allows selection of a goods received batch for reprinting the goods received note given a purchase order number');
+UPDATE config SET confvalue='4.03.6' WHERE confname='VersionNumber';
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
 |