From: <dai...@us...> - 2011-03-29 09:04:29
|
Revision: 4521 http://web-erp.svn.sourceforge.net/web-erp/?rev=4521&view=rev Author: daintree Date: 2011-03-29 09:04:20 +0000 (Tue, 29 Mar 2011) Log Message: ----------- SQL to ansi and other html to xhtml Modified Paths: -------------- trunk/BOMExtendedQty.php trunk/BOMIndented.php trunk/BOMIndentedReverse.php trunk/COGSGLPostings.php trunk/CompanyPreferences.php trunk/Credit_Invoice.php trunk/CustomerReceipt.php trunk/Customers.php trunk/MRP.php trunk/api/api_branches.php trunk/api/api_currencies.php trunk/api/api_customers.php trunk/api/api_customertypes.php trunk/api/api_glaccounts.php trunk/api/api_holdreasons.php trunk/api/api_locations.php trunk/api/api_salesareas.php trunk/api/api_salesman.php trunk/api/api_salesorders.php trunk/api/api_salestypes.php trunk/api/api_shippers.php trunk/api/api_stock.php trunk/api/api_stockcategories.php trunk/api/api_suppliers.php trunk/api/api_taxgroups.php trunk/api/api_workorders.php trunk/includes/ConnectDB_mysql.inc Added Paths: ----------- trunk/locale/zh_CN.utf8/Manual/ManualSalesAnalysis.html trunk/locale/zh_CN.utf8/Manual/ManualSalesPeople.html trunk/locale/zh_CN.utf8/Manual/ManualShipments.html Modified: trunk/BOMExtendedQty.php =================================================================== --- trunk/BOMExtendedQty.php 2011-03-28 09:49:25 UTC (rev 4520) +++ trunk/BOMExtendedQty.php 2011-03-29 09:04:20 UTC (rev 4521) @@ -2,8 +2,6 @@ /* $Id$*/ -/* $Revision: 1.8 $ */ - // BOMExtendedQty.php - Quantiy Extended Bill of Materials //$PageSecurity = 2; include('includes/session.inc'); @@ -30,7 +28,7 @@ $sql = 'CREATE TEMPORARY TABLE passbom ( part char(20), extendedqpa double, - sortpart text)'; + sortpart text) DEFAULT CHARSET=utf8'; $ErrMsg = _('The SQL to to create passbom failed with the message'); $result = DB_query($sql,$db,$ErrMsg); @@ -43,7 +41,7 @@ loccode char(5), effectiveafter date, effectiveto date, - quantity double)'; + quantity double) DEFAULT CHARSET=utf8'; $result = DB_query($sql,$db,_('Create of tempbom failed because')); // First, find first level of components below requested assembly // Put those first level parts in passbom, use COMPONENT in passbom @@ -56,8 +54,9 @@ (" . $_POST['Quantity'] . " * bom.quantity) as extendedqpa, CONCAT(bom.parent,bom.component) AS sortpart FROM bom - WHERE bom.parent =" . "'" . $_POST['Part'] . "' - AND bom.effectiveto >= NOW() AND bom.effectiveafter <= NOW()"; + WHERE bom.parent ='" . $_POST['Part'] . "' + AND bom.effectiveto >= NOW() + AND bom.effectiveafter <= NOW()"; $result = DB_query($sql,$db); $levelctr = 2; @@ -82,8 +81,9 @@ bom.effectiveto, (" . $_POST['Quantity'] . " * bom.quantity) as extendedqpa FROM bom - WHERE bom.parent =" . "'" . $_POST['Part'] . "' - AND bom.effectiveto >= NOW() AND bom.effectiveafter <= NOW()"; + WHERE bom.parent ='" . $_POST['Part'] . "' + AND bom.effectiveto >= NOW() + AND bom.effectiveafter <= NOW()"; $result = DB_query($sql,$db); //echo "</br>sql is $sql</br>"; // This while routine finds the other levels as long as $componentctr - the @@ -114,7 +114,8 @@ (bom.quantity * passbom.extendedqpa) FROM bom,passbom WHERE bom.parent = passbom.part - AND bom.effectiveto >= NOW() AND bom.effectiveafter <= NOW()"; + AND bom.effectiveto >= NOW() + AND bom.effectiveafter <= NOW()"; $result = DB_query($sql,$db); $sql = 'DROP TABLE IF EXISTS passbom2'; @@ -129,7 +130,7 @@ $sql = 'CREATE TEMPORARY TABLE passbom ( part char(20), extendedqpa decimal(10,3), - sortpart text)'; + sortpart text) DEFAULT CHARSET=utf8'; $result = DB_query($sql,$db); @@ -138,13 +139,15 @@ (bom.quantity * passbom2.extendedqpa), CONCAT(passbom2.sortpart,bom.component) AS sortpart FROM bom,passbom2 - WHERE bom.parent = passbom2.part - AND bom.effectiveto >= NOW() AND bom.effectiveafter <= NOW()"; + WHERE bom.parent = passbom2.part + AND bom.effectiveto >= NOW() + AND bom.effectiveafter <= NOW()"; $result = DB_query($sql,$db); - $sql = 'SELECT COUNT(*) FROM bom,passbom WHERE bom.parent = passbom.part - GROUP BY passbom.part'; + $sql = 'SELECT COUNT(*) FROM bom, passbom + WHERE bom.parent = passbom.part + GROUP BY passbom.part'; $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); @@ -156,9 +159,9 @@ $title = _('Quantity Extended BOM Listing') . ' - ' . _('Problem Report'); include('includes/header.inc'); prnMsg( _('The Quantiy Extended BOM Listing could not be retrieved by the SQL because') . ' ' . DB_error_msg($db),'error'); - echo "<br><a href='" .$rootpath .'/index.php?' . SID . "'>" . _('Back to the menu') . '</a>'; + echo '<br /><a href="' .$rootpath .'/index.php">' . _('Back to the menu') . '</a>'; if ($debug==1){ - echo "<br>$sql"; + echo '<br />' . $sql; } include('includes/footer.inc'); exit; @@ -168,11 +171,11 @@ $Right_Margin); $sql = "SELECT stockmaster.stockid,stockmaster.description FROM stockmaster - WHERE stockid = " . "'" . $_POST['Part'] . "'"; + WHERE stockid = '" . $_POST['Part'] . "'"; $result = DB_query($sql,$db); $myrow = DB_fetch_array($result,$db); - $assembly = $_POST['Part']; - $assemblydesc = $myrow['description']; + $Assembly = $_POST['Part']; + $AssemblyDescription = $myrow['description']; $FontSize=8; $Tot_Val=0; @@ -209,14 +212,12 @@ $ListCount = DB_num_rows($result); // UldisN While ($myrow = DB_fetch_array($result,$db)){ - - // Parameters for addTextWrap are defined in /includes/class.pdf.php // 1) X position 2) Y position 3) Width // 4) Height 5) Text 6) Alignment 7) Border 8) Fill - True to use SetFillColor // and False to set to transparent - $difference = $myrow['quantity'] - ($myrow['qoh'] + $myrow['poqty'] + $myrow['woqty']); - if (($_POST['Select'] == 'All') or ($difference > 0)) { + $Difference = $myrow['quantity'] - ($myrow['qoh'] + $myrow['poqty'] + $myrow['woqty']); + if (($_POST['Select'] == 'All') or ($Difference > 0)) { $YPos -=$line_height; $FontSize=8; // Use to alternate between lines with transparent and painted background @@ -234,7 +235,7 @@ $myrow['decimalplaces']),'right',0,$fill); $pdf->addTextWrap(440,$YPos,40,$FontSize,number_format($myrow['woqty'], $myrow['decimalplaces']),'right',0,$fill); - $pdf->addTextWrap(480,$YPos,50,$FontSize,number_format($difference, + $pdf->addTextWrap(480,$YPos,50,$FontSize,number_format($Difference, $myrow['decimalplaces']),'right',0,$fill); } if ($YPos < $Bottom_Margin + $line_height){ @@ -251,33 +252,18 @@ PrintHeader($pdf,$YPos,$PageNumber,$Page_Height,$Top_Margin,$Left_Margin,$Page_Width, $Right_Margin); } -/* Uldisn:This actually would produce the output - $pdfcode = $pdf->output(); - $len = strlen($pdfcode); -*/ -// if ($len<=20){ - if ($ListCount == 0) { //UldisN - $title = _('Print Indented BOM Listing Error'); - include('includes/header.inc'); - prnMsg(_('There were no items for the selected assembly'),'error'); - echo "<br><a href='$rootpath/index.php?" . SID . "'>" . _('Back to the menu') . '</a>'; - include('includes/footer.inc'); - exit; + if ($ListCount == 0) { + $title = _('Print Indented BOM Listing Error'); + include('includes/header.inc'); + prnMsg(_('There were no items for the selected assembly'),'error'); + echo "<br /><a href='$rootpath/index.php?" . SID . "'>" . _('Back to the menu') . '</a>'; + include('includes/footer.inc'); + exit; } else { -/* UldisN - header('Content-type: application/pdf'); - header("Content-Length: " . $len); - header('Content-Disposition: inline; filename=Customer_trans.pdf'); - header('Expires: 0'); - header('Cache-Control: private, post-check=0, pre-check=0'); - header('Pragma: public'); + $pdf->OutputD($_SESSION['DatabaseName'] . '_BOM_Extended_Qty_' . date('Y-m-d').'.pdf'); + $pdf->__destruct(); + } - $pdf->Output('BOMExtendedQty', 'I'); -*/ - $pdf->OutputD($_SESSION['DatabaseName'] . '_Customer_trans_' . date('Y-m-d').'.pdf');//UldisN - $pdf-> __destruct(); - } - } else { /*The option to print PDF was not hit so display form */ $title=_('Quantity Extended BOM Listing'); @@ -297,7 +283,7 @@ echo "<option selected value='yes'>" . _('Print With Alternating Highlighted Lines'); echo "<option value='no'>" . _('Plain Print'); echo '</select></td></tr>'; - echo "</table></br></br><div class='centre'><br><input type=submit name='PrintPDF' value='" . _('Print PDF') . "'></div>"; + echo "</table></br></br><div class='centre'><br /><input type=submit name='PrintPDF' value='" . _('Print PDF') . "'></div>"; include('includes/footer.inc'); @@ -348,6 +334,4 @@ $YPos =$YPos - (2*$line_height); $PageNumber++; } // End of PrintHeader function - - ?> Modified: trunk/BOMIndented.php =================================================================== --- trunk/BOMIndented.php 2011-03-28 09:49:25 UTC (rev 4520) +++ trunk/BOMIndented.php 2011-03-29 09:04:20 UTC (rev 4521) @@ -2,10 +2,8 @@ /* $Id$*/ -/* $Revision: 1.5 $ */ - // BOMIndented.php - Indented Bill of Materials -//$PageSecurity = 2; + include('includes/session.inc'); if (isset($_POST['PrintPDF'])) { @@ -25,7 +23,7 @@ $result = DB_query($sql,$db); $sql = 'CREATE TEMPORARY TABLE passbom ( part char(20), - sortpart text)'; + sortpart text) DEFAULT CHARSET=utf8'; $ErrMsg = _('The SQL to create passbom failed with the message'); $result = DB_query($sql,$db,$ErrMsg); @@ -38,7 +36,7 @@ loccode char(5), effectiveafter date, effectiveto date, - quantity double)'; + quantity double) DEFAULT CHARSET=utf8'; $result = DB_query($sql,$db,_('Create of tempbom failed because')); // First, find first level of components below requested assembly // Put those first level parts in passbom, use COMPONENT in passbom @@ -50,8 +48,9 @@ SELECT bom.component AS part, CONCAT(bom.parent,bom.component) AS sortpart FROM bom - WHERE bom.parent =" . "'" . $_POST['Part'] . "' - AND bom.effectiveto >= NOW() AND bom.effectiveafter <= NOW()"; + WHERE bom.parent ='" . $_POST['Part'] . "' + AND bom.effectiveto >= NOW() + AND bom.effectiveafter <= NOW()"; $result = DB_query($sql,$db); $levelctr = 2; @@ -77,7 +76,8 @@ bom.quantity FROM bom WHERE bom.parent ='" . $_POST['Part'] . "' - AND bom.effectiveto >= NOW() AND bom.effectiveafter <= NOW()"; + AND bom.effectiveto >= NOW() + AND bom.effectiveafter <= NOW()"; $result = DB_query($sql,$db); //echo "</br>sql is $sql</br>"; // This while routine finds the other levels as long as $componentctr - the @@ -107,7 +107,7 @@ bom.effectiveafter, bom.effectiveto, bom.quantity - FROM bom,passbom + FROM bom, passbom WHERE bom.parent = passbom.part AND bom.effectiveto >= NOW() AND bom.effectiveafter <= NOW()"; $result = DB_query($sql,$db); @@ -123,16 +123,17 @@ $sql = 'CREATE TEMPORARY TABLE passbom ( part char(20), - sortpart text)'; + sortpart text) DEFAULT CHARSET=utf8'; $result = DB_query($sql,$db); - $sql = "INSERT INTO passbom (part, sortpart) + $sql = 'INSERT INTO passbom (part, sortpart) SELECT bom.component AS part, CONCAT(passbom2.sortpart,bom.component) AS sortpart FROM bom,passbom2 WHERE bom.parent = passbom2.part - AND bom.effectiveto >= NOW() AND bom.effectiveafter <= NOW()"; + AND bom.effectiveto >= NOW() + AND bom.effectiveafter <= NOW()'; $result = DB_query($sql,$db); @@ -181,9 +182,9 @@ // $fill is used to alternate between lines with transparent and painted background $fill = false; - $pdf->SetFillColor(224,235,255); + $pdf->SetFillColor(224,235,255); - $ListCount = DB_num_rows($result); // UldisN + $ListCount = DB_num_rows($result); while ($myrow = DB_fetch_array($result,$db)){ @@ -239,19 +240,8 @@ include('includes/footer.inc'); exit; } else { - /* UldisN - header('Content-type: application/pdf'); - header("Content-Length: " . $len); - header('Content-Disposition: inline; filename=Customer_trans.pdf'); - header('Expires: 0'); - header('Cache-Control: private, post-check=0, pre-check=0'); - header('Pragma: public'); - - $pdf->Output('BOMIndented.pdf', 'I'); - */ - $pdf->OutputD($_SESSION['DatabaseName'] . '_Customer_trans_' . date('Y-m-d').'.pdf');//UldisN - $pdf-> __destruct(); - + $pdf->OutputD($_SESSION['DatabaseName'] . '_Customer_trans_' . date('Y-m-d').'.pdf');//UldisN + $pdf->__destruct(); } } else { /*The option to print PDF was not hit so display form */ @@ -333,5 +323,4 @@ } // End of PrintHeader function - -?> +?> \ No newline at end of file Modified: trunk/BOMIndentedReverse.php =================================================================== --- trunk/BOMIndentedReverse.php 2011-03-28 09:49:25 UTC (rev 4520) +++ trunk/BOMIndentedReverse.php 2011-03-29 09:04:20 UTC (rev 4521) @@ -2,11 +2,9 @@ /* $Id$*/ -/* $Revision: 1.1 $ */ - // BOMIndented.php - Reverse Indented Bill of Materials - From lowest level component to top level // assembly -//$PageSecurity = 2; + include('includes/session.inc'); if (isset($_POST['PrintPDF'])) { @@ -26,7 +24,8 @@ $result = DB_query($sql,$db); $sql = 'CREATE TEMPORARY TABLE passbom ( part char(20), - sortpart text)'; + sortpart text) DEFAULT CHARSET=utf8'; + $ErrMsg = _('The SQL to to create passbom failed with the message'); $result = DB_query($sql,$db,$ErrMsg); @@ -39,7 +38,7 @@ loccode char(5), effectiveafter date, effectiveto date, - quantity double)'; + quantity double) DEFAULT CHARSET=utf8'; $result = DB_query($sql,$db,_('Create of tempbom failed because')); // First, find first level of components below requested assembly // Put those first level parts in passbom, use COMPONENT in passbom @@ -51,8 +50,9 @@ SELECT bom.parent AS part, CONCAT(bom.component,bom.parent) AS sortpart FROM bom - WHERE bom.component =" . "'" . $_POST['Part'] . "' - AND bom.effectiveto >= NOW() AND bom.effectiveafter <= NOW()"; + WHERE bom.component ='" . $_POST['Part'] . "' + AND bom.effectiveto >= NOW() + AND bom.effectiveafter <= NOW()"; $result = DB_query($sql,$db); $levelctr = 2; @@ -78,7 +78,8 @@ bom.quantity FROM bom WHERE bom.component ='" . $_POST['Part'] . "' - AND bom.effectiveto >= NOW() AND bom.effectiveafter <= NOW()"; + AND bom.effectiveto >= NOW() + AND bom.effectiveafter <= NOW()"; $result = DB_query($sql,$db); // This while routine finds the other levels as long as $componentctr - the @@ -107,9 +108,10 @@ bom.effectiveafter, bom.effectiveto, bom.quantity - FROM bom,passbom - WHERE bom.component = passbom.part - AND bom.effectiveto >= NOW() AND bom.effectiveafter <= NOW()"; + FROM bom,passbom + WHERE bom.component = passbom.part + AND bom.effectiveto >= NOW() + AND bom.effectiveafter <= NOW()"; $result = DB_query($sql,$db); $sql = 'DROP TABLE IF EXISTS passbom2'; @@ -123,7 +125,7 @@ $sql = 'CREATE TEMPORARY TABLE passbom ( part char(20), - sortpart text)'; + sortpart text) DEFAULT CHARSET=utf8'; $result = DB_query($sql,$db); @@ -132,7 +134,8 @@ CONCAT(passbom2.sortpart,bom.parent) AS sortpart FROM bom,passbom2 WHERE bom.component = passbom2.part - AND bom.effectiveto >= NOW() AND bom.effectiveafter <= NOW()"; + AND bom.effectiveto >= NOW() + AND bom.effectiveafter <= NOW()"; $result = DB_query($sql,$db); @@ -160,7 +163,7 @@ $sql = "SELECT stockmaster.stockid, stockmaster.description FROM stockmaster - WHERE stockid = " . "'" . $_POST['Part'] . "'"; + WHERE stockid = '" . $_POST['Part'] . "'"; $result = DB_query($sql,$db); $myrow = DB_fetch_array($result,$db); $assembly = $_POST['Part']; @@ -222,12 +225,6 @@ PrintHeader($pdf,$YPos,$PageNumber,$Page_Height,$Top_Margin,$Left_Margin,$Page_Width, $Right_Margin,$assemblydesc); } -/* UldisN - $pdfcode = $pdf->output(); - $len = strlen($pdfcode); - - if ($len<=20){ -*/ if ($ListCount == 0) { $title = _('Print Reverse Indented BOM Listing Error'); include('includes/header.inc'); @@ -236,16 +233,8 @@ include('includes/footer.inc'); exit; } else { -// header('Content-type: application/pdf'); -// header("Content-Length: " . $len); -// header('Content-Disposition: inline; filename=Customer_trans.pdf'); -// header('Expires: 0'); -// header('Cache-Control: private, post-check=0, pre-check=0'); -// header('Pragma: public'); -// -// $pdf->Output('BOMIndentedReverse.pdf', 'I'); - $pdf->OutputD($_SESSION['DatabaseName'] . '_Customer_trans_' . date('Y-m-d').'.pdf');//UldisN - $pdf-> __destruct(); + $pdf->OutputD($_SESSION['DatabaseName'] . '_Customer_trans_' . date('Y-m-d').'.pdf');//UldisN + $pdf->__destruct(); } } else { /*The option to print PDF was not hit so display form */ @@ -255,7 +244,7 @@ echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/maintenance.png" title="' . _('Search') . '" alt="" />' . ' ' . $title.'</p><br />'; - echo '</br></br><form action=' . $_SERVER['PHP_SELF'] . " method='post'><table class=selection>"; + echo '</br></br><form action=' . $_SERVER['PHP_SELF'] . ' method="post"><table class="selection">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<tr><td>' . _('Part') . ":</td>"; echo "<td><input type ='text' name='Part' size='20'>"; @@ -319,5 +308,4 @@ } // End of PrintHeader function - -?> +?> \ No newline at end of file Modified: trunk/COGSGLPostings.php =================================================================== --- trunk/COGSGLPostings.php 2011-03-28 09:49:25 UTC (rev 4520) +++ trunk/COGSGLPostings.php 2011-03-29 09:04:20 UTC (rev 4521) @@ -58,7 +58,7 @@ $result = DB_query($sql,$db); prnMsg ($msg,'info'); - echo '<br>'; + echo '<br />'; unset ($SelectedCOGSPostingID); } elseif (isset($_GET['delete'])) { @@ -67,7 +67,7 @@ $sql="DELETE FROM cogsglpostings WHERE id='".$SelectedCOGSPostingID."'"; $result = DB_query($sql,$db); prnMsg( _('The cost of sales posting code record has been deleted'),'info'); - echo '<br>'; + echo '<br />'; unset ($SelectedCOGSPostingID); } @@ -90,11 +90,11 @@ $ShowLivePostingRecords = false; prnMsg (_('The following cost of sales posting records that do not have valid general ledger code specified - these records must be amended.'),'error'); echo '<table class=selection>'; - echo "<tr><th>" . _('Area') . "</th> - <th>" . _('Stock Category') . "</th> - <th>" . _('Sales Type') . "</th> - <th>" . _('COGS Account') . "</th> - </tr>"; + echo '<tr><th>' . _('Area') . '</th> + <th>' . _('Stock Category') . '</th> + <th>' . _('Sales Type') . '</th> + <th>' . _('COGS Account') . '</th> + </tr>'; $k=0; //row colour counter while ($myrow = DB_fetch_row($result)) { @@ -116,9 +116,9 @@ $myrow[2], $myrow[3], $myrow[4], - $_SERVER['PHP_SELF'] . '?' . SID . '&', + $_SERVER['PHP_SELF'] . '?', $myrow[0], - $_SERVER['PHP_SELF']. '?' . SID . '&', + $_SERVER['PHP_SELF']. '?', $myrow[0]); }//end while echo '</table>'; @@ -146,13 +146,13 @@ sequenceintb ) VALUES ( 'Sales', - 1, - 1, - 10)"; + '1', + '1', + '10')"; $result = DB_query($sql,$db); } - $sql = 'SELECT accountcode FROM chartmaster WHERE accountcode =1'; + $sql = "SELECT accountcode FROM chartmaster WHERE accountcode ='1' "; $result = DB_query($sql,$db); if (DB_num_rows($result)==0){ /* account number 1 is not used, so insert a new account */ @@ -162,7 +162,7 @@ group_ ) VALUES ( - 1, + '1', 'Default Sales/Discounts', 'Sales' )"; @@ -177,7 +177,7 @@ VALUES ('AN', 'ANY', 'AN', - 1)"; + '1')"; $result = DB_query($sql,$db); } @@ -194,14 +194,11 @@ $result = DB_query($sql,$db); echo '<table class=selection>'; - echo '<tr><th>' . _('Area') . - '</th><th>' . _('Stock Category') . - '</th><th>' . _('Sales Type') . - '</th><th>' . _('GL Account') . - '</th></tr>'; - + echo '<tr><th>' . _('Area') . '</th> + <th>' . _('Stock Category') . '</th> + <th>' . _('Sales Type') . '</th> + <th>' . _('GL Account') . '</th></tr>'; $k = 0; - while ($myrow = DB_fetch_row($result)) { if ($k==1){ echo '<tr class="EvenTableRows">'; @@ -222,9 +219,9 @@ $myrow[2], $myrow[3], $myrow[4], - $_SERVER['PHP_SELF'] . '?' . SID . '&', + $_SERVER['PHP_SELF'] . '?', $myrow[0], - $_SERVER['PHP_SELF'] . '?' . SID . '&', + $_SERVER['PHP_SELF'] . '?', $myrow[0]); }//END WHILE LIST LOOP @@ -234,12 +231,12 @@ //end of ifs and buts! if (isset($SelectedCOGSPostingID)) { - echo "<div class='centre'><a href=" . $_SERVER['PHP_SELF'] .">" . _('Show all cost of sales posting records') . "</a></div>"; + echo '<div class="centre"><a href="' . $_SERVER['PHP_SELF'] .'">' . _('Show all cost of sales posting records') . '</a></div>'; } -echo "<p>"; +echo '<p />'; -echo "<form method='post' action=" . $_SERVER['PHP_SELF'] . ">"; +echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; if (isset($SelectedCOGSPostingID)) { @@ -265,20 +262,23 @@ } //end of if $SelectedCOGSPostingID only do the else when a new record is being entered -$sql = "SELECT areacode, +$sql = 'SELECT areacode, areadescription - FROM areas"; + FROM areas'; $result = DB_query($sql,$db); -echo "<table class=selection><tr><td>" . _('Area') . ":</td><td><select tabindex=1 name='Area'><option value='AN'>" . _('Any Other'); +echo '<table class=selection> + <tr><td>' . _('Area') . ':</td> + <td><select tabindex=1 name="Area"> + <option value="AN">' . _('Any Other') . '</option>'; while ($myrow = DB_fetch_array($result)) { if (isset($_POST['Area']) and $myrow['areacode']==$_POST['Area']) { - echo "<option selected VALUE='"; + echo '<option selected VALUE="'; } else { - echo "<option VALUE='"; + echo '<option VALUE="'; } - echo $myrow['areacode'] . "'>" . $myrow['areadescription']; + echo $myrow['areacode'] . '">' . $myrow['areadescription'] . '</option>'; } //end while loop DB_free_result($result); @@ -286,16 +286,18 @@ $sql = 'SELECT categoryid, categorydescription FROM stockcategory'; $result = DB_query($sql,$db); -echo "</select></td></tr><tr><td>" . _('Stock Category') . ":</td><td><select tabindex=2 name='StkCat'> - <option VALUE='ANY'>" . _('Any Other'); +echo '</select></td></tr> + <tr><td>' . _('Stock Category') . ':</td> + <td><select tabindex=2 name="StkCat"> + <option VALUE="ANY">' . _('Any Other') . '</option>'; while ($myrow = DB_fetch_array($result)) { if (isset($_POST['StkCat']) and $myrow["categoryid"]==$_POST['StkCat']) { - echo "<option selected VALUE='"; + echo '<option selected VALUE="'; } else { - echo "<option VALUE='"; + echo '<option VALUE="'; } - echo $myrow['categoryid'] . "'>" . $myrow['categorydescription']; + echo $myrow['categoryid'] . '">' . $myrow['categorydescription'] . '</option>'; } //end while loop @@ -304,23 +306,27 @@ $sql = 'SELECT typeabbrev, sales_type FROM salestypes'; $result = DB_query($sql,$db); -echo "</select></td></tr><tr><td>" . _('Sales Type') . " / " . _('Price List') . ":</td> - <td><select tabindex=3 name='SalesType'><option VALUE='AN'>" . _('Any Other'); +echo '</select></td></tr> + <tr><td>' . _('Sales Type') . ' / ' . _('Price List') . ':</td> + <td><select tabindex=3 name="SalesType"> + <option VALUE="AN">' . _('Any Other') . '</option>'; while ($myrow = DB_fetch_array($result)) { if (isset($_POST['SalesType']) and $myrow['typeabbrev']==$_POST['SalesType']) { - echo "<option selected VALUE='"; + echo '<option selected VALUE="'; } else { - echo "<option VALUE='"; + echo '<option VALUE="'; } - echo $myrow["typeabbrev"] . "'>" . $myrow['sales_type']; + echo $myrow['typeabbrev'] . '">' . $myrow['sales_type'] . '</option>'; } //end while loop -echo "</select></td></tr><tr><td>" . _('Post to GL account') . ":</td><td><select tabindex=4 name='GLCode'>"; +echo '</select></td></tr> + <tr><td>' . _('Post to GL account') . ':</td> + <td><select tabindex="4" name="GLCode">'; DB_free_result($result); -$sql = "SELECT chartmaster.accountcode, +$sql = 'SELECT chartmaster.accountcode, chartmaster.accountname FROM chartmaster, accountgroups @@ -328,23 +334,23 @@ AND accountgroups.pandl=1 ORDER BY accountgroups.sequenceintb, chartmaster.accountcode, - chartmaster.accountname"; + chartmaster.accountname'; $result = DB_query($sql,$db); while ($myrow = DB_fetch_array($result)) { if (isset($_POST['GLCode']) and $myrow['accountcode']==$_POST['GLCode']) { - echo "<option selected VALUE='"; + echo '<option selected VALUE="'; } else { - echo "<option VALUE='"; + echo '<option VALUE="'; } - echo $myrow['accountcode'] . "'>" . $myrow['accountcode'] . ' - ' . $myrow['accountname']; + echo $myrow['accountcode'] . '">' . $myrow['accountcode'] . ' - ' . $myrow['accountname'] . '</option>'; } //end while loop DB_free_result($result); -echo "</select></td></tr></table>"; -echo "<br><div class='centre'><input tabindex=5 type='Submit' name='submit' value=" . _('Enter Information') . "></form></div>"; +echo '</select></td></tr></table>'; +echo '<br /><div class="centre"><input tabindex="5" type="Submit" name="submit" value="' . _('Enter Information') . '"></form></div>'; include('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/CompanyPreferences.php =================================================================== --- trunk/CompanyPreferences.php 2011-03-28 09:49:25 UTC (rev 4520) +++ trunk/CompanyPreferences.php 2011-03-29 09:04:20 UTC (rev 4521) @@ -1,10 +1,7 @@ <?php -/* $Revision: 1.18 $ */ /* $Id$*/ -//$PageSecurity =10; - include('includes/session.inc'); $title = _('Company Preferences'); @@ -133,13 +130,13 @@ /* Alter the exchange rates in the currencies table */ /* Get default currency rate */ - $sql='SELECT rate from currencies WHERE currabrev="'.$_POST['CurrencyDefault'].'"'; + $sql="SELECT rate from currencies WHERE currabrev='" . $_POST['CurrencyDefault'] . "'"; $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); $NewCurrencyRate=$myrow[0]; /* Set new rates */ - $sql='UPDATE currencies SET rate=rate/"'.$NewCurrencyRate.'"'; + $sql="UPDATE currencies SET rate=rate/'".$NewCurrencyRate."'"; $ErrMsg = _('Could not update the currency rates'); $result = DB_query($sql,$db,$ErrMsg); @@ -163,36 +160,34 @@ echo '<table class=selection>'; if ($InputError != 1) { - $sql = "SELECT coyname, - gstno, - companynumber, - regoffice1, - regoffice2, - regoffice3, - regoffice4, - regoffice5, - regoffice6, - telephone, - fax, - email, - currencydefault, - debtorsact, - pytdiscountact, - creditorsact, - payrollact, - grnact, - exchangediffact, - purchasesexchangediffact, - retainedearnings, - gllink_debtors, - gllink_creditors, - gllink_stock, - freightact - FROM companies - WHERE coycode=1"; + $sql = 'SELECT coyname, + gstno, + companynumber, + regoffice1, + regoffice2, + regoffice3, + regoffice4, + regoffice5, + regoffice6, + telephone, + fax, + email, + currencydefault, + debtorsact, + pytdiscountact, + creditorsact, + payrollact, + grnact, + exchangediffact, + purchasesexchangediffact, + retainedearnings, + gllink_debtors, + gllink_creditors, + gllink_stock, + freightact + FROM companies + WHERE coycode=1'; - - $ErrMsg = _('The company preferences could not be retrieved because'); $result = DB_query($sql, $db,$ErrMsg); @@ -275,15 +270,15 @@ </tr>'; -$result=DB_query("SELECT currabrev, currency FROM currencies",$db); +$result=DB_query('SELECT currabrev, currency FROM currencies',$db); echo '<tr><td>' . _('Home Currency') . ':</td><td><select tabindex="13" Name=CurrencyDefault>'; while ($myrow = DB_fetch_array($result)) { if ($_POST['CurrencyDefault']==$myrow['currabrev']){ - echo "<option selected VALUE='". $myrow['currabrev'] . "'>" . $myrow['currency']; + echo '<option selected VALUE="'. $myrow['currabrev'] . '">' . $myrow['currency'] . '</option>'; } else { - echo "<option VALUE='". $myrow['currabrev'] . "'>" . $myrow['currency']; + echo '<option VALUE="' . $myrow['currabrev'] . '">' . $myrow['currency']. '</option>'; } } //end while loop @@ -291,21 +286,21 @@ echo '</select></td></tr>'; -$result=DB_query("SELECT accountcode, - accountname - FROM chartmaster, - accountgroups - WHERE chartmaster.group_=accountgroups.groupname - AND accountgroups.pandl=0 - ORDER BY chartmaster.accountcode",$db); +$result=DB_query('SELECT accountcode, + accountname + FROM chartmaster INNER JOIN accountgroups + ON chartmaster.group_=accountgroups.groupname + WHERE accountgroups.pandl=0 + ORDER BY chartmaster.accountcode',$db); -echo '<tr><td>' . _('Debtors Control GL Account') . ':</td><td><select tabindex="14" Name=DebtorsAct>'; +echo '<tr><td>' . _('Debtors Control GL Account') . ':</td> + <td><select tabindex="14" Name=DebtorsAct>'; while ($myrow = DB_fetch_row($result)) { if ($_POST['DebtorsAct']==$myrow[0]){ - echo "<option selected VALUE='". $myrow[0] . "'>" . $myrow[1] . ' ('.$myrow[0].')'; + echo '<option selected VALUE="'. $myrow[0] . '">' . $myrow[1] . ' ('.$myrow[0].')</option>'; } else { - echo "<option VALUE='". $myrow[0] . "'>" . $myrow[1] . ' ('.$myrow[0].')'; + echo '<option VALUE="'. $myrow[0] . '">' . $myrow[1] . ' ('.$myrow[0].')</option>'; } } //end while loop @@ -317,9 +312,9 @@ while ($myrow = DB_fetch_row($result)) { if ($_POST['CreditorsAct']==$myrow[0]){ - echo "<option selected VALUE='". $myrow[0] . "'>" . $myrow[1] . ' ('.$myrow[0].')'; + echo '<option selected VALUE="'. $myrow[0] . '">' . $myrow[1] . ' ('.$myrow[0].')</option>'; } else { - echo "<option VALUE='". $myrow[0] . "'>" . $myrow[1] . ' ('.$myrow[0].')'; + echo '<option VALUE="' . $myrow[0] . '">' . $myrow[1] . ' ('.$myrow[0].')</option>'; } } //end while loop @@ -331,9 +326,9 @@ while ($myrow = DB_fetch_row($result)) { if ($_POST['PayrollAct']==$myrow[0]){ - echo "<option selected VALUE='". $myrow[0] . "'>" . $myrow[1] . ' ('.$myrow[0].')'; + echo '<option selected VALUE="'. $myrow[0] . '">' . $myrow[1] . ' ('.$myrow[0].')</option>'; } else { - echo "<option VALUE='". $myrow[0] . "'>" . $myrow[1] . ' ('.$myrow[0].')'; + echo '<option VALUE="'. $myrow[0] . '">' . $myrow[1] . ' ('.$myrow[0].')</option>'; } } //end while loop @@ -345,22 +340,23 @@ while ($myrow = DB_fetch_row($result)) { if ($_POST['GRNAct']==$myrow[0]){ - echo "<option selected VALUE='". $myrow[0] . "'>" . $myrow[1] . ' ('.$myrow[0].')'; + echo '<option selected VALUE="'. $myrow[0] . '">' . $myrow[1] . ' ('.$myrow[0].')</option>'; } else { - echo "<option VALUE='". $myrow[0] . "'>" . $myrow[1] . ' ('.$myrow[0].')'; + echo '<option VALUE="'. $myrow[0] . '">' . $myrow[1] . ' ('.$myrow[0].')</option>'; } } //end while loop DB_data_seek($result,0); echo '</select></td></tr>'; -echo '<tr><td>' . _('Retained Earning Clearing GL Account') . ':</td><td><select tabindex="18" Name=RetainedEarnings>'; +echo '<tr><td>' . _('Retained Earning Clearing GL Account') . ':</td> + <td><select tabindex="18" Name="RetainedEarnings">'; while ($myrow = DB_fetch_row($result)) { if ($_POST['RetainedEarnings']==$myrow[0]){ - echo "<option selected VALUE='". $myrow[0] . "'>" . $myrow[1] . ' ('.$myrow[0].')'; + echo '<option selected VALUE="'. $myrow[0] . '">' . $myrow[1] . ' ('.$myrow[0].')</option>'; } else { - echo "<option VALUE='". $myrow[0] . "'>" . $myrow[1] . ' ('.$myrow[0].')'; + echo '<option VALUE="'. $myrow[0] . '">' . $myrow[1] . ' ('.$myrow[0].')</option>'; } } //end while loop @@ -368,21 +364,21 @@ echo '</select></td></tr>'; -echo '<tr><td>' . _('Freight Re-charged GL Account') . ':</td><td><select tabindex="19" Name=FreightAct>'; +echo '<tr><td>' . _('Freight Re-charged GL Account') . ':</td> + <td><select tabindex="19" Name="FreightAct">'; $result=DB_query('SELECT accountcode, - accountname - FROM chartmaster, - accountgroups - WHERE chartmaster.group_=accountgroups.groupname - AND accountgroups.pandl=1 - ORDER BY chartmaster.accountcode',$db); + accountname + FROM chartmaster INNER JOIN accountgroups + ON chartmaster.group_=accountgroups.groupname + WHERE accountgroups.pandl=1 + ORDER BY chartmaster.accountcode',$db); while ($myrow = DB_fetch_row($result)) { if ($_POST['FreightAct']==$myrow[0]){ - echo "<option selected VALUE='". $myrow[0] . "'>" . $myrow[1] . ' ('.$myrow[0].')'; + echo '<option selected VALUE="'. $myrow[0] . '">' . $myrow[1] . ' ('.$myrow[0].')</option>'; } else { - echo "<option VALUE='". $myrow[0] . "'>" . $myrow[1] . ' ('.$myrow[0].')'; + echo '<option VALUE="'. $myrow[0] . '">' . $myrow[1] . ' ('.$myrow[0].')</option>'; } } //end while loop @@ -390,13 +386,14 @@ echo '</select></td></tr>'; -echo '<tr><td>' . _('Sales Exchange Variances GL Account') . ':</td><td><select tabindex="20" Name=ExchangeDiffAct>'; +echo '<tr><td>' . _('Sales Exchange Variances GL Account') . ':</td> + <td><select tabindex="20" Name="ExchangeDiffAct">'; while ($myrow = DB_fetch_row($result)) { if ($_POST['ExchangeDiffAct']==$myrow[0]){ - echo "<option selected VALUE='". $myrow[0] . "'>" . $myrow[1] . ' ('.$myrow[0].')'; + echo '<option selected VALUE="'. $myrow[0] . '">' . $myrow[1] . ' ('.$myrow[0].')</option>'; } else { - echo "<option VALUE='". $myrow[0] . "'>" . $myrow[1] . ' ('.$myrow[0].')'; + echo '<option VALUE="'. $myrow[0] . '">' . $myrow[1] . ' ('.$myrow[0].')</option>'; } } //end while loop @@ -404,13 +401,14 @@ echo '</select></td></tr>'; -echo '<tr><td>' . _('Purchases Exchange Variances GL Account') . ':</td><td><select tabindex="21" Name=PurchasesExchangeDiffAct>'; +echo '<tr><td>' . _('Purchases Exchange Variances GL Account') . ':</td> + <td><select tabindex="21" Name="PurchasesExchangeDiffAct">'; while ($myrow = DB_fetch_row($result)) { if ($_POST['PurchasesExchangeDiffAct']==$myrow[0]){ - echo "<option selected VALUE='". $myrow[0] . "'>" . $myrow[1] . ' ('.$myrow[0].')'; + echo '<option selected VALUE="'. $myrow[0] . '">' . $myrow[1] . ' ('.$myrow[0].')</option>'; } else { - echo "<option VALUE='". $myrow[0] . "'>" . $myrow[1] . ' ('.$myrow[0].')'; + echo '<option VALUE="'. $myrow[0] . '">' . $myrow[1] . ' ('.$myrow[0].')</option>'; } } //end while loop @@ -418,13 +416,14 @@ echo '</select></td></tr>'; -echo '<tr><td>' . _('Payment Discount GL Account') . ':</td><td><select tabindex="22" Name=PytDiscountAct>'; +echo '<tr><td>' . _('Payment Discount GL Account') . ':</td> + <td><select tabindex="22" Name="PytDiscountAct">'; while ($myrow = DB_fetch_row($result)) { if ($_POST['PytDiscountAct']==$myrow[0]){ - echo "<option selected VALUE='". $myrow[0] . "'>" . $myrow[1] . ' ('.$myrow[0].')'; + echo '<option selected VALUE="'. $myrow[0] . '">' . $myrow[1] . ' ('.$myrow[0].')</option>'; } else { - echo "<option VALUE='". $myrow[0] . "'>" . $myrow[1] . ' ('.$myrow[0].')'; + echo '<option VALUE="'. $myrow[0] . '">' . $myrow[1] . ' ('.$myrow[0].')</option>'; } } //end while loop @@ -432,44 +431,47 @@ echo '</select></td></tr>'; -echo '<tr><td>' . _('Create GL entries for accounts receivable transactions') . ':</td><td><select tabindex="23" Name=GLLink_Debtors>'; +echo '<tr><td>' . _('Create GL entries for accounts receivable transactions') . ':</td> + <td><select tabindex="23" Name="GLLink_Debtors">'; if ($_POST['GLLink_Debtors']==0){ - echo '<option selected VALUE=0>' . _('No'); - echo '<option VALUE=1>' . _('Yes'); + echo '<option selected VALUE="0">' . _('No') . '</option>'; + echo '<option VALUE="1">' . _('Yes'). '</option>'; } else { - echo '<option selected VALUE=1>' . _('Yes'); - echo '<option VALUE=0>' . _('No'); + echo '<option selected VALUE="1">' . _('Yes'). '</option>'; + echo '<option VALUE="0">' . _('No'). '</option>'; } echo '</select></td></tr>'; -echo '<tr><td>' . _('Create GL entries for accounts payable transactions') . ':</td><td><select tabindex="24" Name=GLLink_Creditors>'; +echo '<tr><td>' . _('Create GL entries for accounts payable transactions') . ':</td> + <td><select tabindex="24" Name="GLLink_Creditors">'; if ($_POST['GLLink_Creditors']==0){ - echo '<option selected VALUE=0>' . _('No'); - echo '<option VALUE=1>' . _('Yes'); + echo '<option selected VALUE="0">' . _('No') . '</option>'; + echo '<option VALUE="1">' . _('Yes') . '</option>'; } else { - echo '<option selected VALUE=1>' . _('Yes'); - echo '<option VALUE=0>' . _('No'); + echo '<option selected VALUE="1">' . _('Yes') . '</option>'; + echo '<option VALUE="0">' . _('No') . '</option>'; } echo '</select></td></tr>'; -echo '<tr><td>' . _('Create GL entries for stock transactions') . '):</td><td><select tabindex="25" Name=GLLink_Stock>'; +echo '<tr><td>' . _('Create GL entries for stock transactions') . '):</td> + <td><select tabindex="25" Name="GLLink_Stock">'; -if ($_POST['GLLink_Stock']==0){ - echo '<option selected VALUE=0>' . _('No'); - echo '<option VALUE=1>' . _('Yes'); +if ($_POST['GLLink_Stock']=='0'){ + echo '<option selected VALUE="0">' . _('No') . '</option>'; + echo '<option VALUE="1">' . _('Yes') . '</option>'; } else { - echo '<option selected VALUE=1>' . _('Yes'); - echo '<option VALUE=0>' . _('No'); + echo '<option selected VALUE="1">' . _('Yes') . '</option>'; + echo '<option VALUE="0">' . _('No') . '</option>'; } echo '</select></td></tr>'; -echo '</table><br><div class="centre"><input tabindex="26" type="Submit" Name="submit" value="' . _('Update') . '"></div>'; +echo '</table><br /><div class="centre"><input tabindex="26" type="Submit" Name="submit" value="' . _('Update') . '"></div>'; include('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/Credit_Invoice.php =================================================================== --- trunk/Credit_Invoice.php 2011-03-28 09:49:25 UTC (rev 4520) +++ trunk/Credit_Invoice.php 2011-03-29 09:04:20 UTC (rev 4521) @@ -257,28 +257,28 @@ if (!isset($_POST['ProcessCredit'])) { - echo "<form action='" . $_SERVER['PHP_SELF'] . "?" . SID . "' method=post>"; + echo '<form action="' . $_SERVER['PHP_SELF'] .'" method="post">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo "<table cellpadding=2 colspan=7 class=selection><tr>"; - echo "<tr><th colspan=13>"; + echo '<table cellpadding="2" colspan="7" class="selection"><tr>'; + echo '<tr><th colspan="13">'; echo '<div class="centre"><font color=blue size=4><b>' . _('Credit Invoice') . ' ' . $_SESSION['ProcessingCredit'] . '</b> <b>'.' - ' . $_SESSION['CreditItems']->CustomerName . '</b></font> - <font size=3 color=blue> - ' . _('Credit Note amounts stated in') . ' ' . $_SESSION['CreditItems']->DefaultCurrency . "</div></font>"; - echo "</th></tr>"; - echo "<th>" . _('Item Code') . "</th> - <th>" . _('Item Description') . "</th> - <th>" . _('Invoiced') . "</th> - <th>" . _('Units') . "</th> - <th>" . _('Credit') . '<br>' . _('Quantity') . "</th> - <th>" . _('Price') . "</th> - <th>" . _('Discount') . ' %' . "</th> - <th>" . _('Total') . '<br>' . _('Excl Tax') . "</th> - <th>" . _('Tax Authority') . "</th> - <th>" . _('Tax') . ' %' . "</th> - <th>" . _('Tax') . '<br>' . _('Amount') . "</th> - <th>" . _('Total') . '<br>' . _('Incl Tax') . "</th></tr>"; + <font size=3 color=blue> - ' . _('Credit Note amounts stated in') . ' ' . $_SESSION['CreditItems']->DefaultCurrency . '</div></font>'; + echo '</th></tr>'; + echo '<th>' . _('Item Code') . '</th> + <th>' . _('Item Description') . '</th> + <th>' . _('Invoiced') . '</th> + <th>' . _('Units') . '</th> + <th>' . _('Credit') . '<br />' . _('Quantity') . '</th> + <th>' . _('Price') . '</th> + <th>' . _('Discount') . ' %' . '</th> + <th>' . _('Total') . '<br />' . _('Excl Tax') . '</th> + <th>' . _('Tax Authority') . '</th> + <th>' . _('Tax') . ' %' . '</th> + <th>' . _('Tax') . '<br />' . _('Amount') . '</th> + <th>' . _('Total') . '<br />' . _('Incl Tax') . '</th></tr>'; $_SESSION['CreditItems']->total = 0; $_SESSION['CreditItems']->totalVolume = 0; Modified: trunk/CustomerReceipt.php =================================================================== --- trunk/CustomerReceipt.php 2011-03-28 09:49:25 UTC (rev 4520) +++ trunk/CustomerReceipt.php 2011-03-29 09:04:20 UTC (rev 4521) @@ -1,11 +1,8 @@ <?php /* $Id$ */ -/* $Revision: 1.46 $ */ include('includes/DefineReceiptClass.php'); - -//$PageSecurity = 3; now retrieved from the DB include('includes/session.inc'); $title = _('Receipt Entry'); @@ -127,7 +124,7 @@ $SuggestedFunctionalExRate = $myrow[0]; /*Get the exchange rate between the functional currency and the receipt currency*/ - $result = DB_query("select rate FROM currencies WHERE currabrev='" . $_SESSION['ReceiptBatch']->Currency . "'",$db); + $result = DB_query("SELECT rate FROM currencies WHERE currabrev='" . $_SESSION['ReceiptBatch']->Currency . "'",$db); $myrow = DB_fetch_row($result); $tableExRate = $myrow[0]; //this is the rate of exchange between the functional currency and the receipt currency /*Calculate cross rate to suggest appropriate exchange rate between receipt currency and account currency */ @@ -212,7 +209,7 @@ } /*Make an array of the defined bank accounts */ - $SQL = "SELECT accountcode FROM bankaccounts"; + $SQL = 'SELECT accountcode FROM bankaccounts'; $result = DB_query($SQL,$db); $BankAccounts = array(); $i=0; @@ -267,13 +264,13 @@ if ($ReceiptItem->GLCode !=''){ //so its a GL receipt if ($_SESSION['CompanyRecord']['gllink_debtors']==1){ /* then enter a GLTrans record */ $SQL = "INSERT INTO gltrans (type, - typeno, - trandate, - periodno, - account, - narrative, - amount, - tag) + typeno, + trandate, + periodno, + account, + narrative, + amount, + tag) VALUES ( 12, '" . $_SESSION['ReceiptBatch']->BatchNo . "', @@ -341,15 +338,15 @@ $PaymentTransNo = GetNextTransNo( 1, $db); $SQL="INSERT INTO banktrans (transno, - type, - bankact, - ref, - exrate, - functionalexrate, - transdate, - banktranstype, - amount, - currcode) + type, + bankact, + ref, + exrate, + functionalexrate, + transdate, + banktranstype, + amount, + currcode) VALUES ( '" . $PaymentTransNo . "', 1, @@ -374,18 +371,18 @@ /*Create a DebtorTrans entry for each customer deposit */ $SQL = "INSERT INTO debtortrans (transno, - type, - debtorno, - branchcode, - trandate, - inputdate, - prd, - reference, - tpe, - rate, - ovamount, - ovdiscount, - invtext) + type, + debtorno, + branchcode, + trandate, + inputdate, + prd, + reference, + tpe, + rate, + ovamount, + ovdiscount, + invtext) VALUES ( '" . $_SESSION['ReceiptBatch']->BatchNo . "', 12, @@ -426,12 +423,12 @@ if ($BatchReceiptsTotal!=0){ /* Bank account entry first */ $SQL="INSERT INTO gltrans (type, - typeno, - trandate, - periodno, - account, - narrative, - amount) + typeno, + trandate, + periodno, + account, + narrative, + amount) VALUES ( 12, '" . $_SESSION['ReceiptBatch']->BatchNo . "', @@ -448,15 +445,15 @@ /*now enter the BankTrans entry */ $SQL="INSERT INTO banktrans (type, - transno, - bankact, - ref, - exrate, - functionalexrate, - transdate, - banktranstype, - amount, - currcode) + transno, + bankact, + ref, + exrate, + functionalexrate, + transdate, + banktranstype, + amount, + currcode) VALUES ( 12, '" . $_SESSION['ReceiptBatch']->BatchNo . "', @@ -476,12 +473,12 @@ if ($BatchDebtorTotal!=0){ /* Now Credit Debtors account with receipts + discounts */ $SQL="INSERT INTO gltrans ( type, - typeno, - trandate, - periodno, - account, - narrative, - amount) + typeno, + trandate, + periodno, + account, + narrative, + amount) VALUES ( 12, '" . $_SESSION['ReceiptBatch']->BatchNo . "', @@ -500,12 +497,12 @@ if ($BatchDiscount!=0){ /* Now Debit Discount account with discounts allowed*/ $SQL="INSERT INTO gltrans ( type, - typeno, - trandate, - periodno, - account, - narrative, - amount) + typeno, + trandate, + periodno, + account, + narrative, + amount) VALUES ( 12, '" . $_SESSION['ReceiptBatch']->BatchNo . "', @@ -552,7 +549,7 @@ $SQL = "SELECT debtorsmaster.debtorno, debtorsmaster.name FROM debtorsmaster - WHERE debtorsmaster.name LIKE '". $SearchString."' + WHERE debtorsmaster.name " . LIKE . " '". $SearchString . "' AND debtorsmaster.currcode= '" . $_SESSION['ReceiptBatch']->Currency . "'"; } elseif (strlen($_POST['CustCode'])>0){ @@ -665,22 +662,22 @@ $NIL_BALANCE = True; $SQL = "SELECT debtorsmaster.name, - debtorsmaster.pymtdiscount, - currencies.currency, - currencies.rate, - paymentterms.terms, - debtorsmaster.creditlimit, - debtorsmaster.currcode, - holdreasons.dissallowinvoices, - holdreasons.reasondescription - FROM debtorsmaster, - paymentterms, - holdreasons, - currencies - WHERE debtorsmaster.paymentterms = paymentterms.termsindicator - AND debtorsmaster.currcode = currencies.currabrev - AND debtorsmaster.holdreason = holdreasons.reasoncode - AND debtorsmaster.debtorno = '" . $_POST['CustomerID'] . "'"; + debtorsmaster.pymtdiscount, + currencies.currency, + currencies.rate, + paymentterms.terms, + debtorsmaster.creditlimit, + debtorsmaster.currcode, + holdreasons.dissallowinvoices, + holdreasons.reasondescription + FROM debtorsmaster, + paymentterms, + holdreasons, + currencies + WHERE debtorsmaster.paymentterms = paymentterms.termsindicator + AND debtorsmaster.currcode = currencies.currabrev + AND debtorsmaster.holdreason = holdreasons.reasoncode + AND debtorsmaster.debtorno = '" . $_POST['CustomerID'] . "'"; $ErrMsg = _('The customer details could not be retrieved because'); $DbgMsg = _('The SQL that failed was'); @@ -813,7 +810,7 @@ <td>' . ' ' . $SuggestedFunctionalExRateText . ' <i>' . _('The exchange rate between the currency of the business (the functional currency) and the currency of the bank account') . '. 1 ' . $_SESSION['CompanyRecord']['currencydefault'] . ' = ? ' . $_SESSION['ReceiptBatch']->AccountCurrency . '</i></td></tr>'; } -echo '<tr><td>' . _('Receipt Type') . ":</td><td><select tabindex=6 name=ReceiptType>"; +echo '<tr><td>' . _('Receipt Type') . ':</td><td><select tabindex=6 name="ReceiptType">'; include('includes/GetPaymentMethods.php'); /* The array ReceiptTypes is defined from the setup tab of the main menu under payment methods - the array is populated from the include file GetPaymentMethods.php */ @@ -853,7 +850,7 @@ foreach ($_SESSION['ReceiptBatch']->Items as $ReceiptItem) { - $SQL = "select accountname FROM chartmaster WHERE accountcode='" . $ReceiptItem->GLCode . "'"; + $SQL = "SELECT accountname FROM chartmaster WHERE accountcode='" . $ReceiptItem->GLCode . "'"; $Result=DB_query($SQL,$db); $myrow=DB_fetch_array($Result); @@ -863,11 +860,9 @@ <td>' . stripslashes($ReceiptItem->CustomerName) . '</td> <td>'.$ReceiptItem->GLCode.' - '.$myrow['accountname'].'</td> <td>'.$ReceiptItem->Narrative . "</td> - <td><a href='" . $_SERVER['PHP_SELF'] . '?' . SID . '&Delete=' . $ReceiptItem->ID . "&Type=".$_GET['Type']."'>" . _('Delete') . '</a></td> + <td><a href='" . $_SERVER['PHP_SELF'] . '?Delete=' . $ReceiptItem->ID . "&Type=".$_GET['Type']."'>" . _('Delete') . '</a></td> </tr>'; - $BatchTotal= $BatchTotal + $ReceiptItem->Amount; - } echo '<tr><td class=number><b>' . number_format($BatchTotal,2) . '</b></td></tr></table>'; @@ -939,7 +934,7 @@ echo '<tr><td>' . _('Select Tag') . ':</td><td><select name="tag">'; $SQL = 'SELECT tagref, - tagdescription + tagdescription FROM tags ORDER BY tagref'; @@ -947,9 +942,9 @@ echo '<option value=0></option>'; 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>'; @@ -1075,7 +1070,7 @@ } //end if results to show if (isset($_SESSION['ReceiptBatch']->Items) and count($_SESSION['ReceiptBatch']->Items) > 0){ - echo '<div class="centre"><br/><input tabindex=13 type=submit name="CommitBatch" VALUE="' . _('Accept and Process Batch') . '"></div>'; + echo '<div class="centre"><br/><input tabindex="13" type="submit" name="CommitBatch" VALUE="' . _('Accept and Process Batch') . '"></div>'; } } Modified: trunk/Customers.php =================================================================== --- trunk/Customers.php 2011-03-28 09:49:25 UTC (rev 4520) +++ trunk/Customers.php 2011-03-29 09:04:20 UTC (rev 4521) @@ -1,10 +1,7 @@ <?php /* $Id$ */ -/* $Revision: 1.44 $ */ -//$PageSecurity = 3; - include('includes/session.inc'); $title = _('Customer Maintenance'); @@ -56,9 +53,6 @@ prnMsg( _('The customer code cannot contain any of the following characters') . " . - ' & + \" " . _('or a space'),'error'); $Errors[$i] = 'DebtorNo'; $i++; -// } elseif (ContainsIllegalCharacters($_POST['Address1']) OR ContainsIllegalCharacters($_POST['Address2'])) { -// $InputError = 1; -// prnMsg( _('Lines of the address must not contain illegal characters'),'error'); } elseif (strlen($_POST['Address1']) >40) { $InputError = 1; prnMsg( _('The Line 1 of the address must be forty characters or less long'),'error'); @@ -225,7 +219,7 @@ $ErrMsg = _('The customer could not be updated because'); $result = DB_query($sql,$db,$ErrMsg); prnMsg( _('Customer updated'),'success'); - echo '<br>'; + echo '<br />'; } else { //it is a new customer /* set the DebtorNo if $AutoDebtorNo in config.php has been set to @@ -314,7 +308,7 @@ if ($myrow[0]>0) { $CancelDelete = 1; prnMsg( _('This customer cannot be deleted because there are transactions that refer to it'),'warn'); - echo '<br> ' . _('There are') . ' ' . $myrow[0] . ' ' . _('transactions against this customer'); + echo '<br /> ' . _('There are') . ' ' . $myrow[0] . ' ' . _('transactions against this customer'); } else { $sql= "SELECT COUNT(*) FROM salesorders WHERE debtorno='" . $_POST['DebtorNo'] . "'"; @@ -323,7 +317,7 @@ if ($myrow[0]>0) { $CancelDelete = 1; prnMsg( _('Cannot delete the customer record because orders have been created against it'),'warn'); - echo '<br> ' . _('There are') . ' ' . $myrow[0] . ' ' . _('orders against this customer'); + echo '<br /> ' . _('There are') . ' ' . $myrow[0] . ' ' . _('orders against this customer'); } else { $sql= "SELECT COUNT(*) FROM salesanalysis WHERE cust='" . $_POST['DebtorNo'] . "'"; $result = DB_query($sql,$db); @@ -331,7 +325,7 @@ if ($myrow[0]>0) { $CancelDelete = 1; prnMsg( _('Cannot delete this customer record because sales analysis records exist for it'),'warn'); - echo '<br> ' . _('There are') . ' ' . $myrow[0] . ' ' . _('sales analysis records against this customer'); + echo '<br /> ' . _('There are') . ' ' . $myrow[0] . ' ' . _('sales analysis records against this customer'); } else { $sql= "SELECT COUNT(*) FROM custbranch WHERE debtorno='" . $_POST['DebtorNo'] . "'"; $result = DB_query($sql,$db); @@ -339,7 +333,7 @@ if ($myrow[0]>0) { $CancelDelete = 1; prnMsg(_('Cannot delete this customer because there are branch records set up against it'),'warn'); - echo '<br> ' . _('There are') . ' ' . $myrow[0] . ' ' . _('branch records relating to this customer'); + echo '<br /> ' . _('There are') . ' ' . $myrow[0] . ' ' . _('branch records relating to this customer'); } } } @@ -418,7 +412,7 @@ } // This link is already on menu bar -//echo "<a href='" . $rootpath . '/SelectCustomer.php?' . SID . "'>" . _('Back to Customers') . '</a><br>'; +//echo "<a href='" . $rootpath . '/SelectCustomer.php?' . SID . "'>" . _('Back to Customers') . '</a><br />'; if (!isset($DebtorNo)) { @@ -494,7 +488,7 @@ $result=DB_query('SELECT typeabbrev, sales_type FROM salestypes ',$db); if (DB_num_rows($result)==0){ $DataError =1; - echo '<a href="SalesTypes.php?" target="_parent">Setup Types</a>'; + echo '<a href="SalesTypes.php?" target="_parent">' . _('Setup Types') . '</a>'; echo '<tr><td colspan=2>' . prnMsg(_('No sales types/price lists defined'),'error') . '</td></tr>'; } else { echo '<tr><td>' . _('Sales Type/Price List') . ':</td> @@ -508,10 +502,10 @@ } // Show Customer Type drop down list - $result=DB_query('SELECT typeid, typename FROM debtortype ',$db); + $result=DB_query('SELECT typeid, typename FROM debtortype', $db); if (DB_num_rows($result)==0){ $DataError =1; - echo '<a href="SalesTypes.php?" target="_parent">Setup Types</a>'; + echo '<a href="SalesTypes.php?" target="_parent">' . _('Setup Types') . '</a>'; echo '<tr><td colspan=2>' . prnMsg(_('No Customer types/price lists defined'),'error') . '</td></tr>'; } else { echo '<tr><td>' . _('Customer Type') . ':</td> @@ -524,12 +518,9 @@ echo '</select></td></tr>'; } - - - - $DateString = Date($_SESSION['DefaultDateFormat']); - echo '<tr><td>' . _('Customer Since') . ' (' . $_SESSION['DefaultDateFormat'] . '):</td><td><input tabindex=10 type="text" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" name="ClientSince" value="' . $DateString . '" size=12 maxlength=10></td></tr>'; + echo '<tr><td>' . _('Customer Since') . ' (' . $_SESSION['DefaultDateFormat'] . '):</td> + <td><input tabindex=10 type="text" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" name="ClientSince" value="' . $DateString . '" size=12 maxlength=10></td></tr>'; echo '<tr><td>' . _('Discount Percent') . ':</td> <td><input tabindex=11 type="textbox" class="number" name="Discount" value=0 size=5 maxlength=4></td></tr>'; echo '<tr><td>' . _('Discount Code') . ':</td> @@ -594,20 +585,19 @@ echo '</select></td></tr>'; } - /*added line 8/23/2007 by Morris Kelly to set po line parameter Y/N*/ - echo '<tr><td>' . _('Customer PO Line on SO') . ":</td><td><select tabindex=18 name='CustomerPOLine'>"; - echo '<option selected value=0>' . _('No'); - echo '<option value=1>' . _('Yes'); + echo '<tr><td>' . _('Customer PO Line on SO') . ':</td><td><select tabindex="18" name="CustomerPOLine">'; + echo '<option selected value=0>' . _('No') . '</option>'; + echo '<option value=1>' . _('Yes') . '</option>'; echo '</select></td></tr>'; - echo '<tr><td>' . _('Invoice Addressing') . ":</td><td><select tabindex=19 name='AddrInvBranch'>"; + echo '<tr><td>' . _('Invoice Addressing') . ':</td><td><select tabindex="19" name="AddrInvBranch">'; echo '<option selected VALUE=0>' . _('Address to HO'); echo '<option VALUE=1>' . _('Address to Branch'); echo '</select></td></tr>'; echo'</table></td></tr></table>'; if ($DataError ==0){ - echo "<br><div class='centre'><input tabindex=20 type='Submit' name='submit' value='" . _('Add New Customer') . "'> <input tabindex=21 type=submit action=RESET VALUE='" . _('Reset') . "'></div>"; + echo "<br /><div class='centre'><input tabindex=20 type='Submit' name='submit' value='" . _('Add New Customer') . "'> <input tabindex=21 type=submit action=RESET VALUE='" . _('Reset') . "'></div>"; } echo '</form>'; @@ -990,7 +980,7 @@ Where debtorno='".$DebtorNo."' and contid='".$Edit."'"; $resultupcc = DB_query($SQLupdatecc,$db); - echo '<br>'.$SQLupdatecc; + echo '<br />'.$SQLupdatecc; echo '<meta http-equiv="Refresh" content="0; url="' . $_SERVER['PHP_SELF'] . '?'.SID.'&DebtorNo='.$DebtorNo.'&ID='.$ID.'">'; } if (isset($_GET['delete'])) { @@ -999,7 +989,7 @@ $resultupcc = DB_query($SQl,$db); echo '<meta http-equiv="Refresh" content="0; url=' . $_SERVER['PHP_SELF'] . '?'.SID.'&DebtorNo='.$DebtorNo.'">'; - echo '<br>'.$SQl; + echo '<br />'.$SQl; prnmsg('Contact Deleted','success'); } @@ -1007,18 +997,18 @@ echo'</td></tr></table>'; if (isset($_POST['New']) and $_POST['New']) { - echo "<div class='centre'><input type='Submit' name='submit' VALUE='" . _('Add New Customer') . - "'> <input type=submit name='reset' VALUE='" . _('Reset') . "'></div></form>"; + echo '<div class="centre"><input type="Submit" name="submit" VALUE="' . _('Add New Customer') . + '"> <input type=submit name="reset" VALUE="' . _('Reset') . '"></div></form>'; } else if (!isset($_GET['Modify'])){ - echo "<br><div class='centre'><input type='Submit' name='submit' VALUE='" . _('Update Customer') . "'>"; + echo '<br /><div class="centre"><input type="Submit" name="submit" VALUE="' . _('Update Customer') . '">'; echo ' <input type="Submit" name="delete" VALUE="' . _('Delete Customer') . '" onclick="return confirm(\'' . _('Are You Sure?') . '\');">'; } if(isset($_POST['addcontact']) AND (isset($_POST['addcontact'])!='')) { - echo '<meta http-equiv="Refresh" content="0; url=' . $rootpath . '/AddCustomerContacts.php?' . SID . '&DebtorNo=' .$DebtorNo.'">'; + echo '<meta http-equiv="Refresh" content="0; url=' . $rootpath . '/AddCustomerContacts.php?DebtorNo=' .$DebtorNo.'">'; } echo '</div>'; } // end of main ifs include('includes/footer.inc'); -?> +?> \ No newline at end of file Modified: trunk/MRP.php ===========================================... [truncated message content] |