From: <dai...@us...> - 2011-04-19 10:18:58
|
Revision: 4555 http://web-erp.svn.sourceforge.net/web-erp/?rev=4555&view=rev Author: daintree Date: 2011-04-19 10:18:49 +0000 (Tue, 19 Apr 2011) Log Message: ----------- more quoting xhtml sql Modified Paths: -------------- trunk/DebtorsAtPeriodEnd.php trunk/DeliveryDetails.php trunk/DiscountCategories.php trunk/DiscountMatrix.php trunk/EDIMessageFormat.php trunk/EmailCustTrans.php trunk/ExchangeRateTrend.php trunk/FixedAssetCategories.php trunk/GLAccountInquiry.php trunk/GLBalanceSheet.php trunk/GLBudgets.php trunk/GLTags.php trunk/GLTrialBalance.php trunk/GoodsReceived.php trunk/InventoryQuantities.php trunk/InventoryValuation.php trunk/Locations.php trunk/MRPReschedules.php trunk/OutstandingGRNs.php trunk/geo_displaymap_customers.php trunk/geo_displaymap_suppliers.php trunk/includes/ConnectDB_mysqli.inc trunk/includes/PDFInventoryValnPageHeader.inc trunk/locale/en_GB.utf8/LC_MESSAGES/messages.pot trunk/sql/mysql/upgrade3.11.1-4.00.sql trunk/sql/mysql/weberp-demo.sql trunk/sql/mysql/weberp-new.sql Modified: trunk/DebtorsAtPeriodEnd.php =================================================================== --- trunk/DebtorsAtPeriodEnd.php 2011-04-18 07:49:36 UTC (rev 4554) +++ trunk/DebtorsAtPeriodEnd.php 2011-04-19 10:18:49 UTC (rev 4555) @@ -1,9 +1,7 @@ <?php -//$PageSecurity = 2; /* $Id$*/ -/* $Revision: 1.16 $ */ include('includes/session.inc'); if (isset($_POST['PrintPDF']) @@ -58,9 +56,9 @@ $title = _('Customer Balances') . ' - ' . _('Problem Report'); include('includes/header.inc'); prnMsg(_('The customer details 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; @@ -70,7 +68,7 @@ $title = _('Customer Balances') . ' - ' . _('Problem Report'); include('includes/header.inc'); prnMsg(_('The customer details listing has no clients to report on'),'warn'); - 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>'; include('includes/footer.inc'); exit; } @@ -115,22 +113,10 @@ $LeftOvers = $pdf->addTextWrap(50,$YPos,160,$FontSize,_('Total balances'),'left'); $LeftOvers = $pdf->addTextWrap(220,$YPos,60,$FontSize,$DisplayTotBalance,'right'); - /* UldisN - $buf = $pdf->output(); - $len = strlen($buf); + + $pdf->OutputD($_SESSION['DatabaseName'] . '_DebtorBals_' . date('Y-m-d').'.pdf'); + $pdf->__destruct(); - header('Content-type: application/pdf'); - header("Content-Length: ".$len); - header('Content-Disposition: inline; filename=DebtorBals.pdf'); - header('Expires: 0'); - header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); - header('Pragma: public'); - - $pdf->stream(); - */ - $pdf->OutputD($_SESSION['DatabaseName'] . '_DebtorBals_' . date('Y-m-d').'.pdf');//UldisN - $pdf->__destruct(); //UldisN - } else { /*The option to print PDF was not hit */ $title=_('Debtor Balances'); @@ -142,29 +128,33 @@ /*if $FromCriteria is not set then show a form to allow input */ - echo '<form action=' . $_SERVER['PHP_SELF'] . " method='POST'><table class=selection>"; + echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post"> + <table class="selection">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<tr><td>' . _('From Customer Code') .":</font></td><td><input tabindex=1 Type=text maxlength=6 size=7 name=FromCriteria value='1'></td></tr>"; - echo '<tr><td>' . _('To Customer Code') . ":</td><td><input tabindex=2 Type=text maxlength=6 size=7 name=ToCriteria value='zzzzzz'></td></tr>"; + echo '<tr><td>' . _('From Customer Code') .':</font></td> + <td><input tabindex=1 Type=text maxlength=6 size=7 name="FromCriteria" value="1"></td> + </tr>'; + echo '<tr><td>' . _('To Customer Code') . ':</td> + <td><input tabindex=2 type="text" maxlength=6 size=7 name="ToCriteria" value="zzzzzz"></td></tr>'; - echo '<tr><td>' . _('Balances As At') . ":</td><td><select tabindex=3 Name='PeriodEnd'>"; + echo '<tr><td>' . _('Balances As At') . ':</td> + <td><select tabindex=3 name="PeriodEnd">'; - $sql = 'SELECT periodno, lastdate_in_period FROM periods ORDER BY periodno DESC'; + $sql = "SELECT periodno, lastdate_in_period FROM periods ORDER BY periodno DESC"; $Periods = DB_query($sql,$db,_('Could not retrieve period data because'),_('The SQL that failed to get the period data was')); while ($myrow = DB_fetch_array($Periods,$db)){ - 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>'; + echo '</table> + <br /><div class="centre"><input tabindex=5 type=submit name="PrintPDF" value="' . _('Print PDF') . '"></div>'; - - echo "</table><br><div class='centre'><input tabindex=5 type=Submit Name='PrintPDF' Value='" . _('Print PDF') . "'></div>"; - include('includes/footer.inc'); } /*end of else not PrintPDF */ Modified: trunk/DeliveryDetails.php =================================================================== --- trunk/DeliveryDetails.php 2011-04-18 07:49:36 UTC (rev 4554) +++ trunk/DeliveryDetails.php 2011-04-19 10:18:49 UTC (rev 4555) @@ -10,7 +10,6 @@ /* Session started in header.inc for password checking the session will contain the details of the order from the Cart class object. The details of the order come from SelectOrderItems.php */ -//$PageSecurity=1; include('includes/session.inc'); $title = _('Order Delivery Details'); include('includes/header.inc'); @@ -644,35 +643,35 @@ WHERE orderno='" .$_SESSION['ExistingOrder'] . "'", $db,$ErrMsg,$DbgMsg,true); $ErrMsg = _('Could not insert the contract bill of materials'); $InsContractBOM = DB_query("INSERT INTO bom (parent, - component, - workcentreadded, - loccode, - effectiveafter, - effectiveto) - SELECT contractref, - stockid, - workcentreadded, - '" . $_SESSION['Items'.$identifier]->Location ."', - '" . Date('Y-m-d') . "', - '2037-12-31' - FROM contractbom - WHERE contractref='" . $ContractRow['contractref'] . "'",$db,$ErrMsg,$DbgMsg); + component, + workcentreadded, + loccode, + effectiveafter, + effectiveto) + SELECT contractref, + stockid, + workcentreadded, + '" . $_SESSION['Items'.$identifier]->Location ."', + '" . Date('Y-m-d') . "', + '2037-12-31' + FROM contractbom + WHERE contractref='" . $ContractRow['contractref'] . "'",$db,$ErrMsg,$DbgMsg); $ErrMsg = _('Unable to insert a new work order for the sales order item'); $InsWOResult = DB_query("INSERT INTO workorders (wo, - loccode, - requiredby, - startdate) - VALUES ('" . $WONo . "', - '" . $_SESSION['Items'.$identifier]->Location ."', - '" . $ContractRow['requireddate'] . "', - '" . Date('Y-m-d'). "')", - $db,$ErrMsg,$DbgMsg); + loccode, + requiredby, + startdate) + VALUES ('" . $WONo . "', + '" . $_SESSION['Items'.$identifier]->Location ."', + '" . $ContractRow['requireddate'] . "', + '" . Date('Y-m-d'). "')", + $db,$ErrMsg,$DbgMsg); //Need to get the latest BOM to roll up cost but also add the contract other requirements $CostResult = DB_query("SELECT SUM((materialcost+labourcost+overheadcost)*contractbom.quantity) AS cost - FROM stockmaster INNER JOIN contractbom - ON stockmaster.stockid=contractbom.stockid - WHERE contractbom.contractref='" . $ContractRow['contractref'] . "'", + FROM stockmaster INNER JOIN contractbom + ON stockmaster.stockid=contractbom.stockid + WHERE contractbom.contractref='" . $ContractRow['contractref'] . "'", $db); $CostRow = DB_fetch_row($CostResult); if (is_null($CostRow[0]) OR $CostRow[0]==0){ @@ -682,8 +681,8 @@ $Cost = $CostRow[0]; //cost of contract BOM } $CostResult = DB_query("SELECT SUM(costperunit*quantity) AS cost - FROM contractreqts - WHERE contractreqts.contractref='" . $ContractRow['contractref'] . "'", + FROM contractreqts + WHERE contractreqts.contractref='" . $ContractRow['contractref'] . "'", $db); $CostRow = DB_fetch_row($CostResult); //add other requirements cost to cost of contract BOM @@ -750,13 +749,13 @@ } $LineItemsSQL = "UPDATE salesorderdetails SET unitprice='" . $StockItem->Price . "', - quantity='" . $StockItem->Quantity . "', - discountpercent='" . floatval($StockItem->DiscountPercent) . "', - completed='" . $Completed . "', - poline='" . $StockItem->POLine . "', - itemdue='" . FormatDateForSQL($StockItem->ItemDue) . "' - WHERE salesorderdetails.orderno='" . $_SESSION['ExistingOrder'] . "' - AND salesorderdetails.orderlineno='" . $StockItem->LineNumber . "'"; + quantity='" . $StockItem->Quantity . "', + discountpercent='" . floatval($StockItem->DiscountPercent) . "', + completed='" . $Completed . "', + poline='" . $StockItem->POLine . "', + itemdue='" . FormatDateForSQL($StockItem->ItemDue) . "' + WHERE salesorderdetails.orderno='" . $_SESSION['ExistingOrder'] . "' + AND salesorderdetails.orderlineno='" . $StockItem->LineNumber . "'"; $DbgMsg = _('The SQL that was used to modify the order line and failed was'); $ErrMsg = _('The updated order line cannot be modified because'); @@ -771,10 +770,24 @@ prnMsg(_('Order Number') .' ' . $_SESSION['ExistingOrder'] . ' ' . _('has been updated'),'success'); - echo '<br /><table class=selection><tr><td><img src="'.$rootpath.'/css/'.$theme.'/images/printer.png" title="' . _('Print') . '" alt=""></td><td><a href="' . $rootpath . '/PrintCustOrder.php?identifier='.$identifier . '&TransNo=' . $_SESSION['ExistingOrder'] . '">'. _('Print packing slip - pre-printed stationery') .'</a></td></tr>'; - echo '<tr><td><img src="'.$rootpath.'/css/'.$theme.'/images/printer.png" title="' . _('Print') . '" alt=""></td><td><a target="_blank" href="' . $rootpath . '/PrintCustOrder_generic.php?identifier='.$identifier . '&TransNo=' . $_SESSION['ExistingOrder'] . '">'. _('Print packing slip') . ' (' . _('Laser') . ')' .'</a></td></tr>'; - echo '<tr><td><img src="'.$rootpath.'/css/'.$theme.'/images/reports.png" title="' . _('Invoice') . '" alt=""></td><td><a href="' . $rootpath .'/ConfirmDispatch_Invoice.php?identifier='.$identifier . '&OrderNumber=' . $_SESSION['ExistingOrder'] . '">'. _('Confirm Order Delivery Quantities and Produce Invoice') .'</a></td></tr>'; - echo '<tr><td><img src="'.$rootpath.'/css/'.$theme.'/images/sales.png" title="' . _('Order') . '" alt=""></td><td><a href="' . $rootpath .'/SelectSalesOrder.php?identifier='.$identifier . '">'. _('Select A Different Order') .'</a></td></tr></table>'; + echo '<br /> + <table class="selection"> + <tr> + <td><img src="'.$rootpath.'/css/'.$theme.'/images/printer.png" title="' . _('Print') . '" alt=""></td><td><a href="' . $rootpath . '/PrintCustOrder.php?identifier='.$identifier . '&TransNo=' . $_SESSION['ExistingOrder'] . '">'. _('Print packing slip - pre-printed stationery') .'</a></td> + </tr>'; + echo '<tr> + <td><img src="'.$rootpath.'/css/'.$theme.'/images/printer.png" title="' . _('Print') . '" alt=""></td> + <td><a target="_blank" href="' . $rootpath . '/PrintCustOrder_generic.php?identifier='.$identifier . '&TransNo=' . $_SESSION['ExistingOrder'] . '">'. _('Print packing slip') . ' (' . _('Laser') . ')' .'</a></td> + </tr>'; + echo '<tr> + <td><img src="'.$rootpath.'/css/'.$theme.'/images/reports.png" title="' . _('Invoice') . '" alt=""></td> + <td><a href="' . $rootpath .'/ConfirmDispatch_Invoice.php?identifier='.$identifier . '&OrderNumber=' . $_SESSION['ExistingOrder'] . '">'. _('Confirm Order Delivery Quantities and Produce Invoice') .'</a></td> + </tr>'; + echo '<tr> + <td><img src="'.$rootpath.'/css/'.$theme.'/images/sales.png" title="' . _('Order') . '" alt=""></td> + <td><a href="' . $rootpath .'/SelectSalesOrder.php?identifier='.$identifier . '">'. _('Select A Different Order') .'</a></td> + </tr> + </table>'; include('includes/footer.inc'); exit; } @@ -786,7 +799,7 @@ echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/inventory.png" title="' . _('Delivery') . '" alt="" />' . ' ' . _('Delivery Details'); echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/customer.png" title="' . _('Customer') . '" alt="" />' . ' ' . _('Customer Code') . ' :<b> ' . $_SESSION['Items'.$identifier]->DebtorNo; echo '</b> ' . _('Customer Name') . ' :<b> ' . $_SESSION['Items'.$identifier]->CustomerName . '</p>'; -//echo '<font size=4><b>'. _('Customer') .' : ' . $_SESSION['Items'.$identifier]->CustomerName . '</b></font>'; + echo '<form action="' . $_SERVER['PHP_SELF'] . '?identifier='.$identifier . '" method=post>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; @@ -942,14 +955,14 @@ $ErrMsg = _('The stock locations could not be retrieved'); $DbgMsg = _('SQL used to retrieve the stock locations was') . ':'; -$StkLocsResult = DB_query('SELECT locationname,loccode - FROM locations',$db, $ErrMsg, $DbgMsg); +$StkLocsResult = DB_query("SELECT locationname,loccode + FROM locations",$db, $ErrMsg, $DbgMsg); while ($myrow=DB_fetch_row($StkLocsResult)){ if ($_SESSION['Items'.$identifier]->Location==$myrow[1]){ - echo '<option selected value="'.$myrow[1].'">'.$myrow[0]; + echo '<option selected value="' . $myrow[1] . '">' . $myrow[0] . '</option>'; } else { - echo '<option value="'.$myrow[1].'">'.$myrow[0]; + echo '<option value="'.$myrow[1].'">'.$myrow[0] . '</option>'; } } @@ -1031,75 +1044,68 @@ /* This field will control whether or not to display the company logo and address on the packlist */ - echo '<tr><td>' . _('Packlist Type') . ':</td><td><select name="DeliverBlind">'; - for ($p = 1; $p <= 2; $p++) { - echo '<option value=' . $p; - if ($p == $_SESSION['Items'.$identifier]->DeliverBlind) { - echo ' selected>'; - } else { - echo '>'; - } - switch ($p) { - case 2: - echo _('Hide Company Details/Logo'); - break; - default: - echo _('Show Company Details/Logo'); - break; - } - } + echo '<tr><td>' . _('Packlist Type') . ':</td> + <td><select name="DeliverBlind">'; + + if ($_SESSION['Items'.$identifier]->DeliverBlind ==2){ + echo '<option value="1">' . _('Show Company Details/Logo') . '</option>'; + echo '<option selected value="2">' . _('Hide Company Details/Logo') . '</option>'; + } else { + echo '<option selected value="1">' . _('Show Company Details/Logo') . '</option>'; + echo '<option value="2">' . _('Hide Company Details/Logo') . '</option>'; + } echo '</select></td></tr>'; if (isset($_SESSION['PrintedPackingSlip']) and $_SESSION['PrintedPackingSlip']==1){ echo '<tr> <td>'. _('Reprint packing slip') .':</td> - <td><select name="ReprintPackingSlip">'; - echo '<option value=0>' . _('Yes'); - echo '<option selected value=1>' . _('No'); + <td><select name="ReprintPackingSlip">'; + echo '<option value=0>' . _('Yes') . '</option>'; + echo '<option selected value=1>' . _('No') . '</option>'; echo '</select> '. _('Last printed') .': ' . ConvertSQLDate($_SESSION['DatePackingSlipPrinted']) . '</td></tr>'; - } else { - echo '<input type=hidden name="ReprintPackingSlip" value=0>'; - } echo '<tr><td>'. _('Charge Freight Cost inc tax') .':</td>'; -echo '<td><input type=text class=number size=10 maxlength=12 name="FreightCost" VALUE=' . $_SESSION['Items'.$identifier]->FreightCost . '></td>'; +echo '<td><input type=text class="number" size=10 maxlength=12 name="FreightCost" value="' . $_SESSION['Items'.$identifier]->FreightCost . '"></td>'; if ($_SESSION['DoFreightCalc']==true){ - echo '<td><input type=submit name="Update" VALUE="' . _('Recalc Freight Cost') . '"></td></tr>'; + echo '<td><input type=submit name="Update" value="' . _('Recalc Freight Cost') . '"></td></tr>'; } if ((!isset($_POST['ShipVia']) OR $_POST['ShipVia']=='') AND isset($_SESSION['Items'.$identifier]->ShipVia)){ $_POST['ShipVia'] = $_SESSION['Items'.$identifier]->ShipVia; } -echo '<tr><td>'. _('Freight/Shipper Method') .':</td><td><select name="ShipVia">'; +echo '<tr><td>'. _('Freight/Shipper Method') .':</td> + <td><select name="ShipVia">'; + $ErrMsg = _('The shipper details could not be retrieved'); $DbgMsg = _('SQL used to retrieve the shipper details was') . ':'; -$sql = 'SELECT shipper_id, shippername - FROM shippers'; + +$sql = "SELECT shipper_id, shippername FROM shippers"; $ShipperResults = DB_query($sql,$db,$ErrMsg,$DbgMsg); while ($myrow=DB_fetch_array($ShipperResults)){ if ($myrow['shipper_id']==$_POST['ShipVia']){ - echo '<option selected value=' . $myrow['shipper_id'] . '>' . $myrow['shippername']; + echo '<option selected value=' . $myrow['shipper_id'] . '>' . $myrow['shippername'] . '</option>'; }else { - echo '<option value=' . $myrow['shipper_id'] . '>' . $myrow['shippername']; + echo '<option value=' . $myrow['shipper_id'] . '>' . $myrow['shippername'] . '</option>'; } } echo '</select></td></tr>'; -echo '<tr><td>'. _('Quotation Only') .':</td><td><select name="Quotation">'; +echo '<tr><td>'. _('Quotation Only') .':</td> + <td><select name="Quotation">'; if ($_SESSION['Items'.$identifier]->Quotation==1){ - echo '<option selected value=1>' . _('Yes'); - echo '<option value=0>' . _('No'); + echo '<option selected value=1>' . _('Yes') . '</option>'; + echo '<option value=0>' . _('No') . '</option>'; } else { - echo '<option VALUE=1>' . _('Yes'); - echo '<option selected VALUE=0>' . _('No'); + echo '<option value=1>' . _('Yes') . '</option>'; + echo '<option selected value=0>' . _('No') . '</option>'; } echo '</select></td></tr>'; @@ -1110,9 +1116,9 @@ if ($_SESSION['ExistingOrder']==0){ echo '<br /><br /><input type=submit name="ProcessOrder" value="' . _('Place Order') . '">'; - echo '<br /><br /><input type=submit name="MakeRecurringOrder" VALUE="' . _('Create Recurring Order') . '">'; + echo '<br /><br /><input type=submit name="MakeRecurringOrder" value="' . _('Create Recurring Order') . '">'; } else { - echo '<br /><input type=submit name="ProcessOrder" VALUE="' . _('Commit Order Changes') . '">'; + echo '<br /><input type=submit name="ProcessOrder" value="' . _('Commit Order Changes') . '">'; } echo '</div></form>'; Modified: trunk/DiscountCategories.php =================================================================== --- trunk/DiscountCategories.php 2011-04-18 07:49:36 UTC (rev 4554) +++ trunk/DiscountCategories.php 2011-04-19 10:18:49 UTC (rev 4555) @@ -1,9 +1,7 @@ <?php -/* $Revision: 1.10 $ */ + /* $Id$*/ -//$PageSecurity = 11; - include('includes/session.inc'); $title = _('Discount Categories Maintenance'); @@ -15,7 +13,7 @@ $_POST['StockID']=$_POST['stockID']; } elseif (isset($_GET['StockID'])) { $_POST['StockID']=$_GET['StockID']; - $_POST['chooseoption']=1; + $_POST['ChooseOption']=1; $_POST['selectchoice']=1; } @@ -42,7 +40,7 @@ if ($InputError !=1) { $sql = "UPDATE stockmaster SET discountcategory='" . $_POST['DiscountCategory'] . "' - WHERE stockid='" . strtoupper($_POST['StockID']) . "'"; + WHERE stockid='" . strtoupper($_POST['StockID']) . "'"; $result = DB_query($sql,$db, _('The discount category') . ' ' . $_POST['DiscountCategory'] . ' ' . _('record for') . ' ' . strtoupper($_POST['StockID']) . ' ' . _('could not be updated because')); @@ -58,8 +56,8 @@ $sql="UPDATE stockmaster SET discountcategory='' WHERE stockid='" . trim(strtoupper($_GET['StockID'])) ."'"; $result = DB_query($sql,$db); prnMsg( _('The stock master record has been updated to no discount category'),'success'); - echo '<br>'; -} elseif (isset($_POST['submitcategory'])) { + echo '<br />'; +} elseif (isset($_POST['SubmitCategory'])) { $sql="UPDATE stockmaster SET discountcategory='".$_POST['DiscountCategory']."' WHERE categoryid='".$_POST['stockcategory']."'"; @@ -67,7 +65,7 @@ } if (isset($_POST['selectchoice'])) { - echo "<form name='update' method='post' action=" . $_SERVER['PHP_SELF'] . '?' . SID . '>'; + echo '<form name="update" method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; $sql = "SELECT DISTINCT discountcategory FROM stockmaster WHERE discountcategory <>''"; @@ -79,31 +77,37 @@ while ($myrow = DB_fetch_array($result)){ if ($myrow['discountcategory']==$_POST['DiscCat']){ - echo "<option selected value='" . $myrow['discountcategory'] . "'>" . $myrow['discountcategory']; + echo '<option selected value="' . $myrow['discountcategory'] . '">' . $myrow['discountcategory'] . '</option>'; } else { - echo "<option value='" . $myrow['discountcategory'] . "'>" . $myrow['discountcategory']; + echo '<option value="' . $myrow['discountcategory'] . '">' . $myrow['discountcategory'] . '</option>'; } echo '</option>'; } echo '</select></td>'; - echo '<td><input type="submit" name="select" value="'._('Select').'"></td></tr></table><br>'; + echo '<td><input type="submit" name="select" value="'._('Select').'"></td></tr></table><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'] . '" />'; - echo '<input type="hidden" name="chooseoption" value="'.$_POST['chooseoption'].'">'; + echo '<input type="hidden" name="ChooseOption" value="'.$_POST['ChooseOption'].'">'; echo '<input type="hidden" name="selectchoice" value="'.$_POST['selectchoice'].'">'; - if (isset($_POST['chooseoption']) and $_POST['chooseoption']==1) { - echo '<table class=selection><tr><td>'. _('Discount Category Code') .':</td><td>'; + if (isset($_POST['ChooseOption']) and $_POST['ChooseOption']==1) { + echo '<table class="selection"><tr><td>'. _('Discount Category Code') .':</td><td>'; if (isset($_POST['DiscCat'])) { - echo "<input type='text' name='DiscountCategory' maxlength=2 size=2 value='" . $_POST['DiscCat'] . - "'></td><td>"._('OR')."</td><td></td><td>"._('OR')."</td></tr>"; + echo '<input type="text" name="DiscountCategory" maxlength=2 size=2 value="' . $_POST['DiscCat'] .'"></td> + <td>'._('OR') . '</td> + <td></td> + <td>'._('OR').'</td> + </tr>'; } else { - echo "<input type='text' name='DiscountCategory' maxlength=2 size=2></td><td>". - _('OR')."</td><td></td><td>"._('OR')."</td></tr>"; + echo '<input type="text" name="DiscountCategory" maxlength=2 size=2></td> + <td>' ._('OR') . '</td> + <td></td> + <td>'._('OR') . '</td> + </tr>'; } if (!isset($_POST['StockID'])) { @@ -115,46 +119,53 @@ if (!isset($_POST['PartDesc'])) { $_POST['PartDesc']=''; } - echo '<tr><td>'. _('Enter Stock Code') .":</td><td><input type='text' name='StockID' size=20 maxlength=20 - value='".$_POST['StockID']."'></td> - <td>"._('Partial code').":</td><td><input type='text' name='PartID' size=10 maxlength=10 value='".$_POST['PartID']."'></td> - <td>"._('Partial description').":</td><td><input type='text' name='PartDesc' size=10 value='".$_POST['PartDesc']."' maxlength=10></td> - <td><input type='Submit' name='search' value='". _('Search') ."'></td></tr>"; + echo '<tr><td>'. _('Enter Stock Code') .':</td> + <td><input type="text" name="StockID" size=20 maxlength=20 value="' . $_POST['StockID'] . '"></td> + <td>'._('Partial code') . ':</td> + <td><input type="text" name="PartID" size=10 maxlength=10 value="' . $_POST['PartID'] . '"></td> + <td>' . _('Partial description') . ':</td> + <td><input type="text" name="PartDesc" size=10 value="' . $_POST['PartDesc'] .'" maxlength=10></td> + <td><input type="submit" name="search" value="' . _('Search') .'"></td></tr>'; echo '</table>'; - echo "<br><div class='centre'><input type='Submit' name='submit' value='". _('Update Item') ."'></div>"; + echo '<br /><div class="centre"><input type="submit" name="submit" value="'. _('Update Item') .'"></div>'; if (isset($_POST['search'])) { if ($_POST['PartID']!='' and $_POST['PartDesc']=='') - $sql="SELECT stockid, description FROM stockmaster WHERE stockid LIKE '%".$_POST['PartID']."%'"; + $sql="SELECT stockid, description FROM stockmaster + WHERE stockid " . LIKE . " '%".$_POST['PartID']."%'"; if ($_POST['PartID']=='' and $_POST['PartDesc']!='') - $sql="SELECT stockid, description FROM stockmaster WHERE description LIKE '%".$_POST['PartDesc']."%'"; + $sql="SELECT stockid, description FROM stockmaster + WHERE description " . LIKE . " '%".$_POST['PartDesc']."%'"; if ($_POST['PartID']!='' and $_POST['PartDesc']!='') - $sql="SELECT stockid, description FROM stockmaster WHERE stockid LIKE '%".$_POST['PartID']."%' and - description LIKE '%".$_POST['PartDesc']."%'"; + $sql="SELECT stockid, description FROM stockmaster + WHERE stockid " . LIKE . " '%".$_POST['PartID']."%' + AND description " . LIKE . " '%".$_POST['PartDesc']."%'"; $result=DB_query($sql,$db); if (!isset($_POST['stockID'])) { - echo _('Select a part code').':<br>'; + echo _('Select a part code').':<br />'; while ($myrow=DB_fetch_array($result)) { - echo '<input type="submit" name="stockID" value="'.$myrow['stockid'].'"><br>'; + echo '<input type="submit" name="stockID" value="'.$myrow['stockid'].'" /><br />'; } } } } else { - echo '<table class=selection><tr><td>'._('Assign discount category').'</td>'; - echo '<td><input type="text" name="DiscountCategory" maxlength=2 size=2></td>'; + echo '<table class=selection> + <tr> + <td>'._('Assign discount category').'</td>'; + echo '<td><input type="text" name="DiscountCategory" maxlength=2 size=2 /></td>'; echo '<td>'._('to all items in stock category').'</td>'; - $sql = 'SELECT categoryid, + $sql = "SELECT categoryid, categorydescription - FROM stockcategory'; + FROM stockcategory"; $result = DB_query($sql, $db); echo '<td><select name="stockcategory">'; while ($myrow=DB_fetch_array($result)) { echo '<option value="'.$myrow['categoryid'].'">'.$myrow['categorydescription'].'</option>'; } echo '</select></td></tr></table>'; - echo "<br><div class='centre'><input type='Submit' name='submitcategory' value='". _('Update Items') ."'></div>"; + echo '<br /><div class="centre"><input type="submit" name="SubmitCategory" value="'. _('Update Items') .'"></div>'; } echo '</form>'; @@ -182,10 +193,10 @@ $result = DB_query($sql,$db); - echo '<br><table class=selection>'; - echo "<tr> - <th>". _('Discount Category') ."</th> - <th>". _('Item') .'</th></tr>'; + echo '<br /><table class="selection">'; + echo '<tr> + <th>'. _('Discount Category') .'</th> + <th>'. _('Item') .'</th></tr>'; $k=0; //row colour counter @@ -197,16 +208,16 @@ echo '<tr class="OddTableRows">'; $k=1; } - $DeleteURL = $_SERVER['PHP_SELF'] . '?' . SID . '&Delete=yes&StockID=' . $myrow['stockid'] . '&DiscountCategory=' . $myrow['discountcategory']; + $DeleteURL = $_SERVER['PHP_SELF'] . '?Delete=yes&StockID=' . $myrow['stockid'] . '&DiscountCategory=' . $myrow['discountcategory']; - printf("<td>%s</td> - <td>%s - %s</td> - <td><a href='%s'>". _('Delete') .'</td> - </tr>', - $myrow['discountcategory'], - $myrow['stockid'], - $myrow['description'], - $DeleteURL); + printf('<td>%s</td> + <td>%s - %s</td> + <td><a href="%s">'. _('Delete') .'</td> + </tr>', + $myrow['discountcategory'], + $myrow['stockid'], + $myrow['description'], + $DeleteURL); } @@ -214,20 +225,22 @@ } else { /* $_POST['DiscCat'] ==0 */ - echo '</div><br>'; + echo '</div><br />'; prnMsg( _('There are currently no discount categories defined') . '. ' . _('Enter a two character abbreviation for the discount category and the stock code to which this category will apply to. Discount rules can then be applied to this discount category'),'info'); } } if (!isset($_POST['selectchoice'])) { - echo "<form method='post' name='choose' action=" . $_SERVER['PHP_SELF'] . '?' . SID . '>'; + echo '<form method="post" name="choose" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<table class=selection>'; + echo '<table class="selection">'; echo '<tr><td>'._('Update discount category for').'</td>'; - echo '<td><select name="chooseoption" onChange="ReloadForm(choose.selectchoice)">'; + echo '<td><select name="ChooseOption" onChange="ReloadForm(choose.selectchoice)">'; echo '<option value="1">'._('a single stock item').'</option>'; echo '<option value="2">'._('a complete stock category').'</option>'; - echo '</select></td></tr></table><br>'; + echo '</select></td></tr> + </table> + <br />'; echo '<div class="centre"><input type="submit" name="selectchoice" value="'._('Select').'"></div>'; } Modified: trunk/DiscountMatrix.php =================================================================== --- trunk/DiscountMatrix.php 2011-04-18 07:49:36 UTC (rev 4554) +++ trunk/DiscountMatrix.php 2011-04-19 10:18:49 UTC (rev 4555) @@ -1,13 +1,11 @@ <?php -/* $Revision: 1.9 $ */ + /* $Id$*/ -//$PageSecurity = 11; include('includes/session.inc'); $title = _('Discount Matrix Maintenance'); include('includes/header.inc'); - if (isset($Errors)) { unset($Errors); } @@ -64,7 +62,7 @@ $result = DB_query($sql,$db); prnMsg( _('The discount matrix record has been added'),'success'); - echo '<br>'; + echo '<br />'; unset($_POST['DiscountCategory']); unset($_POST['SalesType']); unset($_POST['QuantityBreak']); @@ -80,30 +78,30 @@ $result = DB_query($sql,$db); prnMsg( _('The discount matrix record has been deleted'),'success'); - echo '<br>'; + echo '<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'] . '" />'; -echo '<table class=selection>'; +echo '<table class="selection">'; -$sql = 'SELECT typeabbrev, +$sql = "SELECT typeabbrev, sales_type - FROM salestypes'; + FROM salestypes"; $result = DB_query($sql, $db); echo '<tr><td>' . _('Customer Price List') . ' (' . _('Sales Type') . '):</td><td>'; -echo "<select tabindex=1 name='SalesType'>"; +echo '<select tabindex=1 name="SalesType">'; while ($myrow = DB_fetch_array($result)){ if (isset($_POST['SalesType']) and $myrow['typeabbrev']==$_POST['SalesType']){ - echo "<option selected value='" . $myrow['typeabbrev'] . "'>" . $myrow['sales_type']; + echo '<option selected value="' . $myrow['typeabbrev'] . '">' . $myrow['sales_type'] . '</option>'; } else { - echo "<option value='" . $myrow['typeabbrev'] . "'>" . $myrow['sales_type']; + echo '<option value="' . $myrow['typeabbrev'] . '">' . $myrow['sales_type'] . '</option>'; } } @@ -118,29 +116,26 @@ while ($myrow = DB_fetch_array($result)){ if ($myrow['discountcategory']==$_POST['DiscCat']){ - echo "<option selected value='" . $myrow['discountcategory'] . "'>" . $myrow['discountcategory']; + echo '<option selected value="' . $myrow['discountcategory'] . '">' . $myrow['discountcategory'] . '</option>'; } else { - echo "<option value='" . $myrow['discountcategory'] . "'>" . $myrow['discountcategory']; + echo '<option value="' . $myrow['discountcategory'] . '">' . $myrow['discountcategory'] . '</option>'; } - echo '</option>'; } echo '</select></td>'; } else { echo '<input type="hidden" name="DiscountCategory" value="">'; } -echo '<tr><td>' . _('Quantity Break') . ":</td><td><input class='number' tabindex=3 " - . (in_array('QuantityBreak',$Errors) ? "class='inputerror'" : "") - ." type='text' name='QuantityBreak' size=10 maxlength=10></td></tr>"; +echo '<tr><td>' . _('Quantity Break') . '</td> + <td><input class="number" tabindex=3 ' . (in_array('QuantityBreak',$Errors) ? 'class="inputerror"' : '') .' type="text" name="QuantityBreak" size=10 maxlength=10></td></tr>'; -echo '<tr><td>' . _('Discount Rate') . " (%):</td><td><input class='number' tabindex=4 " - . (in_array('DiscountRate',$Errors) ? "class='inputerror'" : "") . - "type='text' name='DiscountRate' size=11 maxlength=14></td></tr>"; -echo '</table><br>'; +echo '<tr><td>' . _('Discount Rate') . ' (%):</td> + <td><input class="number" tabindex=4 ' . (in_array('DiscountRate',$Errors) ? 'class="inputerror"' : '') . 'type="text" name="DiscountRate" size=11 maxlength=14></td></tr>'; +echo '</table><br />'; -echo "<div class='centre'><input tabindex=5 type='submit' name='submit' value='" . _('Enter Information') . "'></div><br>"; +echo '<div class="centre"><input tabindex=5 type="submit" name="submit" value="' . _('Enter Information') . '"></div><br />'; -$sql = 'SELECT sales_type, +$sql = "SELECT sales_type, salestype, discountcategory, quantitybreak, @@ -149,15 +144,15 @@ ON discountmatrix.salestype=salestypes.typeabbrev ORDER BY salestype, discountcategory, - quantitybreak'; + quantitybreak"; $result = DB_query($sql,$db); echo '<table class=selection>'; -echo "<tr><th>" . _('Sales Type') . "</th> - <th>" . _('Discount Category') . "</th> - <th>" . _('Quantity Break') . "</th> - <th>" . _('Discount Rate') . ' %' . "</th></tr>"; +echo '<tr><th>' . _('Sales Type') . '</th> + <th>' . _('Discount Category') . '</th> + <th>' . _('Quantity Break') . '</th> + <th>' . _('Discount Rate') . ' %' . '</th></tr>'; $k=0; //row colour counter @@ -169,13 +164,13 @@ echo '<tr class="OddTableRows">'; $k=1; } - $DeleteURL = $_SERVER['PHP_SELF'] . '?' . SID . '&Delete=yes&SalesType=' . $myrow['salestype'] . '&DiscountCategory=' . $myrow['discountcategory'] . '&QuantityBreak=' . $myrow['quantitybreak']; + $DeleteURL = $_SERVER['PHP_SELF'] . '?Delete=yes&SalesType=' . $myrow['salestype'] . '&DiscountCategory=' . $myrow['discountcategory'] . '&QuantityBreak=' . $myrow['quantitybreak']; - printf("<td>%s</td> + printf('<td>%s</td> <td>%s</td> - <td class='number'>%s</td> - <td class='number'>%s</td> - <td><a href='%s'>" . _('Delete') . '</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td><a href="%s">' . _('Delete') . '</td> </tr>', $myrow['sales_type'], $myrow['discountcategory'], Modified: trunk/EDIMessageFormat.php =================================================================== --- trunk/EDIMessageFormat.php 2011-04-18 07:49:36 UTC (rev 4554) +++ trunk/EDIMessageFormat.php 2011-04-19 10:18:49 UTC (rev 4555) @@ -97,7 +97,7 @@ prnMsg($msg,'success'); } -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'] . '" />'; echo '<p><table border=0 width=100%> @@ -124,12 +124,12 @@ $result = DB_query($sql,$db); echo '<table class=selection>'; - echo '<tr><th colspan=5><font size=3>' . _('Definition of') . ' ' . $MessageType . ' ' . _('for') . ' ' . $PartnerCode."</font></th></tr>"; - $TableHeader = "<tr> - <th>" . _('Section') . "</th> - <th>" . _('Sequence') . "</th> - <th>" . _('Format String') . "</th> - </tr>"; + echo '<tr><th colspan=5><font size=3>' . _('Definition of') . ' ' . $MessageType . ' ' . _('for') . ' ' . $PartnerCode.'</font></th></tr>'; + $TableHeader = '<tr> + <th>' . _('Section') . '</th> + <th>' . _('Sequence') . '</th> + <th>' . _('Format String') . '</th> + </tr>'; echo $TableHeader; $k=0; //row colour counter @@ -144,12 +144,12 @@ } - printf("<td>%s</td> + printf('<td>%s</td> <td class=number>%s</td> <td>%s</td> - <td><a href=\"%s&SelectedMessageLine=%s\">" . _('Edit') . "</a></td> - <td><a href=\"%s&delete=%s\">" . _('Delete') . "</a></td> - </tr>", + <td><a href="%s&SelectedMessageLine=%s">' . _('Edit') . '</a></td> + <td><a href="%s&delete=%s">' . _('Delete') . '</a></td> + </tr>', $myrow[1], $myrow[2], $myrow[3], @@ -161,8 +161,8 @@ } //END WHILE LIST LOOP echo '</table><p>'; if (DB_num_rows($result)==0){ - echo "<div class='centre'><input tabindex=1 type=submit name='NewEDIInvMsg' value='" . - _('Create New EDI Invoice Message From Default Template') . "'></div><br>"; + echo '<div class="centre"><input tabindex=1 type=submit name="NewEDIInvMsg" value="' . + _('Create New EDI Invoice Message From Default Template') . '"></div><br>'; } } //end of ifs SelectedLine is not set @@ -188,14 +188,14 @@ $_POST['SequenceNo'] = $myrow['sequenceno']; $_POST['LineText'] = $myrow['linetext']; - echo "<div class='centre'><a href='" . $_SERVER['PHP_SELF'] . '?' . SID . 'MessageType=INVOIC&PartnerCode=' . $myrow['partnercode'] . "'>" . _('Review Message Lines') . '</a></div>'; + echo '<div class="centre"><a href="' . $_SERVER['PHP_SELF'] . '?MessageType=INVOIC&PartnerCode=' . $myrow['partnercode'] . '">' . _('Review Message Lines') . '</a></div>'; - echo "<input type=hidden name='SelectedMessageLine' VALUE='" . $SelectedMessageLine . "'>"; - echo "<input type=hidden name='MessageType' VALUE='" . $myrow['messagetype'] . "'>"; - echo "<input type=hidden name='PartnerCode' VALUE='" . $myrow['partnercode'] . "'>"; + echo '<input type=hidden name="SelectedMessageLine" VALUE="' . $SelectedMessageLine . '">'; + echo '<input type=hidden name="MessageType" VALUE="' . $myrow['messagetype'] . '">'; + echo '<input type=hidden name="PartnerCode" VALUE="' . $myrow['partnercode'] . '">'; } else { //end of if $SelectedMessageLine only do the else when a new record is being entered - echo "<input type=hidden name='MessageType' VALUE='" . $MessageType . "'>"; - echo "<input type=hidden name='PartnerCode' VALUE='" . $PartnerCode . "'>"; + echo '<input type=hidden name="MessageType" VALUE="' . $MessageType . '">'; + echo '<input type=hidden name="PartnerCode" VALUE="' . $PartnerCode . '">'; } echo '<table class=selection>'; @@ -209,20 +209,20 @@ echo '<select tabindex=2 name="Section">'; if ($_POST['Section']=='Heading') { - echo "<option selected VALUE='Heading'>" . _('Heading') . '</option>'; + echo '<option selected VALUE="Heading">' . _('Heading') . '</option>'; } else { - echo "<option value='Heading'>" . _('Heading') . '</option>'; + echo '<option value="Heading">' . _('Heading') . '</option>'; } if (isset($_POST['Section']) and $_POST['Section']=='Detail') { - echo "<option selected VALUE='Detail'>" . _('Detail') . '</option>'; + echo '<option selected VALUE="Detail">' . _('Detail') . '</option>'; } else { - echo "<option value='Detail'>" . _('Detail') . '</option>'; + echo '<option value="Detail">' . _('Detail') . '</option>'; } if (isset($_POST['Section']) and $_POST['Section']=='Summary') { - echo "<option selected VALUE='Summary'>" . _('Summary') . '</option>'; + echo '<option selected VALUE="Summary">' . _('Summary') . '</option>'; } else { - echo "<option value='Summary'>" . _('Summary') . '</option>'; + echo '<option value="Summary">' . _('Summary') . '</option>'; } echo '</select>'; @@ -234,20 +234,20 @@ echo '</td></tr>'; echo '<tr><td>Sequence Number:</td>'; -echo "<td><input tabindex=3 type=text name=SequenceNo size=3 maxlength=3 value=".$_POST['SequenceNo'].">"; -echo "</td></tr>"; -echo "<tr><td>" . _('Line Text') . ':' ."</td>"; -echo "<td>"; -echo "<input tabindex=4 type='Text' name='LineText' size=50 maxlength=50 VALUE=".$_POST['LineText'] .">"; -echo "</td></tr>"; -echo "</table><br>"; +echo '<td><input tabindex=3 type=text name=SequenceNo size=3 maxlength=3 value='.$_POST['SequenceNo'].'>'; +echo '</td></tr>'; +echo '<tr><td>' . _('Line Text') . ':' .'</td>'; +echo '<td>'; +echo '<input tabindex=4 type="Text" name="LineText" size=50 maxlength=50 VALUE='.$_POST['LineText'] .'>'; +echo '</td></tr>'; +echo '</table><br>'; if (isset($_GET['SelectedMessageLine'])) { - echo "<div class='centre'><input tabindex=5 type='submit' name='update' value='". _('Update Information'). "'></div>"; + echo '<div class="centre"><input tabindex=5 type="submit" name="update" value="'. _('Update Information'). '"></div>'; } else { - echo "<div class='centre'><input tabindex=5 type='submit' name='submit' value='". _('Enter Information'). "'></div>"; + echo '<div class="centre"><input tabindex=5 type="submit" name="submit" value="'. _('Enter Information'). '"></div>'; } -echo "</form>"; +echo '</form>'; include('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/EmailCustTrans.php =================================================================== --- trunk/EmailCustTrans.php 2011-04-18 07:49:36 UTC (rev 4554) +++ trunk/EmailCustTrans.php 2011-04-19 10:18:49 UTC (rev 4555) @@ -37,13 +37,13 @@ include ('includes/header.inc'); -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 "<input type=hidden name='TransNo' VALUE=" . $_GET['FromTransNo'] . ">"; -echo "<input type=hidden name='InvOrCredit' VALUE=" . $_GET['InvOrCredit'] . '>'; +echo '<input type=hidden name="TransNo" VALUE="' . $_GET['FromTransNo'] . '">'; +echo '<input type=hidden name="InvOrCredit" VALUE="' . $_GET['InvOrCredit'] . '>'; -echo '<p><table>'; +echo '<br /><table>'; $SQL = "SELECT email FROM custbranch INNER JOIN debtortrans @@ -62,11 +62,11 @@ $EmailAddress =''; } -echo '<tr><td>' . _('Email') . ' ' . $_GET['InvOrCredit'] . ' ' . _('number') . ' ' . $_GET['FromTransNo'] . ' ' . _('to') . ":</td> - <td><input type=TEXT name='EmailAddr' maxlength=60 size=60 VALUE='" . $EmailAddress . "'</td> - </table>"; +echo '<tr><td>' . _('Email') . ' ' . $_GET['InvOrCredit'] . ' ' . _('number') . ' ' . $_GET['FromTransNo'] . ' ' . _('to') . ':</td> + <td><input type=TEXT name="EmailAddr" maxlength=60 size=60 VALUE="' . $EmailAddress . '"></td> + </table>'; -echo "<br><div class='centre'><input type=submit name='DoIt' VALUE='" . _('OK') . "'>"; +echo '<br><div class="centre"><input type=submit name="DoIt" VALUE="' . _('OK') . '">'; echo '</div></form>'; include ('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/ExchangeRateTrend.php =================================================================== --- trunk/ExchangeRateTrend.php 2011-04-18 07:49:36 UTC (rev 4554) +++ trunk/ExchangeRateTrend.php 2011-04-19 10:18:49 UTC (rev 4555) @@ -23,7 +23,7 @@ // SHOW OUR MAIN INPUT FORM // ************************ - echo "<form method='post' name=update action=" . $_SERVER['PHP_SELF'] . '?' . SID . '>'; + echo '<form method="post" name=update action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<div class="centre"><p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/money_add.png" title="' . _('View Currency Trend') . '" alt="" />' . ' ' . _('View Currency Trend') . '</p>'; @@ -40,9 +40,9 @@ while ($myrow=DB_fetch_array($result)) { if ($myrow['currabrev']!=$_SESSION['CompanyRecord']['currencydefault']){ if ( $CurrencyToShow==$myrow['currabrev'] ) { - echo '<option selected value=' . $myrow['currabrev'] . '>' . $myrow['country'] . ' ' . $myrow['currency'] . ' (' . $myrow['currabrev'] . ')'; + echo '<option selected value=' . $myrow['currabrev'] . '>' . $myrow['country'] . ' ' . $myrow['currency'] . ' (' . $myrow['currabrev'] . ')'. '</option>'; } else { - echo '<option value=' . $myrow['currabrev'] . '>' . $myrow['country'] . ' ' . $myrow['currency'] . ' (' . $myrow['currabrev'] . ')'; + echo '<option value=' . $myrow['currabrev'] . '>' . $myrow['country'] . ' ' . $myrow['currency'] . ' (' . $myrow['currabrev'] . ')'. '</option>'; } } } Modified: trunk/FixedAssetCategories.php =================================================================== --- trunk/FixedAssetCategories.php 2011-04-18 07:49:36 UTC (rev 4554) +++ trunk/FixedAssetCategories.php 2011-04-19 10:18:49 UTC (rev 4555) @@ -154,7 +154,7 @@ FROM fixedassetcategories'; $result = DB_query($sql,$db); - echo "<br /><table class=selection>\n"; + echo '<br /><table class=selection>'; echo '<tr><th>' . _('Cat Code') . '</th> <th>' . _('Description') . '</th> <th>' . _('Cost GL') . '</th> @@ -172,15 +172,15 @@ echo '<tr class="OddTableRows">'; $k=1; } - printf("<td>%s</td> + printf('<td>%s</td> <td>%s</td> - <td class=\"number\">%s</td> - <td class=\"number\">%s</td> - <td class=\"number\">%s</td> - <td class=\"number\">%s</td> - <td><a href=\"%sSelectedCategory=%s\">" . _('Edit') . "</td> - <td><a href=\"%sSelectedCategory=%s&delete=yes\" onclick=\"return confirm('" . _('Are you sure you wish to delete this fixed asset category? Additional checks will be performed before actual deletion to ensure data integrity is not compromised.') . "');\">" . _('Delete') . "</td> - </tr>", + <td class="number">%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td><a href="%sSelectedCategory=%s">' . _('Edit') . '</td> + <td><a href="%sSelectedCategory=%s&delete=yes" onclick="return confirm("' . _('Are you sure you wish to delete this fixed asset category? Additional checks will be performed before actual deletion to ensure data integrity is not compromised.') . '");">' . _('Delete') . '</td> + </tr>', $myrow['categoryid'], $myrow['categorydescription'], $myrow['costact'], @@ -199,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'] . '">' ._('Show All Fixed Asset Categories') . '</a></div>'; } echo '<form name="CategoryForm" method="post" action="' . $_SERVER['PHP_SELF'] . '?' . SID . '">'; @@ -273,11 +273,10 @@ while ($myrow = DB_fetch_array($BSAccountsResult)){ if (isset($_POST['CostAct']) and $myrow['accountcode']==$_POST['CostAct']) { - echo '<option selected value='; + echo '<option selected value='.$myrow['accountcode'] . '>' . $myrow['accountname'] . ' ('.$myrow['accountcode'].')</option>'; } else { - echo '<option value='; + echo '<option value='.$myrow['accountcode'] . '>' . $myrow['accountname'] . ' ('.$myrow['accountcode'].')</option>'; } - echo $myrow['accountcode'] . '>' . $myrow['accountname'] . ' ('.$myrow['accountcode'].')'; } //end while loop echo '</select></td></tr>'; @@ -286,11 +285,10 @@ while ($myrow = DB_fetch_array($PnLAccountsResult)) { if (isset($_POST['DepnAct']) and $myrow['accountcode']==$_POST['DepnAct']) { - echo '<option selected value='; + echo '<option selected value='.$myrow['accountcode'] . '>' . $myrow['accountname'] . ' ('.$myrow['accountcode'].')</option>'; } else { - echo '<option value='; + echo '<option value='.$myrow['accountcode'] . '>' . $myrow['accountname'] . ' ('.$myrow['accountcode'].')</option>'; } - echo $myrow['accountcode'] . '>' . $myrow['accountname'] . ' ('.$myrow['accountcode'].')</option>'; } //end while loop echo '</select></td></tr>'; @@ -298,11 +296,10 @@ echo '<tr><td>' . _('Profit or Loss on Disposal GL Code:') . '</td><td><select name="DisposalAct">'; while ($myrow = DB_fetch_array($PnLAccountsResult)) { if (isset($_POST['DisposalAct']) and $myrow['accountcode']==$_POST['DisposalAct']) { - echo '<option selected value='; + echo '<option selected value='.$myrow['accountcode'] . '>' . $myrow['accountname'] . ' ('.$myrow['accountcode'].')' . '</option>'; } else { - echo '<option value='; + echo '<option value='.$myrow['accountcode'] . '>' . $myrow['accountname'] . ' ('.$myrow['accountcode'].')' . '</option>'; } - echo $myrow['accountcode'] . '>' . $myrow['accountname'] . ' ('.$myrow['accountcode'].')' . '</option>'; } //end while loop echo '</select></td></tr>'; @@ -313,11 +310,10 @@ while ($myrow = DB_fetch_array($BSAccountsResult)) { if (isset($_POST['AccumDepnAct']) and $myrow['accountcode']==$_POST['AccumDepnAct']) { - echo '<option selected value='; + echo '<option selected value='.$myrow['accountcode'] . '>' . $myrow['accountname'] . ' ('.$myrow['accountcode'].')' . '</option>'; } else { - echo '<option value='; + echo '<option value='.$myrow['accountcode'] . '>' . $myrow['accountname'] . ' ('.$myrow['accountcode'].')' . '</option>'; } - echo $myrow['accountcode'] . '>' . $myrow['accountname'] . ' ('.$myrow['accountcode'].')' . '</option>'; } //end while loop Modified: trunk/GLAccountInquiry.php =================================================================== --- trunk/GLAccountInquiry.php 2011-04-18 07:49:36 UTC (rev 4554) +++ trunk/GLAccountInquiry.php 2011-04-19 10:18:49 UTC (rev 4555) @@ -25,14 +25,14 @@ echo '<div class="page_help_text">' . _('Use the keyboard Shift key to select multiple 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*/ $DefaultPeriodDate = Date ('Y-m-d', Mktime(0,0,0,Date('m'),0,Date('Y'))); /*Show a form to allow input of criteria for TB to show */ -echo '<table class=selection><tr><td>'._('Account').":</td><td><select Name='Account'>"; +echo '<table class=selection><tr><td>'._('Account').':</td><td><select Name="Account">'; $sql = "SELECT accountcode, accountname FROM chartmaster ORDER BY accountcode"; $Account = DB_query($sql,$db); while ($myrow=DB_fetch_array($Account,$db)){ @@ -55,7 +55,7 @@ $result=DB_query($SQL,$db); echo '<option value=0>0 - '._('All tags'); while ($myrow=DB_fetch_array($result)){ - if (isset($_POST['tag']) and $_POST['tag']==$myrow["tagref"]){ + if (isset($_POST['tag']) and $_POST['tag']==$myrow['tagref']){ echo '<option selected value=' . $myrow['tagref'] . '>' . $myrow['tagref'].' - ' .$myrow['tagdescription']; } else { echo '<option value=' . $myrow['tagref'] . '>' . $myrow['tagref'].' - ' .$myrow['tagdescription']; @@ -75,8 +75,8 @@ echo '<option value=' . $myrow['periodno'] . '>' . _(MonthAndYearFromSQLDate($myrow['lastdate_in_period'])); } } -echo "</select></td></tr><table>"; -echo "<p><div class='centre'><input type=submit name='Show' value='"._('Show Account Transactions')."'></div></form>"; +echo '</select></td></tr><table>'; +echo '<p><div class="centre"><input type=submit name="Show" value="'._('Show Account Transactions').'"></div></form>'; /* End of the Form rest of script is what happens if the show button is hit*/ @@ -148,16 +148,16 @@ echo '<br><table class=selection>'; echo '<tr><th colspan=8><b>' ._('Transactions for account').' '.$SelectedAccount. ' - '. $SelectedAccountName.'</b></th></tr>'; - $TableHeader = "<tr> - <th>" . _('Type') . "</th> - <th>" . _('Number') . "</th> - <th>" . _('Date') . "</th> - <th>" . _('Debit') . "</th> - <th>" . _('Credit') . "</th> - <th>" . _('Narrative') . "</th> - <th>" . _('Balance') . "</th> - <th>" . _('Tag') . "</th> - </tr>"; + $TableHeader = '<tr> + <th>' . _('Type') . '</th> + <th>' . _('Number') . '</th> + <th>' . _('Date') . '</th> + <th>' . _('Debit') . '</th> + <th>' . _('Credit') . '</th> + <th>' . _('Narrative') . '</th> + <th>' . _('Balance') . '</th> + <th>' . _('Tag') . '</th> + </tr>'; echo $TableHeader; @@ -179,15 +179,15 @@ $RunningTotal =$ChartDetailRow['bfwd']; if ($RunningTotal < 0 ){ //its a credit balance b/fwd - echo "<tr bgcolor='#FDFEEF'> - <td colspan=3><b>" . _('Brought Forward Balance') . '</b><td> + echo '<tr bgcolor="#FDFEEF"> + <td colspan=3><b>' . _('Brought Forward Balance') . '</b><td> </td></td> <td class=number><b>' . number_format(-$RunningTotal,2) . '</b></td> <td></td> </tr>'; } else { //its a debit balance b/fwd - echo "<tr bgcolor='#FDFEEF'> - <td colspan=3><b>" . _('Brought Forward Balance') . '</b></td> + echo '<tr bgcolor="#FDFEEF"> + <td colspan=3><b>' . _('Brought Forward Balance') . '</b></td> <td class=number><b>' . number_format($RunningTotal,2) . '</b></td> <td colspan=2></td> </tr>'; @@ -215,8 +215,8 @@ $ChartDetailsResult = DB_query($sql,$db,$ErrMsg); $ChartDetailRow = DB_fetch_array($ChartDetailsResult); - echo "<tr bgcolor='#FDFEEF'> - <td colspan=3><b>" . _('Total for period') . ' ' . $PeriodNo . '</b></td>'; + echo '<tr bgcolor="#FDFEEF"> + <td colspan=3><b>' . _('Total for period') . ' ' . $PeriodNo . '</b></td>'; if ($PeriodTotal < 0 ){ //its a credit balance b/fwd if ($PandLAccount==True) { $RunningTotal = 0; @@ -271,15 +271,15 @@ if ($tagrow['tagdescription']=='') { $tagrow['tagdescription']=_('None'); } - printf("<td>%s</td> - <td class=number><a href='%s'>%s</a></td> + printf('<td>%s</td> + <td class=number><a href="%s">%s</a></td> <td>%s</td> <td class=number>%s</td> <td class=number>%s</td> <td>%s</td> <td class=number><b>%s</b></td> <td>%s</td> - </tr>", + </tr>', $myrow['typename'], $URL_to_TransDetail, $myrow['typeno'], @@ -292,7 +292,7 @@ } - echo "<tr bgcolor='#FDFEEF'><td colspan=3><b>"; + echo '<tr bgcolor="#FDFEEF"><td colspan=3><b>'; if ($PandLAccount==True){ echo _('Total Period Movement'); } else { /*its a balance sheet account*/ Modified: trunk/GLBalanceSheet.php =================================================================== --- trunk/GLBalanceSheet.php 2011-04-18 07:49:36 UTC (rev 4554) +++ trunk/GLBalanceSheet.php 2011-04-19 10:18:49 UTC (rev 4555) @@ -24,9 +24,9 @@ . _('The balance sheet has three parts: assets, liabilities and ownership equity. The main categories of assets are listed first and are followed by the liabilities. The difference between the assets and the liabilities is known as equity or the net assets or the net worth or capital of the company and according to the accounting equation, net worth must equal assets minus liabilities.') . '<br>' . _('webERP is an "accrual" based system (not a "cash based" system). Accrual systems include items when they are invoiced to the customer, and when expenses are owed based on the supplier invoice date.') . '</div>'; - 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'] . '" />'; - echo '<p><table class="selection"><tr><td>'._('Select the balance date').":</td><td><select Name='BalancePeriodEnd'>"; + echo '<p><table class="selection"><tr><td>'._('Select the balance date').':</td><td><select Name="BalancePeriodEnd">'; $periodno=GetPeriod(Date($_SESSION['DefaultDateFormat']), $db); $sql = "SELECT lastdate_in_period FROM periods WHERE periodno='".$periodno . "'"; @@ -47,15 +47,15 @@ echo '</select></td></tr>'; - echo '<tr><td>'._('Detail Or Summary').":</td><td><select Name='Detail'>"; - echo "<option selected VALUE='Summary'>"._('Summary'); - echo "<option selected VALUE='Detailed'>"._('All Accounts'); + echo '<tr><td>'._('Detail Or Summary').':</td><td><select Name="Detail">'; + echo '<option selected VALUE="Summary">'._('Summary') . '</option>'; + echo '<option selected VALUE="Detailed">'._('All Accounts') . '</option>'; echo '</select></td></tr>'; echo '</table>'; - echo "<br><div class='centre'><input type=submit Name='ShowBalanceSheet' Value='"._('Show on Screen (HTML)')."'</div>"; - echo "<br><div class='centre'><input type=submit Name='PrintPDF' Value='"._('Produce PDF Report')."'></div>"; + echo '<br><div class="centre"><input type=submit Name="ShowBalanceSheet" Value="'._('Show on Screen (HTML)').'"></div>'; + echo '<br><div class="centre"><input type=submit Name="PrintPDF" Value="'._('Produce PDF Report').'"></div>'; /*Now do the posting while the user is thinking about the period to select */ include ('includes/GLPostings.inc'); @@ -301,9 +301,9 @@ exit; } else { include('includes/header.inc'); - 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'] . '" />'; - echo "<input type=hidden name='BalancePeriodEnd' VALUE=" . $_POST['BalancePeriodEnd'] . '>'; + echo '<input type=hidden name="BalancePeriodEnd" VALUE="' . $_POST['BalancePeriodEnd'] . '">'; $RetainedEarningsAct = $_SESSION['CompanyRecord']['retainedearnings']; @@ -354,17 +354,17 @@ _('Balance Sheet as at') . ' ' . $BalanceDate .'</b></font></div></th></tr>'; if ($_POST['Detail']=='Detailed'){ - $TableHeader = "<tr> - <th>"._('Account')."</td> - <th>"._('Account Name')."</td> + $TableHeader = '<tr> + <th>'._('Account').'</td> + <th>'._('Account Name').'</td> <th colspan=2>$BalanceDate</th> - <th colspan=2>"._('Last Year').'</th> + <th colspan=2>'._('Last Year').'</th> </tr>'; } else { /*summary */ - $TableHeader = "<tr> + $TableHeader = '<tr> <th colspan=2></th> <th colspan=2>$BalanceDate</th> - <th colspan=2>"._('Last Year').'</th> + <th colspan=2>'._('Last Year').'</th> </tr>'; } @@ -533,7 +533,7 @@ $k++; } - $ActEnquiryURL = "<a href='$rootpath/GLAccountInquiry.php?" . SID . "Period=" . $_POST['BalancePeriodEnd'] . '&Account=' . $myrow['accountcode'] . "'>" . $myrow['accountcode'] . '<a>'; + $ActEnquiryURL = '<a href="' . $rootpath . '/GLAccountInquiry.php?Period=' . $_POST['BalancePeriodEnd'] . '&Account=' . $myrow['accountcode'] . '">' . $myrow['accountcode'] . '</a>'; $PrintString = '<td>%s</td> <td>%s</td> @@ -658,7 +658,7 @@ </tr>'; echo '</table>'; - echo "<br><div class='centre'><input type=submit Name='SelectADifferentPeriod' Value='"._('Select A Different Balance Date')."'></div>"; + echo '<br><div class="centre"><input type=submit Name="SelectADifferentPeriod" Value="'._('Select A Different Balance Date').'"></div>'; } echo '</form>'; Modified: trunk/GLBudgets.php =================================================================== --- trunk/GLBudgets.php 2011-04-18 07:49:36 UTC (rev 4554) +++ trunk/GLBudgets.php 2011-04-19 10:18:49 UTC (rev 4555) @@ -24,7 +24,7 @@ prnMsg(_('Budget updated successfully'), 'success'); } -//If an account hasn't been selected then select one here. +//If an account has not 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'] . '" method="post" name="selectaccount">'; echo '<input type="hidden" name="F... [truncated message content] |
From: <dai...@us...> - 2011-04-26 11:03:46
|
Revision: 4556 http://web-erp.svn.sourceforge.net/web-erp/?rev=4556&view=rev Author: daintree Date: 2011-04-26 11:03:36 +0000 (Tue, 26 Apr 2011) Log Message: ----------- rework scripts for xhtml and quoting Modified Paths: -------------- trunk/CustEDISetup.php trunk/CustLoginSetup.php trunk/CustWhereAlloc.php trunk/CustomerBranches.php trunk/CustomerReceipt.php trunk/CustomerTypes.php trunk/Customers.php trunk/InventoryValuation.php trunk/WWW_Users.php trunk/build/make_release.sh trunk/includes/GetConfig.php trunk/includes/LanguageSetup.php trunk/includes/PDFInventoryValnPageHeader.inc trunk/includes/session.inc trunk/locale/cs_CZ.utf8/LC_MESSAGES/messages.mo trunk/locale/cs_CZ.utf8/LC_MESSAGES/messages.po trunk/locale/de_DE.utf8/LC_MESSAGES/messages.mo trunk/locale/de_DE.utf8/LC_MESSAGES/messages.po trunk/locale/el_GR.utf8/LC_MESSAGES/messages.mo trunk/locale/el_GR.utf8/LC_MESSAGES/messages.po trunk/locale/en_GB.utf8/LC_MESSAGES/messages.pot trunk/locale/en_US.utf8/LC_MESSAGES/messages.mo trunk/locale/en_US.utf8/LC_MESSAGES/messages.po trunk/locale/es_ES.utf8/LC_MESSAGES/messages.mo trunk/locale/es_ES.utf8/LC_MESSAGES/messages.po trunk/locale/et_EE.utf8/LC_MESSAGES/messages.mo trunk/locale/et_EE.utf8/LC_MESSAGES/messages.po trunk/locale/fa_IR.utf8/LC_MESSAGES/messages.mo trunk/locale/fa_IR.utf8/LC_MESSAGES/messages.po trunk/locale/fr_FR.utf8/LC_MESSAGES/messages.mo trunk/locale/fr_FR.utf8/LC_MESSAGES/messages.po trunk/locale/hi_IN.utf8/LC_MESSAGES/messages.mo trunk/locale/hi_IN.utf8/LC_MESSAGES/messages.po trunk/locale/hr_HR.utf8/LC_MESSAGES/messages.mo trunk/locale/hr_HR.utf8/LC_MESSAGES/messages.po trunk/locale/hu_HU.utf8/LC_MESSAGES/messages.mo trunk/locale/hu_HU.utf8/LC_MESSAGES/messages.po trunk/locale/id_ID.utf8/LC_MESSAGES/messages.mo trunk/locale/id_ID.utf8/LC_MESSAGES/messages.po trunk/locale/it_IT.utf8/LC_MESSAGES/messages.mo trunk/locale/it_IT.utf8/LC_MESSAGES/messages.po trunk/locale/ja_JP.utf8/LC_MESSAGES/messages.mo trunk/locale/ja_JP.utf8/LC_MESSAGES/messages.po trunk/locale/lv_LV.utf8/LC_MESSAGES/messages.mo trunk/locale/lv_LV.utf8/LC_MESSAGES/messages.po trunk/locale/nl_NL.utf8/LC_MESSAGES/messages.mo trunk/locale/nl_NL.utf8/LC_MESSAGES/messages.po trunk/locale/pl_PL.utf8/LC_MESSAGES/messages.mo trunk/locale/pl_PL.utf8/LC_MESSAGES/messages.po trunk/locale/pt_BR.utf8/LC_MESSAGES/messages.mo trunk/locale/pt_BR.utf8/LC_MESSAGES/messages.po trunk/locale/pt_PT.utf8/LC_MESSAGES/messages.mo trunk/locale/pt_PT.utf8/LC_MESSAGES/messages.po trunk/locale/ro_RO.utf8/LC_MESSAGES/messages.mo trunk/locale/ro_RO.utf8/LC_MESSAGES/messages.po trunk/locale/ru_RU.utf8/LC_MESSAGES/messages.mo trunk/locale/ru_RU.utf8/LC_MESSAGES/messages.po trunk/locale/sq_AL.utf8/LC_MESSAGES/messages.mo trunk/locale/sq_AL.utf8/LC_MESSAGES/messages.po trunk/locale/sv_SE.utf8/LC_MESSAGES/messages.mo trunk/locale/sv_SE.utf8/LC_MESSAGES/messages.po trunk/locale/sw_KE.utf8/LC_MESSAGES/messages.mo trunk/locale/sw_KE.utf8/LC_MESSAGES/messages.po trunk/locale/tr_TR.utf8/LC_MESSAGES/messages.mo trunk/locale/tr_TR.utf8/LC_MESSAGES/messages.po trunk/locale/vi_VN.utf8/LC_MESSAGES/messages.mo trunk/locale/vi_VN.utf8/LC_MESSAGES/messages.po trunk/locale/zh_CN.utf8/LC_MESSAGES/messages.mo trunk/locale/zh_CN.utf8/LC_MESSAGES/messages.po trunk/locale/zh_HK.utf8/LC_MESSAGES/messages.mo trunk/locale/zh_HK.utf8/LC_MESSAGES/messages.po trunk/sql/mysql/weberp-demo.sql trunk/sql/mysql/weberp-new.sql Modified: trunk/CustEDISetup.php =================================================================== --- trunk/CustEDISetup.php 2011-04-19 10:18:49 UTC (rev 4555) +++ trunk/CustEDISetup.php 2011-04-26 11:03:36 UTC (rev 4556) @@ -1,14 +1,12 @@ <?php -/* $Revision: 1.11 $ */ + /* $Id$*/ -//$PageSecurity = 11; - include('includes/session.inc'); $title = _('Customer EDI Set Up'); include('includes/header.inc'); -echo "<a href='" . $rootpath . '/SelectCustomer.php?' . SID . "'>" . _('Back to Customers') . '</a><br>'; +echo '<a href="' . $rootpath . '/SelectCustomer.php">' . _('Back to Customers') . '</a><br />'; if (isset($Errors)) { unset($Errors); @@ -27,10 +25,7 @@ //first off validate inputs sensible - if (strstr($_POST['EDIReference'],"'") - OR strstr($_POST['EDIReference'],'+') - OR strstr($_POST['EDIReference'],"\"") - OR strstr($_POST['EDIReference'],'&') + if (ContainsIllegalCharacters($_POST['EDIReference']) OR strstr($_POST['EDIReference'],' ')) { $InputError = 1; prnMsg(_('The customers EDI reference code cannot contain any of the following characters') .' - \' & + \" ' . _('or a space'),'warn'); @@ -75,9 +70,9 @@ } } -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'] . '" />'; -echo '<br><table class=selection>'; +echo '<br /><table class=selection>'; $sql = "SELECT debtorno, name, @@ -105,59 +100,59 @@ if ($myrow['ediinvoices']==0){ - echo '<option selected VALUE=0>'._('Disabled'); - echo '<option VALUE=1>'._('Enabled'); + echo '<option selected value=0>'._('Disabled') . '</option>'; + echo '<option value=1>'._('Enabled'). '</option>'; } else { - echo '<option VALUE=0>'._('Disabled'); - echo '<option selected VALUE=1>'._('Enabled'); + echo '<option value=0>'._('Disabled') . '</option>'; + echo '<option selected value=1>'._('Enabled') . '</option>'; } -echo "</select><a href='$rootpath/EDIMessageFormat.php?" . SID . "&MessageType=INVOIC&PartnerCode=" . $_SESSION['CustomerID'] . "'>"._('Create') . '/' . _('Edit Invoice Message Format').'</a></td></tr>'; +echo '</select><a href="' . $rootpath . '/EDIMessageFormat.php?MessageType=INVOIC&PartnerCode=' . $_SESSION['CustomerID'] . '">'._('Create') . '/' . _('Edit Invoice Message Format').'</a></td></tr>'; -echo '<tr><td>'._('Enable Receiving of EDI Orders').":</td> - <td><select tabindex=2 name='EDIOrders'>"; +echo '<tr><td>'._('Enable Receiving of EDI Orders') . ':</td> + <td><select tabindex=2 name="EDIOrders">'; if ($myrow['ediorders']==0){ - echo '<option selected VALUE=0>'._('Disabled'); - echo '<option VALUE=1>'._('Enabled'); + echo '<option selected value=0>'._('Disabled') . '</option>'; + echo '<option value=1>'._('Enabled') . '</option>'; } else { - echo '<option VALUE=0>'._('Disabled'); - echo '<option selected VALUE=1>'._('Enabled'); + echo '<option value=0>'._('Disabled') . '</option>'; + echo '<option selected value=1>'._('Enabled') . '</option>'; } echo '</select></td></tr>'; -echo '<tr><td>'._('Customer EDI Reference').":</td> - <td><input " . (in_array('EDIReference',$Errors) ? 'class="inputerror"' : '' ) . - " tabindex=3 type='Text' name='EDIReference' size=20 maxlength=20 value='" . $myrow['edireference'] . "'></td></tr>"; +echo '<tr><td>'._('Customer EDI Reference') . ':</td> + <td><input ' . (in_array('EDIReference',$Errors) ? 'class="inputerror"' : '' ) . + ' tabindex=3 type="text" name="EDIReference" size=20 maxlength=20 value="' . $myrow['edireference'] . '"></td></tr>'; -echo '<tr><td>'._('EDI Communication Method').":</td> - <td><select tabindex=4 name='EDITransport'>"; +echo '<tr><td>'._('EDI Communication Method') . ':</td> + <td><select tabindex=4 name="EDITransport" >'; if ($myrow['editransport']=='email'){ - echo "<option selected value='email'>"._('Email Attachments'); - echo "<option value='ftp'>"._('File Transfer Protocol (FTP)'); + echo '<option selected value="email">'._('Email Attachments') . '</option>'; + echo '<option value="ftp">'._('File Transfer Protocol (FTP)') . '</option>'; } else { - echo "<option value='email'>"._('Email Attachments'); - echo "<option selected value='ftp'>"._('File Transfer Protocol (FTP)'); + echo '<option value="email">'._('Email Attachments') . '</option>'; + echo '<option selected value="ftp">'._('File Transfer Protocol (FTP)') . '</option>'; } echo '</select></td></tr>'; -echo '<tr><td>'._('FTP Server or Email Address').":</td> - <td><input " . (in_array('EDIAddress',$Errors) ? 'class="inputerror"' : '' ) . - " tabindex=5 type='Text' name='EDIAddress' size=42 maxlength=40 value='" . $myrow['ediaddress'] . "'></td></tr>"; +echo '<tr><td>'._('FTP Server or Email Address') . ':</td> + <td><input ' . (in_array('EDIAddress',$Errors) ? 'class="inputerror"' : '' ) . + ' tabindex=5 type="text" name="EDIAddress" size=42 maxlength=40 value="' . $myrow['ediaddress'] . '"></td></tr>'; if ($myrow['editransport']=='ftp'){ - echo '<tr><td>'._('FTP Server User Name').":</td> - <td><input tabindex=6 type='Text' name='EDIServerUser' size=20 maxlength=20 value=" . $myrow['ediserveruser'] . "></td></tr>"; - echo '<tr><td>'._('FTP Server Password').":</td> - <td><input tabindex=7 type='Text' name='EDIServerPwd' size=20 maxlength=20 value='" . $myrow['ediserverpwd'] . "'></td></tr>"; + echo '<tr><td>'._('FTP Server User Name') . ':</td> + <td><input tabindex=6 type="text" name="EDIServerUser" size=20 maxlength=20 value="' . $myrow['ediserveruser'] . '"></td></tr>'; + echo '<tr><td>'._('FTP Server Password') . ':</td> + <td><input tabindex=7 type="text" name="EDIServerPwd" size=20 maxlength=20 value="' . $myrow['ediserverpwd'] . '"></td></tr>'; } -echo "</table><br><div class='centre'><input tabindex=8 type='Submit' name='submit' value='"._('Update EDI Configuration')."'></div></form>"; +echo '</table><br /><div class="centre"><input tabindex=8 type="submit" name="submit" value="' ._('Update EDI Configuration'). '"></div></form>'; include('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/CustLoginSetup.php =================================================================== --- trunk/CustLoginSetup.php 2011-04-19 10:18:49 UTC (rev 4555) +++ trunk/CustLoginSetup.php 2011-04-26 11:03:36 UTC (rev 4556) @@ -1,9 +1,7 @@ <?php -/* $Revision: 1.2 $ */ + /* $Id$*/ -//$PageSecurity = 15; - include('includes/session.inc'); $title = _('Customer Login Configuration'); include('includes/header.inc'); @@ -21,7 +19,7 @@ _('Petty Cash'), _('Setup')); -echo "<a href='" . $rootpath . '/SelectCustomer.php?' . SID . "'>" . _('Back to Customers') . '</a><br>'; +echo '<a href="' . $rootpath . '/SelectCustomer.php">' . _('Back to Customers') . '</a><br>'; $sql="SELECT name FROM debtorsmaster @@ -33,17 +31,15 @@ echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/customer.png" title="' . _('Customer') . '" alt="" />' . ' ' . _('Customer') . ' : ' . $_SESSION['CustomerID'] . ' - ' . $CustomerName. _(' has been selected') . - '</p><br />';//'</p>'; -//echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/group_add.png" title="' . _('Search') . '" alt="">' . ' ' . $title.'<br>'; + '</p><br />'; - //Make an array of the security roles where only one role is active and is ID 1 //For the security role selection box, we will only show roles that have: //- Only one entry in securitygroups AND the tokenid of this entry == 1 //First get all available security role ID's' -$query_roles = 'SELECT secroleid FROM securityroles'; +$query_roles = "SELECT secroleid FROM securityroles"; $result_roles = DB_query($query_roles, $db); //Check for every security role if they have only one entry in securitygroups, if so check if the tokenid == 1, then store in selection box @@ -65,9 +61,7 @@ $SecurityRoles[$Sec_row[0]] = $Sec_row[1]; } DB_free_result($Sec_Result); - } - } if (isset($_GET['SelectedUser'])){ @@ -88,7 +82,7 @@ if (strlen($_POST['UserID'])<3){ $InputError = 1; prnMsg(_('The user ID entered must be at least 4 characters long'),'error'); - } elseif (ContainsIllegalCharacters($_POST['UserID'])) { + } elseif (ContainsIllegalCharacters($_POST['UserID']) OR strstr($_POST['UserID'],' ')) { $InputError = 1; prnMsg(_('User names cannot contain any of the following characters') . " - ' & + \" \\ " . _('or a space'),'error'); } elseif (strlen($_POST['Password'])<5){ @@ -270,18 +264,19 @@ $result = DB_query($sql,$db); echo '<table class=selection>'; - echo "<tr><th>" . _('User Login') . "</th> - <th>" . _('Full Name') . "</th> - <th>" . _('Telephone') . "</th> - <th>" . _('Email') . "</th> - <th>" . _('Customer Code') . "</th> - <th>" . _('Branch Code') . "</th> - <th>" . _('Last Visit') . "</th> - <th>" . _('Security Role') ."</th> - <th>" . _('Report Size') ."</th> - <th>" . _('Theme') ."</th> - <th>" . _('Language') ."</th> - </tr>"; + + echo '<tr><th>' . _('User Login') . '</th> + <th>' . _('Full Name') . '</th> + <th>' . _('Telephone') . '</th> + <th>' . _('Email') . '</th> + <th>' . _('Customer Code') . '</th> + <th>' . _('Branch Code') . '</th> + <th>' . _('Last Visit') . '</th> + <th>' . _('Security Role') .'</th> + <th>' . _('Report Size') .'</th> + <th>' . _('Theme') .'</th> + <th>' . _('Language') .'</th> + </tr>'; $k=0; //row colour counter @@ -298,7 +293,7 @@ /*The SecurityHeadings array is defined in config.php */ - printf("<td>%s</td> + printf('<td>%s</td> <td>%s</td> <td>%s</td> <td>%s</td> @@ -309,9 +304,9 @@ <td>%s</td> <td>%s</td> <td>%s</td> - <td><a href=\"%s&SelectedUser=%s\">" . _('Edit') . "</a></td> - <td><a href=\"%s&SelectedUser=%s&delete=1\">" . _('Delete') . "</a></td> - </tr>", + <td><a href="%s&SelectedUser=%s">' . _('Edit') . '</a></td> + <td><a href="%s&SelectedUser=%s&delete=1">' . _('Delete') . '</a></td> + </tr>', $myrow[0], $myrow[1], $myrow[2], @@ -323,9 +318,9 @@ $myrow[8], $myrow[9], $myrow[10], - $_SERVER['PHP_SELF'] . "?" . SID, + $_SERVER['PHP_SELF'] . '?', $myrow[0], - $_SERVER['PHP_SELF'] . "?" . SID, + $_SERVER['PHP_SELF'] . '?', $myrow[0]); } //END WHILE LIST LOOP @@ -334,10 +329,9 @@ if (isset($SelectedUser)) { - echo "<div class='centre'><a href='" . $_SERVER['PHP_SELF'] ."?" . SID . "'>" . _('Review Existing Users') . '</a></div><br>'; + echo '<div class="centre"><a href="' . $_SERVER['PHP_SELF'] .'">' . _('Review Existing Users') . '</a></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'] . '" />'; if (isset($SelectedUser)) { @@ -377,17 +371,16 @@ $_POST['UserLanguage'] = $myrow['language']; $_POST['Blocked'] = $myrow['blocked']; - echo "<input type='hidden' name='SelectedUser' value='" . $SelectedUser . "'>"; - echo "<input type='hidden' name='UserID' value='" . $_POST['UserID'] . "'>"; - echo "<input type='hidden' name='ModulesAllowed' value='" . $_POST['ModulesAllowed'] . "'>"; + echo '<input type="hidden" name="SelectedUser" value="' . $SelectedUser . '">'; + echo '<input type="hidden" name="UserID" value="' . $_POST['UserID'] . '">'; + echo '<input type="hidden" name="ModulesAllowed" value="' . $_POST['ModulesAllowed'] . '">'; - echo '<table class=selection> <tr><td>' . _('User code') . ':</td><td>'; + echo '<table class="selection"> <tr><td>' . _('User code') . ':</td><td>'; echo $_POST['UserID'] . '</td></tr>'; } else { //end of if $SelectedUser only do the else when a new record is being entered + echo '<table class=selection><tr><td>' . _('User Login') . ':</td><td><input type="text" name="UserID" size=22 maxlength=20 /></td></tr>'; - echo '<table class=selection><tr><td>' . _('User Login') . ":</td><td><input type='text' name='UserID' size=22 maxlength=20 ></td></tr>"; - /*set the default modules to show to all this had trapped a few people previously*/ $i=0; @@ -415,53 +408,48 @@ if (!isset($_POST['Email'])) { $_POST['Email']=''; } -echo '<tr><td>' . _('Password') . ":</td> - <td><input type='password' name='Password' size=22 maxlength=20 value='" . $_POST['Password'] . "'></tr>"; -echo '<tr><td>' . _('Full Name') . ":</td> - <td><input type='text' name='RealName' value='" . $_POST['RealName'] . "' size=36 maxlength=35></td></tr>"; -echo '<tr><td>' . _('Telephone No') . ":</td> - <td><input type='text' name='Phone' value='" . $_POST['Phone'] . "' size=32 maxlength=30></td></tr>"; -echo '<tr><td>' . _('Email Address') .":</td> - <td><input type='text' name='Email' value='" . $_POST['Email'] ."' size=32 maxlength=55></td></tr>"; -echo '<tr><td>' . _('Security Role') . ":</td><td><select name='Access'>"; +echo '<tr><td>' . _('Password') . ':</td> + <td><input type="password" name="Password" size=22 maxlength=20 value="' . $_POST['Password'] . '"></tr>'; +echo '<tr><td>' . _('Full Name') . ':</td> + <td><input type="text" name="RealName" value="' . $_POST['RealName'] . '" size=36 maxlength=35></td></tr>'; +echo '<tr><td>' . _('Telephone No') . ':</td> + <td><input type="text" name="Phone" value="' . $_POST['Phone'] . '" size=32 maxlength=30></td></tr>'; +echo '<tr><td>' . _('Email Address') .':</td> + <td><input type="text" name="Email" value="' . $_POST['Email'] .'" size=32 maxlength=55></td></tr>'; +echo '<tr><td>' . _('Security Role') . ':</td><td><select name="Access">'; foreach ($SecurityRoles as $SecKey => $SecVal) { if (isset($_POST['Access']) and $SecKey == $_POST['Access']){ - echo "<option selected value=" . $SecKey . ">" . $SecVal; + echo '<option selected value="' . $SecKey . '">' . $SecVal .'</option>'; } else { - echo "<option value=" . $SecKey . ">" . $SecVal; + echo '<option value="' . $SecKey . '">' . $SecVal .'</option>'; } } echo '</select></td></tr>'; echo '<input type="hidden" name="ID" value="'.$_SESSION['UserID'].'">'; +echo '<tr><td>' . _('Default Location') . ':</td> + <td><select name="DefaultLocation">'; -echo '<tr><td>' . _('Default Location') . ":</td> - <td><select name='DefaultLocation'>"; - $sql = "SELECT loccode, locationname FROM locations"; $result = DB_query($sql,$db); while ($myrow=DB_fetch_array($result)){ - if (isset($_POST['DefaultLocation']) and $myrow['loccode'] == $_POST['DefaultLocation']){ - - echo "<option selected value='" . $myrow['loccode'] . "'>" . $myrow['locationname']; - + echo '<option selected value="' . $myrow['loccode'] . '">' . $myrow['locationname'] .'</option>'; } else { - echo "<option Value='" . $myrow['loccode'] . "'>" . $myrow['locationname']; - + echo '<option Value="' . $myrow['loccode'] . '">' . $myrow['locationname'] .'</option>'; } - } + //Customer is fixed by selection of customer $_POST['Cust']=$_SESSION['CustomerID']; echo '<input type="hidden" name="Cust" value="' . $_POST['Cust'] . '">'; echo '<tr><td>'._('Customer Code').':</td> <td>' . $_POST['Cust'] . '</td></tr>'; -echo '<tr><td>' . _('Branch Code') . ":</td> - <td><select name='BranchCode'>"; +echo '<tr><td>' . _('Branch Code') . ':</td> + <td><select name="BranchCode">'; $sql = "SELECT branchcode FROM custbranch WHERE debtorno = '" . $_POST['Cust'] . "'"; $result = DB_query($sql,$db); @@ -474,79 +462,75 @@ } if (isset($_POST['BranchCode']) and $myrow['branchcode'] == $_POST['BranchCode']){ - - echo "<option selected value='" . $myrow['branchcode'] . "'>" . $myrow['branchcode']; - + echo '<option selected value="' . $myrow['branchcode'] . '">' . $myrow['branchcode'] . '</option>'; } else { - echo "<option Value='" . $myrow['branchcode'] . "'>" . $myrow['branchcode']; - + echo '<option Value="' . $myrow['branchcode'] . '">' . $myrow['branchcode'] . '</option>'; } - } -echo '<tr><td>' . _('Reports Page Size') .":</td> - <td><select name='PageSize'>"; +echo '<tr><td>' . _('Reports Page Size') .':</td> + <td><select name="PageSize">'; if(isset($_POST['PageSize']) and $_POST['PageSize']=='A4'){ - echo "<option selected value='A4'>" . _('A4'); + echo '<option selected value="A4">' . _('A4') .'</option>'; } else { - echo "<option value='A4'>A4"; + echo '<option value="A4">' . _('A4') . '</option>'; } if(isset($_POST['PageSize']) and $_POST['PageSize']=='A3'){ - echo "<option selected Value='A3'>" . _('A3'); + echo '<option selected value="A3">' . _('A3') .'</option>'; } else { - echo "<option value='A3'>A3"; + echo '<option value="A3">' . _('A3') .'</option>'; } if(isset($_POST['PageSize']) and $_POST['PageSize']=='A3_landscape'){ - echo "<option selected Value='A3_landscape'>" . _('A3') . ' ' . _('landscape'); + echo '<option selected value="A3_landscape">' . _('A3') . ' ' . _('landscape') .'</option>'; } else { - echo "<option value='A3_landscape'>" . _('A3') . ' ' . _('landscape'); + echo '<option value="A3_landscape">' . _('A3') . ' ' . _('landscape') .'</option>'; } if(isset($_POST['PageSize']) and $_POST['PageSize']=='letter'){ - echo "<option selected Value='letter'>" . _('Letter'); + echo '<option selected value="letter">' . _('Letter') .'</option>'; } else { - echo "<option value='letter'>" . _('Letter'); + echo '<option value="letter">' . _('Letter') .'</option>'; } if(isset($_POST['PageSize']) and $_POST['PageSize']=='letter_landscape'){ - echo "<option selected Value='letter_landscape'>" . _('Letter') . ' ' . _('landscape'); + echo '<option selected value="letter_landscape">' . _('Letter') . ' ' . _('landscape') .'</option>'; } else { - echo "<option value='letter_landscape'>" . _('Letter') . ' ' . _('landscape'); + echo '<option value="letter_landscape">' . _('Letter') . ' ' . _('landscape') .'</option>'; } if(isset($_POST['PageSize']) and $_POST['PageSize']=='legal'){ - echo "<option selected value='legal'>" . _('Legal'); + echo '<option selected value="legal">' . _('Legal') .'</option>'; } else { - echo "<option Value='legal'>" . _('Legal'); + echo '<option value="legal">' . _('Legal') .'</option>'; } if(isset($_POST['PageSize']) and $_POST['PageSize']=='legal_landscape'){ - echo "<option selected value='legal_landscape'>" . _('Legal') . ' ' . _('landscape'); + echo '<option selected value="legal_landscape">' . _('Legal') . ' ' . _('landscape') .'</option>'; } else { - echo "<option value='legal_landscape'>" . _('Legal') . ' ' . _('landscape'); + echo '<option value="legal_landscape">' . _('Legal') . ' ' . _('landscape') .'</option>'; } echo '</select></td></tr>'; echo '<tr> - <td>' . _('Theme') . ":</td> - <td><select name='Theme'>"; + <td>' . _('Theme') . ':</td> + <td><select name="Theme">'; $ThemeDirectory = dir('css/'); while (false != ($ThemeName = $ThemeDirectory->read())){ - if (is_dir("css/$ThemeName") AND $ThemeName != '.' AND $ThemeName != '..' AND $ThemeName != 'CVS'){ + if (is_dir('css/' . $ThemeName) AND $ThemeName != '.' AND $ThemeName != '..' AND $ThemeName != '.svn'){ if (isset($_POST['Theme']) and $_POST['Theme'] == $ThemeName){ - echo "<option selected value='$ThemeName'>$ThemeName"; + echo '<option selected value="' . $ThemeName . '">' . $ThemeName .'</option>'; } else if (!isset($_POST['Theme']) and ($_SESSION['DefaultTheme']==$ThemeName)) { - echo "<option selected value='$ThemeName'>$ThemeName"; + echo '<option selected value="' . $ThemeName . '">' . $ThemeName .'</option>'; } else { - echo "<option value='$ThemeName'>$ThemeName"; + echo '<option value="' . $ThemeName . '">' . $ThemeName .'</option>'; } } } @@ -555,22 +539,25 @@ echo '<tr> - <td>' . _('Language') . ":</td> - <td><select name='UserLanguage'>"; + <td>' . _('Language') . ':</td> + <td><select name="UserLanguage">'; - $LangDirHandle = dir('locale/'); +$Languages = scandir('locale/', 0); -while (false != ($LanguageEntry = $LangDirHandle->read())){ +foreach ($Languages as $LanguageEntry){ - if (is_dir('locale/' . $LanguageEntry) AND $LanguageEntry != '..' AND $LanguageEntry != 'CVS' AND $LanguageEntry!='.'){ + if (is_dir('locale/' . $LanguageEntry) + AND $LanguageEntry != '..' + AND $LanguageEntry != '.svn' + AND $LanguageEntry!='.'){ if (isset($_POST['UserLanguage']) and $_POST['UserLanguage'] == $LanguageEntry){ - echo "<option selected value='$LanguageEntry'>$LanguageEntry"; + echo '<option selected value="' . $LanguageEntry . '">' . $LanguageEntry .'</option>'; } elseif (!isset($_POST['UserLanguage']) and $LanguageEntry == $DefaultLanguage) { - echo "<option selected value='$LanguageEntry'>$LanguageEntry"; + echo '<option selected value="' . $LanguageEntry . '">' . $LanguageEntry .'</option>'; } else { - echo "<option value='$LanguageEntry'>$LanguageEntry"; + echo '<option value="' . $LanguageEntry . '">' . $LanguageEntry .'</option>'; } } } @@ -584,32 +571,34 @@ $i=0; foreach($ModuleList as $ModuleName){ - echo '<tr><td>' . _('Display') . ' ' . $ModuleName . ' ' . _('options') . ": </td><td><select name='Module_" . $i . "'>"; + echo '<tr><td>' . _('Display') . ' ' . $ModuleName . ' ' . _('options') . ': </td> + <td><select name="Module_' . $i . '">'; if ($ModulesAllowed[$i]==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>'; $i++; } -echo '<tr><td>' . _('Account Status') . ":</td><td><select name='Blocked'>"; +echo '<tr><td>' . _('Account Status') . ':</td> + <td><select name="Blocked">'; if ($_POST['Blocked']==0){ - echo '<option selected value=0>' . _('Open'); - echo '<option value=1>' . _('Blocked'); + echo '<option selected value=0>' . _('Open') . '</option>'; + echo '<option value=1>' . _('Blocked') . '</option>'; } else { - echo '<option selected value=1>' . _('Blocked'); - echo '<option value=0>' . _('Open'); + echo '<option selected value=1>' . _('Blocked') . '</option>'; + echo '<option value=0>' . _('Open') . '</option>'; } echo '</select></td></tr>'; +echo '</table><br> + <div class="centre"><input type="submit" name="submit" value="' . _('Enter Information') . '"></div> + </form>'; -echo "</table><br> - <div class='centre'><input type='submit' name='submit' value='" . _('Enter Information') . "'></div></form>"; - if (isset($_GET['SelectedUser'])) { echo '<script type="text/javascript">defaultControl(document.forms[0].Password);</script>'; } else { @@ -617,5 +606,4 @@ } include('includes/footer.inc'); - ?> \ No newline at end of file Modified: trunk/CustWhereAlloc.php =================================================================== --- trunk/CustWhereAlloc.php 2011-04-19 10:18:49 UTC (rev 4555) +++ trunk/CustWhereAlloc.php 2011-04-26 11:03:36 UTC (rev 4556) @@ -1,13 +1,12 @@ <?php -/* $Revision: 1.10 $ */ + /* $Id$*/ -//$PageSecurity = 2; include('includes/session.inc'); $title = _('Customer How Paid Inquiry'); include('includes/header.inc'); -echo "<form action='" . $_SERVER['PHP_SELF'] . "' method=post>"; +echo '<form action="' . $_SERVER['PHP_SELF'] . '" method=post>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/money_add.png" title="' . @@ -15,32 +14,33 @@ echo '<table class=selection cellpadding=2><tr>'; -echo '<td>' . _('Type') . ":</td><td><select tabindex=1 name='TransType'> "; +echo '<td>' . _('Type') . ':</td> + <td><select tabindex=1 name="TransType"> '; $sql = "SELECT typeid, typename FROM systypes WHERE typeid = 10 OR typeid=12"; $resultTypes = DB_query($sql,$db); while ($myrow=DB_fetch_array($resultTypes)){ if (isset($_POST['TransType'])){ if ($myrow['typeid'] == $_POST['TransType']){ - echo "<option selected Value='" . $myrow['typeid'] . "'>" . $myrow['typename']; + echo '<option selected value="' . $myrow['typeid'] . '">' . $myrow['typename'] . '</option>'; } else { - echo "<option Value='" . $myrow['typeid'] . "'>" . $myrow['typename']; + echo '<option Value="' . $myrow['typeid'] . '">' . $myrow['typename'] . '</option>'; } } else { - echo "<option Value='" . $myrow['typeid'] . "'>" . $myrow['typename']; + echo '<option value="' . $myrow['typeid'] . '">' . $myrow['typename'] . '</option>'; } } echo '</select></td>'; if (!isset($_POST['TransNo'])) {$_POST['TransNo']='';} -echo '<td>'._('Transaction Number').":</td> - <td><input tabindex=2 type=text name='TransNo' maxlength=10 size=10 value=". $_POST['TransNo'] . '></td>'; +echo '<td>'._('Transaction Number').':</td> + <td><input tabindex=2 type="text" name="TransNo" maxlength=10 size=10 value="'. $_POST['TransNo'] . '"></td>'; -echo "</tr></table><br> - <div class='centre'><input tabindex=3 type=submit name='ShowResults' value="._('Show How Allocated').'></div>'; +echo '</tr></table><br /> + <div class="centre"><input tabindex=3 type="submit" name="ShowResults" value="' . _('Show How Allocated') . '"></div>'; if (isset($_POST['ShowResults']) AND $_POST['TransNo']==''){ - echo '<br>'; + echo '<br />'; prnMsg(_('The transaction number to be queried must be entered first'),'warn'); } @@ -59,7 +59,6 @@ $myrow = DB_fetch_array($result); $AllocToID = $myrow['id']; - $sql = "SELECT type, transno, trandate, @@ -79,18 +78,20 @@ if (DB_num_rows($TransResult)==0){ prnMsg(_('There are no allocations made against this transaction'),'info'); } else { - echo '<br><table cellpadding=2 class=selection>'; + echo '<br /><table cellpadding=2 class=selection>'; - echo '<tr><th colspan=6><div class="centre"><font size=3 color=blue><b>'._('Allocations made against invoice number') . ' ' . $_POST['TransNo'] - . '<br>'._('Transaction Total').': '. number_format($myrow['totamt'],2) . '</font></b></div></th></tr>'; + echo '<tr> + <th colspan=6><div class="centre"><font size=3 color=blue><b>'._('Allocations made against invoice number') . ' ' . $_POST['TransNo'] . '<br />'._('Transaction Total').': '. number_format($myrow['totamt'],2) . '</font></b></div></th> + </tr>'; - $tableheader = "<tr><th>"._('Type')."</th> - <th>"._('Number')."</th> - <th>"._('Reference')."</th> - <th>"._('Ex Rate')."</th> - <th>"._('Amount')."</th> - <th>"._('Alloc').'</th> - </tr>'; + $tableheader = '<tr> + <th>' . _('Type') . '</th> + <th>' . _('Number') . '</th> + <th>' . _('Reference') . '</th> + <th>' . _('Ex Rate') . '</th> + <th>' . _('Amount') . '</th> + <th>' . _('Alloc') . '</th> + </tr>'; echo $tableheader; $RowCounter = 1; @@ -112,13 +113,13 @@ } else { $TransType = _('Receipt'); } - echo "<td>".$TransType."</td> - <td>".$myrow['transno']."</td> - <td>".$myrow['reference']."</td> - <td>".$myrow['rate']."</td> - <td class=number>".number_format($myrow['totalamt'],2)."</td> - <td class=number>".number_format($myrow['amt'],2)."</td> - </tr>"; + echo '<td>' . $TransType . '</td> + <td>' . $myrow['transno'] . '</td> + <td>' . $myrow['reference'] . '</td> + <td>' . $myrow['rate'] . '</td> + <td class=number>' . number_format($myrow['totalamt'],$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class=number>' . number_format($myrow['amt'],$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + </tr>'; $RowCounter++; If ($RowCounter == 12){ Modified: trunk/CustomerBranches.php =================================================================== --- trunk/CustomerBranches.php 2011-04-19 10:18:49 UTC (rev 4555) +++ trunk/CustomerBranches.php 2011-04-26 11:03:36 UTC (rev 4556) @@ -1,10 +1,7 @@ <?php -/* $Revision: 1.53 $ */ /* $Id$*/ -//$PageSecurity = 3; - include('includes/session.inc'); $title = _('Customer Branches'); include('includes/header.inc'); @@ -17,7 +14,7 @@ if (!isset($DebtorNo)) { prnMsg(_('This page must be called with the debtor code of the customer for whom you wish to edit the branches for').'. - <br>'._('When the pages is called from within the system this will always be the case').' <br>'. + <br />'._('When the pages is called from within the system this will always be the case').' <br />'. _('Select a customer first then select the link to add/edit/delete branches'),'warn'); include('includes/footer.inc'); exit; @@ -30,9 +27,6 @@ $SelectedBranch = strtoupper($_POST['SelectedBranch']); } -// This link is already available on the menu on this page -//echo "<a href='" . $rootpath . '/SelectCustomer.php?' . SID . "'>" . _('Back to Customers') . '</a><br>'; - if (isset($Errors)) { unset($Errors); } @@ -107,39 +101,35 @@ define("KEY", $api_key); if ($map_host=="") { // check that some sane values are setup already in geocode tables, if not skip the geocoding but add the record anyway. - echo '<div class="warn">' . _('Warning - Geocode Integration is enabled, but no hosts are setup. Go to Geocode Setup') . '</div>'; + echo '<div class="warn">' . _('Warning - Geocode Integration is enabled, but no hosts are setup. Go to Geocode Setup') . '</div>'; } else { - - $address = $_POST["BrAddress1"] . ", " . $_POST["BrAddress2"] . ", " . $_POST["BrAddress3"] . ", " . $_POST["BrAddress4"]; - - $base_url = "http://" . MAPS_HOST . "/maps/geo?output=xml" . "&key=" . KEY; - $request_url = $base_url . "&q=" . urlencode($address); - $xml = simplexml_load_string(utf8_encode(file_get_contents($request_url))) or die("url not loading"); -// $xml = simplexml_load_file($request_url) or die("url not loading"); - - $coordinates = $xml->Response->Placemark->Point->coordinates; - $coordinatesSplit = explode(",", $coordinates); - // Format: Longitude, Latitude, Altitude - $latitude = $coordinatesSplit[1]; - $longitude = $coordinatesSplit[0]; - - $status = $xml->Response->Status->code; - if (strcmp($status, "200") == 0) { - // Successful geocode - $geocode_pending = false; - $coordinates = $xml->Response->Placemark->Point->coordinates; - $coordinatesSplit = explode(",", $coordinates); - // Format: Longitude, Latitude, Altitude - $latitude = $coordinatesSplit[1]; - $longitude = $coordinatesSplit[0]; - } else { - // failure to geocode - $geocode_pending = false; - echo '<div class="page_help_text"><b>Geocode Notice:</b> Address: ' . $address . ' failed to geocode. '; - echo 'Received status ' . $status . '</div>'; - } + $address = $_POST['BrAddress1'] . ", " . $_POST['BrAddress2'] . ", " . $_POST['BrAddress3'] . ", " . $_POST['BrAddress4']; + $base_url = 'http://' . MAPS_HOST . '/maps/geo?output=xml&key=' . KEY; + $request_url = $base_url . '&q=' . urlencode($address); + $xml = simplexml_load_string(utf8_encode(file_get_contents($request_url))) or die("url not loading"); + $coordinates = $xml->Response->Placemark->Point->coordinates; + $coordinatesSplit = explode(",", $coordinates); + // Format: Longitude, Latitude, Altitude + $latitude = $coordinatesSplit[1]; + $longitude = $coordinatesSplit[0]; + + $status = $xml->Response->Status->code; + if (strcmp($status, '200') == 0) { + // Successful geocode + $geocode_pending = false; + $coordinates = $xml->Response->Placemark->Point->coordinates; + $coordinatesSplit = explode(",", $coordinates); + // Format: Longitude, Latitude, Altitude + $latitude = $coordinatesSplit[1]; + $longitude = $coordinatesSplit[0]; + } else { + // failure to geocode + $geocode_pending = false; + echo '<div class="page_help_text"><b>' . _('Geocode Notice') . ':</b> ' . _('Address') . ': ' . $address . ' ' . _('failed to geocode'); + echo _('Received status') . ' ' . $status . '</div>'; + } + } } - } if (isset($SelectedBranch) AND $InputError !=1) { /*SelectedBranch could also exist if submit had not been clicked this code would not run in this case cos submit is false of course see the delete code below*/ @@ -242,8 +232,8 @@ '" . $_POST['DeliverBlind'] . "' )"; } - echo '<br>'; - $msg = _('Customer branch<b>').' ' . $_POST['BranchCode'] . ': ' . $_POST['BrName'] . ' '._('</b>has been added, add another branch, or return to <a href=index.php>Main Menu</a>'); + echo '<br />'; + $msg = _('Customer branch').'<b> ' . $_POST['BranchCode'] . ': ' . $_POST['BrName'] . ' </b>'._('has been added, add another branch, or return to the') . ' <a href="index.php">' . _('Main Menu') . '</a>'; //run the SQL from either of the above possibilites @@ -292,7 +282,7 @@ $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); if ($myrow[0]>0) { - prnMsg(_('Cannot delete this branch because customer transactions have been created to this branch') . '<br>' . + prnMsg(_('Cannot delete this branch because customer transactions have been created to this branch') . '<br />' . _('There are').' ' . $myrow[0] . ' '._('transactions with this Branch Code'),'error'); } else { @@ -303,7 +293,7 @@ $myrow = DB_fetch_row($result); if ($myrow[0]>0) { prnMsg(_('Cannot delete this branch because sales analysis records exist for it'),'error'); - echo '<br>'._('There are').' ' . $myrow[0] . ' '._('sales analysis records with this Branch Code/customer'); + echo '<br />'._('There are').' ' . $myrow[0] . ' '._('sales analysis records with this Branch Code/customer'); } else { @@ -313,7 +303,7 @@ $myrow = DB_fetch_row($result); if ($myrow[0]>0) { prnMsg(_('Cannot delete this branch because sales orders exist for it') . '. ' . _('Purge old sales orders first'),'warn'); - echo '<br>'._('There are').' ' . $myrow[0] . ' '._('sales orders for this Branch/customer'); + echo '<br />'._('There are').' ' . $myrow[0] . ' '._('sales orders for this Branch/customer'); } else { // Check if there are any users that refer to this branch code $sql= "SELECT COUNT(*) FROM www_users WHERE www_users.branchcode='".$SelectedBranch."' AND www_users.customerid = '".$DebtorNo."'"; @@ -323,7 +313,7 @@ if ($myrow[0]>0) { prnMsg(_('Cannot delete this branch because users exist that refer to it') . '. ' . _('Purge old users first'),'warn'); - echo '<br>'._('There are').' ' . $myrow[0] . ' '._('users referring to this Branch/customer'); + echo '<br />'._('There are').' ' . $myrow[0] . ' '._('users referring to this Branch/customer'); } else { $sql="DELETE FROM custbranch WHERE branchcode='" . $SelectedBranch . "' AND debtorno='" . $DebtorNo . "'"; @@ -373,16 +363,18 @@ echo '<p Class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/customer.png" title="' . _('Customer') . '" alt="" />' . ' ' . _('Branches defined for'). ' '. $DebtorNo . ' - ' . $myrow[0] . '</p>'; echo '<table class=selection>'; - echo "<tr><th>"._('Code')."</th> - <th>"._('Name')."</th> - <th>"._('Branch Contact')."</th> - <th>"._('Salesman')."</th> - <th>"._('Area')."</th> - <th>"._('Phone No')."</th> - <th>"._('Fax No')."</th> - <th>"._('Email')."</th> - <th>"._('Tax Group')."</th> - <th>"._('Enabled?')."</th></tr>"; + + echo '<tr><th>'._('Code').'</th> + <th>'._('Name').'</th> + <th>'._('Branch Contact').'</th> + <th>'._('Salesman').'</th> + <th>'._('Area').'</th> + <th>'._('Phone No').'</th> + <th>'._('Fax No').'</th> + <th>'._('Email').'</th> + <th>'._('Tax Group').'</th> + <th>'._('Enabled?').'</th></tr>'; + $k=0; do { if ($k==1){ @@ -393,20 +385,19 @@ $k=1; } - - printf("<td>%s</td> + printf('<td>%s</td> <td>%s</td> <td>%s</td> <td>%s</td> <td>%s</td> <td>%s</td> <td>%s</td> - <td><a href='Mailto:%s'>%s</a></td> + <td><a href="Mailto:%s">%s</a></td> <td>%s</td> <td>%s</td> - <td><a href='%s?DebtorNo=%s&SelectedBranch=%s'>%s</td> - <td><a href='%s?DebtorNo=%s&SelectedBranch=%s&delete=yes' onclick=\"return confirm('" . - _('Are you sure you wish to delete this branch?') . "');\">%s</td></tr>", + <td><a href="%s?DebtorNo=%s&SelectedBranch=%s">%s</td> + <td><a href="%s?DebtorNo=%s&SelectedBranch=%s&delete=yes" onclick=\'return confirm("' . + _('Are you sure you wish to delete this branch?') . '");\'>%s</td></tr>', $myrow[10], $myrow[2], $myrow[5], @@ -431,9 +422,9 @@ } while ($myrow = DB_fetch_row($result)); //END WHILE LIST LOOP - echo '</table><br><table class=selection><tr><td><div class="centre">'; - echo '<b>'.$TotalEnable.'</b> ' . _('Branches are enabled.') . '<br>'; - echo '<b>'.$TotalDisable.'</b> ' . _('Branches are disabled.') . '<br>'; + echo '</table><br /><table class=selection><tr><td><div class="centre">'; + echo '<b>'.$TotalEnable.'</b> ' . _('Branches are enabled.') . '<br />'; + echo '<b>'.$TotalDisable.'</b> ' . _('Branches are disabled.') . '<br />'; echo '<b>'.($TotalEnable+$TotalDisable). '</b> ' . _('Total Branches') . '</div></td></tr></table>'; } else { $sql = "SELECT debtorsmaster.name, @@ -462,7 +453,7 @@ } if (!isset($_GET['delete'])) { - 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'] . '" />'; if (isset($SelectedBranch)) { @@ -532,17 +523,18 @@ $_POST['DeliverBlind'] = $myrow['deliverblind']; } - echo "<input type=hidden name='SelectedBranch' VALUE='" . $SelectedBranch . "'>"; - echo "<input type=hidden name='BranchCode' VALUE='" . $_POST['BranchCode'] . "'>"; - + echo '<input type=hidden name="SelectedBranch" value="' . $SelectedBranch . '" />'; + echo '<input type=hidden name="BranchCode" value="' . $_POST['BranchCode'] . '" />'; + echo '<p Class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/customer.png" title="' . _('Customer') . '" alt="">' . ' ' . _('Change Details for Branch'). ' '. $SelectedBranch . '</p>'; if (isset($SelectedBranch)) { - echo '<div class="centre"><a href=' . $_SERVER['PHP_SELF'] . '?' . SID . 'DebtorNo=' . $DebtorNo. '>' . _('Show all branches defined for'). ' '. $DebtorNo . '</a></div>'; + echo '<div class="centre"><a href=' . $_SERVER['PHP_SELF'] . '?DebtorNo=' . $DebtorNo. '>' . _('Show all branches defined for'). ' '. $DebtorNo . '</a></div>'; } - echo "<br><table class=selection>"; - echo "<tr><th colspan=2><div class='centre'><b>"._('Change Branch')."</b></th></tr>"; - echo "<tr><td>"._('Branch Code').':</td><td>'; + echo '<br><table class="selection">'; + echo '<tr><th colspan=2><div class="centre"><b>'._('Change Branch').'</b></th></tr>'; + echo '<tr><td>'._('Branch Code').':</td><td>'; + echo $_POST['BranchCode'] . '</td></tr>'; } else { //end of if $SelectedBranch only do the else when a new record is being entered @@ -577,8 +569,7 @@ } echo '<p Class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/customer.png" title="' . _('Customer') . '" alt="">' . ' ' . _('Add a Branch').'</p>'; echo '<table class=selection><tr><td>'._('Branch Code'). ':</td> - <td><input ' .(in_array('BranchCode',$Errors) ? 'class="inputerror"' : '' ) . - " tabindex=1 type='Text' name='BranchCode' size=12 maxlength=10 value=" . $_POST['BranchCode'] . '></td></tr>'; + <td><input ' .(in_array('BranchCode',$Errors) ? 'class="inputerror"' : '' ) . ' tabindex=1 type="text" name="BranchCode" size=12 maxlength=10 value="' . $_POST['BranchCode'] . '"></td></tr>'; $_POST['DeliverBlind'] = $_SESSION['DefaultBlindPackNote']; } @@ -590,7 +581,7 @@ if (DB_num_rows($result)==0){ echo '</table>'; prnMsg(_('There are no sales people defined as yet') . ' - ' . _('customer branches must be allocated to a sales person') . '. ' . _('Please use the link below to define at least one sales person'),'error'); - echo '<p align="center"><a href="' . $rootpath . '/SalesPeople.php?"' . SID . '">'._('Define Sales People') . '</a>'; + echo '<p align="center"><a href="' . $rootpath . '/SalesPeople.php">'._('Define Sales People') . '</a>'; include('includes/footer.inc'); exit; } @@ -654,7 +645,7 @@ if (DB_num_rows($result)==0){ echo '</table>'; prnMsg(_('There are no areas defined as yet') . ' - ' . _('customer branches must be allocated to an area') . '. ' . _('Please use the link below to define at least one sales area'),'error'); - echo "<br><a href='$rootpath/Areas.php?" . SID . "'>"._('Define Sales Areas').'</a>'; + echo '<br /><a href="' . $rootpath. '/Areas.php">'._('Define Sales Areas').'</a>'; include('includes/footer.inc'); exit; } @@ -681,7 +672,7 @@ if (DB_num_rows($result)==0){ echo '</table>'; prnMsg(_('There are no stock locations defined as yet') . ' - ' . _('customer branches must refer to a default location where stock is normally drawn from') . '. ' . _('Please use the link below to define at least one stock location'),'error'); - echo "<br><a href='$rootpath/Locations.php?" . SID . "'>"._('Define Stock Locations').'</a>'; + echo '<br /><a href="' . $rootpath . '/Locations.php">'._('Define Stock Locations').'</a>'; include('includes/footer.inc'); exit; } @@ -691,11 +682,11 @@ while ($myrow = DB_fetch_array($result)) { if (isset($_POST['DefaultLocation']) and $myrow['loccode']==$_POST['DefaultLocation']) { - echo '<option selected VALUE='; + echo '<option selected value='; } else { - echo '<option VALUE='; + echo '<option value='; } - echo $myrow['loccode'] . '>' . $myrow['locationname']; + echo $myrow['loccode'] . '>' . $myrow['locationname'] . '</option>'; } //end while loop @@ -718,7 +709,7 @@ DB_data_seek($result,0); - $sql = 'SELECT taxgroupid, taxgroupdescription FROM taxgroups'; + $sql = "SELECT taxgroupid, taxgroupdescription FROM taxgroups"; $result = DB_query($sql,$db); while ($myrow = DB_fetch_array($result)) { @@ -727,30 +718,32 @@ } else { echo '<option VALUE='; } - echo $myrow['taxgroupid'] . '>' . $myrow['taxgroupdescription']; + echo $myrow['taxgroupid'] . '>' . $myrow['taxgroupdescription'] . '</option>'; } //end while loop echo '</select></td></tr>'; - echo '<tr><td>'._('Transactions on this branch').":</td><td><select tabindex=20 name='DisableTrans'>"; + echo '<tr><td>'._('Transactions on this branch') . ':</td> + <td><select tabindex=20 name="DisableTrans">'; if ($_POST['DisableTrans']==0){ - echo '<option selected VALUE=0>' . _('Enabled'); - echo '<option VALUE=1>' . _('Disabled'); + echo '<option selected value=0>' . _('Enabled') . '</option>'; + echo '<option value=1>' . _('Disabled') . '</option>'; } else { - echo '<option selected VALUE=1>' . _('Disabled'); - echo '<option VALUE=0>' . _('Enabled'); + echo '<option selected value=1>' . _('Disabled') . '</option>'; + echo '<option value=0>' . _('Enabled') . '</option>'; } echo ' </select></td></tr>'; - echo '<tr><td>'._('Default freight/shipper method').":</td><td><select tabindex=21 name='DefaultShipVia'>"; - $SQL = 'SELECT shipper_id, shippername FROM shippers'; + echo '<tr><td>'._('Default freight/shipper method') . ':</td> + <td><select tabindex=21 name="DefaultShipVia">'; + $SQL = "SELECT shipper_id, shippername FROM shippers"; $ShipperResults = DB_query($SQL,$db); while ($myrow=DB_fetch_array($ShipperResults)){ if (isset($_POST['DefaultShipVia'])and $myrow['shipper_id']==$_POST['DefaultShipVia']){ - echo '<option selected VALUE=' . $myrow['shipper_id'] . '>' . $myrow['shippername']; + echo '<option selected value=' . $myrow['shipper_id'] . '>' . $myrow['shippername'] . '</option>'; }else { - echo '<option VALUE=' . $myrow['shipper_id'] . '>' . $myrow['shippername']; + echo '<option value=' . $myrow['shipper_id'] . '>' . $myrow['shippername'] . '</option>'; } } @@ -759,22 +752,16 @@ /* This field is a default value that will be used to set the value on the sales order which will control whether or not to display the company logo and address on the packlist */ - echo '<tr><td>' . _('Default Packlist') . ":</td><td><select tabindex=22 name='DeliverBlind'>"; - for ($p = 1; $p <= 2; $p++) { - echo '<option VALUE=' . $p; - if ($p == $_POST['DeliverBlind']) { - echo ' selected>'; - } else { - echo '>'; - } - switch ($p) { - case 1: - echo _('Show company details and logo'); break; - case 2: - echo _('Hide company details and logo'); break; - } - } - echo '</select></td></tr>'; + echo '<tr><td>' . _('Default Packlist') . ':</td><td><select tabindex=22 name="DeliverBlind">'; + if ($_POST['DeliverBlind']==2){ + echo '<option value="1">' . _('Show company details and logo') . '</option>'; + echo '<option selected value="2">' . _('Hide company details and logo') . '</option>'; + } else { + echo '<option selected value="1">' . _('Show company details and logo') . '</option>'; + echo '<option value="2">' . _('Hide company details and logo') . '</option>'; + } + + echo '</select></td></tr>'; echo '<tr><td>'._('Postal Address 1 (Street)').':</td>'; if (!isset($_POST['BrPostAddr1'])) {$_POST['BrPostAddr1']='';} @@ -792,7 +779,7 @@ if (!isset($_POST['CustBranchCode'])) {$_POST['CustBranchCode']='';} echo '<td><input tabindex=27 type="Text" name="CustBranchCode" size=31 maxlength=30 value="'. $_POST['CustBranchCode'].'"></td></tr>'; echo '</table>'; - echo '<br><div class="centre"><input tabindex=28 type="Submit" name="submit" value="' . _('Enter Branch') . '"></div>'; + echo '<br /><div class="centre"><input tabindex=28 type="Submit" name="submit" value="' . _('Enter Branch') . '"></div>'; echo '</form>'; } //end if record deleted no point displaying form to add record Modified: trunk/CustomerReceipt.php =================================================================== --- trunk/CustomerReceipt.php 2011-04-19 10:18:49 UTC (rev 4555) +++ trunk/CustomerReceipt.php 2011-04-26 11:03:36 UTC (rev 4556) @@ -231,10 +231,10 @@ echo '<br /><p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/money_add.png" title="' . _('Allocate') . '" alt="" />' . ' ' . _('Summary of Receipt Batch').'</p><br />'; echo '<table class=selection><tr><th>'._('Batch Number').'</th> - <th>'._('Date Banked').'</th> - <th>'._('Customer Name').'</th - <th>'._('GL Code').'</th - <th>'._('Amount of Receipt').'</th></tr>'; + <th>' . _('Date Banked') . '</th> + <th>' . _('Customer Name') . '</th> + <th>' . _('GL Code') . '</th> + <th>' . _('Amount of Receipt').'</th></tr>'; foreach ($_SESSION['ReceiptBatch']->Items as $ReceiptItem) { @@ -859,8 +859,8 @@ <td class=number>' . number_format($ReceiptItem->Discount,2) . '</td> <td>' . stripslashes($ReceiptItem->CustomerName) . '</td> <td>'.$ReceiptItem->GLCode.' - '.$myrow['accountname'].'</td> - <td>'.$ReceiptItem->Narrative . "</td> - <td><a href='" . $_SERVER['PHP_SELF'] . '?Delete=' . $ReceiptItem->ID . "&Type=".$_GET['Type']."'>" . _('Delete') . '</a></td> + <td>'.$ReceiptItem->Narrative . '</td> + <td><a href="' . $_SERVER['PHP_SELF'] . '?Delete=' . $ReceiptItem->ID . '&Type=' . $_GET['Type']. '">' . _('Delete') . '</a></td> </tr>'; $BatchTotal= $BatchTotal + $ReceiptItem->Amount; } @@ -918,7 +918,7 @@ echo '<table class=selection>'; - $DisplayDiscountPercent = number_format($_SESSION['CustomerRecord']['pymtdiscount']*100,2) . "%"; + $DisplayDiscountPercent = number_format($_SESSION['CustomerRecord']['pymtdiscount']*100,2) . '%'; echo '<input type="hidden" name="CustomerID" value="' . $_POST['CustomerID'] . '">'; echo '<input type="hidden" name="CustomerName" value="' . $_SESSION['CustomerRecord']['name'] . '">'; @@ -1050,9 +1050,9 @@ echo '<tr class="EvenTableRows">'; $k=1; } - - printf("<td><font size=1><input tabindex=".number_format(12+$j)." type=submit name='Select' value='%s'</font></td> - <td>%s</td></tr>", + printf('<td><font size=1> + <input tabindex='.number_format(12+$j).' type=submit name="Select" value="%s"></font></td> + <td>%s</td></tr>', $myrow['debtorno'], $myrow['name']); Modified: trunk/CustomerTypes.php =================================================================== --- trunk/CustomerTypes.php 2011-04-19 10:18:49 UTC (rev 4555) +++ trunk/CustomerTypes.php 2011-04-26 11:03:36 UTC (rev 4556) @@ -1,9 +1,7 @@ <?php -/* $Revision: 1.6 $ */ + /* $Id$*/ -//$PageSecurity = 15; - include('includes/session.inc'); $title = _('Customer Types') . ' / ' . _('Maintenance'); include('includes/header.inc'); @@ -43,7 +41,7 @@ if (strlen($_POST['typename'])==0) { $InputError = 1; - echo '<br>'; + echo '<br />'; prnMsg(_('The customer type name description must contain at least one character'),'error'); $Errors[$i] = 'CustomerType'; $i++; @@ -56,7 +54,7 @@ $checkrow=DB_fetch_row($checkresult); if ($checkrow[0]>0 and !isset($SelectedType)) { $InputError = 1; - echo '<br>'; + echo '<br />'; prnMsg(_('You already have a customer type called').' '.$_POST['typename'],'error'); $Errors[$i] = 'CustomerName'; $i++; @@ -124,7 +122,7 @@ $result = DB_query($sql,$db); $_SESSION['DefaultCustomerType'] = $_POST['typeid']; } - echo '<br>'; + echo '<br />'; prnMsg($msg,'success'); unset($SelectedType); @@ -146,7 +144,7 @@ $myrow = DB_fetch_row($result); if ($myrow[0]>0) { - prnMsg(_('Cannot delete this type because customer transactions have been created using this type') . '<br>' . _('There are') . ' ' . $myrow[0] . ' ' . _('transactions using this type'),'error'); + prnMsg(_('Cannot delete this type because customer transactions have been created using this type') . '<br />' . _('There are') . ' ' . $myrow[0] . ' ' . _('transactions using this type'),'error'); } else { @@ -156,13 +154,13 @@ $result = DB_query($sql,$db,$ErrMsg); $myrow = DB_fetch_row($result); if ($myrow[0]>0) { - prnMsg (_('Cannot delete this type because customers are currently set up to use this type') . '<br>' . _('There are') . ' ' . $myrow[0] . ' ' . _('customers with this type code')); + prnMsg (_('Cannot delete this type because customers are currently set up to use this type') . '<br />' . _('There are') . ' ' . $myrow[0] . ' ' . _('customers with this type code')); } else { $sql="DELETE FROM debtortype WHERE typeid='".$SelectedType."'"; $ErrMsg = _('The Type record could not be deleted because'); $result = DB_query($sql,$db,$ErrMsg); - echo '<br>'; + echo '<br />'; prnMsg(_('Customer type') . $SelectedType . ' ' . _('has been deleted') ,'success'); unset ($SelectedType); @@ -182,11 +180,11 @@ $sql = 'SELECT typeid, typename FROM debtortype'; $result = DB_query($sql,$db); - echo '<br><table class=selection>'; - echo "<tr> - <th>" . _('Type ID') . "</th> - <th>" . _('Type Name') . "</th> - </tr>"; + echo '<br /><table class=selection>'; + echo '<tr> + <th>' . _('Type ID') . '</th> + <th>' . _('Type Name') . '</th> + </tr>'; $k=0; //row colour counter @@ -199,16 +197,17 @@ $k=1; } - printf(" +printf('<td>%s</td> <td>%s</td> - <td>%s</td> - <td><a href='%sSelectedType=%s'>" . _('Edit') . "</td> - <td><a href='%sSelectedType=%s&delete=yes' onclick=\"return confirm('" . _('Are you sure you wish to delete this Customer Type?') . "');\">" . _('Delete') . "</td> - </tr>", + <td><a href="%sSelectedType=%s">' . _('Edit') . '</td> + <td><a href="%sSelectedType=%s&delete=yes" onclick=\'return confirm("' . _('Are you sure you wish to delete this Customer Type?') . '");\'>' . _('Delete') . '</td> + </tr>', $myrow[0], $myrow[1], - $_SERVER['PHP_SELF'] . '?' . SID, $myrow[0], - $_SERVER['PHP_SELF'] . '?' . SID, $myrow[0]); + $_SERVER['PHP_SELF'] . '?', + $myrow[0], + $_SERVER['PHP_SELF'] . '?', + $myrow[0]); } //END WHILE LIST LOOP echo '</table>'; @@ -217,18 +216,17 @@ //end of ifs and buts! if (isset($SelectedType)) { - echo '<div class="centre"><p><a href="' . $_SERVER['PHP_SELF'] . '?' . SID . '">' . _('Show All Types Defined') . '</a></div><p>'; + echo '<div class="centre"><p><a href="' . $_SERVER['PHP_SELF'] . '">' . _('Show All Types Defined') . '</a></div><p>'; } if (! isset($_GET['delete'])) { - 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'] . '" />'; echo '<p><table class=selection>'; //Main table // The user wish to EDIT an existing type - if ( isset($SelectedType) AND $SelectedType!='' ) - { + if ( isset($SelectedType) AND $SelectedType!='' ) { $sql = "SELECT typeid, typename @@ -241,26 +239,23 @@ $_POST['typeid'] = $myrow['typeid']; $_POST['typename'] = $myrow['typename']; - echo "<input type=hidden name='SelectedType' VALUE=" . $SelectedType . ">"; - echo "<input type=hidden name='typeid' VALUE=" . $_POST['typeid'] . ">"; - echo "<table class=selection> <tr><td>"; + echo '<input type=hidden name="SelectedType" value="' . $SelectedType . '">'; + echo '<input type=hidden name="typeid" value=' . $_POST['typeid'] . '">'; + echo '<table class="selection">'; // We dont allow the user to change an existing type code - echo 'Type ID: ' . $_POST['typeid'] . '</td></tr>'; + echo '<tr><td>' . _('Type ID') . ': ' . $_POST['typeid'] . '</td></tr>'; } else { - // This is a new type so the user may volunteer a type code - - echo "<table class=selection>"; - + echo '<table class="selection">'; } if (!isset($_POST['typename'])) { $_POST['typename']=''; } - echo "<tr><td>" . _('Type Name') . ":</td><td><input type='Text' name='typename' value='" . $_POST['typename'] . "'></td></tr>"; + echo '<tr><td>' . _('Type Name') . ':</td><td><input type="Text" name="typename" value="' . $_POST['typename'] . '"></td></tr>'; echo '</td></tr></table>'; // close main table Modified: trunk/Customers.php =================================================================== --- trunk/Customers.php 2011-04-19 10:18:49 UTC (rev 4555) +++ trunk/Customers.php 2011-04-26 11:03:36 UTC (rev 4556) @@ -281,11 +281,11 @@ $BranchCode = substr($_POST['DebtorNo'],0,4); - echo "<meta http-equiv='Refresh' content='0; url=" . $rootpath ."/CustomerBranches.php?" . SID . "&DebtorNo=" . $_POST['DebtorNo'] . "'>"; + echo '<meta http-equiv="Refresh" content="0; url=' . $rootpath .'/CustomerBranches.php?DebtorNo=' . $_POST['DebtorNo'] . '">'; echo '<div class="centre">' . _('You should automatically be forwarded to the entry of a new Customer Branch page') . '. ' . _('If this does not happen') .' (' . _('if the browser does not support META Refresh') . ') ' . - "<a href='" . $rootpath . "/CustomerBranches.php?" . SID . "&DebtorNo=" . $_POST['DebtorNo'] . '.</div>'; + '<a href="' . $rootpath . '/CustomerBranches.php?DebtorNo=' . $_POST['DebtorNo'] . '"></a></div>'; include('includes/footer.inc'); exit; @@ -421,8 +421,8 @@ /* First check that all the necessary items have been setup */ $SetupErrors=0; //Count errors - $sql='SELECT COUNT(typeabbrev) - FROM salestypes'; + $sql="SELECT COUNT(typeabbrev) + FROM salestypes"; $result=DB_query($sql, $db); $myrow=DB_fetch_row($result); if ($myrow[0]==0) { @@ -430,8 +430,8 @@ _('Click').' '.'<a target="_blank" href="' . $rootpath . '/SalesTypes.php">' . _('here').' ' . '</a>'._('to set up your price lists'),'warning').'<br />'; $SetupErrors += 1; } - $sql='SELECT COUNT(typeid) - FROM debtortype'; + $sql="SELECT COUNT(typeid) + FROM debtortype"; $result=DB_query($sql, $db); $myrow=DB_fetch_row($result); if ($myrow[0]==0) { @@ -445,20 +445,20 @@ include('includes/footer.inc'); exit; } - - 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'] . '" />'; - echo "<input type='Hidden' name='New' value='Yes'>"; + echo '<input type="hidden" name="New" value="Yes" />'; $DataError =0; - echo '<table class=selection cellspacing=4><tr><td valign=top><table class=selection>'; + echo '<table cl... [truncated message content] |
From: <dai...@us...> - 2011-04-26 11:03:46
|
Revision: 4556 http://web-erp.svn.sourceforge.net/web-erp/?rev=4556&view=rev Author: daintree Date: 2011-04-26 11:03:36 +0000 (Tue, 26 Apr 2011) Log Message: ----------- rework scripts for xhtml and quoting Modified Paths: -------------- trunk/CustEDISetup.php trunk/CustLoginSetup.php trunk/CustWhereAlloc.php trunk/CustomerBranches.php trunk/CustomerReceipt.php trunk/CustomerTypes.php trunk/Customers.php trunk/InventoryValuation.php trunk/WWW_Users.php trunk/build/make_release.sh trunk/includes/GetConfig.php trunk/includes/LanguageSetup.php trunk/includes/PDFInventoryValnPageHeader.inc trunk/includes/session.inc trunk/locale/cs_CZ.utf8/LC_MESSAGES/messages.mo trunk/locale/cs_CZ.utf8/LC_MESSAGES/messages.po trunk/locale/de_DE.utf8/LC_MESSAGES/messages.mo trunk/locale/de_DE.utf8/LC_MESSAGES/messages.po trunk/locale/el_GR.utf8/LC_MESSAGES/messages.mo trunk/locale/el_GR.utf8/LC_MESSAGES/messages.po trunk/locale/en_GB.utf8/LC_MESSAGES/messages.pot trunk/locale/en_US.utf8/LC_MESSAGES/messages.mo trunk/locale/en_US.utf8/LC_MESSAGES/messages.po trunk/locale/es_ES.utf8/LC_MESSAGES/messages.mo trunk/locale/es_ES.utf8/LC_MESSAGES/messages.po trunk/locale/et_EE.utf8/LC_MESSAGES/messages.mo trunk/locale/et_EE.utf8/LC_MESSAGES/messages.po trunk/locale/fa_IR.utf8/LC_MESSAGES/messages.mo trunk/locale/fa_IR.utf8/LC_MESSAGES/messages.po trunk/locale/fr_FR.utf8/LC_MESSAGES/messages.mo trunk/locale/fr_FR.utf8/LC_MESSAGES/messages.po trunk/locale/hi_IN.utf8/LC_MESSAGES/messages.mo trunk/locale/hi_IN.utf8/LC_MESSAGES/messages.po trunk/locale/hr_HR.utf8/LC_MESSAGES/messages.mo trunk/locale/hr_HR.utf8/LC_MESSAGES/messages.po trunk/locale/hu_HU.utf8/LC_MESSAGES/messages.mo trunk/locale/hu_HU.utf8/LC_MESSAGES/messages.po trunk/locale/id_ID.utf8/LC_MESSAGES/messages.mo trunk/locale/id_ID.utf8/LC_MESSAGES/messages.po trunk/locale/it_IT.utf8/LC_MESSAGES/messages.mo trunk/locale/it_IT.utf8/LC_MESSAGES/messages.po trunk/locale/ja_JP.utf8/LC_MESSAGES/messages.mo trunk/locale/ja_JP.utf8/LC_MESSAGES/messages.po trunk/locale/lv_LV.utf8/LC_MESSAGES/messages.mo trunk/locale/lv_LV.utf8/LC_MESSAGES/messages.po trunk/locale/nl_NL.utf8/LC_MESSAGES/messages.mo trunk/locale/nl_NL.utf8/LC_MESSAGES/messages.po trunk/locale/pl_PL.utf8/LC_MESSAGES/messages.mo trunk/locale/pl_PL.utf8/LC_MESSAGES/messages.po trunk/locale/pt_BR.utf8/LC_MESSAGES/messages.mo trunk/locale/pt_BR.utf8/LC_MESSAGES/messages.po trunk/locale/pt_PT.utf8/LC_MESSAGES/messages.mo trunk/locale/pt_PT.utf8/LC_MESSAGES/messages.po trunk/locale/ro_RO.utf8/LC_MESSAGES/messages.mo trunk/locale/ro_RO.utf8/LC_MESSAGES/messages.po trunk/locale/ru_RU.utf8/LC_MESSAGES/messages.mo trunk/locale/ru_RU.utf8/LC_MESSAGES/messages.po trunk/locale/sq_AL.utf8/LC_MESSAGES/messages.mo trunk/locale/sq_AL.utf8/LC_MESSAGES/messages.po trunk/locale/sv_SE.utf8/LC_MESSAGES/messages.mo trunk/locale/sv_SE.utf8/LC_MESSAGES/messages.po trunk/locale/sw_KE.utf8/LC_MESSAGES/messages.mo trunk/locale/sw_KE.utf8/LC_MESSAGES/messages.po trunk/locale/tr_TR.utf8/LC_MESSAGES/messages.mo trunk/locale/tr_TR.utf8/LC_MESSAGES/messages.po trunk/locale/vi_VN.utf8/LC_MESSAGES/messages.mo trunk/locale/vi_VN.utf8/LC_MESSAGES/messages.po trunk/locale/zh_CN.utf8/LC_MESSAGES/messages.mo trunk/locale/zh_CN.utf8/LC_MESSAGES/messages.po trunk/locale/zh_HK.utf8/LC_MESSAGES/messages.mo trunk/locale/zh_HK.utf8/LC_MESSAGES/messages.po trunk/sql/mysql/weberp-demo.sql trunk/sql/mysql/weberp-new.sql Modified: trunk/CustEDISetup.php =================================================================== --- trunk/CustEDISetup.php 2011-04-19 10:18:49 UTC (rev 4555) +++ trunk/CustEDISetup.php 2011-04-26 11:03:36 UTC (rev 4556) @@ -1,14 +1,12 @@ <?php -/* $Revision: 1.11 $ */ + /* $Id$*/ -//$PageSecurity = 11; - include('includes/session.inc'); $title = _('Customer EDI Set Up'); include('includes/header.inc'); -echo "<a href='" . $rootpath . '/SelectCustomer.php?' . SID . "'>" . _('Back to Customers') . '</a><br>'; +echo '<a href="' . $rootpath . '/SelectCustomer.php">' . _('Back to Customers') . '</a><br />'; if (isset($Errors)) { unset($Errors); @@ -27,10 +25,7 @@ //first off validate inputs sensible - if (strstr($_POST['EDIReference'],"'") - OR strstr($_POST['EDIReference'],'+') - OR strstr($_POST['EDIReference'],"\"") - OR strstr($_POST['EDIReference'],'&') + if (ContainsIllegalCharacters($_POST['EDIReference']) OR strstr($_POST['EDIReference'],' ')) { $InputError = 1; prnMsg(_('The customers EDI reference code cannot contain any of the following characters') .' - \' & + \" ' . _('or a space'),'warn'); @@ -75,9 +70,9 @@ } } -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'] . '" />'; -echo '<br><table class=selection>'; +echo '<br /><table class=selection>'; $sql = "SELECT debtorno, name, @@ -105,59 +100,59 @@ if ($myrow['ediinvoices']==0){ - echo '<option selected VALUE=0>'._('Disabled'); - echo '<option VALUE=1>'._('Enabled'); + echo '<option selected value=0>'._('Disabled') . '</option>'; + echo '<option value=1>'._('Enabled'). '</option>'; } else { - echo '<option VALUE=0>'._('Disabled'); - echo '<option selected VALUE=1>'._('Enabled'); + echo '<option value=0>'._('Disabled') . '</option>'; + echo '<option selected value=1>'._('Enabled') . '</option>'; } -echo "</select><a href='$rootpath/EDIMessageFormat.php?" . SID . "&MessageType=INVOIC&PartnerCode=" . $_SESSION['CustomerID'] . "'>"._('Create') . '/' . _('Edit Invoice Message Format').'</a></td></tr>'; +echo '</select><a href="' . $rootpath . '/EDIMessageFormat.php?MessageType=INVOIC&PartnerCode=' . $_SESSION['CustomerID'] . '">'._('Create') . '/' . _('Edit Invoice Message Format').'</a></td></tr>'; -echo '<tr><td>'._('Enable Receiving of EDI Orders').":</td> - <td><select tabindex=2 name='EDIOrders'>"; +echo '<tr><td>'._('Enable Receiving of EDI Orders') . ':</td> + <td><select tabindex=2 name="EDIOrders">'; if ($myrow['ediorders']==0){ - echo '<option selected VALUE=0>'._('Disabled'); - echo '<option VALUE=1>'._('Enabled'); + echo '<option selected value=0>'._('Disabled') . '</option>'; + echo '<option value=1>'._('Enabled') . '</option>'; } else { - echo '<option VALUE=0>'._('Disabled'); - echo '<option selected VALUE=1>'._('Enabled'); + echo '<option value=0>'._('Disabled') . '</option>'; + echo '<option selected value=1>'._('Enabled') . '</option>'; } echo '</select></td></tr>'; -echo '<tr><td>'._('Customer EDI Reference').":</td> - <td><input " . (in_array('EDIReference',$Errors) ? 'class="inputerror"' : '' ) . - " tabindex=3 type='Text' name='EDIReference' size=20 maxlength=20 value='" . $myrow['edireference'] . "'></td></tr>"; +echo '<tr><td>'._('Customer EDI Reference') . ':</td> + <td><input ' . (in_array('EDIReference',$Errors) ? 'class="inputerror"' : '' ) . + ' tabindex=3 type="text" name="EDIReference" size=20 maxlength=20 value="' . $myrow['edireference'] . '"></td></tr>'; -echo '<tr><td>'._('EDI Communication Method').":</td> - <td><select tabindex=4 name='EDITransport'>"; +echo '<tr><td>'._('EDI Communication Method') . ':</td> + <td><select tabindex=4 name="EDITransport" >'; if ($myrow['editransport']=='email'){ - echo "<option selected value='email'>"._('Email Attachments'); - echo "<option value='ftp'>"._('File Transfer Protocol (FTP)'); + echo '<option selected value="email">'._('Email Attachments') . '</option>'; + echo '<option value="ftp">'._('File Transfer Protocol (FTP)') . '</option>'; } else { - echo "<option value='email'>"._('Email Attachments'); - echo "<option selected value='ftp'>"._('File Transfer Protocol (FTP)'); + echo '<option value="email">'._('Email Attachments') . '</option>'; + echo '<option selected value="ftp">'._('File Transfer Protocol (FTP)') . '</option>'; } echo '</select></td></tr>'; -echo '<tr><td>'._('FTP Server or Email Address').":</td> - <td><input " . (in_array('EDIAddress',$Errors) ? 'class="inputerror"' : '' ) . - " tabindex=5 type='Text' name='EDIAddress' size=42 maxlength=40 value='" . $myrow['ediaddress'] . "'></td></tr>"; +echo '<tr><td>'._('FTP Server or Email Address') . ':</td> + <td><input ' . (in_array('EDIAddress',$Errors) ? 'class="inputerror"' : '' ) . + ' tabindex=5 type="text" name="EDIAddress" size=42 maxlength=40 value="' . $myrow['ediaddress'] . '"></td></tr>'; if ($myrow['editransport']=='ftp'){ - echo '<tr><td>'._('FTP Server User Name').":</td> - <td><input tabindex=6 type='Text' name='EDIServerUser' size=20 maxlength=20 value=" . $myrow['ediserveruser'] . "></td></tr>"; - echo '<tr><td>'._('FTP Server Password').":</td> - <td><input tabindex=7 type='Text' name='EDIServerPwd' size=20 maxlength=20 value='" . $myrow['ediserverpwd'] . "'></td></tr>"; + echo '<tr><td>'._('FTP Server User Name') . ':</td> + <td><input tabindex=6 type="text" name="EDIServerUser" size=20 maxlength=20 value="' . $myrow['ediserveruser'] . '"></td></tr>'; + echo '<tr><td>'._('FTP Server Password') . ':</td> + <td><input tabindex=7 type="text" name="EDIServerPwd" size=20 maxlength=20 value="' . $myrow['ediserverpwd'] . '"></td></tr>'; } -echo "</table><br><div class='centre'><input tabindex=8 type='Submit' name='submit' value='"._('Update EDI Configuration')."'></div></form>"; +echo '</table><br /><div class="centre"><input tabindex=8 type="submit" name="submit" value="' ._('Update EDI Configuration'). '"></div></form>'; include('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/CustLoginSetup.php =================================================================== --- trunk/CustLoginSetup.php 2011-04-19 10:18:49 UTC (rev 4555) +++ trunk/CustLoginSetup.php 2011-04-26 11:03:36 UTC (rev 4556) @@ -1,9 +1,7 @@ <?php -/* $Revision: 1.2 $ */ + /* $Id$*/ -//$PageSecurity = 15; - include('includes/session.inc'); $title = _('Customer Login Configuration'); include('includes/header.inc'); @@ -21,7 +19,7 @@ _('Petty Cash'), _('Setup')); -echo "<a href='" . $rootpath . '/SelectCustomer.php?' . SID . "'>" . _('Back to Customers') . '</a><br>'; +echo '<a href="' . $rootpath . '/SelectCustomer.php">' . _('Back to Customers') . '</a><br>'; $sql="SELECT name FROM debtorsmaster @@ -33,17 +31,15 @@ echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/customer.png" title="' . _('Customer') . '" alt="" />' . ' ' . _('Customer') . ' : ' . $_SESSION['CustomerID'] . ' - ' . $CustomerName. _(' has been selected') . - '</p><br />';//'</p>'; -//echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/group_add.png" title="' . _('Search') . '" alt="">' . ' ' . $title.'<br>'; + '</p><br />'; - //Make an array of the security roles where only one role is active and is ID 1 //For the security role selection box, we will only show roles that have: //- Only one entry in securitygroups AND the tokenid of this entry == 1 //First get all available security role ID's' -$query_roles = 'SELECT secroleid FROM securityroles'; +$query_roles = "SELECT secroleid FROM securityroles"; $result_roles = DB_query($query_roles, $db); //Check for every security role if they have only one entry in securitygroups, if so check if the tokenid == 1, then store in selection box @@ -65,9 +61,7 @@ $SecurityRoles[$Sec_row[0]] = $Sec_row[1]; } DB_free_result($Sec_Result); - } - } if (isset($_GET['SelectedUser'])){ @@ -88,7 +82,7 @@ if (strlen($_POST['UserID'])<3){ $InputError = 1; prnMsg(_('The user ID entered must be at least 4 characters long'),'error'); - } elseif (ContainsIllegalCharacters($_POST['UserID'])) { + } elseif (ContainsIllegalCharacters($_POST['UserID']) OR strstr($_POST['UserID'],' ')) { $InputError = 1; prnMsg(_('User names cannot contain any of the following characters') . " - ' & + \" \\ " . _('or a space'),'error'); } elseif (strlen($_POST['Password'])<5){ @@ -270,18 +264,19 @@ $result = DB_query($sql,$db); echo '<table class=selection>'; - echo "<tr><th>" . _('User Login') . "</th> - <th>" . _('Full Name') . "</th> - <th>" . _('Telephone') . "</th> - <th>" . _('Email') . "</th> - <th>" . _('Customer Code') . "</th> - <th>" . _('Branch Code') . "</th> - <th>" . _('Last Visit') . "</th> - <th>" . _('Security Role') ."</th> - <th>" . _('Report Size') ."</th> - <th>" . _('Theme') ."</th> - <th>" . _('Language') ."</th> - </tr>"; + + echo '<tr><th>' . _('User Login') . '</th> + <th>' . _('Full Name') . '</th> + <th>' . _('Telephone') . '</th> + <th>' . _('Email') . '</th> + <th>' . _('Customer Code') . '</th> + <th>' . _('Branch Code') . '</th> + <th>' . _('Last Visit') . '</th> + <th>' . _('Security Role') .'</th> + <th>' . _('Report Size') .'</th> + <th>' . _('Theme') .'</th> + <th>' . _('Language') .'</th> + </tr>'; $k=0; //row colour counter @@ -298,7 +293,7 @@ /*The SecurityHeadings array is defined in config.php */ - printf("<td>%s</td> + printf('<td>%s</td> <td>%s</td> <td>%s</td> <td>%s</td> @@ -309,9 +304,9 @@ <td>%s</td> <td>%s</td> <td>%s</td> - <td><a href=\"%s&SelectedUser=%s\">" . _('Edit') . "</a></td> - <td><a href=\"%s&SelectedUser=%s&delete=1\">" . _('Delete') . "</a></td> - </tr>", + <td><a href="%s&SelectedUser=%s">' . _('Edit') . '</a></td> + <td><a href="%s&SelectedUser=%s&delete=1">' . _('Delete') . '</a></td> + </tr>', $myrow[0], $myrow[1], $myrow[2], @@ -323,9 +318,9 @@ $myrow[8], $myrow[9], $myrow[10], - $_SERVER['PHP_SELF'] . "?" . SID, + $_SERVER['PHP_SELF'] . '?', $myrow[0], - $_SERVER['PHP_SELF'] . "?" . SID, + $_SERVER['PHP_SELF'] . '?', $myrow[0]); } //END WHILE LIST LOOP @@ -334,10 +329,9 @@ if (isset($SelectedUser)) { - echo "<div class='centre'><a href='" . $_SERVER['PHP_SELF'] ."?" . SID . "'>" . _('Review Existing Users') . '</a></div><br>'; + echo '<div class="centre"><a href="' . $_SERVER['PHP_SELF'] .'">' . _('Review Existing Users') . '</a></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'] . '" />'; if (isset($SelectedUser)) { @@ -377,17 +371,16 @@ $_POST['UserLanguage'] = $myrow['language']; $_POST['Blocked'] = $myrow['blocked']; - echo "<input type='hidden' name='SelectedUser' value='" . $SelectedUser . "'>"; - echo "<input type='hidden' name='UserID' value='" . $_POST['UserID'] . "'>"; - echo "<input type='hidden' name='ModulesAllowed' value='" . $_POST['ModulesAllowed'] . "'>"; + echo '<input type="hidden" name="SelectedUser" value="' . $SelectedUser . '">'; + echo '<input type="hidden" name="UserID" value="' . $_POST['UserID'] . '">'; + echo '<input type="hidden" name="ModulesAllowed" value="' . $_POST['ModulesAllowed'] . '">'; - echo '<table class=selection> <tr><td>' . _('User code') . ':</td><td>'; + echo '<table class="selection"> <tr><td>' . _('User code') . ':</td><td>'; echo $_POST['UserID'] . '</td></tr>'; } else { //end of if $SelectedUser only do the else when a new record is being entered + echo '<table class=selection><tr><td>' . _('User Login') . ':</td><td><input type="text" name="UserID" size=22 maxlength=20 /></td></tr>'; - echo '<table class=selection><tr><td>' . _('User Login') . ":</td><td><input type='text' name='UserID' size=22 maxlength=20 ></td></tr>"; - /*set the default modules to show to all this had trapped a few people previously*/ $i=0; @@ -415,53 +408,48 @@ if (!isset($_POST['Email'])) { $_POST['Email']=''; } -echo '<tr><td>' . _('Password') . ":</td> - <td><input type='password' name='Password' size=22 maxlength=20 value='" . $_POST['Password'] . "'></tr>"; -echo '<tr><td>' . _('Full Name') . ":</td> - <td><input type='text' name='RealName' value='" . $_POST['RealName'] . "' size=36 maxlength=35></td></tr>"; -echo '<tr><td>' . _('Telephone No') . ":</td> - <td><input type='text' name='Phone' value='" . $_POST['Phone'] . "' size=32 maxlength=30></td></tr>"; -echo '<tr><td>' . _('Email Address') .":</td> - <td><input type='text' name='Email' value='" . $_POST['Email'] ."' size=32 maxlength=55></td></tr>"; -echo '<tr><td>' . _('Security Role') . ":</td><td><select name='Access'>"; +echo '<tr><td>' . _('Password') . ':</td> + <td><input type="password" name="Password" size=22 maxlength=20 value="' . $_POST['Password'] . '"></tr>'; +echo '<tr><td>' . _('Full Name') . ':</td> + <td><input type="text" name="RealName" value="' . $_POST['RealName'] . '" size=36 maxlength=35></td></tr>'; +echo '<tr><td>' . _('Telephone No') . ':</td> + <td><input type="text" name="Phone" value="' . $_POST['Phone'] . '" size=32 maxlength=30></td></tr>'; +echo '<tr><td>' . _('Email Address') .':</td> + <td><input type="text" name="Email" value="' . $_POST['Email'] .'" size=32 maxlength=55></td></tr>'; +echo '<tr><td>' . _('Security Role') . ':</td><td><select name="Access">'; foreach ($SecurityRoles as $SecKey => $SecVal) { if (isset($_POST['Access']) and $SecKey == $_POST['Access']){ - echo "<option selected value=" . $SecKey . ">" . $SecVal; + echo '<option selected value="' . $SecKey . '">' . $SecVal .'</option>'; } else { - echo "<option value=" . $SecKey . ">" . $SecVal; + echo '<option value="' . $SecKey . '">' . $SecVal .'</option>'; } } echo '</select></td></tr>'; echo '<input type="hidden" name="ID" value="'.$_SESSION['UserID'].'">'; +echo '<tr><td>' . _('Default Location') . ':</td> + <td><select name="DefaultLocation">'; -echo '<tr><td>' . _('Default Location') . ":</td> - <td><select name='DefaultLocation'>"; - $sql = "SELECT loccode, locationname FROM locations"; $result = DB_query($sql,$db); while ($myrow=DB_fetch_array($result)){ - if (isset($_POST['DefaultLocation']) and $myrow['loccode'] == $_POST['DefaultLocation']){ - - echo "<option selected value='" . $myrow['loccode'] . "'>" . $myrow['locationname']; - + echo '<option selected value="' . $myrow['loccode'] . '">' . $myrow['locationname'] .'</option>'; } else { - echo "<option Value='" . $myrow['loccode'] . "'>" . $myrow['locationname']; - + echo '<option Value="' . $myrow['loccode'] . '">' . $myrow['locationname'] .'</option>'; } - } + //Customer is fixed by selection of customer $_POST['Cust']=$_SESSION['CustomerID']; echo '<input type="hidden" name="Cust" value="' . $_POST['Cust'] . '">'; echo '<tr><td>'._('Customer Code').':</td> <td>' . $_POST['Cust'] . '</td></tr>'; -echo '<tr><td>' . _('Branch Code') . ":</td> - <td><select name='BranchCode'>"; +echo '<tr><td>' . _('Branch Code') . ':</td> + <td><select name="BranchCode">'; $sql = "SELECT branchcode FROM custbranch WHERE debtorno = '" . $_POST['Cust'] . "'"; $result = DB_query($sql,$db); @@ -474,79 +462,75 @@ } if (isset($_POST['BranchCode']) and $myrow['branchcode'] == $_POST['BranchCode']){ - - echo "<option selected value='" . $myrow['branchcode'] . "'>" . $myrow['branchcode']; - + echo '<option selected value="' . $myrow['branchcode'] . '">' . $myrow['branchcode'] . '</option>'; } else { - echo "<option Value='" . $myrow['branchcode'] . "'>" . $myrow['branchcode']; - + echo '<option Value="' . $myrow['branchcode'] . '">' . $myrow['branchcode'] . '</option>'; } - } -echo '<tr><td>' . _('Reports Page Size') .":</td> - <td><select name='PageSize'>"; +echo '<tr><td>' . _('Reports Page Size') .':</td> + <td><select name="PageSize">'; if(isset($_POST['PageSize']) and $_POST['PageSize']=='A4'){ - echo "<option selected value='A4'>" . _('A4'); + echo '<option selected value="A4">' . _('A4') .'</option>'; } else { - echo "<option value='A4'>A4"; + echo '<option value="A4">' . _('A4') . '</option>'; } if(isset($_POST['PageSize']) and $_POST['PageSize']=='A3'){ - echo "<option selected Value='A3'>" . _('A3'); + echo '<option selected value="A3">' . _('A3') .'</option>'; } else { - echo "<option value='A3'>A3"; + echo '<option value="A3">' . _('A3') .'</option>'; } if(isset($_POST['PageSize']) and $_POST['PageSize']=='A3_landscape'){ - echo "<option selected Value='A3_landscape'>" . _('A3') . ' ' . _('landscape'); + echo '<option selected value="A3_landscape">' . _('A3') . ' ' . _('landscape') .'</option>'; } else { - echo "<option value='A3_landscape'>" . _('A3') . ' ' . _('landscape'); + echo '<option value="A3_landscape">' . _('A3') . ' ' . _('landscape') .'</option>'; } if(isset($_POST['PageSize']) and $_POST['PageSize']=='letter'){ - echo "<option selected Value='letter'>" . _('Letter'); + echo '<option selected value="letter">' . _('Letter') .'</option>'; } else { - echo "<option value='letter'>" . _('Letter'); + echo '<option value="letter">' . _('Letter') .'</option>'; } if(isset($_POST['PageSize']) and $_POST['PageSize']=='letter_landscape'){ - echo "<option selected Value='letter_landscape'>" . _('Letter') . ' ' . _('landscape'); + echo '<option selected value="letter_landscape">' . _('Letter') . ' ' . _('landscape') .'</option>'; } else { - echo "<option value='letter_landscape'>" . _('Letter') . ' ' . _('landscape'); + echo '<option value="letter_landscape">' . _('Letter') . ' ' . _('landscape') .'</option>'; } if(isset($_POST['PageSize']) and $_POST['PageSize']=='legal'){ - echo "<option selected value='legal'>" . _('Legal'); + echo '<option selected value="legal">' . _('Legal') .'</option>'; } else { - echo "<option Value='legal'>" . _('Legal'); + echo '<option value="legal">' . _('Legal') .'</option>'; } if(isset($_POST['PageSize']) and $_POST['PageSize']=='legal_landscape'){ - echo "<option selected value='legal_landscape'>" . _('Legal') . ' ' . _('landscape'); + echo '<option selected value="legal_landscape">' . _('Legal') . ' ' . _('landscape') .'</option>'; } else { - echo "<option value='legal_landscape'>" . _('Legal') . ' ' . _('landscape'); + echo '<option value="legal_landscape">' . _('Legal') . ' ' . _('landscape') .'</option>'; } echo '</select></td></tr>'; echo '<tr> - <td>' . _('Theme') . ":</td> - <td><select name='Theme'>"; + <td>' . _('Theme') . ':</td> + <td><select name="Theme">'; $ThemeDirectory = dir('css/'); while (false != ($ThemeName = $ThemeDirectory->read())){ - if (is_dir("css/$ThemeName") AND $ThemeName != '.' AND $ThemeName != '..' AND $ThemeName != 'CVS'){ + if (is_dir('css/' . $ThemeName) AND $ThemeName != '.' AND $ThemeName != '..' AND $ThemeName != '.svn'){ if (isset($_POST['Theme']) and $_POST['Theme'] == $ThemeName){ - echo "<option selected value='$ThemeName'>$ThemeName"; + echo '<option selected value="' . $ThemeName . '">' . $ThemeName .'</option>'; } else if (!isset($_POST['Theme']) and ($_SESSION['DefaultTheme']==$ThemeName)) { - echo "<option selected value='$ThemeName'>$ThemeName"; + echo '<option selected value="' . $ThemeName . '">' . $ThemeName .'</option>'; } else { - echo "<option value='$ThemeName'>$ThemeName"; + echo '<option value="' . $ThemeName . '">' . $ThemeName .'</option>'; } } } @@ -555,22 +539,25 @@ echo '<tr> - <td>' . _('Language') . ":</td> - <td><select name='UserLanguage'>"; + <td>' . _('Language') . ':</td> + <td><select name="UserLanguage">'; - $LangDirHandle = dir('locale/'); +$Languages = scandir('locale/', 0); -while (false != ($LanguageEntry = $LangDirHandle->read())){ +foreach ($Languages as $LanguageEntry){ - if (is_dir('locale/' . $LanguageEntry) AND $LanguageEntry != '..' AND $LanguageEntry != 'CVS' AND $LanguageEntry!='.'){ + if (is_dir('locale/' . $LanguageEntry) + AND $LanguageEntry != '..' + AND $LanguageEntry != '.svn' + AND $LanguageEntry!='.'){ if (isset($_POST['UserLanguage']) and $_POST['UserLanguage'] == $LanguageEntry){ - echo "<option selected value='$LanguageEntry'>$LanguageEntry"; + echo '<option selected value="' . $LanguageEntry . '">' . $LanguageEntry .'</option>'; } elseif (!isset($_POST['UserLanguage']) and $LanguageEntry == $DefaultLanguage) { - echo "<option selected value='$LanguageEntry'>$LanguageEntry"; + echo '<option selected value="' . $LanguageEntry . '">' . $LanguageEntry .'</option>'; } else { - echo "<option value='$LanguageEntry'>$LanguageEntry"; + echo '<option value="' . $LanguageEntry . '">' . $LanguageEntry .'</option>'; } } } @@ -584,32 +571,34 @@ $i=0; foreach($ModuleList as $ModuleName){ - echo '<tr><td>' . _('Display') . ' ' . $ModuleName . ' ' . _('options') . ": </td><td><select name='Module_" . $i . "'>"; + echo '<tr><td>' . _('Display') . ' ' . $ModuleName . ' ' . _('options') . ': </td> + <td><select name="Module_' . $i . '">'; if ($ModulesAllowed[$i]==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>'; $i++; } -echo '<tr><td>' . _('Account Status') . ":</td><td><select name='Blocked'>"; +echo '<tr><td>' . _('Account Status') . ':</td> + <td><select name="Blocked">'; if ($_POST['Blocked']==0){ - echo '<option selected value=0>' . _('Open'); - echo '<option value=1>' . _('Blocked'); + echo '<option selected value=0>' . _('Open') . '</option>'; + echo '<option value=1>' . _('Blocked') . '</option>'; } else { - echo '<option selected value=1>' . _('Blocked'); - echo '<option value=0>' . _('Open'); + echo '<option selected value=1>' . _('Blocked') . '</option>'; + echo '<option value=0>' . _('Open') . '</option>'; } echo '</select></td></tr>'; +echo '</table><br> + <div class="centre"><input type="submit" name="submit" value="' . _('Enter Information') . '"></div> + </form>'; -echo "</table><br> - <div class='centre'><input type='submit' name='submit' value='" . _('Enter Information') . "'></div></form>"; - if (isset($_GET['SelectedUser'])) { echo '<script type="text/javascript">defaultControl(document.forms[0].Password);</script>'; } else { @@ -617,5 +606,4 @@ } include('includes/footer.inc'); - ?> \ No newline at end of file Modified: trunk/CustWhereAlloc.php =================================================================== --- trunk/CustWhereAlloc.php 2011-04-19 10:18:49 UTC (rev 4555) +++ trunk/CustWhereAlloc.php 2011-04-26 11:03:36 UTC (rev 4556) @@ -1,13 +1,12 @@ <?php -/* $Revision: 1.10 $ */ + /* $Id$*/ -//$PageSecurity = 2; include('includes/session.inc'); $title = _('Customer How Paid Inquiry'); include('includes/header.inc'); -echo "<form action='" . $_SERVER['PHP_SELF'] . "' method=post>"; +echo '<form action="' . $_SERVER['PHP_SELF'] . '" method=post>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/money_add.png" title="' . @@ -15,32 +14,33 @@ echo '<table class=selection cellpadding=2><tr>'; -echo '<td>' . _('Type') . ":</td><td><select tabindex=1 name='TransType'> "; +echo '<td>' . _('Type') . ':</td> + <td><select tabindex=1 name="TransType"> '; $sql = "SELECT typeid, typename FROM systypes WHERE typeid = 10 OR typeid=12"; $resultTypes = DB_query($sql,$db); while ($myrow=DB_fetch_array($resultTypes)){ if (isset($_POST['TransType'])){ if ($myrow['typeid'] == $_POST['TransType']){ - echo "<option selected Value='" . $myrow['typeid'] . "'>" . $myrow['typename']; + echo '<option selected value="' . $myrow['typeid'] . '">' . $myrow['typename'] . '</option>'; } else { - echo "<option Value='" . $myrow['typeid'] . "'>" . $myrow['typename']; + echo '<option Value="' . $myrow['typeid'] . '">' . $myrow['typename'] . '</option>'; } } else { - echo "<option Value='" . $myrow['typeid'] . "'>" . $myrow['typename']; + echo '<option value="' . $myrow['typeid'] . '">' . $myrow['typename'] . '</option>'; } } echo '</select></td>'; if (!isset($_POST['TransNo'])) {$_POST['TransNo']='';} -echo '<td>'._('Transaction Number').":</td> - <td><input tabindex=2 type=text name='TransNo' maxlength=10 size=10 value=". $_POST['TransNo'] . '></td>'; +echo '<td>'._('Transaction Number').':</td> + <td><input tabindex=2 type="text" name="TransNo" maxlength=10 size=10 value="'. $_POST['TransNo'] . '"></td>'; -echo "</tr></table><br> - <div class='centre'><input tabindex=3 type=submit name='ShowResults' value="._('Show How Allocated').'></div>'; +echo '</tr></table><br /> + <div class="centre"><input tabindex=3 type="submit" name="ShowResults" value="' . _('Show How Allocated') . '"></div>'; if (isset($_POST['ShowResults']) AND $_POST['TransNo']==''){ - echo '<br>'; + echo '<br />'; prnMsg(_('The transaction number to be queried must be entered first'),'warn'); } @@ -59,7 +59,6 @@ $myrow = DB_fetch_array($result); $AllocToID = $myrow['id']; - $sql = "SELECT type, transno, trandate, @@ -79,18 +78,20 @@ if (DB_num_rows($TransResult)==0){ prnMsg(_('There are no allocations made against this transaction'),'info'); } else { - echo '<br><table cellpadding=2 class=selection>'; + echo '<br /><table cellpadding=2 class=selection>'; - echo '<tr><th colspan=6><div class="centre"><font size=3 color=blue><b>'._('Allocations made against invoice number') . ' ' . $_POST['TransNo'] - . '<br>'._('Transaction Total').': '. number_format($myrow['totamt'],2) . '</font></b></div></th></tr>'; + echo '<tr> + <th colspan=6><div class="centre"><font size=3 color=blue><b>'._('Allocations made against invoice number') . ' ' . $_POST['TransNo'] . '<br />'._('Transaction Total').': '. number_format($myrow['totamt'],2) . '</font></b></div></th> + </tr>'; - $tableheader = "<tr><th>"._('Type')."</th> - <th>"._('Number')."</th> - <th>"._('Reference')."</th> - <th>"._('Ex Rate')."</th> - <th>"._('Amount')."</th> - <th>"._('Alloc').'</th> - </tr>'; + $tableheader = '<tr> + <th>' . _('Type') . '</th> + <th>' . _('Number') . '</th> + <th>' . _('Reference') . '</th> + <th>' . _('Ex Rate') . '</th> + <th>' . _('Amount') . '</th> + <th>' . _('Alloc') . '</th> + </tr>'; echo $tableheader; $RowCounter = 1; @@ -112,13 +113,13 @@ } else { $TransType = _('Receipt'); } - echo "<td>".$TransType."</td> - <td>".$myrow['transno']."</td> - <td>".$myrow['reference']."</td> - <td>".$myrow['rate']."</td> - <td class=number>".number_format($myrow['totalamt'],2)."</td> - <td class=number>".number_format($myrow['amt'],2)."</td> - </tr>"; + echo '<td>' . $TransType . '</td> + <td>' . $myrow['transno'] . '</td> + <td>' . $myrow['reference'] . '</td> + <td>' . $myrow['rate'] . '</td> + <td class=number>' . number_format($myrow['totalamt'],$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class=number>' . number_format($myrow['amt'],$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + </tr>'; $RowCounter++; If ($RowCounter == 12){ Modified: trunk/CustomerBranches.php =================================================================== --- trunk/CustomerBranches.php 2011-04-19 10:18:49 UTC (rev 4555) +++ trunk/CustomerBranches.php 2011-04-26 11:03:36 UTC (rev 4556) @@ -1,10 +1,7 @@ <?php -/* $Revision: 1.53 $ */ /* $Id$*/ -//$PageSecurity = 3; - include('includes/session.inc'); $title = _('Customer Branches'); include('includes/header.inc'); @@ -17,7 +14,7 @@ if (!isset($DebtorNo)) { prnMsg(_('This page must be called with the debtor code of the customer for whom you wish to edit the branches for').'. - <br>'._('When the pages is called from within the system this will always be the case').' <br>'. + <br />'._('When the pages is called from within the system this will always be the case').' <br />'. _('Select a customer first then select the link to add/edit/delete branches'),'warn'); include('includes/footer.inc'); exit; @@ -30,9 +27,6 @@ $SelectedBranch = strtoupper($_POST['SelectedBranch']); } -// This link is already available on the menu on this page -//echo "<a href='" . $rootpath . '/SelectCustomer.php?' . SID . "'>" . _('Back to Customers') . '</a><br>'; - if (isset($Errors)) { unset($Errors); } @@ -107,39 +101,35 @@ define("KEY", $api_key); if ($map_host=="") { // check that some sane values are setup already in geocode tables, if not skip the geocoding but add the record anyway. - echo '<div class="warn">' . _('Warning - Geocode Integration is enabled, but no hosts are setup. Go to Geocode Setup') . '</div>'; + echo '<div class="warn">' . _('Warning - Geocode Integration is enabled, but no hosts are setup. Go to Geocode Setup') . '</div>'; } else { - - $address = $_POST["BrAddress1"] . ", " . $_POST["BrAddress2"] . ", " . $_POST["BrAddress3"] . ", " . $_POST["BrAddress4"]; - - $base_url = "http://" . MAPS_HOST . "/maps/geo?output=xml" . "&key=" . KEY; - $request_url = $base_url . "&q=" . urlencode($address); - $xml = simplexml_load_string(utf8_encode(file_get_contents($request_url))) or die("url not loading"); -// $xml = simplexml_load_file($request_url) or die("url not loading"); - - $coordinates = $xml->Response->Placemark->Point->coordinates; - $coordinatesSplit = explode(",", $coordinates); - // Format: Longitude, Latitude, Altitude - $latitude = $coordinatesSplit[1]; - $longitude = $coordinatesSplit[0]; - - $status = $xml->Response->Status->code; - if (strcmp($status, "200") == 0) { - // Successful geocode - $geocode_pending = false; - $coordinates = $xml->Response->Placemark->Point->coordinates; - $coordinatesSplit = explode(",", $coordinates); - // Format: Longitude, Latitude, Altitude - $latitude = $coordinatesSplit[1]; - $longitude = $coordinatesSplit[0]; - } else { - // failure to geocode - $geocode_pending = false; - echo '<div class="page_help_text"><b>Geocode Notice:</b> Address: ' . $address . ' failed to geocode. '; - echo 'Received status ' . $status . '</div>'; - } + $address = $_POST['BrAddress1'] . ", " . $_POST['BrAddress2'] . ", " . $_POST['BrAddress3'] . ", " . $_POST['BrAddress4']; + $base_url = 'http://' . MAPS_HOST . '/maps/geo?output=xml&key=' . KEY; + $request_url = $base_url . '&q=' . urlencode($address); + $xml = simplexml_load_string(utf8_encode(file_get_contents($request_url))) or die("url not loading"); + $coordinates = $xml->Response->Placemark->Point->coordinates; + $coordinatesSplit = explode(",", $coordinates); + // Format: Longitude, Latitude, Altitude + $latitude = $coordinatesSplit[1]; + $longitude = $coordinatesSplit[0]; + + $status = $xml->Response->Status->code; + if (strcmp($status, '200') == 0) { + // Successful geocode + $geocode_pending = false; + $coordinates = $xml->Response->Placemark->Point->coordinates; + $coordinatesSplit = explode(",", $coordinates); + // Format: Longitude, Latitude, Altitude + $latitude = $coordinatesSplit[1]; + $longitude = $coordinatesSplit[0]; + } else { + // failure to geocode + $geocode_pending = false; + echo '<div class="page_help_text"><b>' . _('Geocode Notice') . ':</b> ' . _('Address') . ': ' . $address . ' ' . _('failed to geocode'); + echo _('Received status') . ' ' . $status . '</div>'; + } + } } - } if (isset($SelectedBranch) AND $InputError !=1) { /*SelectedBranch could also exist if submit had not been clicked this code would not run in this case cos submit is false of course see the delete code below*/ @@ -242,8 +232,8 @@ '" . $_POST['DeliverBlind'] . "' )"; } - echo '<br>'; - $msg = _('Customer branch<b>').' ' . $_POST['BranchCode'] . ': ' . $_POST['BrName'] . ' '._('</b>has been added, add another branch, or return to <a href=index.php>Main Menu</a>'); + echo '<br />'; + $msg = _('Customer branch').'<b> ' . $_POST['BranchCode'] . ': ' . $_POST['BrName'] . ' </b>'._('has been added, add another branch, or return to the') . ' <a href="index.php">' . _('Main Menu') . '</a>'; //run the SQL from either of the above possibilites @@ -292,7 +282,7 @@ $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); if ($myrow[0]>0) { - prnMsg(_('Cannot delete this branch because customer transactions have been created to this branch') . '<br>' . + prnMsg(_('Cannot delete this branch because customer transactions have been created to this branch') . '<br />' . _('There are').' ' . $myrow[0] . ' '._('transactions with this Branch Code'),'error'); } else { @@ -303,7 +293,7 @@ $myrow = DB_fetch_row($result); if ($myrow[0]>0) { prnMsg(_('Cannot delete this branch because sales analysis records exist for it'),'error'); - echo '<br>'._('There are').' ' . $myrow[0] . ' '._('sales analysis records with this Branch Code/customer'); + echo '<br />'._('There are').' ' . $myrow[0] . ' '._('sales analysis records with this Branch Code/customer'); } else { @@ -313,7 +303,7 @@ $myrow = DB_fetch_row($result); if ($myrow[0]>0) { prnMsg(_('Cannot delete this branch because sales orders exist for it') . '. ' . _('Purge old sales orders first'),'warn'); - echo '<br>'._('There are').' ' . $myrow[0] . ' '._('sales orders for this Branch/customer'); + echo '<br />'._('There are').' ' . $myrow[0] . ' '._('sales orders for this Branch/customer'); } else { // Check if there are any users that refer to this branch code $sql= "SELECT COUNT(*) FROM www_users WHERE www_users.branchcode='".$SelectedBranch."' AND www_users.customerid = '".$DebtorNo."'"; @@ -323,7 +313,7 @@ if ($myrow[0]>0) { prnMsg(_('Cannot delete this branch because users exist that refer to it') . '. ' . _('Purge old users first'),'warn'); - echo '<br>'._('There are').' ' . $myrow[0] . ' '._('users referring to this Branch/customer'); + echo '<br />'._('There are').' ' . $myrow[0] . ' '._('users referring to this Branch/customer'); } else { $sql="DELETE FROM custbranch WHERE branchcode='" . $SelectedBranch . "' AND debtorno='" . $DebtorNo . "'"; @@ -373,16 +363,18 @@ echo '<p Class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/customer.png" title="' . _('Customer') . '" alt="" />' . ' ' . _('Branches defined for'). ' '. $DebtorNo . ' - ' . $myrow[0] . '</p>'; echo '<table class=selection>'; - echo "<tr><th>"._('Code')."</th> - <th>"._('Name')."</th> - <th>"._('Branch Contact')."</th> - <th>"._('Salesman')."</th> - <th>"._('Area')."</th> - <th>"._('Phone No')."</th> - <th>"._('Fax No')."</th> - <th>"._('Email')."</th> - <th>"._('Tax Group')."</th> - <th>"._('Enabled?')."</th></tr>"; + + echo '<tr><th>'._('Code').'</th> + <th>'._('Name').'</th> + <th>'._('Branch Contact').'</th> + <th>'._('Salesman').'</th> + <th>'._('Area').'</th> + <th>'._('Phone No').'</th> + <th>'._('Fax No').'</th> + <th>'._('Email').'</th> + <th>'._('Tax Group').'</th> + <th>'._('Enabled?').'</th></tr>'; + $k=0; do { if ($k==1){ @@ -393,20 +385,19 @@ $k=1; } - - printf("<td>%s</td> + printf('<td>%s</td> <td>%s</td> <td>%s</td> <td>%s</td> <td>%s</td> <td>%s</td> <td>%s</td> - <td><a href='Mailto:%s'>%s</a></td> + <td><a href="Mailto:%s">%s</a></td> <td>%s</td> <td>%s</td> - <td><a href='%s?DebtorNo=%s&SelectedBranch=%s'>%s</td> - <td><a href='%s?DebtorNo=%s&SelectedBranch=%s&delete=yes' onclick=\"return confirm('" . - _('Are you sure you wish to delete this branch?') . "');\">%s</td></tr>", + <td><a href="%s?DebtorNo=%s&SelectedBranch=%s">%s</td> + <td><a href="%s?DebtorNo=%s&SelectedBranch=%s&delete=yes" onclick=\'return confirm("' . + _('Are you sure you wish to delete this branch?') . '");\'>%s</td></tr>', $myrow[10], $myrow[2], $myrow[5], @@ -431,9 +422,9 @@ } while ($myrow = DB_fetch_row($result)); //END WHILE LIST LOOP - echo '</table><br><table class=selection><tr><td><div class="centre">'; - echo '<b>'.$TotalEnable.'</b> ' . _('Branches are enabled.') . '<br>'; - echo '<b>'.$TotalDisable.'</b> ' . _('Branches are disabled.') . '<br>'; + echo '</table><br /><table class=selection><tr><td><div class="centre">'; + echo '<b>'.$TotalEnable.'</b> ' . _('Branches are enabled.') . '<br />'; + echo '<b>'.$TotalDisable.'</b> ' . _('Branches are disabled.') . '<br />'; echo '<b>'.($TotalEnable+$TotalDisable). '</b> ' . _('Total Branches') . '</div></td></tr></table>'; } else { $sql = "SELECT debtorsmaster.name, @@ -462,7 +453,7 @@ } if (!isset($_GET['delete'])) { - 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'] . '" />'; if (isset($SelectedBranch)) { @@ -532,17 +523,18 @@ $_POST['DeliverBlind'] = $myrow['deliverblind']; } - echo "<input type=hidden name='SelectedBranch' VALUE='" . $SelectedBranch . "'>"; - echo "<input type=hidden name='BranchCode' VALUE='" . $_POST['BranchCode'] . "'>"; - + echo '<input type=hidden name="SelectedBranch" value="' . $SelectedBranch . '" />'; + echo '<input type=hidden name="BranchCode" value="' . $_POST['BranchCode'] . '" />'; + echo '<p Class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/customer.png" title="' . _('Customer') . '" alt="">' . ' ' . _('Change Details for Branch'). ' '. $SelectedBranch . '</p>'; if (isset($SelectedBranch)) { - echo '<div class="centre"><a href=' . $_SERVER['PHP_SELF'] . '?' . SID . 'DebtorNo=' . $DebtorNo. '>' . _('Show all branches defined for'). ' '. $DebtorNo . '</a></div>'; + echo '<div class="centre"><a href=' . $_SERVER['PHP_SELF'] . '?DebtorNo=' . $DebtorNo. '>' . _('Show all branches defined for'). ' '. $DebtorNo . '</a></div>'; } - echo "<br><table class=selection>"; - echo "<tr><th colspan=2><div class='centre'><b>"._('Change Branch')."</b></th></tr>"; - echo "<tr><td>"._('Branch Code').':</td><td>'; + echo '<br><table class="selection">'; + echo '<tr><th colspan=2><div class="centre"><b>'._('Change Branch').'</b></th></tr>'; + echo '<tr><td>'._('Branch Code').':</td><td>'; + echo $_POST['BranchCode'] . '</td></tr>'; } else { //end of if $SelectedBranch only do the else when a new record is being entered @@ -577,8 +569,7 @@ } echo '<p Class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/customer.png" title="' . _('Customer') . '" alt="">' . ' ' . _('Add a Branch').'</p>'; echo '<table class=selection><tr><td>'._('Branch Code'). ':</td> - <td><input ' .(in_array('BranchCode',$Errors) ? 'class="inputerror"' : '' ) . - " tabindex=1 type='Text' name='BranchCode' size=12 maxlength=10 value=" . $_POST['BranchCode'] . '></td></tr>'; + <td><input ' .(in_array('BranchCode',$Errors) ? 'class="inputerror"' : '' ) . ' tabindex=1 type="text" name="BranchCode" size=12 maxlength=10 value="' . $_POST['BranchCode'] . '"></td></tr>'; $_POST['DeliverBlind'] = $_SESSION['DefaultBlindPackNote']; } @@ -590,7 +581,7 @@ if (DB_num_rows($result)==0){ echo '</table>'; prnMsg(_('There are no sales people defined as yet') . ' - ' . _('customer branches must be allocated to a sales person') . '. ' . _('Please use the link below to define at least one sales person'),'error'); - echo '<p align="center"><a href="' . $rootpath . '/SalesPeople.php?"' . SID . '">'._('Define Sales People') . '</a>'; + echo '<p align="center"><a href="' . $rootpath . '/SalesPeople.php">'._('Define Sales People') . '</a>'; include('includes/footer.inc'); exit; } @@ -654,7 +645,7 @@ if (DB_num_rows($result)==0){ echo '</table>'; prnMsg(_('There are no areas defined as yet') . ' - ' . _('customer branches must be allocated to an area') . '. ' . _('Please use the link below to define at least one sales area'),'error'); - echo "<br><a href='$rootpath/Areas.php?" . SID . "'>"._('Define Sales Areas').'</a>'; + echo '<br /><a href="' . $rootpath. '/Areas.php">'._('Define Sales Areas').'</a>'; include('includes/footer.inc'); exit; } @@ -681,7 +672,7 @@ if (DB_num_rows($result)==0){ echo '</table>'; prnMsg(_('There are no stock locations defined as yet') . ' - ' . _('customer branches must refer to a default location where stock is normally drawn from') . '. ' . _('Please use the link below to define at least one stock location'),'error'); - echo "<br><a href='$rootpath/Locations.php?" . SID . "'>"._('Define Stock Locations').'</a>'; + echo '<br /><a href="' . $rootpath . '/Locations.php">'._('Define Stock Locations').'</a>'; include('includes/footer.inc'); exit; } @@ -691,11 +682,11 @@ while ($myrow = DB_fetch_array($result)) { if (isset($_POST['DefaultLocation']) and $myrow['loccode']==$_POST['DefaultLocation']) { - echo '<option selected VALUE='; + echo '<option selected value='; } else { - echo '<option VALUE='; + echo '<option value='; } - echo $myrow['loccode'] . '>' . $myrow['locationname']; + echo $myrow['loccode'] . '>' . $myrow['locationname'] . '</option>'; } //end while loop @@ -718,7 +709,7 @@ DB_data_seek($result,0); - $sql = 'SELECT taxgroupid, taxgroupdescription FROM taxgroups'; + $sql = "SELECT taxgroupid, taxgroupdescription FROM taxgroups"; $result = DB_query($sql,$db); while ($myrow = DB_fetch_array($result)) { @@ -727,30 +718,32 @@ } else { echo '<option VALUE='; } - echo $myrow['taxgroupid'] . '>' . $myrow['taxgroupdescription']; + echo $myrow['taxgroupid'] . '>' . $myrow['taxgroupdescription'] . '</option>'; } //end while loop echo '</select></td></tr>'; - echo '<tr><td>'._('Transactions on this branch').":</td><td><select tabindex=20 name='DisableTrans'>"; + echo '<tr><td>'._('Transactions on this branch') . ':</td> + <td><select tabindex=20 name="DisableTrans">'; if ($_POST['DisableTrans']==0){ - echo '<option selected VALUE=0>' . _('Enabled'); - echo '<option VALUE=1>' . _('Disabled'); + echo '<option selected value=0>' . _('Enabled') . '</option>'; + echo '<option value=1>' . _('Disabled') . '</option>'; } else { - echo '<option selected VALUE=1>' . _('Disabled'); - echo '<option VALUE=0>' . _('Enabled'); + echo '<option selected value=1>' . _('Disabled') . '</option>'; + echo '<option value=0>' . _('Enabled') . '</option>'; } echo ' </select></td></tr>'; - echo '<tr><td>'._('Default freight/shipper method').":</td><td><select tabindex=21 name='DefaultShipVia'>"; - $SQL = 'SELECT shipper_id, shippername FROM shippers'; + echo '<tr><td>'._('Default freight/shipper method') . ':</td> + <td><select tabindex=21 name="DefaultShipVia">'; + $SQL = "SELECT shipper_id, shippername FROM shippers"; $ShipperResults = DB_query($SQL,$db); while ($myrow=DB_fetch_array($ShipperResults)){ if (isset($_POST['DefaultShipVia'])and $myrow['shipper_id']==$_POST['DefaultShipVia']){ - echo '<option selected VALUE=' . $myrow['shipper_id'] . '>' . $myrow['shippername']; + echo '<option selected value=' . $myrow['shipper_id'] . '>' . $myrow['shippername'] . '</option>'; }else { - echo '<option VALUE=' . $myrow['shipper_id'] . '>' . $myrow['shippername']; + echo '<option value=' . $myrow['shipper_id'] . '>' . $myrow['shippername'] . '</option>'; } } @@ -759,22 +752,16 @@ /* This field is a default value that will be used to set the value on the sales order which will control whether or not to display the company logo and address on the packlist */ - echo '<tr><td>' . _('Default Packlist') . ":</td><td><select tabindex=22 name='DeliverBlind'>"; - for ($p = 1; $p <= 2; $p++) { - echo '<option VALUE=' . $p; - if ($p == $_POST['DeliverBlind']) { - echo ' selected>'; - } else { - echo '>'; - } - switch ($p) { - case 1: - echo _('Show company details and logo'); break; - case 2: - echo _('Hide company details and logo'); break; - } - } - echo '</select></td></tr>'; + echo '<tr><td>' . _('Default Packlist') . ':</td><td><select tabindex=22 name="DeliverBlind">'; + if ($_POST['DeliverBlind']==2){ + echo '<option value="1">' . _('Show company details and logo') . '</option>'; + echo '<option selected value="2">' . _('Hide company details and logo') . '</option>'; + } else { + echo '<option selected value="1">' . _('Show company details and logo') . '</option>'; + echo '<option value="2">' . _('Hide company details and logo') . '</option>'; + } + + echo '</select></td></tr>'; echo '<tr><td>'._('Postal Address 1 (Street)').':</td>'; if (!isset($_POST['BrPostAddr1'])) {$_POST['BrPostAddr1']='';} @@ -792,7 +779,7 @@ if (!isset($_POST['CustBranchCode'])) {$_POST['CustBranchCode']='';} echo '<td><input tabindex=27 type="Text" name="CustBranchCode" size=31 maxlength=30 value="'. $_POST['CustBranchCode'].'"></td></tr>'; echo '</table>'; - echo '<br><div class="centre"><input tabindex=28 type="Submit" name="submit" value="' . _('Enter Branch') . '"></div>'; + echo '<br /><div class="centre"><input tabindex=28 type="Submit" name="submit" value="' . _('Enter Branch') . '"></div>'; echo '</form>'; } //end if record deleted no point displaying form to add record Modified: trunk/CustomerReceipt.php =================================================================== --- trunk/CustomerReceipt.php 2011-04-19 10:18:49 UTC (rev 4555) +++ trunk/CustomerReceipt.php 2011-04-26 11:03:36 UTC (rev 4556) @@ -231,10 +231,10 @@ echo '<br /><p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/money_add.png" title="' . _('Allocate') . '" alt="" />' . ' ' . _('Summary of Receipt Batch').'</p><br />'; echo '<table class=selection><tr><th>'._('Batch Number').'</th> - <th>'._('Date Banked').'</th> - <th>'._('Customer Name').'</th - <th>'._('GL Code').'</th - <th>'._('Amount of Receipt').'</th></tr>'; + <th>' . _('Date Banked') . '</th> + <th>' . _('Customer Name') . '</th> + <th>' . _('GL Code') . '</th> + <th>' . _('Amount of Receipt').'</th></tr>'; foreach ($_SESSION['ReceiptBatch']->Items as $ReceiptItem) { @@ -859,8 +859,8 @@ <td class=number>' . number_format($ReceiptItem->Discount,2) . '</td> <td>' . stripslashes($ReceiptItem->CustomerName) . '</td> <td>'.$ReceiptItem->GLCode.' - '.$myrow['accountname'].'</td> - <td>'.$ReceiptItem->Narrative . "</td> - <td><a href='" . $_SERVER['PHP_SELF'] . '?Delete=' . $ReceiptItem->ID . "&Type=".$_GET['Type']."'>" . _('Delete') . '</a></td> + <td>'.$ReceiptItem->Narrative . '</td> + <td><a href="' . $_SERVER['PHP_SELF'] . '?Delete=' . $ReceiptItem->ID . '&Type=' . $_GET['Type']. '">' . _('Delete') . '</a></td> </tr>'; $BatchTotal= $BatchTotal + $ReceiptItem->Amount; } @@ -918,7 +918,7 @@ echo '<table class=selection>'; - $DisplayDiscountPercent = number_format($_SESSION['CustomerRecord']['pymtdiscount']*100,2) . "%"; + $DisplayDiscountPercent = number_format($_SESSION['CustomerRecord']['pymtdiscount']*100,2) . '%'; echo '<input type="hidden" name="CustomerID" value="' . $_POST['CustomerID'] . '">'; echo '<input type="hidden" name="CustomerName" value="' . $_SESSION['CustomerRecord']['name'] . '">'; @@ -1050,9 +1050,9 @@ echo '<tr class="EvenTableRows">'; $k=1; } - - printf("<td><font size=1><input tabindex=".number_format(12+$j)." type=submit name='Select' value='%s'</font></td> - <td>%s</td></tr>", + printf('<td><font size=1> + <input tabindex='.number_format(12+$j).' type=submit name="Select" value="%s"></font></td> + <td>%s</td></tr>', $myrow['debtorno'], $myrow['name']); Modified: trunk/CustomerTypes.php =================================================================== --- trunk/CustomerTypes.php 2011-04-19 10:18:49 UTC (rev 4555) +++ trunk/CustomerTypes.php 2011-04-26 11:03:36 UTC (rev 4556) @@ -1,9 +1,7 @@ <?php -/* $Revision: 1.6 $ */ + /* $Id$*/ -//$PageSecurity = 15; - include('includes/session.inc'); $title = _('Customer Types') . ' / ' . _('Maintenance'); include('includes/header.inc'); @@ -43,7 +41,7 @@ if (strlen($_POST['typename'])==0) { $InputError = 1; - echo '<br>'; + echo '<br />'; prnMsg(_('The customer type name description must contain at least one character'),'error'); $Errors[$i] = 'CustomerType'; $i++; @@ -56,7 +54,7 @@ $checkrow=DB_fetch_row($checkresult); if ($checkrow[0]>0 and !isset($SelectedType)) { $InputError = 1; - echo '<br>'; + echo '<br />'; prnMsg(_('You already have a customer type called').' '.$_POST['typename'],'error'); $Errors[$i] = 'CustomerName'; $i++; @@ -124,7 +122,7 @@ $result = DB_query($sql,$db); $_SESSION['DefaultCustomerType'] = $_POST['typeid']; } - echo '<br>'; + echo '<br />'; prnMsg($msg,'success'); unset($SelectedType); @@ -146,7 +144,7 @@ $myrow = DB_fetch_row($result); if ($myrow[0]>0) { - prnMsg(_('Cannot delete this type because customer transactions have been created using this type') . '<br>' . _('There are') . ' ' . $myrow[0] . ' ' . _('transactions using this type'),'error'); + prnMsg(_('Cannot delete this type because customer transactions have been created using this type') . '<br />' . _('There are') . ' ' . $myrow[0] . ' ' . _('transactions using this type'),'error'); } else { @@ -156,13 +154,13 @@ $result = DB_query($sql,$db,$ErrMsg); $myrow = DB_fetch_row($result); if ($myrow[0]>0) { - prnMsg (_('Cannot delete this type because customers are currently set up to use this type') . '<br>' . _('There are') . ' ' . $myrow[0] . ' ' . _('customers with this type code')); + prnMsg (_('Cannot delete this type because customers are currently set up to use this type') . '<br />' . _('There are') . ' ' . $myrow[0] . ' ' . _('customers with this type code')); } else { $sql="DELETE FROM debtortype WHERE typeid='".$SelectedType."'"; $ErrMsg = _('The Type record could not be deleted because'); $result = DB_query($sql,$db,$ErrMsg); - echo '<br>'; + echo '<br />'; prnMsg(_('Customer type') . $SelectedType . ' ' . _('has been deleted') ,'success'); unset ($SelectedType); @@ -182,11 +180,11 @@ $sql = 'SELECT typeid, typename FROM debtortype'; $result = DB_query($sql,$db); - echo '<br><table class=selection>'; - echo "<tr> - <th>" . _('Type ID') . "</th> - <th>" . _('Type Name') . "</th> - </tr>"; + echo '<br /><table class=selection>'; + echo '<tr> + <th>' . _('Type ID') . '</th> + <th>' . _('Type Name') . '</th> + </tr>'; $k=0; //row colour counter @@ -199,16 +197,17 @@ $k=1; } - printf(" +printf('<td>%s</td> <td>%s</td> - <td>%s</td> - <td><a href='%sSelectedType=%s'>" . _('Edit') . "</td> - <td><a href='%sSelectedType=%s&delete=yes' onclick=\"return confirm('" . _('Are you sure you wish to delete this Customer Type?') . "');\">" . _('Delete') . "</td> - </tr>", + <td><a href="%sSelectedType=%s">' . _('Edit') . '</td> + <td><a href="%sSelectedType=%s&delete=yes" onclick=\'return confirm("' . _('Are you sure you wish to delete this Customer Type?') . '");\'>' . _('Delete') . '</td> + </tr>', $myrow[0], $myrow[1], - $_SERVER['PHP_SELF'] . '?' . SID, $myrow[0], - $_SERVER['PHP_SELF'] . '?' . SID, $myrow[0]); + $_SERVER['PHP_SELF'] . '?', + $myrow[0], + $_SERVER['PHP_SELF'] . '?', + $myrow[0]); } //END WHILE LIST LOOP echo '</table>'; @@ -217,18 +216,17 @@ //end of ifs and buts! if (isset($SelectedType)) { - echo '<div class="centre"><p><a href="' . $_SERVER['PHP_SELF'] . '?' . SID . '">' . _('Show All Types Defined') . '</a></div><p>'; + echo '<div class="centre"><p><a href="' . $_SERVER['PHP_SELF'] . '">' . _('Show All Types Defined') . '</a></div><p>'; } if (! isset($_GET['delete'])) { - 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'] . '" />'; echo '<p><table class=selection>'; //Main table // The user wish to EDIT an existing type - if ( isset($SelectedType) AND $SelectedType!='' ) - { + if ( isset($SelectedType) AND $SelectedType!='' ) { $sql = "SELECT typeid, typename @@ -241,26 +239,23 @@ $_POST['typeid'] = $myrow['typeid']; $_POST['typename'] = $myrow['typename']; - echo "<input type=hidden name='SelectedType' VALUE=" . $SelectedType . ">"; - echo "<input type=hidden name='typeid' VALUE=" . $_POST['typeid'] . ">"; - echo "<table class=selection> <tr><td>"; + echo '<input type=hidden name="SelectedType" value="' . $SelectedType . '">'; + echo '<input type=hidden name="typeid" value=' . $_POST['typeid'] . '">'; + echo '<table class="selection">'; // We dont allow the user to change an existing type code - echo 'Type ID: ' . $_POST['typeid'] . '</td></tr>'; + echo '<tr><td>' . _('Type ID') . ': ' . $_POST['typeid'] . '</td></tr>'; } else { - // This is a new type so the user may volunteer a type code - - echo "<table class=selection>"; - + echo '<table class="selection">'; } if (!isset($_POST['typename'])) { $_POST['typename']=''; } - echo "<tr><td>" . _('Type Name') . ":</td><td><input type='Text' name='typename' value='" . $_POST['typename'] . "'></td></tr>"; + echo '<tr><td>' . _('Type Name') . ':</td><td><input type="Text" name="typename" value="' . $_POST['typename'] . '"></td></tr>'; echo '</td></tr></table>'; // close main table Modified: trunk/Customers.php =================================================================== --- trunk/Customers.php 2011-04-19 10:18:49 UTC (rev 4555) +++ trunk/Customers.php 2011-04-26 11:03:36 UTC (rev 4556) @@ -281,11 +281,11 @@ $BranchCode = substr($_POST['DebtorNo'],0,4); - echo "<meta http-equiv='Refresh' content='0; url=" . $rootpath ."/CustomerBranches.php?" . SID . "&DebtorNo=" . $_POST['DebtorNo'] . "'>"; + echo '<meta http-equiv="Refresh" content="0; url=' . $rootpath .'/CustomerBranches.php?DebtorNo=' . $_POST['DebtorNo'] . '">'; echo '<div class="centre">' . _('You should automatically be forwarded to the entry of a new Customer Branch page') . '. ' . _('If this does not happen') .' (' . _('if the browser does not support META Refresh') . ') ' . - "<a href='" . $rootpath . "/CustomerBranches.php?" . SID . "&DebtorNo=" . $_POST['DebtorNo'] . '.</div>'; + '<a href="' . $rootpath . '/CustomerBranches.php?DebtorNo=' . $_POST['DebtorNo'] . '"></a></div>'; include('includes/footer.inc'); exit; @@ -421,8 +421,8 @@ /* First check that all the necessary items have been setup */ $SetupErrors=0; //Count errors - $sql='SELECT COUNT(typeabbrev) - FROM salestypes'; + $sql="SELECT COUNT(typeabbrev) + FROM salestypes"; $result=DB_query($sql, $db); $myrow=DB_fetch_row($result); if ($myrow[0]==0) { @@ -430,8 +430,8 @@ _('Click').' '.'<a target="_blank" href="' . $rootpath . '/SalesTypes.php">' . _('here').' ' . '</a>'._('to set up your price lists'),'warning').'<br />'; $SetupErrors += 1; } - $sql='SELECT COUNT(typeid) - FROM debtortype'; + $sql="SELECT COUNT(typeid) + FROM debtortype"; $result=DB_query($sql, $db); $myrow=DB_fetch_row($result); if ($myrow[0]==0) { @@ -445,20 +445,20 @@ include('includes/footer.inc'); exit; } - - 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'] . '" />'; - echo "<input type='Hidden' name='New' value='Yes'>"; + echo '<input type="hidden" name="New" value="Yes" />'; $DataError =0; - echo '<table class=selection cellspacing=4><tr><td valign=top><table class=selection>'; + echo '<table cl... [truncated message content] |
From: <dai...@us...> - 2011-04-28 10:39:34
|
Revision: 4557 http://web-erp.svn.sourceforge.net/web-erp/?rev=4557&view=rev Author: daintree Date: 2011-04-28 10:39:25 +0000 (Thu, 28 Apr 2011) Log Message: ----------- quoting Modified Paths: -------------- trunk/AccountGroups.php trunk/Credit_Invoice.php trunk/FixedAssetItems.php trunk/GLTags.php trunk/PDFBankingSummary.php trunk/PDFChequeListing.php trunk/PDFOrderStatus.php trunk/Payments.php trunk/Suppliers.php trunk/UpgradeDatabase.php trunk/WWW_Access.php trunk/WorkOrderEntry.php trunk/doc/Change.log.html trunk/includes/ConnectDB.inc trunk/includes/ConnectDB_mysql.inc trunk/includes/ConnectDB_mysqli.inc trunk/includes/Login.php trunk/includes/MiscFunctions.php Added Paths: ----------- trunk/SecurityTokens.php trunk/sql/mysql/upgrade4.03-4.04.sql Modified: trunk/AccountGroups.php =================================================================== --- trunk/AccountGroups.php 2011-04-26 11:03:36 UTC (rev 4556) +++ trunk/AccountGroups.php 2011-04-28 10:39:25 UTC (rev 4557) @@ -1,9 +1,7 @@ <?php -/* $Revision: 1.23 $ */ + /* $Id$*/ -//$PageSecurity = 10; - include('includes/session.inc'); $title = _('Account Groups'); @@ -227,12 +225,12 @@ echo '<table class="selection"> <tr> - <th>' . _('Group Name') . "</th> - <th>" . _('Section') . "</th> - <th>" . _('Sequence In TB') . "</th> - <th>" . _('Profit and Loss') . "</th> - <th>" . _('Parent Group') . "</th> - </tr>"; + <th>' . _('Group Name') . '</th> + <th>' . _('Section') . '</th> + <th>' . _('Sequence In TB') . '</th> + <th>' . _('Profit and Loss') . '</th> + <th>' . _('Parent Group') . '</th> + </tr>'; $k=0; //row colour counter while ($myrow = DB_fetch_row($result)) { @@ -262,8 +260,8 @@ <td>' . $myrow[2] . '</td> <td>' . $PandLText . '</td> <td>' . $myrow[4] . '</td>'; - echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?' . SID . '&SelectedAccountGroup=' . htmlentities($myrow[0], ENT_QUOTES,'UTF-8') . '">' . _('Edit') . '</a></td>'; - echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?' . SID . '&SelectedAccountGroup=' . htmlentities($myrow[0], ENT_QUOTES,'UTF-8') . '&delete=1">' . _('Delete') .'</a></td></tr>'; + echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedAccountGroup=' . htmlentities($myrow[0], ENT_QUOTES,'UTF-8') . '">' . _('Edit') . '</a></td>'; + echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedAccountGroup=' . htmlentities($myrow[0], ENT_QUOTES,'UTF-8') . '&delete=1">' . _('Delete') .'</a></td></tr>'; } //END WHILE LIST LOOP echo '</table>'; @@ -271,12 +269,12 @@ if (isset($_POST['SelectedAccountGroup']) OR isset($_GET['SelectedAccountGroup'])) { - echo '<br /><div class="centre"><a href="' . $_SERVER['PHP_SELF'] . '?' . SID .'">' . _('Review Account Groups') . '</a></div>'; + echo '<br /><div class="centre"><a href="' . $_SERVER['PHP_SELF'] .'">' . _('Review Account Groups') . '</a></div>'; } if (! isset($_GET['delete'])) { - echo '<br /><form method="post" id="AccountGroups" action="' . $_SERVER['PHP_SELF'] . '?' . SID . '">'; + echo '<br /><form method="post" id="AccountGroups" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; @@ -339,13 +337,12 @@ <input tabindex="1" ' . (in_array('GroupName',$Errors) ? 'class="inputerror"' : '' ) .' type="text" name="GroupName" size="50" maxlength="50" value="' . $_POST['GroupName'] . '" /></td></tr>'; } echo '<tr><td>' . _('Parent Group') . ':' . '</td> - <td><select tabindex="2" ' . (in_array('ParentGroupName',$Errors) ? 'class="selecterror"' : '' ) . - ' name="ParentGroupName">'; + <td><select tabindex="2" ' . (in_array('ParentGroupName',$Errors) ? 'class="selecterror"' : '' ) . ' name="ParentGroupName">'; - $sql = 'SELECT groupname FROM accountgroups'; + $sql = "SELECT groupname FROM accountgroups"; $groupresult = DB_query($sql, $db,$ErrMsg,$DbgMsg); if (!isset($_POST['ParentGroupName'])){ - echo '<option selected="selected" value="">' ._('Top Level Group').'</option>'; + echo '<option selected value="">' ._('Top Level Group').'</option>'; } else { echo '<option value="">' ._('Top Level Group').'</option>'; } Modified: trunk/Credit_Invoice.php =================================================================== --- trunk/Credit_Invoice.php 2011-04-26 11:03:36 UTC (rev 4556) +++ trunk/Credit_Invoice.php 2011-04-28 10:39:25 UTC (rev 4557) @@ -1,8 +1,6 @@ <?php /* $Id$*/ -//$PageSecurity =3; - /*Functions to get the GL codes to post the transaction to */ include('includes/GetSalesTransGLCodes.inc'); /*defines the structure of the data required to hold the transaction as a session variable */ @@ -398,8 +396,8 @@ <td colspan=3 class=number>' . _('Freight cost charged on invoice') . '</td> <td class=number>' . number_format($_SESSION['Old_FreightCost'],2) . '</td> <td></td> - <td colspan=2 class=number>' . _('Credit Freight Cost') . "</td> - <td><input tabindex=".$j." type=text class=number size=6 maxlength=6 name='ChargeFreightCost' value=" . $_SESSION['CreditItems']->FreightCost . "></td>"; + <td colspan=2 class=number>' . _('Credit Freight Cost') . '</td> + <td><input tabindex='.$j.' type=text class="number" size=6 maxlength=6 name="ChargeFreightCost" value="' . $_SESSION['CreditItems']->FreightCost . '"></td>'; echo '<td>'; echo '</td><td>'; @@ -422,7 +420,7 @@ } if (!isset($_POST['ProcessCredit'])) { - echo '<input type=text class=number name=FreightTaxRate' . $FreightTaxLine->TaxCalculationOrder . ' maxlength=4 size=4 VALUE=' . $FreightTaxLine->TaxRate * 100 . '>'; + echo '<input type=text class=number name=FreightTaxRate' . $FreightTaxLine->TaxCalculationOrder . ' maxlength=4 size=4 value=' . $FreightTaxLine->TaxRate * 100 . '>'; } if ($FreightTaxLine->TaxOnTax ==1){ $TaxTotals[$FreightTaxLine->TaxAuthID] += ($FreightTaxLine->TaxRate * ($_SESSION['CreditItems']->FreightCost + $FreightTaxTotal)); @@ -437,8 +435,8 @@ if (!isset($_POST['ProcessCredit'])) { echo '</td>'; - echo '<td class=number>' . number_format($FreightTaxTotal,2) . '</td> - <td class=number>' . number_format($FreightTaxTotal+ $_SESSION['CreditItems']->FreightCost,2) . '</td> + echo '<td class="number">' . number_format($FreightTaxTotal,2) . '</td> + <td class="number">' . number_format($FreightTaxTotal+ $_SESSION['CreditItems']->FreightCost,2) . '</td> </tr>'; } @@ -447,12 +445,12 @@ if (!isset($_POST['ProcessCredit'])) { echo '<tr> - <td colspan=7 class=number>' . _('Credit Totals') . "</td> - <td class=number><hr><b>$DisplayTotal</b><hr></td> + <td colspan=7 class=number>' . _('Credit Totals') . '</td> + <td class=number><hr><b>' . $DisplayTotal . '</b><hr></td> <td colspan=2></td> - <td class=number><hr><b>" . number_format($TaxTotal,2) . "<hr></td> - <td class=number><hr><b>" . number_format($TaxTotal+($_SESSION['CreditItems']->total + $_SESSION['CreditItems']->FreightCost),2) . "</b><hr></td> - </tr></table>"; + <td class=number><hr><b>' . number_format($TaxTotal,2) . '<hr></td> + <td class=number><hr><b>' . number_format($TaxTotal+($_SESSION['CreditItems']->total + $_SESSION['CreditItems']->FreightCost),2) . '</b><hr></td> + </tr></table>'; } $DefaultDispatchDate = Date($_SESSION['DefaultDateFormat']); @@ -493,12 +491,11 @@ /*Start an SQL transaction */ - $SQL = 'BEGIN'; - $Result = DB_query($SQL,$db); + + $Result = DB_Txn_Begin($db); $DefaultDispatchDate= FormatDateForSQL($DefaultDispatchDate); - /*Calculate the allocation and see if it is possible to allocate to the invoice being credited */ $SQL = "SELECT (ovamount+ovgst+ovfreight-ovdiscount-alloc) as baltoallocate @@ -822,7 +819,7 @@ /* Insert stock movements for the stock coming back in - with unit cost */ - if ($MBFlag=="M" OR $MBFlag=="B"){ + if ($MBFlag=='M' OR $MBFlag=='B'){ $SQL = "INSERT INTO stockmoves ( stockid, type, @@ -1437,8 +1434,7 @@ } } /*end of if Sales and GL integrated */ - $SQL='COMMIT'; - $Result = DB_query($SQL,$db); + $Result = DB_Txn_Commit($db); unset($_SESSION['CreditItems']->LineItems); unset($_SESSION['CreditItems']); Modified: trunk/FixedAssetItems.php =================================================================== --- trunk/FixedAssetItems.php 2011-04-26 11:03:36 UTC (rev 4556) +++ trunk/FixedAssetItems.php 2011-04-28 10:39:25 UTC (rev 4557) @@ -50,7 +50,7 @@ if ($UploadTheFile=='Yes'){ $result = move_uploaded_file($_FILES['ItemPicture']['tmp_name'], $filename); - $message = ($result)?_('File url') ."<a href='". $filename ."'>" . $filename . '</a>' : _('Something is wrong with uploading a file'); + $message = ($result)?_('File url') .'<a href="' . $filename .'">' . $filename . '</a>' : _('Something is wrong with uploading a file'); } /* EOR Add Image upload for New Item - by Ori */ } @@ -262,10 +262,6 @@ prnMsg( _('The new asset has been added to the database with an asset code of:') . ' ' . $NewAssetID,'success'); unset($_POST['LongDescription']); unset($_POST['Description']); -// unset($_POST['AssetCategoryID']); -// unset($_POST['AssetLocation']); -// unset($_POST['DepnType']); -// unset($_POST['DepnRate']); unset($_POST['BarCode']); unset($_POST['SerialNo']); }//ALL WORKED SO RESET THE FORM VARIABLES @@ -374,8 +370,8 @@ } /* end if delete asset */ $result = DB_Txn_Commit($db); -echo '<form name="AssetForm" enctype="multipart/form-data" method="post" action="' . $_SERVER['PHP_SELF'] . '?' .SID . - '"><table class=selection>'; +echo '<form name="AssetForm" enctype="multipart/form-data" method="post" action="' . $_SERVER['PHP_SELF'] . '"> + <table class=selection>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; @@ -452,7 +448,7 @@ echo '<tr><td>'. _('Image File (.jpg)') . ':</td><td><input type="file" id="ItemPicture" name="ItemPicture"></td>'; if (function_exists('imagecreatefromjpg')){ - $StockImgLink = '<img src="GetStockImage.php?SID&automake=1&textcolor=FFFFFF&bgcolor=CCCCCC'. + $StockImgLink = '<img src="GetStockImage.php?automake=1&textcolor=FFFFFF&bgcolor=CCCCCC'. '&AssetID='.urlencode($AssetID). '&text='. '&width=64'. Modified: trunk/GLTags.php =================================================================== --- trunk/GLTags.php 2011-04-26 11:03:36 UTC (rev 4556) +++ trunk/GLTags.php 2011-04-28 10:39:25 UTC (rev 4557) @@ -1,7 +1,7 @@ <?php /* $Id$*/ -//$PageSecurity = 10; + include('includes/session.inc'); $title = _('Maintain General Ledger Tags'); @@ -19,13 +19,13 @@ } if (isset($_POST['submit'])) { - $sql = "insert into tags values(NULL, '".$_POST['description']."')"; + $sql = "INSERT INTO tags values(NULL, '".$_POST['description']."')"; $result= DB_query($sql,$db); } if (isset($_POST['update'])) { - $sql = "update tags set tagdescription='".$_POST['description']. - "' where tagref='".$_POST['reference']."'"; + $sql = "UPDATE tags SET tagdescription='".$_POST['description']. + "' WHERE tagref='".$_POST['reference']."'"; $result= DB_query($sql,$db); } echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/maintenance.png" title="' . @@ -41,9 +41,9 @@ <input type="hidden" name="reference" value="'.$_GET['SelectedTag'].'">'; if (isset($_GET['Action']) and $_GET['Action']=='edit') { - echo '<input type=Submit name=update value=' . _('Update') . '>'; + echo '<input type="submit" name=update value=' . _('Update') . '>'; } else { - echo '<input type=Submit name=submit value=' . _('Insert') . '>'; + echo '<input type="submit" name=submit value=' . _('Insert') . '>'; } echo '</td></tr></table><p></p>'; @@ -58,13 +58,13 @@ $result= DB_query($sql,$db); while ($myrow = DB_fetch_array($result,$db)){ - echo '<tr><td>'.$myrow[0].'</td><td>'.$myrow[1].'</td><td><a href="' . - $_SERVER['PHP_SELF'] . '?' . SID . '&SelectedTag=' . $myrow[0] . '&Action=edit">' . _('Edit') . '</a></td></tr>'; + echo '<tr><td>'.$myrow[0].'</td><td>'.$myrow[1].'</td> + <td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedTag=' . $myrow[0] . '&Action=edit">' . _('Edit') . '</a></td></tr>'; } echo '</table><p></p>'; -echo "<script>defaultControl(document.form.description);</script>"; +echo '<script>defaultControl(document.form.description);</script>'; include('includes/footer.inc'); Modified: trunk/PDFBankingSummary.php =================================================================== --- trunk/PDFBankingSummary.php 2011-04-26 11:03:36 UTC (rev 4556) +++ trunk/PDFBankingSummary.php 2011-04-28 10:39:25 UTC (rev 4557) @@ -16,15 +16,16 @@ echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/magnifier.png" title="' . $title . '" alt="" />' . ' ' . $title . '</p>'; - $sql='SELECT DISTINCT + $sql="SELECT DISTINCT transno, transdate FROM banktrans WHERE type=12 - ORDER BY transno DESC'; + ORDER BY transno DESC"; $result=DB_query($sql, $db); - echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '"><table class=selection>'; + echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '"> + <table class=selection>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<tr><td>' . _('Select the batch number of receipts to be printed') . ':</td>'; echo '<td><select name="BatchNo">'; @@ -165,7 +166,7 @@ $LeftOvers = $pdf->addTextWrap($Left_Margin,$YPos,60,$FontSize,number_format($TotalBanked,2), 'right'); $LeftOvers = $pdf->addTextWrap($Left_Margin+65,$YPos,300,$FontSize,_('TOTAL') . ' ' . $Currency . ' ' . _('BANKED'), 'left'); - $pdf->OutputD($_SESSION['DatabaseName'] . '_BankingSummary_' . date('Y-m-d').'.pdf');//UldisN + $pdf->OutputD($_SESSION['DatabaseName'] . '_BankingSummary_' . date('Y-m-d').'.pdf'); $pdf->__destruct(); } Modified: trunk/PDFChequeListing.php =================================================================== --- trunk/PDFChequeListing.php 2011-04-26 11:03:36 UTC (rev 4556) +++ trunk/PDFChequeListing.php 2011-04-28 10:39:25 UTC (rev 4557) @@ -31,6 +31,7 @@ } echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; + echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<table class=selection> <tr> Modified: trunk/PDFOrderStatus.php =================================================================== --- trunk/PDFOrderStatus.php 2011-04-26 11:03:36 UTC (rev 4556) +++ trunk/PDFOrderStatus.php 2011-04-28 10:39:25 UTC (rev 4557) @@ -27,12 +27,11 @@ prnMsg($msg,'error'); } - echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/transactions.png" title="' . $title . '" alt="" />' . ' ' - . _('Order Status Report') . '</p>'; + echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/transactions.png" title="' . $title . '" alt="" />' . ' ' . _('Order Status Report') . '</p>'; echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<table class=selection> + echo '<table class="selection"> <tr> <td>' . _('Enter the date from which orders are to be listed') . ':</td> <td><input type=text class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="FromDate" maxlength=10 size=10 value="' . Date($_SESSION['DefaultDateFormat'], Mktime(0,0,0,Date('m'),Date('d')-1,Date('y'))) . '"></td> @@ -54,7 +53,7 @@ echo '</select></td></tr>'; echo '<tr><td>' . _('Inventory Location') . ':</td><td><select name="Location">'; - echo '<option selected value="All">' . _('All Locations'); + echo '<option selected value="All">' . _('All Locations') . '</option>'; $result= DB_query("SELECT loccode, locationname FROM locations",$db); while ($myrow=DB_fetch_array($result)){ @@ -242,9 +241,9 @@ if (DB_error_no($db)!=0){ include('includes/header.inc'); - echo '<br>' . _('An error occurred getting the orders details'); + echo '<br />' . _('An error occurred getting the orders details'); if ($debug==1){ - echo '<br>' . _('The SQL used to get the orders that failed was') . '<br>' . $sql; + echo '<br />' . _('The SQL used to get the orders that failed was') . '<br />' . $sql; } include ('includes/footer.inc'); exit; @@ -341,6 +340,6 @@ $OrderNo=0; } /*end of new page header */ } /* end of while there are delivery differences to print */ -$pdf->OutputD($_SESSION['DatabaseName'] . '_OrderStatus_' . date('Y-m-d') . '.pdf');//UldisN -$pdf->__destruct(); //UldisN +$pdf->OutputD($_SESSION['DatabaseName'] . '_OrderStatus_' . date('Y-m-d') . '.pdf'); +$pdf->__destruct(); ?> \ No newline at end of file Modified: trunk/Payments.php =================================================================== --- trunk/Payments.php 2011-04-26 11:03:36 UTC (rev 4556) +++ trunk/Payments.php 2011-04-28 10:39:25 UTC (rev 4557) @@ -723,18 +723,19 @@ echo ' ' . _('on') . ' ' . $_SESSION['PaymentDetail']->DatePaid . '</font></th></tr>'; -$SQL = 'SELECT bankaccountname, +$SQL = "SELECT bankaccountname, bankaccounts.accountcode, bankaccounts.currcode FROM bankaccounts, chartmaster - WHERE bankaccounts.accountcode=chartmaster.accountcode'; + WHERE bankaccounts.accountcode=chartmaster.accountcode"; $ErrMsg = _('The bank accounts could not be retrieved because'); $DbgMsg = _('The SQL used to retrieve the bank accounts was'); $AccountsResults = DB_query($SQL,$db,$ErrMsg,$DbgMsg); -echo '<tr><td>' . _('Bank Account') . ':</td><td><select name="BankAccount" onChange="ReloadForm(UpdateHeader)">'; +echo '<tr><td>' . _('Bank Account') . ':</td> + <td><select name="BankAccount" onChange="ReloadForm(UpdateHeader)">'; if (DB_num_rows($AccountsResults)==0){ echo '</select></td></tr></table><p>'; @@ -746,9 +747,9 @@ while ($myrow=DB_fetch_array($AccountsResults)){ /*list the bank account names */ if (isset($_POST['BankAccount']) and $_POST['BankAccount']==$myrow['accountcode']){ - echo '<option selected value="' . $myrow['accountcode'] . '">' . $myrow['bankaccountname'] . ' - ' . $myrow['currcode']; + echo '<option selected value="' . $myrow['accountcode'] . '">' . $myrow['bankaccountname'] . ' - ' . $myrow['currcode'] . '</option>'; } else { - echo '<option value="' . $myrow['accountcode'] . '">' . $myrow['bankaccountname'] . ' - ' . $myrow['currcode']; + echo '<option value="' . $myrow['accountcode'] . '">' . $myrow['bankaccountname'] . ' - ' . $myrow['currcode'] . '</option>'; } } echo '</select></td></tr>'; @@ -762,7 +763,7 @@ if ($_SESSION['PaymentDetail']->SupplierID==''){ echo '<tr><td>' . _('Currency of Payment') . ':</td><td><select name="Currency" onChange="ReloadForm(UpdateHeader)">'; - $SQL = 'SELECT currency, currabrev, rate FROM currencies'; + $SQL = "SELECT currency, currabrev, rate FROM currencies"; $result=DB_query($SQL,$db); if (DB_num_rows($result)==0){ @@ -771,9 +772,9 @@ } else { while ($myrow=DB_fetch_array($result)){ if ($_SESSION['PaymentDetail']->Currency==$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>'; } } echo '</select></td><td><i>' . _('The transaction currency does not need to be the same as the bank account currency') . '</i></td></tr>'; @@ -822,10 +823,12 @@ if ($_POST['FunctionalExRate']==1 AND isset($SuggestedFunctionalExRate)){ $_POST['FunctionalExRate'] = $SuggestedFunctionalExRate; } - echo '<tr><td>' . _('Functional Exchange Rate') . ':</td><td><input type="text" name="FunctionalExRate" maxlength=10 size=12 value="' . $_POST['FunctionalExRate'] . '"></td> + echo '<tr><td>' . _('Functional Exchange Rate') . ':</td> + <td><input type="text" name="FunctionalExRate" maxlength=10 size=12 value="' . $_POST['FunctionalExRate'] . '"></td> <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['PaymentDetail']->AccountCurrency . '</i></td></tr>'; } -echo '<tr><td>' . _('Payment type') . ':</td><td><select name="Paymenttype">'; +echo '<tr><td>' . _('Payment type') . ':</td> + <td><select name="Paymenttype">'; include('includes/GetPaymentMethods.php'); /* The array Payttypes is set up in includes/GetPaymentMethods.php @@ -834,9 +837,9 @@ foreach ($PaytTypes as $PaytType) { if (isset($_POST['Paymenttype']) and $_POST['Paymenttype']==$PaytType){ - echo '<option selected value="' . $PaytType . '">' . $PaytType; + echo '<option selected value="' . $PaytType . '">' . $PaytType . '</option>'; } else { - echo '<option Value="' . $PaytType . '">' . $PaytType; + echo '<option Value="' . $PaytType . '">' . $PaytType . '</option>'; } } //end foreach echo '</select></td></tr>'; @@ -853,7 +856,7 @@ } echo '<tr><td>' . _('Reference / Narrative') . ':</td> - <td colspan=2><input type="text" name="Narrative" maxlength=80 size=82 value="' . $_POST['Narrative'] . '"> ' . _('(Max. length 80 characters)') . '</td></tr>'; + <td colspan=2><input type="text" name="Narrative" maxlength=80 size=82 value="' . $_POST['Narrative'] . '"> ' . _('(Max. length 80 characters)') . '</td></tr>'; echo '<tr><td colspan=3><div class="centre"><input type="submit" name="UpdateHeader" value="' . _('Update'). '"></td></tr>'; @@ -894,13 +897,46 @@ echo '<tr><td>' . _('Enter GL Account Manually') . ':</td> <td><input type=Text class="number" Name="GLManualCode" Maxlength=12 size=12 onChange="return inArray(this, GLCode.options,'. "'".'The account code '."'".'+ this.value+ '."'".' doesnt exist'."'".')"></td></tr>'; } - echo '<tr><td>' . _('Select GL Account') . ':</td> - <td><select name="GLCode" onChange="return assignComboToInput(this,'.'GLManualCode'.')">'; + + echo '<tr><td>' . _('Select GL Group') . ':</td> + <td><select name="GLGroup" onChange="return ReloadForm(UpdateCodes)">'; - $SQL = 'SELECT accountcode, + $SQL = "SELECT groupname + FROM accountgroups + ORDER BY sequenceintb"; + + $result=DB_query($SQL,$db); + if (DB_num_rows($result)==0){ + echo '</select></td></tr>'; + prnMsg(_('No General ledger account groups have been set up yet') . ' - ' . _('payments cannot be analysed against GL accounts until the GL accounts are set up'),'error'); + } else { + echo '<option value=""></option>'; + while ($myrow=DB_fetch_array($result)){ + if (isset($_POST['GLGroup']) and ($_POST['GLGroup']==$myrow['groupname'])){ + echo '<option selected value="' . $myrow['groupname'] . '">' . $myrow['groupname'] . '</option>'; + } else { + echo '<option value="' . $myrow['groupname'] . '">' . $myrow['groupname'] . '</option>'; + } + } + echo '</select><input type="submit" name="UpdateCodes" value="Select" /></td></tr>'; + } + + if (isset($_POST['GLGroup']) and $_POST['GLGroup']!='') { + $SQL = "SELECT accountcode, accountname FROM chartmaster - ORDER BY accountcode'; + WHERE group_='".$_POST['GLGroup']."' + ORDER BY accountcode"; + } else { + $SQL = "SELECT accountcode, + accountname + FROM chartmaster + ORDER BY accountcode"; + } + + + echo '<tr><td>' . _('Select GL Account') . ':</td> + <td><select name="GLCode" onChange="return assignComboToInput(this,'.'GLManualCode'.')">'; $result=DB_query($SQL,$db); if (DB_num_rows($result)==0){ @@ -909,40 +945,47 @@ } else { echo '<option value=""></option>'; while ($myrow=DB_fetch_array($result)){ - if (isset($_POST['GLCode']) and $_POST['GLCode']==$myrow["accountcode"]){ - echo '<option selected value=' . $myrow['accountcode'] . '>' . $myrow['accountcode'] . ' - ' . $myrow['accountname']; + if (isset($_POST['GLCode']) and $_POST['GLCode']==$myrow['accountcode']){ + echo '<option selected value=' . $myrow['accountcode'] . '>' . $myrow['accountcode'] . ' - ' . $myrow['accountname'] . '</option>'; } else { - echo '<option value=' . $myrow['accountcode'] . '>' . $myrow['accountcode'] . ' - ' . $myrow['accountname']; + echo '<option value=' . $myrow['accountcode'] . '>' . $myrow['accountcode'] . ' - ' . $myrow['accountname'] . '</option>'; } } echo '</select></td></tr>'; } - echo '<tr><td>'. _('Cheque/Voucher Number') .'</td><td><input type="text" name="cheque" Maxlength=12 size=12></td></tr>'; + echo '<tr><td>'. _('Cheque/Voucher Number') .'</td> + <td><input type="text" name="cheque" Maxlength=12 size=12></td></tr>'; if (isset($_POST['GLNarrative'])) { - echo '<tr><td>' . _('GL Narrative') . ':</td><td><input type="text" name="GLNarrative" maxlength=50 size=52 value="' . $_POST['GLNarrative'] . '"></td></tr>'; + echo '<tr><td>' . _('GL Narrative') . ':</td> + <td><input type="text" name="GLNarrative" maxlength=50 size=52 value="' . $_POST['GLNarrative'] . '"></td></tr>'; } else { - echo '<tr><td>' . _('GL Narrative') . ':</td><td><input type="text" name="GLNarrative" maxlength=50 size=52></td></tr>'; + echo '<tr><td>' . _('GL Narrative') . ':</td> + <td><input type="text" name="GLNarrative" maxlength=50 size=52></td></tr>'; } if (isset($_POST['GLAmount'])) { - echo '<tr><td>' . _('Amount') . ' (' . $_SESSION['PaymentDetail']->Currency . '):</td><td><input type=Text Name="GLAmount" Maxlength=12 size=12 class=number value=' . $_POST['GLAmount'] . '></td></tr>'; + echo '<tr><td>' . _('Amount') . ' (' . $_SESSION['PaymentDetail']->Currency . '):</td> + <td><input type=Text Name="GLAmount" Maxlength=12 size=12 class=number value=' . $_POST['GLAmount'] . '></td></tr>'; } else { - echo '<tr><td>' . _('Amount') . ' (' . $_SESSION['PaymentDetail']->Currency . '):</td><td><input type=Text Name="GLAmount" Maxlength=12 size=12 class=number></td></tr>'; + echo '<tr><td>' . _('Amount') . ' (' . $_SESSION['PaymentDetail']->Currency . '):</td> + <td><input type=Text Name="GLAmount" Maxlength=12 size=12 class=number></td></tr>'; } echo '</table><br />'; echo '<div class="centre"><input type=submit name="Process" value="' . _('Accept') . '"><input type=submit name="Cancel" value="' . _('Cancel') . '"></div>'; if (sizeOf($_SESSION['PaymentDetail']->GLItems)>0) { - echo '<br /><table class=selection><tr> - <th>' . _('Cheque No').'</th> - <th>' . _('Amount') . ' (' . $_SESSION['PaymentDetail']->Currency . ')</th> - <th>' . _('GL Account') . '</th> - <th>' . _('Narrative') . '</th> - <th>' . _('Tag') . '</th> - </tr>'; + echo '<br /> + <table class=selection> + <tr> + <th>' . _('Cheque No').'</th> + <th>' . _('Amount') . ' (' . $_SESSION['PaymentDetail']->Currency . ')</th> + <th>' . _('GL Account') . '</th> + <th>' . _('Narrative') . '</th> + <th>' . _('Tag') . '</th> + </tr>'; $PaymentTotal = 0; foreach ($_SESSION['PaymentDetail']->GLItems as $PaymentItem) { Added: trunk/SecurityTokens.php =================================================================== --- trunk/SecurityTokens.php (rev 0) +++ trunk/SecurityTokens.php 2011-04-28 10:39:25 UTC (rev 4557) @@ -0,0 +1,86 @@ +<?php + +/* $Id$*/ +//$PageSecurity = 10; +include('includes/session.inc'); +$title = _('Maintain Security Tokens'); + +include('includes/header.inc'); + +if (isset($_GET['SelectedToken'])) { + $sql="SELECT tokenid, tokenname FROM securitytokens where tokenid='".$_GET['SelectedToken']."'"; + $result= DB_query($sql,$db); + $myrow = DB_fetch_array($result,$db); + $ref=$myrow[0]; + $description=$myrow[1]; +} else if (!isset($_POST['TokenID'])){ + $description=''; + $_POST['TokenID']=''; + $_GET['SelectedToken']=''; +} else { + $description=$_POST['Description']; +} + +if (isset($_POST['submit'])) { + $TestSQL="SELECT tokenid FROM securitytokens WHERE tokenid='".$_POST['TokenID']."'"; + $TestResult=DB_query($TestSQL, $db); + if (DB_num_rows($TestResult)==0) { + $sql = "INSERT INTO securitytokens values('".$_POST['TokenID']."', '".$_POST['Description']."')"; + $result= DB_query($sql,$db); + unset($description); + unset($_POST['TokenID']); + } else { + prnMsg( _('This token ID has already been used. Please use a new one') , 'warn'); + } +} + +if (isset($_POST['update'])) { + $sql = "UPDATE securitytokens SET tokenname='".$_POST['Description']. + "' WHERE tokenid='".$_POST['TokenID']."'"; + $result= DB_query($sql,$db); + unset($description); + unset($_POST['TokenID']); +} +echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/maintenance.png" title="' . + _('Print') . '" alt="" />' . ' ' . $title . '</p>'; + +echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '" name="form">'; +echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; +echo '<br><table><tr>'; + + + +if (isset($_GET['Action']) and $_GET['Action']=='edit') { + echo '<td>'. _('Description') . '</td> + <td><input type="text" size=30 maxlength=30 name="Description" value="'.$description.'"></td><td> + <input type="hidden" name="TokenID" value="'.$_GET['SelectedToken'].'">'; + echo '<input type=Submit name=update value=' . _('Update') . '>'; +} else { + echo '<td>'._('Token ID') . '<td><input type="text" name="TokenID" value="'.$_POST['TokenID'].'"></td></tr> + <tr><td>'. _('Description') . '</td><td><input type="text" size=30 maxlength=30 name="Description" value="'.$description.'"></td><td>'; + echo '<input type=Submit name=submit value=' . _('Insert') . '>'; +} + +echo '</td></tr></table><p></p>'; + +echo '</form>'; + +echo '<table class=selection>'; +echo '<tr><th>'. _('Token ID') .'</th>'; +echo '<th>'. _('Description'). '</th>'; + +$sql="SELECT tokenid, tokenname FROM securitytokens ORDER BY tokenid"; +$result= DB_query($sql,$db); + +while ($myrow = DB_fetch_array($result,$db)){ + echo '<tr><td>'.$myrow[0].'</td><td>'.$myrow[1].'</td><td><a href="' . + $_SERVER['PHP_SELF'] . '?SelectedToken=' . $myrow[0] . '&Action=edit">' . _('Edit') . '</a></td></tr>'; +} + +echo '</table><p></p>'; + +echo "<script>defaultControl(document.form.description);</script>"; + +include('includes/footer.inc'); + +?> \ No newline at end of file Modified: trunk/Suppliers.php =================================================================== --- trunk/Suppliers.php 2011-04-26 11:03:36 UTC (rev 4556) +++ trunk/Suppliers.php 2011-04-28 10:39:25 UTC (rev 4557) @@ -2,8 +2,6 @@ /* $Id$ */ -//$PageSecurity = 5; - include('includes/session.inc'); $title = _('Supplier Maintenance'); @@ -137,7 +135,7 @@ break; default: - echo _('The prefix') . ' - ' . $BankPrefix . ' ' . _('is not a valid New Zealand Bank') . '.<br>' . + echo _('The prefix') . ' - ' . $BankPrefix . ' ' . _('is not a valid New Zealand Bank') . '.<br />' . _('If you are using webERP outside New Zealand error trapping relevant to your country should be used'); return False; exit; @@ -301,8 +299,6 @@ unset($SupplierID); } -// This is aleady linked from this page -//echo "<a href='" . $rootpath . '/SelectSupplier.php?' . SID . "'>" . _('Back to Suppliers') . '</a><br>'; echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . _('Search') . '" alt="" />' . ' ' . _('Suppliers') . '</p>'; $InputError = 0; @@ -426,7 +422,7 @@ $longitude = $coordinatesSplit[0]; $status = $xml->Response->Status->code; - if (strcmp($status, "200") == 0) { + if (strcmp($status, '200') == 0) { // Successful geocode $geocode_pending = false; $coordinates = $xml->Response->Placemark->Point->coordinates; @@ -437,22 +433,22 @@ } else { // failure to geocode $geocode_pending = false; - echo '<p>Address: ' . $address . ' failed to geocode'."\n"; - echo 'Received status ' . $status . "\n" . '</p>'; + echo '<p>' . _('Address') . ': ' . $address . ' ' . _('failed to geocode') ."\n"; + echo _('Received status') . ' ' . $status . "\n" . '</p>'; } } } if (!isset($_POST['New'])) { $supptranssql = "SELECT supplierno - FROM supptrans - WHERE supplierno='".$SupplierID ."'"; + FROM supptrans + WHERE supplierno='".$SupplierID ."'"; $suppresult = DB_query($supptranssql, $db); $supptrans = DB_num_rows($suppresult); $suppcurrssql = "SELECT currcode - FROM suppliers - WHERE supplierid='".$SupplierID ."'"; + FROM suppliers + WHERE supplierid='".$SupplierID ."'"; $currresult = DB_query($suppcurrssql, $db); $suppcurr = DB_fetch_row($currresult); @@ -516,49 +512,49 @@ } else { //its a new supplier $sql = "INSERT INTO suppliers (supplierid, - suppname, - address1, - address2, - address3, - address4, - telephone, - fax, - email, - supptype, - currcode, - suppliersince, - paymentterms, - bankpartics, - bankref, - bankact, - remittance, - taxgroupid, - factorcompanyid, - lat, - lng, - taxref) - VALUES ('$SupplierID', - '" . $_POST['SuppName'] . "', - '" . $_POST['Address1'] . "', - '" . $_POST['Address2'] . "', - '" . $_POST['Address3'] . "', - '" . $_POST['Address4'] . "', - '".$_POST['Phone']."', - '".$_POST['Fax']."', - '".$_POST['Email']."', - '".$_POST['SupplierType']."', - '" . $_POST['CurrCode'] . "', - '" . $SQL_SupplierSince . "', - '" . $_POST['PaymentTerms'] . "', - '" . $_POST['BankPartics'] . "', - '" . $_POST['BankRef'] . "', - '" . $_POST['BankAct'] . "', - '" . $_POST['Remittance'] . "', - '" . $_POST['TaxGroup'] . "', - '" . $_POST['FactorID'] . "', - '" . $latitude ."', - '" . $longitude ."', - '" . $_POST['TaxRef'] . "')"; + suppname, + address1, + address2, + address3, + address4, + telephone, + fax, + email, + supptype, + currcode, + suppliersince, + paymentterms, + bankpartics, + bankref, + bankact, + remittance, + taxgroupid, + factorcompanyid, + lat, + lng, + taxref) + VALUES ('$SupplierID', + '" . $_POST['SuppName'] . "', + '" . $_POST['Address1'] . "', + '" . $_POST['Address2'] . "', + '" . $_POST['Address3'] . "', + '" . $_POST['Address4'] . "', + '".$_POST['Phone']."', + '".$_POST['Fax']."', + '".$_POST['Email']."', + '".$_POST['SupplierType']."', + '" . $_POST['CurrCode'] . "', + '" . $SQL_SupplierSince . "', + '" . $_POST['PaymentTerms'] . "', + '" . $_POST['BankPartics'] . "', + '" . $_POST['BankRef'] . "', + '" . $_POST['BankAct'] . "', + '" . $_POST['Remittance'] . "', + '" . $_POST['TaxGroup'] . "', + '" . $_POST['FactorID'] . "', + '" . $latitude ."', + '" . $longitude ."', + '" . $_POST['TaxRef'] . "')"; $ErrMsg = _('The supplier') . ' ' . $_POST['SuppName'] . ' ' . _('could not be added because'); $DbgMsg = _('The SQL that was used to insert the supplier but failed was'); @@ -610,7 +606,7 @@ if ($myrow[0] > 0) { $CancelDelete = 1; prnMsg(_('Cannot delete this supplier because there are transactions that refer to this supplier'),'warn'); - echo '<br>' . _('There are') . ' ' . $myrow[0] . ' ' . _('transactions against this supplier'); + echo '<br />' . _('There are') . ' ' . $myrow[0] . ' ' . _('transactions against this supplier'); } else { $sql= "SELECT COUNT(*) FROM purchorders WHERE supplierno='" . $SupplierID . "'"; @@ -619,7 +615,7 @@ if ($myrow[0] > 0) { $CancelDelete = 1; prnMsg(_('Cannot delete the supplier record because purchase orders have been created against this supplier'),'warn'); - echo '<br>' . _('There are') . ' ' . $myrow[0] . ' ' . _('orders against this supplier'); + echo '<br />' . _('There are') . ' ' . $myrow[0] . ' ' . _('orders against this supplier'); } else { $sql= "SELECT COUNT(*) FROM suppliercontacts WHERE supplierid='" . $SupplierID . "'"; $result = DB_query($sql, $db); @@ -627,7 +623,7 @@ if ($myrow[0] > 0) { $CancelDelete = 1; prnMsg(_('Cannot delete this supplier because there are supplier contacts set up against it') . ' - ' . _('delete these first'),'warn'); - echo '<br>' . _('There are') . ' ' . $myrow[0] . ' ' . _('supplier contacts relating to this supplier'); + echo '<br />' . _('There are') . ' ' . $myrow[0] . ' ' . _('supplier contacts relating to this supplier'); } } @@ -647,105 +643,140 @@ /*If the page was called without $SupplierID passed to page then assume a new supplier is to be entered show a form with a Supplier Code field other wise the form showing the fields with the existing entries against the supplier will show for editing with only a hidden SupplierID field*/ - 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'] . '" />'; - echo "<input type='hidden' name='New' VALUE='Yes'>"; + echo '<input type="hidden" name="New" value="Yes">'; echo '<table class=selection>'; - echo '<tr><td>' . _('Supplier Code') . ":</td><td><input type='text' name='SupplierID' size=11 maxlength=10></td></tr>"; - echo '<tr><td>' . _('Supplier Name') . ":</td><td><input type='text' name='SuppName' size=42 maxlength=40></td></tr>"; - echo '<tr><td>' . _('Address Line 1 (Street)') . ":</td><td><input type='text' name='Address1' size=42 maxlength=40></td></tr>"; - echo '<tr><td>' . _('Address Line 2 (Suburb/City)') . ":</td><td><input type='text' name='Address2' size=42 maxlength=40></td></tr>"; - echo '<tr><td>' . _('Address Line 3 (State/Province)') . ":</td><td><input type='text' name='Address3' size=42 maxlength=40></td></tr>"; - echo '<tr><td>' . _('Address Line 4 (Postal Code)') . ":</td><td><input type='text' name='Address4' size=42 maxlength=40></td></tr>"; - echo '<tr><td>' . _('Telephone') . ":</td><td><input type='text' name='Phone' size=30 maxlength=40></td></tr>"; - echo '<tr><td>' . _('Facsimile') . ":</td><td><input type='text' name='Fax' size=30 maxlength=40></td></tr>"; - echo '<tr><td>' . _('Email Address') . ":</td><td><input type='text' name='Email' size=30 maxlength=40></td></tr>"; - echo '<tr><td>' . _('Supplier Type') . ":</td><td><select name='SupplierType'>"; - $result=DB_query('SELECT typeid, typename FROM suppliertype', $db); + echo '<tr><td>' . _('Supplier Code') . ':</td> + <td><input type="text" name="SupplierID" size=11 maxlength=10></td> + </tr>'; + echo '<tr><td>' . _('Supplier Name') . ':</td> + <td><input type="text" name="SuppName" size=42 maxlength=40></td> + </tr>'; + echo '<tr><td>' . _('Address Line 1 (Street)') . ':</td> + <td><input type="text" name="Address1" size=42 maxlength=40></td> + </tr>'; + echo '<tr><td>' . _('Address Line 2 (Suburb/City)') . ':</td> + <td><input type="text" name="Address2" size=42 maxlength=40></td> + </tr>'; + echo '<tr><td>' . _('Address Line 3 (State/Province)') . ':</td> + <td><input type="text" name="Address3" size=42 maxlength=40></td> + </tr>'; + echo '<tr><td>' . _('Address Line 4 (Postal Code)') . ':</td> + <td><input type="text" name="Address4" size=42 maxlength=40></td> + </tr>'; + echo '<tr><td>' . _('Telephone') . ':</td> + <td><input type="text" name="Phone" size=30 maxlength=40></td> + </tr>'; + echo '<tr><td>' . _('Facsimile') . ':</td> + <td><input type="text" name="Fax" size=30 maxlength=40></td> + </tr>'; + echo '<tr><td>' . _('Email Address') . ':</td> + <td><input type="text" name="Email" size=30 maxlength=40></td> + </tr>'; + echo '<tr><td>' . _('Supplier Type') . ':</td> + <td><select name="SupplierType">'; + $result=DB_query("SELECT typeid, typename FROM suppliertype", $db); while ($myrow = DB_fetch_array($result)) { - echo "<option VALUE='". $myrow['typeid'] . "'>" . $myrow['typename']; + echo '<option value="' . $myrow['typeid'] . '">' . $myrow['typename'] .'</option>'; } //end while loop - echo "</select></td></tr>"; + echo '</select></td></tr>'; $DateString = Date($_SESSION['DefaultDateFormat']); - echo '<tr><td>' . _('Supplier Since') . ' (' . $_SESSION['DefaultDateFormat'] . "):</td><td><input type='text' class='date' alt='".$_SESSION['DefaultDateFormat']."' name='SupplierSince' VALUE=$DateString size=12 maxlength=10></td></tr>"; - echo '<tr><td>' . _('Bank Particulars') . ":</td><td><input type='text' name='BankPartics' size=13 maxlength=12></td></tr>"; - echo '<tr><td>' . _('Bank reference') . ":</td><td><input type='text' name='BankRef' VALUE=0 size=13 maxlength=12></td></tr>"; - echo '<tr><td>' . _('Bank Account No') . ":</td><td><input type='text' name='BankAct' size=31 maxlength=30></td></tr>"; + echo '<tr><td>' . _('Supplier Since') . ' (' . $_SESSION['DefaultDateFormat'] . '):</td> + <td><input type="text" class="date" alt="' .$_SESSION['DefaultDateFormat'] .'" name="SupplierSince" value="' . $DateString . '" size=12 maxlength=10></td> + </tr>'; + echo '<tr><td>' . _('Bank Particulars') . ':</td> + <td><input type="text" name="BankPartics" size=13 maxlength=12></td> + </tr>'; + echo '<tr><td>' . _('Bank reference') . ':</td> + <td><input type="text" name="BankRef" value=0 size=13 maxlength=12></td> + </tr>'; + echo '<tr><td>' . _('Bank Account No') . ':</td> + <td><input type="text" name="BankAct" size=31 maxlength=30></td></tr>'; - $result=DB_query('SELECT terms, termsindicator FROM paymentterms', $db); + $result=DB_query("SELECT terms, termsindicator FROM paymentterms", $db); - echo '<tr><td>' . _('Payment Terms') . ":</td><td><select name='PaymentTerms'>"; + echo '<tr><td>' . _('Payment Terms') . ':</td> + <td><select name="PaymentTerms">'; while ($myrow = DB_fetch_array($result)) { - echo "<option VALUE='". $myrow['termsindicator'] . "'>" . $myrow['terms']; + echo '<option value="'. $myrow['termsindicator'] . '">' . $myrow['terms'] .'</option>'; } //end while loop DB_data_seek($result, 0); echo '</select></td></tr>'; - $result=DB_query('SELECT id, coyname FROM factorcompanies', $db); + $result=DB_query("SELECT id, coyname FROM factorcompanies", $db); - echo '<tr><td>' . _('Factor Company') . ":</td><td><select name='FactorID'>"; - echo '<option VALUE=0>' . _('None'); + echo '<tr><td>' . _('Factor Company') . ':</td> + <td><select name="FactorID">'; + echo '<option value=0>' . _('None'); while ($myrow = DB_fetch_array($result)) { if (isset($_POST['FactorID']) and $_POST['FactorID'] == $myrow['id']){ - echo '<option selected VALUE=' . $myrow['id'] . '>' . $myrow['coyname']; + echo '<option selected value=' . $myrow['id'] . '>' . $myrow['coyname'] .'</option>'; } else { - echo '<option VALUE=' . $myrow['id'] . '>' . $myrow['coyname']; + echo '<option value=' . $myrow['id'] . '>' . $myrow['coyname'] .'</option>'; } } //end while loop DB_data_seek($result, 0); echo '</select></td></tr>'; - echo '<tr><td>' . _('Tax Reference') . ':</td><td><input type="text" name=2TaxRef" size=21 maxlength=20></td></tr>'; + echo '<tr><td>' . _('Tax Reference') . ':</td> + <td><input type="text" name="TaxRef" size=21 maxlength=20></td></tr>'; - $result=DB_query('SELECT currency, currabrev FROM currencies', $db); + $result=DB_query("SELECT currency, currabrev FROM currencies", $db); if (!isset($_POST['CurrCode'])){ - $CurrResult = DB_query('SELECT currencydefault FROM companies WHERE coycode=1', $db); + $CurrResult = DB_query("SELECT currencydefault FROM companies WHERE coycode=1", $db); $myrow = DB_fetch_row($CurrResult); $_POST['CurrCode'] = $myrow[0]; } - echo '<tr><td>' . _('Supplier Currency') . ':</td><td><select name="CurrCode">'; + echo '<tr><td>' . _('Supplier Currency') . ':</td> + <td><select name="CurrCode">'; while ($myrow = DB_fetch_array($result)) { if ($_POST['CurrCode'] == $myrow['currabrev']){ - echo '<option selected VALUE=' . $myrow['currabrev'] . '>' . $myrow['currency'] . '</option>'; + echo '<option selected value=' . $myrow['currabrev'] . '>' . $myrow['currency'] . '</option>'; } else { - echo '<option VALUE=' . $myrow['currabrev'] . '>' . $myrow['currency'] . '</option>'; + echo '<option value=' . $myrow['currabrev'] . '>' . $myrow['currency'] . '</option>'; } } //end while loop DB_data_seek($result, 0); - echo '</select></td></tr><tr><td>' . _('Remittance Advice') . ':</td><td><select name="Remittance">'; - echo '<option VALUE=0>' . _('Not Required') . '</option>'; - echo '<option VALUE=1>' . _('Required') . '</option>'; + echo '</select></td></tr> + <tr><td>' . _('Remittance Advice') . ':</td> + <td><select name="Remittance">'; + echo '<option value=0>' . _('Not Required') . '</option>'; + echo '<option value=1>' . _('Required') . '</option>'; echo '</select></td></tr>'; - echo '<tr><td>' . _('Tax Group') . ':</td><td><select name="TaxGroup">'; + echo '<tr><td>' . _('Tax Group') . ':</td> + <td><select name="TaxGroup">'; DB_data_seek($result, 0); - $sql = 'SELECT taxgroupid, taxgroupdescription FROM taxgroups'; + $sql = "SELECT taxgroupid, taxgroupdescription FROM taxgroups"; $result = DB_query($sql, $db); while ($myrow = DB_fetch_array($result)) { if (isset($_POST['TaxGroup']) and $_POST['TaxGroup'] == $myrow['taxgroupid']){ - echo '<option selected VALUE=' . $myrow['taxgroupid'] . '>' . $myrow['taxgroupdescription'] . '</option>'; + echo '<option selected value=' . $myrow['taxgroupid'] . '>' . $myrow['taxgroupdescription'] . '</option>'; } else { - echo '<option VALUE=' . $myrow['taxgroupid'] . '>' . $myrow['taxgroupdescription'] . '</option>'; + echo '<option value=' . $myrow['taxgroupid'] . '>' . $myrow['taxgroupdescription'] . '</option>'; } } //end while loop - echo '</select></td></tr></table><p><div class="centre"><input type="Submit" name="submit" VALUE="' . _('Insert New Supplier') . '">'; + echo '</select></td></tr> + </table> + <p><div class="centre"><input type="Submit" name="submit" value="' . _('Insert New Supplier') . '">'; echo '</div></form>'; } else { //SupplierID exists - either passed when calling the form or from the form itself - 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'] . '" />'; echo '<table class=selection>'; @@ -796,91 +827,112 @@ $_POST['FactorID'] = $myrow['factorcompanyid']; $_POST['TaxRef'] = $myrow['taxref']; - echo '<input type=hidden name="SupplierID" VALUE="' . $SupplierID . '">'; + echo '<input type=hidden name="SupplierID" value="' . $SupplierID . '">'; } else { // its a new supplier being added - echo '<input type=hidden name="New" VALUE="Yes">'; - echo '<tr><td>' . _('Supplier Code') . ':</td><td><input '.(in_array('ID',$Errors) ? 'class="inputerror"' : '').' type="text" name="SupplierID" VALUE="' . $SupplierID . '" size=12 maxlength=10></td></tr>'; + echo '<input type=hidden name="New" value="Yes">'; + echo '<tr><td>' . _('Supplier Code') . ':</td> + <td><input '.(in_array('ID',$Errors) ? 'class="inputerror"' : '').' type="text" name="SupplierID" value="' . $SupplierID . '" size=12 maxlength=10></td></tr>'; } - echo '<tr><td>' . _('Supplier Name') . ':</td><td><input '.(in_array('Name',$Errors) ? 'class="inputerror"' : '').' type="text" name="SuppName" VALUE="' . $_POST['SuppName'] . '" size=42 maxlength=40></td></tr>'; - echo '<tr><td>' . _('Address Line 1 (Street)') . ':</td><td><input type="text" name="Address1" VALUE="' . $_POST['Address1'] . '" size=42 maxlength=40></td></tr>'; - echo '<tr><td>' . _('Address Line 2 (Suburb/City)') . ':</td><td><input type="text" name="Address2" VALUE="' . $_POST['Address2'] . '" size=42 maxlength=40></td></tr>'; - echo '<tr><td>' . _('Address Line 3 (State/Province)') . ':</td><td><input type="text" name="Address3" VALUE="' . $_POST['Address3'] . '" size=42 maxlength=40></td></tr>'; - echo '<tr><td>' . _('Address Line 4 (Postal Code)') . ':</td><td><input type="text" name="Address4" VALUE="' . $_POST['Address4'] . '" size=42 maxlength=40></td></tr>'; - echo '<tr><td>' . _('Telephone') . ':</td><td><input '.(in_array('Name',$Errors) ? 'class="inputerror"' : '').' type="text" name="Phone" VALUE="' . $_POST['Phone'] . '" size=42 maxlength=40></td></tr>'; - echo '<tr><td>' . _('Facsimile') . ':</td><td><input '.(in_array('Name',$Errors) ? 'class="inputerror"' : '').' type="text" name="Fax" VALUE="' . $_POST['Fax'] . '" size=42 maxlength=40></td></tr>'; - echo '<tr><td>' . _('Email Address') . ':</td><td><input '.(in_array('Name',$Errors) ? 'class="inputerror"' : '').' type="text" name="Email" VALUE="' . $_POST['Email'] . '" size=42 maxlength=40></td></tr>'; - echo '<tr><td>' . _('Supplier Type') . ":</td><td><select name='SupplierType'>"; - $result=DB_query('SELECT typeid, typename FROM suppliertype', $db); + echo '<tr><td>' . _('Supplier Name') . ':</td> + <td><input '.(in_array('Name',$Errors) ? 'class="inputerror"' : '').' type="text" name="SuppName" value="' . $_POST['SuppName'] . '" size=42 maxlength=40></td></tr>'; + echo '<tr><td>' . _('Address Line 1 (Street)') . ':</td> + <td><input type="text" name="Address1" value="' . $_POST['Address1'] . '" size=42 maxlength=40></td></tr>'; + echo '<tr><td>' . _('Address Line 2 (Suburb/City)') . ':</td> + <td><input type="text" name="Address2" value="' . $_POST['Address2'] . '" size=42 maxlength=40></td></tr>'; + echo '<tr><td>' . _('Address Line 3 (State/Province)') . ':</td> + <td><input type="text" name="Address3" value="' . $_POST['Address3'] . '" size=42 maxlength=40></td></tr>'; + echo '<tr><td>' . _('Address Line 4 (Postal Code)') . ':</td> + <td><input type="text" name="Address4" value="' . $_POST['Address4'] . '" size=42 maxlength=40></td></tr>'; + echo '<tr><td>' . _('Telephone') . ':</td> + <td><input '.(in_array('Name',$Errors) ? 'class="inputerror"' : '').' type="text" name="Phone" value="' . $_POST['Phone'] . '" size=42 maxlength=40></td></tr>'; + echo '<tr><td>' . _('Facsimile') . ':</td> + <td><input '.(in_array('Name',$Errors) ? 'class="inputerror"' : '').' type="text" name="Fax" value="' . $_POST['Fax'] . '" size=42 maxlength=40></td></tr>'; + echo '<tr><td>' . _('Email Address') . ':</td> + <td><input '.(in_array('Name',$Errors) ? 'class="inputerror"' : '').' type="text" name="Email" value="' . $_POST['Email'] . '" size=42 maxlength=40></td></tr>'; + echo '<tr><td>' . _('Supplier Type') . ':</td> + <td><select name="SupplierType">'; + $result=DB_query("SELECT typeid, typename FROM suppliertype", $db); while ($myrow = DB_fetch_array($result)) { if ($_POST['SupplierType']==$myrow['typeid']) { - echo "<option selected value='". $myrow['typeid'] . "'>" . $myrow['typename']; + echo '<option selected value="'. $myrow['typeid'] . '">' . $myrow['typename'] .'</option>'; } else { - echo "<option value='". $myrow['typeid'] . "'>" . $myrow['typename']; + echo '<option value="' . $myrow['typeid'] . '">' . $myrow['typename'] .'</option>'; } } //end while loop - echo "</select></td></tr>"; + echo '</select></td></tr>'; - echo '<tr><td>' . _('Supplier Since') . ' (' . $_SESSION['DefaultDateFormat'] .'):</td><td><input '.(in_array('SupplierSince',$Errors) ? 'class="inputerror"' : '').' size=12 maxlength=10 type="text" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" name="SupplierSince" VALUE=' . $_POST['SupplierSince'] . '></td></tr>'; - echo '<tr><td>' . _('Bank Particulars') . ":</td><td><input type='text' name='BankPartics' size=13 maxlength=12 VALUE='" . $_POST['BankPartics'] . "'></td></tr>"; - echo '<tr><td>' . _('Bank Reference') . ':</td><td><input '.(in_array('BankRef',$Errors) ? 'class="inputerror"' : '').' type="text" name="BankRef" size=13 maxlength=12 VALUE="' . $_POST['BankRef'] . '"></td></tr>'; - echo '<tr><td>' . _('Bank Account No') . ":</td><td><input type='text' name='BankAct' size=31 maxlength=30 VALUE='" . $_POST['BankAct'] . "'></td></tr>"; + echo '<tr><td>' . _('Supplier Since') . ' (' . $_SESSION['DefaultDateFormat'] .'):</td> + <td><input '.(in_array('SupplierSince',$Errors) ? 'class="inputerror"' : '').' size=12 maxlength=10 type="text" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" name="SupplierSince" value=' . $_POST['SupplierSince'] . '></td></tr>'; + echo '<tr><td>' . _('Bank Particulars') . ':</td> + <td><input type="text" name="BankPartics" size=13 maxlength=12 value="' . $_POST['BankPartics'] . '"></td></tr>'; + echo '<tr><td>' . _('Bank Reference') . ':</td> + <td><input '.(in_array('BankRef',$Errors) ? 'class="inputerror"' : '').' type="text" name="BankRef" size=13 maxlength=12 value="' . $_POST['BankRef'] . '"></td></tr>'; + echo '<tr><td>' . _('Bank Account No') . ':</td> + <td><input type="text" name="BankAct" size=31 maxlength=30 value="' . $_POST['BankAct'] . '"></td></tr>'; - $result=DB_query('SELECT terms, termsindicator FROM paymentterms', $db); + $result=DB_query("SELECT terms, termsindicator FROM paymentterms", $db); - echo '<tr><td>' . _('Payment Terms') . ":</td><td><select name='PaymentTerms'>"; + echo '<tr><td>' . _('Payment Terms') . ':</td> + <td><select name="PaymentTerms">'; while ($myrow = DB_fetch_array($result)) { if ($_POST['PaymentTerms'] == $myrow['termsindicator']){ - echo '<option selected VALUE=' . $myrow['termsindicator'] . '>' . $myrow['terms']; + echo '<option selected value=' . $myrow['termsindicator'] . '>' . $myrow['terms'] .'</option>'; } else { - echo '<option VALUE=' . $myrow['termsindicator'] . '>' . $myrow['terms']; + echo '<option value=' . $myrow['termsindicator'] . '>' . $myrow['terms'] .'</option>'; } } //end while loop DB_data_seek($result, 0); - $result=DB_query('SELECT id, coyname FROM factorcompanies', $db); + $result=DB_query("SELECT id, coyname FROM factorcompanies", $db); - echo '<tr><td>' . _('Factor Company') . ":</td><td><select name='FactorID'>"; - echo '<option VALUE=0>' . _('None'); + echo '<tr><td>' . _('Factor Company') . ':</td> + <td><select name="FactorID">'; + echo '<option value=0>' . _('None'); while ($myrow = DB_fetch_array($result)) { if ($_POST['FactorID'] == $myrow['id']){ - echo '<option selected VALUE=' . $myrow['id'] . '>' . $myrow['coyname']; + echo '<option selected value=' . $myrow['id'] . '>' . $myrow['coyname'] .'</option>'; } else { - echo '<option VALUE=' . $myrow['id'] . '>' . $myrow['coyname']; + echo '<option value=' . $myrow['id'] . '>' . $myrow['coyname'] .'</option>'; } } //end while loop DB_data_seek($result, 0); - echo '<tr><td>' . _('Tax Reference') . ":</td><td><input type='text' name='TaxRef' size=21 maxlength=20 VALUE='".$_POST['TaxRef']."'></td></tr>"; + echo '<tr><td>' . _('Tax Reference') . ':</td> + <td><input type="text" name="TaxRef" size=21 maxlength=20 value="' . $_POST['TaxRef'] .'"></td></tr>'; - $result=DB_query('SELECT currency, currabrev FROM currencies', $db); + $result=DB_query("SELECT currency, currabrev FROM currencies", $db); - echo '</select></td></tr><tr><td>' . _('Supplier Currency') . ":</td><td><select name='CurrCode'>"; + echo '</select></td></tr><tr><td>' . _('Supplier Currency') . ':</td> + <td><select name="CurrCode">'; while ($myrow = DB_fetch_array($result)) { if ($_POST['CurrCode'] == $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 DB_data_seek($result, 0); - echo '</select></td></tr><tr><td>' . _('Remittance Advice') . ":</td><td><select name='Remittance'>"; + echo '</select></td></tr> + <tr><td>' . _('Remittance Advice') . ':</td> + <td><select name="Remittance">'; if ($_POST['Remittance'] == 0){ - echo '<option selected VALUE=0>' . _('Not Required'); - echo '<option VALUE=1>' . _('Required'); + echo '<option selected value=0>' . _('Not Required') .'</option>'; + echo '<option value=1>' . _('Required') .'</option>'; } else { - echo '<option VALUE=0>' . _('Not Required'); - echo '<option selected VALUE=1>' . _('Required'); + echo '<option value=0>' . _('Not Required') .'</option>'; + echo '<option selected value=1>' . _('Required') .'</option>'; } echo '</select></td></tr>'; - echo '<tr><td>' . _('Tax Group') . ":</td><td><select name='TaxGroup'>"; + echo '<tr><td>' . _('Tax Group') . ':</td> + <td><select name="TaxGroup">'; DB_data_seek($result, 0); @@ -889,9 +941,9 @@ while ($myrow = DB_fetch_array($result)) { if ($myrow['taxgroupid'] == $_POST['TaxGroup']) { - echo '<option selected VALUE="'.$myrow['taxgroupid'] . '">' . $myrow['taxgroupdescription'] . '</option>'; + echo '<option selected value="'.$myrow['taxgroupid'] . '">' . $myrow['taxgroupdescription'] . '</option>'; } else { - echo '<option VALUE="' . $myrow['taxgroupid'] . '">' . $myrow['taxgroupdescription'] . '</option>'; + echo '<option value="' . $myrow['taxgroupid'] . '">' . $myrow['taxgroupdescription'] . '</option>'; } } //end while loop @@ -899,13 +951,13 @@ echo '</select></td></tr></table>'; if (isset($_POST['New'])) { - echo '<p><div class="centre"><input type="Submit" name="submit" VALUE="' . _('Add These New Supplier Details') . '"></form>'; + echo '<p><div class="centre"><input type="Submit" name="submit" value="' . _('Add These New Supplier Details') . '"></form>'; } else { - echo '<br><p><div class="centre"><input type="Submit" name="submit" VALUE="' . _('Update Supplier') . '"></div><br>'; -// echo '<p><font color=red><b>' . _('WARNING') . ': ' . _('There is no second warning if you hit the delete button below') . '. ' . _('However checks will be made to ensure there are no outstanding purchase orders or existing accounts payable transactions before the deletion is processed') . '<br></font></b>'; + echo '<br /><p><div class="centre"><input type="Submit" name="submit" value="' . _('Update Supplier') . '"></div><br />'; +// echo '<p><font color=red><b>' . _('WARNING') . ': ' . _('There is no second warning if you hit the delete button below') . '. ' . _('However checks will be made to ensure there are no outstanding purchase orders or existing accounts payable transactions before the deletion is processed') . '<br /></font></b>'; prnMsg(_('WARNING') . ': ' . _('There is no second warning if you hit the delete button below') . '. ' . _('However checks will be made to ensure there are no outstanding purchase orders or existing accounts payable transactions before the deletion is processed'), 'Warn'); - echo '<br><div class=centre><input type="submit" name="delete" VALUE="' . _('Delete Supplier') . '" onclick=\"return confirm(\'' . _('Are you sure you wish to delete this supplier?') . '\');\"></form>'; - echo '<br><a href="' . $rootpath . '/SupplierContacts.php?SupplierID=' . $SupplierID . '">' . _('Review Contact Details') . '</a></div>'; + echo '<br /><div class=centre><input type="submit" name="delete" value="' . _('Delete Supplier') . '" onclick=\"return confirm(\'' . _('Are you sure you wish to delete this supplier?') . '\');\"></form>'; + echo '<br /><a href="' . $rootpath . '/SupplierContacts.php?SupplierID=' . $SupplierID . '">' . _('Review Contact Details') . '</a></div>'; } echo '</div>'; } // end of main ifs Modified: trunk/UpgradeDatabase.php =================================================================== --- trunk/UpgradeDatabase.php 2011-04-26 11:03:36 UTC (r... [truncated message content] |
From: <dai...@us...> - 2011-04-28 10:39:34
|
Revision: 4557 http://web-erp.svn.sourceforge.net/web-erp/?rev=4557&view=rev Author: daintree Date: 2011-04-28 10:39:25 +0000 (Thu, 28 Apr 2011) Log Message: ----------- quoting Modified Paths: -------------- trunk/AccountGroups.php trunk/Credit_Invoice.php trunk/FixedAssetItems.php trunk/GLTags.php trunk/PDFBankingSummary.php trunk/PDFChequeListing.php trunk/PDFOrderStatus.php trunk/Payments.php trunk/Suppliers.php trunk/UpgradeDatabase.php trunk/WWW_Access.php trunk/WorkOrderEntry.php trunk/doc/Change.log.html trunk/includes/ConnectDB.inc trunk/includes/ConnectDB_mysql.inc trunk/includes/ConnectDB_mysqli.inc trunk/includes/Login.php trunk/includes/MiscFunctions.php Added Paths: ----------- trunk/SecurityTokens.php trunk/sql/mysql/upgrade4.03-4.04.sql Modified: trunk/AccountGroups.php =================================================================== --- trunk/AccountGroups.php 2011-04-26 11:03:36 UTC (rev 4556) +++ trunk/AccountGroups.php 2011-04-28 10:39:25 UTC (rev 4557) @@ -1,9 +1,7 @@ <?php -/* $Revision: 1.23 $ */ + /* $Id$*/ -//$PageSecurity = 10; - include('includes/session.inc'); $title = _('Account Groups'); @@ -227,12 +225,12 @@ echo '<table class="selection"> <tr> - <th>' . _('Group Name') . "</th> - <th>" . _('Section') . "</th> - <th>" . _('Sequence In TB') . "</th> - <th>" . _('Profit and Loss') . "</th> - <th>" . _('Parent Group') . "</th> - </tr>"; + <th>' . _('Group Name') . '</th> + <th>' . _('Section') . '</th> + <th>' . _('Sequence In TB') . '</th> + <th>' . _('Profit and Loss') . '</th> + <th>' . _('Parent Group') . '</th> + </tr>'; $k=0; //row colour counter while ($myrow = DB_fetch_row($result)) { @@ -262,8 +260,8 @@ <td>' . $myrow[2] . '</td> <td>' . $PandLText . '</td> <td>' . $myrow[4] . '</td>'; - echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?' . SID . '&SelectedAccountGroup=' . htmlentities($myrow[0], ENT_QUOTES,'UTF-8') . '">' . _('Edit') . '</a></td>'; - echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?' . SID . '&SelectedAccountGroup=' . htmlentities($myrow[0], ENT_QUOTES,'UTF-8') . '&delete=1">' . _('Delete') .'</a></td></tr>'; + echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedAccountGroup=' . htmlentities($myrow[0], ENT_QUOTES,'UTF-8') . '">' . _('Edit') . '</a></td>'; + echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedAccountGroup=' . htmlentities($myrow[0], ENT_QUOTES,'UTF-8') . '&delete=1">' . _('Delete') .'</a></td></tr>'; } //END WHILE LIST LOOP echo '</table>'; @@ -271,12 +269,12 @@ if (isset($_POST['SelectedAccountGroup']) OR isset($_GET['SelectedAccountGroup'])) { - echo '<br /><div class="centre"><a href="' . $_SERVER['PHP_SELF'] . '?' . SID .'">' . _('Review Account Groups') . '</a></div>'; + echo '<br /><div class="centre"><a href="' . $_SERVER['PHP_SELF'] .'">' . _('Review Account Groups') . '</a></div>'; } if (! isset($_GET['delete'])) { - echo '<br /><form method="post" id="AccountGroups" action="' . $_SERVER['PHP_SELF'] . '?' . SID . '">'; + echo '<br /><form method="post" id="AccountGroups" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; @@ -339,13 +337,12 @@ <input tabindex="1" ' . (in_array('GroupName',$Errors) ? 'class="inputerror"' : '' ) .' type="text" name="GroupName" size="50" maxlength="50" value="' . $_POST['GroupName'] . '" /></td></tr>'; } echo '<tr><td>' . _('Parent Group') . ':' . '</td> - <td><select tabindex="2" ' . (in_array('ParentGroupName',$Errors) ? 'class="selecterror"' : '' ) . - ' name="ParentGroupName">'; + <td><select tabindex="2" ' . (in_array('ParentGroupName',$Errors) ? 'class="selecterror"' : '' ) . ' name="ParentGroupName">'; - $sql = 'SELECT groupname FROM accountgroups'; + $sql = "SELECT groupname FROM accountgroups"; $groupresult = DB_query($sql, $db,$ErrMsg,$DbgMsg); if (!isset($_POST['ParentGroupName'])){ - echo '<option selected="selected" value="">' ._('Top Level Group').'</option>'; + echo '<option selected value="">' ._('Top Level Group').'</option>'; } else { echo '<option value="">' ._('Top Level Group').'</option>'; } Modified: trunk/Credit_Invoice.php =================================================================== --- trunk/Credit_Invoice.php 2011-04-26 11:03:36 UTC (rev 4556) +++ trunk/Credit_Invoice.php 2011-04-28 10:39:25 UTC (rev 4557) @@ -1,8 +1,6 @@ <?php /* $Id$*/ -//$PageSecurity =3; - /*Functions to get the GL codes to post the transaction to */ include('includes/GetSalesTransGLCodes.inc'); /*defines the structure of the data required to hold the transaction as a session variable */ @@ -398,8 +396,8 @@ <td colspan=3 class=number>' . _('Freight cost charged on invoice') . '</td> <td class=number>' . number_format($_SESSION['Old_FreightCost'],2) . '</td> <td></td> - <td colspan=2 class=number>' . _('Credit Freight Cost') . "</td> - <td><input tabindex=".$j." type=text class=number size=6 maxlength=6 name='ChargeFreightCost' value=" . $_SESSION['CreditItems']->FreightCost . "></td>"; + <td colspan=2 class=number>' . _('Credit Freight Cost') . '</td> + <td><input tabindex='.$j.' type=text class="number" size=6 maxlength=6 name="ChargeFreightCost" value="' . $_SESSION['CreditItems']->FreightCost . '"></td>'; echo '<td>'; echo '</td><td>'; @@ -422,7 +420,7 @@ } if (!isset($_POST['ProcessCredit'])) { - echo '<input type=text class=number name=FreightTaxRate' . $FreightTaxLine->TaxCalculationOrder . ' maxlength=4 size=4 VALUE=' . $FreightTaxLine->TaxRate * 100 . '>'; + echo '<input type=text class=number name=FreightTaxRate' . $FreightTaxLine->TaxCalculationOrder . ' maxlength=4 size=4 value=' . $FreightTaxLine->TaxRate * 100 . '>'; } if ($FreightTaxLine->TaxOnTax ==1){ $TaxTotals[$FreightTaxLine->TaxAuthID] += ($FreightTaxLine->TaxRate * ($_SESSION['CreditItems']->FreightCost + $FreightTaxTotal)); @@ -437,8 +435,8 @@ if (!isset($_POST['ProcessCredit'])) { echo '</td>'; - echo '<td class=number>' . number_format($FreightTaxTotal,2) . '</td> - <td class=number>' . number_format($FreightTaxTotal+ $_SESSION['CreditItems']->FreightCost,2) . '</td> + echo '<td class="number">' . number_format($FreightTaxTotal,2) . '</td> + <td class="number">' . number_format($FreightTaxTotal+ $_SESSION['CreditItems']->FreightCost,2) . '</td> </tr>'; } @@ -447,12 +445,12 @@ if (!isset($_POST['ProcessCredit'])) { echo '<tr> - <td colspan=7 class=number>' . _('Credit Totals') . "</td> - <td class=number><hr><b>$DisplayTotal</b><hr></td> + <td colspan=7 class=number>' . _('Credit Totals') . '</td> + <td class=number><hr><b>' . $DisplayTotal . '</b><hr></td> <td colspan=2></td> - <td class=number><hr><b>" . number_format($TaxTotal,2) . "<hr></td> - <td class=number><hr><b>" . number_format($TaxTotal+($_SESSION['CreditItems']->total + $_SESSION['CreditItems']->FreightCost),2) . "</b><hr></td> - </tr></table>"; + <td class=number><hr><b>' . number_format($TaxTotal,2) . '<hr></td> + <td class=number><hr><b>' . number_format($TaxTotal+($_SESSION['CreditItems']->total + $_SESSION['CreditItems']->FreightCost),2) . '</b><hr></td> + </tr></table>'; } $DefaultDispatchDate = Date($_SESSION['DefaultDateFormat']); @@ -493,12 +491,11 @@ /*Start an SQL transaction */ - $SQL = 'BEGIN'; - $Result = DB_query($SQL,$db); + + $Result = DB_Txn_Begin($db); $DefaultDispatchDate= FormatDateForSQL($DefaultDispatchDate); - /*Calculate the allocation and see if it is possible to allocate to the invoice being credited */ $SQL = "SELECT (ovamount+ovgst+ovfreight-ovdiscount-alloc) as baltoallocate @@ -822,7 +819,7 @@ /* Insert stock movements for the stock coming back in - with unit cost */ - if ($MBFlag=="M" OR $MBFlag=="B"){ + if ($MBFlag=='M' OR $MBFlag=='B'){ $SQL = "INSERT INTO stockmoves ( stockid, type, @@ -1437,8 +1434,7 @@ } } /*end of if Sales and GL integrated */ - $SQL='COMMIT'; - $Result = DB_query($SQL,$db); + $Result = DB_Txn_Commit($db); unset($_SESSION['CreditItems']->LineItems); unset($_SESSION['CreditItems']); Modified: trunk/FixedAssetItems.php =================================================================== --- trunk/FixedAssetItems.php 2011-04-26 11:03:36 UTC (rev 4556) +++ trunk/FixedAssetItems.php 2011-04-28 10:39:25 UTC (rev 4557) @@ -50,7 +50,7 @@ if ($UploadTheFile=='Yes'){ $result = move_uploaded_file($_FILES['ItemPicture']['tmp_name'], $filename); - $message = ($result)?_('File url') ."<a href='". $filename ."'>" . $filename . '</a>' : _('Something is wrong with uploading a file'); + $message = ($result)?_('File url') .'<a href="' . $filename .'">' . $filename . '</a>' : _('Something is wrong with uploading a file'); } /* EOR Add Image upload for New Item - by Ori */ } @@ -262,10 +262,6 @@ prnMsg( _('The new asset has been added to the database with an asset code of:') . ' ' . $NewAssetID,'success'); unset($_POST['LongDescription']); unset($_POST['Description']); -// unset($_POST['AssetCategoryID']); -// unset($_POST['AssetLocation']); -// unset($_POST['DepnType']); -// unset($_POST['DepnRate']); unset($_POST['BarCode']); unset($_POST['SerialNo']); }//ALL WORKED SO RESET THE FORM VARIABLES @@ -374,8 +370,8 @@ } /* end if delete asset */ $result = DB_Txn_Commit($db); -echo '<form name="AssetForm" enctype="multipart/form-data" method="post" action="' . $_SERVER['PHP_SELF'] . '?' .SID . - '"><table class=selection>'; +echo '<form name="AssetForm" enctype="multipart/form-data" method="post" action="' . $_SERVER['PHP_SELF'] . '"> + <table class=selection>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; @@ -452,7 +448,7 @@ echo '<tr><td>'. _('Image File (.jpg)') . ':</td><td><input type="file" id="ItemPicture" name="ItemPicture"></td>'; if (function_exists('imagecreatefromjpg')){ - $StockImgLink = '<img src="GetStockImage.php?SID&automake=1&textcolor=FFFFFF&bgcolor=CCCCCC'. + $StockImgLink = '<img src="GetStockImage.php?automake=1&textcolor=FFFFFF&bgcolor=CCCCCC'. '&AssetID='.urlencode($AssetID). '&text='. '&width=64'. Modified: trunk/GLTags.php =================================================================== --- trunk/GLTags.php 2011-04-26 11:03:36 UTC (rev 4556) +++ trunk/GLTags.php 2011-04-28 10:39:25 UTC (rev 4557) @@ -1,7 +1,7 @@ <?php /* $Id$*/ -//$PageSecurity = 10; + include('includes/session.inc'); $title = _('Maintain General Ledger Tags'); @@ -19,13 +19,13 @@ } if (isset($_POST['submit'])) { - $sql = "insert into tags values(NULL, '".$_POST['description']."')"; + $sql = "INSERT INTO tags values(NULL, '".$_POST['description']."')"; $result= DB_query($sql,$db); } if (isset($_POST['update'])) { - $sql = "update tags set tagdescription='".$_POST['description']. - "' where tagref='".$_POST['reference']."'"; + $sql = "UPDATE tags SET tagdescription='".$_POST['description']. + "' WHERE tagref='".$_POST['reference']."'"; $result= DB_query($sql,$db); } echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/maintenance.png" title="' . @@ -41,9 +41,9 @@ <input type="hidden" name="reference" value="'.$_GET['SelectedTag'].'">'; if (isset($_GET['Action']) and $_GET['Action']=='edit') { - echo '<input type=Submit name=update value=' . _('Update') . '>'; + echo '<input type="submit" name=update value=' . _('Update') . '>'; } else { - echo '<input type=Submit name=submit value=' . _('Insert') . '>'; + echo '<input type="submit" name=submit value=' . _('Insert') . '>'; } echo '</td></tr></table><p></p>'; @@ -58,13 +58,13 @@ $result= DB_query($sql,$db); while ($myrow = DB_fetch_array($result,$db)){ - echo '<tr><td>'.$myrow[0].'</td><td>'.$myrow[1].'</td><td><a href="' . - $_SERVER['PHP_SELF'] . '?' . SID . '&SelectedTag=' . $myrow[0] . '&Action=edit">' . _('Edit') . '</a></td></tr>'; + echo '<tr><td>'.$myrow[0].'</td><td>'.$myrow[1].'</td> + <td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedTag=' . $myrow[0] . '&Action=edit">' . _('Edit') . '</a></td></tr>'; } echo '</table><p></p>'; -echo "<script>defaultControl(document.form.description);</script>"; +echo '<script>defaultControl(document.form.description);</script>'; include('includes/footer.inc'); Modified: trunk/PDFBankingSummary.php =================================================================== --- trunk/PDFBankingSummary.php 2011-04-26 11:03:36 UTC (rev 4556) +++ trunk/PDFBankingSummary.php 2011-04-28 10:39:25 UTC (rev 4557) @@ -16,15 +16,16 @@ echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/magnifier.png" title="' . $title . '" alt="" />' . ' ' . $title . '</p>'; - $sql='SELECT DISTINCT + $sql="SELECT DISTINCT transno, transdate FROM banktrans WHERE type=12 - ORDER BY transno DESC'; + ORDER BY transno DESC"; $result=DB_query($sql, $db); - echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '"><table class=selection>'; + echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '"> + <table class=selection>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<tr><td>' . _('Select the batch number of receipts to be printed') . ':</td>'; echo '<td><select name="BatchNo">'; @@ -165,7 +166,7 @@ $LeftOvers = $pdf->addTextWrap($Left_Margin,$YPos,60,$FontSize,number_format($TotalBanked,2), 'right'); $LeftOvers = $pdf->addTextWrap($Left_Margin+65,$YPos,300,$FontSize,_('TOTAL') . ' ' . $Currency . ' ' . _('BANKED'), 'left'); - $pdf->OutputD($_SESSION['DatabaseName'] . '_BankingSummary_' . date('Y-m-d').'.pdf');//UldisN + $pdf->OutputD($_SESSION['DatabaseName'] . '_BankingSummary_' . date('Y-m-d').'.pdf'); $pdf->__destruct(); } Modified: trunk/PDFChequeListing.php =================================================================== --- trunk/PDFChequeListing.php 2011-04-26 11:03:36 UTC (rev 4556) +++ trunk/PDFChequeListing.php 2011-04-28 10:39:25 UTC (rev 4557) @@ -31,6 +31,7 @@ } echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; + echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<table class=selection> <tr> Modified: trunk/PDFOrderStatus.php =================================================================== --- trunk/PDFOrderStatus.php 2011-04-26 11:03:36 UTC (rev 4556) +++ trunk/PDFOrderStatus.php 2011-04-28 10:39:25 UTC (rev 4557) @@ -27,12 +27,11 @@ prnMsg($msg,'error'); } - echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/transactions.png" title="' . $title . '" alt="" />' . ' ' - . _('Order Status Report') . '</p>'; + echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/transactions.png" title="' . $title . '" alt="" />' . ' ' . _('Order Status Report') . '</p>'; echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<table class=selection> + echo '<table class="selection"> <tr> <td>' . _('Enter the date from which orders are to be listed') . ':</td> <td><input type=text class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="FromDate" maxlength=10 size=10 value="' . Date($_SESSION['DefaultDateFormat'], Mktime(0,0,0,Date('m'),Date('d')-1,Date('y'))) . '"></td> @@ -54,7 +53,7 @@ echo '</select></td></tr>'; echo '<tr><td>' . _('Inventory Location') . ':</td><td><select name="Location">'; - echo '<option selected value="All">' . _('All Locations'); + echo '<option selected value="All">' . _('All Locations') . '</option>'; $result= DB_query("SELECT loccode, locationname FROM locations",$db); while ($myrow=DB_fetch_array($result)){ @@ -242,9 +241,9 @@ if (DB_error_no($db)!=0){ include('includes/header.inc'); - echo '<br>' . _('An error occurred getting the orders details'); + echo '<br />' . _('An error occurred getting the orders details'); if ($debug==1){ - echo '<br>' . _('The SQL used to get the orders that failed was') . '<br>' . $sql; + echo '<br />' . _('The SQL used to get the orders that failed was') . '<br />' . $sql; } include ('includes/footer.inc'); exit; @@ -341,6 +340,6 @@ $OrderNo=0; } /*end of new page header */ } /* end of while there are delivery differences to print */ -$pdf->OutputD($_SESSION['DatabaseName'] . '_OrderStatus_' . date('Y-m-d') . '.pdf');//UldisN -$pdf->__destruct(); //UldisN +$pdf->OutputD($_SESSION['DatabaseName'] . '_OrderStatus_' . date('Y-m-d') . '.pdf'); +$pdf->__destruct(); ?> \ No newline at end of file Modified: trunk/Payments.php =================================================================== --- trunk/Payments.php 2011-04-26 11:03:36 UTC (rev 4556) +++ trunk/Payments.php 2011-04-28 10:39:25 UTC (rev 4557) @@ -723,18 +723,19 @@ echo ' ' . _('on') . ' ' . $_SESSION['PaymentDetail']->DatePaid . '</font></th></tr>'; -$SQL = 'SELECT bankaccountname, +$SQL = "SELECT bankaccountname, bankaccounts.accountcode, bankaccounts.currcode FROM bankaccounts, chartmaster - WHERE bankaccounts.accountcode=chartmaster.accountcode'; + WHERE bankaccounts.accountcode=chartmaster.accountcode"; $ErrMsg = _('The bank accounts could not be retrieved because'); $DbgMsg = _('The SQL used to retrieve the bank accounts was'); $AccountsResults = DB_query($SQL,$db,$ErrMsg,$DbgMsg); -echo '<tr><td>' . _('Bank Account') . ':</td><td><select name="BankAccount" onChange="ReloadForm(UpdateHeader)">'; +echo '<tr><td>' . _('Bank Account') . ':</td> + <td><select name="BankAccount" onChange="ReloadForm(UpdateHeader)">'; if (DB_num_rows($AccountsResults)==0){ echo '</select></td></tr></table><p>'; @@ -746,9 +747,9 @@ while ($myrow=DB_fetch_array($AccountsResults)){ /*list the bank account names */ if (isset($_POST['BankAccount']) and $_POST['BankAccount']==$myrow['accountcode']){ - echo '<option selected value="' . $myrow['accountcode'] . '">' . $myrow['bankaccountname'] . ' - ' . $myrow['currcode']; + echo '<option selected value="' . $myrow['accountcode'] . '">' . $myrow['bankaccountname'] . ' - ' . $myrow['currcode'] . '</option>'; } else { - echo '<option value="' . $myrow['accountcode'] . '">' . $myrow['bankaccountname'] . ' - ' . $myrow['currcode']; + echo '<option value="' . $myrow['accountcode'] . '">' . $myrow['bankaccountname'] . ' - ' . $myrow['currcode'] . '</option>'; } } echo '</select></td></tr>'; @@ -762,7 +763,7 @@ if ($_SESSION['PaymentDetail']->SupplierID==''){ echo '<tr><td>' . _('Currency of Payment') . ':</td><td><select name="Currency" onChange="ReloadForm(UpdateHeader)">'; - $SQL = 'SELECT currency, currabrev, rate FROM currencies'; + $SQL = "SELECT currency, currabrev, rate FROM currencies"; $result=DB_query($SQL,$db); if (DB_num_rows($result)==0){ @@ -771,9 +772,9 @@ } else { while ($myrow=DB_fetch_array($result)){ if ($_SESSION['PaymentDetail']->Currency==$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>'; } } echo '</select></td><td><i>' . _('The transaction currency does not need to be the same as the bank account currency') . '</i></td></tr>'; @@ -822,10 +823,12 @@ if ($_POST['FunctionalExRate']==1 AND isset($SuggestedFunctionalExRate)){ $_POST['FunctionalExRate'] = $SuggestedFunctionalExRate; } - echo '<tr><td>' . _('Functional Exchange Rate') . ':</td><td><input type="text" name="FunctionalExRate" maxlength=10 size=12 value="' . $_POST['FunctionalExRate'] . '"></td> + echo '<tr><td>' . _('Functional Exchange Rate') . ':</td> + <td><input type="text" name="FunctionalExRate" maxlength=10 size=12 value="' . $_POST['FunctionalExRate'] . '"></td> <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['PaymentDetail']->AccountCurrency . '</i></td></tr>'; } -echo '<tr><td>' . _('Payment type') . ':</td><td><select name="Paymenttype">'; +echo '<tr><td>' . _('Payment type') . ':</td> + <td><select name="Paymenttype">'; include('includes/GetPaymentMethods.php'); /* The array Payttypes is set up in includes/GetPaymentMethods.php @@ -834,9 +837,9 @@ foreach ($PaytTypes as $PaytType) { if (isset($_POST['Paymenttype']) and $_POST['Paymenttype']==$PaytType){ - echo '<option selected value="' . $PaytType . '">' . $PaytType; + echo '<option selected value="' . $PaytType . '">' . $PaytType . '</option>'; } else { - echo '<option Value="' . $PaytType . '">' . $PaytType; + echo '<option Value="' . $PaytType . '">' . $PaytType . '</option>'; } } //end foreach echo '</select></td></tr>'; @@ -853,7 +856,7 @@ } echo '<tr><td>' . _('Reference / Narrative') . ':</td> - <td colspan=2><input type="text" name="Narrative" maxlength=80 size=82 value="' . $_POST['Narrative'] . '"> ' . _('(Max. length 80 characters)') . '</td></tr>'; + <td colspan=2><input type="text" name="Narrative" maxlength=80 size=82 value="' . $_POST['Narrative'] . '"> ' . _('(Max. length 80 characters)') . '</td></tr>'; echo '<tr><td colspan=3><div class="centre"><input type="submit" name="UpdateHeader" value="' . _('Update'). '"></td></tr>'; @@ -894,13 +897,46 @@ echo '<tr><td>' . _('Enter GL Account Manually') . ':</td> <td><input type=Text class="number" Name="GLManualCode" Maxlength=12 size=12 onChange="return inArray(this, GLCode.options,'. "'".'The account code '."'".'+ this.value+ '."'".' doesnt exist'."'".')"></td></tr>'; } - echo '<tr><td>' . _('Select GL Account') . ':</td> - <td><select name="GLCode" onChange="return assignComboToInput(this,'.'GLManualCode'.')">'; + + echo '<tr><td>' . _('Select GL Group') . ':</td> + <td><select name="GLGroup" onChange="return ReloadForm(UpdateCodes)">'; - $SQL = 'SELECT accountcode, + $SQL = "SELECT groupname + FROM accountgroups + ORDER BY sequenceintb"; + + $result=DB_query($SQL,$db); + if (DB_num_rows($result)==0){ + echo '</select></td></tr>'; + prnMsg(_('No General ledger account groups have been set up yet') . ' - ' . _('payments cannot be analysed against GL accounts until the GL accounts are set up'),'error'); + } else { + echo '<option value=""></option>'; + while ($myrow=DB_fetch_array($result)){ + if (isset($_POST['GLGroup']) and ($_POST['GLGroup']==$myrow['groupname'])){ + echo '<option selected value="' . $myrow['groupname'] . '">' . $myrow['groupname'] . '</option>'; + } else { + echo '<option value="' . $myrow['groupname'] . '">' . $myrow['groupname'] . '</option>'; + } + } + echo '</select><input type="submit" name="UpdateCodes" value="Select" /></td></tr>'; + } + + if (isset($_POST['GLGroup']) and $_POST['GLGroup']!='') { + $SQL = "SELECT accountcode, accountname FROM chartmaster - ORDER BY accountcode'; + WHERE group_='".$_POST['GLGroup']."' + ORDER BY accountcode"; + } else { + $SQL = "SELECT accountcode, + accountname + FROM chartmaster + ORDER BY accountcode"; + } + + + echo '<tr><td>' . _('Select GL Account') . ':</td> + <td><select name="GLCode" onChange="return assignComboToInput(this,'.'GLManualCode'.')">'; $result=DB_query($SQL,$db); if (DB_num_rows($result)==0){ @@ -909,40 +945,47 @@ } else { echo '<option value=""></option>'; while ($myrow=DB_fetch_array($result)){ - if (isset($_POST['GLCode']) and $_POST['GLCode']==$myrow["accountcode"]){ - echo '<option selected value=' . $myrow['accountcode'] . '>' . $myrow['accountcode'] . ' - ' . $myrow['accountname']; + if (isset($_POST['GLCode']) and $_POST['GLCode']==$myrow['accountcode']){ + echo '<option selected value=' . $myrow['accountcode'] . '>' . $myrow['accountcode'] . ' - ' . $myrow['accountname'] . '</option>'; } else { - echo '<option value=' . $myrow['accountcode'] . '>' . $myrow['accountcode'] . ' - ' . $myrow['accountname']; + echo '<option value=' . $myrow['accountcode'] . '>' . $myrow['accountcode'] . ' - ' . $myrow['accountname'] . '</option>'; } } echo '</select></td></tr>'; } - echo '<tr><td>'. _('Cheque/Voucher Number') .'</td><td><input type="text" name="cheque" Maxlength=12 size=12></td></tr>'; + echo '<tr><td>'. _('Cheque/Voucher Number') .'</td> + <td><input type="text" name="cheque" Maxlength=12 size=12></td></tr>'; if (isset($_POST['GLNarrative'])) { - echo '<tr><td>' . _('GL Narrative') . ':</td><td><input type="text" name="GLNarrative" maxlength=50 size=52 value="' . $_POST['GLNarrative'] . '"></td></tr>'; + echo '<tr><td>' . _('GL Narrative') . ':</td> + <td><input type="text" name="GLNarrative" maxlength=50 size=52 value="' . $_POST['GLNarrative'] . '"></td></tr>'; } else { - echo '<tr><td>' . _('GL Narrative') . ':</td><td><input type="text" name="GLNarrative" maxlength=50 size=52></td></tr>'; + echo '<tr><td>' . _('GL Narrative') . ':</td> + <td><input type="text" name="GLNarrative" maxlength=50 size=52></td></tr>'; } if (isset($_POST['GLAmount'])) { - echo '<tr><td>' . _('Amount') . ' (' . $_SESSION['PaymentDetail']->Currency . '):</td><td><input type=Text Name="GLAmount" Maxlength=12 size=12 class=number value=' . $_POST['GLAmount'] . '></td></tr>'; + echo '<tr><td>' . _('Amount') . ' (' . $_SESSION['PaymentDetail']->Currency . '):</td> + <td><input type=Text Name="GLAmount" Maxlength=12 size=12 class=number value=' . $_POST['GLAmount'] . '></td></tr>'; } else { - echo '<tr><td>' . _('Amount') . ' (' . $_SESSION['PaymentDetail']->Currency . '):</td><td><input type=Text Name="GLAmount" Maxlength=12 size=12 class=number></td></tr>'; + echo '<tr><td>' . _('Amount') . ' (' . $_SESSION['PaymentDetail']->Currency . '):</td> + <td><input type=Text Name="GLAmount" Maxlength=12 size=12 class=number></td></tr>'; } echo '</table><br />'; echo '<div class="centre"><input type=submit name="Process" value="' . _('Accept') . '"><input type=submit name="Cancel" value="' . _('Cancel') . '"></div>'; if (sizeOf($_SESSION['PaymentDetail']->GLItems)>0) { - echo '<br /><table class=selection><tr> - <th>' . _('Cheque No').'</th> - <th>' . _('Amount') . ' (' . $_SESSION['PaymentDetail']->Currency . ')</th> - <th>' . _('GL Account') . '</th> - <th>' . _('Narrative') . '</th> - <th>' . _('Tag') . '</th> - </tr>'; + echo '<br /> + <table class=selection> + <tr> + <th>' . _('Cheque No').'</th> + <th>' . _('Amount') . ' (' . $_SESSION['PaymentDetail']->Currency . ')</th> + <th>' . _('GL Account') . '</th> + <th>' . _('Narrative') . '</th> + <th>' . _('Tag') . '</th> + </tr>'; $PaymentTotal = 0; foreach ($_SESSION['PaymentDetail']->GLItems as $PaymentItem) { Added: trunk/SecurityTokens.php =================================================================== --- trunk/SecurityTokens.php (rev 0) +++ trunk/SecurityTokens.php 2011-04-28 10:39:25 UTC (rev 4557) @@ -0,0 +1,86 @@ +<?php + +/* $Id$*/ +//$PageSecurity = 10; +include('includes/session.inc'); +$title = _('Maintain Security Tokens'); + +include('includes/header.inc'); + +if (isset($_GET['SelectedToken'])) { + $sql="SELECT tokenid, tokenname FROM securitytokens where tokenid='".$_GET['SelectedToken']."'"; + $result= DB_query($sql,$db); + $myrow = DB_fetch_array($result,$db); + $ref=$myrow[0]; + $description=$myrow[1]; +} else if (!isset($_POST['TokenID'])){ + $description=''; + $_POST['TokenID']=''; + $_GET['SelectedToken']=''; +} else { + $description=$_POST['Description']; +} + +if (isset($_POST['submit'])) { + $TestSQL="SELECT tokenid FROM securitytokens WHERE tokenid='".$_POST['TokenID']."'"; + $TestResult=DB_query($TestSQL, $db); + if (DB_num_rows($TestResult)==0) { + $sql = "INSERT INTO securitytokens values('".$_POST['TokenID']."', '".$_POST['Description']."')"; + $result= DB_query($sql,$db); + unset($description); + unset($_POST['TokenID']); + } else { + prnMsg( _('This token ID has already been used. Please use a new one') , 'warn'); + } +} + +if (isset($_POST['update'])) { + $sql = "UPDATE securitytokens SET tokenname='".$_POST['Description']. + "' WHERE tokenid='".$_POST['TokenID']."'"; + $result= DB_query($sql,$db); + unset($description); + unset($_POST['TokenID']); +} +echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/maintenance.png" title="' . + _('Print') . '" alt="" />' . ' ' . $title . '</p>'; + +echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '" name="form">'; +echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; +echo '<br><table><tr>'; + + + +if (isset($_GET['Action']) and $_GET['Action']=='edit') { + echo '<td>'. _('Description') . '</td> + <td><input type="text" size=30 maxlength=30 name="Description" value="'.$description.'"></td><td> + <input type="hidden" name="TokenID" value="'.$_GET['SelectedToken'].'">'; + echo '<input type=Submit name=update value=' . _('Update') . '>'; +} else { + echo '<td>'._('Token ID') . '<td><input type="text" name="TokenID" value="'.$_POST['TokenID'].'"></td></tr> + <tr><td>'. _('Description') . '</td><td><input type="text" size=30 maxlength=30 name="Description" value="'.$description.'"></td><td>'; + echo '<input type=Submit name=submit value=' . _('Insert') . '>'; +} + +echo '</td></tr></table><p></p>'; + +echo '</form>'; + +echo '<table class=selection>'; +echo '<tr><th>'. _('Token ID') .'</th>'; +echo '<th>'. _('Description'). '</th>'; + +$sql="SELECT tokenid, tokenname FROM securitytokens ORDER BY tokenid"; +$result= DB_query($sql,$db); + +while ($myrow = DB_fetch_array($result,$db)){ + echo '<tr><td>'.$myrow[0].'</td><td>'.$myrow[1].'</td><td><a href="' . + $_SERVER['PHP_SELF'] . '?SelectedToken=' . $myrow[0] . '&Action=edit">' . _('Edit') . '</a></td></tr>'; +} + +echo '</table><p></p>'; + +echo "<script>defaultControl(document.form.description);</script>"; + +include('includes/footer.inc'); + +?> \ No newline at end of file Modified: trunk/Suppliers.php =================================================================== --- trunk/Suppliers.php 2011-04-26 11:03:36 UTC (rev 4556) +++ trunk/Suppliers.php 2011-04-28 10:39:25 UTC (rev 4557) @@ -2,8 +2,6 @@ /* $Id$ */ -//$PageSecurity = 5; - include('includes/session.inc'); $title = _('Supplier Maintenance'); @@ -137,7 +135,7 @@ break; default: - echo _('The prefix') . ' - ' . $BankPrefix . ' ' . _('is not a valid New Zealand Bank') . '.<br>' . + echo _('The prefix') . ' - ' . $BankPrefix . ' ' . _('is not a valid New Zealand Bank') . '.<br />' . _('If you are using webERP outside New Zealand error trapping relevant to your country should be used'); return False; exit; @@ -301,8 +299,6 @@ unset($SupplierID); } -// This is aleady linked from this page -//echo "<a href='" . $rootpath . '/SelectSupplier.php?' . SID . "'>" . _('Back to Suppliers') . '</a><br>'; echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . _('Search') . '" alt="" />' . ' ' . _('Suppliers') . '</p>'; $InputError = 0; @@ -426,7 +422,7 @@ $longitude = $coordinatesSplit[0]; $status = $xml->Response->Status->code; - if (strcmp($status, "200") == 0) { + if (strcmp($status, '200') == 0) { // Successful geocode $geocode_pending = false; $coordinates = $xml->Response->Placemark->Point->coordinates; @@ -437,22 +433,22 @@ } else { // failure to geocode $geocode_pending = false; - echo '<p>Address: ' . $address . ' failed to geocode'."\n"; - echo 'Received status ' . $status . "\n" . '</p>'; + echo '<p>' . _('Address') . ': ' . $address . ' ' . _('failed to geocode') ."\n"; + echo _('Received status') . ' ' . $status . "\n" . '</p>'; } } } if (!isset($_POST['New'])) { $supptranssql = "SELECT supplierno - FROM supptrans - WHERE supplierno='".$SupplierID ."'"; + FROM supptrans + WHERE supplierno='".$SupplierID ."'"; $suppresult = DB_query($supptranssql, $db); $supptrans = DB_num_rows($suppresult); $suppcurrssql = "SELECT currcode - FROM suppliers - WHERE supplierid='".$SupplierID ."'"; + FROM suppliers + WHERE supplierid='".$SupplierID ."'"; $currresult = DB_query($suppcurrssql, $db); $suppcurr = DB_fetch_row($currresult); @@ -516,49 +512,49 @@ } else { //its a new supplier $sql = "INSERT INTO suppliers (supplierid, - suppname, - address1, - address2, - address3, - address4, - telephone, - fax, - email, - supptype, - currcode, - suppliersince, - paymentterms, - bankpartics, - bankref, - bankact, - remittance, - taxgroupid, - factorcompanyid, - lat, - lng, - taxref) - VALUES ('$SupplierID', - '" . $_POST['SuppName'] . "', - '" . $_POST['Address1'] . "', - '" . $_POST['Address2'] . "', - '" . $_POST['Address3'] . "', - '" . $_POST['Address4'] . "', - '".$_POST['Phone']."', - '".$_POST['Fax']."', - '".$_POST['Email']."', - '".$_POST['SupplierType']."', - '" . $_POST['CurrCode'] . "', - '" . $SQL_SupplierSince . "', - '" . $_POST['PaymentTerms'] . "', - '" . $_POST['BankPartics'] . "', - '" . $_POST['BankRef'] . "', - '" . $_POST['BankAct'] . "', - '" . $_POST['Remittance'] . "', - '" . $_POST['TaxGroup'] . "', - '" . $_POST['FactorID'] . "', - '" . $latitude ."', - '" . $longitude ."', - '" . $_POST['TaxRef'] . "')"; + suppname, + address1, + address2, + address3, + address4, + telephone, + fax, + email, + supptype, + currcode, + suppliersince, + paymentterms, + bankpartics, + bankref, + bankact, + remittance, + taxgroupid, + factorcompanyid, + lat, + lng, + taxref) + VALUES ('$SupplierID', + '" . $_POST['SuppName'] . "', + '" . $_POST['Address1'] . "', + '" . $_POST['Address2'] . "', + '" . $_POST['Address3'] . "', + '" . $_POST['Address4'] . "', + '".$_POST['Phone']."', + '".$_POST['Fax']."', + '".$_POST['Email']."', + '".$_POST['SupplierType']."', + '" . $_POST['CurrCode'] . "', + '" . $SQL_SupplierSince . "', + '" . $_POST['PaymentTerms'] . "', + '" . $_POST['BankPartics'] . "', + '" . $_POST['BankRef'] . "', + '" . $_POST['BankAct'] . "', + '" . $_POST['Remittance'] . "', + '" . $_POST['TaxGroup'] . "', + '" . $_POST['FactorID'] . "', + '" . $latitude ."', + '" . $longitude ."', + '" . $_POST['TaxRef'] . "')"; $ErrMsg = _('The supplier') . ' ' . $_POST['SuppName'] . ' ' . _('could not be added because'); $DbgMsg = _('The SQL that was used to insert the supplier but failed was'); @@ -610,7 +606,7 @@ if ($myrow[0] > 0) { $CancelDelete = 1; prnMsg(_('Cannot delete this supplier because there are transactions that refer to this supplier'),'warn'); - echo '<br>' . _('There are') . ' ' . $myrow[0] . ' ' . _('transactions against this supplier'); + echo '<br />' . _('There are') . ' ' . $myrow[0] . ' ' . _('transactions against this supplier'); } else { $sql= "SELECT COUNT(*) FROM purchorders WHERE supplierno='" . $SupplierID . "'"; @@ -619,7 +615,7 @@ if ($myrow[0] > 0) { $CancelDelete = 1; prnMsg(_('Cannot delete the supplier record because purchase orders have been created against this supplier'),'warn'); - echo '<br>' . _('There are') . ' ' . $myrow[0] . ' ' . _('orders against this supplier'); + echo '<br />' . _('There are') . ' ' . $myrow[0] . ' ' . _('orders against this supplier'); } else { $sql= "SELECT COUNT(*) FROM suppliercontacts WHERE supplierid='" . $SupplierID . "'"; $result = DB_query($sql, $db); @@ -627,7 +623,7 @@ if ($myrow[0] > 0) { $CancelDelete = 1; prnMsg(_('Cannot delete this supplier because there are supplier contacts set up against it') . ' - ' . _('delete these first'),'warn'); - echo '<br>' . _('There are') . ' ' . $myrow[0] . ' ' . _('supplier contacts relating to this supplier'); + echo '<br />' . _('There are') . ' ' . $myrow[0] . ' ' . _('supplier contacts relating to this supplier'); } } @@ -647,105 +643,140 @@ /*If the page was called without $SupplierID passed to page then assume a new supplier is to be entered show a form with a Supplier Code field other wise the form showing the fields with the existing entries against the supplier will show for editing with only a hidden SupplierID field*/ - 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'] . '" />'; - echo "<input type='hidden' name='New' VALUE='Yes'>"; + echo '<input type="hidden" name="New" value="Yes">'; echo '<table class=selection>'; - echo '<tr><td>' . _('Supplier Code') . ":</td><td><input type='text' name='SupplierID' size=11 maxlength=10></td></tr>"; - echo '<tr><td>' . _('Supplier Name') . ":</td><td><input type='text' name='SuppName' size=42 maxlength=40></td></tr>"; - echo '<tr><td>' . _('Address Line 1 (Street)') . ":</td><td><input type='text' name='Address1' size=42 maxlength=40></td></tr>"; - echo '<tr><td>' . _('Address Line 2 (Suburb/City)') . ":</td><td><input type='text' name='Address2' size=42 maxlength=40></td></tr>"; - echo '<tr><td>' . _('Address Line 3 (State/Province)') . ":</td><td><input type='text' name='Address3' size=42 maxlength=40></td></tr>"; - echo '<tr><td>' . _('Address Line 4 (Postal Code)') . ":</td><td><input type='text' name='Address4' size=42 maxlength=40></td></tr>"; - echo '<tr><td>' . _('Telephone') . ":</td><td><input type='text' name='Phone' size=30 maxlength=40></td></tr>"; - echo '<tr><td>' . _('Facsimile') . ":</td><td><input type='text' name='Fax' size=30 maxlength=40></td></tr>"; - echo '<tr><td>' . _('Email Address') . ":</td><td><input type='text' name='Email' size=30 maxlength=40></td></tr>"; - echo '<tr><td>' . _('Supplier Type') . ":</td><td><select name='SupplierType'>"; - $result=DB_query('SELECT typeid, typename FROM suppliertype', $db); + echo '<tr><td>' . _('Supplier Code') . ':</td> + <td><input type="text" name="SupplierID" size=11 maxlength=10></td> + </tr>'; + echo '<tr><td>' . _('Supplier Name') . ':</td> + <td><input type="text" name="SuppName" size=42 maxlength=40></td> + </tr>'; + echo '<tr><td>' . _('Address Line 1 (Street)') . ':</td> + <td><input type="text" name="Address1" size=42 maxlength=40></td> + </tr>'; + echo '<tr><td>' . _('Address Line 2 (Suburb/City)') . ':</td> + <td><input type="text" name="Address2" size=42 maxlength=40></td> + </tr>'; + echo '<tr><td>' . _('Address Line 3 (State/Province)') . ':</td> + <td><input type="text" name="Address3" size=42 maxlength=40></td> + </tr>'; + echo '<tr><td>' . _('Address Line 4 (Postal Code)') . ':</td> + <td><input type="text" name="Address4" size=42 maxlength=40></td> + </tr>'; + echo '<tr><td>' . _('Telephone') . ':</td> + <td><input type="text" name="Phone" size=30 maxlength=40></td> + </tr>'; + echo '<tr><td>' . _('Facsimile') . ':</td> + <td><input type="text" name="Fax" size=30 maxlength=40></td> + </tr>'; + echo '<tr><td>' . _('Email Address') . ':</td> + <td><input type="text" name="Email" size=30 maxlength=40></td> + </tr>'; + echo '<tr><td>' . _('Supplier Type') . ':</td> + <td><select name="SupplierType">'; + $result=DB_query("SELECT typeid, typename FROM suppliertype", $db); while ($myrow = DB_fetch_array($result)) { - echo "<option VALUE='". $myrow['typeid'] . "'>" . $myrow['typename']; + echo '<option value="' . $myrow['typeid'] . '">' . $myrow['typename'] .'</option>'; } //end while loop - echo "</select></td></tr>"; + echo '</select></td></tr>'; $DateString = Date($_SESSION['DefaultDateFormat']); - echo '<tr><td>' . _('Supplier Since') . ' (' . $_SESSION['DefaultDateFormat'] . "):</td><td><input type='text' class='date' alt='".$_SESSION['DefaultDateFormat']."' name='SupplierSince' VALUE=$DateString size=12 maxlength=10></td></tr>"; - echo '<tr><td>' . _('Bank Particulars') . ":</td><td><input type='text' name='BankPartics' size=13 maxlength=12></td></tr>"; - echo '<tr><td>' . _('Bank reference') . ":</td><td><input type='text' name='BankRef' VALUE=0 size=13 maxlength=12></td></tr>"; - echo '<tr><td>' . _('Bank Account No') . ":</td><td><input type='text' name='BankAct' size=31 maxlength=30></td></tr>"; + echo '<tr><td>' . _('Supplier Since') . ' (' . $_SESSION['DefaultDateFormat'] . '):</td> + <td><input type="text" class="date" alt="' .$_SESSION['DefaultDateFormat'] .'" name="SupplierSince" value="' . $DateString . '" size=12 maxlength=10></td> + </tr>'; + echo '<tr><td>' . _('Bank Particulars') . ':</td> + <td><input type="text" name="BankPartics" size=13 maxlength=12></td> + </tr>'; + echo '<tr><td>' . _('Bank reference') . ':</td> + <td><input type="text" name="BankRef" value=0 size=13 maxlength=12></td> + </tr>'; + echo '<tr><td>' . _('Bank Account No') . ':</td> + <td><input type="text" name="BankAct" size=31 maxlength=30></td></tr>'; - $result=DB_query('SELECT terms, termsindicator FROM paymentterms', $db); + $result=DB_query("SELECT terms, termsindicator FROM paymentterms", $db); - echo '<tr><td>' . _('Payment Terms') . ":</td><td><select name='PaymentTerms'>"; + echo '<tr><td>' . _('Payment Terms') . ':</td> + <td><select name="PaymentTerms">'; while ($myrow = DB_fetch_array($result)) { - echo "<option VALUE='". $myrow['termsindicator'] . "'>" . $myrow['terms']; + echo '<option value="'. $myrow['termsindicator'] . '">' . $myrow['terms'] .'</option>'; } //end while loop DB_data_seek($result, 0); echo '</select></td></tr>'; - $result=DB_query('SELECT id, coyname FROM factorcompanies', $db); + $result=DB_query("SELECT id, coyname FROM factorcompanies", $db); - echo '<tr><td>' . _('Factor Company') . ":</td><td><select name='FactorID'>"; - echo '<option VALUE=0>' . _('None'); + echo '<tr><td>' . _('Factor Company') . ':</td> + <td><select name="FactorID">'; + echo '<option value=0>' . _('None'); while ($myrow = DB_fetch_array($result)) { if (isset($_POST['FactorID']) and $_POST['FactorID'] == $myrow['id']){ - echo '<option selected VALUE=' . $myrow['id'] . '>' . $myrow['coyname']; + echo '<option selected value=' . $myrow['id'] . '>' . $myrow['coyname'] .'</option>'; } else { - echo '<option VALUE=' . $myrow['id'] . '>' . $myrow['coyname']; + echo '<option value=' . $myrow['id'] . '>' . $myrow['coyname'] .'</option>'; } } //end while loop DB_data_seek($result, 0); echo '</select></td></tr>'; - echo '<tr><td>' . _('Tax Reference') . ':</td><td><input type="text" name=2TaxRef" size=21 maxlength=20></td></tr>'; + echo '<tr><td>' . _('Tax Reference') . ':</td> + <td><input type="text" name="TaxRef" size=21 maxlength=20></td></tr>'; - $result=DB_query('SELECT currency, currabrev FROM currencies', $db); + $result=DB_query("SELECT currency, currabrev FROM currencies", $db); if (!isset($_POST['CurrCode'])){ - $CurrResult = DB_query('SELECT currencydefault FROM companies WHERE coycode=1', $db); + $CurrResult = DB_query("SELECT currencydefault FROM companies WHERE coycode=1", $db); $myrow = DB_fetch_row($CurrResult); $_POST['CurrCode'] = $myrow[0]; } - echo '<tr><td>' . _('Supplier Currency') . ':</td><td><select name="CurrCode">'; + echo '<tr><td>' . _('Supplier Currency') . ':</td> + <td><select name="CurrCode">'; while ($myrow = DB_fetch_array($result)) { if ($_POST['CurrCode'] == $myrow['currabrev']){ - echo '<option selected VALUE=' . $myrow['currabrev'] . '>' . $myrow['currency'] . '</option>'; + echo '<option selected value=' . $myrow['currabrev'] . '>' . $myrow['currency'] . '</option>'; } else { - echo '<option VALUE=' . $myrow['currabrev'] . '>' . $myrow['currency'] . '</option>'; + echo '<option value=' . $myrow['currabrev'] . '>' . $myrow['currency'] . '</option>'; } } //end while loop DB_data_seek($result, 0); - echo '</select></td></tr><tr><td>' . _('Remittance Advice') . ':</td><td><select name="Remittance">'; - echo '<option VALUE=0>' . _('Not Required') . '</option>'; - echo '<option VALUE=1>' . _('Required') . '</option>'; + echo '</select></td></tr> + <tr><td>' . _('Remittance Advice') . ':</td> + <td><select name="Remittance">'; + echo '<option value=0>' . _('Not Required') . '</option>'; + echo '<option value=1>' . _('Required') . '</option>'; echo '</select></td></tr>'; - echo '<tr><td>' . _('Tax Group') . ':</td><td><select name="TaxGroup">'; + echo '<tr><td>' . _('Tax Group') . ':</td> + <td><select name="TaxGroup">'; DB_data_seek($result, 0); - $sql = 'SELECT taxgroupid, taxgroupdescription FROM taxgroups'; + $sql = "SELECT taxgroupid, taxgroupdescription FROM taxgroups"; $result = DB_query($sql, $db); while ($myrow = DB_fetch_array($result)) { if (isset($_POST['TaxGroup']) and $_POST['TaxGroup'] == $myrow['taxgroupid']){ - echo '<option selected VALUE=' . $myrow['taxgroupid'] . '>' . $myrow['taxgroupdescription'] . '</option>'; + echo '<option selected value=' . $myrow['taxgroupid'] . '>' . $myrow['taxgroupdescription'] . '</option>'; } else { - echo '<option VALUE=' . $myrow['taxgroupid'] . '>' . $myrow['taxgroupdescription'] . '</option>'; + echo '<option value=' . $myrow['taxgroupid'] . '>' . $myrow['taxgroupdescription'] . '</option>'; } } //end while loop - echo '</select></td></tr></table><p><div class="centre"><input type="Submit" name="submit" VALUE="' . _('Insert New Supplier') . '">'; + echo '</select></td></tr> + </table> + <p><div class="centre"><input type="Submit" name="submit" value="' . _('Insert New Supplier') . '">'; echo '</div></form>'; } else { //SupplierID exists - either passed when calling the form or from the form itself - 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'] . '" />'; echo '<table class=selection>'; @@ -796,91 +827,112 @@ $_POST['FactorID'] = $myrow['factorcompanyid']; $_POST['TaxRef'] = $myrow['taxref']; - echo '<input type=hidden name="SupplierID" VALUE="' . $SupplierID . '">'; + echo '<input type=hidden name="SupplierID" value="' . $SupplierID . '">'; } else { // its a new supplier being added - echo '<input type=hidden name="New" VALUE="Yes">'; - echo '<tr><td>' . _('Supplier Code') . ':</td><td><input '.(in_array('ID',$Errors) ? 'class="inputerror"' : '').' type="text" name="SupplierID" VALUE="' . $SupplierID . '" size=12 maxlength=10></td></tr>'; + echo '<input type=hidden name="New" value="Yes">'; + echo '<tr><td>' . _('Supplier Code') . ':</td> + <td><input '.(in_array('ID',$Errors) ? 'class="inputerror"' : '').' type="text" name="SupplierID" value="' . $SupplierID . '" size=12 maxlength=10></td></tr>'; } - echo '<tr><td>' . _('Supplier Name') . ':</td><td><input '.(in_array('Name',$Errors) ? 'class="inputerror"' : '').' type="text" name="SuppName" VALUE="' . $_POST['SuppName'] . '" size=42 maxlength=40></td></tr>'; - echo '<tr><td>' . _('Address Line 1 (Street)') . ':</td><td><input type="text" name="Address1" VALUE="' . $_POST['Address1'] . '" size=42 maxlength=40></td></tr>'; - echo '<tr><td>' . _('Address Line 2 (Suburb/City)') . ':</td><td><input type="text" name="Address2" VALUE="' . $_POST['Address2'] . '" size=42 maxlength=40></td></tr>'; - echo '<tr><td>' . _('Address Line 3 (State/Province)') . ':</td><td><input type="text" name="Address3" VALUE="' . $_POST['Address3'] . '" size=42 maxlength=40></td></tr>'; - echo '<tr><td>' . _('Address Line 4 (Postal Code)') . ':</td><td><input type="text" name="Address4" VALUE="' . $_POST['Address4'] . '" size=42 maxlength=40></td></tr>'; - echo '<tr><td>' . _('Telephone') . ':</td><td><input '.(in_array('Name',$Errors) ? 'class="inputerror"' : '').' type="text" name="Phone" VALUE="' . $_POST['Phone'] . '" size=42 maxlength=40></td></tr>'; - echo '<tr><td>' . _('Facsimile') . ':</td><td><input '.(in_array('Name',$Errors) ? 'class="inputerror"' : '').' type="text" name="Fax" VALUE="' . $_POST['Fax'] . '" size=42 maxlength=40></td></tr>'; - echo '<tr><td>' . _('Email Address') . ':</td><td><input '.(in_array('Name',$Errors) ? 'class="inputerror"' : '').' type="text" name="Email" VALUE="' . $_POST['Email'] . '" size=42 maxlength=40></td></tr>'; - echo '<tr><td>' . _('Supplier Type') . ":</td><td><select name='SupplierType'>"; - $result=DB_query('SELECT typeid, typename FROM suppliertype', $db); + echo '<tr><td>' . _('Supplier Name') . ':</td> + <td><input '.(in_array('Name',$Errors) ? 'class="inputerror"' : '').' type="text" name="SuppName" value="' . $_POST['SuppName'] . '" size=42 maxlength=40></td></tr>'; + echo '<tr><td>' . _('Address Line 1 (Street)') . ':</td> + <td><input type="text" name="Address1" value="' . $_POST['Address1'] . '" size=42 maxlength=40></td></tr>'; + echo '<tr><td>' . _('Address Line 2 (Suburb/City)') . ':</td> + <td><input type="text" name="Address2" value="' . $_POST['Address2'] . '" size=42 maxlength=40></td></tr>'; + echo '<tr><td>' . _('Address Line 3 (State/Province)') . ':</td> + <td><input type="text" name="Address3" value="' . $_POST['Address3'] . '" size=42 maxlength=40></td></tr>'; + echo '<tr><td>' . _('Address Line 4 (Postal Code)') . ':</td> + <td><input type="text" name="Address4" value="' . $_POST['Address4'] . '" size=42 maxlength=40></td></tr>'; + echo '<tr><td>' . _('Telephone') . ':</td> + <td><input '.(in_array('Name',$Errors) ? 'class="inputerror"' : '').' type="text" name="Phone" value="' . $_POST['Phone'] . '" size=42 maxlength=40></td></tr>'; + echo '<tr><td>' . _('Facsimile') . ':</td> + <td><input '.(in_array('Name',$Errors) ? 'class="inputerror"' : '').' type="text" name="Fax" value="' . $_POST['Fax'] . '" size=42 maxlength=40></td></tr>'; + echo '<tr><td>' . _('Email Address') . ':</td> + <td><input '.(in_array('Name',$Errors) ? 'class="inputerror"' : '').' type="text" name="Email" value="' . $_POST['Email'] . '" size=42 maxlength=40></td></tr>'; + echo '<tr><td>' . _('Supplier Type') . ':</td> + <td><select name="SupplierType">'; + $result=DB_query("SELECT typeid, typename FROM suppliertype", $db); while ($myrow = DB_fetch_array($result)) { if ($_POST['SupplierType']==$myrow['typeid']) { - echo "<option selected value='". $myrow['typeid'] . "'>" . $myrow['typename']; + echo '<option selected value="'. $myrow['typeid'] . '">' . $myrow['typename'] .'</option>'; } else { - echo "<option value='". $myrow['typeid'] . "'>" . $myrow['typename']; + echo '<option value="' . $myrow['typeid'] . '">' . $myrow['typename'] .'</option>'; } } //end while loop - echo "</select></td></tr>"; + echo '</select></td></tr>'; - echo '<tr><td>' . _('Supplier Since') . ' (' . $_SESSION['DefaultDateFormat'] .'):</td><td><input '.(in_array('SupplierSince',$Errors) ? 'class="inputerror"' : '').' size=12 maxlength=10 type="text" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" name="SupplierSince" VALUE=' . $_POST['SupplierSince'] . '></td></tr>'; - echo '<tr><td>' . _('Bank Particulars') . ":</td><td><input type='text' name='BankPartics' size=13 maxlength=12 VALUE='" . $_POST['BankPartics'] . "'></td></tr>"; - echo '<tr><td>' . _('Bank Reference') . ':</td><td><input '.(in_array('BankRef',$Errors) ? 'class="inputerror"' : '').' type="text" name="BankRef" size=13 maxlength=12 VALUE="' . $_POST['BankRef'] . '"></td></tr>'; - echo '<tr><td>' . _('Bank Account No') . ":</td><td><input type='text' name='BankAct' size=31 maxlength=30 VALUE='" . $_POST['BankAct'] . "'></td></tr>"; + echo '<tr><td>' . _('Supplier Since') . ' (' . $_SESSION['DefaultDateFormat'] .'):</td> + <td><input '.(in_array('SupplierSince',$Errors) ? 'class="inputerror"' : '').' size=12 maxlength=10 type="text" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" name="SupplierSince" value=' . $_POST['SupplierSince'] . '></td></tr>'; + echo '<tr><td>' . _('Bank Particulars') . ':</td> + <td><input type="text" name="BankPartics" size=13 maxlength=12 value="' . $_POST['BankPartics'] . '"></td></tr>'; + echo '<tr><td>' . _('Bank Reference') . ':</td> + <td><input '.(in_array('BankRef',$Errors) ? 'class="inputerror"' : '').' type="text" name="BankRef" size=13 maxlength=12 value="' . $_POST['BankRef'] . '"></td></tr>'; + echo '<tr><td>' . _('Bank Account No') . ':</td> + <td><input type="text" name="BankAct" size=31 maxlength=30 value="' . $_POST['BankAct'] . '"></td></tr>'; - $result=DB_query('SELECT terms, termsindicator FROM paymentterms', $db); + $result=DB_query("SELECT terms, termsindicator FROM paymentterms", $db); - echo '<tr><td>' . _('Payment Terms') . ":</td><td><select name='PaymentTerms'>"; + echo '<tr><td>' . _('Payment Terms') . ':</td> + <td><select name="PaymentTerms">'; while ($myrow = DB_fetch_array($result)) { if ($_POST['PaymentTerms'] == $myrow['termsindicator']){ - echo '<option selected VALUE=' . $myrow['termsindicator'] . '>' . $myrow['terms']; + echo '<option selected value=' . $myrow['termsindicator'] . '>' . $myrow['terms'] .'</option>'; } else { - echo '<option VALUE=' . $myrow['termsindicator'] . '>' . $myrow['terms']; + echo '<option value=' . $myrow['termsindicator'] . '>' . $myrow['terms'] .'</option>'; } } //end while loop DB_data_seek($result, 0); - $result=DB_query('SELECT id, coyname FROM factorcompanies', $db); + $result=DB_query("SELECT id, coyname FROM factorcompanies", $db); - echo '<tr><td>' . _('Factor Company') . ":</td><td><select name='FactorID'>"; - echo '<option VALUE=0>' . _('None'); + echo '<tr><td>' . _('Factor Company') . ':</td> + <td><select name="FactorID">'; + echo '<option value=0>' . _('None'); while ($myrow = DB_fetch_array($result)) { if ($_POST['FactorID'] == $myrow['id']){ - echo '<option selected VALUE=' . $myrow['id'] . '>' . $myrow['coyname']; + echo '<option selected value=' . $myrow['id'] . '>' . $myrow['coyname'] .'</option>'; } else { - echo '<option VALUE=' . $myrow['id'] . '>' . $myrow['coyname']; + echo '<option value=' . $myrow['id'] . '>' . $myrow['coyname'] .'</option>'; } } //end while loop DB_data_seek($result, 0); - echo '<tr><td>' . _('Tax Reference') . ":</td><td><input type='text' name='TaxRef' size=21 maxlength=20 VALUE='".$_POST['TaxRef']."'></td></tr>"; + echo '<tr><td>' . _('Tax Reference') . ':</td> + <td><input type="text" name="TaxRef" size=21 maxlength=20 value="' . $_POST['TaxRef'] .'"></td></tr>'; - $result=DB_query('SELECT currency, currabrev FROM currencies', $db); + $result=DB_query("SELECT currency, currabrev FROM currencies", $db); - echo '</select></td></tr><tr><td>' . _('Supplier Currency') . ":</td><td><select name='CurrCode'>"; + echo '</select></td></tr><tr><td>' . _('Supplier Currency') . ':</td> + <td><select name="CurrCode">'; while ($myrow = DB_fetch_array($result)) { if ($_POST['CurrCode'] == $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 DB_data_seek($result, 0); - echo '</select></td></tr><tr><td>' . _('Remittance Advice') . ":</td><td><select name='Remittance'>"; + echo '</select></td></tr> + <tr><td>' . _('Remittance Advice') . ':</td> + <td><select name="Remittance">'; if ($_POST['Remittance'] == 0){ - echo '<option selected VALUE=0>' . _('Not Required'); - echo '<option VALUE=1>' . _('Required'); + echo '<option selected value=0>' . _('Not Required') .'</option>'; + echo '<option value=1>' . _('Required') .'</option>'; } else { - echo '<option VALUE=0>' . _('Not Required'); - echo '<option selected VALUE=1>' . _('Required'); + echo '<option value=0>' . _('Not Required') .'</option>'; + echo '<option selected value=1>' . _('Required') .'</option>'; } echo '</select></td></tr>'; - echo '<tr><td>' . _('Tax Group') . ":</td><td><select name='TaxGroup'>"; + echo '<tr><td>' . _('Tax Group') . ':</td> + <td><select name="TaxGroup">'; DB_data_seek($result, 0); @@ -889,9 +941,9 @@ while ($myrow = DB_fetch_array($result)) { if ($myrow['taxgroupid'] == $_POST['TaxGroup']) { - echo '<option selected VALUE="'.$myrow['taxgroupid'] . '">' . $myrow['taxgroupdescription'] . '</option>'; + echo '<option selected value="'.$myrow['taxgroupid'] . '">' . $myrow['taxgroupdescription'] . '</option>'; } else { - echo '<option VALUE="' . $myrow['taxgroupid'] . '">' . $myrow['taxgroupdescription'] . '</option>'; + echo '<option value="' . $myrow['taxgroupid'] . '">' . $myrow['taxgroupdescription'] . '</option>'; } } //end while loop @@ -899,13 +951,13 @@ echo '</select></td></tr></table>'; if (isset($_POST['New'])) { - echo '<p><div class="centre"><input type="Submit" name="submit" VALUE="' . _('Add These New Supplier Details') . '"></form>'; + echo '<p><div class="centre"><input type="Submit" name="submit" value="' . _('Add These New Supplier Details') . '"></form>'; } else { - echo '<br><p><div class="centre"><input type="Submit" name="submit" VALUE="' . _('Update Supplier') . '"></div><br>'; -// echo '<p><font color=red><b>' . _('WARNING') . ': ' . _('There is no second warning if you hit the delete button below') . '. ' . _('However checks will be made to ensure there are no outstanding purchase orders or existing accounts payable transactions before the deletion is processed') . '<br></font></b>'; + echo '<br /><p><div class="centre"><input type="Submit" name="submit" value="' . _('Update Supplier') . '"></div><br />'; +// echo '<p><font color=red><b>' . _('WARNING') . ': ' . _('There is no second warning if you hit the delete button below') . '. ' . _('However checks will be made to ensure there are no outstanding purchase orders or existing accounts payable transactions before the deletion is processed') . '<br /></font></b>'; prnMsg(_('WARNING') . ': ' . _('There is no second warning if you hit the delete button below') . '. ' . _('However checks will be made to ensure there are no outstanding purchase orders or existing accounts payable transactions before the deletion is processed'), 'Warn'); - echo '<br><div class=centre><input type="submit" name="delete" VALUE="' . _('Delete Supplier') . '" onclick=\"return confirm(\'' . _('Are you sure you wish to delete this supplier?') . '\');\"></form>'; - echo '<br><a href="' . $rootpath . '/SupplierContacts.php?SupplierID=' . $SupplierID . '">' . _('Review Contact Details') . '</a></div>'; + echo '<br /><div class=centre><input type="submit" name="delete" value="' . _('Delete Supplier') . '" onclick=\"return confirm(\'' . _('Are you sure you wish to delete this supplier?') . '\');\"></form>'; + echo '<br /><a href="' . $rootpath . '/SupplierContacts.php?SupplierID=' . $SupplierID . '">' . _('Review Contact Details') . '</a></div>'; } echo '</div>'; } // end of main ifs Modified: trunk/UpgradeDatabase.php =================================================================== --- trunk/UpgradeDatabase.php 2011-04-26 11:03:36 UTC (r... [truncated message content] |
From: <dai...@us...> - 2011-04-29 12:43:29
|
Revision: 4558 http://web-erp.svn.sourceforge.net/web-erp/?rev=4558&view=rev Author: daintree Date: 2011-04-29 12:43:19 +0000 (Fri, 29 Apr 2011) Log Message: ----------- quoting Modified Paths: -------------- trunk/PO_Header.php trunk/SpecialOrder.php trunk/StockCostUpdate.php trunk/StockLocMovements.php trunk/StockLocStatus.php trunk/StockMovements.php trunk/StockQuantityByDate.php trunk/includes/GetConfig.php trunk/locale/cs_CZ.utf8/LC_MESSAGES/messages.mo trunk/locale/cs_CZ.utf8/LC_MESSAGES/messages.po trunk/locale/de_DE.utf8/LC_MESSAGES/messages.mo trunk/locale/de_DE.utf8/LC_MESSAGES/messages.po trunk/locale/el_GR.utf8/LC_MESSAGES/messages.mo trunk/locale/el_GR.utf8/LC_MESSAGES/messages.po trunk/locale/en_GB.utf8/LC_MESSAGES/messages.pot trunk/locale/en_US.utf8/LC_MESSAGES/messages.mo trunk/locale/en_US.utf8/LC_MESSAGES/messages.po trunk/locale/es_ES.utf8/LC_MESSAGES/messages.mo trunk/locale/es_ES.utf8/LC_MESSAGES/messages.po trunk/locale/et_EE.utf8/LC_MESSAGES/messages.mo trunk/locale/et_EE.utf8/LC_MESSAGES/messages.po trunk/locale/fa_IR.utf8/LC_MESSAGES/messages.mo trunk/locale/fa_IR.utf8/LC_MESSAGES/messages.po trunk/locale/fr_FR.utf8/LC_MESSAGES/messages.mo trunk/locale/fr_FR.utf8/LC_MESSAGES/messages.po trunk/locale/hi_IN.utf8/LC_MESSAGES/messages.mo trunk/locale/hi_IN.utf8/LC_MESSAGES/messages.po trunk/locale/hr_HR.utf8/LC_MESSAGES/messages.mo trunk/locale/hr_HR.utf8/LC_MESSAGES/messages.po trunk/locale/hu_HU.utf8/LC_MESSAGES/messages.mo trunk/locale/hu_HU.utf8/LC_MESSAGES/messages.po trunk/locale/id_ID.utf8/LC_MESSAGES/messages.mo trunk/locale/id_ID.utf8/LC_MESSAGES/messages.po trunk/locale/it_IT.utf8/LC_MESSAGES/messages.mo trunk/locale/it_IT.utf8/LC_MESSAGES/messages.po trunk/locale/ja_JP.utf8/LC_MESSAGES/messages.mo trunk/locale/ja_JP.utf8/LC_MESSAGES/messages.po trunk/locale/lv_LV.utf8/LC_MESSAGES/messages.mo trunk/locale/lv_LV.utf8/LC_MESSAGES/messages.po trunk/locale/nl_NL.utf8/LC_MESSAGES/messages.mo trunk/locale/nl_NL.utf8/LC_MESSAGES/messages.po trunk/locale/pl_PL.utf8/LC_MESSAGES/messages.mo trunk/locale/pl_PL.utf8/LC_MESSAGES/messages.po trunk/locale/pt_BR.utf8/LC_MESSAGES/messages.mo trunk/locale/pt_BR.utf8/LC_MESSAGES/messages.po trunk/locale/pt_PT.utf8/LC_MESSAGES/messages.mo trunk/locale/pt_PT.utf8/LC_MESSAGES/messages.po trunk/locale/ro_RO.utf8/LC_MESSAGES/messages.mo trunk/locale/ro_RO.utf8/LC_MESSAGES/messages.po trunk/locale/ru_RU.utf8/LC_MESSAGES/messages.mo trunk/locale/ru_RU.utf8/LC_MESSAGES/messages.po trunk/locale/sq_AL.utf8/LC_MESSAGES/messages.mo trunk/locale/sq_AL.utf8/LC_MESSAGES/messages.po trunk/locale/sv_SE.utf8/LC_MESSAGES/messages.mo trunk/locale/sv_SE.utf8/LC_MESSAGES/messages.po trunk/locale/sw_KE.utf8/LC_MESSAGES/messages.mo trunk/locale/sw_KE.utf8/LC_MESSAGES/messages.po trunk/locale/tr_TR.utf8/LC_MESSAGES/messages.mo trunk/locale/tr_TR.utf8/LC_MESSAGES/messages.po trunk/locale/vi_VN.utf8/LC_MESSAGES/messages.mo trunk/locale/vi_VN.utf8/LC_MESSAGES/messages.po trunk/locale/zh_CN.utf8/LC_MESSAGES/messages.mo trunk/locale/zh_CN.utf8/LC_MESSAGES/messages.po trunk/locale/zh_HK.utf8/LC_MESSAGES/messages.mo trunk/locale/zh_HK.utf8/LC_MESSAGES/messages.po trunk/sql/mysql/weberp-demo.sql trunk/sql/mysql/weberp-new.sql Modified: trunk/PO_Header.php =================================================================== --- trunk/PO_Header.php 2011-04-28 10:39:25 UTC (rev 4557) +++ trunk/PO_Header.php 2011-04-29 12:43:19 UTC (rev 4558) @@ -805,7 +805,7 @@ echo '</select></td></tr>'; echo '<tr><td>' . _('Status Comment') . ':</td> - <td><input type=text name="StatusComments" size=50></td></tr> + <td><input type=text name="StatusComments" size=50></td></tr> <tr><td colspan=2><b>' . $_SESSION['PO'.$identifier]->StatusComments .'</b></td></tr>'; //need to use single quotes as double quotes inside the string of StatusComments echo '<input type="hidden" name="StatusCommentsComplete" value="' . $_SESSION['PO'.$identifier]->StatusComments .'">'; Modified: trunk/SpecialOrder.php =================================================================== --- trunk/SpecialOrder.php 2011-04-28 10:39:25 UTC (rev 4557) +++ trunk/SpecialOrder.php 2011-04-29 12:43:19 UTC (rev 4558) @@ -2,8 +2,6 @@ /* $Id$ */ -//$PageSecurity = 4; - include('includes/DefineSpecialOrderClass.php'); /* Session started in header.inc for password checking and authorisation level check */ include('includes/session.inc'); @@ -13,7 +11,7 @@ include('includes/header.inc'); -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'] . '" />'; @@ -22,15 +20,15 @@ } if (!isset($_SESSION['SupplierID'])){ - echo '<br><br>'; + echo '<br /><br />'; prnMsg(_('To set up a special') . ', ' . _('the supplier must first be selected from the Select Supplier page'),'info'); - echo "<br><a href='$rootpath/SelectSupplier.php?" . SID . "'>" . _('Select the supplier now') . "</a>"; + echo '<br /><a href="' . $rootpath . '/SelectSupplier.php">' . _('Select the supplier now') . '</a>'; include('includes/footer.inc'); exit; } if (!isset($_SESSION['CustomerID']) OR $_SESSION['CustomerID']==""){ - echo "<br><br>" . _('To set up a special') . ', ' . _('the customer must first be selected from the Select Customer page') . "<br><a href='$rootpath/SelectCustomer.php?" . SID . "'>" . _('Select the customer now') . "</a>"; + echo '<br /><br />' . _('To set up a special') . ', ' . _('the customer must first be selected from the Select Customer page') . '<br /><a href="' . $rootpath . '/SelectCustomer.php">' . _('Select the customer now') . '</a>'; include('includes/footer.inc'); exit; } @@ -110,9 +108,9 @@ } echo '<div class="centre">'; if (!isset($_SESSION['SPL']->BranchCode)){ - echo "<br><font size=4 color=BLUE>" . _('Purchase from') . " " . $_SESSION['SPL']->SupplierName . " " . _('in') . " " . $_SESSION['SPL']->SuppCurrCode . " " . _('for') . " " . $_SESSION['SPL']->CustomerName . " (" . $_SESSION['SPL']->CustCurrCode . ")"; + echo '<br /><font size=4 color=blue>' . _('Purchase from') . ' ' . $_SESSION['SPL']->SupplierName . ' ' . _('in') . ' ' . $_SESSION['SPL']->SuppCurrCode . ' ' . _('for') . ' ' . $_SESSION['SPL']->CustomerName . ' (' . $_SESSION['SPL']->CustCurrCode . ')'; } else { - echo '<br><font size=4 color=BLUE>' . _('Purchase from') . ' ' . $_SESSION['SPL']->SupplierName . ' ' . _('in') . ' ' . $_SESSION['SPL']->SuppCurrCode . ' ' . _('for') . ' ' . $_SESSION['SPL']->CustomerName . ' (' . $_SESSION['SPL']->CustCurrCode . ') - ' . _('delivered to') . ' ' . $_SESSION['SPL']->BranchName . ' ' . _('branch'); + echo '<br /><font size=4 color=BLUE>' . _('Purchase from') . ' ' . $_SESSION['SPL']->SupplierName . ' ' . _('in') . ' ' . $_SESSION['SPL']->SuppCurrCode . ' ' . _('for') . ' ' . $_SESSION['SPL']->CustomerName . ' (' . $_SESSION['SPL']->CustCurrCode . ') - ' . _('delivered to') . ' ' . $_SESSION['SPL']->BranchName . ' ' . _('branch'); } echo '</div></font>'; /*if the branch details and delivery details have not been entered then select them from the list */ @@ -127,12 +125,13 @@ If (DB_num_rows($BranchResult)>0) { echo '<div class="centre">'; - echo '<br><br>' . _('Select the customer branch to deliver the special to from the list below'); + echo '<br /><br />' . _('Select the customer branch to deliver the special to from the list below'); - echo '</div><br><table cellpadding=3 colspan=2 BORDER=1>'; + echo '</div><br /><table cellpadding=3 colspan=2 BORDER=1>'; - $tableheader = "<tr><th>" ._('Code') . "</th> - <th>" . _('Branch Name') . "</th></tr>"; + $tableheader = '<tr><th>' ._('Code') . '</th> + <th>' . _('Branch Name') . '</th> + </tr>'; echo $tableheader; $j = 1; @@ -148,7 +147,11 @@ $k++; } - printf("<td><input type=submit name='SelectBranch' VALUE='%s'</td><td>%s</td></tr>", $myrow['branchcode'], $myrow['brname']); + printf('<td><input type="submit" name="SelectBranch" value="%s"</td> + <td>%s</td> + </tr>', + $myrow['branchcode'], + $myrow['brname']); //end of page full new headings if } @@ -189,32 +192,32 @@ if (!is_numeric($_POST['Qty'])){ $AllowAdd = False; - prnMsg( _('Cannot Enter this order line') . '<br>' . _('The quantity of the order item must be numeric'),'warn'); + prnMsg( _('Cannot Enter this order line') . '<br />' . _('The quantity of the order item must be numeric'),'warn'); } if ($_POST['Qty']<0){ $AllowAdd = False; - prnMsg( _('Cannot Enter this order line') . '<br>' . _('The quantity of the ordered item entered must be a positive amount'),'warn'); + prnMsg( _('Cannot Enter this order line') . '<br />' . _('The quantity of the ordered item entered must be a positive amount'),'warn'); } if (!is_numeric($_POST['Price'])){ $AllowAdd = False; - prnMsg( _('Cannot Enter this order line') . '<br>' . _('The price entered must be numeric'),'warn'); + prnMsg( _('Cannot Enter this order line') . '<br />' . _('The price entered must be numeric'),'warn'); } if (!is_numeric($_POST['Cost'])){ $AllowAdd = False; - prnMsg( _('Cannot Enter this order line') . '<br>' . _('The cost entered must be numeric'),'warn'); + prnMsg( _('Cannot Enter this order line') . '<br />' . _('The cost entered must be numeric'),'warn'); } if ((($_POST['Price']/$_SESSION['SPL']->CustCurrExRate)-($_POST['Cost']/$_SESSION['SPL']->SuppCurrExRate))<0){ $AllowAdd = False; - prnMsg( _('Cannot Enter this order line') . '<br>' . _('The sale is at a lower price than the cost'),'warn'); + prnMsg( _('Cannot Enter this order line') . '<br />' . _('The sale is at a lower price than the cost'),'warn'); } if (!Is_Date($_POST['ReqDelDate'])){ $AllowAdd = False; - prnMsg( _('Cannot Enter this order line') . '<br>' . _('The date entered must be in the format') . ' ' . $_SESSION['DefaultDateFormat'],'warn'); + prnMsg( _('Cannot Enter this order line') . '<br />' . _('The date entered must be in the format') . ' ' . $_SESSION['DefaultDateFormat'],'warn'); } If ($AllowAdd == True){ @@ -292,7 +295,7 @@ $sql = $sql . "'" . $_SESSION['SPL']->SupplierID . "', '" . $_SESSION['SPL']->Comments . "', - '" . Date("Y-m-d") . "', + '" . Date('Y-m-d') . "', '" . $_SESSION['SPL']->SuppCurrExRate . "', '" . $_SESSION['SPL']->Initiator . "', '" . $_SESSION['SPL']->QuotationRef . "', @@ -307,11 +310,9 @@ $ErrMsg = _('The purchase order header record could not be inserted into the database because'); - $DbgMsg = _('The SQL statement used to insert the purchase order header record and failed was') . "<br>$sql"; + $DbgMsg = _('The SQL statement used to insert the purchase order header record and failed was') . '<br />' . $sql; $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - /*Get the auto increment value of the order number created from the SQL above */ -// $_SESSION['SPL']->PurchOrderNo = DB_Last_Insert_ID($db,'purchorders','orderno'); $_SESSION['SPL']->PurchOrderNo = GetNextTransNo(18, $db); @@ -355,7 +356,7 @@ $ErrMsg = _('The item record for line') . " " . $SPLLine->LineNo . " " . _('could not be create because'); - $DbgMsg = _('The SQL statement used to insert the item and failed was') . "<br>$sql"; + $DbgMsg = _('The SQL statement used to insert the item and failed was') . "<br />$sql"; $result =DB_query($sql,$db,$ErrMsg,$DbgMsg,true); @@ -397,8 +398,8 @@ } /* end of the loop round the detail line items on the order */ - echo '<br><br>' . _('Purchase Order') . ' ' . $_SESSION['SPL']->PurchOrderNo . ' ' . _('on') . ' ' . $_SESSION['SPL']->SupplierName . ' ' . _('has been created'); - echo "<br><a href='$rootpath/PO_PDFPurchOrder.php?" . SID . '&OrderNo=' . $_SESSION['SPL']->PurchOrderNo . "'>" . _('Print Purchase Order') . '</a>'; + echo '<br /><br />' . _('Purchase Order') . ' ' . $_SESSION['SPL']->PurchOrderNo . ' ' . _('on') . ' ' . $_SESSION['SPL']->SupplierName . ' ' . _('has been created'); + echo '<br /><a href="' . $rootpath . '/PO_PDFPurchOrder.php?OrderNo=' . $_SESSION['SPL']->PurchOrderNo . '">' . _('Print Purchase Order') . '</a>'; /*Now insert the sales order too */ @@ -448,7 +449,7 @@ '" . $_SESSION['SPL']->CustomerID . "', '" . $_SESSION['SPL']->BranchCode . "', '" . $_SESSION['SPL']->CustRef ."', - '" . Date("Y-m-d") . "', + '" . Date('Y-m-d') . "', '" . $BranchDetails['salestype'] . "', '" . $BranchDetails['defaultshipvia'] ."', '" . $BranchDetails['brname'] . "', @@ -466,9 +467,6 @@ $ErrMsg = _('The sales order cannot be added because'); $InsertQryResult = DB_query($HeaderSQL,$db,$ErrMsg, $DbMsg); -// $SalesOrderNo = DB_Last_Insert_ID($db,'salesorders','orderno'); -// $SalesOrderNo = GetNextTransNo(30, $db); - $StartOf_LineItemsSQL = "INSERT INTO salesorderdetails (orderno, stkcode, unitprice, @@ -486,20 +484,20 @@ } /* inserted line items into sales order details */ unset ($_SESSION['SPL']); - prnMsg(_('Sales Order Number') . ' ' . $SalesOrderNo . ' ' . _('has been entered') . '. <p>' . _('Orders created on a cash sales account may need the delivery details for the order to be modified') . '. <br><br>' . _('A freight charge may also be applicable'),'success'); + prnMsg(_('Sales Order Number') . ' ' . $SalesOrderNo . ' ' . _('has been entered') . '. <p>' . _('Orders created on a cash sales account may need the delivery details for the order to be modified') . '. <br /><br />' . _('A freight charge may also be applicable'),'success'); if (count($_SESSION['AllowedPageSecurityTokens'])>1){ /* Only allow print of packing slip for internal staff - customer logon's cannot go here */ - echo "<p><a href='$rootpath/PrintCustOrder.php?" . SID . "&TransNo=" . $SalesOrderNo . "'>" . _('Print packing slip') . ' (' . _('Preprinted stationery') . ')</a>'; - echo "<p><a href='$rootpath/PrintCustOrder_generic.php?" . SID . '&TransNo=' . $SalesOrderNo . "'>" . _('Print packing slip') . ' (' . _('Laser') . ')</a>'; + echo '<p><a href="' . $rootpath . '/PrintCustOrder.php?TransNo=' . $SalesOrderNo . '">' . _('Print packing slip') . ' (' . _('Preprinted stationery') . ')</a>'; + echo '<p><a href="' . $rootpath . '/PrintCustOrder_generic.php?TransNo=' . $SalesOrderNo . '">' . _('Print packing slip') . ' (' . _('Laser') . ')</a>'; } $Result = DB_Txn_Commit($db); unset($_SESSION['SPL']); /*Clear the PO data to allow a newy to be input*/ - echo "<br><br><a href='$rootpath/SpecialOrder.php?" . SID . "'>" . _('Enter A New Special Order') . "</a>"; + echo '<br /><br /><a href="' . $rootpath . '/SpecialOrder.php">' . _('Enter A New Special Order') . '</a>'; exit; } /*end if there were no input errors trapped */ } /* end of the code to do transfer the SPL object to the database - user hit the place Order*/ @@ -507,56 +505,49 @@ /*Show the header information for modification */ -echo "<table><tr><td>" . _('Receive Purchase Into and Sell From') . ": <select name='StkLocation'>"; +echo '<table><tr><td>' . _('Receive Purchase Into and Sell From') . ': <select name="StkLocation">'; $sql = "SELECT loccode, locationname FROM locations"; $LocnResult = DB_query($sql,$db); -if (!isset($_SESSION['SPL']->StkLocation) OR $_SESSION['SPL']->StkLocation==""){ /*If this is the first time the form loaded set up defaults */ +if (!isset($_SESSION['SPL']->StkLocation) OR $_SESSION['SPL']->StkLocation==''){ /*If this is the first time the form loaded set up defaults */ $_SESSION['SPL']->StkLocation = $_SESSION['UserStockLocation']; } while ($LocnRow=DB_fetch_array($LocnResult)){ if ($_SESSION['SPL']->StkLocation == $LocnRow['loccode']){ - echo "<option selected Value='" . $LocnRow['loccode'] . "'>" . $LocnRow['locationname']; + echo '<option selected value="' . $LocnRow['loccode'] . '">' . $LocnRow['locationname'] . '</option>'; } else { - echo "<option Value='" . $LocnRow['loccode'] . "'>" . $LocnRow['locationname']; + echo '<option Value="' . $LocnRow['loccode'] . '">' . $LocnRow['locationname'] . '</option>'; } } -echo "</select></td>"; +echo '</select></td>'; -echo "<td>" . _('Initiated By') . ": <input type=TEXT name='Initiator' size=11 maxlength=10 VALUE=" . $_SESSION['SPL']->Initiator . "></td>"; -echo "<td>" . _('Special Ref') . ": <input type=TEXT name='QuotationRef' size=16 maxlength=15 VALUE=" . $_SESSION['SPL']->QuotationRef . "></td>"; -echo "<td>" . _('Customer Ref') . ": <input type=TEXT name='CustRef' size=11 maxlength=10 VALUE=" . $_SESSION['SPL']->CustRef . "></td></tr>"; +echo '<td>' . _('Initiated By') . ': <input type="text" name="Initiator" size=11 maxlength=10 value="' . $_SESSION['SPL']->Initiator . '"></td> + <td>' . _('Special Ref') . ': <input type="text" name="QuotationRef" size=16 maxlength=15 value="' . $_SESSION['SPL']->QuotationRef . '"></td> + <td>' . _('Customer Ref') . ': <input type="text" name="CustRef" size=11 maxlength=10 value="' . $_SESSION['SPL']->CustRef . '"></td></tr> + <tr><td valign=top colspan=2>' . _('Comments') . ': <textarea name="Comments" cols=70 rows=2>' . $_SESSION['SPL']->Comments . '</textarea></td></tr> +</table> +<hr>'; /* Rule off the header */ -echo "<tr><td VALIGN=TOP colspan=2>" . _('Comments') . ":"; -echo "<textarea name='Comments' cols=70 rows=2>" . $_SESSION['SPL']->Comments . "</textarea></td></tr></table>"; - -echo "<hr>"; /* Rule off the header */ - /*Now show the order so far */ if (count($_SESSION['SPL']->LineItems)>0){ - echo "<div class='centre'>><b>" . _('Special Order Summary') . "</b></div>"; - echo "<table cellpadding=2 colspan=7 border=1>"; + echo '<div class="centre">><b>' . _('Special Order Summary') . '</b></div>'; + echo '<table cellpadding=2 colspan=7 border=1>'; - $sql = 'select currencydefault from companies'; - $result = DB_query($sql, $db); - $myrow = DB_fetch_row($result); - $DefaultCurrency = $myrow[0]; + echo '<tr> + <th>' . _('Item Description') . '</th> + <th>' . _('Delivery') . '</th> + <th>' . _('Quantity') . '</th> + <th>' . _('Purchase Cost') . '<br />' . $_SESSION['SPL']->SuppCurrCode . '</th> + <th>' . _('Sell Price') . '<br />' . $_SESSION['SPL']->CustCurrCode . '</th> + <th>' . _('Total Cost') . '<br />' . $_SESSION['SPL']->SuppCurrCode . '</th> + <th>' . _('Total Price') . '<br />' . $_SESSION['SPL']->CustCurrCode . '</th> + <th>' . _('Total Cost') . '<br />' . $_SESSION['CompanyRecord']['currencydefault'] . '</th> + <th>' . _('Total Price') . '<br />' . $_SESSION['CompanyRecord']['currencydefault'] . '</th> + </tr>'; - echo "<tr> - <th>" . _('Item Description') . "</th> - <th>" . _('Delivery') . "</th> - <th>" . _('Quantity') . "</th> - <th>" . _('Purchase Cost') . '<br>' . $_SESSION['SPL']->SuppCurrCode . "</th> - <th>" . _('Sell Price') . '<br>' . $_SESSION['SPL']->CustCurrCode . "</th> - <th>" . _('Total Cost') . '<br>' . $_SESSION['SPL']->SuppCurrCode . "</th> - <th>" . _('Total Price') . '<br>' . $_SESSION['SPL']->CustCurrCode . "</th> - <th>" . _('Total Cost') . '<br>' . $DefaultCurrency . "</th> - <th>" . _('Total Price') . '<br>' . $DefaultCurrency . "</th> - </tr>"; - $_SESSION['SPL']->total = 0; $k = 0; //row colour counter foreach ($_SESSION['SPL']->LineItems as $SPLLine) { @@ -579,38 +570,41 @@ $k=1; } echo '<td>' . $SPLLine->ItemDescription . '</td> - <td>' . $SPLLine->ReqDelDate . "</td> - <td class=number>$DisplayQuantity</td> - <td class=number>$DisplayCost</td> - <td class=number>$DisplayPrice</td> - <td class=number>$DisplayLineCostTotal</td> - <td class=number>$DisplayLineTotal</td> - <td class=number>$DisplayLineCostTotalCurr</td> - <td class=number>$DisplayLineTotalCurr</td> - <td><a href='" . $_SERVER['PHP_SELF'] . "?" . SID .'&Delete=' . $SPLLine->LineNo . "'>" . _('Delete') . '</a></td></tr>'; + <td>' . $SPLLine->ReqDelDate . '</td> + <td class=number>' . $DisplayQuantity . '</td> + <td class=number>' . $DisplayCost . '</td> + <td class=number>' . $DisplayPrice . '</td> + <td class=number>' . $DisplayLineCostTotal . '</td> + <td class=number>' . $DisplayLineTotal . '</td> + <td class=number>' . $DisplayLineCostTotalCurr . '</td> + <td class=number>' . $DisplayLineTotalCurr . '</td> + <td><a href="' . $_SERVER['PHP_SELF'] . '?Delete=' . $SPLLine->LineNo . '">' . _('Delete') . '</a></td></tr>'; $_SESSION['SPL']->total = $_SESSION['SPL']->total + $DisplayLineTotalCurr; } $DisplayTotal = number_format($_SESSION['SPL']->total,2); echo '<tr> - <td colspan=8 class=number>' . _('TOTAL Excl Tax') . "</td> - <td class=number><b>$DisplayTotal</b></td> - </tr></table>"; + <td colspan=8 class=number>' . _('TOTAL Excl Tax') . '</td> + <td class=number><b>' . $DisplayTotal . '</b></td> + </tr> + </table>'; } /*Set up the form to enter new special items into */ -echo "<table>"; +echo '<table>'; -echo "<input type='hidden' name='LineNo' value=" . ($_SESSION['SPL']->LinesOnOrder + 1) .">"; +echo '<input type="hidden" name="LineNo" value="' . ($_SESSION['SPL']->LinesOnOrder + 1) .'" />'; if (!isset($_POST['ItemDescription'])) {$_POST['ItemDescription']='';} -echo '<tr><td>' . _('Ordered item Description') . ":</td><td><input type=TEXT name='ItemDescription' size=40 maxlength=40 VALUE='" . $_POST['ItemDescription'] . "'></td></tr>"; +echo '<tr><td>' . _('Ordered item Description') . ':</td> + <td><input type="text" name="ItemDescription" size=40 maxlength=40 value="' . $_POST['ItemDescription'] . '"></td></tr>'; -echo '<tr><td>' . _('Category') . ':</td><td><select name=StkCat>'; +echo '<tr><td>' . _('Category') . ':</td> + <td><select name=StkCat>'; $sql = "SELECT categoryid, categorydescription FROM stockcategory"; $ErrMsg = _('The stock categories could not be retrieved because'); @@ -619,9 +613,9 @@ while ($myrow=DB_fetch_array($result)){ if (isset($_POST['StkCat']) and $myrow['categoryid']==$_POST['StkCat']){ - 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>'; } } echo '</select></td></tr>'; @@ -630,30 +624,31 @@ /*default the order quantity to 1 unit */ $_POST['Qty'] = 1; -echo '<tr><td>' . _('Order Quantity') . ":</td> - <td><input type='Text' class='number' size=7 maxlength=6 name='Qty' value=" . $_POST['Qty'] . "></td></tr>"; +echo '<tr><td>' . _('Order Quantity') . ':</td> + <td><input type="text" class="number" size=7 maxlength=6 name="Qty" value="' . $_POST['Qty'] . '"></td> + </tr>'; if (!isset($_POST['Cost'])) {$_POST['Cost']='';} -echo '<tr><td>' . _('Unit Cost') . ":</td> - <td><input type='Text' class='number' size=15 maxlength=14 name='Cost' value=" . $_POST['Cost'] . "></td></tr>"; +echo '<tr><td>' . _('Unit Cost') . ':</td> + <td><input type="text" class="number" size=15 maxlength=14 name="Cost" value="' . $_POST['Cost'] . '"></td></tr>'; if (!isset($_POST['Price'])) { $_POST['Price']='';} -echo '<tr><td>' . _('Unit Price') . ":</td> - <td><input type='Text' class='number' size=15 maxlength=14 name='Price' value=" . $_POST['Price'] . "></td></tr>"; +echo '<tr><td>' . _('Unit Price') . ':</td> + <td><input type="text" class="number" size=15 maxlength=14 name="Price" value="' . $_POST['Price'] . '"></td></tr>'; /*Default the required delivery date to tomorrow as a starting point */ $_POST['ReqDelDate'] = Date($_SESSION['DefaultDateFormat'],Mktime(0,0,0,Date('m'),Date('d')+1,Date('y'))); -echo '<tr><td>' . _('Required Delivery Date') . ":</td> - <td><input type='Text' class='date' alt='".$_SESSION['DefaultDateFormat']."' size=12 maxlength=11 name='ReqDelDate' value=" . $_POST['ReqDelDate'] . "></td></tr>"; +echo '<tr><td>' . _('Required Delivery Date') . ':</td> + <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" size=12 maxlength=11 name="ReqDelDate" value="' . $_POST['ReqDelDate'] . '"></td></tr>'; echo '</table>'; /* end of main table */ -echo "<div class='centre'><input type=submit Name='EnterLine' VALUE='" . _('Add Item to Order') . "'>"; +echo '<div class="centre"><input type="submit" name="EnterLine" value="' . _('Add Item to Order') . '">'; -echo "<br><br><input type=submit Name='Cancel' VALUE='" . _('Start Again') . "'>"; -echo "<br><br><input type=submit Name='Commit' VALUE='" . _('Process This Order') . "'>"; +echo '<br /><br /><input type="submit" name="Cancel" value="' . _('Start Again') . '">'; +echo '<br /><br /><input type="submit" name="Commit" value="' . _('Process This Order') . '">'; echo '</div></form>'; include('includes/footer.inc'); Modified: trunk/StockCostUpdate.php =================================================================== --- trunk/StockCostUpdate.php 2011-04-28 10:39:25 UTC (rev 4557) +++ trunk/StockCostUpdate.php 2011-04-29 12:43:19 UTC (rev 4558) @@ -15,7 +15,7 @@ $StockID =trim(strtoupper($_POST['StockID'])); } -echo '<a href="' . $rootpath . '/SelectProduct.php?' . SID . '">' . _('Back to Items') . '</a><br>'; +echo '<a href="' . $rootpath . '/SelectProduct.php">' . _('Back to Items') . '</a><br>'; echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . _('Inventory Adjustment') . '" alt="" />' . ' ' . $title . '</p>'; @@ -23,21 +23,21 @@ if (isset($_POST['UpdateData'])){ $sql = "SELECT materialcost, - labourcost, - overheadcost, - mbflag, - sum(quantity) as totalqoh - FROM stockmaster INNER JOIN locstock - ON stockmaster.stockid=locstock.stockid - WHERE stockmaster.stockid='".$StockID."' - GROUP BY description, - units, - lastcost, - actualcost, - materialcost, - labourcost, - overheadcost, - mbflag"; + labourcost, + overheadcost, + mbflag, + sum(quantity) as totalqoh + FROM stockmaster INNER JOIN locstock + ON stockmaster.stockid=locstock.stockid + WHERE stockmaster.stockid='".$StockID."' + GROUP BY description, + units, + lastcost, + actualcost, + materialcost, + labourcost, + overheadcost, + mbflag"; $ErrMsg = _('The entered item code does not exist'); $OldResult = DB_query($sql,$db,$ErrMsg); $OldRow = DB_fetch_array($OldResult); @@ -66,12 +66,11 @@ $Result = DB_Txn_Begin($db); ItemCostUpdateGL($db, $StockID, $NewCost, $OldCost, $_POST['QOH']); - $SQL = "UPDATE stockmaster SET - materialcost='" . $_POST['MaterialCost'] . "', - labourcost='" . $_POST['LabourCost'] . "', - overheadcost='" . $_POST['OverheadCost'] . "', - lastcost='" . $OldCost . "' - WHERE stockid='" . $StockID . "'"; + $SQL = "UPDATE stockmaster SET materialcost='" . $_POST['MaterialCost'] . "', + labourcost='" . $_POST['LabourCost'] . "', + overheadcost='" . $_POST['OverheadCost'] . "', + lastcost='" . $OldCost . "' + WHERE stockid='" . $StockID . "'"; $ErrMsg = _('The cost details for the stock item could not be updated because'); $DbgMsg = _('The SQL that failed was'); @@ -87,30 +86,30 @@ $DbgMsg = _('The SQL that failed was'); $result = DB_query("SELECT description, - units, - lastcost, - actualcost, - materialcost, - labourcost, - overheadcost, - mbflag, - stocktype, - sum(quantity) as totalqoh - FROM stockmaster INNER JOIN locstock - ON stockmaster.stockid=locstock.stockid - INNER JOIN stockcategory - ON stockmaster.categoryid = stockcategory.categoryid - WHERE stockmaster.stockid='" . $StockID . "' - GROUP BY description, - units, - lastcost, - actualcost, - materialcost, - labourcost, - overheadcost, - mbflag, - stocktype", - $db,$ErrMsg,$DbgMsg); + units, + lastcost, + actualcost, + materialcost, + labourcost, + overheadcost, + mbflag, + stocktype, + sum(quantity) as totalqoh + FROM stockmaster INNER JOIN locstock + ON stockmaster.stockid=locstock.stockid + INNER JOIN stockcategory + ON stockmaster.categoryid = stockcategory.categoryid + WHERE stockmaster.stockid='" . $StockID . "' + GROUP BY description, + units, + lastcost, + actualcost, + materialcost, + labourcost, + overheadcost, + mbflag, + stocktype", + $db,$ErrMsg,$DbgMsg); $myrow = DB_fetch_array($result); @@ -125,8 +124,8 @@ echo '<tr><th colspan=2><font color=navy size=2>'. _('Total Quantity On Hand') . ': ' . $myrow['totalqoh'] . ' ' . $myrow['units'] .'</font></th></tr>'; if (($myrow['mbflag']=='D' AND $myrow['stocktype'] != 'L') - OR $myrow['mbflag']=='A' - OR $myrow['mbflag']=='K'){ + OR $myrow['mbflag']=='A' + OR $myrow['mbflag']=='K'){ echo '</form>'; // Close the form if ($myrow['mbflag']=='D'){ echo '<br>' . $StockID .' ' . _('is a service item'); @@ -164,11 +163,11 @@ echo '</table><br /><div class="centre"><input type="submit" name="UpdateData" VALUE="' . _('Update') . '"><br /><br />'; } if ($myrow['mbflag']!='D'){ - echo '<div class="centre"><a href="' . $rootpath . '/StockStatus.php?' . SID . '&StockID=' . $StockID . '>' . _('Show Stock Status') . '</a>'; - echo '<br><a href="' . $rootpath . '/StockMovements.php?' . SID . '&StockID=' . $StockID . '">' . _('Show Stock Movements') . '</a>'; - echo '<br><a href="' . $rootpath . '/StockUsage.php?' . SID . '&StockID=' . $StockID . '">' . _('Show Stock Usage') .'</a>'; - echo '<br><a href="' . $rootpath . '/SelectSalesOrder.php?' . SID . '&SelectedStockItem=' . $StockID . '">' . _('Search Outstanding Sales Orders') . '</a>'; - echo '<br><a href="' . $rootpath . '/SelectCompletedOrder.php?' . SID . '&SelectedStockItem=' . $StockID . '">' . _('Search Completed Sales Orders') . '</a></div>'; + echo '<div class="centre"><a href="' . $rootpath . '/StockStatus.php?StockID=' . $StockID . '>' . _('Show Stock Status') . '</a>'; + echo '<br><a href="' . $rootpath . '/StockMovements.php?StockID=' . $StockID . '">' . _('Show Stock Movements') . '</a>'; + echo '<br><a href="' . $rootpath . '/StockUsage.php?StockID=' . $StockID . '">' . _('Show Stock Usage') .'</a>'; + echo '<br><a href="' . $rootpath . '/SelectSalesOrder.php?SelectedStockItem=' . $StockID . '">' . _('Search Outstanding Sales Orders') . '</a>'; + echo '<br><a href="' . $rootpath . '/SelectCompletedOrder.php?SelectedStockItem=' . $StockID . '">' . _('Search Completed Sales Orders') . '</a></div>'; } echo '</form></div>'; include('includes/footer.inc'); Modified: trunk/StockLocMovements.php =================================================================== --- trunk/StockLocMovements.php 2011-04-28 10:39:25 UTC (rev 4557) +++ trunk/StockLocMovements.php 2011-04-29 12:43:19 UTC (rev 4558) @@ -1,15 +1,13 @@ <?php /* $Id$*/ -//$PageSecurity = 2; - include('includes/session.inc'); $title = _('All Stock Movements By Location'); include('includes/header.inc'); -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 '<p class="page_title_text"><img src="' . $rootpath . '/css/' . $theme . '/images/magnifier.png" title="' . _('Search') . @@ -18,20 +16,20 @@ echo '<table class=selection><tr><td>'; echo ' ' . _('From Stock Location') . ':<select name="StockLocation"> '; -$sql = 'SELECT loccode, locationname FROM locations'; +$sql = "SELECT loccode, locationname FROM locations"; $resultStkLocs = DB_query($sql,$db); while ($myrow=DB_fetch_array($resultStkLocs)){ if (isset($_POST['StockLocation']) AND $_POST['StockLocation']!='All'){ if ($myrow['loccode'] == $_POST['StockLocation']){ - echo '<option selected Value="' . $myrow['loccode'] . '">' . $myrow['locationname']; + echo '<option selected Value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } else { - echo '<option Value="' . $myrow['loccode'] . '">' . $myrow['locationname']; + echo '<option Value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } } elseif ($myrow['loccode']==$_SESSION['UserStockLocation']){ - echo '<option selected Value="' . $myrow['loccode'] . '">' . $myrow['locationname']; + echo '<option selected Value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; $_POST['StockLocation']=$myrow['loccode']; } else { - echo '<option Value="' . $myrow['loccode'] . '">' . $myrow['locationname']; + echo '<option Value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } } @@ -43,7 +41,7 @@ if (!isset($_POST['AfterDate']) OR !Is_Date($_POST['AfterDate'])){ $_POST['AfterDate'] = Date($_SESSION['DefaultDateFormat'], Mktime(0,0,0,Date('m')-1,Date('d'),Date('y'))); } -echo ' ' . _('Show Movements before') . ': <input type=TEXT name="BeforeDate" size=12 maxlength=12 Value="' . $_POST['BeforeDate'] . '">'; +echo ' ' . _('Show Movements before') . ': <input type="text" name="BeforeDate" size=12 maxlength=12 Value="' . $_POST['BeforeDate'] . '">'; echo ' ' . _('But after') . ': <input type=TEXT name="AfterDate" size=12 maxlength=12 Value="' . $_POST['AfterDate'] . '">'; echo '</td></tr></table><br>'; echo '<div class=centre><input type=submit name="ShowMoves" VALUE="' . _('Show Stock Movements') . '"></div><br>'; @@ -77,7 +75,7 @@ $ErrMsg = _('The stock movements for the selected criteria could not be retrieved because'); $MovtsResult = DB_query($sql, $db,$ErrMsg); -echo '<table cellpadding=5 CELLSPACING=4 class=selection>'; +echo '<table cellpadding=5 cellspacing="4 "class="selection">'; $tableheader = '<tr> <th>' . _('Item Code') . '</th> <th>' . _('Type') . '</th> @@ -108,29 +106,29 @@ $DisplayTranDate = ConvertSQLDate($myrow['trandate']); - printf("<td><a target='_blank' href='StockStatus.php?" . SID . "&StockID=%s'>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td class=number>%s</td> - <td>%s</td> - <td class=number>%s</td> - <td class=number>%s</td> - <td class=number>%s</td> - </tr>", - strtoupper($myrow['stockid']), - strtoupper($myrow['stockid']), - $myrow['typename'], - $myrow['transno'], - $DisplayTranDate, - $myrow['debtorno'], - number_format($myrow['qty'], - $myrow['decimalplaces']), - $myrow['reference'], - number_format($myrow['price'],2), - number_format($myrow['discountpercent']*100,2), - number_format($myrow['newqoh'],$myrow['decimalplaces'])); + printf('<td><a target="_blank" href="' . $rootpath . '/StockStatus.php?StockID=%s">%s</td> + <td>%s</td> + <td>%s</td> + <td>%s</td> + <td>%s</td> + <td class=number>%s</td> + <td>%s</td> + <td class=number>%s</td> + <td class=number>%s</td> + <td class=number>%s</td> + </tr>', + strtoupper($myrow['stockid']), + strtoupper($myrow['stockid']), + $myrow['typename'], + $myrow['transno'], + $DisplayTranDate, + $myrow['debtorno'], + number_format($myrow['qty'], + $myrow['decimalplaces']), + $myrow['reference'], + number_format($myrow['price'],$_SESSION['CompanyRecord']['decimalplaces']), + number_format($myrow['discountpercent']*100,2), + number_format($myrow['newqoh'],$myrow['decimalplaces'])); $j++; If ($j == 16){ $j=1; Modified: trunk/StockLocStatus.php =================================================================== --- trunk/StockLocStatus.php 2011-04-28 10:39:25 UTC (rev 4557) +++ trunk/StockLocStatus.php 2011-04-29 12:43:19 UTC (rev 4558) @@ -1,8 +1,7 @@ <?php + /* $Id$*/ -//$PageSecurity = 2; - include('includes/session.inc'); $title = _('All Stock Status By Location/Category'); @@ -16,7 +15,7 @@ } -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'] . '" />'; $sql = "SELECT loccode, @@ -27,7 +26,9 @@ echo '<p class="page_title_text"><img src="' . $rootpath . '/css/' . $theme . '/images/magnifier.png" title="' . _('Search') . '" alt="" />' . ' ' . $title.'</p>'; -echo '<table class=selection><tr><td>' . _('From Stock Location') . ':</td><td><select name="StockLocation"> '; +echo '<table class=selection> + <tr><td>' . _('From Stock Location') . ':</td> + <td><select name="StockLocation"> '; while ($myrow=DB_fetch_array($resultStkLocs)){ if (isset($_POST['StockLocation']) AND $_POST['StockLocation']!='All'){ if ($myrow['loccode'] == $_POST['StockLocation']){ @@ -44,17 +45,21 @@ } echo '</select></td></tr>'; -$SQL='SELECT categoryid, categorydescription FROM stockcategory ORDER BY categorydescription'; +$SQL="SELECT categoryid, + categorydescription + FROM stockcategory + ORDER BY categorydescription"; $result1 = DB_query($SQL,$db); if (DB_num_rows($result1)==0){ echo '</table><p>'; prnMsg(_('There are no stock categories currently defined please use the link below to set them up'),'warn'); - echo '<br><a href="' . $rootpath . '/StockCategories.php?' . SID .'">' . _('Define Stock Categories') . '</a>'; + echo '<br /><a href="' . $rootpath . '/StockCategories.php">' . _('Define Stock Categories') . '</a>'; include ('includes/footer.inc'); exit; } -echo '<tr><td>' . _('In Stock Category') . ':</td><td><select name="StockCat">'; +echo '<tr><td>' . _('In Stock Category') . ':</td> + <td><select name="StockCat">'; if (!isset($_POST['StockCat'])){ $_POST['StockCat']='All'; } @@ -73,8 +78,8 @@ echo '</select></td></tr>'; - -echo '<tr><td>' . _('Shown Only Items Where') . ':</td><td><select name="BelowReorderQuantity">'; +echo '<tr><td>' . _('Shown Only Items Where') . ':</td> + <td><select name="BelowReorderQuantity">'; if (!isset($_POST['BelowReorderQuantity'])){ $_POST['BelowReorderQuantity']='All'; } @@ -94,7 +99,7 @@ echo '</td></tr></table>'; -echo '<br><div class="centre"><input type=submit name="ShowStatus" value="' . _('Show Stock Status') . '"></div>'; +echo '<br /><div class="centre"><input type=submit name="ShowStatus" value="' . _('Show Stock Status') . '"></div>'; if (isset($_POST['ShowStatus'])){ @@ -142,7 +147,7 @@ $DbgMsg = _('The SQL that failed was'); $LocStockResult = DB_query($sql, $db, $ErrMsg, $DbgMsg); - echo '<br><table cellpadding=5 cellspacing=4 class=selection>'; + echo '<br /><table cellpadding=5 cellspacing=4 class="selection">'; $tableheader = '<tr> <th>' . _('StockID') . '</th> @@ -161,7 +166,7 @@ $StockID = $myrow['stockid']; - $sql = "SELECT Sum(salesorderdetails.quantity-salesorderdetails.qtyinvoiced) AS dem + $sql = "SELECT SUM(salesorderdetails.quantity-salesorderdetails.qtyinvoiced) AS dem FROM salesorderdetails, salesorders WHERE salesorders.orderno = salesorderdetails.orderno @@ -181,17 +186,17 @@ //Also need to add in the demand as a component of an assembly items if this items has any assembly parents. $sql = "SELECT Sum((salesorderdetails.quantity-salesorderdetails.qtyinvoiced)*bom.quantity) AS dem - FROM salesorderdetails, - salesorders, - bom, - stockmaster - WHERE salesorderdetails.stkcode=bom.parent - AND salesorders.orderno = salesorderdetails.orderno - AND salesorders.fromstkloc='" . $myrow['loccode'] . "' - AND salesorderdetails.quantity-salesorderdetails.qtyinvoiced > 0 - AND bom.component='" . $StockID . "' - AND stockmaster.stockid=bom.parent - AND stockmaster.mbflag='A'"; + FROM salesorderdetails, + salesorders, + bom, + stockmaster + WHERE salesorderdetails.stkcode=bom.parent + AND salesorders.orderno = salesorderdetails.orderno + AND salesorders.fromstkloc='" . $myrow['loccode'] . "' + AND salesorderdetails.quantity-salesorderdetails.qtyinvoiced > 0 + AND bom.component='" . $StockID . "' + AND stockmaster.stockid=bom.parent + AND stockmaster.mbflag='A'"; $ErrMsg = _('The demand for this product from') . ' ' . $myrow['loccode'] . ' ' . _('cannot be retrieved because'); $DemandResult = DB_query($sql,$db, $ErrMsg); @@ -201,12 +206,12 @@ $DemandQty += $DemandRow[0]; } $sql = "SELECT SUM((woitems.qtyreqd-woitems.qtyrecd)*bom.quantity) AS dem - FROM workorders, woitems, bom - WHERE woitems.wo = workorders.wo - AND woitems.stockid = bom.parent - AND workorders.closed=0 - AND bom.component = '". $StockID . "' - AND workorders.loccode='". $myrow['loccode'] ."'"; + FROM workorders, woitems, bom + WHERE woitems.wo = workorders.wo + AND woitems.stockid = bom.parent + AND workorders.closed=0 + AND bom.component = '". $StockID . "' + AND workorders.loccode='". $myrow['loccode'] ."'"; $DemandResult = DB_query($sql,$db, $ErrMsg); if (DB_num_rows($DemandResult)==1){ @@ -215,19 +220,15 @@ } - $sql = "SELECT SUM(purchorderdetails.quantityord*(CASE WHEN purchdata.conversionfactor IS NULL THEN 1 ELSE purchdata.conversionfactor END) - - purchorderdetails.quantityrecd*(CASE WHEN purchdata.conversionfactor IS NULL THEN 1 ELSE purchdata.conversionfactor END)) AS qoo - FROM purchorderdetails - INNER JOIN purchorders - ON purchorderdetails.orderno=purchorders.orderno - LEFT JOIN purchdata - ON purchorders.supplierno=purchdata.supplierno - AND purchorderdetails.itemcode=purchdata.stockid - WHERE purchorders.intostocklocation='" . $myrow['loccode'] . "' - AND purchorderdetails.itemcode='" . $StockID . "' - AND purchorders.status <> 'Cancelled' - AND purchorders.status <> 'Rejected' - AND purchorders.status <> 'Pending'"; + $sql = "SELECT SUM(purchorderdetails.quantityord - purchorderdetails.quantityrecd) AS qoo + FROM purchorderdetails + INNER JOIN purchorders + ON purchorderdetails.orderno=purchorders.orderno + WHERE purchorders.intostocklocation='" . $myrow['loccode'] . "' + AND purchorderdetails.itemcode='" . $StockID . "' + AND purchorders.status <> 'Cancelled' + AND purchorders.status <> 'Rejected' + AND purchorders.status <> 'Pending'"; $ErrMsg = _('The quantity on order for this product to be received into') . ' ' . $myrow['loccode'] . ' ' . _('cannot be retrieved because'); $QOOResult = DB_query($sql,$db,$ErrMsg); @@ -251,27 +252,29 @@ echo '<tr class="EvenTableRows">'; $k=1; } - printf("<td><a target='_blank' href='StockStatus.php?StockID=%s'>%s</a></td> + printf('<td><a target="_blank" href="' . $rootpath . '/StockStatus.php?StockID=%s">%s</a></td> <td>%s</td> <td class=number>%s</td> <td class=number>%s</td> <td class=number>%s</td> - <td class=number><a target='_blank' href='SelectProduct.php?StockID=%s'>%s</a></td> - <td class=number>%s</td></tr>", + <td class=number><a target="_blank" href="' . $rootpath . 'SelectProduct.php?StockID=%s">%s</a></td> + <td class=number>%s</td> + </tr>', strtoupper($myrow['stockid']), strtoupper($myrow['stockid']), $myrow['description'], number_format($myrow['quantity'],$myrow['decimalplaces']), number_format($myrow['reorderlevel'],$myrow['decimalplaces']), number_format($DemandQty,$myrow['decimalplaces']), - strtoupper($myrow['stockid']), + strtoupper($myrow['stockid']), number_format($myrow['quantity'] - $DemandQty,$myrow['decimalplaces']), number_format($QOO,$myrow['decimalplaces'])); + if ($myrow['serialised'] ==1){ /*The line is a serialised item*/ - echo '<td><a target="_blank" href="' . $rootpath . '/StockSerialItems.php?' . SID . '&Serialised=Yes&Location=' . $myrow['loccode'] . '&StockID=' . $StockID . '">' . _('Serial Numbers') . '</a></td></tr>'; + echo '<td><a target="_blank" href="' . $rootpath . '/StockSerialItems.php?Serialised=Yes&Location=' . $myrow['loccode'] . '&StockID=' . $StockID . '">' . _('Serial Numbers') . '</a></td></tr>'; } elseif ($myrow['controlled']==1){ - echo '<td><a target="_blank" href="' . $rootpath . '/StockSerialItems.php?' . SID . '&Location=' . $myrow['loccode'] . '&StockID=' . $StockID . '">' . _('Batches') . '</a></td></tr>'; + echo '<td><a target="_blank" href="' . $rootpath . '/StockSerialItems.php?Location=' . $myrow['loccode'] . '&StockID=' . $StockID . '">' . _('Batches') . '</a></td></tr>'; } } else if ($_POST['BelowReorderQuantity']!='NotZero') { if ($k==1){ @@ -281,13 +284,13 @@ echo '<tr class="EvenTableRows">'; $k=1; } - printf("<td><a target='_blank' href='StockStatus.php?StockID=%s'>%s</a></td> + printf('<td><a target="_blank" href="' . $rootpath . '/StockStatus.php?StockID=%s">%s</a></td> <td>%s</td> <td class=number>%s</td> <td class=number>%s</td> <td class=number>%s</td> - <td class=number><a target='_blank' href='SelectProduct.php?StockID=%s'>%s</a></td> - <td class=number>%s</td>", + <td class=number><a target="_blank" href="' . $rootpath . 'SelectProduct.php?StockID=%s">%s</a></td> + <td class=number>%s</td>', strtoupper($myrow['stockid']), strtoupper($myrow['stockid']), $myrow['description'], Modified: trunk/StockMovements.php =================================================================== --- trunk/StockMovements.php 2011-04-28 10:39:25 UTC (rev 4557) +++ trunk/StockMovements.php 2011-04-29 12:43:19 UTC (rev 4558) @@ -2,13 +2,10 @@ /* $Id$*/ -//$PageSecurity = 2; - include('includes/session.inc'); $title = _('Stock Movements'); include('includes/header.inc'); - if (isset($_GET['StockID'])){ $StockID = trim(strtoupper($_GET['StockID'])); } elseif (isset($_POST['StockID'])){ @@ -17,50 +14,46 @@ $StockID = ''; } - -// This is already linked from this page -//echo "<a href='" . $rootpath . '/SelectProduct.php?' . SID . "'>" . _('Back to Items') . '</a><br>'; - $result = DB_query("SELECT description, units FROM stockmaster WHERE stockid='".$StockID."'",$db); $myrow = DB_fetch_row($result); echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/inventory.png" title="' . _('Inventory') . '" alt="" /><b>' . ' ' . $StockID . ' - ' . $myrow['0'] . ' : ' . _('in units of') . ' : ' . $myrow[1] . '</b></p>'; -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'] . '" />'; if (!isset($_POST['BeforeDate']) OR !Is_Date($_POST['BeforeDate'])){ $_POST['BeforeDate'] = Date($_SESSION['DefaultDateFormat']); } if (!isset($_POST['AfterDate']) OR !Is_Date($_POST['AfterDate'])){ - $_POST['AfterDate'] = Date($_SESSION['DefaultDateFormat'], Mktime(0,0,0,Date("m")-3,Date("d"),Date("y"))); + $_POST['AfterDate'] = Date($_SESSION['DefaultDateFormat'], Mktime(0,0,0,Date('m')-3,Date('d'),Date('y'))); } echo '<br /><table cellpadding=2 class=selection>'; -echo '<tr><th colspan=10>' . _('Stock Code') . ":<input type=TEXT name='StockID' size=21 VALUE='$StockID' maxlength=20>"; +echo '<tr><th colspan=10>' . _('Stock Code') . ':<input type="text" name="StockID" size=21 value="' . $StockID . '" maxlength=20>'; -echo ' ' . _('From Stock Location') . ":<select name='StockLocation'> "; +echo ' ' . _('From Stock Location') . ':<select name="StockLocation"> '; -$sql = 'SELECT loccode, locationname FROM locations'; +$sql = "SELECT loccode, locationname FROM locations"; $resultStkLocs = DB_query($sql,$db); while ($myrow=DB_fetch_array($resultStkLocs)){ if (isset($_POST['StockLocation']) AND $_POST['StockLocation']!='All'){ if ($myrow['loccode'] == $_POST['StockLocation']){ - echo "<option selected VALUE='" . $myrow['loccode'] . "'>" . $myrow['locationname']; + echo '<option selected value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } else { - echo "<option VALUE='" . $myrow['loccode'] . "'>" . $myrow['locationname']; + echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } } elseif ($myrow['loccode']==$_SESSION['UserStockLocation']){ - echo "<option selected VALUE='" . $myrow['loccode'] . "'>" . $myrow['locationname']; + echo '<option selected value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; $_POST['StockLocation']=$myrow['loccode']; } else { - echo "<option VALUE='" . $myrow['loccode'] . "'>" . $myrow['locationname']; + echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } } echo '</select></th></tr>'; echo '<tr><th colspan=10>' . _('Show Movements before') . ': <input type=text name="BeforeDate" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" size="12" maxlength="12" VALUE="' . $_POST['BeforeDate'] . '">'; echo ' ' . _('But after') . ': <input type=TEXT name="AfterDate" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" size="12" maxlength="12" VALUE="' . $_POST['AfterDate'] . '">'; -echo " <input type=submit name='ShowMoves' VALUE='" . _('Show Stock Movements') . "'></th></tr>"; +echo ' <input type="submit" name="ShowMoves" value="' . _('Show Stock Movements') . '"></th></tr>'; $SQLBeforeDate = FormatDateForSQL($_POST['BeforeDate']); $SQLAfterDate = FormatDateForSQL($_POST['AfterDate']); @@ -93,14 +86,19 @@ $MovtsResult = DB_query($sql, $db, $ErrMsg, $DbgMsg); -$tableheader = "<tr> - <th>" . _('Type') . "</th><th>" . _('Number') . "</th> - <th>" . _('Date') . "</th><th>" . _('Customer') . "</th> - <th>" . _('Branch') . "</th><th>" . _('Quantity') . "</th> - <th>" . _('Reference') . "</th><th>" . _('Price') . "</th> - <th>" . _('Discount') . "</th><th>" . _('New Qty') . "</th> - </tr>"; - +$tableheader = '<tr> + <th>' . _('Type') . '</th> + <th>' . _('Number') . '</th> + <th>' . _('Date') . '</th> + <th>' . _('Customer') . '</th> + <th>' . _('Branch') . '</th> + <th>' . _('Quantity') . '</th> + <th>' . _('Reference') . '</th> + <th>' . _('Price') . '</th> + <th>' . _('Discount') . '</th> + <th>' . _('New Qty') . '</th> + </tr>'; + echo $tableheader; $j = 1; @@ -120,61 +118,59 @@ if ($myrow['type']==10){ /*its a sales invoice allow link to show invoice it was sold on*/ - printf("<td><a TARGET='_blank' href='%s/PrintCustTrans.php?%s&FromTransNo=%s&InvOrCredit=Invoice'>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td class=number>%s</td> - <td>%s</td> - <td class=number>%s</td> - <td class=number>%s%%</td> - <td class=number>%s</td> - </tr>", - $rootpath, - SID, - $myrow['transno'], - $myrow['typename'], - $myrow['transno'], - $DisplayTranDate, - $myrow['debtorno'], - $myrow['branchcode'], - number_format($myrow['qty'], - $myrow['decimalplaces']), - $myrow['reference'], - number_format($myrow['price'],2), - number_format($myrow['discountpercent']*100,2), - number_format($myrow['newqoh'],$myrow['decimalplaces'])); + printf('<td><a target="_blank" href="%s/PrintCustTrans.php?FromTransNo=%s&InvOrCredit=Invoice">%s</td> + <td>%s</td> + <td>%s</td> + <td>%s</td> + <td>%s</td> + <td class=number>%s</td> + <td>%s</td> + <td class=number>%s</td> + <td class=number>%s%%</td> + <td class=number>%s</td> + </tr>', + $rootpath, + $myrow['transno'], + $myrow['typename'], + $myrow['transno'], + $DisplayTranDate, + $myrow['debtorno'], + $myrow['branchcode'], + number_format($myrow['qty'], + $myrow['decimalplaces']), + $myrow['reference'], + number_format($myrow['price'],2), + number_format($myrow['discountpercent']*100,2), + number_format($myrow['newqoh'],$myrow['decimalplaces'])); } elseif ($myrow['type']==11){ - printf("<td><a TARGET='_blank' href='%s/PrintCustTrans.php?%s&FromTransNo=%s&InvOrCredit=Credit'>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td class=number>%s</td> - <td>%s</td> - <td class=number>%s</td> - <td class=number>%s%%</td> - <td class=number>%s</td> - </tr>", - $rootpath, - SID, - $myrow['transno'], - $myrow['typename'], - $myrow['transno'], - $DisplayTranDate, - $myrow['debtorno'], - $myrow['branchcode'], - number_format($myrow['qty'],$myrow['decimalplaces']), - $myrow['reference'], - number_format($myrow['price'],2), - number_format($myrow['discountpercent']*100,2), - number_format($myrow['newqoh'],$myrow['decimalplaces'])); + printf('<td><a target="_blank" href="%s/PrintCustTrans.php?FromTransNo=%s&InvOrCredit=Credit">%s</td> + <td>%s</td> + <td>%s</td> + <td>%s</td> + <td>%s</td> + <td class=number>%s</td> + <td>%s</td> + <td class=number>%s</td> + <td class=number>%s%%</td> + <td class=number>%s</td> + </tr>', + $rootpath, + $myrow['transno'], + $myrow['typename'], + $myrow['transno'], + $DisplayTranDate, + $myrow['debtorno'], + $myrow['branchcode'], + number_format($myrow['qty'],$myrow['decimalplaces']), + $myrow['reference'], + number_format($myrow['price'],$_SESSION['CompanyRecord']['decimalplaces']), + number_format($myrow['discountpercent']*100,2), + number_format($myrow['newqoh'],$myrow['decimalplaces'])); } else { - printf("<td>%s</td> + printf('<td>%s</td> <td>%s</td> <td>%s</td> <td>%s</td> @@ -184,7 +180,7 @@ <td class=number>%s</td> <td class=number>%s%%</td> <td class=number>%s</td> - </tr>", + </tr>', $myrow['typename'], $myrow['transno'], $DisplayTranDate, @@ -192,7 +188,7 @@ $myrow['branchcode'], number_format($myrow['qty'],$myrow['decimalplaces']), $myrow['reference'], - number_format($myrow['price'],2), + number_format($myrow['price'],$_SESSION['CompanyRecord']['decimalplaces']), number_format($myrow['discountpercent']*100,2), number_format($myrow['newqoh'],$myrow['decimalplaces'])); } @@ -201,10 +197,10 @@ //end of while loop echo '</table>'; -echo "<div class=centre><br /><a href='$rootpath/StockStatus.php?" . SID . "&StockID=$StockID'>" . _('Show Stock Status') . '</a>'; -echo "<br><a href='$rootpath/StockUsage.php?" . SID . "&StockID=$StockID&StockLocation=" . $_POST['StockLocation'] . "'>" . _('Show Stock Usage') . '</a>'; -echo "<br><a href='$rootpath/SelectSalesOrder.php?" . SID . "&SelectedStockItem=$StockID&StockLocation=" . $_POST['StockLocation'] . "'>" . _('Search Outstanding Sales Orders') . '</a>'; -echo "<br><a href='$rootpath/SelectCompletedOrder.php?" . SID . "&SelectedStockItem=$StockID'>" . _('Search Completed Sales Orders') . '</a>'; +echo '<div class="centre"><br /><a href="' . $rootpath . '/StockStatus.php?StockID=' . $StockID . '">' . _('Show Stock Status') . '</a>'; +echo '<br /><a href="' . $rootpath . '/StockUsage.php?StockID=' . $StockID . '&StockLocation=' . $_POST['StockLocation'] . '">' . _('Show Stock Usage') . '</a>'; +echo '<br /><a href="' . $rootpath . '/SelectSalesOrder.php?SelectedStockItem=' . $StockID . '&StockLocation=' . $_POST['StockLocation'] . '">' . _('Search Outstanding Sales Orders') . '</a>'; +echo '<br /><a href="' . $rootpath . '/SelectCompletedOrder.php?SelectedStockItem=' . $StockID . '">' . _('Search Completed Sales Orders') . '</a>'; echo '</form></div>'; Modified: trunk/StockQuantityByDate.php =================================================================== --- trunk/StockQuantityByDate.php 2011-04-28 10:39:25 UTC (rev 4557) +++ trunk/StockQuantityByDate.php 2011-04-29 12:43:19 UTC (rev 4558) @@ -1,11 +1,7 @@ <?php /* $Id$ */ -/* Contributed by Chris Bice - gettext by Kitch*/ - -//$PageSecurity = 2; - include('includes/session.inc'); $title = _('Stock On Hand By Date'); include('includes/header.inc'); @@ -13,65 +9,65 @@ echo '<p Class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/inventory.png" title="' . _('Inventory') . '" alt="" /><b>' . $title. '</b></p>'; -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'] . '" />'; -$sql = 'SELECT categoryid, categorydescription FROM stockcategory'; +$sql = "SELECT categoryid, categorydescription FROM stockcategory"; $resultStkLocs = DB_query($sql, $db); echo '<table class=selection><tr>'; -echo '<td>' . _('For Stock Category') . ":</td> - <td><select name='StockCategory'> "; +echo '<td>' . _('For Stock Category') . ':</td> + <td><select name="StockCategory"> '; echo '<option value="All">' . _('All') . '</option>'; while ($myrow=DB_fetch_array($resultStkLocs)){ if (isset($_POST['StockCategory']) AND $_POST['StockCategory']!='All'){ if ($myrow['categoryid'] == $_POST['StockCategory']){ - echo "<option selected VALUE='" . $myrow['categoryid'] . "'>" . $myrow['categorydescription'] . '</option>'; + echo '<option selected value="' . $myrow['categoryid'] . '">' . $myrow['categorydescription'] . '</option>'; } else { - echo "<option VALUE='" . $myrow['categoryid'] . "'>" . $myrow['categorydescription'] . '</option>'; + echo '<option value="' . $myrow['categoryid'] . '">' . $myrow['categorydescription'] . '</option>'; } }else { - echo "<option VALUE='" . $myrow['categoryid'] . "'>" . $myrow['categorydescription'] . '</option>'; + echo '<option value="' . $myrow['categoryid'] . '">' . $myrow['categorydescription'] . '</option>'; } } echo '</select></td>'; -$sql = 'SELECT loccode, locationname FROM locations'; +$sql = "SELECT loccode, locationname FROM locations"; $resultStkLocs = DB_query($sql, $db); -echo '<td>' . _('For Stock Location') . ":</td> - <td><select name='StockLocation'> "; +echo '<td>' . _('For Stock Location') . ':</td> + <td><select name="StockLocation"> '; while ($myrow=DB_fetch_array($resultStkLocs)){ if (isset($_POST['StockLocation']) AND $_POST['StockLocation']!='All'){ if ($myrow['loccode'] == $_POST['StockLocation']){ - echo "<option selected VALUE='" . $myrow['loccode'] . "'>" . $myrow['locationname']; + echo '<option selected value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } else { - echo "<option VALUE='" . $myrow['loccode'] . "'>" . $myrow['locationname']; + echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } } elseif ($myrow['loccode']==$_SESSION['UserStockLocation']){ - echo "<option selected VALUE='" . $myrow['loccode'] . "'>" . $myrow['locationname']; + echo '<option selected value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; $_POST['StockLocation']=$myrow['loccode']; } else { - echo "<option VALUE='" . $myrow['loccode'] . "'>" . $myrow['locationname']; + echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } } echo '</select></td>'; if (!isset($_POST['OnHandDate'])){ - $_POST['OnHandDate'] = Date($_SESSION['DefaultDateFormat'], Mktime(0,0,0,Date("m"),0,Date("y"))); + $_POST['OnHandDate'] = Date($_SESSION['DefaultDateFormat'], Mktime(0,0,0,Date('m'),0,Date('y'))); } -echo '<td>' . _("On-Hand On Date") . ":</td> - <td><input type=TEXT class='date' alt='".$_SESSION['DefaultDateFormat']."' name='OnHandDate' size=12 maxlength=12 VALUE='" . $_POST['OnHandDate'] . "'></td></tr>"; -echo "<tr><td colspan=6><div class='centre'><input type=submit n... [truncated message content] |
From: <dai...@us...> - 2011-04-29 12:43:29
|
Revision: 4558 http://web-erp.svn.sourceforge.net/web-erp/?rev=4558&view=rev Author: daintree Date: 2011-04-29 12:43:19 +0000 (Fri, 29 Apr 2011) Log Message: ----------- quoting Modified Paths: -------------- trunk/PO_Header.php trunk/SpecialOrder.php trunk/StockCostUpdate.php trunk/StockLocMovements.php trunk/StockLocStatus.php trunk/StockMovements.php trunk/StockQuantityByDate.php trunk/includes/GetConfig.php trunk/locale/cs_CZ.utf8/LC_MESSAGES/messages.mo trunk/locale/cs_CZ.utf8/LC_MESSAGES/messages.po trunk/locale/de_DE.utf8/LC_MESSAGES/messages.mo trunk/locale/de_DE.utf8/LC_MESSAGES/messages.po trunk/locale/el_GR.utf8/LC_MESSAGES/messages.mo trunk/locale/el_GR.utf8/LC_MESSAGES/messages.po trunk/locale/en_GB.utf8/LC_MESSAGES/messages.pot trunk/locale/en_US.utf8/LC_MESSAGES/messages.mo trunk/locale/en_US.utf8/LC_MESSAGES/messages.po trunk/locale/es_ES.utf8/LC_MESSAGES/messages.mo trunk/locale/es_ES.utf8/LC_MESSAGES/messages.po trunk/locale/et_EE.utf8/LC_MESSAGES/messages.mo trunk/locale/et_EE.utf8/LC_MESSAGES/messages.po trunk/locale/fa_IR.utf8/LC_MESSAGES/messages.mo trunk/locale/fa_IR.utf8/LC_MESSAGES/messages.po trunk/locale/fr_FR.utf8/LC_MESSAGES/messages.mo trunk/locale/fr_FR.utf8/LC_MESSAGES/messages.po trunk/locale/hi_IN.utf8/LC_MESSAGES/messages.mo trunk/locale/hi_IN.utf8/LC_MESSAGES/messages.po trunk/locale/hr_HR.utf8/LC_MESSAGES/messages.mo trunk/locale/hr_HR.utf8/LC_MESSAGES/messages.po trunk/locale/hu_HU.utf8/LC_MESSAGES/messages.mo trunk/locale/hu_HU.utf8/LC_MESSAGES/messages.po trunk/locale/id_ID.utf8/LC_MESSAGES/messages.mo trunk/locale/id_ID.utf8/LC_MESSAGES/messages.po trunk/locale/it_IT.utf8/LC_MESSAGES/messages.mo trunk/locale/it_IT.utf8/LC_MESSAGES/messages.po trunk/locale/ja_JP.utf8/LC_MESSAGES/messages.mo trunk/locale/ja_JP.utf8/LC_MESSAGES/messages.po trunk/locale/lv_LV.utf8/LC_MESSAGES/messages.mo trunk/locale/lv_LV.utf8/LC_MESSAGES/messages.po trunk/locale/nl_NL.utf8/LC_MESSAGES/messages.mo trunk/locale/nl_NL.utf8/LC_MESSAGES/messages.po trunk/locale/pl_PL.utf8/LC_MESSAGES/messages.mo trunk/locale/pl_PL.utf8/LC_MESSAGES/messages.po trunk/locale/pt_BR.utf8/LC_MESSAGES/messages.mo trunk/locale/pt_BR.utf8/LC_MESSAGES/messages.po trunk/locale/pt_PT.utf8/LC_MESSAGES/messages.mo trunk/locale/pt_PT.utf8/LC_MESSAGES/messages.po trunk/locale/ro_RO.utf8/LC_MESSAGES/messages.mo trunk/locale/ro_RO.utf8/LC_MESSAGES/messages.po trunk/locale/ru_RU.utf8/LC_MESSAGES/messages.mo trunk/locale/ru_RU.utf8/LC_MESSAGES/messages.po trunk/locale/sq_AL.utf8/LC_MESSAGES/messages.mo trunk/locale/sq_AL.utf8/LC_MESSAGES/messages.po trunk/locale/sv_SE.utf8/LC_MESSAGES/messages.mo trunk/locale/sv_SE.utf8/LC_MESSAGES/messages.po trunk/locale/sw_KE.utf8/LC_MESSAGES/messages.mo trunk/locale/sw_KE.utf8/LC_MESSAGES/messages.po trunk/locale/tr_TR.utf8/LC_MESSAGES/messages.mo trunk/locale/tr_TR.utf8/LC_MESSAGES/messages.po trunk/locale/vi_VN.utf8/LC_MESSAGES/messages.mo trunk/locale/vi_VN.utf8/LC_MESSAGES/messages.po trunk/locale/zh_CN.utf8/LC_MESSAGES/messages.mo trunk/locale/zh_CN.utf8/LC_MESSAGES/messages.po trunk/locale/zh_HK.utf8/LC_MESSAGES/messages.mo trunk/locale/zh_HK.utf8/LC_MESSAGES/messages.po trunk/sql/mysql/weberp-demo.sql trunk/sql/mysql/weberp-new.sql Modified: trunk/PO_Header.php =================================================================== --- trunk/PO_Header.php 2011-04-28 10:39:25 UTC (rev 4557) +++ trunk/PO_Header.php 2011-04-29 12:43:19 UTC (rev 4558) @@ -805,7 +805,7 @@ echo '</select></td></tr>'; echo '<tr><td>' . _('Status Comment') . ':</td> - <td><input type=text name="StatusComments" size=50></td></tr> + <td><input type=text name="StatusComments" size=50></td></tr> <tr><td colspan=2><b>' . $_SESSION['PO'.$identifier]->StatusComments .'</b></td></tr>'; //need to use single quotes as double quotes inside the string of StatusComments echo '<input type="hidden" name="StatusCommentsComplete" value="' . $_SESSION['PO'.$identifier]->StatusComments .'">'; Modified: trunk/SpecialOrder.php =================================================================== --- trunk/SpecialOrder.php 2011-04-28 10:39:25 UTC (rev 4557) +++ trunk/SpecialOrder.php 2011-04-29 12:43:19 UTC (rev 4558) @@ -2,8 +2,6 @@ /* $Id$ */ -//$PageSecurity = 4; - include('includes/DefineSpecialOrderClass.php'); /* Session started in header.inc for password checking and authorisation level check */ include('includes/session.inc'); @@ -13,7 +11,7 @@ include('includes/header.inc'); -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'] . '" />'; @@ -22,15 +20,15 @@ } if (!isset($_SESSION['SupplierID'])){ - echo '<br><br>'; + echo '<br /><br />'; prnMsg(_('To set up a special') . ', ' . _('the supplier must first be selected from the Select Supplier page'),'info'); - echo "<br><a href='$rootpath/SelectSupplier.php?" . SID . "'>" . _('Select the supplier now') . "</a>"; + echo '<br /><a href="' . $rootpath . '/SelectSupplier.php">' . _('Select the supplier now') . '</a>'; include('includes/footer.inc'); exit; } if (!isset($_SESSION['CustomerID']) OR $_SESSION['CustomerID']==""){ - echo "<br><br>" . _('To set up a special') . ', ' . _('the customer must first be selected from the Select Customer page') . "<br><a href='$rootpath/SelectCustomer.php?" . SID . "'>" . _('Select the customer now') . "</a>"; + echo '<br /><br />' . _('To set up a special') . ', ' . _('the customer must first be selected from the Select Customer page') . '<br /><a href="' . $rootpath . '/SelectCustomer.php">' . _('Select the customer now') . '</a>'; include('includes/footer.inc'); exit; } @@ -110,9 +108,9 @@ } echo '<div class="centre">'; if (!isset($_SESSION['SPL']->BranchCode)){ - echo "<br><font size=4 color=BLUE>" . _('Purchase from') . " " . $_SESSION['SPL']->SupplierName . " " . _('in') . " " . $_SESSION['SPL']->SuppCurrCode . " " . _('for') . " " . $_SESSION['SPL']->CustomerName . " (" . $_SESSION['SPL']->CustCurrCode . ")"; + echo '<br /><font size=4 color=blue>' . _('Purchase from') . ' ' . $_SESSION['SPL']->SupplierName . ' ' . _('in') . ' ' . $_SESSION['SPL']->SuppCurrCode . ' ' . _('for') . ' ' . $_SESSION['SPL']->CustomerName . ' (' . $_SESSION['SPL']->CustCurrCode . ')'; } else { - echo '<br><font size=4 color=BLUE>' . _('Purchase from') . ' ' . $_SESSION['SPL']->SupplierName . ' ' . _('in') . ' ' . $_SESSION['SPL']->SuppCurrCode . ' ' . _('for') . ' ' . $_SESSION['SPL']->CustomerName . ' (' . $_SESSION['SPL']->CustCurrCode . ') - ' . _('delivered to') . ' ' . $_SESSION['SPL']->BranchName . ' ' . _('branch'); + echo '<br /><font size=4 color=BLUE>' . _('Purchase from') . ' ' . $_SESSION['SPL']->SupplierName . ' ' . _('in') . ' ' . $_SESSION['SPL']->SuppCurrCode . ' ' . _('for') . ' ' . $_SESSION['SPL']->CustomerName . ' (' . $_SESSION['SPL']->CustCurrCode . ') - ' . _('delivered to') . ' ' . $_SESSION['SPL']->BranchName . ' ' . _('branch'); } echo '</div></font>'; /*if the branch details and delivery details have not been entered then select them from the list */ @@ -127,12 +125,13 @@ If (DB_num_rows($BranchResult)>0) { echo '<div class="centre">'; - echo '<br><br>' . _('Select the customer branch to deliver the special to from the list below'); + echo '<br /><br />' . _('Select the customer branch to deliver the special to from the list below'); - echo '</div><br><table cellpadding=3 colspan=2 BORDER=1>'; + echo '</div><br /><table cellpadding=3 colspan=2 BORDER=1>'; - $tableheader = "<tr><th>" ._('Code') . "</th> - <th>" . _('Branch Name') . "</th></tr>"; + $tableheader = '<tr><th>' ._('Code') . '</th> + <th>' . _('Branch Name') . '</th> + </tr>'; echo $tableheader; $j = 1; @@ -148,7 +147,11 @@ $k++; } - printf("<td><input type=submit name='SelectBranch' VALUE='%s'</td><td>%s</td></tr>", $myrow['branchcode'], $myrow['brname']); + printf('<td><input type="submit" name="SelectBranch" value="%s"</td> + <td>%s</td> + </tr>', + $myrow['branchcode'], + $myrow['brname']); //end of page full new headings if } @@ -189,32 +192,32 @@ if (!is_numeric($_POST['Qty'])){ $AllowAdd = False; - prnMsg( _('Cannot Enter this order line') . '<br>' . _('The quantity of the order item must be numeric'),'warn'); + prnMsg( _('Cannot Enter this order line') . '<br />' . _('The quantity of the order item must be numeric'),'warn'); } if ($_POST['Qty']<0){ $AllowAdd = False; - prnMsg( _('Cannot Enter this order line') . '<br>' . _('The quantity of the ordered item entered must be a positive amount'),'warn'); + prnMsg( _('Cannot Enter this order line') . '<br />' . _('The quantity of the ordered item entered must be a positive amount'),'warn'); } if (!is_numeric($_POST['Price'])){ $AllowAdd = False; - prnMsg( _('Cannot Enter this order line') . '<br>' . _('The price entered must be numeric'),'warn'); + prnMsg( _('Cannot Enter this order line') . '<br />' . _('The price entered must be numeric'),'warn'); } if (!is_numeric($_POST['Cost'])){ $AllowAdd = False; - prnMsg( _('Cannot Enter this order line') . '<br>' . _('The cost entered must be numeric'),'warn'); + prnMsg( _('Cannot Enter this order line') . '<br />' . _('The cost entered must be numeric'),'warn'); } if ((($_POST['Price']/$_SESSION['SPL']->CustCurrExRate)-($_POST['Cost']/$_SESSION['SPL']->SuppCurrExRate))<0){ $AllowAdd = False; - prnMsg( _('Cannot Enter this order line') . '<br>' . _('The sale is at a lower price than the cost'),'warn'); + prnMsg( _('Cannot Enter this order line') . '<br />' . _('The sale is at a lower price than the cost'),'warn'); } if (!Is_Date($_POST['ReqDelDate'])){ $AllowAdd = False; - prnMsg( _('Cannot Enter this order line') . '<br>' . _('The date entered must be in the format') . ' ' . $_SESSION['DefaultDateFormat'],'warn'); + prnMsg( _('Cannot Enter this order line') . '<br />' . _('The date entered must be in the format') . ' ' . $_SESSION['DefaultDateFormat'],'warn'); } If ($AllowAdd == True){ @@ -292,7 +295,7 @@ $sql = $sql . "'" . $_SESSION['SPL']->SupplierID . "', '" . $_SESSION['SPL']->Comments . "', - '" . Date("Y-m-d") . "', + '" . Date('Y-m-d') . "', '" . $_SESSION['SPL']->SuppCurrExRate . "', '" . $_SESSION['SPL']->Initiator . "', '" . $_SESSION['SPL']->QuotationRef . "', @@ -307,11 +310,9 @@ $ErrMsg = _('The purchase order header record could not be inserted into the database because'); - $DbgMsg = _('The SQL statement used to insert the purchase order header record and failed was') . "<br>$sql"; + $DbgMsg = _('The SQL statement used to insert the purchase order header record and failed was') . '<br />' . $sql; $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - /*Get the auto increment value of the order number created from the SQL above */ -// $_SESSION['SPL']->PurchOrderNo = DB_Last_Insert_ID($db,'purchorders','orderno'); $_SESSION['SPL']->PurchOrderNo = GetNextTransNo(18, $db); @@ -355,7 +356,7 @@ $ErrMsg = _('The item record for line') . " " . $SPLLine->LineNo . " " . _('could not be create because'); - $DbgMsg = _('The SQL statement used to insert the item and failed was') . "<br>$sql"; + $DbgMsg = _('The SQL statement used to insert the item and failed was') . "<br />$sql"; $result =DB_query($sql,$db,$ErrMsg,$DbgMsg,true); @@ -397,8 +398,8 @@ } /* end of the loop round the detail line items on the order */ - echo '<br><br>' . _('Purchase Order') . ' ' . $_SESSION['SPL']->PurchOrderNo . ' ' . _('on') . ' ' . $_SESSION['SPL']->SupplierName . ' ' . _('has been created'); - echo "<br><a href='$rootpath/PO_PDFPurchOrder.php?" . SID . '&OrderNo=' . $_SESSION['SPL']->PurchOrderNo . "'>" . _('Print Purchase Order') . '</a>'; + echo '<br /><br />' . _('Purchase Order') . ' ' . $_SESSION['SPL']->PurchOrderNo . ' ' . _('on') . ' ' . $_SESSION['SPL']->SupplierName . ' ' . _('has been created'); + echo '<br /><a href="' . $rootpath . '/PO_PDFPurchOrder.php?OrderNo=' . $_SESSION['SPL']->PurchOrderNo . '">' . _('Print Purchase Order') . '</a>'; /*Now insert the sales order too */ @@ -448,7 +449,7 @@ '" . $_SESSION['SPL']->CustomerID . "', '" . $_SESSION['SPL']->BranchCode . "', '" . $_SESSION['SPL']->CustRef ."', - '" . Date("Y-m-d") . "', + '" . Date('Y-m-d') . "', '" . $BranchDetails['salestype'] . "', '" . $BranchDetails['defaultshipvia'] ."', '" . $BranchDetails['brname'] . "', @@ -466,9 +467,6 @@ $ErrMsg = _('The sales order cannot be added because'); $InsertQryResult = DB_query($HeaderSQL,$db,$ErrMsg, $DbMsg); -// $SalesOrderNo = DB_Last_Insert_ID($db,'salesorders','orderno'); -// $SalesOrderNo = GetNextTransNo(30, $db); - $StartOf_LineItemsSQL = "INSERT INTO salesorderdetails (orderno, stkcode, unitprice, @@ -486,20 +484,20 @@ } /* inserted line items into sales order details */ unset ($_SESSION['SPL']); - prnMsg(_('Sales Order Number') . ' ' . $SalesOrderNo . ' ' . _('has been entered') . '. <p>' . _('Orders created on a cash sales account may need the delivery details for the order to be modified') . '. <br><br>' . _('A freight charge may also be applicable'),'success'); + prnMsg(_('Sales Order Number') . ' ' . $SalesOrderNo . ' ' . _('has been entered') . '. <p>' . _('Orders created on a cash sales account may need the delivery details for the order to be modified') . '. <br /><br />' . _('A freight charge may also be applicable'),'success'); if (count($_SESSION['AllowedPageSecurityTokens'])>1){ /* Only allow print of packing slip for internal staff - customer logon's cannot go here */ - echo "<p><a href='$rootpath/PrintCustOrder.php?" . SID . "&TransNo=" . $SalesOrderNo . "'>" . _('Print packing slip') . ' (' . _('Preprinted stationery') . ')</a>'; - echo "<p><a href='$rootpath/PrintCustOrder_generic.php?" . SID . '&TransNo=' . $SalesOrderNo . "'>" . _('Print packing slip') . ' (' . _('Laser') . ')</a>'; + echo '<p><a href="' . $rootpath . '/PrintCustOrder.php?TransNo=' . $SalesOrderNo . '">' . _('Print packing slip') . ' (' . _('Preprinted stationery') . ')</a>'; + echo '<p><a href="' . $rootpath . '/PrintCustOrder_generic.php?TransNo=' . $SalesOrderNo . '">' . _('Print packing slip') . ' (' . _('Laser') . ')</a>'; } $Result = DB_Txn_Commit($db); unset($_SESSION['SPL']); /*Clear the PO data to allow a newy to be input*/ - echo "<br><br><a href='$rootpath/SpecialOrder.php?" . SID . "'>" . _('Enter A New Special Order') . "</a>"; + echo '<br /><br /><a href="' . $rootpath . '/SpecialOrder.php">' . _('Enter A New Special Order') . '</a>'; exit; } /*end if there were no input errors trapped */ } /* end of the code to do transfer the SPL object to the database - user hit the place Order*/ @@ -507,56 +505,49 @@ /*Show the header information for modification */ -echo "<table><tr><td>" . _('Receive Purchase Into and Sell From') . ": <select name='StkLocation'>"; +echo '<table><tr><td>' . _('Receive Purchase Into and Sell From') . ': <select name="StkLocation">'; $sql = "SELECT loccode, locationname FROM locations"; $LocnResult = DB_query($sql,$db); -if (!isset($_SESSION['SPL']->StkLocation) OR $_SESSION['SPL']->StkLocation==""){ /*If this is the first time the form loaded set up defaults */ +if (!isset($_SESSION['SPL']->StkLocation) OR $_SESSION['SPL']->StkLocation==''){ /*If this is the first time the form loaded set up defaults */ $_SESSION['SPL']->StkLocation = $_SESSION['UserStockLocation']; } while ($LocnRow=DB_fetch_array($LocnResult)){ if ($_SESSION['SPL']->StkLocation == $LocnRow['loccode']){ - echo "<option selected Value='" . $LocnRow['loccode'] . "'>" . $LocnRow['locationname']; + echo '<option selected value="' . $LocnRow['loccode'] . '">' . $LocnRow['locationname'] . '</option>'; } else { - echo "<option Value='" . $LocnRow['loccode'] . "'>" . $LocnRow['locationname']; + echo '<option Value="' . $LocnRow['loccode'] . '">' . $LocnRow['locationname'] . '</option>'; } } -echo "</select></td>"; +echo '</select></td>'; -echo "<td>" . _('Initiated By') . ": <input type=TEXT name='Initiator' size=11 maxlength=10 VALUE=" . $_SESSION['SPL']->Initiator . "></td>"; -echo "<td>" . _('Special Ref') . ": <input type=TEXT name='QuotationRef' size=16 maxlength=15 VALUE=" . $_SESSION['SPL']->QuotationRef . "></td>"; -echo "<td>" . _('Customer Ref') . ": <input type=TEXT name='CustRef' size=11 maxlength=10 VALUE=" . $_SESSION['SPL']->CustRef . "></td></tr>"; +echo '<td>' . _('Initiated By') . ': <input type="text" name="Initiator" size=11 maxlength=10 value="' . $_SESSION['SPL']->Initiator . '"></td> + <td>' . _('Special Ref') . ': <input type="text" name="QuotationRef" size=16 maxlength=15 value="' . $_SESSION['SPL']->QuotationRef . '"></td> + <td>' . _('Customer Ref') . ': <input type="text" name="CustRef" size=11 maxlength=10 value="' . $_SESSION['SPL']->CustRef . '"></td></tr> + <tr><td valign=top colspan=2>' . _('Comments') . ': <textarea name="Comments" cols=70 rows=2>' . $_SESSION['SPL']->Comments . '</textarea></td></tr> +</table> +<hr>'; /* Rule off the header */ -echo "<tr><td VALIGN=TOP colspan=2>" . _('Comments') . ":"; -echo "<textarea name='Comments' cols=70 rows=2>" . $_SESSION['SPL']->Comments . "</textarea></td></tr></table>"; - -echo "<hr>"; /* Rule off the header */ - /*Now show the order so far */ if (count($_SESSION['SPL']->LineItems)>0){ - echo "<div class='centre'>><b>" . _('Special Order Summary') . "</b></div>"; - echo "<table cellpadding=2 colspan=7 border=1>"; + echo '<div class="centre">><b>' . _('Special Order Summary') . '</b></div>'; + echo '<table cellpadding=2 colspan=7 border=1>'; - $sql = 'select currencydefault from companies'; - $result = DB_query($sql, $db); - $myrow = DB_fetch_row($result); - $DefaultCurrency = $myrow[0]; + echo '<tr> + <th>' . _('Item Description') . '</th> + <th>' . _('Delivery') . '</th> + <th>' . _('Quantity') . '</th> + <th>' . _('Purchase Cost') . '<br />' . $_SESSION['SPL']->SuppCurrCode . '</th> + <th>' . _('Sell Price') . '<br />' . $_SESSION['SPL']->CustCurrCode . '</th> + <th>' . _('Total Cost') . '<br />' . $_SESSION['SPL']->SuppCurrCode . '</th> + <th>' . _('Total Price') . '<br />' . $_SESSION['SPL']->CustCurrCode . '</th> + <th>' . _('Total Cost') . '<br />' . $_SESSION['CompanyRecord']['currencydefault'] . '</th> + <th>' . _('Total Price') . '<br />' . $_SESSION['CompanyRecord']['currencydefault'] . '</th> + </tr>'; - echo "<tr> - <th>" . _('Item Description') . "</th> - <th>" . _('Delivery') . "</th> - <th>" . _('Quantity') . "</th> - <th>" . _('Purchase Cost') . '<br>' . $_SESSION['SPL']->SuppCurrCode . "</th> - <th>" . _('Sell Price') . '<br>' . $_SESSION['SPL']->CustCurrCode . "</th> - <th>" . _('Total Cost') . '<br>' . $_SESSION['SPL']->SuppCurrCode . "</th> - <th>" . _('Total Price') . '<br>' . $_SESSION['SPL']->CustCurrCode . "</th> - <th>" . _('Total Cost') . '<br>' . $DefaultCurrency . "</th> - <th>" . _('Total Price') . '<br>' . $DefaultCurrency . "</th> - </tr>"; - $_SESSION['SPL']->total = 0; $k = 0; //row colour counter foreach ($_SESSION['SPL']->LineItems as $SPLLine) { @@ -579,38 +570,41 @@ $k=1; } echo '<td>' . $SPLLine->ItemDescription . '</td> - <td>' . $SPLLine->ReqDelDate . "</td> - <td class=number>$DisplayQuantity</td> - <td class=number>$DisplayCost</td> - <td class=number>$DisplayPrice</td> - <td class=number>$DisplayLineCostTotal</td> - <td class=number>$DisplayLineTotal</td> - <td class=number>$DisplayLineCostTotalCurr</td> - <td class=number>$DisplayLineTotalCurr</td> - <td><a href='" . $_SERVER['PHP_SELF'] . "?" . SID .'&Delete=' . $SPLLine->LineNo . "'>" . _('Delete') . '</a></td></tr>'; + <td>' . $SPLLine->ReqDelDate . '</td> + <td class=number>' . $DisplayQuantity . '</td> + <td class=number>' . $DisplayCost . '</td> + <td class=number>' . $DisplayPrice . '</td> + <td class=number>' . $DisplayLineCostTotal . '</td> + <td class=number>' . $DisplayLineTotal . '</td> + <td class=number>' . $DisplayLineCostTotalCurr . '</td> + <td class=number>' . $DisplayLineTotalCurr . '</td> + <td><a href="' . $_SERVER['PHP_SELF'] . '?Delete=' . $SPLLine->LineNo . '">' . _('Delete') . '</a></td></tr>'; $_SESSION['SPL']->total = $_SESSION['SPL']->total + $DisplayLineTotalCurr; } $DisplayTotal = number_format($_SESSION['SPL']->total,2); echo '<tr> - <td colspan=8 class=number>' . _('TOTAL Excl Tax') . "</td> - <td class=number><b>$DisplayTotal</b></td> - </tr></table>"; + <td colspan=8 class=number>' . _('TOTAL Excl Tax') . '</td> + <td class=number><b>' . $DisplayTotal . '</b></td> + </tr> + </table>'; } /*Set up the form to enter new special items into */ -echo "<table>"; +echo '<table>'; -echo "<input type='hidden' name='LineNo' value=" . ($_SESSION['SPL']->LinesOnOrder + 1) .">"; +echo '<input type="hidden" name="LineNo" value="' . ($_SESSION['SPL']->LinesOnOrder + 1) .'" />'; if (!isset($_POST['ItemDescription'])) {$_POST['ItemDescription']='';} -echo '<tr><td>' . _('Ordered item Description') . ":</td><td><input type=TEXT name='ItemDescription' size=40 maxlength=40 VALUE='" . $_POST['ItemDescription'] . "'></td></tr>"; +echo '<tr><td>' . _('Ordered item Description') . ':</td> + <td><input type="text" name="ItemDescription" size=40 maxlength=40 value="' . $_POST['ItemDescription'] . '"></td></tr>'; -echo '<tr><td>' . _('Category') . ':</td><td><select name=StkCat>'; +echo '<tr><td>' . _('Category') . ':</td> + <td><select name=StkCat>'; $sql = "SELECT categoryid, categorydescription FROM stockcategory"; $ErrMsg = _('The stock categories could not be retrieved because'); @@ -619,9 +613,9 @@ while ($myrow=DB_fetch_array($result)){ if (isset($_POST['StkCat']) and $myrow['categoryid']==$_POST['StkCat']){ - 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>'; } } echo '</select></td></tr>'; @@ -630,30 +624,31 @@ /*default the order quantity to 1 unit */ $_POST['Qty'] = 1; -echo '<tr><td>' . _('Order Quantity') . ":</td> - <td><input type='Text' class='number' size=7 maxlength=6 name='Qty' value=" . $_POST['Qty'] . "></td></tr>"; +echo '<tr><td>' . _('Order Quantity') . ':</td> + <td><input type="text" class="number" size=7 maxlength=6 name="Qty" value="' . $_POST['Qty'] . '"></td> + </tr>'; if (!isset($_POST['Cost'])) {$_POST['Cost']='';} -echo '<tr><td>' . _('Unit Cost') . ":</td> - <td><input type='Text' class='number' size=15 maxlength=14 name='Cost' value=" . $_POST['Cost'] . "></td></tr>"; +echo '<tr><td>' . _('Unit Cost') . ':</td> + <td><input type="text" class="number" size=15 maxlength=14 name="Cost" value="' . $_POST['Cost'] . '"></td></tr>'; if (!isset($_POST['Price'])) { $_POST['Price']='';} -echo '<tr><td>' . _('Unit Price') . ":</td> - <td><input type='Text' class='number' size=15 maxlength=14 name='Price' value=" . $_POST['Price'] . "></td></tr>"; +echo '<tr><td>' . _('Unit Price') . ':</td> + <td><input type="text" class="number" size=15 maxlength=14 name="Price" value="' . $_POST['Price'] . '"></td></tr>'; /*Default the required delivery date to tomorrow as a starting point */ $_POST['ReqDelDate'] = Date($_SESSION['DefaultDateFormat'],Mktime(0,0,0,Date('m'),Date('d')+1,Date('y'))); -echo '<tr><td>' . _('Required Delivery Date') . ":</td> - <td><input type='Text' class='date' alt='".$_SESSION['DefaultDateFormat']."' size=12 maxlength=11 name='ReqDelDate' value=" . $_POST['ReqDelDate'] . "></td></tr>"; +echo '<tr><td>' . _('Required Delivery Date') . ':</td> + <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" size=12 maxlength=11 name="ReqDelDate" value="' . $_POST['ReqDelDate'] . '"></td></tr>'; echo '</table>'; /* end of main table */ -echo "<div class='centre'><input type=submit Name='EnterLine' VALUE='" . _('Add Item to Order') . "'>"; +echo '<div class="centre"><input type="submit" name="EnterLine" value="' . _('Add Item to Order') . '">'; -echo "<br><br><input type=submit Name='Cancel' VALUE='" . _('Start Again') . "'>"; -echo "<br><br><input type=submit Name='Commit' VALUE='" . _('Process This Order') . "'>"; +echo '<br /><br /><input type="submit" name="Cancel" value="' . _('Start Again') . '">'; +echo '<br /><br /><input type="submit" name="Commit" value="' . _('Process This Order') . '">'; echo '</div></form>'; include('includes/footer.inc'); Modified: trunk/StockCostUpdate.php =================================================================== --- trunk/StockCostUpdate.php 2011-04-28 10:39:25 UTC (rev 4557) +++ trunk/StockCostUpdate.php 2011-04-29 12:43:19 UTC (rev 4558) @@ -15,7 +15,7 @@ $StockID =trim(strtoupper($_POST['StockID'])); } -echo '<a href="' . $rootpath . '/SelectProduct.php?' . SID . '">' . _('Back to Items') . '</a><br>'; +echo '<a href="' . $rootpath . '/SelectProduct.php">' . _('Back to Items') . '</a><br>'; echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . _('Inventory Adjustment') . '" alt="" />' . ' ' . $title . '</p>'; @@ -23,21 +23,21 @@ if (isset($_POST['UpdateData'])){ $sql = "SELECT materialcost, - labourcost, - overheadcost, - mbflag, - sum(quantity) as totalqoh - FROM stockmaster INNER JOIN locstock - ON stockmaster.stockid=locstock.stockid - WHERE stockmaster.stockid='".$StockID."' - GROUP BY description, - units, - lastcost, - actualcost, - materialcost, - labourcost, - overheadcost, - mbflag"; + labourcost, + overheadcost, + mbflag, + sum(quantity) as totalqoh + FROM stockmaster INNER JOIN locstock + ON stockmaster.stockid=locstock.stockid + WHERE stockmaster.stockid='".$StockID."' + GROUP BY description, + units, + lastcost, + actualcost, + materialcost, + labourcost, + overheadcost, + mbflag"; $ErrMsg = _('The entered item code does not exist'); $OldResult = DB_query($sql,$db,$ErrMsg); $OldRow = DB_fetch_array($OldResult); @@ -66,12 +66,11 @@ $Result = DB_Txn_Begin($db); ItemCostUpdateGL($db, $StockID, $NewCost, $OldCost, $_POST['QOH']); - $SQL = "UPDATE stockmaster SET - materialcost='" . $_POST['MaterialCost'] . "', - labourcost='" . $_POST['LabourCost'] . "', - overheadcost='" . $_POST['OverheadCost'] . "', - lastcost='" . $OldCost . "' - WHERE stockid='" . $StockID . "'"; + $SQL = "UPDATE stockmaster SET materialcost='" . $_POST['MaterialCost'] . "', + labourcost='" . $_POST['LabourCost'] . "', + overheadcost='" . $_POST['OverheadCost'] . "', + lastcost='" . $OldCost . "' + WHERE stockid='" . $StockID . "'"; $ErrMsg = _('The cost details for the stock item could not be updated because'); $DbgMsg = _('The SQL that failed was'); @@ -87,30 +86,30 @@ $DbgMsg = _('The SQL that failed was'); $result = DB_query("SELECT description, - units, - lastcost, - actualcost, - materialcost, - labourcost, - overheadcost, - mbflag, - stocktype, - sum(quantity) as totalqoh - FROM stockmaster INNER JOIN locstock - ON stockmaster.stockid=locstock.stockid - INNER JOIN stockcategory - ON stockmaster.categoryid = stockcategory.categoryid - WHERE stockmaster.stockid='" . $StockID . "' - GROUP BY description, - units, - lastcost, - actualcost, - materialcost, - labourcost, - overheadcost, - mbflag, - stocktype", - $db,$ErrMsg,$DbgMsg); + units, + lastcost, + actualcost, + materialcost, + labourcost, + overheadcost, + mbflag, + stocktype, + sum(quantity) as totalqoh + FROM stockmaster INNER JOIN locstock + ON stockmaster.stockid=locstock.stockid + INNER JOIN stockcategory + ON stockmaster.categoryid = stockcategory.categoryid + WHERE stockmaster.stockid='" . $StockID . "' + GROUP BY description, + units, + lastcost, + actualcost, + materialcost, + labourcost, + overheadcost, + mbflag, + stocktype", + $db,$ErrMsg,$DbgMsg); $myrow = DB_fetch_array($result); @@ -125,8 +124,8 @@ echo '<tr><th colspan=2><font color=navy size=2>'. _('Total Quantity On Hand') . ': ' . $myrow['totalqoh'] . ' ' . $myrow['units'] .'</font></th></tr>'; if (($myrow['mbflag']=='D' AND $myrow['stocktype'] != 'L') - OR $myrow['mbflag']=='A' - OR $myrow['mbflag']=='K'){ + OR $myrow['mbflag']=='A' + OR $myrow['mbflag']=='K'){ echo '</form>'; // Close the form if ($myrow['mbflag']=='D'){ echo '<br>' . $StockID .' ' . _('is a service item'); @@ -164,11 +163,11 @@ echo '</table><br /><div class="centre"><input type="submit" name="UpdateData" VALUE="' . _('Update') . '"><br /><br />'; } if ($myrow['mbflag']!='D'){ - echo '<div class="centre"><a href="' . $rootpath . '/StockStatus.php?' . SID . '&StockID=' . $StockID . '>' . _('Show Stock Status') . '</a>'; - echo '<br><a href="' . $rootpath . '/StockMovements.php?' . SID . '&StockID=' . $StockID . '">' . _('Show Stock Movements') . '</a>'; - echo '<br><a href="' . $rootpath . '/StockUsage.php?' . SID . '&StockID=' . $StockID . '">' . _('Show Stock Usage') .'</a>'; - echo '<br><a href="' . $rootpath . '/SelectSalesOrder.php?' . SID . '&SelectedStockItem=' . $StockID . '">' . _('Search Outstanding Sales Orders') . '</a>'; - echo '<br><a href="' . $rootpath . '/SelectCompletedOrder.php?' . SID . '&SelectedStockItem=' . $StockID . '">' . _('Search Completed Sales Orders') . '</a></div>'; + echo '<div class="centre"><a href="' . $rootpath . '/StockStatus.php?StockID=' . $StockID . '>' . _('Show Stock Status') . '</a>'; + echo '<br><a href="' . $rootpath . '/StockMovements.php?StockID=' . $StockID . '">' . _('Show Stock Movements') . '</a>'; + echo '<br><a href="' . $rootpath . '/StockUsage.php?StockID=' . $StockID . '">' . _('Show Stock Usage') .'</a>'; + echo '<br><a href="' . $rootpath . '/SelectSalesOrder.php?SelectedStockItem=' . $StockID . '">' . _('Search Outstanding Sales Orders') . '</a>'; + echo '<br><a href="' . $rootpath . '/SelectCompletedOrder.php?SelectedStockItem=' . $StockID . '">' . _('Search Completed Sales Orders') . '</a></div>'; } echo '</form></div>'; include('includes/footer.inc'); Modified: trunk/StockLocMovements.php =================================================================== --- trunk/StockLocMovements.php 2011-04-28 10:39:25 UTC (rev 4557) +++ trunk/StockLocMovements.php 2011-04-29 12:43:19 UTC (rev 4558) @@ -1,15 +1,13 @@ <?php /* $Id$*/ -//$PageSecurity = 2; - include('includes/session.inc'); $title = _('All Stock Movements By Location'); include('includes/header.inc'); -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 '<p class="page_title_text"><img src="' . $rootpath . '/css/' . $theme . '/images/magnifier.png" title="' . _('Search') . @@ -18,20 +16,20 @@ echo '<table class=selection><tr><td>'; echo ' ' . _('From Stock Location') . ':<select name="StockLocation"> '; -$sql = 'SELECT loccode, locationname FROM locations'; +$sql = "SELECT loccode, locationname FROM locations"; $resultStkLocs = DB_query($sql,$db); while ($myrow=DB_fetch_array($resultStkLocs)){ if (isset($_POST['StockLocation']) AND $_POST['StockLocation']!='All'){ if ($myrow['loccode'] == $_POST['StockLocation']){ - echo '<option selected Value="' . $myrow['loccode'] . '">' . $myrow['locationname']; + echo '<option selected Value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } else { - echo '<option Value="' . $myrow['loccode'] . '">' . $myrow['locationname']; + echo '<option Value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } } elseif ($myrow['loccode']==$_SESSION['UserStockLocation']){ - echo '<option selected Value="' . $myrow['loccode'] . '">' . $myrow['locationname']; + echo '<option selected Value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; $_POST['StockLocation']=$myrow['loccode']; } else { - echo '<option Value="' . $myrow['loccode'] . '">' . $myrow['locationname']; + echo '<option Value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } } @@ -43,7 +41,7 @@ if (!isset($_POST['AfterDate']) OR !Is_Date($_POST['AfterDate'])){ $_POST['AfterDate'] = Date($_SESSION['DefaultDateFormat'], Mktime(0,0,0,Date('m')-1,Date('d'),Date('y'))); } -echo ' ' . _('Show Movements before') . ': <input type=TEXT name="BeforeDate" size=12 maxlength=12 Value="' . $_POST['BeforeDate'] . '">'; +echo ' ' . _('Show Movements before') . ': <input type="text" name="BeforeDate" size=12 maxlength=12 Value="' . $_POST['BeforeDate'] . '">'; echo ' ' . _('But after') . ': <input type=TEXT name="AfterDate" size=12 maxlength=12 Value="' . $_POST['AfterDate'] . '">'; echo '</td></tr></table><br>'; echo '<div class=centre><input type=submit name="ShowMoves" VALUE="' . _('Show Stock Movements') . '"></div><br>'; @@ -77,7 +75,7 @@ $ErrMsg = _('The stock movements for the selected criteria could not be retrieved because'); $MovtsResult = DB_query($sql, $db,$ErrMsg); -echo '<table cellpadding=5 CELLSPACING=4 class=selection>'; +echo '<table cellpadding=5 cellspacing="4 "class="selection">'; $tableheader = '<tr> <th>' . _('Item Code') . '</th> <th>' . _('Type') . '</th> @@ -108,29 +106,29 @@ $DisplayTranDate = ConvertSQLDate($myrow['trandate']); - printf("<td><a target='_blank' href='StockStatus.php?" . SID . "&StockID=%s'>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td class=number>%s</td> - <td>%s</td> - <td class=number>%s</td> - <td class=number>%s</td> - <td class=number>%s</td> - </tr>", - strtoupper($myrow['stockid']), - strtoupper($myrow['stockid']), - $myrow['typename'], - $myrow['transno'], - $DisplayTranDate, - $myrow['debtorno'], - number_format($myrow['qty'], - $myrow['decimalplaces']), - $myrow['reference'], - number_format($myrow['price'],2), - number_format($myrow['discountpercent']*100,2), - number_format($myrow['newqoh'],$myrow['decimalplaces'])); + printf('<td><a target="_blank" href="' . $rootpath . '/StockStatus.php?StockID=%s">%s</td> + <td>%s</td> + <td>%s</td> + <td>%s</td> + <td>%s</td> + <td class=number>%s</td> + <td>%s</td> + <td class=number>%s</td> + <td class=number>%s</td> + <td class=number>%s</td> + </tr>', + strtoupper($myrow['stockid']), + strtoupper($myrow['stockid']), + $myrow['typename'], + $myrow['transno'], + $DisplayTranDate, + $myrow['debtorno'], + number_format($myrow['qty'], + $myrow['decimalplaces']), + $myrow['reference'], + number_format($myrow['price'],$_SESSION['CompanyRecord']['decimalplaces']), + number_format($myrow['discountpercent']*100,2), + number_format($myrow['newqoh'],$myrow['decimalplaces'])); $j++; If ($j == 16){ $j=1; Modified: trunk/StockLocStatus.php =================================================================== --- trunk/StockLocStatus.php 2011-04-28 10:39:25 UTC (rev 4557) +++ trunk/StockLocStatus.php 2011-04-29 12:43:19 UTC (rev 4558) @@ -1,8 +1,7 @@ <?php + /* $Id$*/ -//$PageSecurity = 2; - include('includes/session.inc'); $title = _('All Stock Status By Location/Category'); @@ -16,7 +15,7 @@ } -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'] . '" />'; $sql = "SELECT loccode, @@ -27,7 +26,9 @@ echo '<p class="page_title_text"><img src="' . $rootpath . '/css/' . $theme . '/images/magnifier.png" title="' . _('Search') . '" alt="" />' . ' ' . $title.'</p>'; -echo '<table class=selection><tr><td>' . _('From Stock Location') . ':</td><td><select name="StockLocation"> '; +echo '<table class=selection> + <tr><td>' . _('From Stock Location') . ':</td> + <td><select name="StockLocation"> '; while ($myrow=DB_fetch_array($resultStkLocs)){ if (isset($_POST['StockLocation']) AND $_POST['StockLocation']!='All'){ if ($myrow['loccode'] == $_POST['StockLocation']){ @@ -44,17 +45,21 @@ } echo '</select></td></tr>'; -$SQL='SELECT categoryid, categorydescription FROM stockcategory ORDER BY categorydescription'; +$SQL="SELECT categoryid, + categorydescription + FROM stockcategory + ORDER BY categorydescription"; $result1 = DB_query($SQL,$db); if (DB_num_rows($result1)==0){ echo '</table><p>'; prnMsg(_('There are no stock categories currently defined please use the link below to set them up'),'warn'); - echo '<br><a href="' . $rootpath . '/StockCategories.php?' . SID .'">' . _('Define Stock Categories') . '</a>'; + echo '<br /><a href="' . $rootpath . '/StockCategories.php">' . _('Define Stock Categories') . '</a>'; include ('includes/footer.inc'); exit; } -echo '<tr><td>' . _('In Stock Category') . ':</td><td><select name="StockCat">'; +echo '<tr><td>' . _('In Stock Category') . ':</td> + <td><select name="StockCat">'; if (!isset($_POST['StockCat'])){ $_POST['StockCat']='All'; } @@ -73,8 +78,8 @@ echo '</select></td></tr>'; - -echo '<tr><td>' . _('Shown Only Items Where') . ':</td><td><select name="BelowReorderQuantity">'; +echo '<tr><td>' . _('Shown Only Items Where') . ':</td> + <td><select name="BelowReorderQuantity">'; if (!isset($_POST['BelowReorderQuantity'])){ $_POST['BelowReorderQuantity']='All'; } @@ -94,7 +99,7 @@ echo '</td></tr></table>'; -echo '<br><div class="centre"><input type=submit name="ShowStatus" value="' . _('Show Stock Status') . '"></div>'; +echo '<br /><div class="centre"><input type=submit name="ShowStatus" value="' . _('Show Stock Status') . '"></div>'; if (isset($_POST['ShowStatus'])){ @@ -142,7 +147,7 @@ $DbgMsg = _('The SQL that failed was'); $LocStockResult = DB_query($sql, $db, $ErrMsg, $DbgMsg); - echo '<br><table cellpadding=5 cellspacing=4 class=selection>'; + echo '<br /><table cellpadding=5 cellspacing=4 class="selection">'; $tableheader = '<tr> <th>' . _('StockID') . '</th> @@ -161,7 +166,7 @@ $StockID = $myrow['stockid']; - $sql = "SELECT Sum(salesorderdetails.quantity-salesorderdetails.qtyinvoiced) AS dem + $sql = "SELECT SUM(salesorderdetails.quantity-salesorderdetails.qtyinvoiced) AS dem FROM salesorderdetails, salesorders WHERE salesorders.orderno = salesorderdetails.orderno @@ -181,17 +186,17 @@ //Also need to add in the demand as a component of an assembly items if this items has any assembly parents. $sql = "SELECT Sum((salesorderdetails.quantity-salesorderdetails.qtyinvoiced)*bom.quantity) AS dem - FROM salesorderdetails, - salesorders, - bom, - stockmaster - WHERE salesorderdetails.stkcode=bom.parent - AND salesorders.orderno = salesorderdetails.orderno - AND salesorders.fromstkloc='" . $myrow['loccode'] . "' - AND salesorderdetails.quantity-salesorderdetails.qtyinvoiced > 0 - AND bom.component='" . $StockID . "' - AND stockmaster.stockid=bom.parent - AND stockmaster.mbflag='A'"; + FROM salesorderdetails, + salesorders, + bom, + stockmaster + WHERE salesorderdetails.stkcode=bom.parent + AND salesorders.orderno = salesorderdetails.orderno + AND salesorders.fromstkloc='" . $myrow['loccode'] . "' + AND salesorderdetails.quantity-salesorderdetails.qtyinvoiced > 0 + AND bom.component='" . $StockID . "' + AND stockmaster.stockid=bom.parent + AND stockmaster.mbflag='A'"; $ErrMsg = _('The demand for this product from') . ' ' . $myrow['loccode'] . ' ' . _('cannot be retrieved because'); $DemandResult = DB_query($sql,$db, $ErrMsg); @@ -201,12 +206,12 @@ $DemandQty += $DemandRow[0]; } $sql = "SELECT SUM((woitems.qtyreqd-woitems.qtyrecd)*bom.quantity) AS dem - FROM workorders, woitems, bom - WHERE woitems.wo = workorders.wo - AND woitems.stockid = bom.parent - AND workorders.closed=0 - AND bom.component = '". $StockID . "' - AND workorders.loccode='". $myrow['loccode'] ."'"; + FROM workorders, woitems, bom + WHERE woitems.wo = workorders.wo + AND woitems.stockid = bom.parent + AND workorders.closed=0 + AND bom.component = '". $StockID . "' + AND workorders.loccode='". $myrow['loccode'] ."'"; $DemandResult = DB_query($sql,$db, $ErrMsg); if (DB_num_rows($DemandResult)==1){ @@ -215,19 +220,15 @@ } - $sql = "SELECT SUM(purchorderdetails.quantityord*(CASE WHEN purchdata.conversionfactor IS NULL THEN 1 ELSE purchdata.conversionfactor END) - - purchorderdetails.quantityrecd*(CASE WHEN purchdata.conversionfactor IS NULL THEN 1 ELSE purchdata.conversionfactor END)) AS qoo - FROM purchorderdetails - INNER JOIN purchorders - ON purchorderdetails.orderno=purchorders.orderno - LEFT JOIN purchdata - ON purchorders.supplierno=purchdata.supplierno - AND purchorderdetails.itemcode=purchdata.stockid - WHERE purchorders.intostocklocation='" . $myrow['loccode'] . "' - AND purchorderdetails.itemcode='" . $StockID . "' - AND purchorders.status <> 'Cancelled' - AND purchorders.status <> 'Rejected' - AND purchorders.status <> 'Pending'"; + $sql = "SELECT SUM(purchorderdetails.quantityord - purchorderdetails.quantityrecd) AS qoo + FROM purchorderdetails + INNER JOIN purchorders + ON purchorderdetails.orderno=purchorders.orderno + WHERE purchorders.intostocklocation='" . $myrow['loccode'] . "' + AND purchorderdetails.itemcode='" . $StockID . "' + AND purchorders.status <> 'Cancelled' + AND purchorders.status <> 'Rejected' + AND purchorders.status <> 'Pending'"; $ErrMsg = _('The quantity on order for this product to be received into') . ' ' . $myrow['loccode'] . ' ' . _('cannot be retrieved because'); $QOOResult = DB_query($sql,$db,$ErrMsg); @@ -251,27 +252,29 @@ echo '<tr class="EvenTableRows">'; $k=1; } - printf("<td><a target='_blank' href='StockStatus.php?StockID=%s'>%s</a></td> + printf('<td><a target="_blank" href="' . $rootpath . '/StockStatus.php?StockID=%s">%s</a></td> <td>%s</td> <td class=number>%s</td> <td class=number>%s</td> <td class=number>%s</td> - <td class=number><a target='_blank' href='SelectProduct.php?StockID=%s'>%s</a></td> - <td class=number>%s</td></tr>", + <td class=number><a target="_blank" href="' . $rootpath . 'SelectProduct.php?StockID=%s">%s</a></td> + <td class=number>%s</td> + </tr>', strtoupper($myrow['stockid']), strtoupper($myrow['stockid']), $myrow['description'], number_format($myrow['quantity'],$myrow['decimalplaces']), number_format($myrow['reorderlevel'],$myrow['decimalplaces']), number_format($DemandQty,$myrow['decimalplaces']), - strtoupper($myrow['stockid']), + strtoupper($myrow['stockid']), number_format($myrow['quantity'] - $DemandQty,$myrow['decimalplaces']), number_format($QOO,$myrow['decimalplaces'])); + if ($myrow['serialised'] ==1){ /*The line is a serialised item*/ - echo '<td><a target="_blank" href="' . $rootpath . '/StockSerialItems.php?' . SID . '&Serialised=Yes&Location=' . $myrow['loccode'] . '&StockID=' . $StockID . '">' . _('Serial Numbers') . '</a></td></tr>'; + echo '<td><a target="_blank" href="' . $rootpath . '/StockSerialItems.php?Serialised=Yes&Location=' . $myrow['loccode'] . '&StockID=' . $StockID . '">' . _('Serial Numbers') . '</a></td></tr>'; } elseif ($myrow['controlled']==1){ - echo '<td><a target="_blank" href="' . $rootpath . '/StockSerialItems.php?' . SID . '&Location=' . $myrow['loccode'] . '&StockID=' . $StockID . '">' . _('Batches') . '</a></td></tr>'; + echo '<td><a target="_blank" href="' . $rootpath . '/StockSerialItems.php?Location=' . $myrow['loccode'] . '&StockID=' . $StockID . '">' . _('Batches') . '</a></td></tr>'; } } else if ($_POST['BelowReorderQuantity']!='NotZero') { if ($k==1){ @@ -281,13 +284,13 @@ echo '<tr class="EvenTableRows">'; $k=1; } - printf("<td><a target='_blank' href='StockStatus.php?StockID=%s'>%s</a></td> + printf('<td><a target="_blank" href="' . $rootpath . '/StockStatus.php?StockID=%s">%s</a></td> <td>%s</td> <td class=number>%s</td> <td class=number>%s</td> <td class=number>%s</td> - <td class=number><a target='_blank' href='SelectProduct.php?StockID=%s'>%s</a></td> - <td class=number>%s</td>", + <td class=number><a target="_blank" href="' . $rootpath . 'SelectProduct.php?StockID=%s">%s</a></td> + <td class=number>%s</td>', strtoupper($myrow['stockid']), strtoupper($myrow['stockid']), $myrow['description'], Modified: trunk/StockMovements.php =================================================================== --- trunk/StockMovements.php 2011-04-28 10:39:25 UTC (rev 4557) +++ trunk/StockMovements.php 2011-04-29 12:43:19 UTC (rev 4558) @@ -2,13 +2,10 @@ /* $Id$*/ -//$PageSecurity = 2; - include('includes/session.inc'); $title = _('Stock Movements'); include('includes/header.inc'); - if (isset($_GET['StockID'])){ $StockID = trim(strtoupper($_GET['StockID'])); } elseif (isset($_POST['StockID'])){ @@ -17,50 +14,46 @@ $StockID = ''; } - -// This is already linked from this page -//echo "<a href='" . $rootpath . '/SelectProduct.php?' . SID . "'>" . _('Back to Items') . '</a><br>'; - $result = DB_query("SELECT description, units FROM stockmaster WHERE stockid='".$StockID."'",$db); $myrow = DB_fetch_row($result); echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/inventory.png" title="' . _('Inventory') . '" alt="" /><b>' . ' ' . $StockID . ' - ' . $myrow['0'] . ' : ' . _('in units of') . ' : ' . $myrow[1] . '</b></p>'; -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'] . '" />'; if (!isset($_POST['BeforeDate']) OR !Is_Date($_POST['BeforeDate'])){ $_POST['BeforeDate'] = Date($_SESSION['DefaultDateFormat']); } if (!isset($_POST['AfterDate']) OR !Is_Date($_POST['AfterDate'])){ - $_POST['AfterDate'] = Date($_SESSION['DefaultDateFormat'], Mktime(0,0,0,Date("m")-3,Date("d"),Date("y"))); + $_POST['AfterDate'] = Date($_SESSION['DefaultDateFormat'], Mktime(0,0,0,Date('m')-3,Date('d'),Date('y'))); } echo '<br /><table cellpadding=2 class=selection>'; -echo '<tr><th colspan=10>' . _('Stock Code') . ":<input type=TEXT name='StockID' size=21 VALUE='$StockID' maxlength=20>"; +echo '<tr><th colspan=10>' . _('Stock Code') . ':<input type="text" name="StockID" size=21 value="' . $StockID . '" maxlength=20>'; -echo ' ' . _('From Stock Location') . ":<select name='StockLocation'> "; +echo ' ' . _('From Stock Location') . ':<select name="StockLocation"> '; -$sql = 'SELECT loccode, locationname FROM locations'; +$sql = "SELECT loccode, locationname FROM locations"; $resultStkLocs = DB_query($sql,$db); while ($myrow=DB_fetch_array($resultStkLocs)){ if (isset($_POST['StockLocation']) AND $_POST['StockLocation']!='All'){ if ($myrow['loccode'] == $_POST['StockLocation']){ - echo "<option selected VALUE='" . $myrow['loccode'] . "'>" . $myrow['locationname']; + echo '<option selected value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } else { - echo "<option VALUE='" . $myrow['loccode'] . "'>" . $myrow['locationname']; + echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } } elseif ($myrow['loccode']==$_SESSION['UserStockLocation']){ - echo "<option selected VALUE='" . $myrow['loccode'] . "'>" . $myrow['locationname']; + echo '<option selected value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; $_POST['StockLocation']=$myrow['loccode']; } else { - echo "<option VALUE='" . $myrow['loccode'] . "'>" . $myrow['locationname']; + echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } } echo '</select></th></tr>'; echo '<tr><th colspan=10>' . _('Show Movements before') . ': <input type=text name="BeforeDate" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" size="12" maxlength="12" VALUE="' . $_POST['BeforeDate'] . '">'; echo ' ' . _('But after') . ': <input type=TEXT name="AfterDate" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" size="12" maxlength="12" VALUE="' . $_POST['AfterDate'] . '">'; -echo " <input type=submit name='ShowMoves' VALUE='" . _('Show Stock Movements') . "'></th></tr>"; +echo ' <input type="submit" name="ShowMoves" value="' . _('Show Stock Movements') . '"></th></tr>'; $SQLBeforeDate = FormatDateForSQL($_POST['BeforeDate']); $SQLAfterDate = FormatDateForSQL($_POST['AfterDate']); @@ -93,14 +86,19 @@ $MovtsResult = DB_query($sql, $db, $ErrMsg, $DbgMsg); -$tableheader = "<tr> - <th>" . _('Type') . "</th><th>" . _('Number') . "</th> - <th>" . _('Date') . "</th><th>" . _('Customer') . "</th> - <th>" . _('Branch') . "</th><th>" . _('Quantity') . "</th> - <th>" . _('Reference') . "</th><th>" . _('Price') . "</th> - <th>" . _('Discount') . "</th><th>" . _('New Qty') . "</th> - </tr>"; - +$tableheader = '<tr> + <th>' . _('Type') . '</th> + <th>' . _('Number') . '</th> + <th>' . _('Date') . '</th> + <th>' . _('Customer') . '</th> + <th>' . _('Branch') . '</th> + <th>' . _('Quantity') . '</th> + <th>' . _('Reference') . '</th> + <th>' . _('Price') . '</th> + <th>' . _('Discount') . '</th> + <th>' . _('New Qty') . '</th> + </tr>'; + echo $tableheader; $j = 1; @@ -120,61 +118,59 @@ if ($myrow['type']==10){ /*its a sales invoice allow link to show invoice it was sold on*/ - printf("<td><a TARGET='_blank' href='%s/PrintCustTrans.php?%s&FromTransNo=%s&InvOrCredit=Invoice'>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td class=number>%s</td> - <td>%s</td> - <td class=number>%s</td> - <td class=number>%s%%</td> - <td class=number>%s</td> - </tr>", - $rootpath, - SID, - $myrow['transno'], - $myrow['typename'], - $myrow['transno'], - $DisplayTranDate, - $myrow['debtorno'], - $myrow['branchcode'], - number_format($myrow['qty'], - $myrow['decimalplaces']), - $myrow['reference'], - number_format($myrow['price'],2), - number_format($myrow['discountpercent']*100,2), - number_format($myrow['newqoh'],$myrow['decimalplaces'])); + printf('<td><a target="_blank" href="%s/PrintCustTrans.php?FromTransNo=%s&InvOrCredit=Invoice">%s</td> + <td>%s</td> + <td>%s</td> + <td>%s</td> + <td>%s</td> + <td class=number>%s</td> + <td>%s</td> + <td class=number>%s</td> + <td class=number>%s%%</td> + <td class=number>%s</td> + </tr>', + $rootpath, + $myrow['transno'], + $myrow['typename'], + $myrow['transno'], + $DisplayTranDate, + $myrow['debtorno'], + $myrow['branchcode'], + number_format($myrow['qty'], + $myrow['decimalplaces']), + $myrow['reference'], + number_format($myrow['price'],2), + number_format($myrow['discountpercent']*100,2), + number_format($myrow['newqoh'],$myrow['decimalplaces'])); } elseif ($myrow['type']==11){ - printf("<td><a TARGET='_blank' href='%s/PrintCustTrans.php?%s&FromTransNo=%s&InvOrCredit=Credit'>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td class=number>%s</td> - <td>%s</td> - <td class=number>%s</td> - <td class=number>%s%%</td> - <td class=number>%s</td> - </tr>", - $rootpath, - SID, - $myrow['transno'], - $myrow['typename'], - $myrow['transno'], - $DisplayTranDate, - $myrow['debtorno'], - $myrow['branchcode'], - number_format($myrow['qty'],$myrow['decimalplaces']), - $myrow['reference'], - number_format($myrow['price'],2), - number_format($myrow['discountpercent']*100,2), - number_format($myrow['newqoh'],$myrow['decimalplaces'])); + printf('<td><a target="_blank" href="%s/PrintCustTrans.php?FromTransNo=%s&InvOrCredit=Credit">%s</td> + <td>%s</td> + <td>%s</td> + <td>%s</td> + <td>%s</td> + <td class=number>%s</td> + <td>%s</td> + <td class=number>%s</td> + <td class=number>%s%%</td> + <td class=number>%s</td> + </tr>', + $rootpath, + $myrow['transno'], + $myrow['typename'], + $myrow['transno'], + $DisplayTranDate, + $myrow['debtorno'], + $myrow['branchcode'], + number_format($myrow['qty'],$myrow['decimalplaces']), + $myrow['reference'], + number_format($myrow['price'],$_SESSION['CompanyRecord']['decimalplaces']), + number_format($myrow['discountpercent']*100,2), + number_format($myrow['newqoh'],$myrow['decimalplaces'])); } else { - printf("<td>%s</td> + printf('<td>%s</td> <td>%s</td> <td>%s</td> <td>%s</td> @@ -184,7 +180,7 @@ <td class=number>%s</td> <td class=number>%s%%</td> <td class=number>%s</td> - </tr>", + </tr>', $myrow['typename'], $myrow['transno'], $DisplayTranDate, @@ -192,7 +188,7 @@ $myrow['branchcode'], number_format($myrow['qty'],$myrow['decimalplaces']), $myrow['reference'], - number_format($myrow['price'],2), + number_format($myrow['price'],$_SESSION['CompanyRecord']['decimalplaces']), number_format($myrow['discountpercent']*100,2), number_format($myrow['newqoh'],$myrow['decimalplaces'])); } @@ -201,10 +197,10 @@ //end of while loop echo '</table>'; -echo "<div class=centre><br /><a href='$rootpath/StockStatus.php?" . SID . "&StockID=$StockID'>" . _('Show Stock Status') . '</a>'; -echo "<br><a href='$rootpath/StockUsage.php?" . SID . "&StockID=$StockID&StockLocation=" . $_POST['StockLocation'] . "'>" . _('Show Stock Usage') . '</a>'; -echo "<br><a href='$rootpath/SelectSalesOrder.php?" . SID . "&SelectedStockItem=$StockID&StockLocation=" . $_POST['StockLocation'] . "'>" . _('Search Outstanding Sales Orders') . '</a>'; -echo "<br><a href='$rootpath/SelectCompletedOrder.php?" . SID . "&SelectedStockItem=$StockID'>" . _('Search Completed Sales Orders') . '</a>'; +echo '<div class="centre"><br /><a href="' . $rootpath . '/StockStatus.php?StockID=' . $StockID . '">' . _('Show Stock Status') . '</a>'; +echo '<br /><a href="' . $rootpath . '/StockUsage.php?StockID=' . $StockID . '&StockLocation=' . $_POST['StockLocation'] . '">' . _('Show Stock Usage') . '</a>'; +echo '<br /><a href="' . $rootpath . '/SelectSalesOrder.php?SelectedStockItem=' . $StockID . '&StockLocation=' . $_POST['StockLocation'] . '">' . _('Search Outstanding Sales Orders') . '</a>'; +echo '<br /><a href="' . $rootpath . '/SelectCompletedOrder.php?SelectedStockItem=' . $StockID . '">' . _('Search Completed Sales Orders') . '</a>'; echo '</form></div>'; Modified: trunk/StockQuantityByDate.php =================================================================== --- trunk/StockQuantityByDate.php 2011-04-28 10:39:25 UTC (rev 4557) +++ trunk/StockQuantityByDate.php 2011-04-29 12:43:19 UTC (rev 4558) @@ -1,11 +1,7 @@ <?php /* $Id$ */ -/* Contributed by Chris Bice - gettext by Kitch*/ - -//$PageSecurity = 2; - include('includes/session.inc'); $title = _('Stock On Hand By Date'); include('includes/header.inc'); @@ -13,65 +9,65 @@ echo '<p Class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/inventory.png" title="' . _('Inventory') . '" alt="" /><b>' . $title. '</b></p>'; -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'] . '" />'; -$sql = 'SELECT categoryid, categorydescription FROM stockcategory'; +$sql = "SELECT categoryid, categorydescription FROM stockcategory"; $resultStkLocs = DB_query($sql, $db); echo '<table class=selection><tr>'; -echo '<td>' . _('For Stock Category') . ":</td> - <td><select name='StockCategory'> "; +echo '<td>' . _('For Stock Category') . ':</td> + <td><select name="StockCategory"> '; echo '<option value="All">' . _('All') . '</option>'; while ($myrow=DB_fetch_array($resultStkLocs)){ if (isset($_POST['StockCategory']) AND $_POST['StockCategory']!='All'){ if ($myrow['categoryid'] == $_POST['StockCategory']){ - echo "<option selected VALUE='" . $myrow['categoryid'] . "'>" . $myrow['categorydescription'] . '</option>'; + echo '<option selected value="' . $myrow['categoryid'] . '">' . $myrow['categorydescription'] . '</option>'; } else { - echo "<option VALUE='" . $myrow['categoryid'] . "'>" . $myrow['categorydescription'] . '</option>'; + echo '<option value="' . $myrow['categoryid'] . '">' . $myrow['categorydescription'] . '</option>'; } }else { - echo "<option VALUE='" . $myrow['categoryid'] . "'>" . $myrow['categorydescription'] . '</option>'; + echo '<option value="' . $myrow['categoryid'] . '">' . $myrow['categorydescription'] . '</option>'; } } echo '</select></td>'; -$sql = 'SELECT loccode, locationname FROM locations'; +$sql = "SELECT loccode, locationname FROM locations"; $resultStkLocs = DB_query($sql, $db); -echo '<td>' . _('For Stock Location') . ":</td> - <td><select name='StockLocation'> "; +echo '<td>' . _('For Stock Location') . ':</td> + <td><select name="StockLocation"> '; while ($myrow=DB_fetch_array($resultStkLocs)){ if (isset($_POST['StockLocation']) AND $_POST['StockLocation']!='All'){ if ($myrow['loccode'] == $_POST['StockLocation']){ - echo "<option selected VALUE='" . $myrow['loccode'] . "'>" . $myrow['locationname']; + echo '<option selected value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } else { - echo "<option VALUE='" . $myrow['loccode'] . "'>" . $myrow['locationname']; + echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } } elseif ($myrow['loccode']==$_SESSION['UserStockLocation']){ - echo "<option selected VALUE='" . $myrow['loccode'] . "'>" . $myrow['locationname']; + echo '<option selected value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; $_POST['StockLocation']=$myrow['loccode']; } else { - echo "<option VALUE='" . $myrow['loccode'] . "'>" . $myrow['locationname']; + echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } } echo '</select></td>'; if (!isset($_POST['OnHandDate'])){ - $_POST['OnHandDate'] = Date($_SESSION['DefaultDateFormat'], Mktime(0,0,0,Date("m"),0,Date("y"))); + $_POST['OnHandDate'] = Date($_SESSION['DefaultDateFormat'], Mktime(0,0,0,Date('m'),0,Date('y'))); } -echo '<td>' . _("On-Hand On Date") . ":</td> - <td><input type=TEXT class='date' alt='".$_SESSION['DefaultDateFormat']."' name='OnHandDate' size=12 maxlength=12 VALUE='" . $_POST['OnHandDate'] . "'></td></tr>"; -echo "<tr><td colspan=6><div class='centre'><input type=submit n... [truncated message content] |
From: <dai...@us...> - 2011-05-01 09:45:27
|
Revision: 4559 http://web-erp.svn.sourceforge.net/web-erp/?rev=4559&view=rev Author: daintree Date: 2011-05-01 09:45:18 +0000 (Sun, 01 May 2011) Log Message: ----------- quoting Modified Paths: -------------- trunk/AccountSections.php trunk/AgedDebtors.php trunk/AuditTrail.php trunk/BOMIndented.php trunk/BOMListing.php trunk/BOMs.php trunk/BankAccounts.php trunk/Logout.php trunk/PageSecurity.php trunk/SecurityTokens.php trunk/StockTransferControlled.php trunk/StockUsage.php trunk/SuppTransGLAnalysis.php trunk/SupplierContacts.php trunk/SupplierInquiry.php trunk/SupplierTypes.php trunk/TaxGroups.php trunk/WorkOrderCosting.php trunk/Z_CheckDebtorsControl.php trunk/css/default/login.css trunk/css/fresh/login.css trunk/css/gel/login.css trunk/css/jelly/login.css trunk/css/professional/login.css trunk/css/professional-rtl/login.css trunk/css/silverwolf/login.css trunk/doc/Change.log.html trunk/includes/Login.php trunk/index.php Modified: trunk/AccountSections.php =================================================================== --- trunk/AccountSections.php 2011-04-29 12:43:19 UTC (rev 4558) +++ trunk/AccountSections.php 2011-05-01 09:45:18 UTC (rev 4559) @@ -1,9 +1,7 @@ <?php -/* $Revision: 1.7 $ */ + /* $Id$*/ -//$PageSecurity = 10; - include('includes/session.inc'); $title = _('Account Sections'); @@ -136,7 +134,7 @@ $myrow = DB_fetch_row($result); if ($myrow[0]>0) { prnMsg( _('Cannot delete this account section because general ledger accounts groups have been created using this section'),'warn'); - echo '<br>' . _('There are') . ' ' . $myrow[0] . ' ' . _('general ledger accounts groups that refer to this account section') . '</font>'; + echo '<br />' . _('There are') . ' ' . $myrow[0] . ' ' . _('general ledger accounts groups that refer to this account section') . '</font>'; } else { //Fetch section name @@ -176,11 +174,11 @@ $result = DB_query($sql,$db,$ErrMsg); echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/maintenance.png" title="' . _('Search') . '" alt="" />' . ' ' . $title.'</p><br />'; - echo "<table name='SectionList' class='selection'> + echo '<table name="SectionList" class="selection"> <tr> - <th>" . _('Section Number') . "</th> - <th>" . _('Section Description') . "</th> - </tr>"; + <th>' . _('Section Number') . '</th> + <th>' . _('Section Description') . '</th> + </tr>'; $k=0; //row colour counter while ($myrow = DB_fetch_row($result)) { @@ -194,11 +192,11 @@ } echo '<td>' . $myrow[0] . '</td><td>' . $myrow[1] . '</td>'; - echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?' . SID . '&SelectedSectionID=' . $myrow[0] . '">' . _('Edit') . '</a></td>'; + echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedSectionID=' . $myrow[0] . '">' . _('Edit') . '</a></td>'; if ( $myrow[0] == '1' || $myrow[0] == '2' ) { echo '<td><b>'._('Restricted').'</b></td>'; } else { - echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?' . SID . '&SelectedSectionID=' . $myrow[0] . '&delete=1">' . _('Delete') .'</a></td>'; + echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedSectionID=' . $myrow[0] . '&delete=1">' . _('Delete') .'</a></td>'; } echo '</tr>'; } //END WHILE LIST LOOP @@ -207,12 +205,12 @@ if (isset($_POST['SelectedSectionID']) or isset($_GET['SelectedSectionID'])) { - echo '<div class="centre"><a href=' . $_SERVER['PHP_SELF'] . '?' . SID .'>' . _('Review Account Sections') . '</a></div>'; + echo '<div class="centre"><a href="' . $_SERVER['PHP_SELF'] . '">' . _('Review Account Sections') . '</a></div>'; } if (! isset($_GET['delete'])) { - echo "<form method='post' name='AccountSections' action='" . $_SERVER['PHP_SELF'] . '?' . SID . "'>"; + echo '<form method="post" name="AccountSections" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; if (isset($_GET['SelectedSectionID'])) { @@ -233,10 +231,12 @@ $_POST['SectionID'] = $myrow['sectionid']; $_POST['SectionName'] = $myrow['sectionname']; - echo "<input type=hidden name='SelectedSectionID' value='" . $_POST['SectionID'] . "'>"; - echo "<table class=selection> - <td>" . _('Section Number') . ':' . "</td> - <td>" . $_POST['SectionID'] . "</td>"; + echo '<input type=hidden name="SelectedSectionID" value="' . $_POST['SectionID'] . '" />'; + echo '<table class="selection"> + <tr> + <td>' . _('Section Number') . ':' . '</td> + <td>' . $_POST['SectionID'] . '</td> + </tr>'; } } else { @@ -250,22 +250,23 @@ if (!isset($_POST['SectionName'])) { $_POST['SectionName']=''; } - echo "<table class='selection'> + echo '<table class="selection"> <tr> - <td>" . _('Section Number') . ':' . '</td> - <td><input tabindex="1" ' . (in_array('SectionID',$Errors) ? 'class="inputerror"' : '' ) ." type='text' name='SectionID' class='number' size='4' maxlength='4' value='" . $_POST['SectionID'] . "' /></td></tr>"; + <td>' . _('Section Number') . ':' . '</td> + <td><input tabindex="1" ' . (in_array('SectionID',$Errors) ? 'class="inputerror"' : '' ) .' type="text" name="SectionID" class="number" size="4" maxlength="4" value="' . $_POST['SectionID'] . '" /></td> + </tr>'; } - echo "<tr><td>" . _('Section Description') . ':' . '</td> - <td><input tabindex="2" ' . (in_array('SectionName',$Errors) ? 'class="inputerror"' : '' ) ." type='text' name='SectionName' size='30' maxlength='30' value='" . $_POST['SectionName'] . "' /></td> - </tr>"; + echo '<tr><td>' . _('Section Description') . ':' . '</td> + <td><input tabindex="2" ' . (in_array('SectionName',$Errors) ? 'class="inputerror"' : '' ) .' type="text" name="SectionName" size="30" maxlength="30" value="' . $_POST['SectionName'] . '" /></td> + </tr>'; echo '<tr><td colspan="2"><div class="centre"><input tabindex="3" type="submit" name="submit" value="' . _('Enter Information') . '" /></div></td></tr>'; echo '</table><br />'; if (!isset($_GET['SelectedSectionID']) or $_GET['SelectedSectionID']=='') { - echo "<script>defaultControl(document.AccountSections.SectionID);</script>"; + echo '<script>defaultControl(document.AccountSections.SectionID);</script>'; } else { - echo "<script>defaultControl(document.AccountSections.SectionName);</script>"; + echo '<script>defaultControl(document.AccountSections.SectionName);</script>'; } echo '</form>'; Modified: trunk/AgedDebtors.php =================================================================== --- trunk/AgedDebtors.php 2011-04-29 12:43:19 UTC (rev 4558) +++ trunk/AgedDebtors.php 2011-05-01 09:45:18 UTC (rev 4559) @@ -2,9 +2,6 @@ /* $Id$ */ -/* $Revision: 1.20 $ */ - -//$PageSecurity = 2; include('includes/session.inc'); if (isset($_POST['PrintPDF']) @@ -22,7 +19,7 @@ /*Now figure out the aged analysis for the customer range under review */ if (trim($_POST['Salesman'])!=''){ - $SalesLimit = " and debtorsmaster.debtorno in (SELECT DISTINCT debtorno FROM custbranch where salesman = '".$_POST['Salesman']."') "; + $SalesLimit = " AND debtorsmaster.debtorno IN (SELECT DISTINCT debtorno FROM custbranch where salesman = '".$_POST['Salesman']."') "; } else { $SalesLimit = ""; } @@ -30,6 +27,7 @@ $SQL = "SELECT debtorsmaster.debtorno, debtorsmaster.name, currencies.currency, + currencies.decimalplaces, paymentterms.terms, debtorsmaster.creditlimit, holdreasons.dissallowinvoices, @@ -86,6 +84,7 @@ GROUP BY debtorsmaster.debtorno, debtorsmaster.name, currencies.currency, + currencies.decimalplaces, paymentterms.terms, paymentterms.daysbeforedue, paymentterms.dayinfollowingmonth, @@ -100,6 +99,7 @@ $SQL = "SELECT debtorsmaster.debtorno, debtorsmaster.name, currencies.currency, + currencies.decimalplaces, paymentterms.terms, debtorsmaster.creditlimit, holdreasons.dissallowinvoices, @@ -158,6 +158,7 @@ GROUP BY debtorsmaster.debtorno, debtorsmaster.name, currencies.currency, + currencies.decimalplaces, paymentterms.terms, paymentterms.daysbeforedue, paymentterms.dayinfollowingmonth, @@ -182,6 +183,7 @@ $SQL = "SELECT debtorsmaster.debtorno, debtorsmaster.name, currencies.currency, + currencies.decimalplaces, paymentterms.terms, debtorsmaster.creditlimit, holdreasons.dissallowinvoices, @@ -245,6 +247,7 @@ GROUP BY debtorsmaster.debtorno, debtorsmaster.name, currencies.currency, + currencies.decimalplaces, paymentterms.terms, paymentterms.daysbeforedue, paymentterms.dayinfollowingmonth, @@ -267,9 +270,9 @@ $title = _('Aged Customer Account Analysis') . ' - ' . _('Problem Report') . '.... '; include('includes/header.inc'); echo '<p>' . _('The customer details could not be retrieved by the SQL because') . ' ' . DB_error_msg($db); - 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; @@ -283,16 +286,17 @@ $TotOD1=0; $TotOD2=0; - $ListCount = DB_num_rows($CustomerResult); //UldisN - + $ListCount = DB_num_rows($CustomerResult); + $DecimalPlaces =2; //by default + while ($AgedAnalysis = DB_fetch_array($CustomerResult,$db)){ + $DecimalPlaces = $AgedAnalysis['decimalplaces']; + $DisplayDue = number_format($AgedAnalysis['due']-$AgedAnalysis['overdue1'],$DecimalPlaces); + $DisplayCurrent = number_format($AgedAnalysis['balance']-$AgedAnalysis['due'],$DecimalPlaces); + $DisplayBalance = number_format($AgedAnalysis['balance'],$DecimalPlaces); + $DisplayOverdue1 = number_format($AgedAnalysis['overdue1']-$AgedAnalysis['overdue2'],$DecimalPlaces); + $DisplayOverdue2 = number_format($AgedAnalysis['overdue2'],$DecimalPlaces); - $DisplayDue = number_format($AgedAnalysis['due']-$AgedAnalysis['overdue1'],2); - $DisplayCurrent = number_format($AgedAnalysis['balance']-$AgedAnalysis['due'],2); - $DisplayBalance = number_format($AgedAnalysis['balance'],2); - $DisplayOverdue1 = number_format($AgedAnalysis['overdue1']-$AgedAnalysis['overdue2'],2); - $DisplayOverdue2 = number_format($AgedAnalysis['overdue2'],2); - $TotBal += $AgedAnalysis['balance']; $TotDue += ($AgedAnalysis['due']-$AgedAnalysis['overdue1']); $TotCurr += ($AgedAnalysis['balance']-$AgedAnalysis['due']); @@ -364,10 +368,10 @@ if (DB_error_no($db) !=0) { $title = _('Aged Customer Account Analysis') . ' - ' . _('Problem Report') . '....'; include('includes/header.inc'); - echo '<br><br>' . _('The details of outstanding transactions for customer') . ' - ' . $AgedAnalysis['debtorno'] . ' ' . _('could not be retrieved because') . ' - ' . DB_error_msg($db); - echo "<br><a href='$rootpath/index.php'>" . _('Back to the menu') . '</a>'; + echo '<br /><br />' . _('The details of outstanding transactions for customer') . ' - ' . $AgedAnalysis['debtorno'] . ' ' . _('could not be retrieved because') . ' - ' . DB_error_msg($db); + echo '<br /><a href="' . $rootpath . '/index.php">' . _('Back to the menu') . '</a>'; if ($debug==1){ - echo '<br>' . _('The SQL that failed was') . '<p>' . $sql; + echo '<br />' . _('The SQL that failed was') . '<p>' . $sql; } include('includes/footer.inc'); exit; @@ -380,11 +384,11 @@ $DisplayTranDate = ConvertSQLDate($DetailTrans['trandate']); $LeftOvers = $pdf->addTextWrap($Left_Margin+125,$YPos,75,$FontSize,$DisplayTranDate,'left'); - $DisplayDue = number_format($DetailTrans['due']-$DetailTrans['overdue1'],2); - $DisplayCurrent = number_format($DetailTrans['balance']-$DetailTrans['due'],2); - $DisplayBalance = number_format($DetailTrans['balance'],2); - $DisplayOverdue1 = number_format($DetailTrans['overdue1']-$DetailTrans['overdue2'],2); - $DisplayOverdue2 = number_format($DetailTrans['overdue2'],2); + $DisplayDue = number_format($DetailTrans['due']-$DetailTrans['overdue1'],$DecimalPlaces); + $DisplayCurrent = number_format($DetailTrans['balance']-$DetailTrans['due'],$DecimalPlaces); + $DisplayBalance = number_format($DetailTrans['balance'],$DecimalPlaces); + $DisplayOverdue1 = number_format($DetailTrans['overdue1']-$DetailTrans['overdue2'],$DecimalPlaces); + $DisplayOverdue2 = number_format($DetailTrans['overdue2'],$DecimalPlaces); $LeftOvers = $pdf->addTextWrap(220,$YPos,60,$FontSize,$DisplayBalance,'right'); $LeftOvers = $pdf->addTextWrap(280,$YPos,60,$FontSize,$DisplayCurrent,'right'); @@ -414,11 +418,11 @@ $pdf->line($Page_Width-$Right_Margin, $YPos+10 ,220, $YPos+10); } - $DisplayTotBalance = number_format($TotBal,2); - $DisplayTotDue = number_format($TotDue,2); - $DisplayTotCurrent = number_format($TotCurr,2); - $DisplayTotOverdue1 = number_format($TotOD1,2); - $DisplayTotOverdue2 = number_format($TotOD2,2); + $DisplayTotBalance = number_format($TotBal,$DecimalPlaces); + $DisplayTotDue = number_format($TotDue,$DecimalPlaces); + $DisplayTotCurrent = number_format($TotCurr,$DecimalPlaces); + $DisplayTotOverdue1 = number_format($TotOD1,$DecimalPlaces); + $DisplayTotOverdue2 = number_format($TotOD2,$DecimalPlaces); $LeftOvers = $pdf->addTextWrap(220,$YPos,60,$FontSize,$DisplayTotBalance,'right'); $LeftOvers = $pdf->addTextWrap(280,$YPos,60,$FontSize,$DisplayTotCurrent,'right'); @@ -426,12 +430,6 @@ $LeftOvers = $pdf->addTextWrap(400,$YPos,60,$FontSize,$DisplayTotOverdue1,'right'); $LeftOvers = $pdf->addTextWrap(460,$YPos,60,$FontSize,$DisplayTotOverdue2,'right'); -/* Javier: This actually would produce the output - $buf = $pdf->output(); - $len = strlen($buf); -*/ - -// if ($len < 1000) { if ($ListCount == 0) { $title = _('Aged Customer Account Analysis') . ' - ' . _('Problem Report') . '....'; include('includes/header.inc'); @@ -439,26 +437,14 @@ if ($debug==1){ prnMsg($SQL,'info'); } - echo "<br><a href='$rootpath/index.php'>" . _('Back to the menu') . '</a>'; + echo '<br /><a href="' . $rootpath . '/index.php">' . _('Back to the menu') . '</a>'; include('includes/footer.inc'); exit; + } else { + $pdf->OutputD($_SESSION['DatabaseName'] . '_' . 'AgedDebtors_' . date('Y-m-d') . '.pdf'); + $pdf-> __destruct(); } -/* Javier: TCPDF sends its own http header, would be an error to send it twice. - header('Content-type: application/pdf'); - header("Content-Length: $len"); - header('Content-Disposition: inline; filename=AgedDebtors.pdf'); - header('Expires: 0'); - header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); - header('Pragma: public'); - $pdf->stream(); */ - -// This else was missed - else { - $pdf->OutputD($_SESSION['DatabaseName'] . '_' . 'AgedDebtors_' . date('Y-m-d') . '.pdf'); - $pdf-> __destruct(); - } - } else { /*The option to print PDF was not hit */ $title=_('Aged Debtor Analysis'); @@ -471,56 +457,64 @@ /*if $FromCriteria is not set then show a form to allow input */ - echo '<form action=' . $_SERVER['PHP_SELF'] . " method='post'><table>"; + echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post"> + <table>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<tr><td>' . _('From Customer Code') . ':' . "</font></td><td><input tabindex='1' Type=text maxlength=6 size=7 name=FromCriteria value='0'></td></tr>"; - echo '<tr><td>' . _('To Customer Code') . ':' . "</td><td><input tabindex='2' Type=text maxlength=6 size=7 name=ToCriteria value='zzzzzz'></td></tr>"; + echo '<tr><td>' . _('From Customer Code') . ':' . '</font></td> + <td><input tabindex="1" type="text" maxlength="6" size="7" name="FromCriteria" value="0"></td> + </tr>'; + echo '<tr><td>' . _('To Customer Code') . ':' . '</td> + <td><input tabindex="2" type="text" maxlength="6" size="7" name="ToCriteria" value="zzzzzz" /></td> + </tr>'; - echo '<tr><td>' . _('All balances or overdues only') . ':' . "</td><td><select tabindex='3' name='All_Or_Overdues'>"; - echo "<option selected Value='All'>" . _('All customers with balances'); - echo "<option Value='OverduesOnly'>" . _('Overdue accounts only'); - echo "<option Value='HeldOnly'>" . _('Held accounts only'); - echo '</select></td></tr>'; + echo '<tr><td>' . _('All balances or overdues only') . ':' . '</td> + <td><select tabindex="3" name="All_Or_Overdues"> + <option selected value="All">' . _('All customers with balances') . '</option> + <option value="OverduesOnly">' . _('Overdue accounts only') . '</option> + <option value="HeldOnly">' . _('Held accounts only') . '</option> + </select> + </td> + </tr>'; - echo '<tr><td>' . _('Only Show Customers Of') . ':' . "</td><td><select tabindex='4' name='Salesman'>"; + echo '<tr><td>' . _('Only Show Customers Of') . ':' . '</td> + <td><select tabindex="4" name="Salesman">'; - $sql = 'SELECT salesmancode, salesmanname FROM salesman'; + $sql = "SELECT salesmancode, salesmanname FROM salesman"; $result=DB_query($sql,$db); - echo "<option value=''></option>"; + echo '<option value=""></option>'; while ($myrow=DB_fetch_array($result)){ - echo "<option value='" . $myrow['salesmancode'] . "'>" . $myrow['salesmanname']; + echo '<option value="' . $myrow['salesmancode'] . '">' . $myrow['salesmanname'] . '</option>'; } echo '</select></td></tr>'; - echo '<tr><td>' . _('Only show customers trading in') . ':' . "</td><td><select tabindex='5' name='Currency'>"; + echo '<tr><td>' . _('Only show customers trading in') . ':' . '</td> + <td><select tabindex="5" name="Currency">'; - $sql = 'SELECT currency, currabrev FROM currencies'; + $sql = "SELECT currency, currabrev FROM currencies"; $result=DB_query($sql,$db); - - while ($myrow=DB_fetch_array($result)){ if ($myrow['currabrev'] == $_SESSION['CompanyRecord']['currencydefault']){ - 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>'; } } echo '</select></td></tr>'; - echo '<tr><td>' . _('Summary or detailed report') . ':' . "</td> - <td><select tabindex='6' name='DetailedReport'>"; - echo "<option selected value='No'>" . _('Summary Report'); - echo "<option value='Yes'>" . _('Detailed Report'); - echo '</select></td></tr>'; + echo '<tr><td>' . _('Summary or detailed report') . ':' . '</td> + <td><select tabindex="6" name="DetailedReport"> + <option selected value="No">' . _('Summary Report') . '</option> + <option value="Yes">' . _('Detailed Report') . '</option> + </select> + </td> + </tr>'; - echo '</table><br><div class="centre"><input tabindex="7" type=submit name="PrintPDF" value="' . _('Print PDF') , '"></div>'; + echo '</table><br /><div class="centre"><input tabindex="7" type=submit name="PrintPDF" value="' . _('Print PDF') , '"></div>'; } include('includes/footer.inc'); - } /*end of else not PrintPDF */ - -?> +?> \ No newline at end of file Modified: trunk/AuditTrail.php =================================================================== --- trunk/AuditTrail.php 2011-04-29 12:43:19 UTC (rev 4558) +++ trunk/AuditTrail.php 2011-05-01 09:45:18 UTC (rev 4559) @@ -40,18 +40,19 @@ // Show user selections echo '<tr><td>'. _('User ID'). '</td> <td><select tabindex="3" name="SelectedUser">'; -echo '<option value=ALL>ALL'; +echo '<option value="ALL">' . _('ALL') . '</option>'; while ($users = DB_fetch_row($UserResult)) { if (isset($_POST['SelectedUser']) and $users[0]==$_POST['SelectedUser']) { - echo '<option selected value=' . $users[0] . '>' . $users[0] . '</option>'; + echo '<option selected value="' . $users[0] . '">' . $users[0] . '</option>'; } else { - echo '<option value=' . $users[0] . '>' . $users[0] . '</option>'; + echo '<option value="' . $users[0] . '">' . $users[0] . '</option>'; } } echo '</select></td></tr>'; // Show table selections -echo '<tr><td>'. _('Table '). '</td><td><select tabindex="4" name="SelectedTable">'; +echo '<tr><td>'. _('Table '). '</td> + <td><select tabindex="4" name="SelectedTable">'; echo '<option value="ALL">' . _('ALL') . '</option>'; while ($tables = DB_fetch_row($TableResult)) { if (isset($_POST['SelectedTable']) and $tables[0]==$_POST['SelectedTable']) { Modified: trunk/BOMIndented.php =================================================================== --- trunk/BOMIndented.php 2011-04-29 12:43:19 UTC (rev 4558) +++ trunk/BOMIndented.php 2011-05-01 09:45:18 UTC (rev 4559) @@ -15,19 +15,19 @@ $PageNumber=1; $line_height=12; - $sql = 'DROP TABLE IF EXISTS tempbom'; + $sql = "DROP TABLE IF EXISTS tempbom"; $result = DB_query($sql,$db); - $sql = 'DROP TABLE IF EXISTS passbom'; + $sql = "DROP TABLE IF EXISTS passbom"; $result = DB_query($sql,$db); - $sql = 'DROP TABLE IF EXISTS passbom2'; + $sql = "DROP TABLE IF EXISTS passbom2"; $result = DB_query($sql,$db); - $sql = 'CREATE TEMPORARY TABLE passbom ( + $sql = "CREATE TEMPORARY TABLE passbom ( part char(20), - sortpart text) DEFAULT CHARSET=utf8'; + sortpart text) DEFAULT CHARSET=utf8"; $ErrMsg = _('The SQL to create passbom failed with the message'); $result = DB_query($sql,$db,$ErrMsg); - $sql = 'CREATE TEMPORARY TABLE tempbom ( + $sql = "CREATE TEMPORARY TABLE tempbom ( parent char(20), component char(20), sortpart text, @@ -36,7 +36,7 @@ loccode char(5), effectiveafter date, effectiveto date, - quantity double) DEFAULT CHARSET=utf8'; + 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 @@ -112,32 +112,32 @@ AND bom.effectiveto >= NOW() AND bom.effectiveafter <= NOW()"; $result = DB_query($sql,$db); - $sql = 'DROP TABLE IF EXISTS passbom2'; + $sql = "DROP TABLE IF EXISTS passbom2"; $result = DB_query($sql,$db); - $sql = 'ALTER TABLE passbom RENAME AS passbom2'; + $sql = "ALTER TABLE passbom RENAME AS passbom2"; $result = DB_query($sql,$db); - $sql = 'DROP TABLE IF EXISTS passbom'; + $sql = "DROP TABLE IF EXISTS passbom"; $result = DB_query($sql,$db); - $sql = 'CREATE TEMPORARY TABLE passbom ( - part char(20), - sortpart text) DEFAULT CHARSET=utf8'; + $sql = "CREATE TEMPORARY TABLE passbom ( + part char(20), + 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.effectiveafter <= NOW()"; $result = DB_query($sql,$db); - $sql = 'SELECT COUNT(*) FROM bom,passbom WHERE bom.parent = passbom.part'; + $sql = "SELECT COUNT(*) FROM bom,passbom WHERE bom.parent = passbom.part"; $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); @@ -150,9 +150,9 @@ $title = _('Indented BOM Listing') . ' - ' . _('Problem Report'); include('includes/header.inc'); prnMsg( _('The Indented 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; @@ -172,12 +172,12 @@ $Right_Margin,$assemblydesc); $Tot_Val=0; - $sql = 'SELECT tempbom.*, - stockmaster.description, - stockmaster.mbflag - FROM tempbom,stockmaster - WHERE tempbom.component = stockmaster.stockid - ORDER BY sortpart'; + $sql = "SELECT tempbom.*, + stockmaster.description, + stockmaster.mbflag + FROM tempbom,stockmaster + WHERE tempbom.component = stockmaster.stockid + ORDER BY sortpart"; $result = DB_query($sql,$db); // $fill is used to alternate between lines with transparent and painted background @@ -226,21 +226,16 @@ 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 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>'; + echo '<br /><a href="' . $rootpath . '/index.php">' . _('Back to the menu') . '</a>'; include('includes/footer.inc'); exit; } else { - $pdf->OutputD($_SESSION['DatabaseName'] . '_Customer_trans_' . date('Y-m-d').'.pdf');//UldisN + $pdf->OutputD($_SESSION['DatabaseName'] . '_Customer_trans_' . date('Y-m-d').'.pdf'); $pdf->__destruct(); } @@ -251,22 +246,30 @@ 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'>"; + echo '<tr><td>' . _('Part') . ':</td> + <td><input type ="text" name="Part" size="20" /> + </tr> + <tr><td>' . _('Levels') . ':</td> + <td><select name="Levels"> + <option selected value="All">' . _('All Levels') . '</option> + <option value="One">' . _('One Level') . '</option> + </select> + </td> + </tr>'; - echo '<tr><td>' . _('Levels') . ":</td><td><select name='Levels'>"; - echo "<option selected value='All'>" . _('All Levels'); - echo "<option value='One'>" . _('One Level'); - echo '</select></td></tr>'; + echo '<tr><td>' . _('Print Option') . ':</td> + <td><select name="Fill"> + <option selected value="yes">' . _('Print With Alternating Highlighted Lines') . '</option> + <option value="no">' . _('Plain Print') . '</option> + </select> + </td> + </tr>'; + echo '</table> + <p><div class="centre"><input type="submit" name="PrintPDF" value="' . _('Print PDF') . '"></div>'; - echo '<tr><td>' . _('Print Option') . ":</td><td><select name='Fill'>"; - echo "<option selected value='yes'>" . _('Print With Alternating Highlighted Lines'); - echo "<option value='no'>" . _('Plain Print'); - echo '</select></td></tr>'; - echo "</table><p><div class='centre'><input type=submit name='PrintPDF' value='" . _('Print PDF') . "'></div>"; - include('includes/footer.inc'); } /*end of else not PrintPDF */ @@ -275,7 +278,6 @@ function PrintHeader(&$pdf,&$YPos,&$PageNumber,$Page_Height,$Top_Margin,$Left_Margin, $Page_Width,$Right_Margin,$assemblydesc) { - $line_height=12; /*PDF page header for Indented BOM Listing report */ if ($PageNumber>1){ Modified: trunk/BOMListing.php =================================================================== --- trunk/BOMListing.php 2011-04-29 12:43:19 UTC (rev 4558) +++ trunk/BOMListing.php 2011-05-01 09:45:18 UTC (rev 4559) @@ -2,12 +2,8 @@ /* $Id$*/ -/* $Revision: 1.14 $ */ - -//$PageSecurity = 2; include('includes/session.inc'); - If (isset($_POST['PrintPDF']) AND isset($_POST['FromCriteria']) AND strlen($_POST['FromCriteria'])>=1 @@ -48,9 +44,9 @@ $title = _('Bill of Materials Listing') . ' - ' . _('Problem Report'); include('includes/header.inc'); prnMsg(_('The Bill of Material listing could not be retrieved by the SQL because'),'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; @@ -105,22 +101,10 @@ $YPos -=$line_height; $pdf->line($Page_Width-$Right_Margin, $YPos,$Left_Margin, $YPos); - /* - $buf = $pdf->output(); - $len = strlen($buf); + + $pdf->OutputD($_SESSION['DatabaseName'] . '_BOMListing_' . date('Y-m-d').'.pdf'); + $pdf->__destruct(); - header('Content-type: application/pdf'); - header('Content-Length: '.$len); - header('Content-Disposition: inline; filename=BOMListing.pdf'); - header('Expires: 0'); - header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); - header('Pragma: public'); - - $pdf->stream(); - */ - $pdf->OutputD($_SESSION['DatabaseName'] . '_BOMListing_' . date('Y-m-d').'.pdf');//UldisN - $pdf->__destruct(); //UldisN - } else { /*The option to print PDF was not hit */ $title=_('Bill Of Material Listing'); @@ -131,19 +115,25 @@ /*if $FromCriteria is not set then show a form to allow input */ - echo '<form action=' . $_SERVER['PHP_SELF'] . " method='POST'><table class=selection>"; + echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="POST"> + <table class="selection">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<tr><td>' . _('From Inventory Part Code') . ':' . "</font></td><td><input tabindex='1' type=text name=FromCriteria size=20 maxlength=20 VALUE='1'></td></tr>"; + echo '<tr><td>' . _('From Inventory Part Code') . ':' . '</font></td> + <td><input tabindex="1" type="text" name="FromCriteria" size="20" maxlength="20" value="1"></td> + </tr>'; - echo '<tr><td>' . _('To Inventory Part Code') . ':' . "</td><td><input tabindex='2' type=text name=ToCriteria size=20 maxlength=20 VALUE='zzzzzzz'></td></tr>"; + echo '<tr><td>' . _('To Inventory Part Code') . ':' . '</td> + <td><input tabindex="2" type="text" name="ToCriteria" size="20" maxlength="20" value="zzzzzzz" /></td> + </tr>'; - echo "</table><br><div class='centre'><input tabindex='3' type=Submit Name='PrintPDF' Value='" . _('Print PDF') . "'></div>"; - echo "<script>defaultControl(document.forms[0].FromCriteria);</script>"; + echo '</table> + <br /><div class="centre"><input tabindex="3" type="submit" name="PrintPDF" value="' . _('Print PDF') . '"></div>'; + echo '<script>defaultControl(document.forms[0].FromCriteria);</script>'; } include('includes/footer.inc');; } /*end of else not PrintPDF */ -?> +?> \ No newline at end of file Modified: trunk/BOMs.php =================================================================== --- trunk/BOMs.php 2011-04-29 12:43:19 UTC (rev 4558) +++ trunk/BOMs.php 2011-05-01 09:45:18 UTC (rev 4559) @@ -1,9 +1,7 @@ <?php -/* $Revision: 1.37 $ */ + /* $Id$*/ -//$PageSecurity = 9; - include('includes/session.inc'); $title = _('Multi-Level Bill Of Materials Maintenance'); @@ -11,8 +9,6 @@ include('includes/header.inc'); include('includes/SQL_CommonFunctions.inc'); - -// *** POPAD&T - ... Phil modified to english variables function display_children($parent, $level, &$BOMTree) { global $db; @@ -20,15 +16,13 @@ // retrive all children of parent $c_result = DB_query("SELECT parent, - component - FROM bom WHERE parent='" . $parent. "'" + component + FROM bom WHERE parent='" . $parent. "'" ,$db); if (DB_num_rows($c_result) > 0) { - //echo ("<UL>\n"); - - + while ($row = DB_fetch_array($c_result)) { - //echo '<br>Parent: ' . $parent . ' Level: ' . $level . ' row[component]: ' . $row['component'] .'<br>'; + //echo '<br />Parent: ' . $parent . ' Level: ' . $level . ' row[component]: ' . $row['component'] .'<br />'; if ($parent != $row['component']) { // indent and display the title of this child $BOMTree[$i]['Level'] = $level; // Level @@ -119,7 +113,7 @@ $DrillID=''; } else { $DrillText = '<a href="%s&Select=%s">' . _('Drill Down'); - $DrillLink = $_SERVER['PHP_SELF'] . '?' . SID; + $DrillLink = $_SERVER['PHP_SELF'] . '?'; $DrillID=$myrow[0]; } if ($ParentMBflag!='M' AND $ParentMBflag!='G'){ @@ -161,12 +155,12 @@ ConvertSQLDate($myrow[6]), $AutoIssue, $QuantityOnHand, - $_SERVER['PHP_SELF'] . '?' . SID, + $_SERVER['PHP_SELF'] . '?', $Parent, $myrow[0], $DrillLink, $DrillID, - $_SERVER['PHP_SELF'] . '?' . SID, + $_SERVER['PHP_SELF'] . '?', $Parent, $myrow[0], $UltimateParent); @@ -246,7 +240,7 @@ } if(!Date1GreaterThanDate2($_POST['EffectiveTo'], $_POST['EffectiveAfter'])){ $InputError = 1; - prnMsg(_('The effective to date must be a date after the effective after date') . '<br>' . _('The effective to date is') . ' ' . DateDiff($_POST['EffectiveTo'], $_POST['EffectiveAfter'], 'd') . ' ' . _('days before the effective after date') . '! ' . _('No updates have been performed') . '.<br>' . _('Effective after was') . ': ' . $_POST['EffectiveAfter'] . ' ' . _('and effective to was') . ': ' . $_POST['EffectiveTo'],'error'); + prnMsg(_('The effective to date must be a date after the effective after date') . '<br />' . _('The effective to date is') . ' ' . DateDiff($_POST['EffectiveTo'], $_POST['EffectiveAfter'], 'd') . ' ' . _('days before the effective after date') . '! ' . _('No updates have been performed') . '.<br />' . _('Effective after was') . ': ' . $_POST['EffectiveAfter'] . ' ' . _('and effective to was') . ': ' . $_POST['EffectiveTo'],'error'); $Errors[$i] = 'EffectiveAfter'; $i++; $Errors[$i] = 'EffectiveTo'; @@ -341,7 +335,7 @@ /*The component must already be on the BOM */ - prnMsg( _('The component') . ' ' . $_POST['Component'] . ' ' . _('is already recorded as a component of') . ' ' . $SelectedParent . '.' . '<br>' . _('Whilst the quantity of the component required can be modified it is inappropriate for a component to appear more than once in a bill of material'),'error'); + prnMsg( _('The component') . ' ' . $_POST['Component'] . ' ' . _('is already recorded as a component of') . ' ' . $SelectedParent . '.' . '<br />' . _('Whilst the quantity of the component required can be modified it is inappropriate for a component to appear more than once in a bill of material'),'error'); $Errors[$i]='ComponentCode'; } @@ -416,8 +410,8 @@ break; } - echo '<br><div class=centre><a href=' . $_SERVER['PHP_SELF'] . '?' . SID . '>' . _('Select a Different BOM') . '</a></div><br>'; - echo '<table class=selection>'; + echo '<br /><div class=centre><a href=' . $_SERVER['PHP_SELF'] . '?' . SID . '>' . _('Select a Different BOM') . '</a></div><br />'; + echo '<table class="selection">'; // Display Manufatured Parent Items $sql = "SELECT bom.parent, stockmaster.description, @@ -453,7 +447,7 @@ $DbgMsg = _('The SQL used to retrieve description of the parent part was'); $result=DB_query($sql,$db,$ErrMsg,$DbgMsg); if( DB_num_rows($result) > 0 ) { - echo (($reqnl)?'<br>':'').'<tr><td><div class="centre">'._('Assembly parent items').' : '; + echo (($reqnl)?'<br />':'').'<tr><td><div class="centre">'._('Assembly parent items').' : '; $ix = 0; while ($myrow = DB_fetch_array($result)){ echo (($ix)?', ':'').'<a href="'.$_SERVER['PHP_SELF'] . '?' . SID . 'Select='.$myrow['parent'].'">'. @@ -473,7 +467,7 @@ $DbgMsg = _('The SQL used to retrieve description of the parent part was'); $result=DB_query($sql,$db,$ErrMsg,$DbgMsg); if( DB_num_rows($result) > 0 ) { - echo (($reqnl)?'<br>':'').'<tr><td><div class="centre">'._('Kit sets').' : '; + echo (($reqnl)?'<br />':'').'<tr><td><div class="centre">'._('Kit sets').' : '; $ix = 0; while ($myrow = DB_fetch_array($result)){ echo (($ix)?', ':'').'<a href="'.$_SERVER['PHP_SELF'] . '?' . SID . 'Select='.$myrow['parent'].'">'. @@ -493,7 +487,7 @@ $DbgMsg = _('The SQL used to retrieve description of the parent part was'); $result=DB_query($sql,$db,$ErrMsg,$DbgMsg); if( DB_num_rows($result) > 0 ) { - echo (($reqnl)?'<br>':'').'<tr><td><div class="centre">'._('Phantom').' : '; + echo (($reqnl)?'<br />':'').'<tr><td><div class="centre">'._('Phantom').' : '; $ix = 0; while ($myrow = DB_fetch_array($result)){ echo (($ix)?', ':'').'<a href="'.$_SERVER['PHP_SELF'] . '?' . SID . 'Select='.$myrow['parent'].'">'. @@ -502,10 +496,11 @@ } //end while loop echo '</div></td></tr>'; } - echo "</table><br><table class=selection>"; - echo "<tr><th colspan=13><div class='centre'><font color=blue size=3><b>".$SelectedParent ." - " . $myrow[0] . ' ('. $MBdesc. ') </font></b></th></tr>'; + echo '</table> + <br /> + <table class="selection">'; + echo '<tr><th colspan=13><div class="centre"><font color=blue size=3><b>' . $SelectedParent .' - ' . $myrow[0] . ' ('. $MBdesc. ') </font></b></th></tr>'; - // *** POPAD&T $BOMTree = array(); //BOMTree is a 2 dimensional array with three elements for each item in the array - Level, Parent, Component //display children populates the BOM_Tree from the selected parent @@ -513,17 +508,17 @@ display_children($SelectedParent, 1, $BOMTree); $TableHeader = '<tr> - <th>' . _('Level') . '</th> - <th>' . _('Code') . '</th> - <th>' . _('Description') . '</th> - <th>' . _('Location') . '</th> - <th>' . _('Work Centre') . '</th> - <th>' . _('Quantity') . '</th> - <th>' . _('Effective After') . '</th> - <th>' . _('Effective To') . '</th> - <th>' . _('Auto Issue') . '</th> - <th>' . _('Qty On Hand') . '</th> - </tr>'; + <th>' . _('Level') . '</th> + <th>' . _('Code') . '</th> + <th>' . _('Description') . '</th> + <th>' . _('Location') . '</th> + <th>' . _('Work Centre') . '</th> + <th>' . _('Quantity') . '</th> + <th>' . _('Effective After') . '</th> + <th>' . _('Effective To') . '</th> + <th>' . _('Auto Issue') . '</th> + <th>' . _('Qty On Hand') . '</th> + </tr>'; echo $TableHeader; if(count($BOMTree) == 0) { echo '<tr class="OddTableRows"><td colspan="8">'._('No materials found.').'</td></tr>'; @@ -546,12 +541,11 @@ DisplayBOMItems($UltimateParent, $Parent, $Component, $Level, $db); } } - // *** end POPAD&T - echo "</table><br>"; + echo '</table><br />'; if (! isset($_GET['delete'])) { - echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '?' . SID . '&Select=' . $SelectedParent .'">'; + echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '?Select=' . $SelectedParent .'">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; if (isset($_GET['SelectedComponent']) and $InputError !=1) { @@ -577,24 +571,24 @@ $_POST['Quantity'] = $myrow['quantity']; $_POST['AutoIssue'] = $myrow['autoissue']; - prnMsg(_('Edit the details of the selected component in the fields below') . '. <br>' . _('Click on the Enter Information button to update the component details'),'info'); - echo "<br><input type=hidden name='SelectedParent' VALUE='$SelectedParent'>"; - echo "<input type=hidden name='SelectedComponent' VALUE='$SelectedComponent'>"; + prnMsg(_('Edit the details of the selected component in the fields below') . '. <br />' . _('Click on the Enter Information button to update the component details'),'info'); + echo '<br /> + <input type="hidden" name="SelectedParent" value="' . $SelectedParent . '" />'; + echo '<input type="hidden" name="SelectedComponent" value="' . $SelectedComponent . '" />'; echo '<table class=selection>'; - echo "<tr><th colspan=13><div class='centre'><font color=blue size=3><b>". ('Edit Component Details') .'</font></b></th></tr>'; + echo '<tr><th colspan=13><div class="centre"><font color=blue size=3><b>'. ('Edit Component Details') .'</font></b></th></tr>'; echo '<tr><td>' . _('Component') . ':</td><td><b>' . $SelectedComponent . '</b></td></tr>'; } else { //end of if $SelectedComponent - echo "<input type=hidden name='SelectedParent' VALUE='$SelectedParent'>"; - /* echo "Enter the details of a new component in the fields below. <br>Click on 'Enter Information' to add the new component, once all fields are completed."; + echo '<input type=hidden name="SelectedParent" value="' . $SelectedParent . '" />'; + /* echo "Enter the details of a new component in the fields below. <br />Click on 'Enter Information' to add the new component, once all fields are completed."; */ echo '<table class=selection>'; - echo "<tr><th colspan=13><div class='centre'><font color=blue size=3><b>". ('New Component Details') .'</font></b></th></tr>'; + echo '<tr><th colspan=13><div class="centre"><font color=blue size=3><b>' . ('New Component Details') .'</font></b></th></tr>'; echo '<tr><td>' . _('Component code') . ':</td><td>'; - echo "<select " . (in_array('ComponentCode',$Errors) ? 'class="selecterror"' : '' ) ." tabindex='1' name='Component'>"; + echo '<select ' . (in_array('ComponentCode',$Errors) ? 'class="selecterror"' : '' ) .' tabindex="1" name="Component">'; - if ($ParentMBflag=='A'){ /*Its an assembly */ $sql = "SELECT stockmaster.stockid, stockmaster.description @@ -627,64 +621,68 @@ while ($myrow = DB_fetch_array($result)) { - echo "<option VALUE=".$myrow['stockid'].'>' . str_pad($myrow['stockid'],21, '_', STR_PAD_RIGHT) . $myrow['description']; + echo '<option value="' .$myrow['stockid'].'">' . str_pad($myrow['stockid'],21, '_', STR_PAD_RIGHT) . $myrow['description'] . '</option>'; } //end while loop echo '</select></td></tr>'; } - echo "<tr><td>" . _('Location') . ": </td><td><select tabindex='2' name='LocCode'>"; + echo '<tr><td>' . _('Location') . ': </td> + <td><select tabindex="2" name="LocCode">'; DB_free_result($result); - $sql = 'SELECT locationname, loccode FROM locations'; + $sql = "SELECT locationname, loccode FROM locations"; $result = DB_query($sql,$db); while ($myrow = DB_fetch_array($result)) { if (isset($_POST['LocCode']) and $myrow['loccode']==$_POST['LocCode']) { - echo "<option selected VALUE='"; + echo '<option selected value="'; } else { - echo "<option VALUE='"; + echo '<option value="'; } - echo $myrow['loccode'] . "'>" . $myrow['locationname']; + echo $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } //end while loop DB_free_result($result); - echo "</select></td></tr><tr><td>" . _('Work Centre Added') . ": </td><td>"; - echo "<select tabindex='3' name='WorkCentreAdded'>"; + echo '</select></td> + </tr> + <tr><td>' . _('Work Centre Added') . ': </td> + <td><select tabindex="3" name="WorkCentreAdded">'; - $sql = 'SELECT code, description FROM workcentres'; + $sql = "SELECT code, description FROM workcentres"; $result = DB_query($sql,$db); if (DB_num_rows($result)==0){ prnMsg( _('There are no work centres set up yet') . '. ' . _('Please use the link below to set up work centres'),'warn'); - echo "<br><a href='$rootpath/WorkCentres.php?" . SID . "'>" . _('Work Centre Maintenance') . '</a>'; + echo '<br /><a href="' . $rootpath . '/WorkCentres.php">' . _('Work Centre Maintenance') . '</a>'; include('includes/footer.inc'); exit; } while ($myrow = DB_fetch_array($result)) { if (isset($_POST['WorkCentreAdded']) and $myrow['code']==$_POST['WorkCentreAdded']) { - echo "<option selected VALUE='"; + echo '<option selected value="'; } else { - echo "<option VALUE='"; + echo '<option value="'; } - echo $myrow['code'] . "'>" . $myrow['description']; + echo $myrow['code'] . '">' . $myrow['description'] . '</option>'; } //end while loop DB_free_result($result); - echo "</select></td></tr><tr><td>" . _('Quantity') . ": </td><td> - <input " . (in_array('Quantity',$Errors) ? 'class="inputerror"' : '' ) ." - tabindex='4' type='Text' class=number name='Quantity' class=number size=10 maxlength=8 value="; + echo '</select></td> + </tr> + <tr><td>' . _('Quantity') . ': </td> + <td><input ' . (in_array('Quantity',$Errors) ? 'class="inputerror"' : '' ) .' tabindex="4" type="text" class="number" name="Quantity" class="number" size="10" maxlength="8" value="'; if (isset($_POST['Quantity'])){ echo $_POST['Quantity']; } else { echo 1; } - echo "></td></tr>"; + echo '"></td></tr>'; if (!isset($_POST['EffectiveTo']) OR $_POST['EffectiveTo']=='') { $_POST['EffectiveTo'] = Date($_SESSION['DefaultDateFormat'],Mktime(0,0,0,Date('m'),Date('d'),(Date('y')+20))); @@ -693,12 +691,10 @@ $_POST['EffectiveAfter'] = Date($_SESSION['DefaultDateFormat'],Mktime(0,0,0,Date('m'),Date('d')-1,Date('y'))); } - echo "<tr><td>" . _('Effective After') . " (" . $_SESSION['DefaultDateFormat'] . "):</td> - <td><input " . (in_array('EffectiveAfter',$Errors) ? 'class="inputerror"' : '' ) . - " tabindex='5' type='Text' name='EffectiveAfter' class=date alt='".$_SESSION['DefaultDateFormat']."' size=11 maxlength=10 VALUE=" . $_POST['EffectiveAfter'] ."> - </td></tr><tr><td>" . _('Effective To') . " (" . $_SESSION['DefaultDateFormat'] . "):</td><td> - <input " . (in_array('EffectiveTo',$Errors) ? 'class="inputerror"' : '' ) . - " tabindex='6' type='Text' name='EffectiveTo' class=date alt='".$_SESSION['DefaultDateFormat']."' size=11 maxlength=10 VALUE=" . $_POST['EffectiveTo'] ."></td></tr>"; + echo '<tr><td>' . _('Effective After') . ' (' . $_SESSION['DefaultDateFormat'] . '):</td> + <td><input ' . (in_array('EffectiveAfter',$Errors) ? 'class="inputerror"' : '' ) . ' tabindex="5" type="text" name="EffectiveAfter" class="date" alt="' .$_SESSION['DefaultDateFormat'] .'" size="11" maxlength="10" value="' . $_POST['EffectiveAfter'] .'"></td></tr> + <tr><td>' . _('Effective To') . ' (' . $_SESSION['DefaultDateFormat'] . '):</td> + <td><input ' . (in_array('EffectiveTo',$Errors) ? 'class="inputerror"' : '' ) . ' tabindex="6" type="text" name="EffectiveTo" class="date" alt="' .$_SESSION['DefaultDateFormat'] . '" size="11" maxlength="10" value="' . $_POST['EffectiveTo'] .'"></td></tr>'; if ($ParentMBflag=='M' OR $ParentMBflag=='G'){ echo '<tr><td>' . _('Auto Issue this Component to Work Orders') . ':</td> @@ -709,20 +705,21 @@ $_POST['AutoIssue'] = $_SESSION['AutoIssue']; } if ($_POST['AutoIssue']==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>'; } else { - echo '<input type=hidden name="AutoIssue" VALUE=0>'; + echo '<input type=hidden name="AutoIssue" value="0">'; } - echo "</table><br><div class='centre'><input tabindex='8' type='Submit' name='Submit' value='" . _('Enter Information') . "'></form></div>"; + echo '</table> + <br /><div class="centre"><input tabindex="8" type="submit" name="Submit" value="' . _('Enter Information') . '"></form></div>'; } //end if record deleted no point displaying form to add record @@ -791,26 +788,32 @@ if (!isset($SelectedParent)) { echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/magnifier.png" title="' . _('Search') . '" alt="">' . ' ' . $title; - echo "<form action=" . $_SERVER['PHP_SELF'] . "?" . SID ." method=post>" . + echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">' . '<div class="page_help_text">'. _('Select a manufactured part') . " (" . _('or Assembly or Kit part') . ") " . - _('to maintain the bill of material for using the options below') . "." . "<br><font size=1>" . - _('Parts must be defined in the stock item entry') . "/" . _('modification screen as manufactured') . - ", " . _('kits or assemblies to be available for construction of a bill of material') .'</div>'. - "</font><br><table class=selection cellpadding=3 colspan=4><tr><td><font size=1>" . _('Enter text extracts in the') . - " <b>" . _('description') . "</b>:</font></td><td><input tabindex='1' type='Text' name='Keywords' size=20 maxlength=25></td> - <td><font size=3><b>" . _('OR') . "</b></font></td><td><font size=1>" . _('Enter extract of the') . - " <b>" . _('Stock Code') . "</b>:</font></td><td><input tabindex='2' type='Text' name='StockCode' size=15 maxlength=18></td> - </tr></table><br><div class='centre'><input tabindex='3' type=submit name='Search' VALUE=" . _('Search Now') . "></div>"; + _('to maintain the bill of material for using the options below') . '<br /><font size=1>' . + _('Parts must be defined in the stock item entry') . '/' . _('modification screen as manufactured') . + ', ' . _('kits or assemblies to be available for construction of a bill of material') .'</div>'. + '</font> + <br /> + <table class="selection" cellpadding="3" colspan="4"> + <tr><td><font size=1>' . _('Enter text extracts in the') . ' <b>' . _('description') . '</b>:</font></td> + <td><input tabindex="1" type="text" name="Keywords" size="20" maxlength="25"></td> + <td><font size=3><b>' . _('OR') . '</b></font></td> + <td><font size=1>' . _('Enter extract of the') . ' <b>' . _('Stock Code') . '</b>:</font></td> + <td><input tabindex="2" type="text" name="StockCode" size="15" maxlength="18"></td> + </tr> + </table> + <br /><div class="centre"><input tabindex="3" type="submit" name="Search" value="' . _('Search Now') . '"></div>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; if (isset($_POST['Search']) and isset($result) AND !isset($SelectedParent)) { - echo '<br><table cellpadding=2 colspan=7 class=selection>'; + echo '<br /><table cellpadding=2 colspan=7 class=selection>'; $TableHeader = '<tr><th>' . _('Code') . '</th> - <th>' . _('Description') . '</th> - <th>' . _('On Hand') . '</th> - <th>' . _('Units') . '</th> - </tr>'; + <th>' . _('Description') . '</th> + <th>' . _('On Hand') . '</th> + <th>' . _('Units') . '</th> + </tr>'; echo $TableHeader; @@ -830,15 +833,14 @@ $StockOnHand = number_format($myrow['totalonhand'],2); } $tab = $j+3; - printf("<td><input tabindex='".$tab."' type=submit name='Select' VALUE='%s'</td> + printf('<td><input tabindex="' . $tab . '" type="submit" name="Select" value="%s"</td> <td>%s</td> <td class=number>%s</td> - <td>%s</td></tr>", + <td>%s</td></tr>', $myrow['stockid'], $myrow['description'], $StockOnHand, - $myrow['units'] - ); + $myrow['units']); $j++; //end of page full new headings if @@ -851,12 +853,12 @@ //end if results to show if (!isset($SelectedParent) or $SelectedParent=='') { - echo "<script>defaultControl(document.forms[0].StockCode);</script>"; + echo '<script>defaultControl(document.forms[0].StockCode);</script>'; } else { - echo "<script>defaultControl(document.form.JournalProcessDate);</script>"; + echo '<script>defaultControl(document.form.JournalProcessDate);</script>'; } -echo "</form>"; +echo '</form>'; } //end StockID already selected Modified: trunk/BankAccounts.php =================================================================== --- trunk/BankAccounts.php 2011-04-29 12:43:19 UTC (rev 4558) +++ trunk/BankAccounts.php 2011-05-01 09:45:18 UTC (rev 4559) @@ -1,9 +1,7 @@ <?php -/* $Revision: 1.21 $ */ + /* $Id$*/ -//$PageSecurity = 10; - include('includes/session.inc'); $title = _('Bank Accounts Maintenance'); @@ -11,7 +9,7 @@ include('includes/header.inc'); echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/money_add.png" title="' . _('Bank') . '" alt="" />' . ' ' . $title . '</p>'; - echo '<div class="page_help_text">' . _('Update Bank Account details. Account Code is for SWIFT or BSB type Bank Codes. Set Default for Invoices to "yes" to print Account details on Invoices (only one account can be set to "yes").') . '.</div><br>'; +echo '<div class="page_help_text">' . _('Update Bank Account details. Account Code is for SWIFT or BSB type Bank Codes. Set Default for Invoices to "yes" to print Account details on Invoices (only one account can be set to "yes").') . '.</div><br />'; if (isset($_GET['SelectedBankAccount'])) { $SelectedBankAccount=$_GET['SelectedBankAccount']; @@ -85,23 +83,21 @@ $sql = "SELECT * FROM banktrans WHERE bankact='" . $SelectedBankAccount . "'"; $BankTransResult = DB_query($sql,$db); if (DB_num_rows($BankTransResult)>0) { - $sql = "UPDATE bankaccounts - SET bankaccountname='" . $_POST['BankAccountName'] . "', - bankaccountcode='" . $_POST['BankAccountCode'] . "', - bankaccountnumber='" . $_POST['BankAccountNumber'] . "', - bankaddress='" . $_POST['BankAddress'] . "', - invoice ='" . $_POST['DefAccount'] . "' - WHERE accountcode = '" . $SelectedBankAccount . "'"; + $sql = "UPDATE bankaccounts SET bankaccountname='" . $_POST['BankAccountName'] . "', + bankaccountcode='" . $_POST['BankAccountCode'] . "', + bankaccountnumber='" . $_POST['BankAccountNumber'] . "', + bankaddress='" . $_POST['BankAddress'] . "', + invoice ='" . $_POST['DefAccount'] . "' + WHERE accountcode = '" . $SelectedBankAccount . "'"; prnMsg(_('Note that it is not possible to change the currency of the account once there are transactions against it'),'warn'); - echo '<br>'; + echo '<br />'; } else { - $sql = "UPDATE bankaccounts - SET bankaccountname='" . $_POST['BankAccountName'] . "', - bankaccountcode='" . $_POST['BankAccountCode'] . "', - bankaccountnumber='" . $_POST['BankAccountNumber'] . "', - bankaddress='" . $_POST['BankAddress'] . "', - currcode ='" . $_POST['CurrCode'] . "', - invoice ='" . $_POST['DefAccount'] . "' + $sql = "UPDATE bankaccounts SET bankaccountname='" . $_POST['BankAccountName'] . "', + bankaccountcode='" . $_POST['BankAccountCode'] . "', + bankaccountnumber='" . $_POST['BankAccountNumber'] . "', + bankaddress='" . $_POST['BankAddress'] . "', + currcode ='" . $_POST['CurrCode'] . "', + invoice ='" . $_POST['DefAccount'] . "' WHERE accountcode = '" . $SelectedBankAccount . "'"; } @@ -110,22 +106,20 @@ /*Selectedbank account is null cos no item selected on first time round so must be adding a record must be submitting new entries in the new bank account form */ - $sql = "INSERT INTO bankaccounts ( - accountcode, - bankaccountname, - bankaccountcode, - bankaccountnumber, - bankaddress, - currcode, - invoice) - VALUES ('" . $_POST['AccountCode'] . "', - '" . $_POST['BankAccountName'] . "', - '" . $_POST['BankAccountCode'] . "', - '" . $_POST['BankAccountNumber'] . "', - '" . $_POST['BankAddress'] . "', - '" . $_POST['CurrCode'] . "', - '" . $_POST['DefAccount'] . "' - )"; + $sql = "INSERT INTO bankaccounts (accountcode, + bankaccountname, + bankaccountcode, + bankaccountnumber, + bankaddress, + currcode, + invoice) + VALUES ('" . $_POST['AccountCode'] . "', + '" . $_POST['BankAccountName'] . "', + '" . $_POST['BankAccountCode'] . "', + '" . $_POST['BankAccountNumber'] . "', + '" . $_POST['BankAddress'] . "', + '" . $_POST['CurrCode'] . "', + '" . $_POST['DefAccount'] . "' )"; $msg = _('The new bank account has been entered'); } @@ -136,7 +130,7 @@ $result = DB_query($sql,$db,$ErrMsg,$DbgMsg); prnMsg($msg,'success'); - echo '<br>'; + echo '<br />'; unset($_POST['AccountCode']); unset($_POST['BankAccountName']); unset($_POST['BankAccountNumber']); @@ -160,7 +154,7 @@ if ($myrow[0]>0) { $CancelDelete = 1; prnMsg(_('Cannot delete this bank account because transactions have been created using this account'),'warn'); - echo '<br> ' . _('There are') . ' ' . $myrow[0] . ' ' . _('transactions with this bank account code'); + echo '<br /> ' . _('There are') . ' ' . $myrow[0] . ' ' . _('transactions with this bank account code'); } if (!$CancelDelete) { @@ -188,19 +182,20 @@ WHERE bankaccounts.accountcode = chartmaster.accountcode"; $ErrMsg = _('The bank accounts set up could not be retrieved because'); - $DbgMsg = _('The SQL used to retrieve the bank account details was') . '<br>' . $sql; + $DbgMsg = _('The SQL used to retrieve the bank account details was') . '<br />' . $sql; $result = DB_query($sql,$db,$ErrMsg,$DbgMsg); echo '<table class="selection">'; - echo "<tr><th>" . _('GL Account Code') . "</th> - <th>" . _('Bank Account Name') . "</th> - <th>" . _('Bank Account Code') . "</th> - <th>" . _('Bank Account Number') . "</th> - <th>" . _('Bank Address') . "</th> - <th>" . _('Currency') . "</th> - <th>" . _('Default for Invoices') . "</th> - </tr>"; + echo '<tr> + <th>' . _('GL Account Code') . '</th> + <th>' . _('Bank Account Name') . '</th> + <th>' . _('Bank Account Code') . '</th> + <th>' . _('Bank Account Number') . '</th> + <th>' . _('Bank Address') . '</th> + <th>' . _('Currency') . '</th> + <th>' . _('Default for Invoices') . '</th> + </tr>'; $k=0; //row colour counter while ($myrow = DB_fetch_row($result)) { @@ -216,16 +211,16 @@ } else { $defacc=_('Yes'); } - printf("<td>%s<br><font size=2>%s</font></td> + printf('<td>%s<br /><font size=2>%s</font></td> <td>%s</td> <td>%s</td> <td>%s</td> <td>%s</td> <td>%s</td> <td>%s</td> - <td><a href=\"%s?SelectedBankAccount=%s\">" . _('Edit') . "</td> - <td><a href=\"%s?SelectedBankAccount=%s&delete=1\">" . _('Delete') . "</td> - </tr>", + <td><a href="%s?SelectedBankAccount=%s">' . _('Edit') . '</td> + <td><a href="%s?SelectedBankAccount=%s&delete=1">' . _('Delete') . '</td> + </tr>', $myrow[0], $myrow[2], $myrow[3], @@ -364,12 +359,13 @@ } }//end while loop } else { - echo '<option VALUE=1>'._('Yes').'</option><option value=0>'._('No').'</option>'; + echo '<option value="1">'._('Yes').'</option> + <option value="0">'._('No').'</option>'; } echo '</select></td>'; -echo '</tr></table><br> +echo '</tr></table><br /> <div class="centre"><input tabindex="7" type="Submit" name="submit" value="'. _('Enter Information') .'"></div>'; echo '</form>'; Modified: trunk/Logout.php =================================================================== --- trunk/Logout.php 2011-04-29 12:43:19 UTC (rev 4558) +++ trunk/Logout.php 2011-05-01 09:45:18 UTC (rev 4559) @@ -23,7 +23,7 @@ <?php echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; ?> - <label><?php echo _('Thank you for using webERP'); ?></label> + <span><?php echo _('Thank you for using webERP'); ?></span> <br /> <input class="button" type="submit" value="<?php echo _('Login'); ?>" name="SubmitUser" /> </form> Modified: trunk/PageSecurity.php =================================================================== --- trunk/PageSecurity.php 2011-04-29 12:43:19 UTC (rev 4558) +++ trunk/PageSecurity.php 2011-05-01 09:45:18 UTC (rev 4559) @@ -13,17 +13,17 @@ if (isset($_POST['Update'])) { foreach ($_POST as $ScriptName => $PageSecurityValue) { if ($ScriptName!='Update' and $ScriptName!='FormID') { - //$key=substr($key, 0, strlen($key)-4).'.php'; + $ScriptName=substr($ScriptName, 0, strlen($Sc... [truncated message content] |
From: <dai...@us...> - 2011-05-01 09:45:27
|
Revision: 4559 http://web-erp.svn.sourceforge.net/web-erp/?rev=4559&view=rev Author: daintree Date: 2011-05-01 09:45:18 +0000 (Sun, 01 May 2011) Log Message: ----------- quoting Modified Paths: -------------- trunk/AccountSections.php trunk/AgedDebtors.php trunk/AuditTrail.php trunk/BOMIndented.php trunk/BOMListing.php trunk/BOMs.php trunk/BankAccounts.php trunk/Logout.php trunk/PageSecurity.php trunk/SecurityTokens.php trunk/StockTransferControlled.php trunk/StockUsage.php trunk/SuppTransGLAnalysis.php trunk/SupplierContacts.php trunk/SupplierInquiry.php trunk/SupplierTypes.php trunk/TaxGroups.php trunk/WorkOrderCosting.php trunk/Z_CheckDebtorsControl.php trunk/css/default/login.css trunk/css/fresh/login.css trunk/css/gel/login.css trunk/css/jelly/login.css trunk/css/professional/login.css trunk/css/professional-rtl/login.css trunk/css/silverwolf/login.css trunk/doc/Change.log.html trunk/includes/Login.php trunk/index.php Modified: trunk/AccountSections.php =================================================================== --- trunk/AccountSections.php 2011-04-29 12:43:19 UTC (rev 4558) +++ trunk/AccountSections.php 2011-05-01 09:45:18 UTC (rev 4559) @@ -1,9 +1,7 @@ <?php -/* $Revision: 1.7 $ */ + /* $Id$*/ -//$PageSecurity = 10; - include('includes/session.inc'); $title = _('Account Sections'); @@ -136,7 +134,7 @@ $myrow = DB_fetch_row($result); if ($myrow[0]>0) { prnMsg( _('Cannot delete this account section because general ledger accounts groups have been created using this section'),'warn'); - echo '<br>' . _('There are') . ' ' . $myrow[0] . ' ' . _('general ledger accounts groups that refer to this account section') . '</font>'; + echo '<br />' . _('There are') . ' ' . $myrow[0] . ' ' . _('general ledger accounts groups that refer to this account section') . '</font>'; } else { //Fetch section name @@ -176,11 +174,11 @@ $result = DB_query($sql,$db,$ErrMsg); echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/maintenance.png" title="' . _('Search') . '" alt="" />' . ' ' . $title.'</p><br />'; - echo "<table name='SectionList' class='selection'> + echo '<table name="SectionList" class="selection"> <tr> - <th>" . _('Section Number') . "</th> - <th>" . _('Section Description') . "</th> - </tr>"; + <th>' . _('Section Number') . '</th> + <th>' . _('Section Description') . '</th> + </tr>'; $k=0; //row colour counter while ($myrow = DB_fetch_row($result)) { @@ -194,11 +192,11 @@ } echo '<td>' . $myrow[0] . '</td><td>' . $myrow[1] . '</td>'; - echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?' . SID . '&SelectedSectionID=' . $myrow[0] . '">' . _('Edit') . '</a></td>'; + echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedSectionID=' . $myrow[0] . '">' . _('Edit') . '</a></td>'; if ( $myrow[0] == '1' || $myrow[0] == '2' ) { echo '<td><b>'._('Restricted').'</b></td>'; } else { - echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?' . SID . '&SelectedSectionID=' . $myrow[0] . '&delete=1">' . _('Delete') .'</a></td>'; + echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedSectionID=' . $myrow[0] . '&delete=1">' . _('Delete') .'</a></td>'; } echo '</tr>'; } //END WHILE LIST LOOP @@ -207,12 +205,12 @@ if (isset($_POST['SelectedSectionID']) or isset($_GET['SelectedSectionID'])) { - echo '<div class="centre"><a href=' . $_SERVER['PHP_SELF'] . '?' . SID .'>' . _('Review Account Sections') . '</a></div>'; + echo '<div class="centre"><a href="' . $_SERVER['PHP_SELF'] . '">' . _('Review Account Sections') . '</a></div>'; } if (! isset($_GET['delete'])) { - echo "<form method='post' name='AccountSections' action='" . $_SERVER['PHP_SELF'] . '?' . SID . "'>"; + echo '<form method="post" name="AccountSections" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; if (isset($_GET['SelectedSectionID'])) { @@ -233,10 +231,12 @@ $_POST['SectionID'] = $myrow['sectionid']; $_POST['SectionName'] = $myrow['sectionname']; - echo "<input type=hidden name='SelectedSectionID' value='" . $_POST['SectionID'] . "'>"; - echo "<table class=selection> - <td>" . _('Section Number') . ':' . "</td> - <td>" . $_POST['SectionID'] . "</td>"; + echo '<input type=hidden name="SelectedSectionID" value="' . $_POST['SectionID'] . '" />'; + echo '<table class="selection"> + <tr> + <td>' . _('Section Number') . ':' . '</td> + <td>' . $_POST['SectionID'] . '</td> + </tr>'; } } else { @@ -250,22 +250,23 @@ if (!isset($_POST['SectionName'])) { $_POST['SectionName']=''; } - echo "<table class='selection'> + echo '<table class="selection"> <tr> - <td>" . _('Section Number') . ':' . '</td> - <td><input tabindex="1" ' . (in_array('SectionID',$Errors) ? 'class="inputerror"' : '' ) ." type='text' name='SectionID' class='number' size='4' maxlength='4' value='" . $_POST['SectionID'] . "' /></td></tr>"; + <td>' . _('Section Number') . ':' . '</td> + <td><input tabindex="1" ' . (in_array('SectionID',$Errors) ? 'class="inputerror"' : '' ) .' type="text" name="SectionID" class="number" size="4" maxlength="4" value="' . $_POST['SectionID'] . '" /></td> + </tr>'; } - echo "<tr><td>" . _('Section Description') . ':' . '</td> - <td><input tabindex="2" ' . (in_array('SectionName',$Errors) ? 'class="inputerror"' : '' ) ." type='text' name='SectionName' size='30' maxlength='30' value='" . $_POST['SectionName'] . "' /></td> - </tr>"; + echo '<tr><td>' . _('Section Description') . ':' . '</td> + <td><input tabindex="2" ' . (in_array('SectionName',$Errors) ? 'class="inputerror"' : '' ) .' type="text" name="SectionName" size="30" maxlength="30" value="' . $_POST['SectionName'] . '" /></td> + </tr>'; echo '<tr><td colspan="2"><div class="centre"><input tabindex="3" type="submit" name="submit" value="' . _('Enter Information') . '" /></div></td></tr>'; echo '</table><br />'; if (!isset($_GET['SelectedSectionID']) or $_GET['SelectedSectionID']=='') { - echo "<script>defaultControl(document.AccountSections.SectionID);</script>"; + echo '<script>defaultControl(document.AccountSections.SectionID);</script>'; } else { - echo "<script>defaultControl(document.AccountSections.SectionName);</script>"; + echo '<script>defaultControl(document.AccountSections.SectionName);</script>'; } echo '</form>'; Modified: trunk/AgedDebtors.php =================================================================== --- trunk/AgedDebtors.php 2011-04-29 12:43:19 UTC (rev 4558) +++ trunk/AgedDebtors.php 2011-05-01 09:45:18 UTC (rev 4559) @@ -2,9 +2,6 @@ /* $Id$ */ -/* $Revision: 1.20 $ */ - -//$PageSecurity = 2; include('includes/session.inc'); if (isset($_POST['PrintPDF']) @@ -22,7 +19,7 @@ /*Now figure out the aged analysis for the customer range under review */ if (trim($_POST['Salesman'])!=''){ - $SalesLimit = " and debtorsmaster.debtorno in (SELECT DISTINCT debtorno FROM custbranch where salesman = '".$_POST['Salesman']."') "; + $SalesLimit = " AND debtorsmaster.debtorno IN (SELECT DISTINCT debtorno FROM custbranch where salesman = '".$_POST['Salesman']."') "; } else { $SalesLimit = ""; } @@ -30,6 +27,7 @@ $SQL = "SELECT debtorsmaster.debtorno, debtorsmaster.name, currencies.currency, + currencies.decimalplaces, paymentterms.terms, debtorsmaster.creditlimit, holdreasons.dissallowinvoices, @@ -86,6 +84,7 @@ GROUP BY debtorsmaster.debtorno, debtorsmaster.name, currencies.currency, + currencies.decimalplaces, paymentterms.terms, paymentterms.daysbeforedue, paymentterms.dayinfollowingmonth, @@ -100,6 +99,7 @@ $SQL = "SELECT debtorsmaster.debtorno, debtorsmaster.name, currencies.currency, + currencies.decimalplaces, paymentterms.terms, debtorsmaster.creditlimit, holdreasons.dissallowinvoices, @@ -158,6 +158,7 @@ GROUP BY debtorsmaster.debtorno, debtorsmaster.name, currencies.currency, + currencies.decimalplaces, paymentterms.terms, paymentterms.daysbeforedue, paymentterms.dayinfollowingmonth, @@ -182,6 +183,7 @@ $SQL = "SELECT debtorsmaster.debtorno, debtorsmaster.name, currencies.currency, + currencies.decimalplaces, paymentterms.terms, debtorsmaster.creditlimit, holdreasons.dissallowinvoices, @@ -245,6 +247,7 @@ GROUP BY debtorsmaster.debtorno, debtorsmaster.name, currencies.currency, + currencies.decimalplaces, paymentterms.terms, paymentterms.daysbeforedue, paymentterms.dayinfollowingmonth, @@ -267,9 +270,9 @@ $title = _('Aged Customer Account Analysis') . ' - ' . _('Problem Report') . '.... '; include('includes/header.inc'); echo '<p>' . _('The customer details could not be retrieved by the SQL because') . ' ' . DB_error_msg($db); - 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; @@ -283,16 +286,17 @@ $TotOD1=0; $TotOD2=0; - $ListCount = DB_num_rows($CustomerResult); //UldisN - + $ListCount = DB_num_rows($CustomerResult); + $DecimalPlaces =2; //by default + while ($AgedAnalysis = DB_fetch_array($CustomerResult,$db)){ + $DecimalPlaces = $AgedAnalysis['decimalplaces']; + $DisplayDue = number_format($AgedAnalysis['due']-$AgedAnalysis['overdue1'],$DecimalPlaces); + $DisplayCurrent = number_format($AgedAnalysis['balance']-$AgedAnalysis['due'],$DecimalPlaces); + $DisplayBalance = number_format($AgedAnalysis['balance'],$DecimalPlaces); + $DisplayOverdue1 = number_format($AgedAnalysis['overdue1']-$AgedAnalysis['overdue2'],$DecimalPlaces); + $DisplayOverdue2 = number_format($AgedAnalysis['overdue2'],$DecimalPlaces); - $DisplayDue = number_format($AgedAnalysis['due']-$AgedAnalysis['overdue1'],2); - $DisplayCurrent = number_format($AgedAnalysis['balance']-$AgedAnalysis['due'],2); - $DisplayBalance = number_format($AgedAnalysis['balance'],2); - $DisplayOverdue1 = number_format($AgedAnalysis['overdue1']-$AgedAnalysis['overdue2'],2); - $DisplayOverdue2 = number_format($AgedAnalysis['overdue2'],2); - $TotBal += $AgedAnalysis['balance']; $TotDue += ($AgedAnalysis['due']-$AgedAnalysis['overdue1']); $TotCurr += ($AgedAnalysis['balance']-$AgedAnalysis['due']); @@ -364,10 +368,10 @@ if (DB_error_no($db) !=0) { $title = _('Aged Customer Account Analysis') . ' - ' . _('Problem Report') . '....'; include('includes/header.inc'); - echo '<br><br>' . _('The details of outstanding transactions for customer') . ' - ' . $AgedAnalysis['debtorno'] . ' ' . _('could not be retrieved because') . ' - ' . DB_error_msg($db); - echo "<br><a href='$rootpath/index.php'>" . _('Back to the menu') . '</a>'; + echo '<br /><br />' . _('The details of outstanding transactions for customer') . ' - ' . $AgedAnalysis['debtorno'] . ' ' . _('could not be retrieved because') . ' - ' . DB_error_msg($db); + echo '<br /><a href="' . $rootpath . '/index.php">' . _('Back to the menu') . '</a>'; if ($debug==1){ - echo '<br>' . _('The SQL that failed was') . '<p>' . $sql; + echo '<br />' . _('The SQL that failed was') . '<p>' . $sql; } include('includes/footer.inc'); exit; @@ -380,11 +384,11 @@ $DisplayTranDate = ConvertSQLDate($DetailTrans['trandate']); $LeftOvers = $pdf->addTextWrap($Left_Margin+125,$YPos,75,$FontSize,$DisplayTranDate,'left'); - $DisplayDue = number_format($DetailTrans['due']-$DetailTrans['overdue1'],2); - $DisplayCurrent = number_format($DetailTrans['balance']-$DetailTrans['due'],2); - $DisplayBalance = number_format($DetailTrans['balance'],2); - $DisplayOverdue1 = number_format($DetailTrans['overdue1']-$DetailTrans['overdue2'],2); - $DisplayOverdue2 = number_format($DetailTrans['overdue2'],2); + $DisplayDue = number_format($DetailTrans['due']-$DetailTrans['overdue1'],$DecimalPlaces); + $DisplayCurrent = number_format($DetailTrans['balance']-$DetailTrans['due'],$DecimalPlaces); + $DisplayBalance = number_format($DetailTrans['balance'],$DecimalPlaces); + $DisplayOverdue1 = number_format($DetailTrans['overdue1']-$DetailTrans['overdue2'],$DecimalPlaces); + $DisplayOverdue2 = number_format($DetailTrans['overdue2'],$DecimalPlaces); $LeftOvers = $pdf->addTextWrap(220,$YPos,60,$FontSize,$DisplayBalance,'right'); $LeftOvers = $pdf->addTextWrap(280,$YPos,60,$FontSize,$DisplayCurrent,'right'); @@ -414,11 +418,11 @@ $pdf->line($Page_Width-$Right_Margin, $YPos+10 ,220, $YPos+10); } - $DisplayTotBalance = number_format($TotBal,2); - $DisplayTotDue = number_format($TotDue,2); - $DisplayTotCurrent = number_format($TotCurr,2); - $DisplayTotOverdue1 = number_format($TotOD1,2); - $DisplayTotOverdue2 = number_format($TotOD2,2); + $DisplayTotBalance = number_format($TotBal,$DecimalPlaces); + $DisplayTotDue = number_format($TotDue,$DecimalPlaces); + $DisplayTotCurrent = number_format($TotCurr,$DecimalPlaces); + $DisplayTotOverdue1 = number_format($TotOD1,$DecimalPlaces); + $DisplayTotOverdue2 = number_format($TotOD2,$DecimalPlaces); $LeftOvers = $pdf->addTextWrap(220,$YPos,60,$FontSize,$DisplayTotBalance,'right'); $LeftOvers = $pdf->addTextWrap(280,$YPos,60,$FontSize,$DisplayTotCurrent,'right'); @@ -426,12 +430,6 @@ $LeftOvers = $pdf->addTextWrap(400,$YPos,60,$FontSize,$DisplayTotOverdue1,'right'); $LeftOvers = $pdf->addTextWrap(460,$YPos,60,$FontSize,$DisplayTotOverdue2,'right'); -/* Javier: This actually would produce the output - $buf = $pdf->output(); - $len = strlen($buf); -*/ - -// if ($len < 1000) { if ($ListCount == 0) { $title = _('Aged Customer Account Analysis') . ' - ' . _('Problem Report') . '....'; include('includes/header.inc'); @@ -439,26 +437,14 @@ if ($debug==1){ prnMsg($SQL,'info'); } - echo "<br><a href='$rootpath/index.php'>" . _('Back to the menu') . '</a>'; + echo '<br /><a href="' . $rootpath . '/index.php">' . _('Back to the menu') . '</a>'; include('includes/footer.inc'); exit; + } else { + $pdf->OutputD($_SESSION['DatabaseName'] . '_' . 'AgedDebtors_' . date('Y-m-d') . '.pdf'); + $pdf-> __destruct(); } -/* Javier: TCPDF sends its own http header, would be an error to send it twice. - header('Content-type: application/pdf'); - header("Content-Length: $len"); - header('Content-Disposition: inline; filename=AgedDebtors.pdf'); - header('Expires: 0'); - header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); - header('Pragma: public'); - $pdf->stream(); */ - -// This else was missed - else { - $pdf->OutputD($_SESSION['DatabaseName'] . '_' . 'AgedDebtors_' . date('Y-m-d') . '.pdf'); - $pdf-> __destruct(); - } - } else { /*The option to print PDF was not hit */ $title=_('Aged Debtor Analysis'); @@ -471,56 +457,64 @@ /*if $FromCriteria is not set then show a form to allow input */ - echo '<form action=' . $_SERVER['PHP_SELF'] . " method='post'><table>"; + echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post"> + <table>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<tr><td>' . _('From Customer Code') . ':' . "</font></td><td><input tabindex='1' Type=text maxlength=6 size=7 name=FromCriteria value='0'></td></tr>"; - echo '<tr><td>' . _('To Customer Code') . ':' . "</td><td><input tabindex='2' Type=text maxlength=6 size=7 name=ToCriteria value='zzzzzz'></td></tr>"; + echo '<tr><td>' . _('From Customer Code') . ':' . '</font></td> + <td><input tabindex="1" type="text" maxlength="6" size="7" name="FromCriteria" value="0"></td> + </tr>'; + echo '<tr><td>' . _('To Customer Code') . ':' . '</td> + <td><input tabindex="2" type="text" maxlength="6" size="7" name="ToCriteria" value="zzzzzz" /></td> + </tr>'; - echo '<tr><td>' . _('All balances or overdues only') . ':' . "</td><td><select tabindex='3' name='All_Or_Overdues'>"; - echo "<option selected Value='All'>" . _('All customers with balances'); - echo "<option Value='OverduesOnly'>" . _('Overdue accounts only'); - echo "<option Value='HeldOnly'>" . _('Held accounts only'); - echo '</select></td></tr>'; + echo '<tr><td>' . _('All balances or overdues only') . ':' . '</td> + <td><select tabindex="3" name="All_Or_Overdues"> + <option selected value="All">' . _('All customers with balances') . '</option> + <option value="OverduesOnly">' . _('Overdue accounts only') . '</option> + <option value="HeldOnly">' . _('Held accounts only') . '</option> + </select> + </td> + </tr>'; - echo '<tr><td>' . _('Only Show Customers Of') . ':' . "</td><td><select tabindex='4' name='Salesman'>"; + echo '<tr><td>' . _('Only Show Customers Of') . ':' . '</td> + <td><select tabindex="4" name="Salesman">'; - $sql = 'SELECT salesmancode, salesmanname FROM salesman'; + $sql = "SELECT salesmancode, salesmanname FROM salesman"; $result=DB_query($sql,$db); - echo "<option value=''></option>"; + echo '<option value=""></option>'; while ($myrow=DB_fetch_array($result)){ - echo "<option value='" . $myrow['salesmancode'] . "'>" . $myrow['salesmanname']; + echo '<option value="' . $myrow['salesmancode'] . '">' . $myrow['salesmanname'] . '</option>'; } echo '</select></td></tr>'; - echo '<tr><td>' . _('Only show customers trading in') . ':' . "</td><td><select tabindex='5' name='Currency'>"; + echo '<tr><td>' . _('Only show customers trading in') . ':' . '</td> + <td><select tabindex="5" name="Currency">'; - $sql = 'SELECT currency, currabrev FROM currencies'; + $sql = "SELECT currency, currabrev FROM currencies"; $result=DB_query($sql,$db); - - while ($myrow=DB_fetch_array($result)){ if ($myrow['currabrev'] == $_SESSION['CompanyRecord']['currencydefault']){ - 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>'; } } echo '</select></td></tr>'; - echo '<tr><td>' . _('Summary or detailed report') . ':' . "</td> - <td><select tabindex='6' name='DetailedReport'>"; - echo "<option selected value='No'>" . _('Summary Report'); - echo "<option value='Yes'>" . _('Detailed Report'); - echo '</select></td></tr>'; + echo '<tr><td>' . _('Summary or detailed report') . ':' . '</td> + <td><select tabindex="6" name="DetailedReport"> + <option selected value="No">' . _('Summary Report') . '</option> + <option value="Yes">' . _('Detailed Report') . '</option> + </select> + </td> + </tr>'; - echo '</table><br><div class="centre"><input tabindex="7" type=submit name="PrintPDF" value="' . _('Print PDF') , '"></div>'; + echo '</table><br /><div class="centre"><input tabindex="7" type=submit name="PrintPDF" value="' . _('Print PDF') , '"></div>'; } include('includes/footer.inc'); - } /*end of else not PrintPDF */ - -?> +?> \ No newline at end of file Modified: trunk/AuditTrail.php =================================================================== --- trunk/AuditTrail.php 2011-04-29 12:43:19 UTC (rev 4558) +++ trunk/AuditTrail.php 2011-05-01 09:45:18 UTC (rev 4559) @@ -40,18 +40,19 @@ // Show user selections echo '<tr><td>'. _('User ID'). '</td> <td><select tabindex="3" name="SelectedUser">'; -echo '<option value=ALL>ALL'; +echo '<option value="ALL">' . _('ALL') . '</option>'; while ($users = DB_fetch_row($UserResult)) { if (isset($_POST['SelectedUser']) and $users[0]==$_POST['SelectedUser']) { - echo '<option selected value=' . $users[0] . '>' . $users[0] . '</option>'; + echo '<option selected value="' . $users[0] . '">' . $users[0] . '</option>'; } else { - echo '<option value=' . $users[0] . '>' . $users[0] . '</option>'; + echo '<option value="' . $users[0] . '">' . $users[0] . '</option>'; } } echo '</select></td></tr>'; // Show table selections -echo '<tr><td>'. _('Table '). '</td><td><select tabindex="4" name="SelectedTable">'; +echo '<tr><td>'. _('Table '). '</td> + <td><select tabindex="4" name="SelectedTable">'; echo '<option value="ALL">' . _('ALL') . '</option>'; while ($tables = DB_fetch_row($TableResult)) { if (isset($_POST['SelectedTable']) and $tables[0]==$_POST['SelectedTable']) { Modified: trunk/BOMIndented.php =================================================================== --- trunk/BOMIndented.php 2011-04-29 12:43:19 UTC (rev 4558) +++ trunk/BOMIndented.php 2011-05-01 09:45:18 UTC (rev 4559) @@ -15,19 +15,19 @@ $PageNumber=1; $line_height=12; - $sql = 'DROP TABLE IF EXISTS tempbom'; + $sql = "DROP TABLE IF EXISTS tempbom"; $result = DB_query($sql,$db); - $sql = 'DROP TABLE IF EXISTS passbom'; + $sql = "DROP TABLE IF EXISTS passbom"; $result = DB_query($sql,$db); - $sql = 'DROP TABLE IF EXISTS passbom2'; + $sql = "DROP TABLE IF EXISTS passbom2"; $result = DB_query($sql,$db); - $sql = 'CREATE TEMPORARY TABLE passbom ( + $sql = "CREATE TEMPORARY TABLE passbom ( part char(20), - sortpart text) DEFAULT CHARSET=utf8'; + sortpart text) DEFAULT CHARSET=utf8"; $ErrMsg = _('The SQL to create passbom failed with the message'); $result = DB_query($sql,$db,$ErrMsg); - $sql = 'CREATE TEMPORARY TABLE tempbom ( + $sql = "CREATE TEMPORARY TABLE tempbom ( parent char(20), component char(20), sortpart text, @@ -36,7 +36,7 @@ loccode char(5), effectiveafter date, effectiveto date, - quantity double) DEFAULT CHARSET=utf8'; + 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 @@ -112,32 +112,32 @@ AND bom.effectiveto >= NOW() AND bom.effectiveafter <= NOW()"; $result = DB_query($sql,$db); - $sql = 'DROP TABLE IF EXISTS passbom2'; + $sql = "DROP TABLE IF EXISTS passbom2"; $result = DB_query($sql,$db); - $sql = 'ALTER TABLE passbom RENAME AS passbom2'; + $sql = "ALTER TABLE passbom RENAME AS passbom2"; $result = DB_query($sql,$db); - $sql = 'DROP TABLE IF EXISTS passbom'; + $sql = "DROP TABLE IF EXISTS passbom"; $result = DB_query($sql,$db); - $sql = 'CREATE TEMPORARY TABLE passbom ( - part char(20), - sortpart text) DEFAULT CHARSET=utf8'; + $sql = "CREATE TEMPORARY TABLE passbom ( + part char(20), + 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.effectiveafter <= NOW()"; $result = DB_query($sql,$db); - $sql = 'SELECT COUNT(*) FROM bom,passbom WHERE bom.parent = passbom.part'; + $sql = "SELECT COUNT(*) FROM bom,passbom WHERE bom.parent = passbom.part"; $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); @@ -150,9 +150,9 @@ $title = _('Indented BOM Listing') . ' - ' . _('Problem Report'); include('includes/header.inc'); prnMsg( _('The Indented 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; @@ -172,12 +172,12 @@ $Right_Margin,$assemblydesc); $Tot_Val=0; - $sql = 'SELECT tempbom.*, - stockmaster.description, - stockmaster.mbflag - FROM tempbom,stockmaster - WHERE tempbom.component = stockmaster.stockid - ORDER BY sortpart'; + $sql = "SELECT tempbom.*, + stockmaster.description, + stockmaster.mbflag + FROM tempbom,stockmaster + WHERE tempbom.component = stockmaster.stockid + ORDER BY sortpart"; $result = DB_query($sql,$db); // $fill is used to alternate between lines with transparent and painted background @@ -226,21 +226,16 @@ 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 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>'; + echo '<br /><a href="' . $rootpath . '/index.php">' . _('Back to the menu') . '</a>'; include('includes/footer.inc'); exit; } else { - $pdf->OutputD($_SESSION['DatabaseName'] . '_Customer_trans_' . date('Y-m-d').'.pdf');//UldisN + $pdf->OutputD($_SESSION['DatabaseName'] . '_Customer_trans_' . date('Y-m-d').'.pdf'); $pdf->__destruct(); } @@ -251,22 +246,30 @@ 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'>"; + echo '<tr><td>' . _('Part') . ':</td> + <td><input type ="text" name="Part" size="20" /> + </tr> + <tr><td>' . _('Levels') . ':</td> + <td><select name="Levels"> + <option selected value="All">' . _('All Levels') . '</option> + <option value="One">' . _('One Level') . '</option> + </select> + </td> + </tr>'; - echo '<tr><td>' . _('Levels') . ":</td><td><select name='Levels'>"; - echo "<option selected value='All'>" . _('All Levels'); - echo "<option value='One'>" . _('One Level'); - echo '</select></td></tr>'; + echo '<tr><td>' . _('Print Option') . ':</td> + <td><select name="Fill"> + <option selected value="yes">' . _('Print With Alternating Highlighted Lines') . '</option> + <option value="no">' . _('Plain Print') . '</option> + </select> + </td> + </tr>'; + echo '</table> + <p><div class="centre"><input type="submit" name="PrintPDF" value="' . _('Print PDF') . '"></div>'; - echo '<tr><td>' . _('Print Option') . ":</td><td><select name='Fill'>"; - echo "<option selected value='yes'>" . _('Print With Alternating Highlighted Lines'); - echo "<option value='no'>" . _('Plain Print'); - echo '</select></td></tr>'; - echo "</table><p><div class='centre'><input type=submit name='PrintPDF' value='" . _('Print PDF') . "'></div>"; - include('includes/footer.inc'); } /*end of else not PrintPDF */ @@ -275,7 +278,6 @@ function PrintHeader(&$pdf,&$YPos,&$PageNumber,$Page_Height,$Top_Margin,$Left_Margin, $Page_Width,$Right_Margin,$assemblydesc) { - $line_height=12; /*PDF page header for Indented BOM Listing report */ if ($PageNumber>1){ Modified: trunk/BOMListing.php =================================================================== --- trunk/BOMListing.php 2011-04-29 12:43:19 UTC (rev 4558) +++ trunk/BOMListing.php 2011-05-01 09:45:18 UTC (rev 4559) @@ -2,12 +2,8 @@ /* $Id$*/ -/* $Revision: 1.14 $ */ - -//$PageSecurity = 2; include('includes/session.inc'); - If (isset($_POST['PrintPDF']) AND isset($_POST['FromCriteria']) AND strlen($_POST['FromCriteria'])>=1 @@ -48,9 +44,9 @@ $title = _('Bill of Materials Listing') . ' - ' . _('Problem Report'); include('includes/header.inc'); prnMsg(_('The Bill of Material listing could not be retrieved by the SQL because'),'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; @@ -105,22 +101,10 @@ $YPos -=$line_height; $pdf->line($Page_Width-$Right_Margin, $YPos,$Left_Margin, $YPos); - /* - $buf = $pdf->output(); - $len = strlen($buf); + + $pdf->OutputD($_SESSION['DatabaseName'] . '_BOMListing_' . date('Y-m-d').'.pdf'); + $pdf->__destruct(); - header('Content-type: application/pdf'); - header('Content-Length: '.$len); - header('Content-Disposition: inline; filename=BOMListing.pdf'); - header('Expires: 0'); - header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); - header('Pragma: public'); - - $pdf->stream(); - */ - $pdf->OutputD($_SESSION['DatabaseName'] . '_BOMListing_' . date('Y-m-d').'.pdf');//UldisN - $pdf->__destruct(); //UldisN - } else { /*The option to print PDF was not hit */ $title=_('Bill Of Material Listing'); @@ -131,19 +115,25 @@ /*if $FromCriteria is not set then show a form to allow input */ - echo '<form action=' . $_SERVER['PHP_SELF'] . " method='POST'><table class=selection>"; + echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="POST"> + <table class="selection">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<tr><td>' . _('From Inventory Part Code') . ':' . "</font></td><td><input tabindex='1' type=text name=FromCriteria size=20 maxlength=20 VALUE='1'></td></tr>"; + echo '<tr><td>' . _('From Inventory Part Code') . ':' . '</font></td> + <td><input tabindex="1" type="text" name="FromCriteria" size="20" maxlength="20" value="1"></td> + </tr>'; - echo '<tr><td>' . _('To Inventory Part Code') . ':' . "</td><td><input tabindex='2' type=text name=ToCriteria size=20 maxlength=20 VALUE='zzzzzzz'></td></tr>"; + echo '<tr><td>' . _('To Inventory Part Code') . ':' . '</td> + <td><input tabindex="2" type="text" name="ToCriteria" size="20" maxlength="20" value="zzzzzzz" /></td> + </tr>'; - echo "</table><br><div class='centre'><input tabindex='3' type=Submit Name='PrintPDF' Value='" . _('Print PDF') . "'></div>"; - echo "<script>defaultControl(document.forms[0].FromCriteria);</script>"; + echo '</table> + <br /><div class="centre"><input tabindex="3" type="submit" name="PrintPDF" value="' . _('Print PDF') . '"></div>'; + echo '<script>defaultControl(document.forms[0].FromCriteria);</script>'; } include('includes/footer.inc');; } /*end of else not PrintPDF */ -?> +?> \ No newline at end of file Modified: trunk/BOMs.php =================================================================== --- trunk/BOMs.php 2011-04-29 12:43:19 UTC (rev 4558) +++ trunk/BOMs.php 2011-05-01 09:45:18 UTC (rev 4559) @@ -1,9 +1,7 @@ <?php -/* $Revision: 1.37 $ */ + /* $Id$*/ -//$PageSecurity = 9; - include('includes/session.inc'); $title = _('Multi-Level Bill Of Materials Maintenance'); @@ -11,8 +9,6 @@ include('includes/header.inc'); include('includes/SQL_CommonFunctions.inc'); - -// *** POPAD&T - ... Phil modified to english variables function display_children($parent, $level, &$BOMTree) { global $db; @@ -20,15 +16,13 @@ // retrive all children of parent $c_result = DB_query("SELECT parent, - component - FROM bom WHERE parent='" . $parent. "'" + component + FROM bom WHERE parent='" . $parent. "'" ,$db); if (DB_num_rows($c_result) > 0) { - //echo ("<UL>\n"); - - + while ($row = DB_fetch_array($c_result)) { - //echo '<br>Parent: ' . $parent . ' Level: ' . $level . ' row[component]: ' . $row['component'] .'<br>'; + //echo '<br />Parent: ' . $parent . ' Level: ' . $level . ' row[component]: ' . $row['component'] .'<br />'; if ($parent != $row['component']) { // indent and display the title of this child $BOMTree[$i]['Level'] = $level; // Level @@ -119,7 +113,7 @@ $DrillID=''; } else { $DrillText = '<a href="%s&Select=%s">' . _('Drill Down'); - $DrillLink = $_SERVER['PHP_SELF'] . '?' . SID; + $DrillLink = $_SERVER['PHP_SELF'] . '?'; $DrillID=$myrow[0]; } if ($ParentMBflag!='M' AND $ParentMBflag!='G'){ @@ -161,12 +155,12 @@ ConvertSQLDate($myrow[6]), $AutoIssue, $QuantityOnHand, - $_SERVER['PHP_SELF'] . '?' . SID, + $_SERVER['PHP_SELF'] . '?', $Parent, $myrow[0], $DrillLink, $DrillID, - $_SERVER['PHP_SELF'] . '?' . SID, + $_SERVER['PHP_SELF'] . '?', $Parent, $myrow[0], $UltimateParent); @@ -246,7 +240,7 @@ } if(!Date1GreaterThanDate2($_POST['EffectiveTo'], $_POST['EffectiveAfter'])){ $InputError = 1; - prnMsg(_('The effective to date must be a date after the effective after date') . '<br>' . _('The effective to date is') . ' ' . DateDiff($_POST['EffectiveTo'], $_POST['EffectiveAfter'], 'd') . ' ' . _('days before the effective after date') . '! ' . _('No updates have been performed') . '.<br>' . _('Effective after was') . ': ' . $_POST['EffectiveAfter'] . ' ' . _('and effective to was') . ': ' . $_POST['EffectiveTo'],'error'); + prnMsg(_('The effective to date must be a date after the effective after date') . '<br />' . _('The effective to date is') . ' ' . DateDiff($_POST['EffectiveTo'], $_POST['EffectiveAfter'], 'd') . ' ' . _('days before the effective after date') . '! ' . _('No updates have been performed') . '.<br />' . _('Effective after was') . ': ' . $_POST['EffectiveAfter'] . ' ' . _('and effective to was') . ': ' . $_POST['EffectiveTo'],'error'); $Errors[$i] = 'EffectiveAfter'; $i++; $Errors[$i] = 'EffectiveTo'; @@ -341,7 +335,7 @@ /*The component must already be on the BOM */ - prnMsg( _('The component') . ' ' . $_POST['Component'] . ' ' . _('is already recorded as a component of') . ' ' . $SelectedParent . '.' . '<br>' . _('Whilst the quantity of the component required can be modified it is inappropriate for a component to appear more than once in a bill of material'),'error'); + prnMsg( _('The component') . ' ' . $_POST['Component'] . ' ' . _('is already recorded as a component of') . ' ' . $SelectedParent . '.' . '<br />' . _('Whilst the quantity of the component required can be modified it is inappropriate for a component to appear more than once in a bill of material'),'error'); $Errors[$i]='ComponentCode'; } @@ -416,8 +410,8 @@ break; } - echo '<br><div class=centre><a href=' . $_SERVER['PHP_SELF'] . '?' . SID . '>' . _('Select a Different BOM') . '</a></div><br>'; - echo '<table class=selection>'; + echo '<br /><div class=centre><a href=' . $_SERVER['PHP_SELF'] . '?' . SID . '>' . _('Select a Different BOM') . '</a></div><br />'; + echo '<table class="selection">'; // Display Manufatured Parent Items $sql = "SELECT bom.parent, stockmaster.description, @@ -453,7 +447,7 @@ $DbgMsg = _('The SQL used to retrieve description of the parent part was'); $result=DB_query($sql,$db,$ErrMsg,$DbgMsg); if( DB_num_rows($result) > 0 ) { - echo (($reqnl)?'<br>':'').'<tr><td><div class="centre">'._('Assembly parent items').' : '; + echo (($reqnl)?'<br />':'').'<tr><td><div class="centre">'._('Assembly parent items').' : '; $ix = 0; while ($myrow = DB_fetch_array($result)){ echo (($ix)?', ':'').'<a href="'.$_SERVER['PHP_SELF'] . '?' . SID . 'Select='.$myrow['parent'].'">'. @@ -473,7 +467,7 @@ $DbgMsg = _('The SQL used to retrieve description of the parent part was'); $result=DB_query($sql,$db,$ErrMsg,$DbgMsg); if( DB_num_rows($result) > 0 ) { - echo (($reqnl)?'<br>':'').'<tr><td><div class="centre">'._('Kit sets').' : '; + echo (($reqnl)?'<br />':'').'<tr><td><div class="centre">'._('Kit sets').' : '; $ix = 0; while ($myrow = DB_fetch_array($result)){ echo (($ix)?', ':'').'<a href="'.$_SERVER['PHP_SELF'] . '?' . SID . 'Select='.$myrow['parent'].'">'. @@ -493,7 +487,7 @@ $DbgMsg = _('The SQL used to retrieve description of the parent part was'); $result=DB_query($sql,$db,$ErrMsg,$DbgMsg); if( DB_num_rows($result) > 0 ) { - echo (($reqnl)?'<br>':'').'<tr><td><div class="centre">'._('Phantom').' : '; + echo (($reqnl)?'<br />':'').'<tr><td><div class="centre">'._('Phantom').' : '; $ix = 0; while ($myrow = DB_fetch_array($result)){ echo (($ix)?', ':'').'<a href="'.$_SERVER['PHP_SELF'] . '?' . SID . 'Select='.$myrow['parent'].'">'. @@ -502,10 +496,11 @@ } //end while loop echo '</div></td></tr>'; } - echo "</table><br><table class=selection>"; - echo "<tr><th colspan=13><div class='centre'><font color=blue size=3><b>".$SelectedParent ." - " . $myrow[0] . ' ('. $MBdesc. ') </font></b></th></tr>'; + echo '</table> + <br /> + <table class="selection">'; + echo '<tr><th colspan=13><div class="centre"><font color=blue size=3><b>' . $SelectedParent .' - ' . $myrow[0] . ' ('. $MBdesc. ') </font></b></th></tr>'; - // *** POPAD&T $BOMTree = array(); //BOMTree is a 2 dimensional array with three elements for each item in the array - Level, Parent, Component //display children populates the BOM_Tree from the selected parent @@ -513,17 +508,17 @@ display_children($SelectedParent, 1, $BOMTree); $TableHeader = '<tr> - <th>' . _('Level') . '</th> - <th>' . _('Code') . '</th> - <th>' . _('Description') . '</th> - <th>' . _('Location') . '</th> - <th>' . _('Work Centre') . '</th> - <th>' . _('Quantity') . '</th> - <th>' . _('Effective After') . '</th> - <th>' . _('Effective To') . '</th> - <th>' . _('Auto Issue') . '</th> - <th>' . _('Qty On Hand') . '</th> - </tr>'; + <th>' . _('Level') . '</th> + <th>' . _('Code') . '</th> + <th>' . _('Description') . '</th> + <th>' . _('Location') . '</th> + <th>' . _('Work Centre') . '</th> + <th>' . _('Quantity') . '</th> + <th>' . _('Effective After') . '</th> + <th>' . _('Effective To') . '</th> + <th>' . _('Auto Issue') . '</th> + <th>' . _('Qty On Hand') . '</th> + </tr>'; echo $TableHeader; if(count($BOMTree) == 0) { echo '<tr class="OddTableRows"><td colspan="8">'._('No materials found.').'</td></tr>'; @@ -546,12 +541,11 @@ DisplayBOMItems($UltimateParent, $Parent, $Component, $Level, $db); } } - // *** end POPAD&T - echo "</table><br>"; + echo '</table><br />'; if (! isset($_GET['delete'])) { - echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '?' . SID . '&Select=' . $SelectedParent .'">'; + echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '?Select=' . $SelectedParent .'">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; if (isset($_GET['SelectedComponent']) and $InputError !=1) { @@ -577,24 +571,24 @@ $_POST['Quantity'] = $myrow['quantity']; $_POST['AutoIssue'] = $myrow['autoissue']; - prnMsg(_('Edit the details of the selected component in the fields below') . '. <br>' . _('Click on the Enter Information button to update the component details'),'info'); - echo "<br><input type=hidden name='SelectedParent' VALUE='$SelectedParent'>"; - echo "<input type=hidden name='SelectedComponent' VALUE='$SelectedComponent'>"; + prnMsg(_('Edit the details of the selected component in the fields below') . '. <br />' . _('Click on the Enter Information button to update the component details'),'info'); + echo '<br /> + <input type="hidden" name="SelectedParent" value="' . $SelectedParent . '" />'; + echo '<input type="hidden" name="SelectedComponent" value="' . $SelectedComponent . '" />'; echo '<table class=selection>'; - echo "<tr><th colspan=13><div class='centre'><font color=blue size=3><b>". ('Edit Component Details') .'</font></b></th></tr>'; + echo '<tr><th colspan=13><div class="centre"><font color=blue size=3><b>'. ('Edit Component Details') .'</font></b></th></tr>'; echo '<tr><td>' . _('Component') . ':</td><td><b>' . $SelectedComponent . '</b></td></tr>'; } else { //end of if $SelectedComponent - echo "<input type=hidden name='SelectedParent' VALUE='$SelectedParent'>"; - /* echo "Enter the details of a new component in the fields below. <br>Click on 'Enter Information' to add the new component, once all fields are completed."; + echo '<input type=hidden name="SelectedParent" value="' . $SelectedParent . '" />'; + /* echo "Enter the details of a new component in the fields below. <br />Click on 'Enter Information' to add the new component, once all fields are completed."; */ echo '<table class=selection>'; - echo "<tr><th colspan=13><div class='centre'><font color=blue size=3><b>". ('New Component Details') .'</font></b></th></tr>'; + echo '<tr><th colspan=13><div class="centre"><font color=blue size=3><b>' . ('New Component Details') .'</font></b></th></tr>'; echo '<tr><td>' . _('Component code') . ':</td><td>'; - echo "<select " . (in_array('ComponentCode',$Errors) ? 'class="selecterror"' : '' ) ." tabindex='1' name='Component'>"; + echo '<select ' . (in_array('ComponentCode',$Errors) ? 'class="selecterror"' : '' ) .' tabindex="1" name="Component">'; - if ($ParentMBflag=='A'){ /*Its an assembly */ $sql = "SELECT stockmaster.stockid, stockmaster.description @@ -627,64 +621,68 @@ while ($myrow = DB_fetch_array($result)) { - echo "<option VALUE=".$myrow['stockid'].'>' . str_pad($myrow['stockid'],21, '_', STR_PAD_RIGHT) . $myrow['description']; + echo '<option value="' .$myrow['stockid'].'">' . str_pad($myrow['stockid'],21, '_', STR_PAD_RIGHT) . $myrow['description'] . '</option>'; } //end while loop echo '</select></td></tr>'; } - echo "<tr><td>" . _('Location') . ": </td><td><select tabindex='2' name='LocCode'>"; + echo '<tr><td>' . _('Location') . ': </td> + <td><select tabindex="2" name="LocCode">'; DB_free_result($result); - $sql = 'SELECT locationname, loccode FROM locations'; + $sql = "SELECT locationname, loccode FROM locations"; $result = DB_query($sql,$db); while ($myrow = DB_fetch_array($result)) { if (isset($_POST['LocCode']) and $myrow['loccode']==$_POST['LocCode']) { - echo "<option selected VALUE='"; + echo '<option selected value="'; } else { - echo "<option VALUE='"; + echo '<option value="'; } - echo $myrow['loccode'] . "'>" . $myrow['locationname']; + echo $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } //end while loop DB_free_result($result); - echo "</select></td></tr><tr><td>" . _('Work Centre Added') . ": </td><td>"; - echo "<select tabindex='3' name='WorkCentreAdded'>"; + echo '</select></td> + </tr> + <tr><td>' . _('Work Centre Added') . ': </td> + <td><select tabindex="3" name="WorkCentreAdded">'; - $sql = 'SELECT code, description FROM workcentres'; + $sql = "SELECT code, description FROM workcentres"; $result = DB_query($sql,$db); if (DB_num_rows($result)==0){ prnMsg( _('There are no work centres set up yet') . '. ' . _('Please use the link below to set up work centres'),'warn'); - echo "<br><a href='$rootpath/WorkCentres.php?" . SID . "'>" . _('Work Centre Maintenance') . '</a>'; + echo '<br /><a href="' . $rootpath . '/WorkCentres.php">' . _('Work Centre Maintenance') . '</a>'; include('includes/footer.inc'); exit; } while ($myrow = DB_fetch_array($result)) { if (isset($_POST['WorkCentreAdded']) and $myrow['code']==$_POST['WorkCentreAdded']) { - echo "<option selected VALUE='"; + echo '<option selected value="'; } else { - echo "<option VALUE='"; + echo '<option value="'; } - echo $myrow['code'] . "'>" . $myrow['description']; + echo $myrow['code'] . '">' . $myrow['description'] . '</option>'; } //end while loop DB_free_result($result); - echo "</select></td></tr><tr><td>" . _('Quantity') . ": </td><td> - <input " . (in_array('Quantity',$Errors) ? 'class="inputerror"' : '' ) ." - tabindex='4' type='Text' class=number name='Quantity' class=number size=10 maxlength=8 value="; + echo '</select></td> + </tr> + <tr><td>' . _('Quantity') . ': </td> + <td><input ' . (in_array('Quantity',$Errors) ? 'class="inputerror"' : '' ) .' tabindex="4" type="text" class="number" name="Quantity" class="number" size="10" maxlength="8" value="'; if (isset($_POST['Quantity'])){ echo $_POST['Quantity']; } else { echo 1; } - echo "></td></tr>"; + echo '"></td></tr>'; if (!isset($_POST['EffectiveTo']) OR $_POST['EffectiveTo']=='') { $_POST['EffectiveTo'] = Date($_SESSION['DefaultDateFormat'],Mktime(0,0,0,Date('m'),Date('d'),(Date('y')+20))); @@ -693,12 +691,10 @@ $_POST['EffectiveAfter'] = Date($_SESSION['DefaultDateFormat'],Mktime(0,0,0,Date('m'),Date('d')-1,Date('y'))); } - echo "<tr><td>" . _('Effective After') . " (" . $_SESSION['DefaultDateFormat'] . "):</td> - <td><input " . (in_array('EffectiveAfter',$Errors) ? 'class="inputerror"' : '' ) . - " tabindex='5' type='Text' name='EffectiveAfter' class=date alt='".$_SESSION['DefaultDateFormat']."' size=11 maxlength=10 VALUE=" . $_POST['EffectiveAfter'] ."> - </td></tr><tr><td>" . _('Effective To') . " (" . $_SESSION['DefaultDateFormat'] . "):</td><td> - <input " . (in_array('EffectiveTo',$Errors) ? 'class="inputerror"' : '' ) . - " tabindex='6' type='Text' name='EffectiveTo' class=date alt='".$_SESSION['DefaultDateFormat']."' size=11 maxlength=10 VALUE=" . $_POST['EffectiveTo'] ."></td></tr>"; + echo '<tr><td>' . _('Effective After') . ' (' . $_SESSION['DefaultDateFormat'] . '):</td> + <td><input ' . (in_array('EffectiveAfter',$Errors) ? 'class="inputerror"' : '' ) . ' tabindex="5" type="text" name="EffectiveAfter" class="date" alt="' .$_SESSION['DefaultDateFormat'] .'" size="11" maxlength="10" value="' . $_POST['EffectiveAfter'] .'"></td></tr> + <tr><td>' . _('Effective To') . ' (' . $_SESSION['DefaultDateFormat'] . '):</td> + <td><input ' . (in_array('EffectiveTo',$Errors) ? 'class="inputerror"' : '' ) . ' tabindex="6" type="text" name="EffectiveTo" class="date" alt="' .$_SESSION['DefaultDateFormat'] . '" size="11" maxlength="10" value="' . $_POST['EffectiveTo'] .'"></td></tr>'; if ($ParentMBflag=='M' OR $ParentMBflag=='G'){ echo '<tr><td>' . _('Auto Issue this Component to Work Orders') . ':</td> @@ -709,20 +705,21 @@ $_POST['AutoIssue'] = $_SESSION['AutoIssue']; } if ($_POST['AutoIssue']==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>'; } else { - echo '<input type=hidden name="AutoIssue" VALUE=0>'; + echo '<input type=hidden name="AutoIssue" value="0">'; } - echo "</table><br><div class='centre'><input tabindex='8' type='Submit' name='Submit' value='" . _('Enter Information') . "'></form></div>"; + echo '</table> + <br /><div class="centre"><input tabindex="8" type="submit" name="Submit" value="' . _('Enter Information') . '"></form></div>'; } //end if record deleted no point displaying form to add record @@ -791,26 +788,32 @@ if (!isset($SelectedParent)) { echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/magnifier.png" title="' . _('Search') . '" alt="">' . ' ' . $title; - echo "<form action=" . $_SERVER['PHP_SELF'] . "?" . SID ." method=post>" . + echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">' . '<div class="page_help_text">'. _('Select a manufactured part') . " (" . _('or Assembly or Kit part') . ") " . - _('to maintain the bill of material for using the options below') . "." . "<br><font size=1>" . - _('Parts must be defined in the stock item entry') . "/" . _('modification screen as manufactured') . - ", " . _('kits or assemblies to be available for construction of a bill of material') .'</div>'. - "</font><br><table class=selection cellpadding=3 colspan=4><tr><td><font size=1>" . _('Enter text extracts in the') . - " <b>" . _('description') . "</b>:</font></td><td><input tabindex='1' type='Text' name='Keywords' size=20 maxlength=25></td> - <td><font size=3><b>" . _('OR') . "</b></font></td><td><font size=1>" . _('Enter extract of the') . - " <b>" . _('Stock Code') . "</b>:</font></td><td><input tabindex='2' type='Text' name='StockCode' size=15 maxlength=18></td> - </tr></table><br><div class='centre'><input tabindex='3' type=submit name='Search' VALUE=" . _('Search Now') . "></div>"; + _('to maintain the bill of material for using the options below') . '<br /><font size=1>' . + _('Parts must be defined in the stock item entry') . '/' . _('modification screen as manufactured') . + ', ' . _('kits or assemblies to be available for construction of a bill of material') .'</div>'. + '</font> + <br /> + <table class="selection" cellpadding="3" colspan="4"> + <tr><td><font size=1>' . _('Enter text extracts in the') . ' <b>' . _('description') . '</b>:</font></td> + <td><input tabindex="1" type="text" name="Keywords" size="20" maxlength="25"></td> + <td><font size=3><b>' . _('OR') . '</b></font></td> + <td><font size=1>' . _('Enter extract of the') . ' <b>' . _('Stock Code') . '</b>:</font></td> + <td><input tabindex="2" type="text" name="StockCode" size="15" maxlength="18"></td> + </tr> + </table> + <br /><div class="centre"><input tabindex="3" type="submit" name="Search" value="' . _('Search Now') . '"></div>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; if (isset($_POST['Search']) and isset($result) AND !isset($SelectedParent)) { - echo '<br><table cellpadding=2 colspan=7 class=selection>'; + echo '<br /><table cellpadding=2 colspan=7 class=selection>'; $TableHeader = '<tr><th>' . _('Code') . '</th> - <th>' . _('Description') . '</th> - <th>' . _('On Hand') . '</th> - <th>' . _('Units') . '</th> - </tr>'; + <th>' . _('Description') . '</th> + <th>' . _('On Hand') . '</th> + <th>' . _('Units') . '</th> + </tr>'; echo $TableHeader; @@ -830,15 +833,14 @@ $StockOnHand = number_format($myrow['totalonhand'],2); } $tab = $j+3; - printf("<td><input tabindex='".$tab."' type=submit name='Select' VALUE='%s'</td> + printf('<td><input tabindex="' . $tab . '" type="submit" name="Select" value="%s"</td> <td>%s</td> <td class=number>%s</td> - <td>%s</td></tr>", + <td>%s</td></tr>', $myrow['stockid'], $myrow['description'], $StockOnHand, - $myrow['units'] - ); + $myrow['units']); $j++; //end of page full new headings if @@ -851,12 +853,12 @@ //end if results to show if (!isset($SelectedParent) or $SelectedParent=='') { - echo "<script>defaultControl(document.forms[0].StockCode);</script>"; + echo '<script>defaultControl(document.forms[0].StockCode);</script>'; } else { - echo "<script>defaultControl(document.form.JournalProcessDate);</script>"; + echo '<script>defaultControl(document.form.JournalProcessDate);</script>'; } -echo "</form>"; +echo '</form>'; } //end StockID already selected Modified: trunk/BankAccounts.php =================================================================== --- trunk/BankAccounts.php 2011-04-29 12:43:19 UTC (rev 4558) +++ trunk/BankAccounts.php 2011-05-01 09:45:18 UTC (rev 4559) @@ -1,9 +1,7 @@ <?php -/* $Revision: 1.21 $ */ + /* $Id$*/ -//$PageSecurity = 10; - include('includes/session.inc'); $title = _('Bank Accounts Maintenance'); @@ -11,7 +9,7 @@ include('includes/header.inc'); echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/money_add.png" title="' . _('Bank') . '" alt="" />' . ' ' . $title . '</p>'; - echo '<div class="page_help_text">' . _('Update Bank Account details. Account Code is for SWIFT or BSB type Bank Codes. Set Default for Invoices to "yes" to print Account details on Invoices (only one account can be set to "yes").') . '.</div><br>'; +echo '<div class="page_help_text">' . _('Update Bank Account details. Account Code is for SWIFT or BSB type Bank Codes. Set Default for Invoices to "yes" to print Account details on Invoices (only one account can be set to "yes").') . '.</div><br />'; if (isset($_GET['SelectedBankAccount'])) { $SelectedBankAccount=$_GET['SelectedBankAccount']; @@ -85,23 +83,21 @@ $sql = "SELECT * FROM banktrans WHERE bankact='" . $SelectedBankAccount . "'"; $BankTransResult = DB_query($sql,$db); if (DB_num_rows($BankTransResult)>0) { - $sql = "UPDATE bankaccounts - SET bankaccountname='" . $_POST['BankAccountName'] . "', - bankaccountcode='" . $_POST['BankAccountCode'] . "', - bankaccountnumber='" . $_POST['BankAccountNumber'] . "', - bankaddress='" . $_POST['BankAddress'] . "', - invoice ='" . $_POST['DefAccount'] . "' - WHERE accountcode = '" . $SelectedBankAccount . "'"; + $sql = "UPDATE bankaccounts SET bankaccountname='" . $_POST['BankAccountName'] . "', + bankaccountcode='" . $_POST['BankAccountCode'] . "', + bankaccountnumber='" . $_POST['BankAccountNumber'] . "', + bankaddress='" . $_POST['BankAddress'] . "', + invoice ='" . $_POST['DefAccount'] . "' + WHERE accountcode = '" . $SelectedBankAccount . "'"; prnMsg(_('Note that it is not possible to change the currency of the account once there are transactions against it'),'warn'); - echo '<br>'; + echo '<br />'; } else { - $sql = "UPDATE bankaccounts - SET bankaccountname='" . $_POST['BankAccountName'] . "', - bankaccountcode='" . $_POST['BankAccountCode'] . "', - bankaccountnumber='" . $_POST['BankAccountNumber'] . "', - bankaddress='" . $_POST['BankAddress'] . "', - currcode ='" . $_POST['CurrCode'] . "', - invoice ='" . $_POST['DefAccount'] . "' + $sql = "UPDATE bankaccounts SET bankaccountname='" . $_POST['BankAccountName'] . "', + bankaccountcode='" . $_POST['BankAccountCode'] . "', + bankaccountnumber='" . $_POST['BankAccountNumber'] . "', + bankaddress='" . $_POST['BankAddress'] . "', + currcode ='" . $_POST['CurrCode'] . "', + invoice ='" . $_POST['DefAccount'] . "' WHERE accountcode = '" . $SelectedBankAccount . "'"; } @@ -110,22 +106,20 @@ /*Selectedbank account is null cos no item selected on first time round so must be adding a record must be submitting new entries in the new bank account form */ - $sql = "INSERT INTO bankaccounts ( - accountcode, - bankaccountname, - bankaccountcode, - bankaccountnumber, - bankaddress, - currcode, - invoice) - VALUES ('" . $_POST['AccountCode'] . "', - '" . $_POST['BankAccountName'] . "', - '" . $_POST['BankAccountCode'] . "', - '" . $_POST['BankAccountNumber'] . "', - '" . $_POST['BankAddress'] . "', - '" . $_POST['CurrCode'] . "', - '" . $_POST['DefAccount'] . "' - )"; + $sql = "INSERT INTO bankaccounts (accountcode, + bankaccountname, + bankaccountcode, + bankaccountnumber, + bankaddress, + currcode, + invoice) + VALUES ('" . $_POST['AccountCode'] . "', + '" . $_POST['BankAccountName'] . "', + '" . $_POST['BankAccountCode'] . "', + '" . $_POST['BankAccountNumber'] . "', + '" . $_POST['BankAddress'] . "', + '" . $_POST['CurrCode'] . "', + '" . $_POST['DefAccount'] . "' )"; $msg = _('The new bank account has been entered'); } @@ -136,7 +130,7 @@ $result = DB_query($sql,$db,$ErrMsg,$DbgMsg); prnMsg($msg,'success'); - echo '<br>'; + echo '<br />'; unset($_POST['AccountCode']); unset($_POST['BankAccountName']); unset($_POST['BankAccountNumber']); @@ -160,7 +154,7 @@ if ($myrow[0]>0) { $CancelDelete = 1; prnMsg(_('Cannot delete this bank account because transactions have been created using this account'),'warn'); - echo '<br> ' . _('There are') . ' ' . $myrow[0] . ' ' . _('transactions with this bank account code'); + echo '<br /> ' . _('There are') . ' ' . $myrow[0] . ' ' . _('transactions with this bank account code'); } if (!$CancelDelete) { @@ -188,19 +182,20 @@ WHERE bankaccounts.accountcode = chartmaster.accountcode"; $ErrMsg = _('The bank accounts set up could not be retrieved because'); - $DbgMsg = _('The SQL used to retrieve the bank account details was') . '<br>' . $sql; + $DbgMsg = _('The SQL used to retrieve the bank account details was') . '<br />' . $sql; $result = DB_query($sql,$db,$ErrMsg,$DbgMsg); echo '<table class="selection">'; - echo "<tr><th>" . _('GL Account Code') . "</th> - <th>" . _('Bank Account Name') . "</th> - <th>" . _('Bank Account Code') . "</th> - <th>" . _('Bank Account Number') . "</th> - <th>" . _('Bank Address') . "</th> - <th>" . _('Currency') . "</th> - <th>" . _('Default for Invoices') . "</th> - </tr>"; + echo '<tr> + <th>' . _('GL Account Code') . '</th> + <th>' . _('Bank Account Name') . '</th> + <th>' . _('Bank Account Code') . '</th> + <th>' . _('Bank Account Number') . '</th> + <th>' . _('Bank Address') . '</th> + <th>' . _('Currency') . '</th> + <th>' . _('Default for Invoices') . '</th> + </tr>'; $k=0; //row colour counter while ($myrow = DB_fetch_row($result)) { @@ -216,16 +211,16 @@ } else { $defacc=_('Yes'); } - printf("<td>%s<br><font size=2>%s</font></td> + printf('<td>%s<br /><font size=2>%s</font></td> <td>%s</td> <td>%s</td> <td>%s</td> <td>%s</td> <td>%s</td> <td>%s</td> - <td><a href=\"%s?SelectedBankAccount=%s\">" . _('Edit') . "</td> - <td><a href=\"%s?SelectedBankAccount=%s&delete=1\">" . _('Delete') . "</td> - </tr>", + <td><a href="%s?SelectedBankAccount=%s">' . _('Edit') . '</td> + <td><a href="%s?SelectedBankAccount=%s&delete=1">' . _('Delete') . '</td> + </tr>', $myrow[0], $myrow[2], $myrow[3], @@ -364,12 +359,13 @@ } }//end while loop } else { - echo '<option VALUE=1>'._('Yes').'</option><option value=0>'._('No').'</option>'; + echo '<option value="1">'._('Yes').'</option> + <option value="0">'._('No').'</option>'; } echo '</select></td>'; -echo '</tr></table><br> +echo '</tr></table><br /> <div class="centre"><input tabindex="7" type="Submit" name="submit" value="'. _('Enter Information') .'"></div>'; echo '</form>'; Modified: trunk/Logout.php =================================================================== --- trunk/Logout.php 2011-04-29 12:43:19 UTC (rev 4558) +++ trunk/Logout.php 2011-05-01 09:45:18 UTC (rev 4559) @@ -23,7 +23,7 @@ <?php echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; ?> - <label><?php echo _('Thank you for using webERP'); ?></label> + <span><?php echo _('Thank you for using webERP'); ?></span> <br /> <input class="button" type="submit" value="<?php echo _('Login'); ?>" name="SubmitUser" /> </form> Modified: trunk/PageSecurity.php =================================================================== --- trunk/PageSecurity.php 2011-04-29 12:43:19 UTC (rev 4558) +++ trunk/PageSecurity.php 2011-05-01 09:45:18 UTC (rev 4559) @@ -13,17 +13,17 @@ if (isset($_POST['Update'])) { foreach ($_POST as $ScriptName => $PageSecurityValue) { if ($ScriptName!='Update' and $ScriptName!='FormID') { - //$key=substr($key, 0, strlen($key)-4).'.php'; + $ScriptName=substr($ScriptName, 0, strlen($Sc... [truncated message content] |
From: <dai...@us...> - 2011-05-02 10:34:04
|
Revision: 4560 http://web-erp.svn.sourceforge.net/web-erp/?rev=4560&view=rev Author: daintree Date: 2011-05-02 10:33:55 +0000 (Mon, 02 May 2011) Log Message: ----------- quoting and currency decimal places on order entry Modified Paths: -------------- trunk/COGSGLPostings.php trunk/ConfirmDispatch_Invoice.php trunk/ContractBOM.php trunk/OffersReceived.php trunk/PO_PDFPurchOrder.php trunk/SelectOrderItems.php trunk/doc/Change.log.html trunk/includes/DefineCartClass.php Modified: trunk/COGSGLPostings.php =================================================================== --- trunk/COGSGLPostings.php 2011-05-01 09:45:18 UTC (rev 4559) +++ trunk/COGSGLPostings.php 2011-05-02 10:33:55 UTC (rev 4560) @@ -1,9 +1,7 @@ <?php -/* $Revision: 1.15 $ */ + /* $Id$*/ -//$PageSecurity = 10; - include('includes/session.inc'); $title = _('Cost Of Sales GL Postings Set Up'); @@ -58,7 +56,6 @@ $result = DB_query($sql,$db); prnMsg ($msg,'info'); - echo '<br />'; unset ($SelectedCOGSPostingID); } elseif (isset($_GET['delete'])) { @@ -67,23 +64,21 @@ $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 />'; unset ($SelectedCOGSPostingID); - } if (!isset($SelectedCOGSPostingID)) { $ShowLivePostingRecords = true; - $sql = 'SELECT cogsglpostings.id, - cogsglpostings.area, - cogsglpostings.stkcat, - cogsglpostings.salestype, - chartmaster.accountname - FROM cogsglpostings LEFT JOIN chartmaster + $sql = "SELECT cogsglpostings.id, + cogsglpostings.area, + cogsglpostings.stkcat, + cogsglpostings.salestype, + chartmaster.accountname + FROM cogsglpostings LEFT JOIN chartmaster ON cogsglpostings.glcode = chartmaster.accountcode - WHERE chartmaster.accountcode IS NULL'; + WHERE chartmaster.accountcode IS NULL"; $result = DB_query($sql,$db); if (DB_num_rows($result)>0){ @@ -106,12 +101,12 @@ $k=1; } - printf("<td>%s</td> + printf('<td>%s</td> <td>%s</td> <td>%s</td> <td>%s</td> - <td><a href=\"%sSelectedCOGSPostingID=%s\">" . _('Edit') . "</td> - <td><a href=\"%sSelectedCOGSPostingID=%s&delete=yes\">". _('Delete') . "</td></tr>", + <td><a href="%sSelectedCOGSPostingID=%s">' . _('Edit') . '</td> + <td><a href="%sSelectedCOGSPostingID=%s&delete=yes">'. _('Delete') . '</td></tr>', $myrow[1], $myrow[2], $myrow[3], @@ -124,11 +119,11 @@ echo '</table>'; } - $sql = 'SELECT cogsglpostings.id, + $sql = "SELECT cogsglpostings.id, cogsglpostings.area, cogsglpostings.stkcat, cogsglpostings.salestype - FROM cogsglpostings'; + FROM cogsglpostings"; $result = DB_query($sql,$db); @@ -182,14 +177,14 @@ } if ($ShowLivePostingRecords){ - $sql = 'SELECT cogsglpostings.id, - cogsglpostings.area, - cogsglpostings.stkcat, - cogsglpostings.salestype, - chartmaster.accountname - FROM cogsglpostings, - chartmaster - WHERE cogsglpostings.glcode = chartmaster.accountcode'; + $sql = "SELECT cogsglpostings.id, + cogsglpostings.area, + cogsglpostings.stkcat, + cogsglpostings.salestype, + chartmaster.accountname + FROM cogsglpostings, + chartmaster + WHERE cogsglpostings.glcode = chartmaster.accountcode"; $result = DB_query($sql,$db); @@ -197,7 +192,8 @@ echo '<tr><th>' . _('Area') . '</th> <th>' . _('Stock Category') . '</th> <th>' . _('Sales Type') . '</th> - <th>' . _('GL Account') . '</th></tr>'; + <th>' . _('GL Account') . '</th> + </tr>'; $k = 0; while ($myrow = DB_fetch_row($result)) { if ($k==1){ @@ -208,13 +204,13 @@ $k++; } - printf("<td>%s</td> + printf('<td>%s</td> <td>%s</td> <td>%s</td> <td>%s</td> - <td><a href=\"%sSelectedCOGSPostingID=%s\">" . _('Edit') . "</td> - <td><a href=\"%sSelectedCOGSPostingID=%s&delete=yes\">" . _('Delete') . "</td> - </tr>", + <td><a href="%sSelectedCOGSPostingID=%s">' . _('Edit') . '</td> + <td><a href="%sSelectedCOGSPostingID=%s&delete=yes">' . _('Delete') . '</td> + </tr>', $myrow[1], $myrow[2], $myrow[3], @@ -257,14 +253,14 @@ $_POST['StkCat'] = $myrow['stkcat']; $_POST['SalesType'] = $myrow['salestype']; - echo '<input type=hidden name="SelectedCOGSPostingID" VALUE="' . $SelectedCOGSPostingID . '">'; + echo '<input type=hidden name="SelectedCOGSPostingID" value="' . $SelectedCOGSPostingID . '">'; } //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> @@ -274,16 +270,16 @@ 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'] . '</option>'; } //end while loop DB_free_result($result); -$sql = 'SELECT categoryid, categorydescription FROM stockcategory'; +$sql = "SELECT categoryid, categorydescription FROM stockcategory"; $result = DB_query($sql,$db); echo '</select></td></tr> @@ -292,10 +288,10 @@ <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="'; + if (isset($_POST['StkCat']) and $myrow['categoryid']==$_POST['StkCat']) { + echo '<option selected value="'; } else { - echo '<option VALUE="'; + echo '<option value="'; } echo $myrow['categoryid'] . '">' . $myrow['categorydescription'] . '</option>'; @@ -303,7 +299,7 @@ DB_free_result($result); -$sql = 'SELECT typeabbrev, sales_type FROM salestypes'; +$sql = "SELECT typeabbrev, sales_type FROM salestypes"; $result = DB_query($sql,$db); echo '</select></td></tr> @@ -313,9 +309,9 @@ 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'] . '</option>'; @@ -326,22 +322,22 @@ <td><select tabindex="4" name="GLCode">'; DB_free_result($result); -$sql = 'SELECT chartmaster.accountcode, - chartmaster.accountname - FROM chartmaster, - accountgroups - WHERE chartmaster.group_=accountgroups.groupname - AND accountgroups.pandl=1 - ORDER BY accountgroups.sequenceintb, - chartmaster.accountcode, - chartmaster.accountname'; +$sql = "SELECT chartmaster.accountcode, + chartmaster.accountname + FROM chartmaster, + accountgroups + WHERE chartmaster.group_=accountgroups.groupname + AND accountgroups.pandl=1 + ORDER BY accountgroups.sequenceintb, + chartmaster.accountcode, + 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'] . '</option>'; Modified: trunk/ConfirmDispatch_Invoice.php =================================================================== --- trunk/ConfirmDispatch_Invoice.php 2011-05-01 09:45:18 UTC (rev 4559) +++ trunk/ConfirmDispatch_Invoice.php 2011-05-02 10:33:55 UTC (rev 4560) @@ -1,12 +1,10 @@ <?php -/* $Revision: 1.67 $ */ /* $Id$*/ /* Session started in session.inc for password checking and authorisation level check */ include('includes/DefineCartClass.php'); include('includes/DefineSerialItems.php'); -//$PageSecurity = 2; include('includes/session.inc'); $title = _('Confirm Dispatches and Invoice An Order'); @@ -15,10 +13,10 @@ include('includes/FreightCalculation.inc'); include('includes/GetSalesTransGLCodes.inc'); -if (!isset($_GET['OrderNumber']) && !isset($_SESSION['ProcessingOrder'])) { +if (!isset($_GET['OrderNumber']) AND !isset($_SESSION['ProcessingOrder'])) { /* This page can only be called with an order number for invoicing*/ - echo '<div class="centre"><a href="' . $rootpath . '/SelectSalesOrder.php?' . SID . '">' . _('Select a sales order to invoice'). '</a></div>'; - echo '<br><br>'; + echo '<div class="centre"><a href="' . $rootpath . '/SelectSalesOrder.php">' . _('Select a sales order to invoice'). '</a></div>'; + echo '<br /><br />'; prnMsg( _('This page can only be opened if an order has been selected Please select an order first from the delivery details screen click on Confirm for invoicing'), 'error' ); include ('includes/footer.inc'); exit; @@ -34,43 +32,44 @@ /*read in all the guff from the selected order into the Items cart */ $OrderHeaderSQL = "SELECT salesorders.orderno, - salesorders.debtorno, - debtorsmaster.name, - salesorders.branchcode, - salesorders.customerref, - salesorders.comments, - salesorders.orddate, - salesorders.ordertype, - salesorders.shipvia, - salesorders.deliverto, - salesorders.deladd1, - salesorders.deladd2, - salesorders.deladd3, - salesorders.deladd4, - salesorders.deladd5, - salesorders.deladd6, - salesorders.contactphone, - salesorders.contactemail, - salesorders.freightcost, - salesorders.deliverydate, - debtorsmaster.currcode, - salesorders.fromstkloc, - locations.taxprovinceid, - custbranch.taxgroupid, - currencies.rate as currency_rate, - custbranch.defaultshipvia, - custbranch.specialinstructions - FROM salesorders, - debtorsmaster, - custbranch, - currencies, - locations - WHERE salesorders.debtorno = debtorsmaster.debtorno - AND salesorders.branchcode = custbranch.branchcode - AND salesorders.debtorno = custbranch.debtorno - AND locations.loccode=salesorders.fromstkloc - AND debtorsmaster.currcode = currencies.currabrev - AND salesorders.orderno = '" . $_GET['OrderNumber']."'"; + salesorders.debtorno, + debtorsmaster.name, + salesorders.branchcode, + salesorders.customerref, + salesorders.comments, + salesorders.orddate, + salesorders.ordertype, + salesorders.shipvia, + salesorders.deliverto, + salesorders.deladd1, + salesorders.deladd2, + salesorders.deladd3, + salesorders.deladd4, + salesorders.deladd5, + salesorders.deladd6, + salesorders.contactphone, + salesorders.contactemail, + salesorders.freightcost, + salesorders.deliverydate, + debtorsmaster.currcode, + salesorders.fromstkloc, + locations.taxprovinceid, + custbranch.taxgroupid, + currencies.rate as currency_rate, + currencies.decimalplaces, + custbranch.defaultshipvia, + custbranch.specialinstructions + FROM salesorders, + debtorsmaster, + custbranch, + currencies, + locations + WHERE salesorders.debtorno = debtorsmaster.debtorno + AND salesorders.branchcode = custbranch.branchcode + AND salesorders.debtorno = custbranch.debtorno + AND locations.loccode=salesorders.fromstkloc + AND debtorsmaster.currcode = currencies.currabrev + AND salesorders.orderno = '" . $_GET['OrderNumber']."'"; $ErrMsg = _('The order cannot be retrieved because'); $DbgMsg = _('The SQL to get the order header was'); @@ -88,6 +87,7 @@ $_SESSION['Items']->Comments = $myrow['comments']; $_SESSION['Items']->DefaultSalesType =$myrow['ordertype']; $_SESSION['Items']->DefaultCurrency = $myrow['currcode']; + $_SESSION['Items']->CurrDecimalPlaces = $myrow['decimalplaces']; $BestShipper = $myrow['shipvia']; $_SESSION['Items']->ShipVia = $myrow['shipvia']; @@ -120,33 +120,33 @@ /*now populate the line items array with the sales order details records */ $LineItemsSQL = "SELECT stkcode, - stockmaster.description, - stockmaster.controlled, - stockmaster.serialised, - stockmaster.volume, - stockmaster.kgs, - stockmaster.units, - stockmaster.decimalplaces, - stockmaster.mbflag, - stockmaster.taxcatid, - stockmaster.discountcategory, - salesorderdetails.unitprice, - salesorderdetails.quantity, - salesorderdetails.discountpercent, - salesorderdetails.actualdispatchdate, - salesorderdetails.qtyinvoiced, - salesorderdetails.narrative, - salesorderdetails.orderlineno, - salesorderdetails.poline, - salesorderdetails.itemdue, - stockmaster.materialcost + - stockmaster.labourcost + - stockmaster.overheadcost AS standardcost - FROM salesorderdetails INNER JOIN stockmaster - ON salesorderdetails.stkcode = stockmaster.stockid - WHERE salesorderdetails.orderno ='" . $_GET['OrderNumber'] . "' - AND salesorderdetails.quantity - salesorderdetails.qtyinvoiced >0 - ORDER BY salesorderdetails.orderlineno"; + stockmaster.description, + stockmaster.controlled, + stockmaster.serialised, + stockmaster.volume, + stockmaster.kgs, + stockmaster.units, + stockmaster.decimalplaces, + stockmaster.mbflag, + stockmaster.taxcatid, + stockmaster.discountcategory, + salesorderdetails.unitprice, + salesorderdetails.quantity, + salesorderdetails.discountpercent, + salesorderdetails.actualdispatchdate, + salesorderdetails.qtyinvoiced, + salesorderdetails.narrative, + salesorderdetails.orderlineno, + salesorderdetails.poline, + salesorderdetails.itemdue, + stockmaster.materialcost + + stockmaster.labourcost + + stockmaster.overheadcost AS standardcost + FROM salesorderdetails INNER JOIN stockmaster + ON salesorderdetails.stkcode = stockmaster.stockid + WHERE salesorderdetails.orderno ='" . $_GET['OrderNumber'] . "' + AND salesorderdetails.quantity - salesorderdetails.qtyinvoiced >0 + ORDER BY salesorderdetails.orderlineno"; $ErrMsg = _('The line items of the order cannot be retrieved because'); $DbgMsg = _('The SQL that failed was'); @@ -157,29 +157,29 @@ while ($myrow=db_fetch_array($LineItemsResult)) { $_SESSION['Items']->add_to_cart($myrow['stkcode'], - $myrow['quantity'], - $myrow['description'], - $myrow['unitprice'], - $myrow['discountpercent'], - $myrow['units'], - $myrow['volume'], - $myrow['kgs'], - 0, - $myrow['mbflag'], - $myrow['actualdispatchdate'], - $myrow['qtyinvoiced'], - $myrow['discountcategory'], - $myrow['controlled'], - $myrow['serialised'], - $myrow['decimalplaces'], - htmlspecialchars_decode($myrow['narrative']), - 'No', - $myrow['orderlineno'], - $myrow['taxcatid'], - '', - $myrow['itemdue'], - $myrow['poline'], - $myrow['standardcost']); /*NB NO Updates to DB */ + $myrow['quantity'], + $myrow['description'], + $myrow['unitprice'], + $myrow['discountpercent'], + $myrow['units'], + $myrow['volume'], + $myrow['kgs'], + 0, + $myrow['mbflag'], + $myrow['actualdispatchdate'], + $myrow['qtyinvoiced'], + $myrow['discountcategory'], + $myrow['controlled'], + $myrow['serialised'], + $myrow['decimalplaces'], + htmlspecialchars_decode($myrow['narrative']), + 'No', + $myrow['orderlineno'], + $myrow['taxcatid'], + '', + $myrow['itemdue'], + $myrow['poline'], + $myrow['standardcost']); /*NB NO Updates to DB */ /*Calculate the taxes applicable to this line item from the customer branch Tax Group and Item Tax Category */ @@ -187,7 +187,7 @@ } /* line items from sales order details */ } else { /* there are no line items that have a quantity to deliver */ - echo '<br>'; + echo '<br />'; prnMsg( _('There are no ordered items with a quantity left to deliver. There is nothing left to invoice')); include('includes/footer.inc'); exit; @@ -197,7 +197,7 @@ } else { /*end if the order was returned sucessfully */ - echo '<br>'. + echo '<br />'. prnMsg( _('This order item could not be retrieved. Please select another order'), 'warn'); include ('includes/footer.inc'); exit; @@ -227,9 +227,6 @@ } else if (is_numeric($_POST[$Itm->LineNumber . '_QtyDispatched' ])AND $_POST[$Itm->LineNumber . '_QtyDispatched'] <= ($_SESSION['Items']->LineItems[$Itm->LineNumber]->Quantity - $_SESSION['Items']->LineItems[$Itm->LineNumber]->QtyInv)){ $_SESSION['Items']->LineItems[$Itm->LineNumber]->QtyDispatched = $_POST[$Itm->LineNumber . '_QtyDispatched']; } - - - foreach ($Itm->Taxes as $TaxLine) { if (isset($_POST[$Itm->LineNumber . $TaxLine->TaxCalculationOrder . '_TaxRate'])){ $_SESSION['Items']->LineItems[$Itm->LineNumber]->Taxes[$TaxLine->TaxCalculationOrder]->TaxRate = $_POST[$Itm->LineNumber . $TaxLine->TaxCalculationOrder . '_TaxRate']/100; @@ -257,7 +254,7 @@ </table> <br />'; -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'] . '" />'; /*************************************************************** @@ -269,15 +266,15 @@ <th>' . _('Item Description' ) . '</th> <th>' . _('Ordered') . '</th> <th>' . _('Units') . '</th> - <th>' . _('Already') . '<br>' . _('Sent') . '</th> + <th>' . _('Already') . '<br />' . _('Sent') . '</th> <th>' . _('This Dispatch') . '</th> <th>' . _('Price') . '</th> <th>' . _('Discount') . '</th> - <th>' . _('Total') . '<br>' . _('Excl Tax') . '</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> + <th>' . _('Tax') . '<br />' . _('Amount') . '</th> + <th>' . _('Total') . '<br />' . _('Incl Tax') . '</th> </tr>'; $_SESSION['Items']->total = 0; @@ -331,8 +328,8 @@ } } $DisplayDiscountPercent = number_format($LnItm->DiscountPercent*100,2) . '%'; - $DisplayLineNetTotal = number_format($LineTotal,2); - $DisplayPrice = number_format($LnItm->Price,2); + $DisplayLineNetTotal = number_format($LineTotal,$_SESSION['Items']->CurrDecimalPlaces); + $DisplayPrice = number_format($LnItm->Price,$_SESSION['Items']->CurrDecimalPlaces); echo '<td class="number">'.$DisplayPrice.'</td> <td class="number">'.$DisplayDiscountPercent.'</td> <td class="number">'.$DisplayLineNetTotal.'</td>'; @@ -381,15 +378,15 @@ $TaxTotal += $TaxLineTotal; - $DisplayTaxAmount = number_format($TaxLineTotal ,2); + $DisplayTaxAmount = number_format($TaxLineTotal ,$_SESSION['Items']->CurrDecimalPlaces); - $DisplayGrossLineTotal = number_format($LineTotal+ $TaxLineTotal,2); + $DisplayGrossLineTotal = number_format($LineTotal+ $TaxLineTotal,$_SESSION['Items']->CurrDecimalPlaces); echo '<td class="number">'.$DisplayTaxAmount.'</td><td class="number">'.$DisplayGrossLineTotal.'</td>'; if ($LnItm->Controlled==1){ if (!isset($_POST['ProcessInvoice'])) { - echo '<td><a href="' . $rootpath . '/ConfirmDispatchControlled_Invoice.php?' . SID . '&LineNo='. $LnItm->LineNumber.'">'; + echo '<td><a href="' . $rootpath . '/ConfirmDispatchControlled_Invoice.php?LineNo='. $LnItm->LineNumber.'">'; if ($LnItm->Serialised==1){ echo _('Enter Serial Numbers'); } else { /*Just batch/roll/lot control */ @@ -400,7 +397,7 @@ } echo '</tr>'; if (strlen($LnItm->Narrative)>1){ - $narrative=str_replace('\r\n','<br>', $LnItm->Narrative); + $narrative=str_replace('\r\n','<br />', $LnItm->Narrative); echo $RowStarter . '<td colspan=12>' . stripslashes($narrative) . '</td></tr>'; } }//end foreach ($line) @@ -413,12 +410,12 @@ if(!isset($_SESSION['Items']->FreightCost)) { if ($_SESSION['DoFreightCalc']==True){ list ($FreightCost, $BestShipper) = CalcFreightCost($_SESSION['Items']->total, - $_SESSION['Items']->BrAdd2, - $_SESSION['Items']->BrAdd3, - $_SESSION['Items']->totalVolume, - $_SESSION['Items']->totalWeight, - $_SESSION['Items']->Location, - $db); + $_SESSION['Items']->BrAdd2, + $_SESSION['Items']->BrAdd3, + $_SESSION['Items']->totalVolume, + $_SESSION['Items']->totalWeight, + $_SESSION['Items']->Location, + $db); $_SESSION['Items']->ShipVia = $BestShipper; } if (is_numeric($FreightCost)){ @@ -433,7 +430,7 @@ if (DB_num_rows($TestShipperExists)==1){ $BestShipper = $_SESSION['Default_Shipper']; } else { - $SQL = 'SELECT shipper_id FROM shippers'; + $SQL = "SELECT shipper_id FROM shippers"; $ErrMsg = _('There was a problem testing for a default shipper'); $TestShipperExists = DB_query($SQL,$db, $ErrMsg); if (DB_num_rows($TestShipperExists)>=1){ @@ -487,7 +484,7 @@ $i=0; // initialise the number of taxes iterated through foreach ($_SESSION['Items']->FreightTaxes as $FreightTaxLine) { if ($i>0){ - echo '<br>'; + echo '<br />'; } echo $FreightTaxLine->TaxAuthDescription; $i++; @@ -498,14 +495,14 @@ $i=0; foreach ($_SESSION['Items']->FreightTaxes as $FreightTaxLine) { if ($i>0){ - echo '<br>'; + echo '<br />'; } if (isset($_POST['ProcessInvoice'])) { echo $FreightTaxLine->TaxRate * 100 ; } else { echo '<input type="text" class="number" name="FreightTaxRate' . $FreightTaxLine->TaxCalculationOrder . - '" maxlength="4" size="4" VALUE="' . $FreightTaxLine->TaxRate * 100 . '">'; + '" maxlength="4" size="4" value="' . $FreightTaxLine->TaxRate * 100 . '">'; } if ($FreightTaxLine->TaxOnTax ==1){ @@ -520,26 +517,26 @@ } echo '</td>'; -echo '<td class="number">' . number_format($FreightTaxTotal,2) . '</td> - <td class="number">' . number_format($FreightTaxTotal+ $_POST['ChargeFreightCost'],2) . '</td> +echo '<td class="number">' . number_format($FreightTaxTotal,$_SESSION['Items']->CurrDecimalPlaces) . '</td> + <td class="number">' . number_format($FreightTaxTotal+ $_POST['ChargeFreightCost'],$_SESSION['Items']->CurrDecimalPlaces) . '</td> </tr>'; $TaxTotal += $FreightTaxTotal; -$DisplaySubTotal = number_format(($_SESSION['Items']->total + $_POST['ChargeFreightCost']),2); +$DisplaySubTotal = number_format(($_SESSION['Items']->total + $_POST['ChargeFreightCost']),$_SESSION['Items']->CurrDecimalPlaces); /* round the totals to avoid silly entries */ $TaxTotal = round($TaxTotal,2); -$_SESSION['Items']->total = round($_SESSION['Items']->total,2); -$_POST['ChargeFreightCost'] = round($_POST['ChargeFreightCost'],2); +$_SESSION['Items']->total = round($_SESSION['Items']->total,$_SESSION['Items']->CurrDecimalPlaces); +$_POST['ChargeFreightCost'] = round($_POST['ChargeFreightCost'],$_SESSION['Items']->CurrDecimalPlaces); echo '<tr> <td colspan="10" class="number">' . _('Invoice Totals'). '</td> <td class="number:><hr><b>'.$DisplaySubTotal.'</b><hr></td> <td colspan="2"></td> - <td class="number"><hr><b>' . number_format($TaxTotal,2) . '</b><hr></td> - <td class="number"><hr><b>' . number_format($TaxTotal+($_SESSION['Items']->total + $_POST['ChargeFreightCost']),2) . '</b><hr></td> + <td class="number"><hr><b>' . number_format($TaxTotal,$_SESSION['Items']->CurrDecimalPlaces) . '</b><hr></td> + <td class="number"><hr><b>' . number_format($TaxTotal+($_SESSION['Items']->total + $_POST['ChargeFreightCost']),$_SESSION['Items']->CurrDecimalPlaces) . '</b><hr></td> </tr>'; if (! isset($_POST['DispatchDate']) OR ! Is_Date($_POST['DispatchDate'])){ @@ -548,12 +545,10 @@ $DefaultDispatchDate = $_POST['DispatchDate']; } -echo '</table><br>'; +echo '</table><br />'; +if (isset($_POST['ProcessInvoice']) AND $_POST['ProcessInvoice'] != ''){ - -if (isset($_POST['ProcessInvoice']) && $_POST['ProcessInvoice'] != ""){ - /* SQL to process the postings for sales invoices... /*First check there are lines on the dipatch with quantities to invoice @@ -634,10 +629,10 @@ /* Now Get the area where the sale is to from the branches table */ $SQL = "SELECT area, - defaultshipvia - FROM custbranch - WHERE custbranch.debtorno ='". $_SESSION['Items']->DebtorNo . "' - AND custbranch.branchcode = '" . $_SESSION['Items']->Branch . "'"; + defaultshipvia + FROM custbranch + WHERE custbranch.debtorno ='". $_SESSION['Items']->DebtorNo . "' + AND custbranch.branchcode = '" . $_SESSION['Items']->Branch . "'"; $ErrMsg = _('We were unable to load Area where the Sale is to from the BRANCHES table') . '. ' . _('Please remedy this'); $Result = DB_query($SQL,$db, $ErrMsg); @@ -658,13 +653,13 @@ /*Now need to check that the order details are the same as they were when they were read into the Items array. If they've changed then someone else may have invoiced them */ $SQL = "SELECT stkcode, - quantity, - qtyinvoiced, - orderlineno - FROM salesorderdetails - WHERE completed=0 - AND orderno = '" . $_SESSION['ProcessingOrder']."'"; - + quantity, + qtyinvoiced, + orderlineno + FROM salesorderdetails + WHERE completed=0 + AND orderno = '" . $_SESSION['ProcessingOrder']."'"; + $Result = DB_query($SQL,$db); if (DB_num_rows($Result) != count($_SESSION['Items']->LineItems)){ @@ -672,12 +667,12 @@ /*there should be the same number of items returned from this query as there are lines on the invoice - if not then someone has already invoiced or credited some lines */ if ($debug==1){ - echo '<br>'.$SQL; - echo '<br>' . _('Number of rows returned by SQL') . ':' . DB_num_rows($Result); - echo '<br>' . _('Count of items in the session') . ' ' . count($_SESSION['Items']->LineItems); + echo '<br />'.$SQL; + echo '<br />' . _('Number of rows returned by SQL') . ':' . DB_num_rows($Result); + echo '<br />' . _('Count of items in the session') . ' ' . count($_SESSION['Items']->LineItems); } - echo '<br>'; + echo '<br />'; prnMsg( _('This order has been changed or invoiced since this delivery was started to be confirmed') . '. ' . _('Processing halted') . '. ' . _('To enter and confirm this dispatch') . '/' . _('invoice the order must be re-selected and re-read again to update the changes made by the other user'), 'error'); unset($_SESSION['Items']->LineItems); @@ -692,15 +687,15 @@ if ($_SESSION['Items']->LineItems[$myrow['orderlineno']]->Quantity != $myrow['quantity'] OR $_SESSION['Items']->LineItems[$myrow['orderlineno']]->QtyInv != $myrow['qtyinvoiced']) { - echo '<br>'. _('Orig order for'). ' ' . $myrow['orderlineno'] . ' '. _('has a quantity of'). ' ' . + echo '<br />'. _('Orig order for'). ' ' . $myrow['orderlineno'] . ' '. _('has a quantity of'). ' ' . $myrow['quantity'] . ' '. _('and an invoiced qty of'). ' ' . $myrow['qtyinvoiced'] . ' '. _('the session shows quantity of'). ' ' . $_SESSION['Items']->LineItems[$myrow['orderlineno']]->Quantity . ' ' . _('and quantity invoice of'). ' ' . $_SESSION['Items']->LineItems[$myrow['orderlineno']]->QtyInv; prnMsg( _('This order has been changed or invoiced since this delivery was started to be confirmed') . ' ' . _('Processing halted.') . ' ' . _('To enter and confirm this dispatch, it must be re-selected and re-read again to update the changes made by the other user'), 'error'); - echo '<br>'; + echo '<br />'; - echo '<div class="centre"><a href="'. $rootpath . '/SelectSalesOrder.php?' . SID . '">'. _('Select a sales order for confirming deliveries and invoicing'). '</a></div>'; + echo '<div class="centre"><a href="'. $rootpath . '/SelectSalesOrder.php">'. _('Select a sales order for confirming deliveries and invoicing'). '</a></div>'; unset($_SESSION['Items']->LineItems); unset($_SESSION['Items']); @@ -739,8 +734,8 @@ /*Update order header for invoice charged on */ $SQL = "UPDATE salesorders - SET comments = CONCAT(comments,' Inv ','" . $InvoiceNo . "') - WHERE orderno= '" . $_SESSION['ProcessingOrder']."'"; + SET comments = CONCAT(comments,' Inv ','" . $InvoiceNo . "') + WHERE orderno= '" . $_SESSION['ProcessingOrder']."'"; $ErrMsg = _('CRITICAL ERROR') . ' ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The sales order header could not be updated with the invoice number'); $DbgMsg = _('The following SQL to update the sales order was used'); @@ -749,40 +744,40 @@ /*Now insert the DebtorTrans */ $SQL = "INSERT INTO debtortrans ( transno, - type, - debtorno, - branchcode, - trandate, - inputdate, - prd, - reference, - tpe, - order_, - ovamount, - ovgst, - ovfreight, - rate, - invtext, - shipvia, - consignment ) - VALUES ( - '". $InvoiceNo . "', - 10, - '" . $_SESSION['Items']->DebtorNo . "', - '" . $_SESSION['Items']->Branch . "', - '" . $DefaultDispatchDate . "', - '" . date('Y-m-d H-i-s') . "', - '" . $PeriodNo . "', - '', - '" . $_SESSION['Items']->DefaultSalesType . "', - '" . $_SESSION['ProcessingOrder'] . "', - '" . $_SESSION['Items']->total . "', - '" . $TaxTotal . "', - '" . $_POST['ChargeFreightCost'] . "', - '" . $_SESSION['CurrencyRate'] . "', - '" . $_POST['InvoiceText'] . "', - '" . $_SESSION['Items']->ShipVia . "', - '" . $_POST['Consignment'] . "' )"; + type, + debtorno, + branchcode, + trandate, + inputdate, + prd, + reference, + tpe, + order_, + ovamount, + ovgst, + ovfreight, + rate, + invtext, + shipvia, + consignment ) + VALUES ( + '". $InvoiceNo . "', + 10, + '" . $_SESSION['Items']->DebtorNo . "', + '" . $_SESSION['Items']->Branch . "', + '" . $DefaultDispatchDate . "', + '" . date('Y-m-d H-i-s') . "', + '" . $PeriodNo . "', + '', + '" . $_SESSION['Items']->DefaultSalesType . "', + '" . $_SESSION['ProcessingOrder'] . "', + '" . $_SESSION['Items']->total . "', + '" . $TaxTotal . "', + '" . $_POST['ChargeFreightCost'] . "', + '" . $_SESSION['CurrencyRate'] . "', + '" . $_POST['InvoiceText'] . "', + '" . $_SESSION['Items']->ShipVia . "', + '" . $_POST['Consignment'] . "' )"; $ErrMsg =_('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The debtor transaction record could not be inserted because'); $DbgMsg = _('The following SQL to insert the debtor transaction record was used'); @@ -794,11 +789,11 @@ foreach ($TaxTotals AS $TaxAuthID => $TaxAmount) { $SQL = "INSERT INTO debtortranstaxes (debtortransid, - taxauthid, - taxamount) - VALUES ('" . $DebtorTransID . "', - '" . $TaxAuthID . "', - '" . $TaxAmount/$_SESSION['CurrencyRate'] . "')"; + taxauthid, + taxamount) + VALUES ('" . $DebtorTransID . "', + '" . $TaxAuthID . "', + '" . $TaxAmount/$_SESSION['CurrencyRate'] . "')"; $ErrMsg =_('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The debtor transaction taxes records could not be inserted because'); $DbgMsg = _('The following SQL to insert the debtor transaction taxes record was used'); @@ -812,26 +807,25 @@ /*Test to see if the item being sold is an asset */ if (substr($OrderLine->StockID,0,6)=='ASSET-'){ - $IsAsset = true; - $HyphenOccursAt = strpos($OrderLine->StockID,'-',6); - if ($HyphenOccursAt == false){ - $AssetNumber = intval(substr($OrderLine->StockID,6)); - } else { - $AssetNumber = intval(substr($OrderLine->StockID,6,strlen($OrderLine->StockID)-$HyphenOccursAt-1)); - } - prnMsg (_('The asset number beind disposed of is:') . ' ' . $AssetNumber, 'info'); + $IsAsset = true; + $HyphenOccursAt = strpos($OrderLine->StockID,'-',6); + if ($HyphenOccursAt == false){ + $AssetNumber = intval(substr($OrderLine->StockID,6)); } else { - $IsAsset = false; - $AssetNumber = 0; + $AssetNumber = intval(substr($OrderLine->StockID,6,strlen($OrderLine->StockID)-$HyphenOccursAt-1)); } + prnMsg (_('The asset number beind disposed of is:') . ' ' . $AssetNumber, 'info'); + } else { + $IsAsset = false; + $AssetNumber = 0; + } - if ($_POST['BOPolicy']=='CAN'){ $SQL = "UPDATE salesorderdetails - SET quantity = quantity - " . ($OrderLine->Quantity - $OrderLine->QtyDispatched) . " - WHERE orderno = '" . $_SESSION['ProcessingOrder'] . " ' - AND stkcode = '" . $OrderLine->StockID . "'"; + SET quantity = quantity - " . ($OrderLine->Quantity - $OrderLine->QtyDispatched) . " + WHERE orderno = '" . $_SESSION['ProcessingOrder'] . " ' + AND stkcode = '" . $OrderLine->StockID . "'"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The sales order detail record could not be updated because'); $DbgMsg = _('The following SQL to update the sales order detail record was used'); @@ -841,20 +835,20 @@ if (($OrderLine->Quantity - $OrderLine->QtyDispatched)>0){ $SQL = "INSERT INTO orderdeliverydifferenceslog ( orderno, - invoiceno, - stockid, - quantitydiff, - debtorno, - branch, - can_or_bo ) - VALUES ( - '" . $_SESSION['ProcessingOrder'] . "', - '" . $InvoiceNo . "', - '" . $OrderLine->StockID . "', - '" . ($OrderLine->Quantity - $OrderLine->QtyDispatched) . "', - '" . $_SESSION['Items']->DebtorNo . "', - '" . $_SESSION['Items']->Branch . "', - 'CAN')"; + invoiceno, + stockid, + quantitydiff, + debtorno, + branch, + can_or_bo ) + VALUES ( + '" . $_SESSION['ProcessingOrder'] . "', + '" . $InvoiceNo . "', + '" . $OrderLine->StockID . "', + '" . ($OrderLine->Quantity - $OrderLine->QtyDispatched) . "', + '" . $_SESSION['Items']->DebtorNo . "', + '" . $_SESSION['Items']->Branch . "', + 'CAN')"; $ErrMsg =_('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The order delivery differences log record could not be inserted because'); $DbgMsg = _('The following SQL to insert the order delivery differences record was used'); @@ -868,44 +862,46 @@ /*The order is being short delivered after the due date - need to insert a delivery differnce log */ $SQL = "INSERT INTO orderdeliverydifferenceslog ( orderno, - invoiceno, - stockid, - quantitydiff, - debtorno, - branch, - can_or_bo - ) - VALUES ( - '" . $_SESSION['ProcessingOrder'] . "', - '" . $InvoiceNo . "', - '" . $OrderLine->StockID . "', - '" . ($OrderLine->Quantity - $OrderLine->QtyDispatched) . "', - '" . $_SESSION['Items']->DebtorNo . "', - '" . $_SESSION['Items']->Branch . "', - 'BO' - )"; + invoiceno, + stockid, + quantitydiff, + debtorno, + branch, + can_or_bo + ) + VALUES ( + '" . $_SESSION['ProcessingOrder'] . "', + '" . $InvoiceNo . "', + '" . $OrderLine->StockID . "', + '" . ($OrderLine->Quantity - $OrderLine->QtyDispatched) . "', + '" . $_SESSION['Items']->DebtorNo . "', + '" . $_SESSION['Items']->Branch . "', + 'BO' + )"; - $ErrMsg = '<br>' . _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The order delivery differences log record could not be inserted because'); + $ErrMsg = '<br />' . _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The order delivery differences log record could not be inserted because'); $DbgMsg = _('The following SQL to insert the order delivery differences record was used'); $Result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); } /*end of order delivery differences log entries */ /*Now update SalesOrderDetails for the quantity invoiced and the actual dispatch dates. */ - if ($OrderLine->QtyDispatched !=0 AND $OrderLine->QtyDispatched!="" AND $OrderLine->QtyDispatched) { + if ($OrderLine->QtyDispatched !=0 AND $OrderLine->QtyDispatched!='' AND $OrderLine->QtyDispatched) { // Test above to see if the line is completed or not - if ($OrderLine->QtyDispatched>=($OrderLine->Quantity - $OrderLine->QtyInv) OR $_POST['BOPolicy']=="CAN"){ - $SQL = "UPDATE salesorderdetails SET qtyinvoiced = qtyinvoiced + " . $OrderLine->QtyDispatched . ", - actualdispatchdate = '" . $DefaultDispatchDate . "', - completed=1 - WHERE orderno = '" . $_SESSION['ProcessingOrder'] . "' - AND orderlineno = '" . $OrderLine->LineNumber . "'"; + if ($OrderLine->QtyDispatched>=($OrderLine->Quantity - $OrderLine->QtyInv) OR $_POST['BOPolicy']=='CAN'){ + $SQL = "UPDATE salesorderdetails + SET qtyinvoiced = qtyinvoiced + " . $OrderLine->QtyDispatched . ", + actualdispatchdate = '" . $DefaultDispatchDate . "', + completed=1 + WHERE orderno = '" . $_SESSION['ProcessingOrder'] . "' + AND orderlineno = '" . $OrderLine->LineNumber . "'"; } else { - $SQL = "UPDATE salesorderdetails SET qtyinvoiced = qtyinvoiced + " . $OrderLine->QtyDispatched . ", - actualdispatchdate = '" . $DefaultDispatchDate . "' - WHERE orderno = '" . $_SESSION['ProcessingOrder'] . "' - AND orderlineno = '" . $OrderLine->LineNumber . "'"; + $SQL = "UPDATE salesorderdetails + SET qtyinvoiced = qtyinvoiced + " . $OrderLine->QtyDispatched . ", + actualdispatchdate = '" . $DefaultDispatchDate . "' + WHERE orderno = '" . $_SESSION['ProcessingOrder'] . "' + AND orderlineno = '" . $OrderLine->LineNumber . "'"; } @@ -916,8 +912,8 @@ /* Update location stock records if not a dummy stock item need the MBFlag later too so save it to $MBFlag */ $Result = DB_query("SELECT mbflag - FROM stockmaster - WHERE stockid = '" . $OrderLine->StockID . "'",$db, _('Cannot retrieve the mbflag')); + FROM stockmaster + WHERE stockid = '" . $OrderLine->StockID . "'",$db, _('Cannot retrieve the mbflag')); $myrow = DB_fetch_row($Result); $MBFlag = $myrow[0]; @@ -928,9 +924,9 @@ /* Need to get the current location quantity will need it later for the stock movement */ $SQL="SELECT locstock.quantity - FROM locstock - WHERE locstock.stockid='" . $OrderLine->StockID . "' - AND loccode= '" . $_SESSION['Items']->Location . "'"; + FROM locstock + WHERE locstock.stockid='" . $OrderLine->StockID . "' + AND loccode= '" . $_SESSION['Items']->Location . "'"; $ErrMsg = _('WARNING') . ': ' . _('Could not retrieve current location stock'); $Result = DB_query($SQL, $db, $ErrMsg); @@ -943,9 +939,9 @@ } $SQL = "UPDATE locstock SET quantity = locstock.quantity - " . $OrderLine->QtyDispatched . " - WHERE locstock.stockid = '" . $OrderLine->StockID . "' - AND loccode = '" . $_SESSION['Items']->Location . "'"; - + WHERE locstock.stockid = '" . $OrderLine->StockID . "' + AND loccode = '" . $_SESSION['Items']->Location . "'"; + $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('Location stock record could not be updated because'); $DbgMsg = _('The following SQL to update the location stock record was used'); $Result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); @@ -956,15 +952,15 @@ $Assembly=True; $StandardCost =0; /*To start with - accumulate the cost of the comoponents for use in journals later on */ $SQL = "SELECT bom.component, - bom.quantity, - stockmaster.materialcost+stockmaster.labourcost+stockmaster.overheadcost AS standard - FROM bom, - stockmaster - WHERE bom.component=stockmaster.stockid - AND bom.parent='" . $OrderLine->StockID . "' - AND bom.effectiveto > '" . Date("Y-m-d") . "' - AND bom.effectiveafter < '" . Date("Y-m-d") . "'"; - + bom.quantity, + stockmaster.materialcost+stockmaster.labourcost+stockmaster.overheadcost AS standard + FROM bom, + stockmaster + WHERE bom.component=stockmaster.stockid + AND bom.parent='" . $OrderLine->StockID . "' + AND bom.effectiveto >= '" . Date('Y-m-d') . "' + AND bom.effectiveafter < '" . Date('Y-m-d') . "'"; + $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('Could not retrieve assembly components from the database for'). ' '. $OrderLine->StockID . _('because').' '; $DbgMsg = _('The SQL that failed was'); $AssResult = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); @@ -975,9 +971,9 @@ /* Need to get the current location quantity will need it later for the stock movement */ $SQL="SELECT locstock.quantity - FROM locstock - WHERE locstock.stockid='" . $AssParts['component'] . "' - AND loccode= '" . $_SESSION['Items']->Location . "'"; + FROM locstock + WHERE locstock.stockid='" . $AssParts['component'] . "' + AND loccode= '" . $_SESSION['Items']->Location . "'"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('Can not retrieve assembly components location stock quantities because '); $DbgMsg = _('The SQL that failed was'); @@ -992,35 +988,32 @@ if (empty($AssParts['standard'])) { $AssParts['standard']=0; } - $SQL = "INSERT INTO stockmoves ( - stockid, - type, - transno, - loccode, - trandate, - debtorno, - branchcode, - prd, - reference, - qty, - standardcost, - show_on_inv_crds, - newqoh - ) VALUES ( - '" . $AssParts['component'] . "', - 10, - '" . $InvoiceNo . "', - '" . $_SESSION['Items']->Location . "', - '" . $DefaultDispatchDate . "', - '" . $_SESSION['Items']->DebtorNo . "', - '" . $_SESSION['Items']->Branch . "', - '" . $PeriodNo . "', - '" . _('Assembly') . ': ' . $OrderLine->StockID . ' ' . _('Order') . ': ' . $_SESSION['ProcessingOrder'] . "', - '" . -$AssParts['quantity'] * $OrderLine->QtyDispatched . "', - '" . $AssParts['standard'] . "', - 0, - '" . ($QtyOnHandPrior - $AssParts['quantity'] * $OrderLine->QtyDispatched) . "' - )"; + $SQL = "INSERT INTO stockmoves ( stockid, + type, + transno, + loccode, + trandate, + debtorno, + branchcode, + prd, + reference, + qty, + standardcost, + show_on_inv_crds, + newqoh) + VALUES ('" . $AssParts['component'] . "', + 10, + '" . $InvoiceNo . "', + '" . $_SESSION['Items']->Location . "', + '" . $DefaultDispatchDate . "', + '" . $_SESSION['Items']->DebtorNo . "', + '" . $_SESSION['Items']->Branch . "', + '" . $PeriodNo . "', + '" . _('Assembly') . ': ' . $OrderLine->StockID . ' ' . _('Order') . ': ' . $_SESSION['ProcessingOrder'] . "', + '" . -$AssParts['quantity'] * $OrderLine->QtyDispatched . "', + '" . $AssParts['standard'] . "', + 0, + '" . ($QtyOnHandPrior - $AssParts['quantity'] * $OrderLine->QtyDispatched) . "' )"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('Stock movement records for the assembly components of'). ' '. $OrderLine->StockID . ' ' . _('could not be inserted because'); $DbgMsg = _('The following SQL to insert the assembly components stock movement records was used'); @@ -1028,9 +1021,9 @@ $SQL = "UPDATE locstock - SET quantity = locstock.quantity - " . $AssParts['quantity'] * $OrderLine->QtyDispatched . " - WHERE locstock.stockid = '" . $AssParts['component'] . "' - AND loccode = '" . $_SESSION['Items']->Location . "'"; + SET quantity = locstock.quantity - " . $AssParts['quantity'] * $OrderLine->QtyDispatched . " + WHERE locstock.stockid = '" . $AssParts['component'] . "' + AND loccode = '" . $_SESSION['Items']->Location . "'"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('Location stock record could not be updated for an assembly component because'); $DbgMsg = _('The following SQL to update the locations stock record for the component was used'); @@ -1050,68 +1043,68 @@ } if ($MBFlag=='B' OR $MBFlag=='M'){ $SQL = "INSERT INTO stockmoves ( stockid, - type, - transno, - loccode, - trandate, - debtorno, - branchcode, - price, - prd, - reference, - qty, - discountpercent, - standardcost, - newqoh, - narrative ) - VALUES ('" . $OrderLine->StockID . "', - 10, - '" . $InvoiceNo . "', - '" . $_SESSION['Items']->Location . "', - '" . $DefaultDispatchDate . "', - '" . $_SESSION['Items']->DebtorNo . "', - '" . $_SESSION['Items']->Branch . "', - '" . $LocalCurrencyPrice . "', - '" . $PeriodNo . "', - '" . $_SESSION['ProcessingOrder'] . "', - '" . -$OrderLine->QtyDispatched . "', - '" . $OrderLine->DiscountPercent . "', - '" . $OrderLine->StandardCost . "', - '" . ($QtyOnHandPrior - $OrderLine->QtyDispatched) . "', - '" . DB_escape_string($OrderLine->Narrative) . "' )"; + type, + transno, + loccode, + trandate, + debtorno, + branchcode, + price, + prd, + reference, + qty, + discountpercent, + standardcost, + newqoh, + narrative ) + VALUES ('" . $OrderLine->StockID . "', + 10, + '" . $InvoiceNo . "', + '" . $_SESSION['Items']->Location . "', + '" . $DefaultDispatchDate . "', + '" . $_SESSION['Items']->DebtorNo . "', + '" . $_SESSION['Items']->Branch . "', + '" . $LocalCurrencyPrice . "', + '" . $PeriodNo . "', + '" . $_SESSION['ProcessingOrder'] . "', + '" . -$OrderLine->QtyDispatched . "', + '" . $OrderLine->DiscountPercent . "', + '" . $OrderLine->StandardCost . "', + '" . ($QtyOnHandPrior - $OrderLine->QtyDispatched) . "', + '" . DB_escape_string($OrderLine->Narrative) . "' )"; } else { // its an assembly or dummy and assemblies/dummies always have nil stock (by definition they are made up at the time of dispatch so new qty on hand will be nil if (empty($OrderLine->StandardCost)) { $OrderLine->StandardCost=0; } $SQL = "INSERT INTO stockmoves ( stockid, - type, - transno, - loccode, - trandate, - debtorno, - branchcode, - price, - prd, - reference, - qty, - discountpercent, - standardcost, - narrative ) - VALUES ('" . $OrderLine->StockID . "', - 10, - '" . $InvoiceNo . "', - '" . $_SESSION['Items']->Location . "', - '" . $DefaultDispatchDate . "', - '" . $_SESSION['Items']->DebtorNo . "', - '" . $_SESSION['Items']->Branch . "', - '" . $LocalCurrencyPrice . "', - '" . $PeriodNo . "', - '" . $_SESSION['ProcessingOrder'] . "', - '" . -$OrderLine->QtyDispatched . "', - '" . $OrderLine->DiscountPercent . "', - '" . $OrderLine->StandardCost . "', - '" . DB_escape_string($OrderLine->Narrative) . "')"; + type, + transno, + loccode, + trandate, + debtorno, + branchcode, + price, + prd, + reference, + qty, + discountpercent, + standardcost, + narrative ) + VALUES ('" . $OrderLine->StockID . "', + 10, + '" . $InvoiceNo . "', + '" . $_SESSION['Items']->Location . "', + '" . $DefaultDispatchDate . "', + '" . $_SESSION['Items']->DebtorNo . "', + '" . $_SESSION['Items']->Branch . "', + '" . $LocalCurrencyPrice . "', + '" . $PeriodNo . "', + '" . $_SESSION['ProcessingOrder'] . "', + '" . -$OrderLine->QtyDispatched . "', + '" . $OrderLine->DiscountPercent . "', + '" . $OrderLine->StandardCost . "', + '" . DB_escape_string($OrderLine->Narrative) . "')"; } @@ -1126,15 +1119,15 @@ foreach ($OrderLine->Taxes as $Tax) { $SQL = "INSERT INTO stockmovestaxes (stkmoveno, - taxauthid, - taxrate, - taxcalculationorder, - taxontax) - VALUES ('" . $StkMoveNo . "', - '" . $Tax->TaxAuthID . "', - '" . $Tax->TaxRate . "', - '" . $Tax->TaxCalculationOrder . "', - '" . $Tax->TaxOnTax . "')"; + taxauthid, + taxrate, + taxcalculationorder, + taxontax) + VALUES ('" . $StkMoveNo . "', + '" . $Tax->TaxAuthID . "', + '" . $Tax->TaxRate . "', + '" . $Tax->TaxCalculationOrder . "', + '" . $Tax->TaxOnTax . "')"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('Taxes and rates applicable to this invoice line item could not be inserted because'); $DbgMsg = _('The following SQL to insert the stock movement tax detail records was used'); @@ -1150,9 +1143,9 @@ The StockSerialMoves as well */ $SQL = "UPDATE stockserialitems SET quantity= quantity - " . $Item->BundleQty . " - WHERE stockid='" . $OrderLine->StockID . "' - AND loccode='" . $_SESSION['Items']->Location . "' - AND serialno='" . $Item->BundleRef . "'"; + WHERE stockid='" . $OrderLine->StockID . "' + AND loccode='" . $_SESSION['Items']->Location . "' + AND serialno='" . $Item->BundleRef . "'"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The serial stock item record could not be updated because'); $DbgMsg = _('The following SQL to update the serial stock item record was used'); @@ -1161,13 +1154,13 @@ /* now insert the serial stock movement */ $SQL = "INSERT INTO stockserialmoves (stockmoveno, - stockid, - serialno, - moveqty) - VALUES ('" . $StkMoveNo . "', - '" . $OrderLine->StockID . "', - '" . $Item->BundleRef . "', - '" . -$Item->BundleQty . "')"; + stockid, + serialno, + moveqty) + VALUES ('" . $StkMoveNo . "', + '" . $OrderLine->StockID . "', + '" . $Item->BundleRef . "', + '" . -$Item->BundleQty . "')"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The serial stock movement record could not be inserted because'); $DbgMsg = _('The following SQL to insert the serial stock movement records was used'); @@ -1178,14 +1171,14 @@ /*Insert Sales Analysis records */ $SQL="SELECT COUNT(*), - salesanalysis.stockid, - salesanalysis.stkcategory, - salesanalysis.cust, - salesanalysis.custbranch, - salesanalysis.area, - salesanalysis.periodno, - salesanalysis.typeabbrev, - salesanalysis.salesperson + salesanalysis.stockid, + salesanalysis.stkcategory, + salesanalysis.cust, + salesanalysis.custbranch, + salesanalysis.area, + salesanalysis.periodno, + salesanalysis.typeabbrev, + salesanalysis.salesperson FROM salesanalysis, custbranch, stockmaster @@ -1211,7 +1204,7 @@ salesanalysis.salesperson"; $ErrMsg = _('The count of existing Sales analysis records could not run because'); - $DbgMsg = '<br>'. _('SQL to count the no of sales analysis records'); + $DbgMsg = '<br />'. _('SQL to count the no of sales analysis records'); $Result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); $myrow = DB_fetch_row($Result); @@ -1219,9 +1212,9 @@ if ($myrow[0]>0){ /*Update the existing record that already exists */ $SQL = "UPDATE salesanalysis SET amt=amt+" . ($OrderLine->Price * $OrderLine->QtyDispatched / $_SESSION['CurrencyRate']) . ", - cost=cost+" . ($OrderLine->StandardCost * $OrderLine->QtyDispatched) . ", - qty=qty +" . $OrderLine->QtyDispatched . ", - disc=disc+" . ($OrderLine->DiscountPercent * $OrderLine->Price * $OrderLine->QtyDispatched / $_SESSION['CurrencyRate']) . " + cost=cost+" . ($OrderLine->StandardCost * $OrderLine->QtyDispatched) . ", + qty=qty +" . $OrderLine->QtyDispatched . ", + disc=disc+" . ($OrderLine->DiscountPercent * $OrderLine->Price * $OrderLine->QtyDispatched / $_SESSION['CurrencyRate']) . " WHERE salesanalysis.area='" . $myrow[5] . "' AND salesanalysis.salesperson='" . $myrow[8] . "' AND typeabbrev ='" . $_SESSION['Items']->DefaultSalesType . "' @@ -1235,31 +1228,31 @@ } else { /* insert a new sales analysis record */ $SQL = "INSERT INTO salesanalysis (typeabbrev, - periodno, - amt, - cost, - cust, - custbranch, - qty, - disc, - stockid, - area, - budgetoractual, - salesperson, - stkcategory ) + periodno, + amt, + cost, + cust, + custbranch, + qty, + disc, + stockid, + area, + budgetoractual, + salesperson, + stkcategory ) SELECT '" . $_SESSION['Items']->DefaultSalesType . "', - '" . $PeriodNo . "', - '" . ($OrderLine->Price * $OrderLine->QtyDispatched / $_SESSION['CurrencyRate']) . "', - '" . ($OrderLine->StandardCost * $OrderLine->QtyDispatched) . "', - '" . $_SESSION['Items']->DebtorNo . "', - '" . $_SESSION['Items']->Branch . "', - '" . $OrderLine->QtyDispatched . "', - '" . ($OrderLine->DiscountPercent * $OrderLine->Price * $OrderLine->QtyDispatched / $_SESSION['CurrencyRate']) . "', - '" . $OrderLine->StockID . "', - custbranch.area, - 1, - custbranch.salesman, - stockmaster.categoryid + '" . $PeriodNo . "', + '" . ($OrderLine->Price * $OrderLine->QtyDispatched / $_SESSION['CurrencyRate']) . "', + '" . ($OrderLine->StandardCost * $OrderLine->QtyDispatched) . "', + '" . $_SESSION['Items']->DebtorNo . "', + '" . $_SESSION['Items']->Branch . "', + '" . $OrderLine->QtyDispatched . "', + '" . ($OrderLine->DiscountPercent * $OrderLine->Price * $OrderLine->QtyDispatched / $_SESSION['CurrencyRate']) . "', + '" . $OrderLine->StockID . "', + custbranch.area, + 1, + custbranch.salesman, + stockmaster.categoryid FROM stockmaster, custbranch WHERE stockmaster.stockid = '" . $OrderLine->StockID . "' @@ -1278,20 +1271,20 @@ /*first the cost of sales entry - GL accounts are retrieved using the function GetCOGSGLAccount from includes/GetSalesTransGLCodes.inc */ $SQL = "INSERT INTO gltrans ( type, - typeno, - trandate, - periodno, - account, - narrative, - amount) - VALUES ( - 10, - '" . $InvoiceNo . "', - '" . $DefaultDispatchDate . "', - '" . $PeriodNo . "', - '" . GetCOGSGLAccount($Area, $OrderLine->StockID, $_SESSION['Items']->DefaultSalesType, $db) . "', - '" . $_SESSION['Items']->DebtorNo . " - " . $OrderLine->StockID . " x " . $OrderLine->QtyDispatched . " @ " . $OrderLine->StandardCost . "', - ... [truncated message content] |
From: <dai...@us...> - 2011-05-02 10:34:04
|
Revision: 4560 http://web-erp.svn.sourceforge.net/web-erp/?rev=4560&view=rev Author: daintree Date: 2011-05-02 10:33:55 +0000 (Mon, 02 May 2011) Log Message: ----------- quoting and currency decimal places on order entry Modified Paths: -------------- trunk/COGSGLPostings.php trunk/ConfirmDispatch_Invoice.php trunk/ContractBOM.php trunk/OffersReceived.php trunk/PO_PDFPurchOrder.php trunk/SelectOrderItems.php trunk/doc/Change.log.html trunk/includes/DefineCartClass.php Modified: trunk/COGSGLPostings.php =================================================================== --- trunk/COGSGLPostings.php 2011-05-01 09:45:18 UTC (rev 4559) +++ trunk/COGSGLPostings.php 2011-05-02 10:33:55 UTC (rev 4560) @@ -1,9 +1,7 @@ <?php -/* $Revision: 1.15 $ */ + /* $Id$*/ -//$PageSecurity = 10; - include('includes/session.inc'); $title = _('Cost Of Sales GL Postings Set Up'); @@ -58,7 +56,6 @@ $result = DB_query($sql,$db); prnMsg ($msg,'info'); - echo '<br />'; unset ($SelectedCOGSPostingID); } elseif (isset($_GET['delete'])) { @@ -67,23 +64,21 @@ $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 />'; unset ($SelectedCOGSPostingID); - } if (!isset($SelectedCOGSPostingID)) { $ShowLivePostingRecords = true; - $sql = 'SELECT cogsglpostings.id, - cogsglpostings.area, - cogsglpostings.stkcat, - cogsglpostings.salestype, - chartmaster.accountname - FROM cogsglpostings LEFT JOIN chartmaster + $sql = "SELECT cogsglpostings.id, + cogsglpostings.area, + cogsglpostings.stkcat, + cogsglpostings.salestype, + chartmaster.accountname + FROM cogsglpostings LEFT JOIN chartmaster ON cogsglpostings.glcode = chartmaster.accountcode - WHERE chartmaster.accountcode IS NULL'; + WHERE chartmaster.accountcode IS NULL"; $result = DB_query($sql,$db); if (DB_num_rows($result)>0){ @@ -106,12 +101,12 @@ $k=1; } - printf("<td>%s</td> + printf('<td>%s</td> <td>%s</td> <td>%s</td> <td>%s</td> - <td><a href=\"%sSelectedCOGSPostingID=%s\">" . _('Edit') . "</td> - <td><a href=\"%sSelectedCOGSPostingID=%s&delete=yes\">". _('Delete') . "</td></tr>", + <td><a href="%sSelectedCOGSPostingID=%s">' . _('Edit') . '</td> + <td><a href="%sSelectedCOGSPostingID=%s&delete=yes">'. _('Delete') . '</td></tr>', $myrow[1], $myrow[2], $myrow[3], @@ -124,11 +119,11 @@ echo '</table>'; } - $sql = 'SELECT cogsglpostings.id, + $sql = "SELECT cogsglpostings.id, cogsglpostings.area, cogsglpostings.stkcat, cogsglpostings.salestype - FROM cogsglpostings'; + FROM cogsglpostings"; $result = DB_query($sql,$db); @@ -182,14 +177,14 @@ } if ($ShowLivePostingRecords){ - $sql = 'SELECT cogsglpostings.id, - cogsglpostings.area, - cogsglpostings.stkcat, - cogsglpostings.salestype, - chartmaster.accountname - FROM cogsglpostings, - chartmaster - WHERE cogsglpostings.glcode = chartmaster.accountcode'; + $sql = "SELECT cogsglpostings.id, + cogsglpostings.area, + cogsglpostings.stkcat, + cogsglpostings.salestype, + chartmaster.accountname + FROM cogsglpostings, + chartmaster + WHERE cogsglpostings.glcode = chartmaster.accountcode"; $result = DB_query($sql,$db); @@ -197,7 +192,8 @@ echo '<tr><th>' . _('Area') . '</th> <th>' . _('Stock Category') . '</th> <th>' . _('Sales Type') . '</th> - <th>' . _('GL Account') . '</th></tr>'; + <th>' . _('GL Account') . '</th> + </tr>'; $k = 0; while ($myrow = DB_fetch_row($result)) { if ($k==1){ @@ -208,13 +204,13 @@ $k++; } - printf("<td>%s</td> + printf('<td>%s</td> <td>%s</td> <td>%s</td> <td>%s</td> - <td><a href=\"%sSelectedCOGSPostingID=%s\">" . _('Edit') . "</td> - <td><a href=\"%sSelectedCOGSPostingID=%s&delete=yes\">" . _('Delete') . "</td> - </tr>", + <td><a href="%sSelectedCOGSPostingID=%s">' . _('Edit') . '</td> + <td><a href="%sSelectedCOGSPostingID=%s&delete=yes">' . _('Delete') . '</td> + </tr>', $myrow[1], $myrow[2], $myrow[3], @@ -257,14 +253,14 @@ $_POST['StkCat'] = $myrow['stkcat']; $_POST['SalesType'] = $myrow['salestype']; - echo '<input type=hidden name="SelectedCOGSPostingID" VALUE="' . $SelectedCOGSPostingID . '">'; + echo '<input type=hidden name="SelectedCOGSPostingID" value="' . $SelectedCOGSPostingID . '">'; } //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> @@ -274,16 +270,16 @@ 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'] . '</option>'; } //end while loop DB_free_result($result); -$sql = 'SELECT categoryid, categorydescription FROM stockcategory'; +$sql = "SELECT categoryid, categorydescription FROM stockcategory"; $result = DB_query($sql,$db); echo '</select></td></tr> @@ -292,10 +288,10 @@ <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="'; + if (isset($_POST['StkCat']) and $myrow['categoryid']==$_POST['StkCat']) { + echo '<option selected value="'; } else { - echo '<option VALUE="'; + echo '<option value="'; } echo $myrow['categoryid'] . '">' . $myrow['categorydescription'] . '</option>'; @@ -303,7 +299,7 @@ DB_free_result($result); -$sql = 'SELECT typeabbrev, sales_type FROM salestypes'; +$sql = "SELECT typeabbrev, sales_type FROM salestypes"; $result = DB_query($sql,$db); echo '</select></td></tr> @@ -313,9 +309,9 @@ 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'] . '</option>'; @@ -326,22 +322,22 @@ <td><select tabindex="4" name="GLCode">'; DB_free_result($result); -$sql = 'SELECT chartmaster.accountcode, - chartmaster.accountname - FROM chartmaster, - accountgroups - WHERE chartmaster.group_=accountgroups.groupname - AND accountgroups.pandl=1 - ORDER BY accountgroups.sequenceintb, - chartmaster.accountcode, - chartmaster.accountname'; +$sql = "SELECT chartmaster.accountcode, + chartmaster.accountname + FROM chartmaster, + accountgroups + WHERE chartmaster.group_=accountgroups.groupname + AND accountgroups.pandl=1 + ORDER BY accountgroups.sequenceintb, + chartmaster.accountcode, + 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'] . '</option>'; Modified: trunk/ConfirmDispatch_Invoice.php =================================================================== --- trunk/ConfirmDispatch_Invoice.php 2011-05-01 09:45:18 UTC (rev 4559) +++ trunk/ConfirmDispatch_Invoice.php 2011-05-02 10:33:55 UTC (rev 4560) @@ -1,12 +1,10 @@ <?php -/* $Revision: 1.67 $ */ /* $Id$*/ /* Session started in session.inc for password checking and authorisation level check */ include('includes/DefineCartClass.php'); include('includes/DefineSerialItems.php'); -//$PageSecurity = 2; include('includes/session.inc'); $title = _('Confirm Dispatches and Invoice An Order'); @@ -15,10 +13,10 @@ include('includes/FreightCalculation.inc'); include('includes/GetSalesTransGLCodes.inc'); -if (!isset($_GET['OrderNumber']) && !isset($_SESSION['ProcessingOrder'])) { +if (!isset($_GET['OrderNumber']) AND !isset($_SESSION['ProcessingOrder'])) { /* This page can only be called with an order number for invoicing*/ - echo '<div class="centre"><a href="' . $rootpath . '/SelectSalesOrder.php?' . SID . '">' . _('Select a sales order to invoice'). '</a></div>'; - echo '<br><br>'; + echo '<div class="centre"><a href="' . $rootpath . '/SelectSalesOrder.php">' . _('Select a sales order to invoice'). '</a></div>'; + echo '<br /><br />'; prnMsg( _('This page can only be opened if an order has been selected Please select an order first from the delivery details screen click on Confirm for invoicing'), 'error' ); include ('includes/footer.inc'); exit; @@ -34,43 +32,44 @@ /*read in all the guff from the selected order into the Items cart */ $OrderHeaderSQL = "SELECT salesorders.orderno, - salesorders.debtorno, - debtorsmaster.name, - salesorders.branchcode, - salesorders.customerref, - salesorders.comments, - salesorders.orddate, - salesorders.ordertype, - salesorders.shipvia, - salesorders.deliverto, - salesorders.deladd1, - salesorders.deladd2, - salesorders.deladd3, - salesorders.deladd4, - salesorders.deladd5, - salesorders.deladd6, - salesorders.contactphone, - salesorders.contactemail, - salesorders.freightcost, - salesorders.deliverydate, - debtorsmaster.currcode, - salesorders.fromstkloc, - locations.taxprovinceid, - custbranch.taxgroupid, - currencies.rate as currency_rate, - custbranch.defaultshipvia, - custbranch.specialinstructions - FROM salesorders, - debtorsmaster, - custbranch, - currencies, - locations - WHERE salesorders.debtorno = debtorsmaster.debtorno - AND salesorders.branchcode = custbranch.branchcode - AND salesorders.debtorno = custbranch.debtorno - AND locations.loccode=salesorders.fromstkloc - AND debtorsmaster.currcode = currencies.currabrev - AND salesorders.orderno = '" . $_GET['OrderNumber']."'"; + salesorders.debtorno, + debtorsmaster.name, + salesorders.branchcode, + salesorders.customerref, + salesorders.comments, + salesorders.orddate, + salesorders.ordertype, + salesorders.shipvia, + salesorders.deliverto, + salesorders.deladd1, + salesorders.deladd2, + salesorders.deladd3, + salesorders.deladd4, + salesorders.deladd5, + salesorders.deladd6, + salesorders.contactphone, + salesorders.contactemail, + salesorders.freightcost, + salesorders.deliverydate, + debtorsmaster.currcode, + salesorders.fromstkloc, + locations.taxprovinceid, + custbranch.taxgroupid, + currencies.rate as currency_rate, + currencies.decimalplaces, + custbranch.defaultshipvia, + custbranch.specialinstructions + FROM salesorders, + debtorsmaster, + custbranch, + currencies, + locations + WHERE salesorders.debtorno = debtorsmaster.debtorno + AND salesorders.branchcode = custbranch.branchcode + AND salesorders.debtorno = custbranch.debtorno + AND locations.loccode=salesorders.fromstkloc + AND debtorsmaster.currcode = currencies.currabrev + AND salesorders.orderno = '" . $_GET['OrderNumber']."'"; $ErrMsg = _('The order cannot be retrieved because'); $DbgMsg = _('The SQL to get the order header was'); @@ -88,6 +87,7 @@ $_SESSION['Items']->Comments = $myrow['comments']; $_SESSION['Items']->DefaultSalesType =$myrow['ordertype']; $_SESSION['Items']->DefaultCurrency = $myrow['currcode']; + $_SESSION['Items']->CurrDecimalPlaces = $myrow['decimalplaces']; $BestShipper = $myrow['shipvia']; $_SESSION['Items']->ShipVia = $myrow['shipvia']; @@ -120,33 +120,33 @@ /*now populate the line items array with the sales order details records */ $LineItemsSQL = "SELECT stkcode, - stockmaster.description, - stockmaster.controlled, - stockmaster.serialised, - stockmaster.volume, - stockmaster.kgs, - stockmaster.units, - stockmaster.decimalplaces, - stockmaster.mbflag, - stockmaster.taxcatid, - stockmaster.discountcategory, - salesorderdetails.unitprice, - salesorderdetails.quantity, - salesorderdetails.discountpercent, - salesorderdetails.actualdispatchdate, - salesorderdetails.qtyinvoiced, - salesorderdetails.narrative, - salesorderdetails.orderlineno, - salesorderdetails.poline, - salesorderdetails.itemdue, - stockmaster.materialcost + - stockmaster.labourcost + - stockmaster.overheadcost AS standardcost - FROM salesorderdetails INNER JOIN stockmaster - ON salesorderdetails.stkcode = stockmaster.stockid - WHERE salesorderdetails.orderno ='" . $_GET['OrderNumber'] . "' - AND salesorderdetails.quantity - salesorderdetails.qtyinvoiced >0 - ORDER BY salesorderdetails.orderlineno"; + stockmaster.description, + stockmaster.controlled, + stockmaster.serialised, + stockmaster.volume, + stockmaster.kgs, + stockmaster.units, + stockmaster.decimalplaces, + stockmaster.mbflag, + stockmaster.taxcatid, + stockmaster.discountcategory, + salesorderdetails.unitprice, + salesorderdetails.quantity, + salesorderdetails.discountpercent, + salesorderdetails.actualdispatchdate, + salesorderdetails.qtyinvoiced, + salesorderdetails.narrative, + salesorderdetails.orderlineno, + salesorderdetails.poline, + salesorderdetails.itemdue, + stockmaster.materialcost + + stockmaster.labourcost + + stockmaster.overheadcost AS standardcost + FROM salesorderdetails INNER JOIN stockmaster + ON salesorderdetails.stkcode = stockmaster.stockid + WHERE salesorderdetails.orderno ='" . $_GET['OrderNumber'] . "' + AND salesorderdetails.quantity - salesorderdetails.qtyinvoiced >0 + ORDER BY salesorderdetails.orderlineno"; $ErrMsg = _('The line items of the order cannot be retrieved because'); $DbgMsg = _('The SQL that failed was'); @@ -157,29 +157,29 @@ while ($myrow=db_fetch_array($LineItemsResult)) { $_SESSION['Items']->add_to_cart($myrow['stkcode'], - $myrow['quantity'], - $myrow['description'], - $myrow['unitprice'], - $myrow['discountpercent'], - $myrow['units'], - $myrow['volume'], - $myrow['kgs'], - 0, - $myrow['mbflag'], - $myrow['actualdispatchdate'], - $myrow['qtyinvoiced'], - $myrow['discountcategory'], - $myrow['controlled'], - $myrow['serialised'], - $myrow['decimalplaces'], - htmlspecialchars_decode($myrow['narrative']), - 'No', - $myrow['orderlineno'], - $myrow['taxcatid'], - '', - $myrow['itemdue'], - $myrow['poline'], - $myrow['standardcost']); /*NB NO Updates to DB */ + $myrow['quantity'], + $myrow['description'], + $myrow['unitprice'], + $myrow['discountpercent'], + $myrow['units'], + $myrow['volume'], + $myrow['kgs'], + 0, + $myrow['mbflag'], + $myrow['actualdispatchdate'], + $myrow['qtyinvoiced'], + $myrow['discountcategory'], + $myrow['controlled'], + $myrow['serialised'], + $myrow['decimalplaces'], + htmlspecialchars_decode($myrow['narrative']), + 'No', + $myrow['orderlineno'], + $myrow['taxcatid'], + '', + $myrow['itemdue'], + $myrow['poline'], + $myrow['standardcost']); /*NB NO Updates to DB */ /*Calculate the taxes applicable to this line item from the customer branch Tax Group and Item Tax Category */ @@ -187,7 +187,7 @@ } /* line items from sales order details */ } else { /* there are no line items that have a quantity to deliver */ - echo '<br>'; + echo '<br />'; prnMsg( _('There are no ordered items with a quantity left to deliver. There is nothing left to invoice')); include('includes/footer.inc'); exit; @@ -197,7 +197,7 @@ } else { /*end if the order was returned sucessfully */ - echo '<br>'. + echo '<br />'. prnMsg( _('This order item could not be retrieved. Please select another order'), 'warn'); include ('includes/footer.inc'); exit; @@ -227,9 +227,6 @@ } else if (is_numeric($_POST[$Itm->LineNumber . '_QtyDispatched' ])AND $_POST[$Itm->LineNumber . '_QtyDispatched'] <= ($_SESSION['Items']->LineItems[$Itm->LineNumber]->Quantity - $_SESSION['Items']->LineItems[$Itm->LineNumber]->QtyInv)){ $_SESSION['Items']->LineItems[$Itm->LineNumber]->QtyDispatched = $_POST[$Itm->LineNumber . '_QtyDispatched']; } - - - foreach ($Itm->Taxes as $TaxLine) { if (isset($_POST[$Itm->LineNumber . $TaxLine->TaxCalculationOrder . '_TaxRate'])){ $_SESSION['Items']->LineItems[$Itm->LineNumber]->Taxes[$TaxLine->TaxCalculationOrder]->TaxRate = $_POST[$Itm->LineNumber . $TaxLine->TaxCalculationOrder . '_TaxRate']/100; @@ -257,7 +254,7 @@ </table> <br />'; -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'] . '" />'; /*************************************************************** @@ -269,15 +266,15 @@ <th>' . _('Item Description' ) . '</th> <th>' . _('Ordered') . '</th> <th>' . _('Units') . '</th> - <th>' . _('Already') . '<br>' . _('Sent') . '</th> + <th>' . _('Already') . '<br />' . _('Sent') . '</th> <th>' . _('This Dispatch') . '</th> <th>' . _('Price') . '</th> <th>' . _('Discount') . '</th> - <th>' . _('Total') . '<br>' . _('Excl Tax') . '</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> + <th>' . _('Tax') . '<br />' . _('Amount') . '</th> + <th>' . _('Total') . '<br />' . _('Incl Tax') . '</th> </tr>'; $_SESSION['Items']->total = 0; @@ -331,8 +328,8 @@ } } $DisplayDiscountPercent = number_format($LnItm->DiscountPercent*100,2) . '%'; - $DisplayLineNetTotal = number_format($LineTotal,2); - $DisplayPrice = number_format($LnItm->Price,2); + $DisplayLineNetTotal = number_format($LineTotal,$_SESSION['Items']->CurrDecimalPlaces); + $DisplayPrice = number_format($LnItm->Price,$_SESSION['Items']->CurrDecimalPlaces); echo '<td class="number">'.$DisplayPrice.'</td> <td class="number">'.$DisplayDiscountPercent.'</td> <td class="number">'.$DisplayLineNetTotal.'</td>'; @@ -381,15 +378,15 @@ $TaxTotal += $TaxLineTotal; - $DisplayTaxAmount = number_format($TaxLineTotal ,2); + $DisplayTaxAmount = number_format($TaxLineTotal ,$_SESSION['Items']->CurrDecimalPlaces); - $DisplayGrossLineTotal = number_format($LineTotal+ $TaxLineTotal,2); + $DisplayGrossLineTotal = number_format($LineTotal+ $TaxLineTotal,$_SESSION['Items']->CurrDecimalPlaces); echo '<td class="number">'.$DisplayTaxAmount.'</td><td class="number">'.$DisplayGrossLineTotal.'</td>'; if ($LnItm->Controlled==1){ if (!isset($_POST['ProcessInvoice'])) { - echo '<td><a href="' . $rootpath . '/ConfirmDispatchControlled_Invoice.php?' . SID . '&LineNo='. $LnItm->LineNumber.'">'; + echo '<td><a href="' . $rootpath . '/ConfirmDispatchControlled_Invoice.php?LineNo='. $LnItm->LineNumber.'">'; if ($LnItm->Serialised==1){ echo _('Enter Serial Numbers'); } else { /*Just batch/roll/lot control */ @@ -400,7 +397,7 @@ } echo '</tr>'; if (strlen($LnItm->Narrative)>1){ - $narrative=str_replace('\r\n','<br>', $LnItm->Narrative); + $narrative=str_replace('\r\n','<br />', $LnItm->Narrative); echo $RowStarter . '<td colspan=12>' . stripslashes($narrative) . '</td></tr>'; } }//end foreach ($line) @@ -413,12 +410,12 @@ if(!isset($_SESSION['Items']->FreightCost)) { if ($_SESSION['DoFreightCalc']==True){ list ($FreightCost, $BestShipper) = CalcFreightCost($_SESSION['Items']->total, - $_SESSION['Items']->BrAdd2, - $_SESSION['Items']->BrAdd3, - $_SESSION['Items']->totalVolume, - $_SESSION['Items']->totalWeight, - $_SESSION['Items']->Location, - $db); + $_SESSION['Items']->BrAdd2, + $_SESSION['Items']->BrAdd3, + $_SESSION['Items']->totalVolume, + $_SESSION['Items']->totalWeight, + $_SESSION['Items']->Location, + $db); $_SESSION['Items']->ShipVia = $BestShipper; } if (is_numeric($FreightCost)){ @@ -433,7 +430,7 @@ if (DB_num_rows($TestShipperExists)==1){ $BestShipper = $_SESSION['Default_Shipper']; } else { - $SQL = 'SELECT shipper_id FROM shippers'; + $SQL = "SELECT shipper_id FROM shippers"; $ErrMsg = _('There was a problem testing for a default shipper'); $TestShipperExists = DB_query($SQL,$db, $ErrMsg); if (DB_num_rows($TestShipperExists)>=1){ @@ -487,7 +484,7 @@ $i=0; // initialise the number of taxes iterated through foreach ($_SESSION['Items']->FreightTaxes as $FreightTaxLine) { if ($i>0){ - echo '<br>'; + echo '<br />'; } echo $FreightTaxLine->TaxAuthDescription; $i++; @@ -498,14 +495,14 @@ $i=0; foreach ($_SESSION['Items']->FreightTaxes as $FreightTaxLine) { if ($i>0){ - echo '<br>'; + echo '<br />'; } if (isset($_POST['ProcessInvoice'])) { echo $FreightTaxLine->TaxRate * 100 ; } else { echo '<input type="text" class="number" name="FreightTaxRate' . $FreightTaxLine->TaxCalculationOrder . - '" maxlength="4" size="4" VALUE="' . $FreightTaxLine->TaxRate * 100 . '">'; + '" maxlength="4" size="4" value="' . $FreightTaxLine->TaxRate * 100 . '">'; } if ($FreightTaxLine->TaxOnTax ==1){ @@ -520,26 +517,26 @@ } echo '</td>'; -echo '<td class="number">' . number_format($FreightTaxTotal,2) . '</td> - <td class="number">' . number_format($FreightTaxTotal+ $_POST['ChargeFreightCost'],2) . '</td> +echo '<td class="number">' . number_format($FreightTaxTotal,$_SESSION['Items']->CurrDecimalPlaces) . '</td> + <td class="number">' . number_format($FreightTaxTotal+ $_POST['ChargeFreightCost'],$_SESSION['Items']->CurrDecimalPlaces) . '</td> </tr>'; $TaxTotal += $FreightTaxTotal; -$DisplaySubTotal = number_format(($_SESSION['Items']->total + $_POST['ChargeFreightCost']),2); +$DisplaySubTotal = number_format(($_SESSION['Items']->total + $_POST['ChargeFreightCost']),$_SESSION['Items']->CurrDecimalPlaces); /* round the totals to avoid silly entries */ $TaxTotal = round($TaxTotal,2); -$_SESSION['Items']->total = round($_SESSION['Items']->total,2); -$_POST['ChargeFreightCost'] = round($_POST['ChargeFreightCost'],2); +$_SESSION['Items']->total = round($_SESSION['Items']->total,$_SESSION['Items']->CurrDecimalPlaces); +$_POST['ChargeFreightCost'] = round($_POST['ChargeFreightCost'],$_SESSION['Items']->CurrDecimalPlaces); echo '<tr> <td colspan="10" class="number">' . _('Invoice Totals'). '</td> <td class="number:><hr><b>'.$DisplaySubTotal.'</b><hr></td> <td colspan="2"></td> - <td class="number"><hr><b>' . number_format($TaxTotal,2) . '</b><hr></td> - <td class="number"><hr><b>' . number_format($TaxTotal+($_SESSION['Items']->total + $_POST['ChargeFreightCost']),2) . '</b><hr></td> + <td class="number"><hr><b>' . number_format($TaxTotal,$_SESSION['Items']->CurrDecimalPlaces) . '</b><hr></td> + <td class="number"><hr><b>' . number_format($TaxTotal+($_SESSION['Items']->total + $_POST['ChargeFreightCost']),$_SESSION['Items']->CurrDecimalPlaces) . '</b><hr></td> </tr>'; if (! isset($_POST['DispatchDate']) OR ! Is_Date($_POST['DispatchDate'])){ @@ -548,12 +545,10 @@ $DefaultDispatchDate = $_POST['DispatchDate']; } -echo '</table><br>'; +echo '</table><br />'; +if (isset($_POST['ProcessInvoice']) AND $_POST['ProcessInvoice'] != ''){ - -if (isset($_POST['ProcessInvoice']) && $_POST['ProcessInvoice'] != ""){ - /* SQL to process the postings for sales invoices... /*First check there are lines on the dipatch with quantities to invoice @@ -634,10 +629,10 @@ /* Now Get the area where the sale is to from the branches table */ $SQL = "SELECT area, - defaultshipvia - FROM custbranch - WHERE custbranch.debtorno ='". $_SESSION['Items']->DebtorNo . "' - AND custbranch.branchcode = '" . $_SESSION['Items']->Branch . "'"; + defaultshipvia + FROM custbranch + WHERE custbranch.debtorno ='". $_SESSION['Items']->DebtorNo . "' + AND custbranch.branchcode = '" . $_SESSION['Items']->Branch . "'"; $ErrMsg = _('We were unable to load Area where the Sale is to from the BRANCHES table') . '. ' . _('Please remedy this'); $Result = DB_query($SQL,$db, $ErrMsg); @@ -658,13 +653,13 @@ /*Now need to check that the order details are the same as they were when they were read into the Items array. If they've changed then someone else may have invoiced them */ $SQL = "SELECT stkcode, - quantity, - qtyinvoiced, - orderlineno - FROM salesorderdetails - WHERE completed=0 - AND orderno = '" . $_SESSION['ProcessingOrder']."'"; - + quantity, + qtyinvoiced, + orderlineno + FROM salesorderdetails + WHERE completed=0 + AND orderno = '" . $_SESSION['ProcessingOrder']."'"; + $Result = DB_query($SQL,$db); if (DB_num_rows($Result) != count($_SESSION['Items']->LineItems)){ @@ -672,12 +667,12 @@ /*there should be the same number of items returned from this query as there are lines on the invoice - if not then someone has already invoiced or credited some lines */ if ($debug==1){ - echo '<br>'.$SQL; - echo '<br>' . _('Number of rows returned by SQL') . ':' . DB_num_rows($Result); - echo '<br>' . _('Count of items in the session') . ' ' . count($_SESSION['Items']->LineItems); + echo '<br />'.$SQL; + echo '<br />' . _('Number of rows returned by SQL') . ':' . DB_num_rows($Result); + echo '<br />' . _('Count of items in the session') . ' ' . count($_SESSION['Items']->LineItems); } - echo '<br>'; + echo '<br />'; prnMsg( _('This order has been changed or invoiced since this delivery was started to be confirmed') . '. ' . _('Processing halted') . '. ' . _('To enter and confirm this dispatch') . '/' . _('invoice the order must be re-selected and re-read again to update the changes made by the other user'), 'error'); unset($_SESSION['Items']->LineItems); @@ -692,15 +687,15 @@ if ($_SESSION['Items']->LineItems[$myrow['orderlineno']]->Quantity != $myrow['quantity'] OR $_SESSION['Items']->LineItems[$myrow['orderlineno']]->QtyInv != $myrow['qtyinvoiced']) { - echo '<br>'. _('Orig order for'). ' ' . $myrow['orderlineno'] . ' '. _('has a quantity of'). ' ' . + echo '<br />'. _('Orig order for'). ' ' . $myrow['orderlineno'] . ' '. _('has a quantity of'). ' ' . $myrow['quantity'] . ' '. _('and an invoiced qty of'). ' ' . $myrow['qtyinvoiced'] . ' '. _('the session shows quantity of'). ' ' . $_SESSION['Items']->LineItems[$myrow['orderlineno']]->Quantity . ' ' . _('and quantity invoice of'). ' ' . $_SESSION['Items']->LineItems[$myrow['orderlineno']]->QtyInv; prnMsg( _('This order has been changed or invoiced since this delivery was started to be confirmed') . ' ' . _('Processing halted.') . ' ' . _('To enter and confirm this dispatch, it must be re-selected and re-read again to update the changes made by the other user'), 'error'); - echo '<br>'; + echo '<br />'; - echo '<div class="centre"><a href="'. $rootpath . '/SelectSalesOrder.php?' . SID . '">'. _('Select a sales order for confirming deliveries and invoicing'). '</a></div>'; + echo '<div class="centre"><a href="'. $rootpath . '/SelectSalesOrder.php">'. _('Select a sales order for confirming deliveries and invoicing'). '</a></div>'; unset($_SESSION['Items']->LineItems); unset($_SESSION['Items']); @@ -739,8 +734,8 @@ /*Update order header for invoice charged on */ $SQL = "UPDATE salesorders - SET comments = CONCAT(comments,' Inv ','" . $InvoiceNo . "') - WHERE orderno= '" . $_SESSION['ProcessingOrder']."'"; + SET comments = CONCAT(comments,' Inv ','" . $InvoiceNo . "') + WHERE orderno= '" . $_SESSION['ProcessingOrder']."'"; $ErrMsg = _('CRITICAL ERROR') . ' ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The sales order header could not be updated with the invoice number'); $DbgMsg = _('The following SQL to update the sales order was used'); @@ -749,40 +744,40 @@ /*Now insert the DebtorTrans */ $SQL = "INSERT INTO debtortrans ( transno, - type, - debtorno, - branchcode, - trandate, - inputdate, - prd, - reference, - tpe, - order_, - ovamount, - ovgst, - ovfreight, - rate, - invtext, - shipvia, - consignment ) - VALUES ( - '". $InvoiceNo . "', - 10, - '" . $_SESSION['Items']->DebtorNo . "', - '" . $_SESSION['Items']->Branch . "', - '" . $DefaultDispatchDate . "', - '" . date('Y-m-d H-i-s') . "', - '" . $PeriodNo . "', - '', - '" . $_SESSION['Items']->DefaultSalesType . "', - '" . $_SESSION['ProcessingOrder'] . "', - '" . $_SESSION['Items']->total . "', - '" . $TaxTotal . "', - '" . $_POST['ChargeFreightCost'] . "', - '" . $_SESSION['CurrencyRate'] . "', - '" . $_POST['InvoiceText'] . "', - '" . $_SESSION['Items']->ShipVia . "', - '" . $_POST['Consignment'] . "' )"; + type, + debtorno, + branchcode, + trandate, + inputdate, + prd, + reference, + tpe, + order_, + ovamount, + ovgst, + ovfreight, + rate, + invtext, + shipvia, + consignment ) + VALUES ( + '". $InvoiceNo . "', + 10, + '" . $_SESSION['Items']->DebtorNo . "', + '" . $_SESSION['Items']->Branch . "', + '" . $DefaultDispatchDate . "', + '" . date('Y-m-d H-i-s') . "', + '" . $PeriodNo . "', + '', + '" . $_SESSION['Items']->DefaultSalesType . "', + '" . $_SESSION['ProcessingOrder'] . "', + '" . $_SESSION['Items']->total . "', + '" . $TaxTotal . "', + '" . $_POST['ChargeFreightCost'] . "', + '" . $_SESSION['CurrencyRate'] . "', + '" . $_POST['InvoiceText'] . "', + '" . $_SESSION['Items']->ShipVia . "', + '" . $_POST['Consignment'] . "' )"; $ErrMsg =_('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The debtor transaction record could not be inserted because'); $DbgMsg = _('The following SQL to insert the debtor transaction record was used'); @@ -794,11 +789,11 @@ foreach ($TaxTotals AS $TaxAuthID => $TaxAmount) { $SQL = "INSERT INTO debtortranstaxes (debtortransid, - taxauthid, - taxamount) - VALUES ('" . $DebtorTransID . "', - '" . $TaxAuthID . "', - '" . $TaxAmount/$_SESSION['CurrencyRate'] . "')"; + taxauthid, + taxamount) + VALUES ('" . $DebtorTransID . "', + '" . $TaxAuthID . "', + '" . $TaxAmount/$_SESSION['CurrencyRate'] . "')"; $ErrMsg =_('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The debtor transaction taxes records could not be inserted because'); $DbgMsg = _('The following SQL to insert the debtor transaction taxes record was used'); @@ -812,26 +807,25 @@ /*Test to see if the item being sold is an asset */ if (substr($OrderLine->StockID,0,6)=='ASSET-'){ - $IsAsset = true; - $HyphenOccursAt = strpos($OrderLine->StockID,'-',6); - if ($HyphenOccursAt == false){ - $AssetNumber = intval(substr($OrderLine->StockID,6)); - } else { - $AssetNumber = intval(substr($OrderLine->StockID,6,strlen($OrderLine->StockID)-$HyphenOccursAt-1)); - } - prnMsg (_('The asset number beind disposed of is:') . ' ' . $AssetNumber, 'info'); + $IsAsset = true; + $HyphenOccursAt = strpos($OrderLine->StockID,'-',6); + if ($HyphenOccursAt == false){ + $AssetNumber = intval(substr($OrderLine->StockID,6)); } else { - $IsAsset = false; - $AssetNumber = 0; + $AssetNumber = intval(substr($OrderLine->StockID,6,strlen($OrderLine->StockID)-$HyphenOccursAt-1)); } + prnMsg (_('The asset number beind disposed of is:') . ' ' . $AssetNumber, 'info'); + } else { + $IsAsset = false; + $AssetNumber = 0; + } - if ($_POST['BOPolicy']=='CAN'){ $SQL = "UPDATE salesorderdetails - SET quantity = quantity - " . ($OrderLine->Quantity - $OrderLine->QtyDispatched) . " - WHERE orderno = '" . $_SESSION['ProcessingOrder'] . " ' - AND stkcode = '" . $OrderLine->StockID . "'"; + SET quantity = quantity - " . ($OrderLine->Quantity - $OrderLine->QtyDispatched) . " + WHERE orderno = '" . $_SESSION['ProcessingOrder'] . " ' + AND stkcode = '" . $OrderLine->StockID . "'"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The sales order detail record could not be updated because'); $DbgMsg = _('The following SQL to update the sales order detail record was used'); @@ -841,20 +835,20 @@ if (($OrderLine->Quantity - $OrderLine->QtyDispatched)>0){ $SQL = "INSERT INTO orderdeliverydifferenceslog ( orderno, - invoiceno, - stockid, - quantitydiff, - debtorno, - branch, - can_or_bo ) - VALUES ( - '" . $_SESSION['ProcessingOrder'] . "', - '" . $InvoiceNo . "', - '" . $OrderLine->StockID . "', - '" . ($OrderLine->Quantity - $OrderLine->QtyDispatched) . "', - '" . $_SESSION['Items']->DebtorNo . "', - '" . $_SESSION['Items']->Branch . "', - 'CAN')"; + invoiceno, + stockid, + quantitydiff, + debtorno, + branch, + can_or_bo ) + VALUES ( + '" . $_SESSION['ProcessingOrder'] . "', + '" . $InvoiceNo . "', + '" . $OrderLine->StockID . "', + '" . ($OrderLine->Quantity - $OrderLine->QtyDispatched) . "', + '" . $_SESSION['Items']->DebtorNo . "', + '" . $_SESSION['Items']->Branch . "', + 'CAN')"; $ErrMsg =_('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The order delivery differences log record could not be inserted because'); $DbgMsg = _('The following SQL to insert the order delivery differences record was used'); @@ -868,44 +862,46 @@ /*The order is being short delivered after the due date - need to insert a delivery differnce log */ $SQL = "INSERT INTO orderdeliverydifferenceslog ( orderno, - invoiceno, - stockid, - quantitydiff, - debtorno, - branch, - can_or_bo - ) - VALUES ( - '" . $_SESSION['ProcessingOrder'] . "', - '" . $InvoiceNo . "', - '" . $OrderLine->StockID . "', - '" . ($OrderLine->Quantity - $OrderLine->QtyDispatched) . "', - '" . $_SESSION['Items']->DebtorNo . "', - '" . $_SESSION['Items']->Branch . "', - 'BO' - )"; + invoiceno, + stockid, + quantitydiff, + debtorno, + branch, + can_or_bo + ) + VALUES ( + '" . $_SESSION['ProcessingOrder'] . "', + '" . $InvoiceNo . "', + '" . $OrderLine->StockID . "', + '" . ($OrderLine->Quantity - $OrderLine->QtyDispatched) . "', + '" . $_SESSION['Items']->DebtorNo . "', + '" . $_SESSION['Items']->Branch . "', + 'BO' + )"; - $ErrMsg = '<br>' . _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The order delivery differences log record could not be inserted because'); + $ErrMsg = '<br />' . _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The order delivery differences log record could not be inserted because'); $DbgMsg = _('The following SQL to insert the order delivery differences record was used'); $Result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); } /*end of order delivery differences log entries */ /*Now update SalesOrderDetails for the quantity invoiced and the actual dispatch dates. */ - if ($OrderLine->QtyDispatched !=0 AND $OrderLine->QtyDispatched!="" AND $OrderLine->QtyDispatched) { + if ($OrderLine->QtyDispatched !=0 AND $OrderLine->QtyDispatched!='' AND $OrderLine->QtyDispatched) { // Test above to see if the line is completed or not - if ($OrderLine->QtyDispatched>=($OrderLine->Quantity - $OrderLine->QtyInv) OR $_POST['BOPolicy']=="CAN"){ - $SQL = "UPDATE salesorderdetails SET qtyinvoiced = qtyinvoiced + " . $OrderLine->QtyDispatched . ", - actualdispatchdate = '" . $DefaultDispatchDate . "', - completed=1 - WHERE orderno = '" . $_SESSION['ProcessingOrder'] . "' - AND orderlineno = '" . $OrderLine->LineNumber . "'"; + if ($OrderLine->QtyDispatched>=($OrderLine->Quantity - $OrderLine->QtyInv) OR $_POST['BOPolicy']=='CAN'){ + $SQL = "UPDATE salesorderdetails + SET qtyinvoiced = qtyinvoiced + " . $OrderLine->QtyDispatched . ", + actualdispatchdate = '" . $DefaultDispatchDate . "', + completed=1 + WHERE orderno = '" . $_SESSION['ProcessingOrder'] . "' + AND orderlineno = '" . $OrderLine->LineNumber . "'"; } else { - $SQL = "UPDATE salesorderdetails SET qtyinvoiced = qtyinvoiced + " . $OrderLine->QtyDispatched . ", - actualdispatchdate = '" . $DefaultDispatchDate . "' - WHERE orderno = '" . $_SESSION['ProcessingOrder'] . "' - AND orderlineno = '" . $OrderLine->LineNumber . "'"; + $SQL = "UPDATE salesorderdetails + SET qtyinvoiced = qtyinvoiced + " . $OrderLine->QtyDispatched . ", + actualdispatchdate = '" . $DefaultDispatchDate . "' + WHERE orderno = '" . $_SESSION['ProcessingOrder'] . "' + AND orderlineno = '" . $OrderLine->LineNumber . "'"; } @@ -916,8 +912,8 @@ /* Update location stock records if not a dummy stock item need the MBFlag later too so save it to $MBFlag */ $Result = DB_query("SELECT mbflag - FROM stockmaster - WHERE stockid = '" . $OrderLine->StockID . "'",$db, _('Cannot retrieve the mbflag')); + FROM stockmaster + WHERE stockid = '" . $OrderLine->StockID . "'",$db, _('Cannot retrieve the mbflag')); $myrow = DB_fetch_row($Result); $MBFlag = $myrow[0]; @@ -928,9 +924,9 @@ /* Need to get the current location quantity will need it later for the stock movement */ $SQL="SELECT locstock.quantity - FROM locstock - WHERE locstock.stockid='" . $OrderLine->StockID . "' - AND loccode= '" . $_SESSION['Items']->Location . "'"; + FROM locstock + WHERE locstock.stockid='" . $OrderLine->StockID . "' + AND loccode= '" . $_SESSION['Items']->Location . "'"; $ErrMsg = _('WARNING') . ': ' . _('Could not retrieve current location stock'); $Result = DB_query($SQL, $db, $ErrMsg); @@ -943,9 +939,9 @@ } $SQL = "UPDATE locstock SET quantity = locstock.quantity - " . $OrderLine->QtyDispatched . " - WHERE locstock.stockid = '" . $OrderLine->StockID . "' - AND loccode = '" . $_SESSION['Items']->Location . "'"; - + WHERE locstock.stockid = '" . $OrderLine->StockID . "' + AND loccode = '" . $_SESSION['Items']->Location . "'"; + $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('Location stock record could not be updated because'); $DbgMsg = _('The following SQL to update the location stock record was used'); $Result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); @@ -956,15 +952,15 @@ $Assembly=True; $StandardCost =0; /*To start with - accumulate the cost of the comoponents for use in journals later on */ $SQL = "SELECT bom.component, - bom.quantity, - stockmaster.materialcost+stockmaster.labourcost+stockmaster.overheadcost AS standard - FROM bom, - stockmaster - WHERE bom.component=stockmaster.stockid - AND bom.parent='" . $OrderLine->StockID . "' - AND bom.effectiveto > '" . Date("Y-m-d") . "' - AND bom.effectiveafter < '" . Date("Y-m-d") . "'"; - + bom.quantity, + stockmaster.materialcost+stockmaster.labourcost+stockmaster.overheadcost AS standard + FROM bom, + stockmaster + WHERE bom.component=stockmaster.stockid + AND bom.parent='" . $OrderLine->StockID . "' + AND bom.effectiveto >= '" . Date('Y-m-d') . "' + AND bom.effectiveafter < '" . Date('Y-m-d') . "'"; + $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('Could not retrieve assembly components from the database for'). ' '. $OrderLine->StockID . _('because').' '; $DbgMsg = _('The SQL that failed was'); $AssResult = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); @@ -975,9 +971,9 @@ /* Need to get the current location quantity will need it later for the stock movement */ $SQL="SELECT locstock.quantity - FROM locstock - WHERE locstock.stockid='" . $AssParts['component'] . "' - AND loccode= '" . $_SESSION['Items']->Location . "'"; + FROM locstock + WHERE locstock.stockid='" . $AssParts['component'] . "' + AND loccode= '" . $_SESSION['Items']->Location . "'"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('Can not retrieve assembly components location stock quantities because '); $DbgMsg = _('The SQL that failed was'); @@ -992,35 +988,32 @@ if (empty($AssParts['standard'])) { $AssParts['standard']=0; } - $SQL = "INSERT INTO stockmoves ( - stockid, - type, - transno, - loccode, - trandate, - debtorno, - branchcode, - prd, - reference, - qty, - standardcost, - show_on_inv_crds, - newqoh - ) VALUES ( - '" . $AssParts['component'] . "', - 10, - '" . $InvoiceNo . "', - '" . $_SESSION['Items']->Location . "', - '" . $DefaultDispatchDate . "', - '" . $_SESSION['Items']->DebtorNo . "', - '" . $_SESSION['Items']->Branch . "', - '" . $PeriodNo . "', - '" . _('Assembly') . ': ' . $OrderLine->StockID . ' ' . _('Order') . ': ' . $_SESSION['ProcessingOrder'] . "', - '" . -$AssParts['quantity'] * $OrderLine->QtyDispatched . "', - '" . $AssParts['standard'] . "', - 0, - '" . ($QtyOnHandPrior - $AssParts['quantity'] * $OrderLine->QtyDispatched) . "' - )"; + $SQL = "INSERT INTO stockmoves ( stockid, + type, + transno, + loccode, + trandate, + debtorno, + branchcode, + prd, + reference, + qty, + standardcost, + show_on_inv_crds, + newqoh) + VALUES ('" . $AssParts['component'] . "', + 10, + '" . $InvoiceNo . "', + '" . $_SESSION['Items']->Location . "', + '" . $DefaultDispatchDate . "', + '" . $_SESSION['Items']->DebtorNo . "', + '" . $_SESSION['Items']->Branch . "', + '" . $PeriodNo . "', + '" . _('Assembly') . ': ' . $OrderLine->StockID . ' ' . _('Order') . ': ' . $_SESSION['ProcessingOrder'] . "', + '" . -$AssParts['quantity'] * $OrderLine->QtyDispatched . "', + '" . $AssParts['standard'] . "', + 0, + '" . ($QtyOnHandPrior - $AssParts['quantity'] * $OrderLine->QtyDispatched) . "' )"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('Stock movement records for the assembly components of'). ' '. $OrderLine->StockID . ' ' . _('could not be inserted because'); $DbgMsg = _('The following SQL to insert the assembly components stock movement records was used'); @@ -1028,9 +1021,9 @@ $SQL = "UPDATE locstock - SET quantity = locstock.quantity - " . $AssParts['quantity'] * $OrderLine->QtyDispatched . " - WHERE locstock.stockid = '" . $AssParts['component'] . "' - AND loccode = '" . $_SESSION['Items']->Location . "'"; + SET quantity = locstock.quantity - " . $AssParts['quantity'] * $OrderLine->QtyDispatched . " + WHERE locstock.stockid = '" . $AssParts['component'] . "' + AND loccode = '" . $_SESSION['Items']->Location . "'"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('Location stock record could not be updated for an assembly component because'); $DbgMsg = _('The following SQL to update the locations stock record for the component was used'); @@ -1050,68 +1043,68 @@ } if ($MBFlag=='B' OR $MBFlag=='M'){ $SQL = "INSERT INTO stockmoves ( stockid, - type, - transno, - loccode, - trandate, - debtorno, - branchcode, - price, - prd, - reference, - qty, - discountpercent, - standardcost, - newqoh, - narrative ) - VALUES ('" . $OrderLine->StockID . "', - 10, - '" . $InvoiceNo . "', - '" . $_SESSION['Items']->Location . "', - '" . $DefaultDispatchDate . "', - '" . $_SESSION['Items']->DebtorNo . "', - '" . $_SESSION['Items']->Branch . "', - '" . $LocalCurrencyPrice . "', - '" . $PeriodNo . "', - '" . $_SESSION['ProcessingOrder'] . "', - '" . -$OrderLine->QtyDispatched . "', - '" . $OrderLine->DiscountPercent . "', - '" . $OrderLine->StandardCost . "', - '" . ($QtyOnHandPrior - $OrderLine->QtyDispatched) . "', - '" . DB_escape_string($OrderLine->Narrative) . "' )"; + type, + transno, + loccode, + trandate, + debtorno, + branchcode, + price, + prd, + reference, + qty, + discountpercent, + standardcost, + newqoh, + narrative ) + VALUES ('" . $OrderLine->StockID . "', + 10, + '" . $InvoiceNo . "', + '" . $_SESSION['Items']->Location . "', + '" . $DefaultDispatchDate . "', + '" . $_SESSION['Items']->DebtorNo . "', + '" . $_SESSION['Items']->Branch . "', + '" . $LocalCurrencyPrice . "', + '" . $PeriodNo . "', + '" . $_SESSION['ProcessingOrder'] . "', + '" . -$OrderLine->QtyDispatched . "', + '" . $OrderLine->DiscountPercent . "', + '" . $OrderLine->StandardCost . "', + '" . ($QtyOnHandPrior - $OrderLine->QtyDispatched) . "', + '" . DB_escape_string($OrderLine->Narrative) . "' )"; } else { // its an assembly or dummy and assemblies/dummies always have nil stock (by definition they are made up at the time of dispatch so new qty on hand will be nil if (empty($OrderLine->StandardCost)) { $OrderLine->StandardCost=0; } $SQL = "INSERT INTO stockmoves ( stockid, - type, - transno, - loccode, - trandate, - debtorno, - branchcode, - price, - prd, - reference, - qty, - discountpercent, - standardcost, - narrative ) - VALUES ('" . $OrderLine->StockID . "', - 10, - '" . $InvoiceNo . "', - '" . $_SESSION['Items']->Location . "', - '" . $DefaultDispatchDate . "', - '" . $_SESSION['Items']->DebtorNo . "', - '" . $_SESSION['Items']->Branch . "', - '" . $LocalCurrencyPrice . "', - '" . $PeriodNo . "', - '" . $_SESSION['ProcessingOrder'] . "', - '" . -$OrderLine->QtyDispatched . "', - '" . $OrderLine->DiscountPercent . "', - '" . $OrderLine->StandardCost . "', - '" . DB_escape_string($OrderLine->Narrative) . "')"; + type, + transno, + loccode, + trandate, + debtorno, + branchcode, + price, + prd, + reference, + qty, + discountpercent, + standardcost, + narrative ) + VALUES ('" . $OrderLine->StockID . "', + 10, + '" . $InvoiceNo . "', + '" . $_SESSION['Items']->Location . "', + '" . $DefaultDispatchDate . "', + '" . $_SESSION['Items']->DebtorNo . "', + '" . $_SESSION['Items']->Branch . "', + '" . $LocalCurrencyPrice . "', + '" . $PeriodNo . "', + '" . $_SESSION['ProcessingOrder'] . "', + '" . -$OrderLine->QtyDispatched . "', + '" . $OrderLine->DiscountPercent . "', + '" . $OrderLine->StandardCost . "', + '" . DB_escape_string($OrderLine->Narrative) . "')"; } @@ -1126,15 +1119,15 @@ foreach ($OrderLine->Taxes as $Tax) { $SQL = "INSERT INTO stockmovestaxes (stkmoveno, - taxauthid, - taxrate, - taxcalculationorder, - taxontax) - VALUES ('" . $StkMoveNo . "', - '" . $Tax->TaxAuthID . "', - '" . $Tax->TaxRate . "', - '" . $Tax->TaxCalculationOrder . "', - '" . $Tax->TaxOnTax . "')"; + taxauthid, + taxrate, + taxcalculationorder, + taxontax) + VALUES ('" . $StkMoveNo . "', + '" . $Tax->TaxAuthID . "', + '" . $Tax->TaxRate . "', + '" . $Tax->TaxCalculationOrder . "', + '" . $Tax->TaxOnTax . "')"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('Taxes and rates applicable to this invoice line item could not be inserted because'); $DbgMsg = _('The following SQL to insert the stock movement tax detail records was used'); @@ -1150,9 +1143,9 @@ The StockSerialMoves as well */ $SQL = "UPDATE stockserialitems SET quantity= quantity - " . $Item->BundleQty . " - WHERE stockid='" . $OrderLine->StockID . "' - AND loccode='" . $_SESSION['Items']->Location . "' - AND serialno='" . $Item->BundleRef . "'"; + WHERE stockid='" . $OrderLine->StockID . "' + AND loccode='" . $_SESSION['Items']->Location . "' + AND serialno='" . $Item->BundleRef . "'"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The serial stock item record could not be updated because'); $DbgMsg = _('The following SQL to update the serial stock item record was used'); @@ -1161,13 +1154,13 @@ /* now insert the serial stock movement */ $SQL = "INSERT INTO stockserialmoves (stockmoveno, - stockid, - serialno, - moveqty) - VALUES ('" . $StkMoveNo . "', - '" . $OrderLine->StockID . "', - '" . $Item->BundleRef . "', - '" . -$Item->BundleQty . "')"; + stockid, + serialno, + moveqty) + VALUES ('" . $StkMoveNo . "', + '" . $OrderLine->StockID . "', + '" . $Item->BundleRef . "', + '" . -$Item->BundleQty . "')"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The serial stock movement record could not be inserted because'); $DbgMsg = _('The following SQL to insert the serial stock movement records was used'); @@ -1178,14 +1171,14 @@ /*Insert Sales Analysis records */ $SQL="SELECT COUNT(*), - salesanalysis.stockid, - salesanalysis.stkcategory, - salesanalysis.cust, - salesanalysis.custbranch, - salesanalysis.area, - salesanalysis.periodno, - salesanalysis.typeabbrev, - salesanalysis.salesperson + salesanalysis.stockid, + salesanalysis.stkcategory, + salesanalysis.cust, + salesanalysis.custbranch, + salesanalysis.area, + salesanalysis.periodno, + salesanalysis.typeabbrev, + salesanalysis.salesperson FROM salesanalysis, custbranch, stockmaster @@ -1211,7 +1204,7 @@ salesanalysis.salesperson"; $ErrMsg = _('The count of existing Sales analysis records could not run because'); - $DbgMsg = '<br>'. _('SQL to count the no of sales analysis records'); + $DbgMsg = '<br />'. _('SQL to count the no of sales analysis records'); $Result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); $myrow = DB_fetch_row($Result); @@ -1219,9 +1212,9 @@ if ($myrow[0]>0){ /*Update the existing record that already exists */ $SQL = "UPDATE salesanalysis SET amt=amt+" . ($OrderLine->Price * $OrderLine->QtyDispatched / $_SESSION['CurrencyRate']) . ", - cost=cost+" . ($OrderLine->StandardCost * $OrderLine->QtyDispatched) . ", - qty=qty +" . $OrderLine->QtyDispatched . ", - disc=disc+" . ($OrderLine->DiscountPercent * $OrderLine->Price * $OrderLine->QtyDispatched / $_SESSION['CurrencyRate']) . " + cost=cost+" . ($OrderLine->StandardCost * $OrderLine->QtyDispatched) . ", + qty=qty +" . $OrderLine->QtyDispatched . ", + disc=disc+" . ($OrderLine->DiscountPercent * $OrderLine->Price * $OrderLine->QtyDispatched / $_SESSION['CurrencyRate']) . " WHERE salesanalysis.area='" . $myrow[5] . "' AND salesanalysis.salesperson='" . $myrow[8] . "' AND typeabbrev ='" . $_SESSION['Items']->DefaultSalesType . "' @@ -1235,31 +1228,31 @@ } else { /* insert a new sales analysis record */ $SQL = "INSERT INTO salesanalysis (typeabbrev, - periodno, - amt, - cost, - cust, - custbranch, - qty, - disc, - stockid, - area, - budgetoractual, - salesperson, - stkcategory ) + periodno, + amt, + cost, + cust, + custbranch, + qty, + disc, + stockid, + area, + budgetoractual, + salesperson, + stkcategory ) SELECT '" . $_SESSION['Items']->DefaultSalesType . "', - '" . $PeriodNo . "', - '" . ($OrderLine->Price * $OrderLine->QtyDispatched / $_SESSION['CurrencyRate']) . "', - '" . ($OrderLine->StandardCost * $OrderLine->QtyDispatched) . "', - '" . $_SESSION['Items']->DebtorNo . "', - '" . $_SESSION['Items']->Branch . "', - '" . $OrderLine->QtyDispatched . "', - '" . ($OrderLine->DiscountPercent * $OrderLine->Price * $OrderLine->QtyDispatched / $_SESSION['CurrencyRate']) . "', - '" . $OrderLine->StockID . "', - custbranch.area, - 1, - custbranch.salesman, - stockmaster.categoryid + '" . $PeriodNo . "', + '" . ($OrderLine->Price * $OrderLine->QtyDispatched / $_SESSION['CurrencyRate']) . "', + '" . ($OrderLine->StandardCost * $OrderLine->QtyDispatched) . "', + '" . $_SESSION['Items']->DebtorNo . "', + '" . $_SESSION['Items']->Branch . "', + '" . $OrderLine->QtyDispatched . "', + '" . ($OrderLine->DiscountPercent * $OrderLine->Price * $OrderLine->QtyDispatched / $_SESSION['CurrencyRate']) . "', + '" . $OrderLine->StockID . "', + custbranch.area, + 1, + custbranch.salesman, + stockmaster.categoryid FROM stockmaster, custbranch WHERE stockmaster.stockid = '" . $OrderLine->StockID . "' @@ -1278,20 +1271,20 @@ /*first the cost of sales entry - GL accounts are retrieved using the function GetCOGSGLAccount from includes/GetSalesTransGLCodes.inc */ $SQL = "INSERT INTO gltrans ( type, - typeno, - trandate, - periodno, - account, - narrative, - amount) - VALUES ( - 10, - '" . $InvoiceNo . "', - '" . $DefaultDispatchDate . "', - '" . $PeriodNo . "', - '" . GetCOGSGLAccount($Area, $OrderLine->StockID, $_SESSION['Items']->DefaultSalesType, $db) . "', - '" . $_SESSION['Items']->DebtorNo . " - " . $OrderLine->StockID . " x " . $OrderLine->QtyDispatched . " @ " . $OrderLine->StandardCost . "', - ... [truncated message content] |
From: <dai...@us...> - 2011-05-03 10:05:13
|
Revision: 4561 http://web-erp.svn.sourceforge.net/web-erp/?rev=4561&view=rev Author: daintree Date: 2011-05-03 10:05:05 +0000 (Tue, 03 May 2011) Log Message: ----------- quoting and locations fix Modified Paths: -------------- trunk/Credit_Invoice.php trunk/Currencies.php trunk/Locations.php Added Paths: ----------- trunk/doc/Change.log Removed Paths: ------------- trunk/doc/Change.log.html Modified: trunk/Credit_Invoice.php =================================================================== --- trunk/Credit_Invoice.php 2011-05-02 10:33:55 UTC (rev 4560) +++ trunk/Credit_Invoice.php 2011-05-03 10:05:05 UTC (rev 4561) @@ -47,7 +47,8 @@ custbranch.defaultlocation, custbranch.taxgroupid, stockmoves.loccode, - locations.taxprovinceid + locations.taxprovinceid, + currencies.decimalplaces FROM debtortrans INNER JOIN debtorsmaster ON debtortrans.debtorno = debtorsmaster.debtorno INNER JOIN custbranch ON @@ -59,6 +60,8 @@ stockmoves.transno=debtortrans.transno INNER JOIN locations ON stockmoves.loccode = locations.loccode + INNER JOIN currencies ON + debtorsmaster.currcode=currencies.currabrev WHERE debtortrans.transno = '" . $_GET['InvoiceNumber'] . "' AND debtortrans.type=10 AND stockmoves.type=10"; @@ -89,12 +92,12 @@ $_SESSION['CreditItems']->FreightCost = $myrow['ovfreight']; $_SESSION['CreditItems']->DispatchTaxProvince = $myrow['taxprovinceid']; $_SESSION['CreditItems']->GetFreightTaxes(); + $_SESSION['CreditItems']->CurrDecimalPlaces = $myrow['decimalplaces']; DB_free_result($GetInvHdrResult); /*now populate the line items array with the stock movement records for the invoice*/ - $LineItemsSQL = "SELECT stockmoves.stkmoveno, stockmoves.stockid, stockmaster.description, @@ -187,7 +190,7 @@ } //end of checks on returned data set DB_free_result($LineItemsResult); } else { - prnMsg( _('This invoice can not be credited using the automatic facility') . '<br>' . _('CRITICAL ERROR') . ': ' . _('Please report that a duplicate DebtorTrans header record was found for invoice') . ' ' . $SESSION['ProcessingCredit'],'warn'); + prnMsg( _('This invoice can not be credited using the automatic facility') . '<br />' . _('CRITICAL ERROR') . ': ' . _('Please report that a duplicate DebtorTrans header record was found for invoice') . ' ' . $SESSION['ProcessingCredit'],'warn'); include('includes/footer.inc'); exit; } //valid invoice record returned from the entered invoice number @@ -314,20 +317,20 @@ if ($LnItm->Controlled==1){ - echo "<td><input type=hidden name='Quantity_" . $LnItm->LineNumber ."' value=" . $LnItm->QtyDispatched . "><a href='$rootpath/CreditItemsControlled.php?" . SID . "&LineNo=" . $LnItm->LineNumber . "&CreditInvoice=Yes'>" . $LnItm->QtyDispatched . "</a></td>"; + echo '<td><input type=hidden name="Quantity_' . $LnItm->LineNumber .'" value=' . $LnItm->QtyDispatched . '><a href="' . $rootpath . '/CreditItemsControlled.php?LineNo=' . $LnItm->LineNumber . '&CreditInvoice=Yes">' . $LnItm->QtyDispatched . '</a></td>'; } else { - echo "<td><input tabindex=".$j." type=text class=number name='Quantity_" . $LnItm->LineNumber ."' maxlength=6 size=6 value=" . $LnItm->QtyDispatched . "></td>"; + echo '<td><input tabindex=' . $j . ' type="text" class="number" name="Quantity_' . $LnItm->LineNumber .'" maxlength=6 size=6 value=' . $LnItm->QtyDispatched . '></td>'; } - $DisplayLineTotal = number_format($LineTotal,2); + $DisplayLineTotal = number_format($LineTotal,$_SESSION['CreditItems']->CurrDecimalPlaces); $j++; - echo "<td><input tabindex=".$j." type=text class=number name='Price_" . $LnItm->LineNumber . "' maxlength=12 size=6 VALUE=" . $LnItm->Price . "></td> - <td><input tabindex=".$j." type=text class=number name='Discount_" . $LnItm->LineNumber . "' maxlength=3 size=3 VALUE=" . ($LnItm->DiscountPercent * 100) . "></td> - <td class=number>$DisplayLineTotal</td>"; + echo '<td><input tabindex=' . $j . ' type=text class=number name="Price_' . $LnItm->LineNumber . '" maxlength=12 size=6 value=' . $LnItm->Price . '></td> + <td><input tabindex=' . $j . ' type=text class="number" name="Discount_' . $LnItm->LineNumber . '" maxlength=3 size=3 value=' . ($LnItm->DiscountPercent * 100) . '></td> + <td class=number>' . $DisplayLineTotal . '</td>'; /*Need to list the taxes applicable to this line */ echo '<td>'; @@ -335,14 +338,14 @@ if (is_array($_SESSION['CreditItems']->LineItems[$LnItm->LineNumber]->Taxes) ){ foreach ($_SESSION['CreditItems']->LineItems[$LnItm->LineNumber]->Taxes AS $Tax) { if ($i>0){ - echo '<br>'; + echo '<br />'; } echo $Tax->TaxAuthDescription; $i++; } } echo '</td>'; - echo '<td class=number>'; + echo '<td class="number">'; } $i=0; // initialise the number of taxes iterated through @@ -353,10 +356,10 @@ } foreach ($LnItm->Taxes as $Tax) { if ($i>0){ - echo '<br>'; + echo '<br />'; } if (!isset($_POST['ProcessCredit'])) { - echo '<input type=text class=number name="' . $LnItm->LineNumber . $Tax->TaxCalculationOrder . + echo '<input type=text class="number" name="' . $LnItm->LineNumber . $Tax->TaxCalculationOrder . '_TaxRate" maxlength=4 size=4 value="' . $Tax->TaxRate*100 . '">'; } $i++; @@ -372,17 +375,17 @@ } $TaxTotal += $TaxLineTotal; - $DisplayTaxAmount = number_format($TaxLineTotal ,2); - $DisplayGrossLineTotal = number_format($LineTotal+ $TaxLineTotal,2); + $DisplayTaxAmount = number_format($TaxLineTotal ,$_SESSION['CreditItems']->CurrDecimalPlaces); + $DisplayGrossLineTotal = number_format($LineTotal+ $TaxLineTotal,$_SESSION['CreditItems']->CurrDecimalPlaces); if (!isset($_POST['ProcessCredit'])) { echo '</td>'; echo '<td class=number>' . $DisplayTaxAmount . '</td> - <td class=number>' . $DisplayGrossLineTotal . "</td> - <td><a href='". $_SERVER['PHP_SELF'] . "?" . SID . "&Delete=" . $LnItm->LineNumber . "'>" . _('Delete') . '</a></td></tr>'; + <td class=number>' . $DisplayGrossLineTotal . '</td> + <td><a href="' . $_SERVER['PHP_SELF'] . '?Delete=' . $LnItm->LineNumber . '">' . _('Delete') . '</a></td></tr>'; - echo '<tr'.$RowStarter . "><td colspan=12><TEXTAREA tabindex=".$j." name='Narrative_" . $LnItm->LineNumber . "' cols=100% rows=1>" . $LnItm->Narrative . "</TEXTAREa><br><hr></td></tr>"; + echo '<tr' . $RowStarter . '><td colspan=12><textarea tabindex=' . $j .' name="Narrative_' . $LnItm->LineNumber . '" cols=100% rows=1>' . $LnItm->Narrative . '</textarea><br /><hr></td></tr>'; $j++; } } /*end foreach loop displaying the invoice lines to credit */ @@ -405,7 +408,7 @@ $i=0; // initialise the number of taxes iterated through foreach ($_SESSION['CreditItems']->FreightTaxes as $FreightTaxLine) { if ($i>0){ - echo '<br>'; + echo '<br />'; } echo $FreightTaxLine->TaxAuthDescription; $i++; @@ -416,7 +419,7 @@ $i=0; foreach ($_SESSION['CreditItems']->FreightTaxes as $FreightTaxLine) { if ($i>0){ - echo '<br>'; + echo '<br />'; } if (!isset($_POST['ProcessCredit'])) { @@ -435,13 +438,13 @@ if (!isset($_POST['ProcessCredit'])) { echo '</td>'; - echo '<td class="number">' . number_format($FreightTaxTotal,2) . '</td> - <td class="number">' . number_format($FreightTaxTotal+ $_SESSION['CreditItems']->FreightCost,2) . '</td> + echo '<td class="number">' . number_format($FreightTaxTotal,$_SESSION['CreditItems']->CurrDecimalPlaces) . '</td> + <td class="number">' . number_format($FreightTaxTotal+ $_SESSION['CreditItems']->FreightCost,$_SESSION['CreditItems']->CurrDecimalPlaces) . '</td> </tr>'; } $TaxTotal += $FreightTaxTotal; -$DisplayTotal = number_format($_SESSION['CreditItems']->total + $_SESSION['CreditItems']->FreightCost,2); +$DisplayTotal = number_format($_SESSION['CreditItems']->total + $_SESSION['CreditItems']->FreightCost,$_SESSION['CreditItems']->CurrDecimalPlaces); if (!isset($_POST['ProcessCredit'])) { echo '<tr> @@ -449,7 +452,7 @@ <td class=number><hr><b>' . $DisplayTotal . '</b><hr></td> <td colspan=2></td> <td class=number><hr><b>' . number_format($TaxTotal,2) . '<hr></td> - <td class=number><hr><b>' . number_format($TaxTotal+($_SESSION['CreditItems']->total + $_SESSION['CreditItems']->FreightCost),2) . '</b><hr></td> + <td class=number><hr><b>' . number_format($TaxTotal+($_SESSION['CreditItems']->total + $_SESSION['CreditItems']->FreightCost),$_SESSION['CreditItems']->CurrDecimalPlaces) . '</b><hr></td> </tr></table>'; } $DefaultDispatchDate = Date($_SESSION['DefaultDateFormat']); @@ -504,7 +507,6 @@ $Result = DB_query($SQL,$db); $myrow = DB_fetch_row($Result); - /*Do some rounding */ $_SESSION['CreditItems']->total = round($_SESSION['CreditItems']->total,2); @@ -1442,9 +1444,9 @@ echo '<div class="centre">'._('Credit Note number') . ' ' . $CreditNo . ' ' . _('has been processed'); if ($_SESSION['InvoicePortraitFormat']==0){ - echo "<br /><a href='". $rootpath . "/PrintCustTrans.php?" . SID . "&FromTransNo=" . $CreditNo . "&InvOrCredit=Credit&PrintPDF=True'>" . _('Print this credit note') . '</a>'; + echo '<br /><a href="' . $rootpath . '/PrintCustTrans.php?FromTransNo=' . $CreditNo . '&InvOrCredit=Credit&PrintPDF=True">' . _('Print this credit note') . '</a>'; } else { - echo "<br /><a href='". $rootpath . "/PrintCustTransPortrait.php?" . SID . "&FromTransNo=" . $CreditNo . "&InvOrCredit=Credit&PrintPDF=True'>" . _('Print this credit note') . '</a>'; + echo '<br /><a href="' . $rootpath . '/PrintCustTransPortrait.php?FromTransNo=' . $CreditNo . '&InvOrCredit=Credit&PrintPDF=True">' . _('Print this credit note') . '</a>'; } echo '</div>'; /*end of process credit note */ @@ -1452,21 +1454,22 @@ } else { /*Process Credit NOT set so allow inputs to set up the credit note */ - echo "<br><table class=selection>"; + echo '<br /><table class=selection>'; - echo '<tr><td>' . _('Credit Note Type') . "</td><td><select tabindex=".$j." name=CreditType>"; + echo '<tr><td>' . _('Credit Note Type') . '</td> + <td><select tabindex=' . $j .' name="CreditType">'; - if (!isset($_POST['CreditType']) OR $_POST['CreditType']=="Return"){ + if (!isset($_POST['CreditType']) OR $_POST['CreditType']=='Return'){ echo '<option selected value="Return">' . _('Goods returned to store') . '</option>'; - echo '<option VALUE="WriteOff">' . _('Goods written off') . '</option>'; - echo '<option VALUE="ReverseOverCharge">' . _('Reverse overcharge') . '</option>'; + echo '<option value="WriteOff">' . _('Goods written off') . '</option>'; + echo '<option value="ReverseOverCharge">' . _('Reverse overcharge') . '</option>'; } elseif($_POST['CreditType']=='WriteOff') { echo '<option selected value="WriteOff">' . _('Goods written off') . '</option>'; - echo '<option VALUE="Return">' . _('Goods returned to store') . '</option>'; - echo '<option VALUE="ReverseOverCharge">' . _('Reverse overcharge') . '</option>'; + echo '<option value="Return">' . _('Goods returned to store') . '</option>'; + echo '<option value="ReverseOverCharge">' . _('Reverse overcharge') . '</option>'; } else { - echo '<option VALUE="WriteOff">' . _('Goods written off') . '</option>'; - echo '<option VALUE="Return">' . _('Goods returned to store') . '</option>'; + echo '<option value="WriteOff">' . _('Goods written off') . '</option>'; + echo '<option value="Return">' . _('Goods returned to store') . '</option>'; echo '<option selected value="ReverseOverCharge">' . _('Reverse overcharge') . '</option>'; } echo '</select></td></tr>'; @@ -1478,7 +1481,7 @@ echo '<tr><td>' . _('Goods returned to location') . '</td><td><select tabindex='.$j.' name=Location>'; - $SQL='SELECT loccode, locationname FROM locations'; + $SQL="SELECT loccode, locationname FROM locations"; $Result = DB_query($SQL,$db); if (!isset($_POST['Location'])){ @@ -1487,24 +1490,24 @@ while ($myrow = DB_fetch_array($Result)) { if ($_POST['Location']==$myrow['loccode']){ - echo "<option selected VALUE='" . $myrow['loccode'] . "'>" . $myrow['locationname']; + echo '<option selected value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } else { - echo "<option VALUE='" . $myrow['loccode'] . "'>" . $myrow['locationname']; + echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } } - echo "</select></td></tr>"; + echo '</select></td></tr>'; $j++; } elseif($_POST['CreditType']=='WriteOff') { /* the goods are to be written off to somewhere */ - echo '<tr><td>' . _('Write off the cost of the goods to') . '</td><td><select TABINDEX='.$j.' name="WriteOffGLCode">'; + echo '<tr><td>' . _('Write off the cost of the goods to') . '</td><td><select tabindex=' . $j .' name="WriteOffGLCode">'; - $SQL='SELECT accountcode, + $SQL="SELECT accountcode, accountname - FROM chartmaster, accountgroups - WHERE chartmaster.group_=accountgroups.groupname - AND ccountgroups.pandl=1 ORDER BY chartmaster.accountcode'; - + FROM chartmaster, accountgroups + WHERE chartmaster.group_=accountgroups.groupname + AND ccountgroups.pandl=1 ORDER BY chartmaster.accountcode"; + $Result = DB_query($SQL,$db); while ($myrow = DB_fetch_array($Result)) { @@ -1521,8 +1524,8 @@ $_POST['CreditText'] = ''; } $j++; - echo '<tr><td>' . _('Credit note text') . '</td><td><textarea tabindex='.$j.' name=CreditText cols=31 rows=5>' . $_POST['CreditText'] . '</textarea></td></tr>'; - echo '</table><br><div class="centre"><input TABINDEX='.$j.' type=submit name=Update Value=' . _('Update') . '><p>'; + echo '<tr><td>' . _('Credit note text') . '</td><td><textarea tabindex=' . $j . ' name=CreditText cols=31 rows=5>' . $_POST['CreditText'] . '</textarea></td></tr>'; + echo '</table><br /><div class="centre"><input tabindex=' . $j . ' type=submit name=Update Value=' . _('Update') . '><p>'; $j++; echo '<input type="submit" tabindex='.$j++.' name="ProcessCredit" Value="' . _('Process Credit') .'"></div>'; } Modified: trunk/Currencies.php =================================================================== --- trunk/Currencies.php 2011-05-02 10:33:55 UTC (rev 4560) +++ trunk/Currencies.php 2011-05-03 10:05:05 UTC (rev 4561) @@ -1,7 +1,6 @@ <?php -/* $Revision: 1.20 $ */ + /* $Id$*/ -//$PageSecurity = 9; include('includes/session.inc'); $title = _('Currencies Maintenance'); @@ -141,7 +140,7 @@ if ($myrow[0] > 0) { prnMsg(_('Cannot delete this currency because customer accounts have been created referring to this currency') . - '<br>' . _('There are') . ' ' . $myrow[0] . ' ' . _('customer accounts that refer to this currency'),'warn'); + '<br />' . _('There are') . ' ' . $myrow[0] . ' ' . _('customer accounts that refer to this currency'),'warn'); } else { $sql= "SELECT COUNT(*) FROM suppliers WHERE suppliers.currcode = '".$SelectedCurrency."'"; $result = DB_query($sql,$db); @@ -149,14 +148,14 @@ if ($myrow[0] > 0) { prnMsg(_('Cannot delete this currency because supplier accounts have been created referring to this currency') - . '<br>' . _('There are') . ' ' . $myrow[0] . ' ' . _('supplier accounts that refer to this currency'),'warn'); + . '<br />' . _('There are') . ' ' . $myrow[0] . ' ' . _('supplier accounts that refer to this currency'),'warn'); } else { $sql= "SELECT COUNT(*) FROM banktrans WHERE banktrans.currcode = '" . $SelectedCurrency . "'"; $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); if ($myrow[0] > 0){ prnMsg(_('Cannot delete this currency because there are bank transactions that use this currency') . - '<br>' . ' ' . _('There are') . ' ' . $myrow[0] . ' ' . _('bank transactions that refer to this currency'),'warn'); + '<br />' . ' ' . _('There are') . ' ' . $myrow[0] . ' ' . _('bank transactions that refer to this currency'),'warn'); } elseif ($FunctionalCurrency==$SelectedCurrency){ prnMsg(_('Cannot delete this currency because it is the functional currency of the company'),'warn'); } else { @@ -216,17 +215,17 @@ } if ($myrow[1]!=$FunctionalCurrency){ - printf("<td><img src=\"%s\"></td> + printf('<td><img src="%s"></td> <td>%s</td> <td>%s</td> <td>%s</td> <td>%s</td> <td class=number>%s</td> <td class=number>%s</td> - <td><a href=\"%s&SelectedCurrency=%s\">%s</a></td> - <td><a href=\"%s&SelectedCurrency=%s&delete=1\">%s</a></td> - <td><a href=\"%s/ExchangeRateTrend.php?%s\">" . _('Graph') . "</a></td> - </tr>", + <td><a href="%s&SelectedCurrency=%s">%s</a></td> + <td><a href="%s&SelectedCurrency=%s&delete=1">%s</a></td> + <td><a href="%s/ExchangeRateTrend.php?%s">' . _('Graph') . '</a></td> + </tr>', $ImageFile, $myrow[1], $myrow[0], @@ -234,23 +233,23 @@ $myrow[3], number_format($myrow[4],5), number_format(GetCurrencyRate($myrow[1],$CurrencyRatesArray),5), - $_SERVER['PHP_SELF'] . '?' . SID, + $_SERVER['PHP_SELF'] . '?', $myrow[1], _('Edit'), - $_SERVER['PHP_SELF'] . '?' . SID, + $_SERVER['PHP_SELF'] . '?', $myrow[1], _('Delete'), $rootpath, - SID . '&CurrencyToShow=' . $myrow[1]); + '&CurrencyToShow=' . $myrow[1]); } else { - printf("<td><img src=\"%s\"></td> + printf('<td><img src="%s"></td> <td>%s</td> <td>%s</td> <td>%s</td> <td>%s</td> <td class=number>%s</td> <td colspan=4>%s</td> - </tr>", + </tr>', $ImageFile, $myrow[1], $myrow[0], @@ -261,19 +260,19 @@ } } //END WHILE LIST LOOP - echo '</table><br>'; + echo '</table><br />'; } //end of ifs and buts! if (isset($SelectedCurrency)) { - echo '<div class="centre"><a href=' .$_SERVER['PHP_SELF'] . '?' . SID. '>'._('Show all currency definitions').'</a></div>'; + echo '<div class="centre"><a href="' .$_SERVER['PHP_SELF'] . '">'._('Show all currency definitions').'</a></div>'; } -echo '<br>'; +echo '<br />'; if (!isset($_GET['delete'])) { - 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'] . '" />'; if (isset($SelectedCurrency) AND $SelectedCurrency!='') { @@ -300,12 +299,11 @@ - echo '<input type="hidden" name="SelectedCurrency" VALUE="' . $SelectedCurrency . '">'; - echo '<input type="hidden" name="Abbreviation" VALUE="' . $_POST['Abbreviation'] . '">'; + echo '<input type="hidden" name="SelectedCurrency" value="' . $SelectedCurrency . '">'; + echo '<input type="hidden" name="Abbreviation" value="' . $_POST['Abbreviation'] . '">'; echo '<table class=selection><tr> <td>' . _('ISO 4217 Currency Code').':</td> - <td>'; - echo $_POST['Abbreviation'] . '</td></tr>'; + <td>' . $_POST['Abbreviation'] . '</td></tr>'; } else { //end of if $SelectedCurrency only do the else when a new record is being entered if (!isset($_POST['Abbreviation'])) {$_POST['Abbreviation']='';} @@ -316,27 +314,35 @@ echo '<tr><td>'._('Currency Name').':</td>'; echo '<td>'; - if (!isset($_POST['CurrencyName'])) {$_POST['CurrencyName']='';} + if (!isset($_POST['CurrencyName'])) { + $_POST['CurrencyName']=''; + } echo '<input ' . (in_array('CurrencyName',$Errors) ? 'class="inputerror"' : '' ) .' type="text" name="CurrencyName" size=20 maxlength=20 VALUE="' . $_POST['CurrencyName'] . '">'; echo '</td></tr>'; echo '<tr><td>'._('Country').':</td>'; echo '<td>'; - if (!isset($_POST['Country'])) {$_POST['Country']='';} + if (!isset($_POST['Country'])) { + $_POST['Country']=''; + } echo '<input ' . (in_array('Country',$Errors) ? 'class="inputerror"' : '' ) .' type="text" name="Country" size=30 maxlength=50 VALUE="' . $_POST['Country'] . '">'; echo '</td></tr>'; echo '<tr><td>'._('Hundredths Name').':</td>'; echo '<td>'; - if (!isset($_POST['HundredsName'])) {$_POST['HundredsName']='';} - echo '<input ' . (in_array('HundredsName',$Errors) ? 'class="inputerror"' : '' ) .' type="text" name="HundredsName" size=10 maxlength=15 VALUE="'. $_POST['HundredsName'].'">'; + if (!isset($_POST['HundredsName'])) { + $_POST['HundredsName']=''; + } + echo '<input ' . (in_array('HundredsName',$Errors) ? 'class="inputerror"' : '' ) .' type="text" name="HundredsName" size=10 maxlength=15 value="'. $_POST['HundredsName'].'">'; echo '</td></tr>'; echo '<tr><td>'._('Exchange Rate').':</td>'; echo '<td>'; - if (!isset($_POST['ExchangeRate'])) {$_POST['ExchangeRate']='';} - echo '<input ' . (in_array('ExchangeRate',$Errors) ? 'class="inputerror"' : '' ) .' type="text" class=number name="ExchangeRate" size=10 maxlength=9 VALUE='. $_POST['ExchangeRate'].'>'; + if (!isset($_POST['ExchangeRate'])) { + $_POST['ExchangeRate']=''; + } + echo '<input ' . (in_array('ExchangeRate',$Errors) ? 'class="inputerror"' : '' ) .' type="text" class=number name="ExchangeRate" size=10 maxlength=9 value='. $_POST['ExchangeRate'].'>'; echo '</td></tr>'; echo '</table>'; - echo '<br><div class="centre"><input type="Submit" name="submit" value='._('Enter Information').'></div>'; + echo '<br /><div class="centre"><input type="Submit" name="submit" value='._('Enter Information').'></div>'; echo '</form>'; Modified: trunk/Locations.php =================================================================== --- trunk/Locations.php 2011-05-02 10:33:55 UTC (rev 4560) +++ trunk/Locations.php 2011-05-03 10:05:05 UTC (rev 4561) @@ -374,7 +374,6 @@ printf('<td>%s</td> <td>%s</td> <td>%s</td> - <td>%s</td> <td><a href="%sSelectedLocation=%s">' . _('Edit') . '</td> <td><a href="%sSelectedLocation=%s&delete=1">' . _('Delete') . '</td> </tr>', @@ -449,8 +448,8 @@ $_POST['Managed'] = $myrow['managed']; - echo '<input type="hidden" name="SelectedLocation" value="' . $SelectedLocation . '>'; - echo '<input type="hidden" name="LocCode" value="' . $_POST['LocCode'] . '>'; + echo '<input type="hidden" name="SelectedLocation" value="' . $SelectedLocation . '">'; + echo '<input type="hidden" name="LocCode" value="' . $_POST['LocCode'] . '">'; echo '<table class="selection">'; echo '<tr><th colspan=2><font size=3 color=blue>'._('Amend Location details').'</font></th></tr>'; echo '<tr><td>' . _('Location Code') . ':</td><td>'; Added: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log (rev 0) +++ trunk/doc/Change.log 2011-05-03 10:05:05 UTC (rev 4561) @@ -0,0 +1,3271 @@ +webERP Change Log + +3/5/11 Locations.php fix table hidden POST variable quotes mismatch - also mismatch between number of parameters in printf output +2/5/11 Make order entry show the currency decimal places for amounts and totals also in invoicing SelectOrderItems.php and ConfirmDispatch_Invoice.php +2/5/11 Fix PO_PDFPurchOrder.php to allow emailing but email option not to appear on printed/emailed orders +1/5/11 Tim PageSecurity.php fix bug that prevented updates to Security Token for a particular script. +1/5/11 Many scripts quoting changes single quotes for strings double quotes for xhtml variables +1/5/11 SecuirtyTokens allow deletion of tokens if no scripts using it +28/4/11 Tim - add facility to select an account group to limit GL acccounts returned as options to post payments to +28/4/11 Tim - new SecurityTokens script +28/4/11 Fix Secunia reported vulnerability by checking for dodgy characters in CompanyNameField - then matched to a real directory on the web-server + +18/4/11 - Version 4.03.8 Release + +18/4/11 Phil: Update zh_HK.utf8, pt_BR.utf8, fa_IR.utf8 from launchpad translations +18/4/11 Phil: Changed PurchData.php back to now have free form text entry of unit of measure - as suggested by Brian May - think it works better this way +18/4/11 Phil: Removed redundant fields that are not used anywhere from DefinePOClass and the various function to add lines to purchase orders and to update purhcase order lines - netweight, cuft, kgs, itemno, total_quantity etc. all this data can be retrieved without duplication in purchorderdetails +16/4/11 Phil: Tim's changes in launchpad fork to 4663 - xhtml syntax fixes +15/4/11 Phil: Copy Exson's traditional Chinese back to zh_HK.utf8 +11/4/11 Ricard: new pcAuthorizeExpenses.php that shows the current balance of the tab to the authorizer. Before the authorizer did not see this information. +11/4/11 Tim: StockLocTransfer.php added $_POST['LinesCounter'] -= 10; +11/4/11 Tim/Phil: Use PHP 5 specific scandir to sort languages into alphabetic order for UserSettings and WWW_Users language selection +10/4/11 Tim: AddCustomerContacts.php use single field rather than * in SQL> +10/4/11 Tim: GLAccountInquiry.php show None if no tag selected +10/4/11 Tim : PDFPrintLabel.php javascript fix +10/4/11 Tim: Add perishable to StockTransfer.php and PDFStockTransfer +10/4/11 Tim: PDFPeriodStockTransListing - new report to print off stock transactions of a specified type for a selected period>/p> +10/4/11 Tim: PDFStockTransListing.php option to print off transactions by inventory location +10/4/11 Tim: Stocks.php - more logical use of $New and $_POST['New'] +10/4/11 Tim: Payments.php PaymentMethods.php Add new field userpreprintedstationery to payment methods to determine whether to print cheques +5/4/11 Tim: includes/LanguageSetup.php - discovered solution to Turkish character set problem!! +5/4/11 Phil: couple of is_date functions left over from experiment to see if changing fixed Turkish - now removed from SupplierInvoice.php and PDFOrdersInvoiced.php +5/4/11 Phil: SuppCreditGRNs was not showing old GRNs and no way to input an older date +31/3/11 Phil:Fix link to create purchase order from purchasing data link on SelectProduct.php - thanks Brian May for pointing out the bug +31/3/11 Phil: Updated all tranlations from the launchpad site +31/3/11 Tim: Fix to make languages display immediately on change - session.inc moved includes/LanguageSetup.php down +30/3/11 Tim: New ReprintGRN.php script takes a purchase order and allows any line received to have GRN(s) reprinted +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 /> +27/3/11 - Version 4.03.5 Release + +27/3/11: Phil fixed SQL upgrade script to add the Z_ChangeSupplierCode.php script is added to the scripts table +27/3/11: Phil fixed some SQL for ansi compatibility I had changed in error - would affect users running strict mode ansi +27/3/11: Phil at Brian May's suggestion added conversion factor to item look up in PO_Items.php - also ensured quantity entry no longer trapped for commas and commas removed from numbers before committing. Also trapped for committing purchase orders with no lines + +26/3/11 - Version 4.03 Release + +26/3/11: Phil added some error trapping to codes of pcTabTypes +24/3/11: Phil rework PDFStockTransfer.php remove a few round trips to DB and added facility to be able to select a transfer number to reprint - added to main menu +24/3/11: James wer...@ya... Added snall image in middle of SelectProduct.php +19/3/11: Phil added country to packing slips +18/3/11: Marcos Garcia Trejo Added Z_ChangeSupplierCode.php +18/3/11: Ricard add orderby transdate to DailyBankTransactions.php +18/3/11: Phil check for Customers.php CustomerBranches.php and Stocks.php now traps codes containing spaces - as well as other illegal characters +15/3/11: Phil PricesByCost.php - made it update prices where there is already a price starting on today's date +15/3/11: Phil SelectOrderItems.php customer selection now done using a hidden $_POST rather than parsing debtorno hyphen branchcode. +15/3/11: Phil Locations.php new field for CounterSales branch code - instead of parsing it from a single field with a hyphen in it. CounterSales.php now uses the new field for customer branch +14/3/11: Phil SelectSalesOrder.php now lists with sales order value denominated in functional currency with total of listed outstadning sales orders (or quotations) shown at the bottom of the listing +12/3/11: Tim Now allow space in codes +12/3/11: SelectSalesOrder.php now allows any number of sales orders to be selected and purchase orders placed for the aggregate of items on the selected sales orders +12/3/11: SuppPriceList.php removed a round trip to DB to get currency - fixed function to get pdf to new TCPDF Output +12/3/11: Exson fix all htmlentities to use ENTQUOTES, 'UTF-8' option so other character sets work with it +10/3/11: Phil fix pagination of PrintCustOrder_generic.php - second copy was not restarting page numbers +10/3/11: Tims launchpad fixes brought in MRP.php fix for table charset utf8 so joins work correctly; typeo in PO_Header preventing purchasing data being retrieved ($result not $Result); correct sql on searching for customer in SelectCreditItems.php; StockStatus.php pricing history bug resolved (4450); StockQuantityByDate.php now allowed to show for all categories - enclosed 'All' in gettext +8/3/11: Tim/Phil PO_Items.php in committing an order detail the assetid of 'Not an Asset' was being inserted to an integer field. Modified $_POST['AssetID'] to = 0 if it was 'Not an Asset' as advised by Tim +8/3/11: Phil fix SalesAnalysis reports for TCPDF as reported by Joe Zhou +5/3/11: Kovács Attila fix to Stocks.php to use ANSI GROUP BY for aggregate functions SQL +5/3/11: Kovács Attila fix to LanguageSetup.php to use utf-8 not ISO-8859-1. Phil hardcoded UTF-8 now as no dynamic changing of character set required all translations are utf-8 +3/3/11: Exson/Baran/Phil fix to customer login to ensure that other customers orders are not displayed when searching by customer ref or order no +3/3/11: Tim launchpad mods to revision 4441 including change to allow supplier currency to be changed if there are no transactions already against the supplier. Ensure credit note session variable is unset before attempting to create a new credit note from the supplier form. Tim's work to add perisable expiry dates to the serial items logic - affects quite a few scripts. Headings to stock check script even if no quantity is shown. Portrait quotations. Not included change to default delivery date to the date the customer requested - left to be the current day's date. Not included Tim's unit pricing work .. yet launchpad revisions 4442-4447 inclusive +27/2/11: Phil/Tim/Peter launchpad added category option for MRPShortages.php links with matching quotes in WorkOrderEntry +27/2/11: Phil StockUsage.php now totals usage each month even in months where there was none - average now includes months with no usage +27/2/11: Phil fix units deletion issue reported by Exson in UnitsOfMeasure.php script - checked for none existant units field in contracts table - removed the check +22/2/11: Phil fix PDFTopItems.php for changed variable names - now using CamelCase tried to rework to conform +22/2/11: Phil remove options for PDFLanguage that are not unique in WWW_Users.php - make it default to the users settings in the SESSION for UserSettings.php +18/2/11: Phil/Don Change PageSecurity array variable name to PageSecurityArray - caused problems with conflict with PageSecurity variable where register_globals = on; +18/2/11: PO_Items.php make number_format variables turn back into numbers for > 1000 +16/2/11: FixedAssetItems.php now checks for location before allowing additions +16/2/11: Company preferences - changed wording of stock integration at cost removed the word standard as suggested by Exson +16/2/11: SelectCreditItems.php formating/conventions lower case html and CreditInvoice.php +15/2/11: Phil Make invoicing warn the user when no taxes are defined for a tax group - i.e. there is a configuration error with taxes +<p /> +15/2/11 Release 4.03RC2 +<p /> +15/2/11: Phil UpgradeDatabase.php fix to upgrade from 4.01RC1 !! +15/2/11: Phil PrintCustTrans.php and PrintCustTransPortrait.php htmlspecialchars_decode($narrative) - conversion at the time of committing to DB needs to be unconverted. Also in ConfirmDispatch_Invoice.php +15/2/11: Phil SelectCustomer.php removed showing blank message when $msg was empty +<p /> +13/2/11 Release 4.03RC1 +<p /> +13/2/11:Phil GoodsReceivedControlled InputSerialItems and friends - now uses session identifier to ensure uniqueness is several people entering stock receipts +13/2/11:Phil Contracts.php SelectOrderItems.php customer selection mechanism reworked - was causing issues in Contracts as noted by DK Shukla +8/2/11: Tim Rework CounterSales.php so that it is now possible to sell items that have sales/purchasing tax +8/2/11: Phil Fix InventoryPlanning and InventoryPlanningPrefSupplier to only show sales order demand - excluding quotations. Also fixed for conversionfactor as now all purchase order quantities are in our normal stock units +8/2/11: Phil Fix incorrect layout of narrative on multiple lines of PDFQuotation.php as reported by Ricard Andreu +8/2/11: Tim/Ricard StockLocTransfer.php can now transfer the same amount as on hand in the location - previously checked to see that the transfer was less than the quantity on hand (when checking for negative stock) +8/2/11: Tim Payments.php and javascripts/MiscFunctions.js corrections to javascript +8/2/11: Phil PDFGrn.php turns out preview is used from the form modification script doh! Over simplificaton reversed to reinstate preview mode +6/2/11: Otandeka Removed debug prnMsg in FixedAssetDepreciation +5/2/11: Phil SystemParameters.php new option to AutoAuthorisePO when the user has authority to do so +5/2/11: Phil PO_Items.php fixed non-existant variables on Enter nominal line. Added option to automatically authorise when user is an authoriser as well as a creator +5/2/11: Phil PDFGrn.php rewrote - preview never used - simplified +4/2/11: Tim CostUpdate.php allow cost update with appropriate permissions token 10 hard coded +4/2/11: Phil SelectCustomer.php rejig selection options in more logical way. Used non-specific SQL to search by any part of the address +2/2/11: Phil PDFTopItems.php and TopItems.php removed mysql specific SQL +30/1/11: Phil GoodsReceived.php rework for supplier units and conversion factor etc now in PO class +30/1/11: Phil PDFGrn.php rework for supplier units and conversion factor etc now in PO class +30/1/11:Exson changed PDFLowGP report remove % from gettext string +29/1/11:Tim fix reportwriter with tcpdf using parent::__construct rather than $this->Cpdf( +24/1/11:Phil Depreciation fixes - SelectAsset by description fix +23/1/11:Peter Otandeka: PDFTopItems.php SQL quoting fixes +23/1/11: Phil Fix Depreciation posting and dates of end of periods +23/1/11:Phil changed back references throughout several MRP scripts from is_date to Is_Date - as Is_Date is used throughout the code and much bigger job to change all references to is_date +20/1/11: Tim changed back addinfo calls to addInfo on PDF reports - Zhigio originally thought to be an issue with Turkish utf-8 pdfs but turned out to be a red herring. class.pdf call changed back to addInfo too - most of calls had not been changed to lower case info +20/1/11: Tim changed PricesBasedOnMarkUp to have end date day before new prices effective from +20/1/11: Phil FixedAssetRegister.php FixedAssetDepreciation.php fixes +19/1/11: Phil modified GLBudgets.php to allow entry of last years budget too +17/1/11: Phil More purchasing work removing redundant queries rationalising code - new layout with supplier units +15/1/11: Tim removed MX record check from IsEmail function in includes/MiscFunctions.php +15/1/11: Tim/Peter Otandeka SQL quoting a whole bunch of scripts - changing single quotes to doubles - didn't apply ones where no variables required quoting +14/1/11: Phil install scripts modified to copy over FormDesigns under the new company directory created +14/1/11: Phil Updates to manual for security and supplier invoice entry +13/1/11:Phil PO_Items.php remove redundant code, setup entry of lines in supplier units +13/1/11:Tim Z_ChangeCustomerCode.php now has foreign key checks defeated when deleting the old customer record and custbranch record +13/1/11:Phil SupplierInvoice.php and SupplierCredit.php now check to ensure the total of contracts fixed asset charges goods received charges, shipment charges and GL charges are at least equal to the amount of the invoice or credit. It was possible when GL interface turned off to get strange results +12/1/11:Phil DailyBankTransactions.php made it so a range of dates can be selected but defaults to just today +11/1/11:Phil Fix choice of portrait or landscape invoices - fix landscape default form layout. Fix portrait invoice logo position +11/1/11:Phil Fix customer transaction inquiries to show correct links where user is not authorised for credit notes or GL inquiries +11/1/11:Phil SupplierCredit.php and SupplierInvoice.php recalculate price variance to post differences on fixed asset additions correctly +11/1/11:Phil PO_PDFPurchOrder.php - fixed for coding conventions removed uneccessary sql calls +11/1/11: Murray Collingwood: Emailing invoices was writing the pdf file twice - once with fwrite and once with the TCPDF output function with the option 'F' +8/1/11 Ricard Andreu: Z_ChangeCustomerCode.php added typeid field that made change customer code fail. Also corrected typo for foreign key checking side stepping for Z_ChangeBranchCode.php +5/1/11 Phil: Bug fixes AssetLocationTransfer and Supplier Contacts +4/1/11 Paul T: Bug# 3151192 - insert underscore for superglobal. +5/1/11 Phil: Bug fixes AssetLocationTransfer and Supplier Contacts +4/1/11 Phil: Start rework of purchase order scripts ... again. +4/1/11 Phil: Select Purchase orders now defaults to just pending and authorised/printed - other statii are options +1/1/11 Phil: Upgrade script make capable of upgrades from any earlier version - and email a backup to the user. Deleted DBUpgradeNumber config variable now use the VersionNumber already there +31/12/10 Tim: Tidy up of CounterSales.php - CamelCasing, quoting SQL, closing slashes in xhtml tags +29/12/10 Phil: Reverted to single SQL upgrade file per release - but retaining Tim's upgrade mechanism if the DBUpgradeNumber is out of date. Removed pseudo SQL language required for upgrade script and the 52 update files - just applies plain vanilla SQL from the scripts required +29/12/10 Tim: DB upgrade mechanism with separate pseudo SQL for each database change in a separate file + 52 files of updates since 3.11.4 +21/12/10 Phil : Reworked PDFPrintLabels.php to conform to standards and corrected SQL for prices +21/12/10 Ricard Andreu: PDFPrintLabels.php was not checking for end date of prices - fixed +19/12/10 Phil: SelectOrderItems.php ConfirmDispatch_Invoice.php add code to handle asset disposals. +14/12/10 Phil: modify purchasing scripts for coding conventions/readability +11/12/10 Phil: Have populated the new field stockcheckdate in stockcheckfreeze and modified PDFStockCheckComparison to use this field when posting the GL - stockmoves need to be on the current day otherwise historical balances will all need to be updated. But narrative shows the date of the stock check for which the adjustment is being made +9/12/10 James Murray: highlighted a bug in SupplierInvoice.php (and also in SupplierCredit.php) where the due date of the invoice/credit was not calculated correctly based on the terms - it was picking up the current date rather than the invoice/credit date. Now fixed +8/12/10 James Murray: fixed bug in SuppPaymentRun.php - was not showing anything as the test to see if there was anything to see was using a non-existant result set! +3/12/10 Matt Elbrecht : Estonian translation +30/11/10 Phil: Changed table structure of new fixedassettrans and modified upgrade script - those who already ran that bit will need to change the table again. Modified fixed asset scripts again. New fixed assets manual +28/11/10 Exson: CreditStatus.php - Fix bug in sql statement +28/11/10 Tim: OutstandingGRNs.php - Only show when the invoiced qty is less than the GRN qty +28/11/10 Phil: All fixed asset scripts SupplierInvoice.php SupplierCredit.php SuppFixedAssetChgs.php - adding fixed assets directly from invoice charges - and reversing additions with credit notes. Also FixedAssetRegister.php report to print PDF or export CSV of fixed assets now includes date range depreciation and b/fwd cost b/fwd accum depn and c/fwd cost and accum depn - and NBV +28/11/10 James Murray: unset session in ConnectDB_mysqli.inc and ConnectDB_mysql.inc when the login fails +27/11/10 Phil: install/index.php check for critical requirements before allowing install to proceed +27/11/10 Phil: includes/DefinePOClass.php change variable to camel case also PO_Header.php PO_Items.php PO_ReadInOrder.inc GoodsReceived.php - scope for error needs lots of testing please +27/11/10 Phil: PurchData - fix MinOrderQty error trapping with appropriate text and default to 1 +27/11/10 Phil: SupplierInvoice.php removed check on weighted average costing to reverse GRN suspense posting and set cost to zero - this was defeating the price variance calculation and the proper valuation of stock. Also took out of the calculations the conversionfactor - will need to alter goods received code to ensure only our units recorded in quantity received. +26/11/10 Tim: upgrade3.11.1-4.00.sql - Add default date for stockcheckdate field in stockcheckfreeze table +26/11/10 Otandeka: CounterSales.php - Fix bug in counter sales script. +24/11/10 Phil: GoodsReceived.php - modified to insert fixedassettrans and to post nominal POs to fixed asset cost account from fixedassetcategories.costact +23/11/10 Pak Ricard: MRP.php and MRPShortages.php fixed temporary tables to use utf-8 - code failed without probably depends on mysql server settings +21/11/10 Phil:Rewritten FixedAssetJournal.php - renamed FixedAssetDepreciation.php +20/11/10 Phil: Rewritten FixedAssetItems.php FixedAssetCategories.php and modified FixedAssetLocations.php to use the new structure +18/11/10 Tim: upgrade3.11.1-4.00.sql - Fix sql syntax errors brought in on recent changes. +14/11/10 Phil: SelectAsset.php script reworked SelectAssetType.php script now deleted +08/11/10 Exson: Z_ImportStocks.php - Bug fixes. +06/11/10 Phil: ShiptChgs.php - made a check to ensure a shipment reference entered manully actually exists before it is added - otherwise a nasty error occurs on commital of the invoice +06/11/10 Paul T: InputSerialItemsSequential.php - Bug# 3080130 - Add new FormID to form. (and minor cleanup) +06/11/10 Tim: ReorderLevelLocation.php - Remove fixed assets from selections +06/11/10 Tim: ReorderLevel.php - Remove fixed assets from selections +06/11/10 Tim: InventoryQuantities.php - Remove fixed assets from selections +06/11/10 Tim: Selectproduct.php - Remove fixed assets from selections +06/11/10 Tim: InventoryValuation.php - Ensure fixed assets dont get shown in valuation report +06/11/10 Tim: FixedAssetItems.php - Fixed typo preventing Item code being shown +06/11/10 Phil: StockCategory.php FixedAssetCategory.php attempt to add validation to depreciation rates by extending the stock category property logic with new fields for numericvalue, minimumvalue and maximumvalue. Then adding the depreciation rate percentage property to expect numeric values with a minimum of 0 and maximum of 100. +05/11/10 Tim: PurchData.php. Converted field name to lower case for consistency +05/11/10 Tim: SelectProduct.php. Change the standard order quantities to agree with Minimum order qty +05/11/10 Tim: PurchData.php. Make the Minimum order quantity field numeric only +05/11/10 Poul Bjerre-Jensen: SelectProduct.php,PurchData.php. Add in Minimum order quantity to Purchasing data +02/11/10 Tim: SelectCustomer.php. Correction to work with debtors that have a - in the code +31/10/10 Tim: SuppTransGLAnalysis.php. Minor bug fixes +31/10/10 Tim: SuppTransGLAnalysis.php. Force the user to select a GL account code instaed of defaulting to first on the list +31/10/10 Tim: CustomerReceipt.php. Force the user to select a GL account code and a Bank Account instaed of defaulting to first on the list +29/10/10 Tim: index.php. If CustomerReceipt selected from the GL menu then go to GL receipts else customer receipts +29/10/10 Tim: Payments.php. Force the user to select a GL account code and a Bank Account instaed of defaulting to first on the list +29/10/10 Tim: GLJournal.php. Force the user to select a GL account code instaed of defaulting to first on the list +28/10/10 Tim: Fix bug # 3017709. When bulk transfers are received for controlled items serial numbers are required +28/10/10 Tim: PcExpensesTypeTab.php - SQL quoting corrections and layout changes and improvements +28/10/10 Tim: PcTabs.php - SQL quoting corrections and layout changes and improvements +28/10/10 Tim: PcTypeTabs.php - SQL quoting corrections and layout changes and improvements +27/10/10 Tim: PcReportTab.php - SQL quoting corrections and layout changes and improvements +27/10/10 Tim: PcClaimExpensesFromTab.php - SQL quoting corrections and layout changes and improvements +27/10/10 Tim: class.pdf.php - Fix bug in html_entity_decode() function call +27/10/10 d.k shukla: ManualPurchaseOrdering.html - Improvements to purchase ordering manual +27/10/10 Tim: WorkOrderEntry.php - When the quantities are changed, then the correct quantities are updated, and the date picker chooses the correct date. +27/10/10 Tim: header.inc - Correct for non ascii characters +27/10/10 Tim: Corrections to display multi line invoice narratives correctly +26/10/10 Tim: Discountmatrix.php - Fix discount category bug +26/10/10 Tim: Discountmatrix.php - Increase the number of decimal places that can be entered +26/10/10 Tim: StockLocTransfer.php - Check there is sufficient stock for the transfer +25/10/10 Marcos Garcia Trejo: New labelprinting functionality +25/10/10 ChenJohn: class.pdf.php - correctly display some html encoded special characters, to make them human readeable in pdf file. +23/10/10 Phil: PurchData.php - search by name failed concatenation of SQL stuffed now repaired. + +Version 4.0RC1 +22 October 2010 + +20/10/10 Paul: MiscFunctions.js - Bug #3060329. Correct condition check. [allows the calendar to start with the textbox's date] +18/10/10 Paul: WorkOrderReceive.php - Bug #3023776. Applied anonymous contribution. +16/10/10 Phil: SupplierInvocie.php fixed for mix up with commits - now shipment charges added correctly and contract charges also +14/10/10 Tim: MiscFunctions.php - Fix bug preventing download of ECB rates +13/10/10 Tim: WWW_Users.php - Show the last visit date correctly. Fixes bug 3085860 +09/10/10 Phil: Added xmlrpc_GetStockCategoryList api method +04/10/10 Matt Taylor: upgrade3.11.1-3.12.sql - Update tables to utf8 +03/10/10 Gabriel Olowo: ManualPurchaseOrdering.php - Manual for purchase ordering system +02/10/10 Tim: AuditTrail.php - Bug fixes and layout changes +02/10/10 Tim: DailySalesInquiry.php - Bug fixes and layout changes +02/10/10 Tim: session.inc - Corrections to sql quoting. Resolves bug 3023782 +02/10/10 Tim: ppdf_tpl.php - Make php 5.3 compatible +02/10/10 Tim: GLJournal.php - Fix to create a reversing journal even when non english language is used. +02/10/10 Tim: PDFGrnHeader.php - Show correct column headings. Fixes bug 3072507 +30/09/10 Tim: Add form verification to prevent form spoofing +30/09/10 Tim: WWW_Users.php - SQL quoting corrections and layout changes and improvements +30/09/10 Tim: WWW_Access.php - SQL quoting corrections and layout changes and improvements +29/09/10 Tim: WOSerialNos.php - SQL quoting corrections +29/09/10 Tim: WorkOrderStatus.php - SQL quoting corrections and layout changes and improvements +29/09/10 Tim: WorkOrderReceive.php - SQL quoting corrections and layout changes and improvements +29/09/10 Tim: WorkOrderIssue.php - SQL quoting corrections and layout changes and improvements +29/09/10 Tim: WorkOrderEntry.php - SQL quoting corrections and layout changes and improvements +28/09/10 Tim: WorkOrderCosting.php - SQL quoting corrections and layout changes and improvements +28/09/10 Tim: WorkCentres.php - SQL quoting corrections and layout changes and improvements +28/09/10 Tim: WhereUsedInquiry.php - SQL quoting corrections and layout changes and improvements +28/09/10 Tim: UserSettings.php - SQL quoting corrections and layout changes and improvements +28/09/10 Tim: UnitsOfMeasure.php - SQL quoting corrections and layout changes and improvements +28/09/10 Tim: TopItems.php - SQL quoting corrections and layout changes and improvements +28/09/10 Tim: TaxProvinces.php - SQL quoting corrections and layout changes and improvements +28/09/10 Tim: TaxGroups.php - SQL quoting corrections and layout changes and improvements +28/09/10 Tim: TaxCategories.php - SQL quoting corrections and layout changes and improvements +28/09/10 Tim: TaxAuthorityRates.php - SQL quoting corrections and layout changes and improvements +28/09/10 Tim: TaxAuthorities.php - SQL quoting corrections and layout changes and improvements +28/09/10 Tim: Tax.php - SQL quoting corrections and layout changes and improvements +28/09/10 Tim: SystemParameters.php - SQL quoting corrections and layout changes and improvements +28/09/10 Tim: SuppTransGLAnalysis.php - SQL quoting corrections and layout changes and improvements +28/09/10 Tim: SuppShiptCharges.php - Layout changes and improvements +28/09/10 Tim: SuppPriceList.php - Layout changes and improvements +27/09/10 Paul Thursby: Various default.css files -- Minor CSS corrections. +27/09/10 Tim: SuppPaymentRun.php - SQL quoting corrections and layout changes and improvements +27/09/10 Tim: SuppLoginSetup.php - SQL quoting corrections and layout changes and improvements +27/09/10 Tim: SupplierTypes.php - SQL quoting corrections and layout changes and improvements +27/09/10 Tim: SupplierTransInquiry.php - New script to show detail supplier transactions +27/09/10 Tim: SupplierTenders.php - SQL quoting corrections +27/09/10 Tim: Suppliers.php - SQL quoting corrections +27/09/10 Tim: SupplierInvoice.php - SQL quoting corrections and layout changes and improvements +27/09/10 Tim: SupplierInquiry.php - SQL quoting corrections and layout changes and improvements +27/09/10 Tim: SupplierCredit.php - SQL quoting corrections and layout changes and improvements +27/09/10 Tim: SupplierContacts.php - SQL quoting corrections and layout changes and improvements +27/09/10 Tim: SupplierBalsAtPeriodEnd.php - Layout changes and improvements +27/09/10 Tim: SupplierAllocations.php - SQL quoting corrections and layout changes and improvements +27/09/10 Tim: SuppInvGRNs.php - SQL quoting corrections and layout changes and improvements +27/09/10 Tim: SuppCreditGRNs.php - SQL quoting corrections and layout changes and improvements +27/09/10 Tim: StockUsage.php - Layout changes and improvements +26/09/10 Tim: StockTransfers.php - Layout changes and improvements +26/09/10 Tim: StockSerialItemResearch.php - Layout changes and improvements +26/09/10 Tim: StockReorderLevel.php - SQL quoting corrections and layout changes and improvements +26/09/10 Tim: StockQuantityByDate.php - SQL quoting corrections and layout changes and improvements +26/09/10 Tim: StockQties_csv.php - Layout changes and improvements +26/09/10 Tim: StockMovements.php - Layout changes and improvements +26/09/10 Tim: StockLocStatus.php - SQL quoting corrections and layout changes and improvements and bug fixes +26/09/10 Tim: StockDispatch.php - SQL quoting corrections and layout changes and improvements and bug fixes +26/09/10 Tim: StockCounts.php - SQL quoting corrections and layout changes and improvements and bug fixes +26/09/10 Tim: StockCostUpdate.php - SQL quoting corrections and layout changes and improvements and bug fixes +26/09/10 Tim: StockCategories.php - SQL quoting corrections and layout changes and improvements and bug fixes +26/09/10 Tim: SpecialOrder.php - SQL quoting corrections +25/09/10 Tim: SMTPServer.php - SQL quoting corrections +25/09/10 Tim: ShiptsList.php - Add script to show list of open shipments for selected supplier +25/09/10 Tim: Shipt_Select.php - SQL quoting corrections and layout changes and improvements and bug fixes +25/09/10 Tim: Shippers.php - SQL quoting corrections and layout changes and improvements and bug fixes +25/09/10 Tim: Shipments.php - SQL quoting corrections and layout changes and improvements and bug fixes +25/09/10 Tim: ShipmentCosting.php - SQL quoting corrections and layout changes and improvements and bug fixes +25/09/10 Tim: SelectWorkOrder.php - SQL quoting corrections and layout changes and improvements and bug fixes +24/09/10 Tim: SelectSalesOrder.php - Layout changes and improvements and bug fixes +24/09/10 Tim: SelectRecurringSalesOrder.php - Layout changes and improvements and bug fixes +24/09/10 Tim: SelectProduct.php - SQL quoting corrections +24/09/10 Tim: SelectOrderItems.php - SQL quoting corrections +24/09/10 Tim: SelectGLAccount.php - SQL quoting corrections and layout changes and improvements and bug fixes +24/09/10 Tim: SelectCustomer.php - Layout changes and improvements and bug fixes +24/09/10 Tim: SelectCreditItems.php - SQL quoting corrections and layout changes and improvements and bug fixes +23/09/10 Tim: SelectAssetType.php - SQL quoting corrections and layout changes and improvements +23/09/10 Tim: SalesTypes.php - SQL quoting corrections and layout changes and improvements +23/09/10 Tim: SalesPeople.php - SQL quoting corrections and layout changes and improvements +23/09/10 Tim: SalesGraph.php - Fix deprecated use of assigning by reference +23/09/10 Tim: SalesGLPostings.php - SQL quoting corrections and layout changes and improvements +23/09/10 Tim: SalesCategories.php - SQL quoting corrections and layout changes and improvements +23/09/10 Tim: SalesAnalRepts.php - SQL quoting corrections and layout changes and improvements +23/09/10 Tim: SalesAnalReptCols.php - SQL quoting corrections and layout changes and improvements +23/09/10 Tim: ReverseGRN.php - SQL quoting corrections and layout changes and improvements +23/09/10 Tim: ReorderLevelLocation.php - SQL quoting corrections and layout changes and improvements +23/09/10 Tim: ReorderLevel.php - SQL quoting corrections and layout changes and improvements +23/09/10 Tim: RecurringSalesOrdersProcess.php - SQL quoting corrections +23/09/10 Tim: RecurringSalesOrders.php - SQL quoting corrections and layout changes and improvements +23/09/10 Tim: DateFunctions.inc - mktime() function without paramaeters is now deprecated, replaced with time() +20/09/10 Pak Ricard: PricesByCost.php - Restrict price changes to those stock items not discontinued +14/09/10 Tim: PurchData.php - SQL quoting corrections and layout changes and improvements +14/09/10 Tim: PrintSalesOrder_generic.php - SQL quoting corrections +14/09/10 Tim: PrintCustTransPortrait.php - SQL quoting corrections and layout changes and improvements +13/09/10 Tim: PrintCustTrans.php - SQL quoting corrections and layout changes and improvements +13/09/10 Tim: PrintStatements.php - Small bug fixes +13/09/10 Tim: PrintCustOrder_Generic.php - Correct the sql quoting +13/09/10 Tim: PrintCustOrder.php - Correct the sql quoting +13/09/10 Tim: PricesBasedOnMarkup.php - Correct the sql quoting, and various layout improvements and bug fixes +13/09/10 Tim: Prices_Customer.php - Correct the sql quoting, and various layout improvements and bug fixes +13/09/10 Tim: Prices.php - Correct the sql quoting, and various layout improvements and bug fixes +13/09/10 Tim: POReport.php - Format correctly for screen and add in option to export as a csv file +11/09/10 Tim: PO_SelectPurchOrder.php - Correct the sql quoting, and various layout improvements +11/09/10 Tim: PO_SelectOSPurchOrder.php - Correct the sql quoting +11/09/10 Tim: PO_PDFPurchOrder.php - Correct the sql quoting +11/09/10 Otandeka: PDFPriceList.php - Corrected undefined offset error +11/09/10 Phil: Manual changes - for utf-8 - language and PDFlanguage selection, also the installer and the new CounterSales.php script +10/09/10 Tim: PO_OrderDetails.php - Layout improvements, links to SelectSuppliers.php and sql quoting corrections +10/09/10 Tim: PO_Items.php - Layout improvements, and sql quoting corrections +10/09/10 Tim: PO_Header.php - Layout improvements, and sql quoting corrections +10/09/10 Tim: PO_AuthoriseMyOrders.php - Layout improvements, and sql quoting corrections +10/09/10 Tim: PO_AuthorisationLevels.php - Layout improvements, and sql quoting corrections +10/09/10 Tim: PeriodsInquiry.php - Layout improvements +10/09/10 ChenJohn: ConnectDB_mysql.inc ConnectDB_mysqli.inc fix utf-8 data being encoded/stored incorrectly in db server +08/09/10 Tim: PDFTopItems.php - Correct the sql quoting +08/09/10 Tim: PDFSuppTransListing.php - Screen layout improvements. Correct the sql quoting +08/09/10 Tim: PDFStockTransfer.php - Correct the sql quoting +08/09/10 Tim: PDFStockNegatives.php - Fix missing sql error message and correct the default date format in the heading +08/09/10 Tim: PDFStockCheckComparison.php - Screen layout improvements. Correct the sql quoting +07/09/10 Tim: PDFRemittanceAdvice.php - Correct the sql quoting +07/09/10 Tim: PDFReceipt.php - Correct the sql quoting +07/09/10 Tim: PDFQuotation.php - Correct the sql quoting +07/09/10 Tim: PDFPickingList.php - Correct the sql quoting +07/09/10 Tim: PDFOrderStatus.php - Improve report layout for readability +07/09/10 Tim: PDFOrderInvoiced.php - Improve report layout for readability +06/09/10 Tim: PO_Header.php - Move dummy status array from DefinePOClass.php +06/09/10 Tim: upgrade3.11.1-3.12.sql - Change syntax to work in both windows and linux +06/09/10 Tim: SupplierInvoice.php - Correct the roundings so that the double entry balances +05/09/10 Tim: PO_AuthoriseMyOrders.php - Update correct status when language not English +05/09/10 Tim: PcAssignCashToTab.php - Show authorised, notes, and receipt fields correctly. Changed to use DB_fetch_array() rather than DB_fetch_row(). +05/09/10 Tim: PDFStockTransListing.php - List stock transactions by transaction type. +05/09/10 Ricard: upgrade3.11.1-3.12.sql - Database changes required for changes to report writer. +31/08/10 Tim: StockLocTransfer.php - Change quantity input field to have more than 5 digits +28/08/10 Marcos Garcia Trejo: Fix ConfirmDispatchInvoice.php assembly components new qty on hand +27/08/10 Tim: Add in requisition number into purchase order prints. +21/08/10 Phil: Fix bugs introduced by Paul's patch prnMsg= should be prnMsg() BOMs.php also did in Contracts.php +21/08/10 Phil: Contract closing changes all the contracts scripts +20/08/10 Paul Thursby: More $msg cleanup. Unused eliminated; Others replaced with prnMsg(). +15/08/10 Phil: Decided to have contracts as part of orders module since not really enough links to warrant a new module changes to index.php WWW_Users.php and sql upgrade. +15/08/10 Phil: New script for ContractCosting.php comparison of contract costs budgeted vs incurred. Lot of work on contracts +13/08/10 Phil: DefineSuppTransClass.php SupplierInvoice.php and SupplierCredit.php now allow entry of contract charges. New script for SuppContractChgs.php +13/08/10 Phil: Fixes to show creditors transactions correctly in GLTransInquiry.php signs mixed up and period not shown previously +10/08/10 Russell (Regal Prods): Fix SelectOrderItems.php width of narrative box was making screen unusable!! +18/08/10 Pak Ricard: Revised report writer with the ability for more fields +07/08/10 Paul Thursby: PO_Items.php - Eliminate query; Moves the ONE field into a query above this point. +07/08/10 Paul Thursby: SelectProduct.php - Variable $msg will never print. Elimnate to use function prnMsg() instead. +08/08/10 Phil: Contracts.php SelectContracts.php DeliveryDetails.php - more work to convert Contracts to quotations and on conversion of contract quotations to orders to create contract work order to issue materials to +07/08/10 Tim: PDFLowGP.php - Sql quoting correction, layout changes, and assorted minor bug corrections +07/08/10 Tim: PO_Items.php - Sql quoting correction, layout changes, and assorted minor bug corrections +07/08/10 Tim: SelectCustomer.php - Unset $result variable once used as it was ca... [truncated message content] |
From: <dai...@us...> - 2011-05-03 10:05:14
|
Revision: 4561 http://web-erp.svn.sourceforge.net/web-erp/?rev=4561&view=rev Author: daintree Date: 2011-05-03 10:05:05 +0000 (Tue, 03 May 2011) Log Message: ----------- quoting and locations fix Modified Paths: -------------- trunk/Credit_Invoice.php trunk/Currencies.php trunk/Locations.php Added Paths: ----------- trunk/doc/Change.log Removed Paths: ------------- trunk/doc/Change.log.html Modified: trunk/Credit_Invoice.php =================================================================== --- trunk/Credit_Invoice.php 2011-05-02 10:33:55 UTC (rev 4560) +++ trunk/Credit_Invoice.php 2011-05-03 10:05:05 UTC (rev 4561) @@ -47,7 +47,8 @@ custbranch.defaultlocation, custbranch.taxgroupid, stockmoves.loccode, - locations.taxprovinceid + locations.taxprovinceid, + currencies.decimalplaces FROM debtortrans INNER JOIN debtorsmaster ON debtortrans.debtorno = debtorsmaster.debtorno INNER JOIN custbranch ON @@ -59,6 +60,8 @@ stockmoves.transno=debtortrans.transno INNER JOIN locations ON stockmoves.loccode = locations.loccode + INNER JOIN currencies ON + debtorsmaster.currcode=currencies.currabrev WHERE debtortrans.transno = '" . $_GET['InvoiceNumber'] . "' AND debtortrans.type=10 AND stockmoves.type=10"; @@ -89,12 +92,12 @@ $_SESSION['CreditItems']->FreightCost = $myrow['ovfreight']; $_SESSION['CreditItems']->DispatchTaxProvince = $myrow['taxprovinceid']; $_SESSION['CreditItems']->GetFreightTaxes(); + $_SESSION['CreditItems']->CurrDecimalPlaces = $myrow['decimalplaces']; DB_free_result($GetInvHdrResult); /*now populate the line items array with the stock movement records for the invoice*/ - $LineItemsSQL = "SELECT stockmoves.stkmoveno, stockmoves.stockid, stockmaster.description, @@ -187,7 +190,7 @@ } //end of checks on returned data set DB_free_result($LineItemsResult); } else { - prnMsg( _('This invoice can not be credited using the automatic facility') . '<br>' . _('CRITICAL ERROR') . ': ' . _('Please report that a duplicate DebtorTrans header record was found for invoice') . ' ' . $SESSION['ProcessingCredit'],'warn'); + prnMsg( _('This invoice can not be credited using the automatic facility') . '<br />' . _('CRITICAL ERROR') . ': ' . _('Please report that a duplicate DebtorTrans header record was found for invoice') . ' ' . $SESSION['ProcessingCredit'],'warn'); include('includes/footer.inc'); exit; } //valid invoice record returned from the entered invoice number @@ -314,20 +317,20 @@ if ($LnItm->Controlled==1){ - echo "<td><input type=hidden name='Quantity_" . $LnItm->LineNumber ."' value=" . $LnItm->QtyDispatched . "><a href='$rootpath/CreditItemsControlled.php?" . SID . "&LineNo=" . $LnItm->LineNumber . "&CreditInvoice=Yes'>" . $LnItm->QtyDispatched . "</a></td>"; + echo '<td><input type=hidden name="Quantity_' . $LnItm->LineNumber .'" value=' . $LnItm->QtyDispatched . '><a href="' . $rootpath . '/CreditItemsControlled.php?LineNo=' . $LnItm->LineNumber . '&CreditInvoice=Yes">' . $LnItm->QtyDispatched . '</a></td>'; } else { - echo "<td><input tabindex=".$j." type=text class=number name='Quantity_" . $LnItm->LineNumber ."' maxlength=6 size=6 value=" . $LnItm->QtyDispatched . "></td>"; + echo '<td><input tabindex=' . $j . ' type="text" class="number" name="Quantity_' . $LnItm->LineNumber .'" maxlength=6 size=6 value=' . $LnItm->QtyDispatched . '></td>'; } - $DisplayLineTotal = number_format($LineTotal,2); + $DisplayLineTotal = number_format($LineTotal,$_SESSION['CreditItems']->CurrDecimalPlaces); $j++; - echo "<td><input tabindex=".$j." type=text class=number name='Price_" . $LnItm->LineNumber . "' maxlength=12 size=6 VALUE=" . $LnItm->Price . "></td> - <td><input tabindex=".$j." type=text class=number name='Discount_" . $LnItm->LineNumber . "' maxlength=3 size=3 VALUE=" . ($LnItm->DiscountPercent * 100) . "></td> - <td class=number>$DisplayLineTotal</td>"; + echo '<td><input tabindex=' . $j . ' type=text class=number name="Price_' . $LnItm->LineNumber . '" maxlength=12 size=6 value=' . $LnItm->Price . '></td> + <td><input tabindex=' . $j . ' type=text class="number" name="Discount_' . $LnItm->LineNumber . '" maxlength=3 size=3 value=' . ($LnItm->DiscountPercent * 100) . '></td> + <td class=number>' . $DisplayLineTotal . '</td>'; /*Need to list the taxes applicable to this line */ echo '<td>'; @@ -335,14 +338,14 @@ if (is_array($_SESSION['CreditItems']->LineItems[$LnItm->LineNumber]->Taxes) ){ foreach ($_SESSION['CreditItems']->LineItems[$LnItm->LineNumber]->Taxes AS $Tax) { if ($i>0){ - echo '<br>'; + echo '<br />'; } echo $Tax->TaxAuthDescription; $i++; } } echo '</td>'; - echo '<td class=number>'; + echo '<td class="number">'; } $i=0; // initialise the number of taxes iterated through @@ -353,10 +356,10 @@ } foreach ($LnItm->Taxes as $Tax) { if ($i>0){ - echo '<br>'; + echo '<br />'; } if (!isset($_POST['ProcessCredit'])) { - echo '<input type=text class=number name="' . $LnItm->LineNumber . $Tax->TaxCalculationOrder . + echo '<input type=text class="number" name="' . $LnItm->LineNumber . $Tax->TaxCalculationOrder . '_TaxRate" maxlength=4 size=4 value="' . $Tax->TaxRate*100 . '">'; } $i++; @@ -372,17 +375,17 @@ } $TaxTotal += $TaxLineTotal; - $DisplayTaxAmount = number_format($TaxLineTotal ,2); - $DisplayGrossLineTotal = number_format($LineTotal+ $TaxLineTotal,2); + $DisplayTaxAmount = number_format($TaxLineTotal ,$_SESSION['CreditItems']->CurrDecimalPlaces); + $DisplayGrossLineTotal = number_format($LineTotal+ $TaxLineTotal,$_SESSION['CreditItems']->CurrDecimalPlaces); if (!isset($_POST['ProcessCredit'])) { echo '</td>'; echo '<td class=number>' . $DisplayTaxAmount . '</td> - <td class=number>' . $DisplayGrossLineTotal . "</td> - <td><a href='". $_SERVER['PHP_SELF'] . "?" . SID . "&Delete=" . $LnItm->LineNumber . "'>" . _('Delete') . '</a></td></tr>'; + <td class=number>' . $DisplayGrossLineTotal . '</td> + <td><a href="' . $_SERVER['PHP_SELF'] . '?Delete=' . $LnItm->LineNumber . '">' . _('Delete') . '</a></td></tr>'; - echo '<tr'.$RowStarter . "><td colspan=12><TEXTAREA tabindex=".$j." name='Narrative_" . $LnItm->LineNumber . "' cols=100% rows=1>" . $LnItm->Narrative . "</TEXTAREa><br><hr></td></tr>"; + echo '<tr' . $RowStarter . '><td colspan=12><textarea tabindex=' . $j .' name="Narrative_' . $LnItm->LineNumber . '" cols=100% rows=1>' . $LnItm->Narrative . '</textarea><br /><hr></td></tr>'; $j++; } } /*end foreach loop displaying the invoice lines to credit */ @@ -405,7 +408,7 @@ $i=0; // initialise the number of taxes iterated through foreach ($_SESSION['CreditItems']->FreightTaxes as $FreightTaxLine) { if ($i>0){ - echo '<br>'; + echo '<br />'; } echo $FreightTaxLine->TaxAuthDescription; $i++; @@ -416,7 +419,7 @@ $i=0; foreach ($_SESSION['CreditItems']->FreightTaxes as $FreightTaxLine) { if ($i>0){ - echo '<br>'; + echo '<br />'; } if (!isset($_POST['ProcessCredit'])) { @@ -435,13 +438,13 @@ if (!isset($_POST['ProcessCredit'])) { echo '</td>'; - echo '<td class="number">' . number_format($FreightTaxTotal,2) . '</td> - <td class="number">' . number_format($FreightTaxTotal+ $_SESSION['CreditItems']->FreightCost,2) . '</td> + echo '<td class="number">' . number_format($FreightTaxTotal,$_SESSION['CreditItems']->CurrDecimalPlaces) . '</td> + <td class="number">' . number_format($FreightTaxTotal+ $_SESSION['CreditItems']->FreightCost,$_SESSION['CreditItems']->CurrDecimalPlaces) . '</td> </tr>'; } $TaxTotal += $FreightTaxTotal; -$DisplayTotal = number_format($_SESSION['CreditItems']->total + $_SESSION['CreditItems']->FreightCost,2); +$DisplayTotal = number_format($_SESSION['CreditItems']->total + $_SESSION['CreditItems']->FreightCost,$_SESSION['CreditItems']->CurrDecimalPlaces); if (!isset($_POST['ProcessCredit'])) { echo '<tr> @@ -449,7 +452,7 @@ <td class=number><hr><b>' . $DisplayTotal . '</b><hr></td> <td colspan=2></td> <td class=number><hr><b>' . number_format($TaxTotal,2) . '<hr></td> - <td class=number><hr><b>' . number_format($TaxTotal+($_SESSION['CreditItems']->total + $_SESSION['CreditItems']->FreightCost),2) . '</b><hr></td> + <td class=number><hr><b>' . number_format($TaxTotal+($_SESSION['CreditItems']->total + $_SESSION['CreditItems']->FreightCost),$_SESSION['CreditItems']->CurrDecimalPlaces) . '</b><hr></td> </tr></table>'; } $DefaultDispatchDate = Date($_SESSION['DefaultDateFormat']); @@ -504,7 +507,6 @@ $Result = DB_query($SQL,$db); $myrow = DB_fetch_row($Result); - /*Do some rounding */ $_SESSION['CreditItems']->total = round($_SESSION['CreditItems']->total,2); @@ -1442,9 +1444,9 @@ echo '<div class="centre">'._('Credit Note number') . ' ' . $CreditNo . ' ' . _('has been processed'); if ($_SESSION['InvoicePortraitFormat']==0){ - echo "<br /><a href='". $rootpath . "/PrintCustTrans.php?" . SID . "&FromTransNo=" . $CreditNo . "&InvOrCredit=Credit&PrintPDF=True'>" . _('Print this credit note') . '</a>'; + echo '<br /><a href="' . $rootpath . '/PrintCustTrans.php?FromTransNo=' . $CreditNo . '&InvOrCredit=Credit&PrintPDF=True">' . _('Print this credit note') . '</a>'; } else { - echo "<br /><a href='". $rootpath . "/PrintCustTransPortrait.php?" . SID . "&FromTransNo=" . $CreditNo . "&InvOrCredit=Credit&PrintPDF=True'>" . _('Print this credit note') . '</a>'; + echo '<br /><a href="' . $rootpath . '/PrintCustTransPortrait.php?FromTransNo=' . $CreditNo . '&InvOrCredit=Credit&PrintPDF=True">' . _('Print this credit note') . '</a>'; } echo '</div>'; /*end of process credit note */ @@ -1452,21 +1454,22 @@ } else { /*Process Credit NOT set so allow inputs to set up the credit note */ - echo "<br><table class=selection>"; + echo '<br /><table class=selection>'; - echo '<tr><td>' . _('Credit Note Type') . "</td><td><select tabindex=".$j." name=CreditType>"; + echo '<tr><td>' . _('Credit Note Type') . '</td> + <td><select tabindex=' . $j .' name="CreditType">'; - if (!isset($_POST['CreditType']) OR $_POST['CreditType']=="Return"){ + if (!isset($_POST['CreditType']) OR $_POST['CreditType']=='Return'){ echo '<option selected value="Return">' . _('Goods returned to store') . '</option>'; - echo '<option VALUE="WriteOff">' . _('Goods written off') . '</option>'; - echo '<option VALUE="ReverseOverCharge">' . _('Reverse overcharge') . '</option>'; + echo '<option value="WriteOff">' . _('Goods written off') . '</option>'; + echo '<option value="ReverseOverCharge">' . _('Reverse overcharge') . '</option>'; } elseif($_POST['CreditType']=='WriteOff') { echo '<option selected value="WriteOff">' . _('Goods written off') . '</option>'; - echo '<option VALUE="Return">' . _('Goods returned to store') . '</option>'; - echo '<option VALUE="ReverseOverCharge">' . _('Reverse overcharge') . '</option>'; + echo '<option value="Return">' . _('Goods returned to store') . '</option>'; + echo '<option value="ReverseOverCharge">' . _('Reverse overcharge') . '</option>'; } else { - echo '<option VALUE="WriteOff">' . _('Goods written off') . '</option>'; - echo '<option VALUE="Return">' . _('Goods returned to store') . '</option>'; + echo '<option value="WriteOff">' . _('Goods written off') . '</option>'; + echo '<option value="Return">' . _('Goods returned to store') . '</option>'; echo '<option selected value="ReverseOverCharge">' . _('Reverse overcharge') . '</option>'; } echo '</select></td></tr>'; @@ -1478,7 +1481,7 @@ echo '<tr><td>' . _('Goods returned to location') . '</td><td><select tabindex='.$j.' name=Location>'; - $SQL='SELECT loccode, locationname FROM locations'; + $SQL="SELECT loccode, locationname FROM locations"; $Result = DB_query($SQL,$db); if (!isset($_POST['Location'])){ @@ -1487,24 +1490,24 @@ while ($myrow = DB_fetch_array($Result)) { if ($_POST['Location']==$myrow['loccode']){ - echo "<option selected VALUE='" . $myrow['loccode'] . "'>" . $myrow['locationname']; + echo '<option selected value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } else { - echo "<option VALUE='" . $myrow['loccode'] . "'>" . $myrow['locationname']; + echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } } - echo "</select></td></tr>"; + echo '</select></td></tr>'; $j++; } elseif($_POST['CreditType']=='WriteOff') { /* the goods are to be written off to somewhere */ - echo '<tr><td>' . _('Write off the cost of the goods to') . '</td><td><select TABINDEX='.$j.' name="WriteOffGLCode">'; + echo '<tr><td>' . _('Write off the cost of the goods to') . '</td><td><select tabindex=' . $j .' name="WriteOffGLCode">'; - $SQL='SELECT accountcode, + $SQL="SELECT accountcode, accountname - FROM chartmaster, accountgroups - WHERE chartmaster.group_=accountgroups.groupname - AND ccountgroups.pandl=1 ORDER BY chartmaster.accountcode'; - + FROM chartmaster, accountgroups + WHERE chartmaster.group_=accountgroups.groupname + AND ccountgroups.pandl=1 ORDER BY chartmaster.accountcode"; + $Result = DB_query($SQL,$db); while ($myrow = DB_fetch_array($Result)) { @@ -1521,8 +1524,8 @@ $_POST['CreditText'] = ''; } $j++; - echo '<tr><td>' . _('Credit note text') . '</td><td><textarea tabindex='.$j.' name=CreditText cols=31 rows=5>' . $_POST['CreditText'] . '</textarea></td></tr>'; - echo '</table><br><div class="centre"><input TABINDEX='.$j.' type=submit name=Update Value=' . _('Update') . '><p>'; + echo '<tr><td>' . _('Credit note text') . '</td><td><textarea tabindex=' . $j . ' name=CreditText cols=31 rows=5>' . $_POST['CreditText'] . '</textarea></td></tr>'; + echo '</table><br /><div class="centre"><input tabindex=' . $j . ' type=submit name=Update Value=' . _('Update') . '><p>'; $j++; echo '<input type="submit" tabindex='.$j++.' name="ProcessCredit" Value="' . _('Process Credit') .'"></div>'; } Modified: trunk/Currencies.php =================================================================== --- trunk/Currencies.php 2011-05-02 10:33:55 UTC (rev 4560) +++ trunk/Currencies.php 2011-05-03 10:05:05 UTC (rev 4561) @@ -1,7 +1,6 @@ <?php -/* $Revision: 1.20 $ */ + /* $Id$*/ -//$PageSecurity = 9; include('includes/session.inc'); $title = _('Currencies Maintenance'); @@ -141,7 +140,7 @@ if ($myrow[0] > 0) { prnMsg(_('Cannot delete this currency because customer accounts have been created referring to this currency') . - '<br>' . _('There are') . ' ' . $myrow[0] . ' ' . _('customer accounts that refer to this currency'),'warn'); + '<br />' . _('There are') . ' ' . $myrow[0] . ' ' . _('customer accounts that refer to this currency'),'warn'); } else { $sql= "SELECT COUNT(*) FROM suppliers WHERE suppliers.currcode = '".$SelectedCurrency."'"; $result = DB_query($sql,$db); @@ -149,14 +148,14 @@ if ($myrow[0] > 0) { prnMsg(_('Cannot delete this currency because supplier accounts have been created referring to this currency') - . '<br>' . _('There are') . ' ' . $myrow[0] . ' ' . _('supplier accounts that refer to this currency'),'warn'); + . '<br />' . _('There are') . ' ' . $myrow[0] . ' ' . _('supplier accounts that refer to this currency'),'warn'); } else { $sql= "SELECT COUNT(*) FROM banktrans WHERE banktrans.currcode = '" . $SelectedCurrency . "'"; $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); if ($myrow[0] > 0){ prnMsg(_('Cannot delete this currency because there are bank transactions that use this currency') . - '<br>' . ' ' . _('There are') . ' ' . $myrow[0] . ' ' . _('bank transactions that refer to this currency'),'warn'); + '<br />' . ' ' . _('There are') . ' ' . $myrow[0] . ' ' . _('bank transactions that refer to this currency'),'warn'); } elseif ($FunctionalCurrency==$SelectedCurrency){ prnMsg(_('Cannot delete this currency because it is the functional currency of the company'),'warn'); } else { @@ -216,17 +215,17 @@ } if ($myrow[1]!=$FunctionalCurrency){ - printf("<td><img src=\"%s\"></td> + printf('<td><img src="%s"></td> <td>%s</td> <td>%s</td> <td>%s</td> <td>%s</td> <td class=number>%s</td> <td class=number>%s</td> - <td><a href=\"%s&SelectedCurrency=%s\">%s</a></td> - <td><a href=\"%s&SelectedCurrency=%s&delete=1\">%s</a></td> - <td><a href=\"%s/ExchangeRateTrend.php?%s\">" . _('Graph') . "</a></td> - </tr>", + <td><a href="%s&SelectedCurrency=%s">%s</a></td> + <td><a href="%s&SelectedCurrency=%s&delete=1">%s</a></td> + <td><a href="%s/ExchangeRateTrend.php?%s">' . _('Graph') . '</a></td> + </tr>', $ImageFile, $myrow[1], $myrow[0], @@ -234,23 +233,23 @@ $myrow[3], number_format($myrow[4],5), number_format(GetCurrencyRate($myrow[1],$CurrencyRatesArray),5), - $_SERVER['PHP_SELF'] . '?' . SID, + $_SERVER['PHP_SELF'] . '?', $myrow[1], _('Edit'), - $_SERVER['PHP_SELF'] . '?' . SID, + $_SERVER['PHP_SELF'] . '?', $myrow[1], _('Delete'), $rootpath, - SID . '&CurrencyToShow=' . $myrow[1]); + '&CurrencyToShow=' . $myrow[1]); } else { - printf("<td><img src=\"%s\"></td> + printf('<td><img src="%s"></td> <td>%s</td> <td>%s</td> <td>%s</td> <td>%s</td> <td class=number>%s</td> <td colspan=4>%s</td> - </tr>", + </tr>', $ImageFile, $myrow[1], $myrow[0], @@ -261,19 +260,19 @@ } } //END WHILE LIST LOOP - echo '</table><br>'; + echo '</table><br />'; } //end of ifs and buts! if (isset($SelectedCurrency)) { - echo '<div class="centre"><a href=' .$_SERVER['PHP_SELF'] . '?' . SID. '>'._('Show all currency definitions').'</a></div>'; + echo '<div class="centre"><a href="' .$_SERVER['PHP_SELF'] . '">'._('Show all currency definitions').'</a></div>'; } -echo '<br>'; +echo '<br />'; if (!isset($_GET['delete'])) { - 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'] . '" />'; if (isset($SelectedCurrency) AND $SelectedCurrency!='') { @@ -300,12 +299,11 @@ - echo '<input type="hidden" name="SelectedCurrency" VALUE="' . $SelectedCurrency . '">'; - echo '<input type="hidden" name="Abbreviation" VALUE="' . $_POST['Abbreviation'] . '">'; + echo '<input type="hidden" name="SelectedCurrency" value="' . $SelectedCurrency . '">'; + echo '<input type="hidden" name="Abbreviation" value="' . $_POST['Abbreviation'] . '">'; echo '<table class=selection><tr> <td>' . _('ISO 4217 Currency Code').':</td> - <td>'; - echo $_POST['Abbreviation'] . '</td></tr>'; + <td>' . $_POST['Abbreviation'] . '</td></tr>'; } else { //end of if $SelectedCurrency only do the else when a new record is being entered if (!isset($_POST['Abbreviation'])) {$_POST['Abbreviation']='';} @@ -316,27 +314,35 @@ echo '<tr><td>'._('Currency Name').':</td>'; echo '<td>'; - if (!isset($_POST['CurrencyName'])) {$_POST['CurrencyName']='';} + if (!isset($_POST['CurrencyName'])) { + $_POST['CurrencyName']=''; + } echo '<input ' . (in_array('CurrencyName',$Errors) ? 'class="inputerror"' : '' ) .' type="text" name="CurrencyName" size=20 maxlength=20 VALUE="' . $_POST['CurrencyName'] . '">'; echo '</td></tr>'; echo '<tr><td>'._('Country').':</td>'; echo '<td>'; - if (!isset($_POST['Country'])) {$_POST['Country']='';} + if (!isset($_POST['Country'])) { + $_POST['Country']=''; + } echo '<input ' . (in_array('Country',$Errors) ? 'class="inputerror"' : '' ) .' type="text" name="Country" size=30 maxlength=50 VALUE="' . $_POST['Country'] . '">'; echo '</td></tr>'; echo '<tr><td>'._('Hundredths Name').':</td>'; echo '<td>'; - if (!isset($_POST['HundredsName'])) {$_POST['HundredsName']='';} - echo '<input ' . (in_array('HundredsName',$Errors) ? 'class="inputerror"' : '' ) .' type="text" name="HundredsName" size=10 maxlength=15 VALUE="'. $_POST['HundredsName'].'">'; + if (!isset($_POST['HundredsName'])) { + $_POST['HundredsName']=''; + } + echo '<input ' . (in_array('HundredsName',$Errors) ? 'class="inputerror"' : '' ) .' type="text" name="HundredsName" size=10 maxlength=15 value="'. $_POST['HundredsName'].'">'; echo '</td></tr>'; echo '<tr><td>'._('Exchange Rate').':</td>'; echo '<td>'; - if (!isset($_POST['ExchangeRate'])) {$_POST['ExchangeRate']='';} - echo '<input ' . (in_array('ExchangeRate',$Errors) ? 'class="inputerror"' : '' ) .' type="text" class=number name="ExchangeRate" size=10 maxlength=9 VALUE='. $_POST['ExchangeRate'].'>'; + if (!isset($_POST['ExchangeRate'])) { + $_POST['ExchangeRate']=''; + } + echo '<input ' . (in_array('ExchangeRate',$Errors) ? 'class="inputerror"' : '' ) .' type="text" class=number name="ExchangeRate" size=10 maxlength=9 value='. $_POST['ExchangeRate'].'>'; echo '</td></tr>'; echo '</table>'; - echo '<br><div class="centre"><input type="Submit" name="submit" value='._('Enter Information').'></div>'; + echo '<br /><div class="centre"><input type="Submit" name="submit" value='._('Enter Information').'></div>'; echo '</form>'; Modified: trunk/Locations.php =================================================================== --- trunk/Locations.php 2011-05-02 10:33:55 UTC (rev 4560) +++ trunk/Locations.php 2011-05-03 10:05:05 UTC (rev 4561) @@ -374,7 +374,6 @@ printf('<td>%s</td> <td>%s</td> <td>%s</td> - <td>%s</td> <td><a href="%sSelectedLocation=%s">' . _('Edit') . '</td> <td><a href="%sSelectedLocation=%s&delete=1">' . _('Delete') . '</td> </tr>', @@ -449,8 +448,8 @@ $_POST['Managed'] = $myrow['managed']; - echo '<input type="hidden" name="SelectedLocation" value="' . $SelectedLocation . '>'; - echo '<input type="hidden" name="LocCode" value="' . $_POST['LocCode'] . '>'; + echo '<input type="hidden" name="SelectedLocation" value="' . $SelectedLocation . '">'; + echo '<input type="hidden" name="LocCode" value="' . $_POST['LocCode'] . '">'; echo '<table class="selection">'; echo '<tr><th colspan=2><font size=3 color=blue>'._('Amend Location details').'</font></th></tr>'; echo '<tr><td>' . _('Location Code') . ':</td><td>'; Added: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log (rev 0) +++ trunk/doc/Change.log 2011-05-03 10:05:05 UTC (rev 4561) @@ -0,0 +1,3271 @@ +webERP Change Log + +3/5/11 Locations.php fix table hidden POST variable quotes mismatch - also mismatch between number of parameters in printf output +2/5/11 Make order entry show the currency decimal places for amounts and totals also in invoicing SelectOrderItems.php and ConfirmDispatch_Invoice.php +2/5/11 Fix PO_PDFPurchOrder.php to allow emailing but email option not to appear on printed/emailed orders +1/5/11 Tim PageSecurity.php fix bug that prevented updates to Security Token for a particular script. +1/5/11 Many scripts quoting changes single quotes for strings double quotes for xhtml variables +1/5/11 SecuirtyTokens allow deletion of tokens if no scripts using it +28/4/11 Tim - add facility to select an account group to limit GL acccounts returned as options to post payments to +28/4/11 Tim - new SecurityTokens script +28/4/11 Fix Secunia reported vulnerability by checking for dodgy characters in CompanyNameField - then matched to a real directory on the web-server + +18/4/11 - Version 4.03.8 Release + +18/4/11 Phil: Update zh_HK.utf8, pt_BR.utf8, fa_IR.utf8 from launchpad translations +18/4/11 Phil: Changed PurchData.php back to now have free form text entry of unit of measure - as suggested by Brian May - think it works better this way +18/4/11 Phil: Removed redundant fields that are not used anywhere from DefinePOClass and the various function to add lines to purchase orders and to update purhcase order lines - netweight, cuft, kgs, itemno, total_quantity etc. all this data can be retrieved without duplication in purchorderdetails +16/4/11 Phil: Tim's changes in launchpad fork to 4663 - xhtml syntax fixes +15/4/11 Phil: Copy Exson's traditional Chinese back to zh_HK.utf8 +11/4/11 Ricard: new pcAuthorizeExpenses.php that shows the current balance of the tab to the authorizer. Before the authorizer did not see this information. +11/4/11 Tim: StockLocTransfer.php added $_POST['LinesCounter'] -= 10; +11/4/11 Tim/Phil: Use PHP 5 specific scandir to sort languages into alphabetic order for UserSettings and WWW_Users language selection +10/4/11 Tim: AddCustomerContacts.php use single field rather than * in SQL> +10/4/11 Tim: GLAccountInquiry.php show None if no tag selected +10/4/11 Tim : PDFPrintLabel.php javascript fix +10/4/11 Tim: Add perishable to StockTransfer.php and PDFStockTransfer +10/4/11 Tim: PDFPeriodStockTransListing - new report to print off stock transactions of a specified type for a selected period>/p> +10/4/11 Tim: PDFStockTransListing.php option to print off transactions by inventory location +10/4/11 Tim: Stocks.php - more logical use of $New and $_POST['New'] +10/4/11 Tim: Payments.php PaymentMethods.php Add new field userpreprintedstationery to payment methods to determine whether to print cheques +5/4/11 Tim: includes/LanguageSetup.php - discovered solution to Turkish character set problem!! +5/4/11 Phil: couple of is_date functions left over from experiment to see if changing fixed Turkish - now removed from SupplierInvoice.php and PDFOrdersInvoiced.php +5/4/11 Phil: SuppCreditGRNs was not showing old GRNs and no way to input an older date +31/3/11 Phil:Fix link to create purchase order from purchasing data link on SelectProduct.php - thanks Brian May for pointing out the bug +31/3/11 Phil: Updated all tranlations from the launchpad site +31/3/11 Tim: Fix to make languages display immediately on change - session.inc moved includes/LanguageSetup.php down +30/3/11 Tim: New ReprintGRN.php script takes a purchase order and allows any line received to have GRN(s) reprinted +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 /> +27/3/11 - Version 4.03.5 Release + +27/3/11: Phil fixed SQL upgrade script to add the Z_ChangeSupplierCode.php script is added to the scripts table +27/3/11: Phil fixed some SQL for ansi compatibility I had changed in error - would affect users running strict mode ansi +27/3/11: Phil at Brian May's suggestion added conversion factor to item look up in PO_Items.php - also ensured quantity entry no longer trapped for commas and commas removed from numbers before committing. Also trapped for committing purchase orders with no lines + +26/3/11 - Version 4.03 Release + +26/3/11: Phil added some error trapping to codes of pcTabTypes +24/3/11: Phil rework PDFStockTransfer.php remove a few round trips to DB and added facility to be able to select a transfer number to reprint - added to main menu +24/3/11: James wer...@ya... Added snall image in middle of SelectProduct.php +19/3/11: Phil added country to packing slips +18/3/11: Marcos Garcia Trejo Added Z_ChangeSupplierCode.php +18/3/11: Ricard add orderby transdate to DailyBankTransactions.php +18/3/11: Phil check for Customers.php CustomerBranches.php and Stocks.php now traps codes containing spaces - as well as other illegal characters +15/3/11: Phil PricesByCost.php - made it update prices where there is already a price starting on today's date +15/3/11: Phil SelectOrderItems.php customer selection now done using a hidden $_POST rather than parsing debtorno hyphen branchcode. +15/3/11: Phil Locations.php new field for CounterSales branch code - instead of parsing it from a single field with a hyphen in it. CounterSales.php now uses the new field for customer branch +14/3/11: Phil SelectSalesOrder.php now lists with sales order value denominated in functional currency with total of listed outstadning sales orders (or quotations) shown at the bottom of the listing +12/3/11: Tim Now allow space in codes +12/3/11: SelectSalesOrder.php now allows any number of sales orders to be selected and purchase orders placed for the aggregate of items on the selected sales orders +12/3/11: SuppPriceList.php removed a round trip to DB to get currency - fixed function to get pdf to new TCPDF Output +12/3/11: Exson fix all htmlentities to use ENTQUOTES, 'UTF-8' option so other character sets work with it +10/3/11: Phil fix pagination of PrintCustOrder_generic.php - second copy was not restarting page numbers +10/3/11: Tims launchpad fixes brought in MRP.php fix for table charset utf8 so joins work correctly; typeo in PO_Header preventing purchasing data being retrieved ($result not $Result); correct sql on searching for customer in SelectCreditItems.php; StockStatus.php pricing history bug resolved (4450); StockQuantityByDate.php now allowed to show for all categories - enclosed 'All' in gettext +8/3/11: Tim/Phil PO_Items.php in committing an order detail the assetid of 'Not an Asset' was being inserted to an integer field. Modified $_POST['AssetID'] to = 0 if it was 'Not an Asset' as advised by Tim +8/3/11: Phil fix SalesAnalysis reports for TCPDF as reported by Joe Zhou +5/3/11: Kovács Attila fix to Stocks.php to use ANSI GROUP BY for aggregate functions SQL +5/3/11: Kovács Attila fix to LanguageSetup.php to use utf-8 not ISO-8859-1. Phil hardcoded UTF-8 now as no dynamic changing of character set required all translations are utf-8 +3/3/11: Exson/Baran/Phil fix to customer login to ensure that other customers orders are not displayed when searching by customer ref or order no +3/3/11: Tim launchpad mods to revision 4441 including change to allow supplier currency to be changed if there are no transactions already against the supplier. Ensure credit note session variable is unset before attempting to create a new credit note from the supplier form. Tim's work to add perisable expiry dates to the serial items logic - affects quite a few scripts. Headings to stock check script even if no quantity is shown. Portrait quotations. Not included change to default delivery date to the date the customer requested - left to be the current day's date. Not included Tim's unit pricing work .. yet launchpad revisions 4442-4447 inclusive +27/2/11: Phil/Tim/Peter launchpad added category option for MRPShortages.php links with matching quotes in WorkOrderEntry +27/2/11: Phil StockUsage.php now totals usage each month even in months where there was none - average now includes months with no usage +27/2/11: Phil fix units deletion issue reported by Exson in UnitsOfMeasure.php script - checked for none existant units field in contracts table - removed the check +22/2/11: Phil fix PDFTopItems.php for changed variable names - now using CamelCase tried to rework to conform +22/2/11: Phil remove options for PDFLanguage that are not unique in WWW_Users.php - make it default to the users settings in the SESSION for UserSettings.php +18/2/11: Phil/Don Change PageSecurity array variable name to PageSecurityArray - caused problems with conflict with PageSecurity variable where register_globals = on; +18/2/11: PO_Items.php make number_format variables turn back into numbers for > 1000 +16/2/11: FixedAssetItems.php now checks for location before allowing additions +16/2/11: Company preferences - changed wording of stock integration at cost removed the word standard as suggested by Exson +16/2/11: SelectCreditItems.php formating/conventions lower case html and CreditInvoice.php +15/2/11: Phil Make invoicing warn the user when no taxes are defined for a tax group - i.e. there is a configuration error with taxes +<p /> +15/2/11 Release 4.03RC2 +<p /> +15/2/11: Phil UpgradeDatabase.php fix to upgrade from 4.01RC1 !! +15/2/11: Phil PrintCustTrans.php and PrintCustTransPortrait.php htmlspecialchars_decode($narrative) - conversion at the time of committing to DB needs to be unconverted. Also in ConfirmDispatch_Invoice.php +15/2/11: Phil SelectCustomer.php removed showing blank message when $msg was empty +<p /> +13/2/11 Release 4.03RC1 +<p /> +13/2/11:Phil GoodsReceivedControlled InputSerialItems and friends - now uses session identifier to ensure uniqueness is several people entering stock receipts +13/2/11:Phil Contracts.php SelectOrderItems.php customer selection mechanism reworked - was causing issues in Contracts as noted by DK Shukla +8/2/11: Tim Rework CounterSales.php so that it is now possible to sell items that have sales/purchasing tax +8/2/11: Phil Fix InventoryPlanning and InventoryPlanningPrefSupplier to only show sales order demand - excluding quotations. Also fixed for conversionfactor as now all purchase order quantities are in our normal stock units +8/2/11: Phil Fix incorrect layout of narrative on multiple lines of PDFQuotation.php as reported by Ricard Andreu +8/2/11: Tim/Ricard StockLocTransfer.php can now transfer the same amount as on hand in the location - previously checked to see that the transfer was less than the quantity on hand (when checking for negative stock) +8/2/11: Tim Payments.php and javascripts/MiscFunctions.js corrections to javascript +8/2/11: Phil PDFGrn.php turns out preview is used from the form modification script doh! Over simplificaton reversed to reinstate preview mode +6/2/11: Otandeka Removed debug prnMsg in FixedAssetDepreciation +5/2/11: Phil SystemParameters.php new option to AutoAuthorisePO when the user has authority to do so +5/2/11: Phil PO_Items.php fixed non-existant variables on Enter nominal line. Added option to automatically authorise when user is an authoriser as well as a creator +5/2/11: Phil PDFGrn.php rewrote - preview never used - simplified +4/2/11: Tim CostUpdate.php allow cost update with appropriate permissions token 10 hard coded +4/2/11: Phil SelectCustomer.php rejig selection options in more logical way. Used non-specific SQL to search by any part of the address +2/2/11: Phil PDFTopItems.php and TopItems.php removed mysql specific SQL +30/1/11: Phil GoodsReceived.php rework for supplier units and conversion factor etc now in PO class +30/1/11: Phil PDFGrn.php rework for supplier units and conversion factor etc now in PO class +30/1/11:Exson changed PDFLowGP report remove % from gettext string +29/1/11:Tim fix reportwriter with tcpdf using parent::__construct rather than $this->Cpdf( +24/1/11:Phil Depreciation fixes - SelectAsset by description fix +23/1/11:Peter Otandeka: PDFTopItems.php SQL quoting fixes +23/1/11: Phil Fix Depreciation posting and dates of end of periods +23/1/11:Phil changed back references throughout several MRP scripts from is_date to Is_Date - as Is_Date is used throughout the code and much bigger job to change all references to is_date +20/1/11: Tim changed back addinfo calls to addInfo on PDF reports - Zhigio originally thought to be an issue with Turkish utf-8 pdfs but turned out to be a red herring. class.pdf call changed back to addInfo too - most of calls had not been changed to lower case info +20/1/11: Tim changed PricesBasedOnMarkUp to have end date day before new prices effective from +20/1/11: Phil FixedAssetRegister.php FixedAssetDepreciation.php fixes +19/1/11: Phil modified GLBudgets.php to allow entry of last years budget too +17/1/11: Phil More purchasing work removing redundant queries rationalising code - new layout with supplier units +15/1/11: Tim removed MX record check from IsEmail function in includes/MiscFunctions.php +15/1/11: Tim/Peter Otandeka SQL quoting a whole bunch of scripts - changing single quotes to doubles - didn't apply ones where no variables required quoting +14/1/11: Phil install scripts modified to copy over FormDesigns under the new company directory created +14/1/11: Phil Updates to manual for security and supplier invoice entry +13/1/11:Phil PO_Items.php remove redundant code, setup entry of lines in supplier units +13/1/11:Tim Z_ChangeCustomerCode.php now has foreign key checks defeated when deleting the old customer record and custbranch record +13/1/11:Phil SupplierInvoice.php and SupplierCredit.php now check to ensure the total of contracts fixed asset charges goods received charges, shipment charges and GL charges are at least equal to the amount of the invoice or credit. It was possible when GL interface turned off to get strange results +12/1/11:Phil DailyBankTransactions.php made it so a range of dates can be selected but defaults to just today +11/1/11:Phil Fix choice of portrait or landscape invoices - fix landscape default form layout. Fix portrait invoice logo position +11/1/11:Phil Fix customer transaction inquiries to show correct links where user is not authorised for credit notes or GL inquiries +11/1/11:Phil SupplierCredit.php and SupplierInvoice.php recalculate price variance to post differences on fixed asset additions correctly +11/1/11:Phil PO_PDFPurchOrder.php - fixed for coding conventions removed uneccessary sql calls +11/1/11: Murray Collingwood: Emailing invoices was writing the pdf file twice - once with fwrite and once with the TCPDF output function with the option 'F' +8/1/11 Ricard Andreu: Z_ChangeCustomerCode.php added typeid field that made change customer code fail. Also corrected typo for foreign key checking side stepping for Z_ChangeBranchCode.php +5/1/11 Phil: Bug fixes AssetLocationTransfer and Supplier Contacts +4/1/11 Paul T: Bug# 3151192 - insert underscore for superglobal. +5/1/11 Phil: Bug fixes AssetLocationTransfer and Supplier Contacts +4/1/11 Phil: Start rework of purchase order scripts ... again. +4/1/11 Phil: Select Purchase orders now defaults to just pending and authorised/printed - other statii are options +1/1/11 Phil: Upgrade script make capable of upgrades from any earlier version - and email a backup to the user. Deleted DBUpgradeNumber config variable now use the VersionNumber already there +31/12/10 Tim: Tidy up of CounterSales.php - CamelCasing, quoting SQL, closing slashes in xhtml tags +29/12/10 Phil: Reverted to single SQL upgrade file per release - but retaining Tim's upgrade mechanism if the DBUpgradeNumber is out of date. Removed pseudo SQL language required for upgrade script and the 52 update files - just applies plain vanilla SQL from the scripts required +29/12/10 Tim: DB upgrade mechanism with separate pseudo SQL for each database change in a separate file + 52 files of updates since 3.11.4 +21/12/10 Phil : Reworked PDFPrintLabels.php to conform to standards and corrected SQL for prices +21/12/10 Ricard Andreu: PDFPrintLabels.php was not checking for end date of prices - fixed +19/12/10 Phil: SelectOrderItems.php ConfirmDispatch_Invoice.php add code to handle asset disposals. +14/12/10 Phil: modify purchasing scripts for coding conventions/readability +11/12/10 Phil: Have populated the new field stockcheckdate in stockcheckfreeze and modified PDFStockCheckComparison to use this field when posting the GL - stockmoves need to be on the current day otherwise historical balances will all need to be updated. But narrative shows the date of the stock check for which the adjustment is being made +9/12/10 James Murray: highlighted a bug in SupplierInvoice.php (and also in SupplierCredit.php) where the due date of the invoice/credit was not calculated correctly based on the terms - it was picking up the current date rather than the invoice/credit date. Now fixed +8/12/10 James Murray: fixed bug in SuppPaymentRun.php - was not showing anything as the test to see if there was anything to see was using a non-existant result set! +3/12/10 Matt Elbrecht : Estonian translation +30/11/10 Phil: Changed table structure of new fixedassettrans and modified upgrade script - those who already ran that bit will need to change the table again. Modified fixed asset scripts again. New fixed assets manual +28/11/10 Exson: CreditStatus.php - Fix bug in sql statement +28/11/10 Tim: OutstandingGRNs.php - Only show when the invoiced qty is less than the GRN qty +28/11/10 Phil: All fixed asset scripts SupplierInvoice.php SupplierCredit.php SuppFixedAssetChgs.php - adding fixed assets directly from invoice charges - and reversing additions with credit notes. Also FixedAssetRegister.php report to print PDF or export CSV of fixed assets now includes date range depreciation and b/fwd cost b/fwd accum depn and c/fwd cost and accum depn - and NBV +28/11/10 James Murray: unset session in ConnectDB_mysqli.inc and ConnectDB_mysql.inc when the login fails +27/11/10 Phil: install/index.php check for critical requirements before allowing install to proceed +27/11/10 Phil: includes/DefinePOClass.php change variable to camel case also PO_Header.php PO_Items.php PO_ReadInOrder.inc GoodsReceived.php - scope for error needs lots of testing please +27/11/10 Phil: PurchData - fix MinOrderQty error trapping with appropriate text and default to 1 +27/11/10 Phil: SupplierInvoice.php removed check on weighted average costing to reverse GRN suspense posting and set cost to zero - this was defeating the price variance calculation and the proper valuation of stock. Also took out of the calculations the conversionfactor - will need to alter goods received code to ensure only our units recorded in quantity received. +26/11/10 Tim: upgrade3.11.1-4.00.sql - Add default date for stockcheckdate field in stockcheckfreeze table +26/11/10 Otandeka: CounterSales.php - Fix bug in counter sales script. +24/11/10 Phil: GoodsReceived.php - modified to insert fixedassettrans and to post nominal POs to fixed asset cost account from fixedassetcategories.costact +23/11/10 Pak Ricard: MRP.php and MRPShortages.php fixed temporary tables to use utf-8 - code failed without probably depends on mysql server settings +21/11/10 Phil:Rewritten FixedAssetJournal.php - renamed FixedAssetDepreciation.php +20/11/10 Phil: Rewritten FixedAssetItems.php FixedAssetCategories.php and modified FixedAssetLocations.php to use the new structure +18/11/10 Tim: upgrade3.11.1-4.00.sql - Fix sql syntax errors brought in on recent changes. +14/11/10 Phil: SelectAsset.php script reworked SelectAssetType.php script now deleted +08/11/10 Exson: Z_ImportStocks.php - Bug fixes. +06/11/10 Phil: ShiptChgs.php - made a check to ensure a shipment reference entered manully actually exists before it is added - otherwise a nasty error occurs on commital of the invoice +06/11/10 Paul T: InputSerialItemsSequential.php - Bug# 3080130 - Add new FormID to form. (and minor cleanup) +06/11/10 Tim: ReorderLevelLocation.php - Remove fixed assets from selections +06/11/10 Tim: ReorderLevel.php - Remove fixed assets from selections +06/11/10 Tim: InventoryQuantities.php - Remove fixed assets from selections +06/11/10 Tim: Selectproduct.php - Remove fixed assets from selections +06/11/10 Tim: InventoryValuation.php - Ensure fixed assets dont get shown in valuation report +06/11/10 Tim: FixedAssetItems.php - Fixed typo preventing Item code being shown +06/11/10 Phil: StockCategory.php FixedAssetCategory.php attempt to add validation to depreciation rates by extending the stock category property logic with new fields for numericvalue, minimumvalue and maximumvalue. Then adding the depreciation rate percentage property to expect numeric values with a minimum of 0 and maximum of 100. +05/11/10 Tim: PurchData.php. Converted field name to lower case for consistency +05/11/10 Tim: SelectProduct.php. Change the standard order quantities to agree with Minimum order qty +05/11/10 Tim: PurchData.php. Make the Minimum order quantity field numeric only +05/11/10 Poul Bjerre-Jensen: SelectProduct.php,PurchData.php. Add in Minimum order quantity to Purchasing data +02/11/10 Tim: SelectCustomer.php. Correction to work with debtors that have a - in the code +31/10/10 Tim: SuppTransGLAnalysis.php. Minor bug fixes +31/10/10 Tim: SuppTransGLAnalysis.php. Force the user to select a GL account code instaed of defaulting to first on the list +31/10/10 Tim: CustomerReceipt.php. Force the user to select a GL account code and a Bank Account instaed of defaulting to first on the list +29/10/10 Tim: index.php. If CustomerReceipt selected from the GL menu then go to GL receipts else customer receipts +29/10/10 Tim: Payments.php. Force the user to select a GL account code and a Bank Account instaed of defaulting to first on the list +29/10/10 Tim: GLJournal.php. Force the user to select a GL account code instaed of defaulting to first on the list +28/10/10 Tim: Fix bug # 3017709. When bulk transfers are received for controlled items serial numbers are required +28/10/10 Tim: PcExpensesTypeTab.php - SQL quoting corrections and layout changes and improvements +28/10/10 Tim: PcTabs.php - SQL quoting corrections and layout changes and improvements +28/10/10 Tim: PcTypeTabs.php - SQL quoting corrections and layout changes and improvements +27/10/10 Tim: PcReportTab.php - SQL quoting corrections and layout changes and improvements +27/10/10 Tim: PcClaimExpensesFromTab.php - SQL quoting corrections and layout changes and improvements +27/10/10 Tim: class.pdf.php - Fix bug in html_entity_decode() function call +27/10/10 d.k shukla: ManualPurchaseOrdering.html - Improvements to purchase ordering manual +27/10/10 Tim: WorkOrderEntry.php - When the quantities are changed, then the correct quantities are updated, and the date picker chooses the correct date. +27/10/10 Tim: header.inc - Correct for non ascii characters +27/10/10 Tim: Corrections to display multi line invoice narratives correctly +26/10/10 Tim: Discountmatrix.php - Fix discount category bug +26/10/10 Tim: Discountmatrix.php - Increase the number of decimal places that can be entered +26/10/10 Tim: StockLocTransfer.php - Check there is sufficient stock for the transfer +25/10/10 Marcos Garcia Trejo: New labelprinting functionality +25/10/10 ChenJohn: class.pdf.php - correctly display some html encoded special characters, to make them human readeable in pdf file. +23/10/10 Phil: PurchData.php - search by name failed concatenation of SQL stuffed now repaired. + +Version 4.0RC1 +22 October 2010 + +20/10/10 Paul: MiscFunctions.js - Bug #3060329. Correct condition check. [allows the calendar to start with the textbox's date] +18/10/10 Paul: WorkOrderReceive.php - Bug #3023776. Applied anonymous contribution. +16/10/10 Phil: SupplierInvocie.php fixed for mix up with commits - now shipment charges added correctly and contract charges also +14/10/10 Tim: MiscFunctions.php - Fix bug preventing download of ECB rates +13/10/10 Tim: WWW_Users.php - Show the last visit date correctly. Fixes bug 3085860 +09/10/10 Phil: Added xmlrpc_GetStockCategoryList api method +04/10/10 Matt Taylor: upgrade3.11.1-3.12.sql - Update tables to utf8 +03/10/10 Gabriel Olowo: ManualPurchaseOrdering.php - Manual for purchase ordering system +02/10/10 Tim: AuditTrail.php - Bug fixes and layout changes +02/10/10 Tim: DailySalesInquiry.php - Bug fixes and layout changes +02/10/10 Tim: session.inc - Corrections to sql quoting. Resolves bug 3023782 +02/10/10 Tim: ppdf_tpl.php - Make php 5.3 compatible +02/10/10 Tim: GLJournal.php - Fix to create a reversing journal even when non english language is used. +02/10/10 Tim: PDFGrnHeader.php - Show correct column headings. Fixes bug 3072507 +30/09/10 Tim: Add form verification to prevent form spoofing +30/09/10 Tim: WWW_Users.php - SQL quoting corrections and layout changes and improvements +30/09/10 Tim: WWW_Access.php - SQL quoting corrections and layout changes and improvements +29/09/10 Tim: WOSerialNos.php - SQL quoting corrections +29/09/10 Tim: WorkOrderStatus.php - SQL quoting corrections and layout changes and improvements +29/09/10 Tim: WorkOrderReceive.php - SQL quoting corrections and layout changes and improvements +29/09/10 Tim: WorkOrderIssue.php - SQL quoting corrections and layout changes and improvements +29/09/10 Tim: WorkOrderEntry.php - SQL quoting corrections and layout changes and improvements +28/09/10 Tim: WorkOrderCosting.php - SQL quoting corrections and layout changes and improvements +28/09/10 Tim: WorkCentres.php - SQL quoting corrections and layout changes and improvements +28/09/10 Tim: WhereUsedInquiry.php - SQL quoting corrections and layout changes and improvements +28/09/10 Tim: UserSettings.php - SQL quoting corrections and layout changes and improvements +28/09/10 Tim: UnitsOfMeasure.php - SQL quoting corrections and layout changes and improvements +28/09/10 Tim: TopItems.php - SQL quoting corrections and layout changes and improvements +28/09/10 Tim: TaxProvinces.php - SQL quoting corrections and layout changes and improvements +28/09/10 Tim: TaxGroups.php - SQL quoting corrections and layout changes and improvements +28/09/10 Tim: TaxCategories.php - SQL quoting corrections and layout changes and improvements +28/09/10 Tim: TaxAuthorityRates.php - SQL quoting corrections and layout changes and improvements +28/09/10 Tim: TaxAuthorities.php - SQL quoting corrections and layout changes and improvements +28/09/10 Tim: Tax.php - SQL quoting corrections and layout changes and improvements +28/09/10 Tim: SystemParameters.php - SQL quoting corrections and layout changes and improvements +28/09/10 Tim: SuppTransGLAnalysis.php - SQL quoting corrections and layout changes and improvements +28/09/10 Tim: SuppShiptCharges.php - Layout changes and improvements +28/09/10 Tim: SuppPriceList.php - Layout changes and improvements +27/09/10 Paul Thursby: Various default.css files -- Minor CSS corrections. +27/09/10 Tim: SuppPaymentRun.php - SQL quoting corrections and layout changes and improvements +27/09/10 Tim: SuppLoginSetup.php - SQL quoting corrections and layout changes and improvements +27/09/10 Tim: SupplierTypes.php - SQL quoting corrections and layout changes and improvements +27/09/10 Tim: SupplierTransInquiry.php - New script to show detail supplier transactions +27/09/10 Tim: SupplierTenders.php - SQL quoting corrections +27/09/10 Tim: Suppliers.php - SQL quoting corrections +27/09/10 Tim: SupplierInvoice.php - SQL quoting corrections and layout changes and improvements +27/09/10 Tim: SupplierInquiry.php - SQL quoting corrections and layout changes and improvements +27/09/10 Tim: SupplierCredit.php - SQL quoting corrections and layout changes and improvements +27/09/10 Tim: SupplierContacts.php - SQL quoting corrections and layout changes and improvements +27/09/10 Tim: SupplierBalsAtPeriodEnd.php - Layout changes and improvements +27/09/10 Tim: SupplierAllocations.php - SQL quoting corrections and layout changes and improvements +27/09/10 Tim: SuppInvGRNs.php - SQL quoting corrections and layout changes and improvements +27/09/10 Tim: SuppCreditGRNs.php - SQL quoting corrections and layout changes and improvements +27/09/10 Tim: StockUsage.php - Layout changes and improvements +26/09/10 Tim: StockTransfers.php - Layout changes and improvements +26/09/10 Tim: StockSerialItemResearch.php - Layout changes and improvements +26/09/10 Tim: StockReorderLevel.php - SQL quoting corrections and layout changes and improvements +26/09/10 Tim: StockQuantityByDate.php - SQL quoting corrections and layout changes and improvements +26/09/10 Tim: StockQties_csv.php - Layout changes and improvements +26/09/10 Tim: StockMovements.php - Layout changes and improvements +26/09/10 Tim: StockLocStatus.php - SQL quoting corrections and layout changes and improvements and bug fixes +26/09/10 Tim: StockDispatch.php - SQL quoting corrections and layout changes and improvements and bug fixes +26/09/10 Tim: StockCounts.php - SQL quoting corrections and layout changes and improvements and bug fixes +26/09/10 Tim: StockCostUpdate.php - SQL quoting corrections and layout changes and improvements and bug fixes +26/09/10 Tim: StockCategories.php - SQL quoting corrections and layout changes and improvements and bug fixes +26/09/10 Tim: SpecialOrder.php - SQL quoting corrections +25/09/10 Tim: SMTPServer.php - SQL quoting corrections +25/09/10 Tim: ShiptsList.php - Add script to show list of open shipments for selected supplier +25/09/10 Tim: Shipt_Select.php - SQL quoting corrections and layout changes and improvements and bug fixes +25/09/10 Tim: Shippers.php - SQL quoting corrections and layout changes and improvements and bug fixes +25/09/10 Tim: Shipments.php - SQL quoting corrections and layout changes and improvements and bug fixes +25/09/10 Tim: ShipmentCosting.php - SQL quoting corrections and layout changes and improvements and bug fixes +25/09/10 Tim: SelectWorkOrder.php - SQL quoting corrections and layout changes and improvements and bug fixes +24/09/10 Tim: SelectSalesOrder.php - Layout changes and improvements and bug fixes +24/09/10 Tim: SelectRecurringSalesOrder.php - Layout changes and improvements and bug fixes +24/09/10 Tim: SelectProduct.php - SQL quoting corrections +24/09/10 Tim: SelectOrderItems.php - SQL quoting corrections +24/09/10 Tim: SelectGLAccount.php - SQL quoting corrections and layout changes and improvements and bug fixes +24/09/10 Tim: SelectCustomer.php - Layout changes and improvements and bug fixes +24/09/10 Tim: SelectCreditItems.php - SQL quoting corrections and layout changes and improvements and bug fixes +23/09/10 Tim: SelectAssetType.php - SQL quoting corrections and layout changes and improvements +23/09/10 Tim: SalesTypes.php - SQL quoting corrections and layout changes and improvements +23/09/10 Tim: SalesPeople.php - SQL quoting corrections and layout changes and improvements +23/09/10 Tim: SalesGraph.php - Fix deprecated use of assigning by reference +23/09/10 Tim: SalesGLPostings.php - SQL quoting corrections and layout changes and improvements +23/09/10 Tim: SalesCategories.php - SQL quoting corrections and layout changes and improvements +23/09/10 Tim: SalesAnalRepts.php - SQL quoting corrections and layout changes and improvements +23/09/10 Tim: SalesAnalReptCols.php - SQL quoting corrections and layout changes and improvements +23/09/10 Tim: ReverseGRN.php - SQL quoting corrections and layout changes and improvements +23/09/10 Tim: ReorderLevelLocation.php - SQL quoting corrections and layout changes and improvements +23/09/10 Tim: ReorderLevel.php - SQL quoting corrections and layout changes and improvements +23/09/10 Tim: RecurringSalesOrdersProcess.php - SQL quoting corrections +23/09/10 Tim: RecurringSalesOrders.php - SQL quoting corrections and layout changes and improvements +23/09/10 Tim: DateFunctions.inc - mktime() function without paramaeters is now deprecated, replaced with time() +20/09/10 Pak Ricard: PricesByCost.php - Restrict price changes to those stock items not discontinued +14/09/10 Tim: PurchData.php - SQL quoting corrections and layout changes and improvements +14/09/10 Tim: PrintSalesOrder_generic.php - SQL quoting corrections +14/09/10 Tim: PrintCustTransPortrait.php - SQL quoting corrections and layout changes and improvements +13/09/10 Tim: PrintCustTrans.php - SQL quoting corrections and layout changes and improvements +13/09/10 Tim: PrintStatements.php - Small bug fixes +13/09/10 Tim: PrintCustOrder_Generic.php - Correct the sql quoting +13/09/10 Tim: PrintCustOrder.php - Correct the sql quoting +13/09/10 Tim: PricesBasedOnMarkup.php - Correct the sql quoting, and various layout improvements and bug fixes +13/09/10 Tim: Prices_Customer.php - Correct the sql quoting, and various layout improvements and bug fixes +13/09/10 Tim: Prices.php - Correct the sql quoting, and various layout improvements and bug fixes +13/09/10 Tim: POReport.php - Format correctly for screen and add in option to export as a csv file +11/09/10 Tim: PO_SelectPurchOrder.php - Correct the sql quoting, and various layout improvements +11/09/10 Tim: PO_SelectOSPurchOrder.php - Correct the sql quoting +11/09/10 Tim: PO_PDFPurchOrder.php - Correct the sql quoting +11/09/10 Otandeka: PDFPriceList.php - Corrected undefined offset error +11/09/10 Phil: Manual changes - for utf-8 - language and PDFlanguage selection, also the installer and the new CounterSales.php script +10/09/10 Tim: PO_OrderDetails.php - Layout improvements, links to SelectSuppliers.php and sql quoting corrections +10/09/10 Tim: PO_Items.php - Layout improvements, and sql quoting corrections +10/09/10 Tim: PO_Header.php - Layout improvements, and sql quoting corrections +10/09/10 Tim: PO_AuthoriseMyOrders.php - Layout improvements, and sql quoting corrections +10/09/10 Tim: PO_AuthorisationLevels.php - Layout improvements, and sql quoting corrections +10/09/10 Tim: PeriodsInquiry.php - Layout improvements +10/09/10 ChenJohn: ConnectDB_mysql.inc ConnectDB_mysqli.inc fix utf-8 data being encoded/stored incorrectly in db server +08/09/10 Tim: PDFTopItems.php - Correct the sql quoting +08/09/10 Tim: PDFSuppTransListing.php - Screen layout improvements. Correct the sql quoting +08/09/10 Tim: PDFStockTransfer.php - Correct the sql quoting +08/09/10 Tim: PDFStockNegatives.php - Fix missing sql error message and correct the default date format in the heading +08/09/10 Tim: PDFStockCheckComparison.php - Screen layout improvements. Correct the sql quoting +07/09/10 Tim: PDFRemittanceAdvice.php - Correct the sql quoting +07/09/10 Tim: PDFReceipt.php - Correct the sql quoting +07/09/10 Tim: PDFQuotation.php - Correct the sql quoting +07/09/10 Tim: PDFPickingList.php - Correct the sql quoting +07/09/10 Tim: PDFOrderStatus.php - Improve report layout for readability +07/09/10 Tim: PDFOrderInvoiced.php - Improve report layout for readability +06/09/10 Tim: PO_Header.php - Move dummy status array from DefinePOClass.php +06/09/10 Tim: upgrade3.11.1-3.12.sql - Change syntax to work in both windows and linux +06/09/10 Tim: SupplierInvoice.php - Correct the roundings so that the double entry balances +05/09/10 Tim: PO_AuthoriseMyOrders.php - Update correct status when language not English +05/09/10 Tim: PcAssignCashToTab.php - Show authorised, notes, and receipt fields correctly. Changed to use DB_fetch_array() rather than DB_fetch_row(). +05/09/10 Tim: PDFStockTransListing.php - List stock transactions by transaction type. +05/09/10 Ricard: upgrade3.11.1-3.12.sql - Database changes required for changes to report writer. +31/08/10 Tim: StockLocTransfer.php - Change quantity input field to have more than 5 digits +28/08/10 Marcos Garcia Trejo: Fix ConfirmDispatchInvoice.php assembly components new qty on hand +27/08/10 Tim: Add in requisition number into purchase order prints. +21/08/10 Phil: Fix bugs introduced by Paul's patch prnMsg= should be prnMsg() BOMs.php also did in Contracts.php +21/08/10 Phil: Contract closing changes all the contracts scripts +20/08/10 Paul Thursby: More $msg cleanup. Unused eliminated; Others replaced with prnMsg(). +15/08/10 Phil: Decided to have contracts as part of orders module since not really enough links to warrant a new module changes to index.php WWW_Users.php and sql upgrade. +15/08/10 Phil: New script for ContractCosting.php comparison of contract costs budgeted vs incurred. Lot of work on contracts +13/08/10 Phil: DefineSuppTransClass.php SupplierInvoice.php and SupplierCredit.php now allow entry of contract charges. New script for SuppContractChgs.php +13/08/10 Phil: Fixes to show creditors transactions correctly in GLTransInquiry.php signs mixed up and period not shown previously +10/08/10 Russell (Regal Prods): Fix SelectOrderItems.php width of narrative box was making screen unusable!! +18/08/10 Pak Ricard: Revised report writer with the ability for more fields +07/08/10 Paul Thursby: PO_Items.php - Eliminate query; Moves the ONE field into a query above this point. +07/08/10 Paul Thursby: SelectProduct.php - Variable $msg will never print. Elimnate to use function prnMsg() instead. +08/08/10 Phil: Contracts.php SelectContracts.php DeliveryDetails.php - more work to convert Contracts to quotations and on conversion of contract quotations to orders to create contract work order to issue materials to +07/08/10 Tim: PDFLowGP.php - Sql quoting correction, layout changes, and assorted minor bug corrections +07/08/10 Tim: PO_Items.php - Sql quoting correction, layout changes, and assorted minor bug corrections +07/08/10 Tim: SelectCustomer.php - Unset $result variable once used as it was ca... [truncated message content] |
From: <dai...@us...> - 2011-05-07 00:24:46
|
Revision: 4562 http://web-erp.svn.sourceforge.net/web-erp/?rev=4562&view=rev Author: daintree Date: 2011-05-07 00:24:37 +0000 (Sat, 07 May 2011) Log Message: ----------- various Modified Paths: -------------- trunk/PrintCustTrans.php trunk/PrintCustTransPortrait.php trunk/Shipt_Select.php trunk/Stocks.php trunk/UpgradeDatabase.php trunk/doc/Change.log trunk/includes/PDFTransPageHeader.inc trunk/includes/session.inc Modified: trunk/PrintCustTrans.php =================================================================== --- trunk/PrintCustTrans.php 2011-05-03 10:05:05 UTC (rev 4561) +++ trunk/PrintCustTrans.php 2011-05-07 00:24:37 UTC (rev 4562) @@ -1,7 +1,9 @@ <?php + /* $Id$ */ -include ('includes/session.inc'); +include('includes/session.inc'); + if (isset($_GET['FromTransNo'])) { $FromTransNo = trim($_GET['FromTransNo']); } elseif (isset($_POST['FromTransNo'])) { @@ -9,43 +11,74 @@ } else { $FromTransNo = ''; } + if (isset($_GET['InvOrCredit'])) { $InvOrCredit = $_GET['InvOrCredit']; } elseif (isset($_POST['InvOrCredit'])) { $InvOrCredit = $_POST['InvOrCredit']; } + if (isset($_GET['PrintPDF'])) { $PrintPDF = TRUE; } elseif (isset($_POST['PrintPDF'])) { $PrintPDF = TRUE; } -if (!isset($_POST['ToTransNo']) or trim($_POST['ToTransNo']) == '' or $_POST['ToTransNo'] < $FromTransNo) { + +if (!isset($_POST['ToTransNo']) + or trim($_POST['ToTransNo'])=='' + or $_POST['ToTransNo'] < $FromTransNo) { + $_POST['ToTransNo'] = $FromTransNo; } + $FirstTrans = $FromTransNo; /* Need to start a new page only on subsequent transactions */ -if ($FromTransNo=='Preview') { - $FormDesign = simplexml_load_file(sys_get_temp_dir().'/SalesInvoice.xml'); -} else { - $FormDesign = simplexml_load_file($PathPrefix.'companies/'.$_SESSION['DatabaseName'].'/FormDesigns/SalesInvoice.xml'); -} -if (isset($PrintPDF) or isset($_GET['PrintPDF']) and $PrintPDF and isset($FromTransNo) and isset($InvOrCredit) and $FromTransNo != '') { - $PaperSize = $FormDesign->PaperSize; - include ('includes/PDFStarter.php'); - if ($InvOrCredit == 'Invoice') { - $pdf->addInfo('Title', _('Sales Invoice') . ' ' . $FromTransNo . ' to ' . $_POST['ToTransNo']); - $pdf->addInfo('Subject', _('Invoices from') . ' ' . $FromTransNo . ' ' . _('to') . ' ' . $_POST['ToTransNo']); + +if (isset($PrintPDF) OR isset($_GET['PrintPDF']) + AND $PrintPDF + AND isset($FromTransNo) + AND isset($InvOrCredit) + AND $FromTransNo!=''){ + + include ('includes/class.pdf.php'); + + /* This invoice is hard coded for A4 Landscape invoices or credit notes so can't use PDFStarter.inc */ + + $Page_Width=842; + $Page_Height=595; + $Top_Margin=30; + $Bottom_Margin=30; + $Left_Margin=40; + $Right_Margin=30; + + + $pdf = new Cpdf('L', 'pt', 'A4'); + $pdf->addInfo('Creator', 'webERP http://www.weberp.org'); + $pdf->addInfo('Author', 'webERP ' . $Version); + + if ($InvOrCredit=='Invoice') { + $pdf->addInfo('Title',_('Sales Invoice') . ' ' . $FromTransNo . ' to ' . $_POST['ToTransNo']); + $pdf->addInfo('Subject',_('Invoices from') . ' ' . $FromTransNo . ' ' . _('to') . ' ' . $_POST['ToTransNo']); } else { - $pdf->addInfo('Title', _('Sales Credit Note')); - $pdf->addInfo('Subject', _('Credit Notes from') . ' ' . $FromTransNo . ' ' . _('to') . ' ' . $_POST['ToTransNo']); + $pdf->addInfo('Title',_('Sales Credit Note') ); + $pdf->addInfo('Subject',_('Credit Notes from') . ' ' . $FromTransNo . ' ' . _('to') . ' ' . $_POST['ToTransNo']); } + $pdf->setAutoPageBreak(0); + $pdf->setPrintHeader(false); + $pdf->AddPage(); + $pdf->cMargin = 0; +/* END Brought from class.pdf.php constructor */ + $FirstPage = true; - $line_height = $FormDesign->LineHeight; - while ($FromTransNo <= $_POST['ToTransNo']) { - /* retrieve the invoice details from the database to print - notice that salesorder record must be present to print the invoice purging of sales orders will - nobble the invoice reprints */ - if ($InvOrCredit == 'Invoice') { + $line_height=16; + + while ($FromTransNo <= $_POST['ToTransNo']){ + + /* retrieve the invoice details from the database to print + notice that salesorder record must be present to print the invoice purging of sales orders will + nobble the invoice reprints */ + + if ($InvOrCredit=='Invoice') { $sql = "SELECT debtortrans.trandate, debtortrans.ovamount, debtortrans.ovdiscount, @@ -111,7 +144,8 @@ AND debtortrans.branchcode=custbranch.branchcode AND custbranch.salesman=salesman.salesmancode AND salesorders.fromstkloc=locations.loccode"; - if (isset($_POST['PrintEDI']) and $_POST['PrintEDI'] == 'No') { + + if (isset($_POST['PrintEDI']) and $_POST['PrintEDI']=='No') { $sql = $sql . " AND debtorsmaster.ediinvoices=0"; } } else { @@ -161,31 +195,29 @@ AND debtortrans.debtorno=custbranch.debtorno AND debtortrans.branchcode=custbranch.branchcode AND custbranch.salesman=salesman.salesmancode"; - if ($_POST['PrintEDI'] == 'No') { + + if ($_POST['PrintEDI']=='No') { $sql = $sql . " AND debtorsmaster.ediinvoices=0"; } } // end else - if ($FromTransNo!='Preview') { - $result = DB_query($sql, $db, '', '', false, false); - if (DB_error_no($db) != 0) { - $title = _('Transaction Print Error Report'); - include ('includes/header.inc'); - prnMsg(_('There was a problem retrieving the invoice or credit note details for note number') . ' ' . $InvoiceToPrint . ' ' . _('from the database') . '. ' . _('To print an invoice, the sales order record, the customer transaction record and the branch record for the customer must not have been purged') . '. ' . _('To print a credit note only requires the customer, transaction, salesman and branch records be available'), 'error'); - if ($debug == 1) { - prnMsg(_('The SQL used to get this information that failed was') . '<br />' . $sql, 'error'); - } - include ('includes/footer.inc'); - exit; + + $result=DB_query($sql, $db, '', '',false, false); + + if (DB_error_no($db)!=0) { + $title = _('Transaction Print Error Report'); + include ('includes/header.inc'); + prnMsg( _('There was a problem retrieving the invoice or credit note details for note number') . ' ' . $InvoiceToPrint . ' ' . _('from the database') . '. ' . _('To print an invoice, the sales order record, the customer transaction record and the branch record for the customer must not have been purged') . '. ' . _('To print a credit note only requires the customer, transaction, salesman and branch records be available'),'error'); + if ($debug==1) { + prnMsg (_('The SQL used to get this information that failed was') . '<br />' . $sql,'error'); } + include ('includes/footer.inc'); + exit; } - if ($FromTransNo=='Preview' or DB_num_rows($result) == 1) { - if ($FromTransNo!='Preview') { - $myrow = DB_fetch_array($result); - $ExchRate = $myrow['rate']; - } else { - $ExchRate = 'X'; - } - if ($InvOrCredit == 'Invoice') { + if (DB_num_rows($result)==1) { + $myrow = DB_fetch_array($result); + $ExchRate = $myrow['rate']; + if ($InvOrCredit=='Invoice') { + $sql = "SELECT stockmoves.stockid, stockmaster.description, -stockmoves.qty as quantity, @@ -193,16 +225,15 @@ ((1 - stockmoves.discountpercent) * stockmoves.price * " . $ExchRate . "* -stockmoves.qty) AS fxnet, (stockmoves.price * " . $ExchRate . ") AS fxprice, stockmoves.narrative, - stockmaster.units, - stockmaster.decimalplaces + stockmaster.units FROM stockmoves, stockmaster WHERE stockmoves.stockid = stockmaster.stockid AND stockmoves.type=10 - AND stockmoves.transno='" . $FromTransNo . "' + AND stockmoves.transno=" . $FromTransNo . " AND stockmoves.show_on_inv_crds=1"; } else { - /* only credit notes to be retrieved */ + /* only credit notes to be retrieved */ $sql = "SELECT stockmoves.stockid, stockmaster.description, stockmoves.qty as quantity, @@ -210,224 +241,294 @@ ((1 - stockmoves.discountpercent) * stockmoves.price * " . $ExchRate . " * stockmoves.qty) AS fxnet, (stockmoves.price * " . $ExchRate . ") AS fxprice, stockmoves.narrative, - stockmaster.units, - stockmaster.decimalplaces + stockmaster.units FROM stockmoves, stockmaster WHERE stockmoves.stockid = stockmaster.stockid AND stockmoves.type=11 - AND stockmoves.transno='" . $FromTransNo . "' + AND stockmoves.transno=" . $FromTransNo . " AND stockmoves.show_on_inv_crds=1"; } // end else - if ($FromTransNo!='Preview') { - $result = DB_query($sql, $db); - } - if (DB_error_no($db) != 0) { + + $result=DB_query($sql,$db); + if (DB_error_no($db)!=0) { $title = _('Transaction Print Error Report'); include ('includes/header.inc'); echo '<br />' . _('There was a problem retrieving the invoice or credit note stock movement details for invoice number') . ' ' . $FromTransNo . ' ' . _('from the database'); - if ($debug == 1) { - echo '<br />' . _('The SQL used to get this information that failed was') . '<br />' . $sql; + if ($debug==1) { + echo '<br />' . _('The SQL used to get this information that failed was') . '<br>' . $sql; } - include ('includes/footer.inc'); + include('includes/footer.inc'); exit; } - if ($FromTransNo=='Preview' or DB_num_rows($result) > 0) { + + if (DB_num_rows($result)>0) { + + $FontSize = 10; $PageNumber = 1; - include ('includes/PDFTransPageHeader.inc'); + + include('includes/PDFTransPageHeader.inc'); $FirstPage = False; - $YPos = $Page_Height - $FormDesign->Data->y; - $Line=1; - while (($FromTransNo=='Preview' and $Line==1) or (isset($result) and $myrow2 = DB_fetch_array($result))) { - if ($myrow2['discountpercent'] == 0) { - $DisplayDiscount = ''; + while ($myrow2=DB_fetch_array($result)) { + + if ($myrow2['discountpercent']==0) { + $DisplayDiscount =''; } else { - $DisplayDiscount = number_format($myrow2['discountpercent'] * 100, 2) . '%'; - $DiscountPrice = $myrow2['fxprice'] * (1 - $myrow2['discountpercent']); + $DisplayDiscount = number_format($myrow2['discountpercent']*100,2) . '%'; + $DiscountPrice=$myrow2['fxprice']*(1-$myrow2['discountpercent']); } - $DisplayNet = number_format($myrow2['fxnet'], 2); - $DisplayPrice = $myrow2['fxprice']; - $DisplayQty = $myrow2['quantity']; - $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column1->x, $YPos,$FormDesign->Data->Column1->Length, $FormDesign->Data->Column1->FontSize, $myrow2['stockid']); - $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column2->x, $YPos,$FormDesign->Data->Column2->Length, $FormDesign->Data->Column2->FontSize, $myrow2['description']); - $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column3->x, $YPos,$FormDesign->Data->Column3->Length, $FormDesign->Data->Column3->FontSize, number_format($DisplayPrice,4), 'right'); - $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column4->x, $YPos,$FormDesign->Data->Column4->Length, $FormDesign->Data->Column4->FontSize, number_format($DisplayQty,$myrow2['decimalplaces']), 'right'); - $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column5->x, $YPos,$FormDesign->Data->Column5->Length, $FormDesign->Data->Column5->FontSize, $myrow2['units'], 'centre'); - $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column6->x, $YPos,$FormDesign->Data->Column6->Length, $FormDesign->Data->Column6->FontSize, $DisplayDiscount, 'right'); - $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column7->x, $YPos,$FormDesign->Data->Column7->Length, $FormDesign->Data->Column7->FontSize, $DisplayNet, 'right'); - $YPos-= ($line_height); - $lines = explode('\r\n', htmlspecialchars_decode($myrow2['narrative'])); - for ($i = 0;$i < sizeOf($lines);$i++) { - while (strlen($lines[$i]) > 1) { - if ($YPos - $line_height <= $Bottom_Margin) { + $DisplayNet=number_format($myrow2['fxnet'],2); + $DisplayPrice=number_format($myrow2['fxprice'],3); + $DisplayQty=$myrow2['quantity']; + + $LeftOvers = $pdf->addTextWrap($Left_Margin+3,$YPos,95,$FontSize,$myrow2['stockid']); + $LeftOvers = $pdf->addTextWrap($Left_Margin+100,$YPos,123,$FontSize,$myrow2['description']); + $LeftOvers = $pdf->addTextWrap($Left_Margin+353,$YPos,96,$FontSize,$DisplayPrice,'right'); + $LeftOvers = $pdf->addTextWrap($Left_Margin+453,$YPos,95,$FontSize,$DisplayQty,'right'); + $LeftOvers = $pdf->addTextWrap($Left_Margin+553,$YPos,35,$FontSize,$myrow2['units'],'centre'); + $LeftOvers = $pdf->addTextWrap($Left_Margin+590,$YPos,50,$FontSize,$DisplayDiscount,'right'); + $LeftOvers = $pdf->addTextWrap($Left_Margin+642,$YPos,120,$FontSize,$DisplayNet,'right'); + + $YPos -= ($line_height); + + $lines=explode('\r\n',htmlspecialchars_decode($myrow2['narrative'])); + for ($i=0;$i<sizeOf($lines);$i++) { + while (strlen($lines[$i])>1) { + if ($YPos-$line_height <= $Bottom_Margin) { /* head up a new invoice/credit note page */ /* draw the vertical column lines right to the bottom */ - PrintLinesToBottom($pdf, $Page_Height, $PageNumber, $FormDesign); - include ('includes/PDFTransPageHeaderPortrait.inc'); - } //end if need a new page headed up - /* increment a line down for the next line item */ - if (strlen($lines[$i]) > 1) { - $lines[$i] = $pdf->addTextWrap($Left_Margin + 100, $YPos, 245, $FontSize, stripslashes($lines[$i])); + PrintLinesToBottom (); + include ('includes/PDFTransPageHeaderPortrait.inc'); + } //end if need a new page headed up + + /* increment a line down for the next line item */ + if (strlen($lines[$i])>1){ + $lines[$i] = $pdf->addTextWrap($Left_Margin+100,$YPos,245,$FontSize,stripslashes($lines[$i])); } - $YPos-= ($line_height); - } - } + $YPos -= ($line_height); + } + } //end for loop around lines of narrative to display if ($YPos <= $Bottom_Margin) { + /* head up a new invoice/credit note page */ /*draw the vertical column lines right to the bottom */ - PrintLinesToBottom($pdf, $Page_Height, $PageNumber, $FormDesign); + PrintLinesToBottom (); include ('includes/PDFTransPageHeader.inc'); } //end if need a new page headed up - $Line++; - } //end while there are line items to print out + } //end while there invoice are line items to print out + } /*end if there are stock movements to show on the invoice or credit note*/ - } /*end if there are stock movements to show on the invoice or credit note*/ - $YPos-= $line_height; + $YPos -= $line_height; + /* check to see enough space left to print the 4 lines for the totals/footer */ - if (($YPos - $Bottom_Margin) < (2 * $line_height)) { - PrintLinesToBottom($pdf, $Page_Height, $PageNumber, $FormDesign); + if (($YPos-$Bottom_Margin)<(2*$line_height)) { + PrintLinesToBottom (); include ('includes/PDFTransPageHeader.inc'); } /* Print a column vertical line with enough space for the footer */ /* draw the vertical column lines to 4 lines shy of the bottom to leave space for invoice footer info ie totals etc */ - $pdf->line($FormDesign->DataLines->Line1->startx, $Page_Height - $FormDesign->DataLines->Line1->starty, $FormDesign->DataLines->Line1->endx, $Page_Height - $FormDesign->DataLines->Line1->endy); + $pdf->line($Left_Margin+97, $TopOfColHeadings+12,$Left_Margin+97,$Bottom_Margin+(4*$line_height)); + /* Print a column vertical line */ - $pdf->line($FormDesign->DataLines->Line2->startx, $Page_Height - $FormDesign->DataLines->Line2->starty, $FormDesign->DataLines->Line2->endx, $Page_Height - $FormDesign->DataLines->Line2->endy); + $pdf->line($Left_Margin+350, $TopOfColHeadings+12,$Left_Margin+350,$Bottom_Margin+(4*$line_height)); + /* Print a column vertical line */ - $pdf->line($FormDesign->DataLines->Line3->startx, $Page_Height - $FormDesign->DataLines->Line3->starty, $FormDesign->DataLines->Line3->endx, $Page_Height - $FormDesign->DataLines->Line3->endy); + $pdf->line($Left_Margin+450, $TopOfColHeadings+12,$Left_Margin+450,$Bottom_Margin+(4*$line_height)); + /* Print a column vertical line */ - $pdf->line($FormDesign->DataLines->Line4->startx, $Page_Height - $FormDesign->DataLines->Line4->starty, $FormDesign->DataLines->Line4->endx, $Page_Height - $FormDesign->DataLines->Line4->endy); + $pdf->line($Left_Margin+550, $TopOfColHeadings+12,$Left_Margin+550,$Bottom_Margin+(4*$line_height)); + /* Print a column vertical line */ - $pdf->line($FormDesign->DataLines->Line5->startx, $Page_Height - $FormDesign->DataLines->Line5->starty, $FormDesign->DataLines->Line5->endx, $Page_Height - $FormDesign->DataLines->Line5->endy); - $pdf->line($FormDesign->DataLines->Line6->startx, $Page_Height - $FormDesign->DataLines->Line6->starty, $FormDesign->DataLines->Line6->endx, $Page_Height - $FormDesign->DataLines->Line6->endy); + $pdf->line($Left_Margin+587, $TopOfColHeadings+12,$Left_Margin+587,$Bottom_Margin+(4*$line_height)); + + $pdf->line($Left_Margin+640, $TopOfColHeadings+12,$Left_Margin+640,$Bottom_Margin+(4*$line_height)); + /* Rule off at bottom of the vertical lines */ - $pdf->line($FormDesign->LineAboveFooter->startx, $Page_Height - $FormDesign->LineAboveFooter->starty, $FormDesign->LineAboveFooter->endx, $Page_Height - $FormDesign->LineAboveFooter->endy); + $pdf->line($Left_Margin, $Bottom_Margin+(4*$line_height),$Page_Width-$Right_Margin,$Bottom_Margin+(4*$line_height)); + /* Now print out the footer and totals */ - if ($InvOrCredit == 'Invoice') { - $DisplaySubTot = number_format($myrow['ovamount'], 2); - $DisplayFreight = number_format($myrow['ovfreight'], 2); - $DisplayTax = number_format($myrow['ovgst'], 2); - $DisplayTotal = number_format($myrow['ovfreight'] + $myrow['ovgst'] + $myrow['ovamount'], 2); + + if ($InvOrCredit=='Invoice') { + + $DisplaySubTot = number_format($myrow['ovamount'],2); + $DisplayFreight = number_format($myrow['ovfreight'],2); + $DisplayTax = number_format($myrow['ovgst'],2); + $DisplayTotal = number_format($myrow['ovfreight']+$myrow['ovgst']+$myrow['ovamount'],2); + } else { - $DisplaySubTot = number_format(-$myrow['ovamount'], 2); - $DisplayFreight = number_format(-$myrow['ovfreight'], 2); - $DisplayTax = number_format(-$myrow['ovgst'], 2); - $DisplayTotal = number_format(-$myrow['ovfreight'] - $myrow['ovgst'] - $myrow['ovamount'], 2); + + $DisplaySubTot = number_format(-$myrow['ovamount'],2); + $DisplayFreight = number_format(-$myrow['ovfreight'],2); + $DisplayTax = number_format(-$myrow['ovgst'],2); + $DisplayTotal = number_format(-$myrow['ovfreight']-$myrow['ovgst']-$myrow['ovamount'],2); } + /* Print out the invoice text entered */ + $YPos = $Bottom_Margin+(3*$line_height); + /* Print out the payment terms */ - $pdf->addTextWrap($FormDesign->PaymentTerms->x, $Page_Height - $FormDesign->PaymentTerms->y, $FormDesign->PaymentTerms->Length, $FormDesign->PaymentTerms->FontSize, _('Payment Terms') . ': ' . $myrow['terms']); - // $pdf->addText($Page_Width-$Right_Margin-392, $YPos - ($line_height*3)+22,$FontSize, _('Bank Code:***** Bank Account:*****')); - // $FontSize=10; - $LeftOvers=explode('\r\n',DB_escape_string($myrow['invtext'])); - for ($i=0;$i<sizeOf($LeftOvers);$i++) { - $pdf->addText($FormDesign->InvoiceText->x, $Page_Height - $FormDesign->InvoiceText->y-($i*10), $FormDesign->InvoiceText->FontSize, $LeftOvers[$i]); + $pdf->addTextWrap($Left_Margin+5,$YPos+3,280,$FontSize,_('Payment Terms') . ': ' . $myrow['terms']); + // $pdf->addText($Page_Width-$Right_Margin-392, $YPos - ($line_height*3)+22,$FontSize, _('Bank Code:***** Bank Account:*****')); + // $FontSize=10; + + $FontSize =8; + $LeftOvers = $pdf->addTextWrap($Left_Margin+5,$YPos-12,280,$FontSize,$myrow['invtext']); + if (strlen($LeftOvers)>0) { + $LeftOvers = $pdf->addTextWrap($Left_Margin+5,$YPos-24,280,$FontSize,$LeftOvers); + if (strlen($LeftOvers)>0) { + $LeftOvers = $pdf->addTextWrap($Left_Margin+5,$YPos-36,280,$FontSize,$LeftOvers); + /*If there is some of the InvText leftover after 3 lines 200 wide then it is not printed :( */ + } } - $pdf->addText($FormDesign->SubTotalCaption->x, $Page_Height - $FormDesign->SubTotalCaption->y, $FormDesign->SubTotalCaption->FontSize, _('Sub Total')); - $LeftOvers = $pdf->addTextWrap($FormDesign->SubTotal->x, $Page_Height - $FormDesign->SubTotal->y, $FormDesign->SubTotal->Length, $FormDesign->SubTotal->FontSize, $DisplaySubTot, 'right'); - $pdf->addText($FormDesign->FreightCaption->x, $Page_Height - $FormDesign->FreightCaption->y, $FormDesign->FreightCaption->FontSize, _('Freight')); - $LeftOvers = $pdf->addTextWrap($FormDesign->Freight->x, $Page_Height - $FormDesign->Freight->y, $FormDesign->Freight->Length, $FormDesign->Freight->FontSize, $DisplayFreight, 'right'); - $pdf->addText($FormDesign->TaxCaption->x, $Page_Height - $FormDesign->TaxCaption->y, $FormDesign->TaxCaption->FontSize, _('Tax')); - $LeftOvers = $pdf->addTextWrap($FormDesign->Tax->x, $Page_Height - $FormDesign->Tax->y, $FormDesign->Tax->Length, $FormDesign->Tax->FontSize, $DisplayTax, 'right'); + $FontSize = 10; + + $pdf->addText($Page_Width-$Right_Margin-220, $YPos+15,$FontSize, _('Sub Total')); + $LeftOvers = $pdf->addTextWrap($Left_Margin+642,$YPos+5,120,$FontSize,$DisplaySubTot, 'right'); + + $pdf->addText($Page_Width-$Right_Margin-220, $YPos+2,$FontSize, _('Freight')); + $LeftOvers = $pdf->addTextWrap($Left_Margin+642,$YPos-6,120,$FontSize,$DisplayFreight, 'right'); + + $pdf->addText($Page_Width-$Right_Margin-220, $YPos-10,$FontSize, _('Tax')); + $LeftOvers = $pdf->addTextWrap($Left_Margin+642,$YPos-($line_height)-5,120, $FontSize,$DisplayTax, 'right'); + /*rule off for total */ - $pdf->line($FormDesign->TotalLine->startx, $Page_Height - $FormDesign->TotalLine->starty, $FormDesign->TotalLine->endx, $Page_Height - $FormDesign->TotalLine->endy); + $pdf->line($Page_Width-$Right_Margin-222, $YPos-(2*$line_height),$Page_Width-$Right_Margin,$YPos-(2*$line_height)); + /*vertical to separate totals from comments and ROMALPA */ - $pdf->line($FormDesign->RomalpaLine->startx, $Page_Height - $FormDesign->RomalpaLine->starty, $FormDesign->RomalpaLine->endx, $Page_Height - $FormDesign->RomalpaLine->endy); - if ($InvOrCredit == 'Invoice') { - $pdf->addText($FormDesign->TotalCaption->x, $Page_Height - $FormDesign->TotalCaption->y, $FormDesign->TotalCaption->FontSize, _('TOTAL INVOICE')); - $YPos=$FormDesign->Romalpa->y; - $LeftOvers = $pdf->addTextWrap($FormDesign->Romalpa->x, $Page_Height - $YPos, $FormDesign->Romalpa->Length, $FormDesign->Romalpa->FontSize, $_SESSION['RomalpaClause']); - while (strlen($LeftOvers) > 0 AND ($Page_Height - $YPos) > $Bottom_Margin) { - $YPos+= $FormDesign->Romalpa->FontSize+1; - $LeftOvers = $pdf->addTextWrap($FormDesign->Romalpa->x, $Page_Height - $YPos, $FormDesign->Romalpa->Length, $FormDesign->Romalpa->FontSize, $LeftOvers); + $pdf->line($Page_Width-$Right_Margin-222, $YPos+$line_height,$Page_Width-$Right_Margin-222,$Bottom_Margin); + + $YPos+=10; + if ($InvOrCredit=='Invoice') { + $pdf->addText($Page_Width-$Right_Margin-220, $YPos - ($line_height*2)-10,$FontSize, _('TOTAL INVOICE')); + $FontSize=9; + $YPos-=4; + $LeftOvers = $pdf->addTextWrap($Left_Margin+280,$YPos,220,$FontSize,$_SESSION['RomalpaClause']); + while (strlen($LeftOvers)>0 AND $YPos > $Bottom_Margin) { + $YPos-=12; + $LeftOvers = $pdf->addTextWrap($Left_Margin+280,$YPos,220,$FontSize,$LeftOvers); } /* Add Images for Visa / Mastercard / Paypal */ if (file_exists('companies/' . $_SESSION['DatabaseName'] . '/payment.jpg')) { - $pdf->addJpegFromFile('companies/' . $_SESSION['DatabaseName'] . '/payment.jpg', $FormDesign->CreditCardLogo->x,$Page_Height -$FormDesign->CreditCardLogo->y,$FormDesign->CreditCardLogo->width,$FormDesign->CreditCardLogo->height); + $pdf->addJpegFromFile('companies/' . $_SESSION['DatabaseName'] . '/payment.jpg',$Page_Width/2 -280,$YPos-20,0,40); } -// $pdf->addText($Page_Width - $Right_Margin - 472, $YPos - ($line_height * 3) + 32, $FontSize, ''); + $pdf->addText($Page_Width-$Right_Margin-472, $YPos - ($line_height*3)+32,$FontSize, ''); + $FontSize=10; } else { - $pdf->addText($FormDesign->TotalCaption->x, $Page_Height - $FormDesign->TotalCaption->y, $FormDesign->TotalCaption->FontSize, _('TOTAL CREDIT')); - } - $LeftOvers = $pdf->addTextWrap($FormDesign->Total->x, $Page_Height - $FormDesign->Total->y, $FormDesign->Total->Length, $FormDesign->Total->FontSize, $DisplayTotal, 'right'); + $pdf->addText($Page_Width-$Right_Margin-220, $YPos-($line_height*2)-10,$FontSize, _('TOTAL CREDIT')); + } + $LeftOvers = $pdf->addTextWrap($Left_Margin+642,35,120, $FontSize,$DisplayTotal, 'right'); } /* end of check to see that there was an invoice record to print */ + $FromTransNo++; + } /* end loop to print invoices */ + + // Have to get the TransNo again, GET[FromTransNo] is updated on each pass of loop + if (isset($_GET['FromTransNo'])) { + $FromTransNo = trim($_GET['FromTransNo']); + } elseif (isset($_POST['FromTransNo'])) { + $FromTransNo = trim($_POST['FromTransNo']); } -} /* end loop to print invoices */ + + + if (isset($_GET['Email'])){ //email the invoice to address supplied + include('includes/header.inc'); -if (($InvOrCredit == 'Invoice' or $InvOrCredit == 'Credit') and isset($PrintPDF)) { - - if (isset($_GET['Email'])) { //email the invoice to address supplied - include ('includes/header.inc'); include ('includes/htmlMimeMail.php'); + $FileName = $_SESSION['reports_dir'] . '/' . $_SESSION['DatabaseName'] . '_' . $InvOrCredit . '_' . $_GET['FromTransNo'] . '.pdf'; + $pdf->Output($FileName,'F'); $mail = new htmlMimeMail(); - $FileName = $_SESSION['reports_dir'] . '/' . $_SESSION['DatabaseName'] . '_' . $InvOrCredit . '_' . $_GET['FromTransNo'] . '.pdf'; - $pdf->Output($FileName, 'F'); + $Attachment = $mail->getFile($FileName); - $mail->setText(_('Please find attached') . ' ' . $InvOrCredit . ' ' . $_GET['FromTransNo']); + $mail->setText(_('Please find attached') . ' ' . $InvOrCredit . ' ' . $_GET['FromTransNo'] ); $mail->SetSubject($InvOrCredit . ' ' . $_GET['FromTransNo']); $mail->addAttachment($Attachment, $FileName, 'application/pdf'); $mail->setFrom($_SESSION['CompanyRecord']['coyname'] . ' <' . $_SESSION['CompanyRecord']['email'] . '>'); $result = $mail->send(array($_GET['Email'])); + unlink($FileName); //delete the temporary file - $title = _('Emailing') . ' ' . $InvOrCredit . ' ' . _('Number') . ' ' . $FromTransNo; - include ('includes/header.inc'); - echo '<p>' . $InvOrCredit . ' ' . _('number') . ' ' . $_GET['FromTransNo'] . ' ' . _('has been emailed to') . ' ' . $_GET['Email']; - include ('includes/footer.inc'); + + $title = _('Emailing') . ' ' .$InvOrCredit . ' ' . _('Number') . ' ' . $FromTransNo; + include('includes/header.inc'); + echo '<p>' . $InvOrCredit . ' ' . _('number') . ' ' . $FromTransNo . ' ' . _('has been emailed to') . ' ' . $_GET['Email']; + include('includes/footer.inc'); exit; - } else { - $pdf->OutputD( $_SESSION['DatabaseName'] . '_' . $InvOrCredit . '_' . $_GET['FromTransNo'] . '.pdf'); + + } else { //its not an email just print the invoice to PDF + $pdf->OutputD($_SESSION['DatabaseName'] . '_' . $InvOrCredit . '_' . $FromTransNo . '.pdf'); + } $pdf->__destruct(); + } else { /*The option to print PDF was not hit */ - $title = _('Select Invoices/Credit Notes To Print'); - include ('includes/header.inc'); - if (!isset($FromTransNo) OR $FromTransNo == '') { + + $title=_('Select Invoices/Credit Notes To Print'); + include('includes/header.inc'); + + if (!isset($FromTransNo) OR $FromTransNo=='') { + /* if FromTransNo is not set then show a form to allow input of either a single invoice number or a range of invoices to be printed. Also get the last invoice number created to show the user where the current range is up to */ - echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="POST"> - <table class="selection">'; + echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<p class="page_title_text"><img src="' . $rootpath . '/css/' . $theme . '/images/printer.png" title="' . _('Print') . '" alt="" />' . ' ' . _('Print Invoices or Credit Notes (Landscape Mode)') . '</p>'; - echo '<tr><td>' . _('Print Invoices or Credit Notes') . '</td><td><select name=InvOrCredit>'; - if ($InvOrCredit == 'Invoice' OR !isset($InvOrCredit)) { + + echo '<div class="centre"><p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/printer.png" title="' . _('Print') . '" alt="">' . ' ' . _('Print Invoices or Credit Notes (Landscape Mode)') . '</div>'; + echo '<table class="table1"> + <tr><td>' . _('Print Invoices or Credit Notes') . '</td><td><select name=InvOrCredit>'; + if ($InvOrCredit=='Invoice' OR !isset($InvOrCredit)) { + echo '<option selected value="Invoice">' . _('Invoices') . '</option>'; - echo '<option value="Credit">' . _('Credit Notes'). '</option>'; + echo '<option value="Credit">' . _('Credit Notes') . '</option>'; } else { echo '<option selected value="Credit">' . _('Credit Notes') . '</option>'; echo '<option value="Invoice">' . _('Invoices') . '</option>'; } + echo '</select></td></tr>'; echo '<tr><td>' . _('Print EDI Transactions') . '</td><td><select name=PrintEDI>'; - if ($InvOrCredit == 'Invoice' OR !isset($InvOrCredit)) { + + if ($InvOrCredit=='Invoice' OR !isset($InvOrCredit)) { + echo '<option selected value="No">' . _('Do not Print PDF EDI Transactions') . '</option>'; echo '<option value="Yes">' . _('Print PDF EDI Transactions Too') . '</option>'; + } else { + echo '<option value="No">' . _('Do not Print PDF EDI Transactions') . '</option>'; echo '<option selected value="Yes">' . _('Print PDF EDI Transactions Too') . '</option>'; } + echo '</select></td></tr>'; echo '<tr><td>' . _('Start invoice/credit note number to print') . '</td> - <td><input type="text" class="number" max=6 size=7 name=FromTransNo></td></tr>'; + <td><input Type=text class=number max=6 size=7 name=FromTransNo></td></tr>'; echo '<tr><td>' . _('End invoice/credit note number to print') . '</td> - <td><input Type="text" class="number" max=6 size=7 name="ToTransNo"></td> - </tr></table>'; - echo '<br /><div class="centre"><input type="submit" name="Print" value="' . _('Print') . '"><p />'; + <td><input Type=text class=number max=6 size=7 name="ToTransNo"></td></tr> + </table>'; + echo '<div class="centre"><input type="submit" name="Print" value="' . _('Print') . '"><p>'; echo '<input type="submit" name="PrintPDF" value="' . _('Print PDF') . '"></div>'; + $sql = "SELECT typeno FROM systypes WHERE typeid=10"; - $result = DB_query($sql, $db); + + $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); - echo '<div class="page_help_text"><b>' . _('The last invoice created was number') . ' ' . $myrow[0] . '</b><br />' . _('If only a single invoice is required') . ', ' . _('enter the invoice number to print in the Start transaction number to print field and leave the End transaction number to print field blank') . '. ' . _('Only use the end invoice to print field if you wish to print a sequential range of invoices') . ''; + + echo '<div class="page_help_text"><b>' . _('The last invoice created was number') . ' ' . $myrow[0] . '</b><br>' . _('If only a single invoice is required') . ', ' . _('enter the invoice number to print in the Start transaction number to print field and leave the End transaction number to print field blank') . '. ' . _('Only use the end invoice to print field if you wish to print a sequential range of invoices') . ''; + $sql = "SELECT typeno FROM systypes WHERE typeid=11"; - $result = DB_query($sql, $db); + + $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); - echo '<br /><b>' . _('The last credit note created was number') . ' ' . $myrow[0] . '</b><br />' . - _('A sequential range can be printed using the same method as for invoices above') . '. ' . _('A single credit note can be printed by only entering a start transaction number') . '</div>'; + + echo '<br /><b>' . _('The last credit note created was number') . ' ' . $myrow[0] . '</b><br />' . _('A sequential range can be printed using the same method as for invoices above') . '. ' . _('A single credit note can be printed by only entering a start transaction number') . '</DIV'; + } else { + while ($FromTransNo <= $_POST['ToTransNo']) { + /*retrieve the invoice details from the database to print notice that salesorder record must be present to print the invoice purging of sales orders will nobble the invoice reprints */ - if ($InvOrCredit == 'Invoice') { + + if ($InvOrCredit=='Invoice') { + $sql = "SELECT debtortrans.trandate, debtortrans.ovamount, @@ -480,6 +581,7 @@ AND debtortrans.branchcode=custbranch.branchcode AND custbranch.salesman=salesman.salesmancode"; } else { + $sql = "SELECT debtortrans.trandate, debtortrans.ovamount, debtortrans.ovdiscount, @@ -515,63 +617,99 @@ AND debtortrans.branchcode=custbranch.branchcode AND custbranch.salesman=salesman.salesmancode"; } - $result = DB_query($sql, $db); - if (DB_num_rows($result) == 0 OR DB_error_no($db) != 0) { - echo '<div class="page_help_text">' . _('There was a problem retrieving the invoice or credit note details for note number') . ' ' . $FromTransNo . ' ' . _('from the database') . '. ' . _('To print an invoice, the sales order record, the customer transaction record and the branch record for the customer must not have been purged') . '. ' . _('To print a credit note only requires the customer, transaction, salesman and branch records be available').'</div>'; - if ($debug == 1) { - echo _('The SQL used to get this information that failed was') . "<br />$sql"; + + $result=DB_query($sql,$db); + if (DB_num_rows($result)==0 OR DB_error_no($db)!=0) { + echo '<p>' . _('There was a problem retrieving the invoice or credit note details for note number') . ' ' . $InvoiceToPrint . ' ' . _('from the database') . '. ' . _('To print an invoice, the sales order record, the customer transaction record and the branch record for the customer must not have been purged') . '. ' . _('To print a credit note only requires the customer, transaction, salesman and branch records be available'); + if ($debug==1) { + echo _('The SQL used to get this information that failed was') . '<br>' . $sql; } break; - include ('includes/footer.inc'); + include('includes/footer.inc'); exit; - } elseif (DB_num_rows($result) == 1) { + } elseif (DB_num_rows($result)==1) { + $myrow = DB_fetch_array($result); /* Then there's an invoice (or credit note) to print. So print out the invoice header and GST Number from the company record */ - if (count($_SESSION['AllowedPageSecurityTokens']) == 1 AND in_array(1, $_SESSION['AllowedPageSecurityTokens']) AND $myrow['debtorno'] != $_SESSION['CustomerID']) { + if (count($_SESSION['AllowedPageSecurityTokens'])==1 AND in_array(1, $_SESSION['AllowedPageSecurityTokens']) AND $myrow['debtorno'] != $_SESSION['CustomerID']){ echo '<p><font color=RED size=4>' . _('This transaction is addressed to another customer and cannot be displayed for privacy reasons') . '. ' . _('Please select only transactions relevant to your company'); exit; } + $ExchRate = $myrow['rate']; $PageNumber = 1; - echo '<table class="table1"><tr><td VALIGN=TOP WIDTH=10%><img src="' . $_SESSION['LogoFile'] . '"></td><td bgcolor="#BBBBBB"><b>'; - if ($InvOrCredit == 'Invoice') { - echo '<font size=4>' . _('TAX INVOICE') . ' '; + + echo '<table class="table1"> + <tr><td VALIGN=TOP WIDTH=10%><img src="' . $_SESSION['LogoFile'] . '"></td> + <td bgcolor="#BBBBBB"><b>'; + + if ($InvOrCredit=='Invoice') { + echo '<font size=4>' . _('TAX INVOICE') . ' '; } else { - echo '<font color=RED size=4>' . _('TAX CREDIT NOTE') . ' '; + echo '<font color=RED size=4>' . _('TAX CREDIT NOTE') . ' '; } - echo '</b>' . _('Number') . ' ' . $FromTransNo . '</font><br /><font size=1>' . _('Tax Authority Ref') . '. ' . $_SESSION['CompanyRecord']['gstno'] . '</td></tr></table>'; + echo '</b>' . _('Number') . ' ' . $FromTransNo . '</font><br><font size=1>' . _('Tax Authority Ref') . '. ' . $_SESSION['CompanyRecord']['gstno'] . '</td></tr></table>'; + /* Now print out the logo and company name and address */ - echo '<table class="table1"><tr><td><font size=4 color="#333333"><b>' . $_SESSION['CompanyRecord']['coyname'] . '</b></font><br />'; - echo $_SESSION['CompanyRecord']['regoffice1'] . '<br />'; - echo $_SESSION['CompanyRecord']['regoffice2'] . '<br />'; - echo $_SESSION['CompanyRecord']['regoffice3'] . '<br />'; - echo $_SESSION['CompanyRecord']['regoffice4'] . '<br />'; - echo $_SESSION['CompanyRecord']['regoffice5'] . '<br />'; - echo $_SESSION['CompanyRecord']['regoffice6'] . '<br />'; - echo _('Telephone') . ': ' . $_SESSION['CompanyRecord']['telephone'] . '<br />'; - echo _('Facsimile') . ': ' . $_SESSION['CompanyRecord']['fax'] . '<br />'; - echo _('Email') . ': ' . $_SESSION['CompanyRecord']['email'] . '<br />'; + echo '<table class="table1"> + <tr><td><font size=4 color="#333333"><b>' . $_SESSION['CompanyRecord']['coyname'] . '</b></font><br>'; + echo $_SESSION['CompanyRecord']['regoffice1'] . '<br>'; + echo $_SESSION['CompanyRecord']['regoffice2'] . '<br>'; + echo $_SESSION['CompanyRecord']['regoffice3'] . '<br>'; + echo $_SESSION['CompanyRecord']['regoffice4'] . '<br>'; + echo $_SESSION['CompanyRecord']['regoffice5'] . '<br>'; + echo $_SESSION['CompanyRecord']['regoffice6'] . '<br>'; + echo _('Telephone') . ': ' . $_SESSION['CompanyRecord']['telephone'] . '<br>'; + echo _('Facsimile') . ': ' . $_SESSION['CompanyRecord']['fax'] . '<br>'; + echo _('Email') . ': ' . $_SESSION['CompanyRecord']['email'] . '<br>'; + echo '</td><td WIDTH=50% class=number>'; + /* Now the customer charged to details in a sub table within a cell of the main table*/ - echo '<table class="table1"><tr><td align=left bgcolor="#BBBBBB"><b>' . _('Charge To') . ':</b></td></tr><tr><td bgcolor="#EEEEEE">'; - echo $myrow['name'] . '<br />' . $myrow['address1'] . '<br />' . $myrow['address2'] . '<br />' . $myrow['address3'] . '<br />' . $myrow['address4'] . '<br />' . $myrow['address5'] . '<br />' . $myrow['address6']; + + echo '<table class="table1"> + <tr><td align=left bgcolor="#BBBBBB"><b>' . _('Charge To') . ':</b></td> + </tr><tr><td bgcolor="#EEEEEE">'; + echo $myrow['name'] . + '<br>' . $myrow['address1'] . + '<br>' . $myrow['address2'] . + '<br>' . $myrow['address3'] . + '<br>' . $myrow['address4'] . + '<br>' . $myrow['address5'] . + '<br>' . $myrow['address6']; echo '</td></tr></table>'; /*end of the small table showing charge to account details */ echo _('Page') . ': ' . $PageNumber; echo '</td></tr></table>'; /*end of the main table showing the company name and charge to details */ - if ($InvOrCredit == 'Invoice') { - echo '<table class="table1"> + + if ($InvOrCredit=='Invoice') { + + echo '<table class="table1"> <tr> <td align=left bgcolor="#BBBBBB"><b>' . _('Charge Branch') . ':</b></td> <td align=left bgcolor="#BBBBBB"><b>' . _('Delivered To') . ':</b></td> </tr>'; - echo '<tr> - <td bgcolor="#EEEEEE">' . $myrow['brname'] . '<br />' . $myrow['braddress1'] . '<br />' . $myrow['braddress2'] . '<br />' . $myrow['braddress3'] . '<br />' . $myrow['braddress4'] . '<br />' . $myrow['braddress5'] . '<br />' . $myrow['braddress6'] . '</td>'; - echo '<td bgcolor="#EEEEEE">' . $myrow['deliverto'] . '<br />' . $myrow['deladd1'] . '<br />' . $myrow['deladd2'] . '<br />' . $myrow['deladd3'] . '<br />' . $myrow['deladd4'] . '<br />' . $myrow['deladd5'] . '<br />' . $myrow['deladd6'] . '</td>'; - echo '</tr> - </table><hr>'; - echo '<table class="table1"> + echo '<tr> + <td bgcolor="#EEEEEE">' .$myrow['brname'] . + '<br>' . $myrow['braddress1'] . + '<br>' . $myrow['braddress2'] . + '<br>' . $myrow['braddress3'] . + '<br>' . $myrow['braddress4'] . + '<br>' . $myrow['braddress5'] . + '<br>' . $myrow['braddress6'] . '</td>'; + + echo '<td bgcolor="#EEEEEE">' . $myrow['deliverto'] . + '<br>' . $myrow['deladd1'] . + '<br>' . $myrow['deladd2'] . + '<br>' . $myrow['deladd3'] . + '<br>' . $myrow['deladd4'] . + '<br>' . $myrow['deladd5'] . + '<br>' . $myrow['deladd6'] . '</td> + </tr> + </table><hr>'; + + echo '<table class="table1"> <tr> <td align=left bgcolor="#BBBBBB"><b>' . _('Your Order Ref') . '</b></td> <td align=left bgcolor="#BBBBBB"><b>' . _('Our Order No') . '</b></td> @@ -581,9 +719,9 @@ <td align=left bgcolor="#BBBBBB"><b>' . _('Shipper') . '</b></td> <td align=left bgcolor="#BBBBBB"><b>' . _('Consignment Ref') . '</b></td> </tr>'; - echo '<tr> + echo '<tr> <td bgcolor="#EEEEEE">' . $myrow['customerref'] . '</td> - <td bgcolor="#EEEEEE">' . $myrow['orderno'] . '</td> + <td bgcolor="#EEEEEE">' .$myrow['orderno'] . '</td> <td bgcolor="#EEEEEE">' . ConvertSQLDate($myrow['orddate']) . '</td> <td bgcolor="#EEEEEE">' . ConvertSQLDate($myrow['trandate']) . '</td> <td bgcolor="#EEEEEE">' . $myrow['salesmanname'] . '</td> @@ -591,7 +729,8 @@ <td bgcolor="#EEEEEE">' . $myrow['consignment'] . '</td> </tr> </table>'; - $sql = "SELECT stockmoves.stockid, + + $sql ="SELECT stockmoves.stockid, stockmaster.description, -stockmoves.qty as quantity, stockmoves.discountpercent, @@ -605,26 +744,35 @@ AND stockmoves.type=10 AND stockmoves.transno='" . $FromTransNo . "' AND stockmoves.show_on_inv_crds=1"; + } else { /* then its a credit note */ - echo '<table width=50%><tr> + + echo '<table width="50%"><tr> <td align=left bgcolor="#BBBBBB"><b>' . _('Branch') . ':</b></td> </tr>'; - echo '<tr> - <td bgcolor="#EEEEEE">' . $myrow['brname'] . '<br />' . $myrow['braddress1'] . '<br />' . $myrow['braddress2'] . '<br />' . $myrow['braddress3'] . '<br />' . $myrow['braddress4'] . '<br />' . $myrow['braddress5'] . '<br />' . $myrow['braddress6'] . '</td> + echo '<tr> + <td bgcolor="#EEEEEE">' .$myrow['brname'] . + '<br>' . $myrow['braddress1'] . + '<br>' . $myrow['braddress2'] . + '<br>' . $myrow['braddress3'] . + '<br>' . $myrow['braddress4'] . + '<br>' . $myrow['braddress5'] . + '<br>' . $myrow['braddress6'] . '</td> </tr></table>'; - echo '<hr><table class="table1"><tr> + echo '<hr><table class="table1"><tr> <td align=left bgcolor="#BBBBBB"><b>' . _('Date') . '</b></td> <td align=left bgcolor="#BBBBBB"><b>' . _('Sales Person') . '</font></b></td> </tr>'; - echo '<tr> + echo '<tr> <td bgcolor="#EEEEEE">' . ConvertSQLDate($myrow['trandate']) . '</td> <td bgcolor="#EEEEEE">' . $myrow['salesmanname'] . '</td> </tr></table>'; - $sql = "SELECT stockmoves.stockid, + + $sql ="SELECT stockmoves.stockid, stockmaster.description, stockmoves.qty as quantity, - stockmoves.discountpercent, ((1 - stockmoves.discountpercent) * stockmoves.price * " . $ExchRate . " * stockmoves.qty) AS fxnet, - (stockmoves.price * " . $ExchRate . ") AS fxprice, + stockmoves.discountpercent, ((1 - stockmoves.discountpercent) * stockmoves.price * ' . $ExchRate . ' * stockmoves.qty) AS fxnet, + (stockmoves.price * ' . $ExchRate . ') AS fxprice, stockmaster.units FROM stockmoves, stockmaster @@ -633,81 +781,109 @@ AND stockmoves.transno='" . $FromTransNo . "' AND stockmoves.show_on_inv_crds=1"; } + echo '<hr>'; echo '<div class="centre"><font size=2>' . _('All amounts stated in') . ' ' . $myrow['currcode'] . '</font></div>'; - $result = DB_query($sql, $db); - if (DB_error_no($db) != 0) { - echo '<div class="page_help_text">' . _('There was a problem retrieving the invoice or credit note stock movement details for invoice number') . ' ' . $FromTransNo . ' ' . _('from the database').'</div>'; - if ($debug == 1) { - echo '<br />' . _('The SQL used to get this information that failed was') . '<br />'.$sql; + + $result=DB_query($sql,$db); + if (DB_error_no($db)!=0) { + echo '<br>' . _('There was a problem retrieving the invoice or credit note stock movement details for invoice number') . ' ' . $FromTransNo . ' ' . _('from the database'); + if ($debug==1){ + echo '<br>' . _('The SQL used to get this information that failed was') . '<br>' .$sql; } exit; } - if (DB_num_rows($result) > 0) { + + if (DB_num_rows($result)>0){ echo '<table class="table1"> <tr><th>' . _('Item Code') . '</th> - <th>' . _('Item Description') . '</th> - <th>' . _('Quantity') . '</th> - <th>' . _('Unit') . '</th> - <th>' . _('Price') . '</th> - <th>' . _('Discount') . '</th> - <th>' . _('Net') . '</th></tr>'; - $LineCounter = 17; - $k = 0; //row colour counter - while ($myrow2 = DB_fetch_array($result)) { - if ($k == 1) { - $RowStarter = '<tr class="EvenTableRows">'; - $k = 0; - } else { - $RowStarter = '<tr class="OddTableRows">'; - $k = 1; - } - echo $RowStarter; - $DisplayPrice = number_format($myrow2['fxprice'], 2); - $DisplayQty = number_format($myrow2['quantity'], 2); - $DisplayNet = number_format($myrow2['fxnet'], 2); - if ($myrow2['discountpercent'] == 0) { - $DisplayDiscount = ''; - } else { - $DisplayDiscount = number_format($myrow2['discountpercent'] * 100, 2) . '%'; - } - printf('<td>%s</td> + <th>' . _('Item Description') . '</th> + <th>' . _('Quantity') . '</th> + <th>' . _('Unit') . '</th> + <th>' . _('Price') . '</th> + <th>' . _('Discount') . '</th> + <th>' . _('Net') . '</th> + </tr>'; + + $LineCounter =17; + $k=0; //row colour counter + + while ($myrow2=DB_fetch_array($result)){ + + if ($k==1){ + $RowStarter = '<tr class="EvenTableRows">'; + $k=0; + } else { + $RowStarter = '<tr class="OddTableRows">'; + $k=1; + } + + echo $RowStarter; + + $DisplayPrice = number_format($myrow2['fxprice'],2); + $DisplayQty = number_format($myrow2['quantity'],2); + $DisplayNet = number_format($myrow2['fxnet'],2); + + if ($myrow2['discountpercent']==0){ + $DisplayDiscount =''; + } else { + $DisplayDiscount = number_format($myrow2['discountpercent']*100,2) . '%'; + } + + printf ('<td>%s</td> <td>%s</td> <td class=number>%s</td> <td class=number>%s</td> <td class=number>%s</td> <td class=number>%s</td> <td class=number>%s</td> - </tr>', $myrow2['stockid'], $myrow2['description'], $DisplayQty, $myrow2['units'], $DisplayPrice, $DisplayDiscount, $DisplayNet); - if (strlen($myrow2['narrative']) > 1) { - echo $RowStarter . '<td></td><td colspan=6>' . $myrow2['narrative'] . '</td></tr>'; + </tr>', + $myrow2['stockid'], + $myrow2['description'], + $DisplayQty, + $myrow2['units'], + $DisplayPrice, + $DisplayDiscount, + $DisplayNet); + + if (strlen($myrow2['narrative'])>1){ + echo $RowStarter . '<td></td><td colspan=6>' . $myrow2['narrative'] . '</td></tr>'; $LineCounter++; - } - $LineCounter++; - if ($LineCounter == ($_SESSION['PageLength'] - 2)) { - /* head up a new invoice/credit note page */ - $PageNumber++; - echo '</table><table class="table1"><tr><td VALIGN=TOp><img src="' . $_SESSION['LogoFile'] . '"></td><td bgcolor="#BBBBBB"><b>'; - if ($InvOrCredit == 'Invoice') { - echo '<font size=4>' . _('TAX INVOICE') . ' '; - } else { - echo '<font color=red size=4>' . _('TAX CREDIT NOTE') . ' '; - } - echo '</b>' . _('Number') . ' ' . $FromTransNo . '</font><br /><font size=1>' . _('GST Number') . ' - ' . $_SESSION['CompanyRecord']['gstno'] . '</td></tr></table>'; - /*Now print out company name and address */ - echo '<table class="table1"><tr> - <td><font size=4 color="#333333"><b>' . $_SESSION['CompanyRecord']['coyname'] . '</b></font><br />'; - echo $_SESSION['CompanyRecord']['regoffice1'] . '<br />'; - echo $_SESSION['CompanyRecord']['regoffice2'] . '<br />'; - echo $_SESSION['CompanyRecord']['regoffice3'] . '<br />'; - echo $_SESSION['CompanyRecord']['regoffice4'] . '<br />'; - echo $_SESSION['CompanyRecord']['regoffice5'] . '<br />'; - echo $_SESSION['CompanyRecord']['regoffice6'] . '<br />'; - echo _('Telephone') . ': ' . $_SESSION['CompanyRecord']['telephone'] . '<br />'; - echo _('Facsimile') . ': ' . $_SESSION['CompanyRecord']['fax'] . '<br />'; - echo _('Email') . ': ' . $_SESSION['CompanyRecord']['email'] . '<br />'; - echo '</td><td class=number>' . _('Page') . ': '.$PageNumber.'</td></tr></table>'; - echo '<table class="table1"><tr> + } + + $LineCounter++; + + if ($LineCounter == ($_SESSION['PageLength'] - 2)){ + + /* head up a new invoice/credit note page */ + + $PageNumber++; + echo '</table> + <table class="table1"> + <tr><td valign=top><img src="' . $_SESSION['LogoFile'] . '"></td> + <td bgcolor="#BBBBBB"><b>'; + + if ($InvOrCredit=='Invoice') { + echo '<font size=4>' . _('TAX INVOICE') . ' '; + } else { + echo '<font color=RED size=4>' . _('TAX CREDIT NOTE') . ' '; + } + echo '</b>' . _('Number') . ' ' . $FromTransNo . '</font><br /><font size=1>' . _('GST Number') . ' - ' . $_SESSION['CompanyRecord']['gstno'] . '</td></tr></table>'; + + /*Now print out company name and address */ + echo '<table class="table1"><tr> + <td><font size=4 color="#333333"><b>' . $_SESSION['CompanyRecord']['coyname'] . '</b></font><br>'; + echo $_SESSION['CompanyRecord']['regoffice1'] . '<br>'; + echo $_SESSION['CompanyRecord']['regoffice2'] . '<br>'; + echo $_SESSION['CompanyRecord']['regoffice3'] . '<br>'; + echo $_SESSION['CompanyRecord']['regoffice4'] . '<br>'; + echo $_SESSION['CompanyRecord']['regoffice5'] . '<br>'; + echo $_SESSION['CompanyRecord']['regoffice6'] . '<br>'; + echo _('Telephone') . ': ' . $_SESSION['CompanyRecord']['telephone'] . '<br>'; + echo _('Facsimile') . ': ' . $_SESSION['CompanyRecord']['fax'] . '<br>'; + echo _('Email') . ': ' . $_SESSION['CompanyRecord']['email'] . '<br>'; + echo '</td><td class=number>' . _('Page') . ': ' . $PageNumber . '</td></tr></table>'; + echo '<table class="table1"><tr> <th>' . _('Item Code') . '</th> <th>' . _('Item Description') . '</th> <th>' . _('Quantity') . '</th> @@ -715,36 +891,45 @@ <th>' . _('Price') . '</th> <th>' . _('Discount') . '</th> <th>' . _('Net') . '</th></tr>'; - $LineCounter = 10; - } //end if need a new page headed up + $LineCounter = 10; + + } //end if need a new page headed up } //end while there are line items to print out echo '</table>'; } /*end if there are stock movements to show on the invoice or credit note*/ + /* check to see enough space left to print the totals/footer */ - $LinesRequiredForText = floor(strlen($myrow['invtext']) / 140); - if ($LineCounter >= ($_SESSION['PageLength'] - 8 - $LinesRequiredForText)) { + $LinesRequiredForText = floor(strlen($myrow['invtext'])/140); + + if ($LineCounter >= ($_SESSION['PageLength'] - 8 - $LinesRequiredForText)){ + /* head up a new invoice/credit note page */ $PageNumber++; - echo '<table class="table1"><tr><td VALIGN=TOp><img src="' . $_SESSION['LogoFile'] . '"></td><td bgcolor="#BBBBBB"><b>'; - if ($InvOrCredit == 'Invoice') { - echo '<font size=4>' . _('TAX INVOICE') . ' '; + echo '<table class="table1"> + <tr><td valign=top><img src="' . $_SESSION['LogoFile'] . '"></td> + <td bgcolor="#BBBBBB"><b>'; + + if ($InvOrCredit=='Invoice') { + echo '<font size=4>' . _('TAX INVOICE') .' '; } else { - echo '<font color=RED size=4>' . _('TAX CREDIT NOTE') . ' '; + echo '<font color=RED size=4>' . _('TAX CREDIT NOTE') . ' '; } - echo '</b>' . _('Number') . ' ' . $FromTransNo . '</font><br /><font size=1>' . _('GST Number') . ' - ' . $_SESSION['CompanyRecord']['gstno'] . '</td></tr><table>'; + echo '</b>' . _('Number') . ' ' . $FromTransNo . '</font><br><font size=1>' . _('GST Number') . ' - ' . $_SESSION['CompanyRecord']['gstno'] . '</td></tr><table>'; + /* Print out the logo and company name and address */ - echo '<table class="table1"><tr><td><font size=4 color="#333333"><b>' . $_SESSION['CompanyRecord']['coyname'] . '</b></font><br />'; - echo $_SESSION['CompanyRecord']['regoffice1'] . '<br />'; - echo $_SESSION['CompanyRecord']['regoffice2'] . '<br />'; - echo $_SESSION['CompanyRecord']['regoffice3'] . '<br />'; - echo $_SESSION['CompanyRecord']['regoffice4'] . '<br />'; - echo $_SESSION['CompanyRecord']['regoffice5'] . '<br />'; - echo $_SESSION['CompanyRecord']['regoffice6'] . '<br />'; - echo _('Telephone') . ': ' . $_SESSION['CompanyRecord']['telephone'] . '<br />'; - echo _('Facsimile') . ': ' . $_SESSION['CompanyRecord']['fax'] . '<br />'; - echo _('Email') . ': ' . $_SESSION['CompanyRecord']['email'] . '<br />'; - echo '</td><td class=number>' . _('Page') . ': '.$PageNumber.'</td></tr></table>'; + echo '<table class="table1"> + <tr><td><font size=4 color="#333333"><b>' . $_SESSION['CompanyRecord']['coyname'] . '</b></font><br>'; + echo $_SESSION['CompanyRecord']['regoffice1'] . '<br>'; + echo $_SESSION['CompanyRecord']['regoffice2'] . '<br>'; + echo $_SESSION['CompanyRecord']['regoffice3'] . '<br>'; + echo $_SESSION['CompanyRecord']['regoffice4'] . '<br>'; + echo $_SESSION['CompanyRecord']['regoffice5'] . '<br>'; + echo $_SESSION['CompanyRecord']['regoffice6'] . '<br>'; + echo _('Telephone') . ': ' . $_SESSION['CompanyRecord']['telephone'] . '<br>'; + echo _('Facsimile') . ': ' . $_SESSION['CompanyRecord']['fax'] . '<br>'; + echo _('Email') . ': ' . $_SESSION['CompanyRecord']['email'] . '<br>'; + echo '</td><td class=number>' . _('Page') . ': ' . $PageNumber . '</td></tr></table>'; echo '<table class="table1"><tr> <th>' . _('Item Code') . '</th> <th>' . _('Item Description') . '</th> @@ -753,62 +938,87 @@ <th>' . _('Price') . '</th> <th>' . _('Discount') . '</th> <th>' . _('Net') . '</th></tr>'; + $LineCounter = 10; } + /* Space out the footer to the bottom of the page */ - echo '<br /><br />' . $myrow['invtext']; - $LineCounter = $LineCounter + 2 + $LinesRequiredForText; - while ($LineCounter < ($_SESSION['PageLength'] - 6)) { - echo '<br />'; + + echo '<br><br>' . $myrow['invtext']; + + $LineCounter=$LineCounter+2+$LinesRequiredForText; + while ($LineCounter < ($_SESSION['PageLength'] -6)){ + echo '<br>'; $LineCounter++; } + /* Now print out the footer and totals */ - if ($InvOrCredit == 'Invoice') { - $DisplaySubTot = number_format($myrow['ovamount'], 2); - $DisplayFreight = number_format($myrow['ovfreight'], 2); - $DisplayTax = number_format($myrow['ovgst'], 2); - $DisplayTotal = number_format($myrow['ovfreight'] + $myrow['ovgst'] + $myrow['ovamount'], 2); + + if ($InvOrCredit=='Invoice') { + + $DisplaySubTot = number_format($myrow['ovamount'],2); + $DisplayFreight = number_format($myrow['ovfreight'],2); + $DisplayTax = number_format($myrow['ovgst'],2); + $DisplayTotal = number_format($myrow['ovfreight']+$myrow['ovgst']+$myrow['ovamount'],2); } else { - $DisplaySubTot = number_format(-$myrow['ovamount'], 2); - $DisplayFreight = number_format(-$myrow['ovfreight'], 2); - $DisplayTax = number_format(-$myrow['ovgst'], 2); - $DisplayTotal = number_format(-$myrow['ovfreight'] - $myrow['ovgst'] - $myrow['ovamount'], 2); + $DisplaySubTot = number_format(-$myrow['ovamount'],2); + $DisplayFreight = number_format(-$myrow['ovfreight'],2); + $DisplayTax = number_format(-$myrow['ovgst'],2); + $DisplayTotal = number_format(-$myrow['ovfreight']-$myrow['ovgst']-$myrow['ovamount'],2); } + /*Print out the invoice text entered */ echo '<table class=table1><tr> <td class=number>' . _('Sub Total') . '</td> - <td class=number bgcolor="#EEEEEE" width=15%>'.$DisplaySubTot.'</td></tr>'; + <td class=number bgcolor="#EEEEEE" width=15%>' . $DisplaySubTot . '</td></tr>'; echo '<tr><td class=number>' . _('Freight') . '</td> - <td class=number bgcolor="#EEEEEE">'.$DisplayFreight.'</td></tr>'; + <td class=number bgcolor="#EEEEEE">' . $DisplayFreight . '</td></tr>'; echo '<tr><td class=number>' . _('Tax') . '</td> - <td class=number bgcolor="#EEEEEE">'.$DisplayTax.'</td></tr>'; - if ($InvOrCredit == 'Invoice') { - echo '<tr><td class=number><b>' . _('TOTAL INVOICE') . '</b></td> - <td class=number bgcolor="#EEEEEE"><U><b>'.$DisplayTotal.'</b></U></td></tr>'; + <td class=number bgcolor="#EEEEEE">' . $DisplayTax . '</td></tr>'; + if ($InvOrCredit=='Invoice'){ + echo '<tr><td class=number><b>' . _('TOTAL INVOICE') . '</b></td> + <td class=number bgcolor="#EEEEEE"><U><b>' . $DisplayTotal . '</b></U></td></tr>'; } else { - echo '<tr><td class=number><font color=RED><b>' . _('TOTAL CREDIT') . '</b></font></td> - <td class=number bgcolor="#EEEEEE"><font color=RED><U><b>'.$DisplayTotal.'</b></U></font></td></tr>'; + echo '<tr><td class=number><font color=RED><b>' . _('TOTAL CREDIT') . '</b></font></td> + <td class=number bgcolor="#EEEEEE"><font color="red"><U><b>' . $DisplayTotal . '</b></U></font></td></tr>'; } echo '</table>'; } /* end of check to see that there was an invoice record to print */ $FromTransNo++; } /* end loop to print invoices */ } /*end of if FromTransNo exists */ - include ('includes/footer.inc'); + include('includes/footer.inc'); } /*end of else not PrintPDF */ -function PrintLinesToBottom($pdf, $Page_Height, $PageNumber, $FormDesign) { + + +function PrintLinesToBottom () { + + global $pdf; + global $PageNumber; + global $TopOfColHeadings; + global $Left_Margin; + global $Bottom_Margin; + global $line_height; + /* draw the vertical column lines right to the bottom */ - $pdf->line($FormDesign->DataLines->Line1->startx, $Page_Height - $FormDesign->DataLines->Line1->starty, $FormDesign->DataLines->Line1->endx, $Page_Height - $FormDesign->DataLines->Line1->endy); + $pdf->line($Left_Margin+97, $TopOfColHeadings+12,$Left_Margin+97,$Bottom_Margin); + /* Print a column vertical line */ - $pdf->line($FormDesign->DataLines->Line2->startx, $Page_Height - $FormDesign->DataLines->Line2->starty, $FormDesign->DataLines->Line2->endx, $Page_Height - $FormDesign->DataLines->Line2->endy); + $pdf->line($Left_Margin+350, $TopOfColHeadings+12,$Left_Margin+350,$Bottom_Margin); + /* Print a column vertical line */ - $pdf->line($FormDesign->DataLines->Line3->startx, $Page_Height - $FormDe... [truncated message content] |
From: <dai...@us...> - 2011-05-07 00:24:46
|
Revision: 4562 http://web-erp.svn.sourceforge.net/web-erp/?rev=4562&view=rev Author: daintree Date: 2011-05-07 00:24:37 +0000 (Sat, 07 May 2011) Log Message: ----------- various Modified Paths: -------------- trunk/PrintCustTrans.php trunk/PrintCustTransPortrait.php trunk/Shipt_Select.php trunk/Stocks.php trunk/UpgradeDatabase.php trunk/doc/Change.log trunk/includes/PDFTransPageHeader.inc trunk/includes/session.inc Modified: trunk/PrintCustTrans.php =================================================================== --- trunk/PrintCustTrans.php 2011-05-03 10:05:05 UTC (rev 4561) +++ trunk/PrintCustTrans.php 2011-05-07 00:24:37 UTC (rev 4562) @@ -1,7 +1,9 @@ <?php + /* $Id$ */ -include ('includes/session.inc'); +include('includes/session.inc'); + if (isset($_GET['FromTransNo'])) { $FromTransNo = trim($_GET['FromTransNo']); } elseif (isset($_POST['FromTransNo'])) { @@ -9,43 +11,74 @@ } else { $FromTransNo = ''; } + if (isset($_GET['InvOrCredit'])) { $InvOrCredit = $_GET['InvOrCredit']; } elseif (isset($_POST['InvOrCredit'])) { $InvOrCredit = $_POST['InvOrCredit']; } + if (isset($_GET['PrintPDF'])) { $PrintPDF = TRUE; } elseif (isset($_POST['PrintPDF'])) { $PrintPDF = TRUE; } -if (!isset($_POST['ToTransNo']) or trim($_POST['ToTransNo']) == '' or $_POST['ToTransNo'] < $FromTransNo) { + +if (!isset($_POST['ToTransNo']) + or trim($_POST['ToTransNo'])=='' + or $_POST['ToTransNo'] < $FromTransNo) { + $_POST['ToTransNo'] = $FromTransNo; } + $FirstTrans = $FromTransNo; /* Need to start a new page only on subsequent transactions */ -if ($FromTransNo=='Preview') { - $FormDesign = simplexml_load_file(sys_get_temp_dir().'/SalesInvoice.xml'); -} else { - $FormDesign = simplexml_load_file($PathPrefix.'companies/'.$_SESSION['DatabaseName'].'/FormDesigns/SalesInvoice.xml'); -} -if (isset($PrintPDF) or isset($_GET['PrintPDF']) and $PrintPDF and isset($FromTransNo) and isset($InvOrCredit) and $FromTransNo != '') { - $PaperSize = $FormDesign->PaperSize; - include ('includes/PDFStarter.php'); - if ($InvOrCredit == 'Invoice') { - $pdf->addInfo('Title', _('Sales Invoice') . ' ' . $FromTransNo . ' to ' . $_POST['ToTransNo']); - $pdf->addInfo('Subject', _('Invoices from') . ' ' . $FromTransNo . ' ' . _('to') . ' ' . $_POST['ToTransNo']); + +if (isset($PrintPDF) OR isset($_GET['PrintPDF']) + AND $PrintPDF + AND isset($FromTransNo) + AND isset($InvOrCredit) + AND $FromTransNo!=''){ + + include ('includes/class.pdf.php'); + + /* This invoice is hard coded for A4 Landscape invoices or credit notes so can't use PDFStarter.inc */ + + $Page_Width=842; + $Page_Height=595; + $Top_Margin=30; + $Bottom_Margin=30; + $Left_Margin=40; + $Right_Margin=30; + + + $pdf = new Cpdf('L', 'pt', 'A4'); + $pdf->addInfo('Creator', 'webERP http://www.weberp.org'); + $pdf->addInfo('Author', 'webERP ' . $Version); + + if ($InvOrCredit=='Invoice') { + $pdf->addInfo('Title',_('Sales Invoice') . ' ' . $FromTransNo . ' to ' . $_POST['ToTransNo']); + $pdf->addInfo('Subject',_('Invoices from') . ' ' . $FromTransNo . ' ' . _('to') . ' ' . $_POST['ToTransNo']); } else { - $pdf->addInfo('Title', _('Sales Credit Note')); - $pdf->addInfo('Subject', _('Credit Notes from') . ' ' . $FromTransNo . ' ' . _('to') . ' ' . $_POST['ToTransNo']); + $pdf->addInfo('Title',_('Sales Credit Note') ); + $pdf->addInfo('Subject',_('Credit Notes from') . ' ' . $FromTransNo . ' ' . _('to') . ' ' . $_POST['ToTransNo']); } + $pdf->setAutoPageBreak(0); + $pdf->setPrintHeader(false); + $pdf->AddPage(); + $pdf->cMargin = 0; +/* END Brought from class.pdf.php constructor */ + $FirstPage = true; - $line_height = $FormDesign->LineHeight; - while ($FromTransNo <= $_POST['ToTransNo']) { - /* retrieve the invoice details from the database to print - notice that salesorder record must be present to print the invoice purging of sales orders will - nobble the invoice reprints */ - if ($InvOrCredit == 'Invoice') { + $line_height=16; + + while ($FromTransNo <= $_POST['ToTransNo']){ + + /* retrieve the invoice details from the database to print + notice that salesorder record must be present to print the invoice purging of sales orders will + nobble the invoice reprints */ + + if ($InvOrCredit=='Invoice') { $sql = "SELECT debtortrans.trandate, debtortrans.ovamount, debtortrans.ovdiscount, @@ -111,7 +144,8 @@ AND debtortrans.branchcode=custbranch.branchcode AND custbranch.salesman=salesman.salesmancode AND salesorders.fromstkloc=locations.loccode"; - if (isset($_POST['PrintEDI']) and $_POST['PrintEDI'] == 'No') { + + if (isset($_POST['PrintEDI']) and $_POST['PrintEDI']=='No') { $sql = $sql . " AND debtorsmaster.ediinvoices=0"; } } else { @@ -161,31 +195,29 @@ AND debtortrans.debtorno=custbranch.debtorno AND debtortrans.branchcode=custbranch.branchcode AND custbranch.salesman=salesman.salesmancode"; - if ($_POST['PrintEDI'] == 'No') { + + if ($_POST['PrintEDI']=='No') { $sql = $sql . " AND debtorsmaster.ediinvoices=0"; } } // end else - if ($FromTransNo!='Preview') { - $result = DB_query($sql, $db, '', '', false, false); - if (DB_error_no($db) != 0) { - $title = _('Transaction Print Error Report'); - include ('includes/header.inc'); - prnMsg(_('There was a problem retrieving the invoice or credit note details for note number') . ' ' . $InvoiceToPrint . ' ' . _('from the database') . '. ' . _('To print an invoice, the sales order record, the customer transaction record and the branch record for the customer must not have been purged') . '. ' . _('To print a credit note only requires the customer, transaction, salesman and branch records be available'), 'error'); - if ($debug == 1) { - prnMsg(_('The SQL used to get this information that failed was') . '<br />' . $sql, 'error'); - } - include ('includes/footer.inc'); - exit; + + $result=DB_query($sql, $db, '', '',false, false); + + if (DB_error_no($db)!=0) { + $title = _('Transaction Print Error Report'); + include ('includes/header.inc'); + prnMsg( _('There was a problem retrieving the invoice or credit note details for note number') . ' ' . $InvoiceToPrint . ' ' . _('from the database') . '. ' . _('To print an invoice, the sales order record, the customer transaction record and the branch record for the customer must not have been purged') . '. ' . _('To print a credit note only requires the customer, transaction, salesman and branch records be available'),'error'); + if ($debug==1) { + prnMsg (_('The SQL used to get this information that failed was') . '<br />' . $sql,'error'); } + include ('includes/footer.inc'); + exit; } - if ($FromTransNo=='Preview' or DB_num_rows($result) == 1) { - if ($FromTransNo!='Preview') { - $myrow = DB_fetch_array($result); - $ExchRate = $myrow['rate']; - } else { - $ExchRate = 'X'; - } - if ($InvOrCredit == 'Invoice') { + if (DB_num_rows($result)==1) { + $myrow = DB_fetch_array($result); + $ExchRate = $myrow['rate']; + if ($InvOrCredit=='Invoice') { + $sql = "SELECT stockmoves.stockid, stockmaster.description, -stockmoves.qty as quantity, @@ -193,16 +225,15 @@ ((1 - stockmoves.discountpercent) * stockmoves.price * " . $ExchRate . "* -stockmoves.qty) AS fxnet, (stockmoves.price * " . $ExchRate . ") AS fxprice, stockmoves.narrative, - stockmaster.units, - stockmaster.decimalplaces + stockmaster.units FROM stockmoves, stockmaster WHERE stockmoves.stockid = stockmaster.stockid AND stockmoves.type=10 - AND stockmoves.transno='" . $FromTransNo . "' + AND stockmoves.transno=" . $FromTransNo . " AND stockmoves.show_on_inv_crds=1"; } else { - /* only credit notes to be retrieved */ + /* only credit notes to be retrieved */ $sql = "SELECT stockmoves.stockid, stockmaster.description, stockmoves.qty as quantity, @@ -210,224 +241,294 @@ ((1 - stockmoves.discountpercent) * stockmoves.price * " . $ExchRate . " * stockmoves.qty) AS fxnet, (stockmoves.price * " . $ExchRate . ") AS fxprice, stockmoves.narrative, - stockmaster.units, - stockmaster.decimalplaces + stockmaster.units FROM stockmoves, stockmaster WHERE stockmoves.stockid = stockmaster.stockid AND stockmoves.type=11 - AND stockmoves.transno='" . $FromTransNo . "' + AND stockmoves.transno=" . $FromTransNo . " AND stockmoves.show_on_inv_crds=1"; } // end else - if ($FromTransNo!='Preview') { - $result = DB_query($sql, $db); - } - if (DB_error_no($db) != 0) { + + $result=DB_query($sql,$db); + if (DB_error_no($db)!=0) { $title = _('Transaction Print Error Report'); include ('includes/header.inc'); echo '<br />' . _('There was a problem retrieving the invoice or credit note stock movement details for invoice number') . ' ' . $FromTransNo . ' ' . _('from the database'); - if ($debug == 1) { - echo '<br />' . _('The SQL used to get this information that failed was') . '<br />' . $sql; + if ($debug==1) { + echo '<br />' . _('The SQL used to get this information that failed was') . '<br>' . $sql; } - include ('includes/footer.inc'); + include('includes/footer.inc'); exit; } - if ($FromTransNo=='Preview' or DB_num_rows($result) > 0) { + + if (DB_num_rows($result)>0) { + + $FontSize = 10; $PageNumber = 1; - include ('includes/PDFTransPageHeader.inc'); + + include('includes/PDFTransPageHeader.inc'); $FirstPage = False; - $YPos = $Page_Height - $FormDesign->Data->y; - $Line=1; - while (($FromTransNo=='Preview' and $Line==1) or (isset($result) and $myrow2 = DB_fetch_array($result))) { - if ($myrow2['discountpercent'] == 0) { - $DisplayDiscount = ''; + while ($myrow2=DB_fetch_array($result)) { + + if ($myrow2['discountpercent']==0) { + $DisplayDiscount =''; } else { - $DisplayDiscount = number_format($myrow2['discountpercent'] * 100, 2) . '%'; - $DiscountPrice = $myrow2['fxprice'] * (1 - $myrow2['discountpercent']); + $DisplayDiscount = number_format($myrow2['discountpercent']*100,2) . '%'; + $DiscountPrice=$myrow2['fxprice']*(1-$myrow2['discountpercent']); } - $DisplayNet = number_format($myrow2['fxnet'], 2); - $DisplayPrice = $myrow2['fxprice']; - $DisplayQty = $myrow2['quantity']; - $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column1->x, $YPos,$FormDesign->Data->Column1->Length, $FormDesign->Data->Column1->FontSize, $myrow2['stockid']); - $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column2->x, $YPos,$FormDesign->Data->Column2->Length, $FormDesign->Data->Column2->FontSize, $myrow2['description']); - $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column3->x, $YPos,$FormDesign->Data->Column3->Length, $FormDesign->Data->Column3->FontSize, number_format($DisplayPrice,4), 'right'); - $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column4->x, $YPos,$FormDesign->Data->Column4->Length, $FormDesign->Data->Column4->FontSize, number_format($DisplayQty,$myrow2['decimalplaces']), 'right'); - $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column5->x, $YPos,$FormDesign->Data->Column5->Length, $FormDesign->Data->Column5->FontSize, $myrow2['units'], 'centre'); - $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column6->x, $YPos,$FormDesign->Data->Column6->Length, $FormDesign->Data->Column6->FontSize, $DisplayDiscount, 'right'); - $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column7->x, $YPos,$FormDesign->Data->Column7->Length, $FormDesign->Data->Column7->FontSize, $DisplayNet, 'right'); - $YPos-= ($line_height); - $lines = explode('\r\n', htmlspecialchars_decode($myrow2['narrative'])); - for ($i = 0;$i < sizeOf($lines);$i++) { - while (strlen($lines[$i]) > 1) { - if ($YPos - $line_height <= $Bottom_Margin) { + $DisplayNet=number_format($myrow2['fxnet'],2); + $DisplayPrice=number_format($myrow2['fxprice'],3); + $DisplayQty=$myrow2['quantity']; + + $LeftOvers = $pdf->addTextWrap($Left_Margin+3,$YPos,95,$FontSize,$myrow2['stockid']); + $LeftOvers = $pdf->addTextWrap($Left_Margin+100,$YPos,123,$FontSize,$myrow2['description']); + $LeftOvers = $pdf->addTextWrap($Left_Margin+353,$YPos,96,$FontSize,$DisplayPrice,'right'); + $LeftOvers = $pdf->addTextWrap($Left_Margin+453,$YPos,95,$FontSize,$DisplayQty,'right'); + $LeftOvers = $pdf->addTextWrap($Left_Margin+553,$YPos,35,$FontSize,$myrow2['units'],'centre'); + $LeftOvers = $pdf->addTextWrap($Left_Margin+590,$YPos,50,$FontSize,$DisplayDiscount,'right'); + $LeftOvers = $pdf->addTextWrap($Left_Margin+642,$YPos,120,$FontSize,$DisplayNet,'right'); + + $YPos -= ($line_height); + + $lines=explode('\r\n',htmlspecialchars_decode($myrow2['narrative'])); + for ($i=0;$i<sizeOf($lines);$i++) { + while (strlen($lines[$i])>1) { + if ($YPos-$line_height <= $Bottom_Margin) { /* head up a new invoice/credit note page */ /* draw the vertical column lines right to the bottom */ - PrintLinesToBottom($pdf, $Page_Height, $PageNumber, $FormDesign); - include ('includes/PDFTransPageHeaderPortrait.inc'); - } //end if need a new page headed up - /* increment a line down for the next line item */ - if (strlen($lines[$i]) > 1) { - $lines[$i] = $pdf->addTextWrap($Left_Margin + 100, $YPos, 245, $FontSize, stripslashes($lines[$i])); + PrintLinesToBottom (); + include ('includes/PDFTransPageHeaderPortrait.inc'); + } //end if need a new page headed up + + /* increment a line down for the next line item */ + if (strlen($lines[$i])>1){ + $lines[$i] = $pdf->addTextWrap($Left_Margin+100,$YPos,245,$FontSize,stripslashes($lines[$i])); } - $YPos-= ($line_height); - } - } + $YPos -= ($line_height); + } + } //end for loop around lines of narrative to display if ($YPos <= $Bottom_Margin) { + /* head up a new invoice/credit note page */ /*draw the vertical column lines right to the bottom */ - PrintLinesToBottom($pdf, $Page_Height, $PageNumber, $FormDesign); + PrintLinesToBottom (); include ('includes/PDFTransPageHeader.inc'); } //end if need a new page headed up - $Line++; - } //end while there are line items to print out + } //end while there invoice are line items to print out + } /*end if there are stock movements to show on the invoice or credit note*/ - } /*end if there are stock movements to show on the invoice or credit note*/ - $YPos-= $line_height; + $YPos -= $line_height; + /* check to see enough space left to print the 4 lines for the totals/footer */ - if (($YPos - $Bottom_Margin) < (2 * $line_height)) { - PrintLinesToBottom($pdf, $Page_Height, $PageNumber, $FormDesign); + if (($YPos-$Bottom_Margin)<(2*$line_height)) { + PrintLinesToBottom (); include ('includes/PDFTransPageHeader.inc'); } /* Print a column vertical line with enough space for the footer */ /* draw the vertical column lines to 4 lines shy of the bottom to leave space for invoice footer info ie totals etc */ - $pdf->line($FormDesign->DataLines->Line1->startx, $Page_Height - $FormDesign->DataLines->Line1->starty, $FormDesign->DataLines->Line1->endx, $Page_Height - $FormDesign->DataLines->Line1->endy); + $pdf->line($Left_Margin+97, $TopOfColHeadings+12,$Left_Margin+97,$Bottom_Margin+(4*$line_height)); + /* Print a column vertical line */ - $pdf->line($FormDesign->DataLines->Line2->startx, $Page_Height - $FormDesign->DataLines->Line2->starty, $FormDesign->DataLines->Line2->endx, $Page_Height - $FormDesign->DataLines->Line2->endy); + $pdf->line($Left_Margin+350, $TopOfColHeadings+12,$Left_Margin+350,$Bottom_Margin+(4*$line_height)); + /* Print a column vertical line */ - $pdf->line($FormDesign->DataLines->Line3->startx, $Page_Height - $FormDesign->DataLines->Line3->starty, $FormDesign->DataLines->Line3->endx, $Page_Height - $FormDesign->DataLines->Line3->endy); + $pdf->line($Left_Margin+450, $TopOfColHeadings+12,$Left_Margin+450,$Bottom_Margin+(4*$line_height)); + /* Print a column vertical line */ - $pdf->line($FormDesign->DataLines->Line4->startx, $Page_Height - $FormDesign->DataLines->Line4->starty, $FormDesign->DataLines->Line4->endx, $Page_Height - $FormDesign->DataLines->Line4->endy); + $pdf->line($Left_Margin+550, $TopOfColHeadings+12,$Left_Margin+550,$Bottom_Margin+(4*$line_height)); + /* Print a column vertical line */ - $pdf->line($FormDesign->DataLines->Line5->startx, $Page_Height - $FormDesign->DataLines->Line5->starty, $FormDesign->DataLines->Line5->endx, $Page_Height - $FormDesign->DataLines->Line5->endy); - $pdf->line($FormDesign->DataLines->Line6->startx, $Page_Height - $FormDesign->DataLines->Line6->starty, $FormDesign->DataLines->Line6->endx, $Page_Height - $FormDesign->DataLines->Line6->endy); + $pdf->line($Left_Margin+587, $TopOfColHeadings+12,$Left_Margin+587,$Bottom_Margin+(4*$line_height)); + + $pdf->line($Left_Margin+640, $TopOfColHeadings+12,$Left_Margin+640,$Bottom_Margin+(4*$line_height)); + /* Rule off at bottom of the vertical lines */ - $pdf->line($FormDesign->LineAboveFooter->startx, $Page_Height - $FormDesign->LineAboveFooter->starty, $FormDesign->LineAboveFooter->endx, $Page_Height - $FormDesign->LineAboveFooter->endy); + $pdf->line($Left_Margin, $Bottom_Margin+(4*$line_height),$Page_Width-$Right_Margin,$Bottom_Margin+(4*$line_height)); + /* Now print out the footer and totals */ - if ($InvOrCredit == 'Invoice') { - $DisplaySubTot = number_format($myrow['ovamount'], 2); - $DisplayFreight = number_format($myrow['ovfreight'], 2); - $DisplayTax = number_format($myrow['ovgst'], 2); - $DisplayTotal = number_format($myrow['ovfreight'] + $myrow['ovgst'] + $myrow['ovamount'], 2); + + if ($InvOrCredit=='Invoice') { + + $DisplaySubTot = number_format($myrow['ovamount'],2); + $DisplayFreight = number_format($myrow['ovfreight'],2); + $DisplayTax = number_format($myrow['ovgst'],2); + $DisplayTotal = number_format($myrow['ovfreight']+$myrow['ovgst']+$myrow['ovamount'],2); + } else { - $DisplaySubTot = number_format(-$myrow['ovamount'], 2); - $DisplayFreight = number_format(-$myrow['ovfreight'], 2); - $DisplayTax = number_format(-$myrow['ovgst'], 2); - $DisplayTotal = number_format(-$myrow['ovfreight'] - $myrow['ovgst'] - $myrow['ovamount'], 2); + + $DisplaySubTot = number_format(-$myrow['ovamount'],2); + $DisplayFreight = number_format(-$myrow['ovfreight'],2); + $DisplayTax = number_format(-$myrow['ovgst'],2); + $DisplayTotal = number_format(-$myrow['ovfreight']-$myrow['ovgst']-$myrow['ovamount'],2); } + /* Print out the invoice text entered */ + $YPos = $Bottom_Margin+(3*$line_height); + /* Print out the payment terms */ - $pdf->addTextWrap($FormDesign->PaymentTerms->x, $Page_Height - $FormDesign->PaymentTerms->y, $FormDesign->PaymentTerms->Length, $FormDesign->PaymentTerms->FontSize, _('Payment Terms') . ': ' . $myrow['terms']); - // $pdf->addText($Page_Width-$Right_Margin-392, $YPos - ($line_height*3)+22,$FontSize, _('Bank Code:***** Bank Account:*****')); - // $FontSize=10; - $LeftOvers=explode('\r\n',DB_escape_string($myrow['invtext'])); - for ($i=0;$i<sizeOf($LeftOvers);$i++) { - $pdf->addText($FormDesign->InvoiceText->x, $Page_Height - $FormDesign->InvoiceText->y-($i*10), $FormDesign->InvoiceText->FontSize, $LeftOvers[$i]); + $pdf->addTextWrap($Left_Margin+5,$YPos+3,280,$FontSize,_('Payment Terms') . ': ' . $myrow['terms']); + // $pdf->addText($Page_Width-$Right_Margin-392, $YPos - ($line_height*3)+22,$FontSize, _('Bank Code:***** Bank Account:*****')); + // $FontSize=10; + + $FontSize =8; + $LeftOvers = $pdf->addTextWrap($Left_Margin+5,$YPos-12,280,$FontSize,$myrow['invtext']); + if (strlen($LeftOvers)>0) { + $LeftOvers = $pdf->addTextWrap($Left_Margin+5,$YPos-24,280,$FontSize,$LeftOvers); + if (strlen($LeftOvers)>0) { + $LeftOvers = $pdf->addTextWrap($Left_Margin+5,$YPos-36,280,$FontSize,$LeftOvers); + /*If there is some of the InvText leftover after 3 lines 200 wide then it is not printed :( */ + } } - $pdf->addText($FormDesign->SubTotalCaption->x, $Page_Height - $FormDesign->SubTotalCaption->y, $FormDesign->SubTotalCaption->FontSize, _('Sub Total')); - $LeftOvers = $pdf->addTextWrap($FormDesign->SubTotal->x, $Page_Height - $FormDesign->SubTotal->y, $FormDesign->SubTotal->Length, $FormDesign->SubTotal->FontSize, $DisplaySubTot, 'right'); - $pdf->addText($FormDesign->FreightCaption->x, $Page_Height - $FormDesign->FreightCaption->y, $FormDesign->FreightCaption->FontSize, _('Freight')); - $LeftOvers = $pdf->addTextWrap($FormDesign->Freight->x, $Page_Height - $FormDesign->Freight->y, $FormDesign->Freight->Length, $FormDesign->Freight->FontSize, $DisplayFreight, 'right'); - $pdf->addText($FormDesign->TaxCaption->x, $Page_Height - $FormDesign->TaxCaption->y, $FormDesign->TaxCaption->FontSize, _('Tax')); - $LeftOvers = $pdf->addTextWrap($FormDesign->Tax->x, $Page_Height - $FormDesign->Tax->y, $FormDesign->Tax->Length, $FormDesign->Tax->FontSize, $DisplayTax, 'right'); + $FontSize = 10; + + $pdf->addText($Page_Width-$Right_Margin-220, $YPos+15,$FontSize, _('Sub Total')); + $LeftOvers = $pdf->addTextWrap($Left_Margin+642,$YPos+5,120,$FontSize,$DisplaySubTot, 'right'); + + $pdf->addText($Page_Width-$Right_Margin-220, $YPos+2,$FontSize, _('Freight')); + $LeftOvers = $pdf->addTextWrap($Left_Margin+642,$YPos-6,120,$FontSize,$DisplayFreight, 'right'); + + $pdf->addText($Page_Width-$Right_Margin-220, $YPos-10,$FontSize, _('Tax')); + $LeftOvers = $pdf->addTextWrap($Left_Margin+642,$YPos-($line_height)-5,120, $FontSize,$DisplayTax, 'right'); + /*rule off for total */ - $pdf->line($FormDesign->TotalLine->startx, $Page_Height - $FormDesign->TotalLine->starty, $FormDesign->TotalLine->endx, $Page_Height - $FormDesign->TotalLine->endy); + $pdf->line($Page_Width-$Right_Margin-222, $YPos-(2*$line_height),$Page_Width-$Right_Margin,$YPos-(2*$line_height)); + /*vertical to separate totals from comments and ROMALPA */ - $pdf->line($FormDesign->RomalpaLine->startx, $Page_Height - $FormDesign->RomalpaLine->starty, $FormDesign->RomalpaLine->endx, $Page_Height - $FormDesign->RomalpaLine->endy); - if ($InvOrCredit == 'Invoice') { - $pdf->addText($FormDesign->TotalCaption->x, $Page_Height - $FormDesign->TotalCaption->y, $FormDesign->TotalCaption->FontSize, _('TOTAL INVOICE')); - $YPos=$FormDesign->Romalpa->y; - $LeftOvers = $pdf->addTextWrap($FormDesign->Romalpa->x, $Page_Height - $YPos, $FormDesign->Romalpa->Length, $FormDesign->Romalpa->FontSize, $_SESSION['RomalpaClause']); - while (strlen($LeftOvers) > 0 AND ($Page_Height - $YPos) > $Bottom_Margin) { - $YPos+= $FormDesign->Romalpa->FontSize+1; - $LeftOvers = $pdf->addTextWrap($FormDesign->Romalpa->x, $Page_Height - $YPos, $FormDesign->Romalpa->Length, $FormDesign->Romalpa->FontSize, $LeftOvers); + $pdf->line($Page_Width-$Right_Margin-222, $YPos+$line_height,$Page_Width-$Right_Margin-222,$Bottom_Margin); + + $YPos+=10; + if ($InvOrCredit=='Invoice') { + $pdf->addText($Page_Width-$Right_Margin-220, $YPos - ($line_height*2)-10,$FontSize, _('TOTAL INVOICE')); + $FontSize=9; + $YPos-=4; + $LeftOvers = $pdf->addTextWrap($Left_Margin+280,$YPos,220,$FontSize,$_SESSION['RomalpaClause']); + while (strlen($LeftOvers)>0 AND $YPos > $Bottom_Margin) { + $YPos-=12; + $LeftOvers = $pdf->addTextWrap($Left_Margin+280,$YPos,220,$FontSize,$LeftOvers); } /* Add Images for Visa / Mastercard / Paypal */ if (file_exists('companies/' . $_SESSION['DatabaseName'] . '/payment.jpg')) { - $pdf->addJpegFromFile('companies/' . $_SESSION['DatabaseName'] . '/payment.jpg', $FormDesign->CreditCardLogo->x,$Page_Height -$FormDesign->CreditCardLogo->y,$FormDesign->CreditCardLogo->width,$FormDesign->CreditCardLogo->height); + $pdf->addJpegFromFile('companies/' . $_SESSION['DatabaseName'] . '/payment.jpg',$Page_Width/2 -280,$YPos-20,0,40); } -// $pdf->addText($Page_Width - $Right_Margin - 472, $YPos - ($line_height * 3) + 32, $FontSize, ''); + $pdf->addText($Page_Width-$Right_Margin-472, $YPos - ($line_height*3)+32,$FontSize, ''); + $FontSize=10; } else { - $pdf->addText($FormDesign->TotalCaption->x, $Page_Height - $FormDesign->TotalCaption->y, $FormDesign->TotalCaption->FontSize, _('TOTAL CREDIT')); - } - $LeftOvers = $pdf->addTextWrap($FormDesign->Total->x, $Page_Height - $FormDesign->Total->y, $FormDesign->Total->Length, $FormDesign->Total->FontSize, $DisplayTotal, 'right'); + $pdf->addText($Page_Width-$Right_Margin-220, $YPos-($line_height*2)-10,$FontSize, _('TOTAL CREDIT')); + } + $LeftOvers = $pdf->addTextWrap($Left_Margin+642,35,120, $FontSize,$DisplayTotal, 'right'); } /* end of check to see that there was an invoice record to print */ + $FromTransNo++; + } /* end loop to print invoices */ + + // Have to get the TransNo again, GET[FromTransNo] is updated on each pass of loop + if (isset($_GET['FromTransNo'])) { + $FromTransNo = trim($_GET['FromTransNo']); + } elseif (isset($_POST['FromTransNo'])) { + $FromTransNo = trim($_POST['FromTransNo']); } -} /* end loop to print invoices */ + + + if (isset($_GET['Email'])){ //email the invoice to address supplied + include('includes/header.inc'); -if (($InvOrCredit == 'Invoice' or $InvOrCredit == 'Credit') and isset($PrintPDF)) { - - if (isset($_GET['Email'])) { //email the invoice to address supplied - include ('includes/header.inc'); include ('includes/htmlMimeMail.php'); + $FileName = $_SESSION['reports_dir'] . '/' . $_SESSION['DatabaseName'] . '_' . $InvOrCredit . '_' . $_GET['FromTransNo'] . '.pdf'; + $pdf->Output($FileName,'F'); $mail = new htmlMimeMail(); - $FileName = $_SESSION['reports_dir'] . '/' . $_SESSION['DatabaseName'] . '_' . $InvOrCredit . '_' . $_GET['FromTransNo'] . '.pdf'; - $pdf->Output($FileName, 'F'); + $Attachment = $mail->getFile($FileName); - $mail->setText(_('Please find attached') . ' ' . $InvOrCredit . ' ' . $_GET['FromTransNo']); + $mail->setText(_('Please find attached') . ' ' . $InvOrCredit . ' ' . $_GET['FromTransNo'] ); $mail->SetSubject($InvOrCredit . ' ' . $_GET['FromTransNo']); $mail->addAttachment($Attachment, $FileName, 'application/pdf'); $mail->setFrom($_SESSION['CompanyRecord']['coyname'] . ' <' . $_SESSION['CompanyRecord']['email'] . '>'); $result = $mail->send(array($_GET['Email'])); + unlink($FileName); //delete the temporary file - $title = _('Emailing') . ' ' . $InvOrCredit . ' ' . _('Number') . ' ' . $FromTransNo; - include ('includes/header.inc'); - echo '<p>' . $InvOrCredit . ' ' . _('number') . ' ' . $_GET['FromTransNo'] . ' ' . _('has been emailed to') . ' ' . $_GET['Email']; - include ('includes/footer.inc'); + + $title = _('Emailing') . ' ' .$InvOrCredit . ' ' . _('Number') . ' ' . $FromTransNo; + include('includes/header.inc'); + echo '<p>' . $InvOrCredit . ' ' . _('number') . ' ' . $FromTransNo . ' ' . _('has been emailed to') . ' ' . $_GET['Email']; + include('includes/footer.inc'); exit; - } else { - $pdf->OutputD( $_SESSION['DatabaseName'] . '_' . $InvOrCredit . '_' . $_GET['FromTransNo'] . '.pdf'); + + } else { //its not an email just print the invoice to PDF + $pdf->OutputD($_SESSION['DatabaseName'] . '_' . $InvOrCredit . '_' . $FromTransNo . '.pdf'); + } $pdf->__destruct(); + } else { /*The option to print PDF was not hit */ - $title = _('Select Invoices/Credit Notes To Print'); - include ('includes/header.inc'); - if (!isset($FromTransNo) OR $FromTransNo == '') { + + $title=_('Select Invoices/Credit Notes To Print'); + include('includes/header.inc'); + + if (!isset($FromTransNo) OR $FromTransNo=='') { + /* if FromTransNo is not set then show a form to allow input of either a single invoice number or a range of invoices to be printed. Also get the last invoice number created to show the user where the current range is up to */ - echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="POST"> - <table class="selection">'; + echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<p class="page_title_text"><img src="' . $rootpath . '/css/' . $theme . '/images/printer.png" title="' . _('Print') . '" alt="" />' . ' ' . _('Print Invoices or Credit Notes (Landscape Mode)') . '</p>'; - echo '<tr><td>' . _('Print Invoices or Credit Notes') . '</td><td><select name=InvOrCredit>'; - if ($InvOrCredit == 'Invoice' OR !isset($InvOrCredit)) { + + echo '<div class="centre"><p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/printer.png" title="' . _('Print') . '" alt="">' . ' ' . _('Print Invoices or Credit Notes (Landscape Mode)') . '</div>'; + echo '<table class="table1"> + <tr><td>' . _('Print Invoices or Credit Notes') . '</td><td><select name=InvOrCredit>'; + if ($InvOrCredit=='Invoice' OR !isset($InvOrCredit)) { + echo '<option selected value="Invoice">' . _('Invoices') . '</option>'; - echo '<option value="Credit">' . _('Credit Notes'). '</option>'; + echo '<option value="Credit">' . _('Credit Notes') . '</option>'; } else { echo '<option selected value="Credit">' . _('Credit Notes') . '</option>'; echo '<option value="Invoice">' . _('Invoices') . '</option>'; } + echo '</select></td></tr>'; echo '<tr><td>' . _('Print EDI Transactions') . '</td><td><select name=PrintEDI>'; - if ($InvOrCredit == 'Invoice' OR !isset($InvOrCredit)) { + + if ($InvOrCredit=='Invoice' OR !isset($InvOrCredit)) { + echo '<option selected value="No">' . _('Do not Print PDF EDI Transactions') . '</option>'; echo '<option value="Yes">' . _('Print PDF EDI Transactions Too') . '</option>'; + } else { + echo '<option value="No">' . _('Do not Print PDF EDI Transactions') . '</option>'; echo '<option selected value="Yes">' . _('Print PDF EDI Transactions Too') . '</option>'; } + echo '</select></td></tr>'; echo '<tr><td>' . _('Start invoice/credit note number to print') . '</td> - <td><input type="text" class="number" max=6 size=7 name=FromTransNo></td></tr>'; + <td><input Type=text class=number max=6 size=7 name=FromTransNo></td></tr>'; echo '<tr><td>' . _('End invoice/credit note number to print') . '</td> - <td><input Type="text" class="number" max=6 size=7 name="ToTransNo"></td> - </tr></table>'; - echo '<br /><div class="centre"><input type="submit" name="Print" value="' . _('Print') . '"><p />'; + <td><input Type=text class=number max=6 size=7 name="ToTransNo"></td></tr> + </table>'; + echo '<div class="centre"><input type="submit" name="Print" value="' . _('Print') . '"><p>'; echo '<input type="submit" name="PrintPDF" value="' . _('Print PDF') . '"></div>'; + $sql = "SELECT typeno FROM systypes WHERE typeid=10"; - $result = DB_query($sql, $db); + + $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); - echo '<div class="page_help_text"><b>' . _('The last invoice created was number') . ' ' . $myrow[0] . '</b><br />' . _('If only a single invoice is required') . ', ' . _('enter the invoice number to print in the Start transaction number to print field and leave the End transaction number to print field blank') . '. ' . _('Only use the end invoice to print field if you wish to print a sequential range of invoices') . ''; + + echo '<div class="page_help_text"><b>' . _('The last invoice created was number') . ' ' . $myrow[0] . '</b><br>' . _('If only a single invoice is required') . ', ' . _('enter the invoice number to print in the Start transaction number to print field and leave the End transaction number to print field blank') . '. ' . _('Only use the end invoice to print field if you wish to print a sequential range of invoices') . ''; + $sql = "SELECT typeno FROM systypes WHERE typeid=11"; - $result = DB_query($sql, $db); + + $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); - echo '<br /><b>' . _('The last credit note created was number') . ' ' . $myrow[0] . '</b><br />' . - _('A sequential range can be printed using the same method as for invoices above') . '. ' . _('A single credit note can be printed by only entering a start transaction number') . '</div>'; + + echo '<br /><b>' . _('The last credit note created was number') . ' ' . $myrow[0] . '</b><br />' . _('A sequential range can be printed using the same method as for invoices above') . '. ' . _('A single credit note can be printed by only entering a start transaction number') . '</DIV'; + } else { + while ($FromTransNo <= $_POST['ToTransNo']) { + /*retrieve the invoice details from the database to print notice that salesorder record must be present to print the invoice purging of sales orders will nobble the invoice reprints */ - if ($InvOrCredit == 'Invoice') { + + if ($InvOrCredit=='Invoice') { + $sql = "SELECT debtortrans.trandate, debtortrans.ovamount, @@ -480,6 +581,7 @@ AND debtortrans.branchcode=custbranch.branchcode AND custbranch.salesman=salesman.salesmancode"; } else { + $sql = "SELECT debtortrans.trandate, debtortrans.ovamount, debtortrans.ovdiscount, @@ -515,63 +617,99 @@ AND debtortrans.branchcode=custbranch.branchcode AND custbranch.salesman=salesman.salesmancode"; } - $result = DB_query($sql, $db); - if (DB_num_rows($result) == 0 OR DB_error_no($db) != 0) { - echo '<div class="page_help_text">' . _('There was a problem retrieving the invoice or credit note details for note number') . ' ' . $FromTransNo . ' ' . _('from the database') . '. ' . _('To print an invoice, the sales order record, the customer transaction record and the branch record for the customer must not have been purged') . '. ' . _('To print a credit note only requires the customer, transaction, salesman and branch records be available').'</div>'; - if ($debug == 1) { - echo _('The SQL used to get this information that failed was') . "<br />$sql"; + + $result=DB_query($sql,$db); + if (DB_num_rows($result)==0 OR DB_error_no($db)!=0) { + echo '<p>' . _('There was a problem retrieving the invoice or credit note details for note number') . ' ' . $InvoiceToPrint . ' ' . _('from the database') . '. ' . _('To print an invoice, the sales order record, the customer transaction record and the branch record for the customer must not have been purged') . '. ' . _('To print a credit note only requires the customer, transaction, salesman and branch records be available'); + if ($debug==1) { + echo _('The SQL used to get this information that failed was') . '<br>' . $sql; } break; - include ('includes/footer.inc'); + include('includes/footer.inc'); exit; - } elseif (DB_num_rows($result) == 1) { + } elseif (DB_num_rows($result)==1) { + $myrow = DB_fetch_array($result); /* Then there's an invoice (or credit note) to print. So print out the invoice header and GST Number from the company record */ - if (count($_SESSION['AllowedPageSecurityTokens']) == 1 AND in_array(1, $_SESSION['AllowedPageSecurityTokens']) AND $myrow['debtorno'] != $_SESSION['CustomerID']) { + if (count($_SESSION['AllowedPageSecurityTokens'])==1 AND in_array(1, $_SESSION['AllowedPageSecurityTokens']) AND $myrow['debtorno'] != $_SESSION['CustomerID']){ echo '<p><font color=RED size=4>' . _('This transaction is addressed to another customer and cannot be displayed for privacy reasons') . '. ' . _('Please select only transactions relevant to your company'); exit; } + $ExchRate = $myrow['rate']; $PageNumber = 1; - echo '<table class="table1"><tr><td VALIGN=TOP WIDTH=10%><img src="' . $_SESSION['LogoFile'] . '"></td><td bgcolor="#BBBBBB"><b>'; - if ($InvOrCredit == 'Invoice') { - echo '<font size=4>' . _('TAX INVOICE') . ' '; + + echo '<table class="table1"> + <tr><td VALIGN=TOP WIDTH=10%><img src="' . $_SESSION['LogoFile'] . '"></td> + <td bgcolor="#BBBBBB"><b>'; + + if ($InvOrCredit=='Invoice') { + echo '<font size=4>' . _('TAX INVOICE') . ' '; } else { - echo '<font color=RED size=4>' . _('TAX CREDIT NOTE') . ' '; + echo '<font color=RED size=4>' . _('TAX CREDIT NOTE') . ' '; } - echo '</b>' . _('Number') . ' ' . $FromTransNo . '</font><br /><font size=1>' . _('Tax Authority Ref') . '. ' . $_SESSION['CompanyRecord']['gstno'] . '</td></tr></table>'; + echo '</b>' . _('Number') . ' ' . $FromTransNo . '</font><br><font size=1>' . _('Tax Authority Ref') . '. ' . $_SESSION['CompanyRecord']['gstno'] . '</td></tr></table>'; + /* Now print out the logo and company name and address */ - echo '<table class="table1"><tr><td><font size=4 color="#333333"><b>' . $_SESSION['CompanyRecord']['coyname'] . '</b></font><br />'; - echo $_SESSION['CompanyRecord']['regoffice1'] . '<br />'; - echo $_SESSION['CompanyRecord']['regoffice2'] . '<br />'; - echo $_SESSION['CompanyRecord']['regoffice3'] . '<br />'; - echo $_SESSION['CompanyRecord']['regoffice4'] . '<br />'; - echo $_SESSION['CompanyRecord']['regoffice5'] . '<br />'; - echo $_SESSION['CompanyRecord']['regoffice6'] . '<br />'; - echo _('Telephone') . ': ' . $_SESSION['CompanyRecord']['telephone'] . '<br />'; - echo _('Facsimile') . ': ' . $_SESSION['CompanyRecord']['fax'] . '<br />'; - echo _('Email') . ': ' . $_SESSION['CompanyRecord']['email'] . '<br />'; + echo '<table class="table1"> + <tr><td><font size=4 color="#333333"><b>' . $_SESSION['CompanyRecord']['coyname'] . '</b></font><br>'; + echo $_SESSION['CompanyRecord']['regoffice1'] . '<br>'; + echo $_SESSION['CompanyRecord']['regoffice2'] . '<br>'; + echo $_SESSION['CompanyRecord']['regoffice3'] . '<br>'; + echo $_SESSION['CompanyRecord']['regoffice4'] . '<br>'; + echo $_SESSION['CompanyRecord']['regoffice5'] . '<br>'; + echo $_SESSION['CompanyRecord']['regoffice6'] . '<br>'; + echo _('Telephone') . ': ' . $_SESSION['CompanyRecord']['telephone'] . '<br>'; + echo _('Facsimile') . ': ' . $_SESSION['CompanyRecord']['fax'] . '<br>'; + echo _('Email') . ': ' . $_SESSION['CompanyRecord']['email'] . '<br>'; + echo '</td><td WIDTH=50% class=number>'; + /* Now the customer charged to details in a sub table within a cell of the main table*/ - echo '<table class="table1"><tr><td align=left bgcolor="#BBBBBB"><b>' . _('Charge To') . ':</b></td></tr><tr><td bgcolor="#EEEEEE">'; - echo $myrow['name'] . '<br />' . $myrow['address1'] . '<br />' . $myrow['address2'] . '<br />' . $myrow['address3'] . '<br />' . $myrow['address4'] . '<br />' . $myrow['address5'] . '<br />' . $myrow['address6']; + + echo '<table class="table1"> + <tr><td align=left bgcolor="#BBBBBB"><b>' . _('Charge To') . ':</b></td> + </tr><tr><td bgcolor="#EEEEEE">'; + echo $myrow['name'] . + '<br>' . $myrow['address1'] . + '<br>' . $myrow['address2'] . + '<br>' . $myrow['address3'] . + '<br>' . $myrow['address4'] . + '<br>' . $myrow['address5'] . + '<br>' . $myrow['address6']; echo '</td></tr></table>'; /*end of the small table showing charge to account details */ echo _('Page') . ': ' . $PageNumber; echo '</td></tr></table>'; /*end of the main table showing the company name and charge to details */ - if ($InvOrCredit == 'Invoice') { - echo '<table class="table1"> + + if ($InvOrCredit=='Invoice') { + + echo '<table class="table1"> <tr> <td align=left bgcolor="#BBBBBB"><b>' . _('Charge Branch') . ':</b></td> <td align=left bgcolor="#BBBBBB"><b>' . _('Delivered To') . ':</b></td> </tr>'; - echo '<tr> - <td bgcolor="#EEEEEE">' . $myrow['brname'] . '<br />' . $myrow['braddress1'] . '<br />' . $myrow['braddress2'] . '<br />' . $myrow['braddress3'] . '<br />' . $myrow['braddress4'] . '<br />' . $myrow['braddress5'] . '<br />' . $myrow['braddress6'] . '</td>'; - echo '<td bgcolor="#EEEEEE">' . $myrow['deliverto'] . '<br />' . $myrow['deladd1'] . '<br />' . $myrow['deladd2'] . '<br />' . $myrow['deladd3'] . '<br />' . $myrow['deladd4'] . '<br />' . $myrow['deladd5'] . '<br />' . $myrow['deladd6'] . '</td>'; - echo '</tr> - </table><hr>'; - echo '<table class="table1"> + echo '<tr> + <td bgcolor="#EEEEEE">' .$myrow['brname'] . + '<br>' . $myrow['braddress1'] . + '<br>' . $myrow['braddress2'] . + '<br>' . $myrow['braddress3'] . + '<br>' . $myrow['braddress4'] . + '<br>' . $myrow['braddress5'] . + '<br>' . $myrow['braddress6'] . '</td>'; + + echo '<td bgcolor="#EEEEEE">' . $myrow['deliverto'] . + '<br>' . $myrow['deladd1'] . + '<br>' . $myrow['deladd2'] . + '<br>' . $myrow['deladd3'] . + '<br>' . $myrow['deladd4'] . + '<br>' . $myrow['deladd5'] . + '<br>' . $myrow['deladd6'] . '</td> + </tr> + </table><hr>'; + + echo '<table class="table1"> <tr> <td align=left bgcolor="#BBBBBB"><b>' . _('Your Order Ref') . '</b></td> <td align=left bgcolor="#BBBBBB"><b>' . _('Our Order No') . '</b></td> @@ -581,9 +719,9 @@ <td align=left bgcolor="#BBBBBB"><b>' . _('Shipper') . '</b></td> <td align=left bgcolor="#BBBBBB"><b>' . _('Consignment Ref') . '</b></td> </tr>'; - echo '<tr> + echo '<tr> <td bgcolor="#EEEEEE">' . $myrow['customerref'] . '</td> - <td bgcolor="#EEEEEE">' . $myrow['orderno'] . '</td> + <td bgcolor="#EEEEEE">' .$myrow['orderno'] . '</td> <td bgcolor="#EEEEEE">' . ConvertSQLDate($myrow['orddate']) . '</td> <td bgcolor="#EEEEEE">' . ConvertSQLDate($myrow['trandate']) . '</td> <td bgcolor="#EEEEEE">' . $myrow['salesmanname'] . '</td> @@ -591,7 +729,8 @@ <td bgcolor="#EEEEEE">' . $myrow['consignment'] . '</td> </tr> </table>'; - $sql = "SELECT stockmoves.stockid, + + $sql ="SELECT stockmoves.stockid, stockmaster.description, -stockmoves.qty as quantity, stockmoves.discountpercent, @@ -605,26 +744,35 @@ AND stockmoves.type=10 AND stockmoves.transno='" . $FromTransNo . "' AND stockmoves.show_on_inv_crds=1"; + } else { /* then its a credit note */ - echo '<table width=50%><tr> + + echo '<table width="50%"><tr> <td align=left bgcolor="#BBBBBB"><b>' . _('Branch') . ':</b></td> </tr>'; - echo '<tr> - <td bgcolor="#EEEEEE">' . $myrow['brname'] . '<br />' . $myrow['braddress1'] . '<br />' . $myrow['braddress2'] . '<br />' . $myrow['braddress3'] . '<br />' . $myrow['braddress4'] . '<br />' . $myrow['braddress5'] . '<br />' . $myrow['braddress6'] . '</td> + echo '<tr> + <td bgcolor="#EEEEEE">' .$myrow['brname'] . + '<br>' . $myrow['braddress1'] . + '<br>' . $myrow['braddress2'] . + '<br>' . $myrow['braddress3'] . + '<br>' . $myrow['braddress4'] . + '<br>' . $myrow['braddress5'] . + '<br>' . $myrow['braddress6'] . '</td> </tr></table>'; - echo '<hr><table class="table1"><tr> + echo '<hr><table class="table1"><tr> <td align=left bgcolor="#BBBBBB"><b>' . _('Date') . '</b></td> <td align=left bgcolor="#BBBBBB"><b>' . _('Sales Person') . '</font></b></td> </tr>'; - echo '<tr> + echo '<tr> <td bgcolor="#EEEEEE">' . ConvertSQLDate($myrow['trandate']) . '</td> <td bgcolor="#EEEEEE">' . $myrow['salesmanname'] . '</td> </tr></table>'; - $sql = "SELECT stockmoves.stockid, + + $sql ="SELECT stockmoves.stockid, stockmaster.description, stockmoves.qty as quantity, - stockmoves.discountpercent, ((1 - stockmoves.discountpercent) * stockmoves.price * " . $ExchRate . " * stockmoves.qty) AS fxnet, - (stockmoves.price * " . $ExchRate . ") AS fxprice, + stockmoves.discountpercent, ((1 - stockmoves.discountpercent) * stockmoves.price * ' . $ExchRate . ' * stockmoves.qty) AS fxnet, + (stockmoves.price * ' . $ExchRate . ') AS fxprice, stockmaster.units FROM stockmoves, stockmaster @@ -633,81 +781,109 @@ AND stockmoves.transno='" . $FromTransNo . "' AND stockmoves.show_on_inv_crds=1"; } + echo '<hr>'; echo '<div class="centre"><font size=2>' . _('All amounts stated in') . ' ' . $myrow['currcode'] . '</font></div>'; - $result = DB_query($sql, $db); - if (DB_error_no($db) != 0) { - echo '<div class="page_help_text">' . _('There was a problem retrieving the invoice or credit note stock movement details for invoice number') . ' ' . $FromTransNo . ' ' . _('from the database').'</div>'; - if ($debug == 1) { - echo '<br />' . _('The SQL used to get this information that failed was') . '<br />'.$sql; + + $result=DB_query($sql,$db); + if (DB_error_no($db)!=0) { + echo '<br>' . _('There was a problem retrieving the invoice or credit note stock movement details for invoice number') . ' ' . $FromTransNo . ' ' . _('from the database'); + if ($debug==1){ + echo '<br>' . _('The SQL used to get this information that failed was') . '<br>' .$sql; } exit; } - if (DB_num_rows($result) > 0) { + + if (DB_num_rows($result)>0){ echo '<table class="table1"> <tr><th>' . _('Item Code') . '</th> - <th>' . _('Item Description') . '</th> - <th>' . _('Quantity') . '</th> - <th>' . _('Unit') . '</th> - <th>' . _('Price') . '</th> - <th>' . _('Discount') . '</th> - <th>' . _('Net') . '</th></tr>'; - $LineCounter = 17; - $k = 0; //row colour counter - while ($myrow2 = DB_fetch_array($result)) { - if ($k == 1) { - $RowStarter = '<tr class="EvenTableRows">'; - $k = 0; - } else { - $RowStarter = '<tr class="OddTableRows">'; - $k = 1; - } - echo $RowStarter; - $DisplayPrice = number_format($myrow2['fxprice'], 2); - $DisplayQty = number_format($myrow2['quantity'], 2); - $DisplayNet = number_format($myrow2['fxnet'], 2); - if ($myrow2['discountpercent'] == 0) { - $DisplayDiscount = ''; - } else { - $DisplayDiscount = number_format($myrow2['discountpercent'] * 100, 2) . '%'; - } - printf('<td>%s</td> + <th>' . _('Item Description') . '</th> + <th>' . _('Quantity') . '</th> + <th>' . _('Unit') . '</th> + <th>' . _('Price') . '</th> + <th>' . _('Discount') . '</th> + <th>' . _('Net') . '</th> + </tr>'; + + $LineCounter =17; + $k=0; //row colour counter + + while ($myrow2=DB_fetch_array($result)){ + + if ($k==1){ + $RowStarter = '<tr class="EvenTableRows">'; + $k=0; + } else { + $RowStarter = '<tr class="OddTableRows">'; + $k=1; + } + + echo $RowStarter; + + $DisplayPrice = number_format($myrow2['fxprice'],2); + $DisplayQty = number_format($myrow2['quantity'],2); + $DisplayNet = number_format($myrow2['fxnet'],2); + + if ($myrow2['discountpercent']==0){ + $DisplayDiscount =''; + } else { + $DisplayDiscount = number_format($myrow2['discountpercent']*100,2) . '%'; + } + + printf ('<td>%s</td> <td>%s</td> <td class=number>%s</td> <td class=number>%s</td> <td class=number>%s</td> <td class=number>%s</td> <td class=number>%s</td> - </tr>', $myrow2['stockid'], $myrow2['description'], $DisplayQty, $myrow2['units'], $DisplayPrice, $DisplayDiscount, $DisplayNet); - if (strlen($myrow2['narrative']) > 1) { - echo $RowStarter . '<td></td><td colspan=6>' . $myrow2['narrative'] . '</td></tr>'; + </tr>', + $myrow2['stockid'], + $myrow2['description'], + $DisplayQty, + $myrow2['units'], + $DisplayPrice, + $DisplayDiscount, + $DisplayNet); + + if (strlen($myrow2['narrative'])>1){ + echo $RowStarter . '<td></td><td colspan=6>' . $myrow2['narrative'] . '</td></tr>'; $LineCounter++; - } - $LineCounter++; - if ($LineCounter == ($_SESSION['PageLength'] - 2)) { - /* head up a new invoice/credit note page */ - $PageNumber++; - echo '</table><table class="table1"><tr><td VALIGN=TOp><img src="' . $_SESSION['LogoFile'] . '"></td><td bgcolor="#BBBBBB"><b>'; - if ($InvOrCredit == 'Invoice') { - echo '<font size=4>' . _('TAX INVOICE') . ' '; - } else { - echo '<font color=red size=4>' . _('TAX CREDIT NOTE') . ' '; - } - echo '</b>' . _('Number') . ' ' . $FromTransNo . '</font><br /><font size=1>' . _('GST Number') . ' - ' . $_SESSION['CompanyRecord']['gstno'] . '</td></tr></table>'; - /*Now print out company name and address */ - echo '<table class="table1"><tr> - <td><font size=4 color="#333333"><b>' . $_SESSION['CompanyRecord']['coyname'] . '</b></font><br />'; - echo $_SESSION['CompanyRecord']['regoffice1'] . '<br />'; - echo $_SESSION['CompanyRecord']['regoffice2'] . '<br />'; - echo $_SESSION['CompanyRecord']['regoffice3'] . '<br />'; - echo $_SESSION['CompanyRecord']['regoffice4'] . '<br />'; - echo $_SESSION['CompanyRecord']['regoffice5'] . '<br />'; - echo $_SESSION['CompanyRecord']['regoffice6'] . '<br />'; - echo _('Telephone') . ': ' . $_SESSION['CompanyRecord']['telephone'] . '<br />'; - echo _('Facsimile') . ': ' . $_SESSION['CompanyRecord']['fax'] . '<br />'; - echo _('Email') . ': ' . $_SESSION['CompanyRecord']['email'] . '<br />'; - echo '</td><td class=number>' . _('Page') . ': '.$PageNumber.'</td></tr></table>'; - echo '<table class="table1"><tr> + } + + $LineCounter++; + + if ($LineCounter == ($_SESSION['PageLength'] - 2)){ + + /* head up a new invoice/credit note page */ + + $PageNumber++; + echo '</table> + <table class="table1"> + <tr><td valign=top><img src="' . $_SESSION['LogoFile'] . '"></td> + <td bgcolor="#BBBBBB"><b>'; + + if ($InvOrCredit=='Invoice') { + echo '<font size=4>' . _('TAX INVOICE') . ' '; + } else { + echo '<font color=RED size=4>' . _('TAX CREDIT NOTE') . ' '; + } + echo '</b>' . _('Number') . ' ' . $FromTransNo . '</font><br /><font size=1>' . _('GST Number') . ' - ' . $_SESSION['CompanyRecord']['gstno'] . '</td></tr></table>'; + + /*Now print out company name and address */ + echo '<table class="table1"><tr> + <td><font size=4 color="#333333"><b>' . $_SESSION['CompanyRecord']['coyname'] . '</b></font><br>'; + echo $_SESSION['CompanyRecord']['regoffice1'] . '<br>'; + echo $_SESSION['CompanyRecord']['regoffice2'] . '<br>'; + echo $_SESSION['CompanyRecord']['regoffice3'] . '<br>'; + echo $_SESSION['CompanyRecord']['regoffice4'] . '<br>'; + echo $_SESSION['CompanyRecord']['regoffice5'] . '<br>'; + echo $_SESSION['CompanyRecord']['regoffice6'] . '<br>'; + echo _('Telephone') . ': ' . $_SESSION['CompanyRecord']['telephone'] . '<br>'; + echo _('Facsimile') . ': ' . $_SESSION['CompanyRecord']['fax'] . '<br>'; + echo _('Email') . ': ' . $_SESSION['CompanyRecord']['email'] . '<br>'; + echo '</td><td class=number>' . _('Page') . ': ' . $PageNumber . '</td></tr></table>'; + echo '<table class="table1"><tr> <th>' . _('Item Code') . '</th> <th>' . _('Item Description') . '</th> <th>' . _('Quantity') . '</th> @@ -715,36 +891,45 @@ <th>' . _('Price') . '</th> <th>' . _('Discount') . '</th> <th>' . _('Net') . '</th></tr>'; - $LineCounter = 10; - } //end if need a new page headed up + $LineCounter = 10; + + } //end if need a new page headed up } //end while there are line items to print out echo '</table>'; } /*end if there are stock movements to show on the invoice or credit note*/ + /* check to see enough space left to print the totals/footer */ - $LinesRequiredForText = floor(strlen($myrow['invtext']) / 140); - if ($LineCounter >= ($_SESSION['PageLength'] - 8 - $LinesRequiredForText)) { + $LinesRequiredForText = floor(strlen($myrow['invtext'])/140); + + if ($LineCounter >= ($_SESSION['PageLength'] - 8 - $LinesRequiredForText)){ + /* head up a new invoice/credit note page */ $PageNumber++; - echo '<table class="table1"><tr><td VALIGN=TOp><img src="' . $_SESSION['LogoFile'] . '"></td><td bgcolor="#BBBBBB"><b>'; - if ($InvOrCredit == 'Invoice') { - echo '<font size=4>' . _('TAX INVOICE') . ' '; + echo '<table class="table1"> + <tr><td valign=top><img src="' . $_SESSION['LogoFile'] . '"></td> + <td bgcolor="#BBBBBB"><b>'; + + if ($InvOrCredit=='Invoice') { + echo '<font size=4>' . _('TAX INVOICE') .' '; } else { - echo '<font color=RED size=4>' . _('TAX CREDIT NOTE') . ' '; + echo '<font color=RED size=4>' . _('TAX CREDIT NOTE') . ' '; } - echo '</b>' . _('Number') . ' ' . $FromTransNo . '</font><br /><font size=1>' . _('GST Number') . ' - ' . $_SESSION['CompanyRecord']['gstno'] . '</td></tr><table>'; + echo '</b>' . _('Number') . ' ' . $FromTransNo . '</font><br><font size=1>' . _('GST Number') . ' - ' . $_SESSION['CompanyRecord']['gstno'] . '</td></tr><table>'; + /* Print out the logo and company name and address */ - echo '<table class="table1"><tr><td><font size=4 color="#333333"><b>' . $_SESSION['CompanyRecord']['coyname'] . '</b></font><br />'; - echo $_SESSION['CompanyRecord']['regoffice1'] . '<br />'; - echo $_SESSION['CompanyRecord']['regoffice2'] . '<br />'; - echo $_SESSION['CompanyRecord']['regoffice3'] . '<br />'; - echo $_SESSION['CompanyRecord']['regoffice4'] . '<br />'; - echo $_SESSION['CompanyRecord']['regoffice5'] . '<br />'; - echo $_SESSION['CompanyRecord']['regoffice6'] . '<br />'; - echo _('Telephone') . ': ' . $_SESSION['CompanyRecord']['telephone'] . '<br />'; - echo _('Facsimile') . ': ' . $_SESSION['CompanyRecord']['fax'] . '<br />'; - echo _('Email') . ': ' . $_SESSION['CompanyRecord']['email'] . '<br />'; - echo '</td><td class=number>' . _('Page') . ': '.$PageNumber.'</td></tr></table>'; + echo '<table class="table1"> + <tr><td><font size=4 color="#333333"><b>' . $_SESSION['CompanyRecord']['coyname'] . '</b></font><br>'; + echo $_SESSION['CompanyRecord']['regoffice1'] . '<br>'; + echo $_SESSION['CompanyRecord']['regoffice2'] . '<br>'; + echo $_SESSION['CompanyRecord']['regoffice3'] . '<br>'; + echo $_SESSION['CompanyRecord']['regoffice4'] . '<br>'; + echo $_SESSION['CompanyRecord']['regoffice5'] . '<br>'; + echo $_SESSION['CompanyRecord']['regoffice6'] . '<br>'; + echo _('Telephone') . ': ' . $_SESSION['CompanyRecord']['telephone'] . '<br>'; + echo _('Facsimile') . ': ' . $_SESSION['CompanyRecord']['fax'] . '<br>'; + echo _('Email') . ': ' . $_SESSION['CompanyRecord']['email'] . '<br>'; + echo '</td><td class=number>' . _('Page') . ': ' . $PageNumber . '</td></tr></table>'; echo '<table class="table1"><tr> <th>' . _('Item Code') . '</th> <th>' . _('Item Description') . '</th> @@ -753,62 +938,87 @@ <th>' . _('Price') . '</th> <th>' . _('Discount') . '</th> <th>' . _('Net') . '</th></tr>'; + $LineCounter = 10; } + /* Space out the footer to the bottom of the page */ - echo '<br /><br />' . $myrow['invtext']; - $LineCounter = $LineCounter + 2 + $LinesRequiredForText; - while ($LineCounter < ($_SESSION['PageLength'] - 6)) { - echo '<br />'; + + echo '<br><br>' . $myrow['invtext']; + + $LineCounter=$LineCounter+2+$LinesRequiredForText; + while ($LineCounter < ($_SESSION['PageLength'] -6)){ + echo '<br>'; $LineCounter++; } + /* Now print out the footer and totals */ - if ($InvOrCredit == 'Invoice') { - $DisplaySubTot = number_format($myrow['ovamount'], 2); - $DisplayFreight = number_format($myrow['ovfreight'], 2); - $DisplayTax = number_format($myrow['ovgst'], 2); - $DisplayTotal = number_format($myrow['ovfreight'] + $myrow['ovgst'] + $myrow['ovamount'], 2); + + if ($InvOrCredit=='Invoice') { + + $DisplaySubTot = number_format($myrow['ovamount'],2); + $DisplayFreight = number_format($myrow['ovfreight'],2); + $DisplayTax = number_format($myrow['ovgst'],2); + $DisplayTotal = number_format($myrow['ovfreight']+$myrow['ovgst']+$myrow['ovamount'],2); } else { - $DisplaySubTot = number_format(-$myrow['ovamount'], 2); - $DisplayFreight = number_format(-$myrow['ovfreight'], 2); - $DisplayTax = number_format(-$myrow['ovgst'], 2); - $DisplayTotal = number_format(-$myrow['ovfreight'] - $myrow['ovgst'] - $myrow['ovamount'], 2); + $DisplaySubTot = number_format(-$myrow['ovamount'],2); + $DisplayFreight = number_format(-$myrow['ovfreight'],2); + $DisplayTax = number_format(-$myrow['ovgst'],2); + $DisplayTotal = number_format(-$myrow['ovfreight']-$myrow['ovgst']-$myrow['ovamount'],2); } + /*Print out the invoice text entered */ echo '<table class=table1><tr> <td class=number>' . _('Sub Total') . '</td> - <td class=number bgcolor="#EEEEEE" width=15%>'.$DisplaySubTot.'</td></tr>'; + <td class=number bgcolor="#EEEEEE" width=15%>' . $DisplaySubTot . '</td></tr>'; echo '<tr><td class=number>' . _('Freight') . '</td> - <td class=number bgcolor="#EEEEEE">'.$DisplayFreight.'</td></tr>'; + <td class=number bgcolor="#EEEEEE">' . $DisplayFreight . '</td></tr>'; echo '<tr><td class=number>' . _('Tax') . '</td> - <td class=number bgcolor="#EEEEEE">'.$DisplayTax.'</td></tr>'; - if ($InvOrCredit == 'Invoice') { - echo '<tr><td class=number><b>' . _('TOTAL INVOICE') . '</b></td> - <td class=number bgcolor="#EEEEEE"><U><b>'.$DisplayTotal.'</b></U></td></tr>'; + <td class=number bgcolor="#EEEEEE">' . $DisplayTax . '</td></tr>'; + if ($InvOrCredit=='Invoice'){ + echo '<tr><td class=number><b>' . _('TOTAL INVOICE') . '</b></td> + <td class=number bgcolor="#EEEEEE"><U><b>' . $DisplayTotal . '</b></U></td></tr>'; } else { - echo '<tr><td class=number><font color=RED><b>' . _('TOTAL CREDIT') . '</b></font></td> - <td class=number bgcolor="#EEEEEE"><font color=RED><U><b>'.$DisplayTotal.'</b></U></font></td></tr>'; + echo '<tr><td class=number><font color=RED><b>' . _('TOTAL CREDIT') . '</b></font></td> + <td class=number bgcolor="#EEEEEE"><font color="red"><U><b>' . $DisplayTotal . '</b></U></font></td></tr>'; } echo '</table>'; } /* end of check to see that there was an invoice record to print */ $FromTransNo++; } /* end loop to print invoices */ } /*end of if FromTransNo exists */ - include ('includes/footer.inc'); + include('includes/footer.inc'); } /*end of else not PrintPDF */ -function PrintLinesToBottom($pdf, $Page_Height, $PageNumber, $FormDesign) { + + +function PrintLinesToBottom () { + + global $pdf; + global $PageNumber; + global $TopOfColHeadings; + global $Left_Margin; + global $Bottom_Margin; + global $line_height; + /* draw the vertical column lines right to the bottom */ - $pdf->line($FormDesign->DataLines->Line1->startx, $Page_Height - $FormDesign->DataLines->Line1->starty, $FormDesign->DataLines->Line1->endx, $Page_Height - $FormDesign->DataLines->Line1->endy); + $pdf->line($Left_Margin+97, $TopOfColHeadings+12,$Left_Margin+97,$Bottom_Margin); + /* Print a column vertical line */ - $pdf->line($FormDesign->DataLines->Line2->startx, $Page_Height - $FormDesign->DataLines->Line2->starty, $FormDesign->DataLines->Line2->endx, $Page_Height - $FormDesign->DataLines->Line2->endy); + $pdf->line($Left_Margin+350, $TopOfColHeadings+12,$Left_Margin+350,$Bottom_Margin); + /* Print a column vertical line */ - $pdf->line($FormDesign->DataLines->Line3->startx, $Page_Height - $FormDe... [truncated message content] |
From: <dai...@us...> - 2011-05-11 09:59:52
|
Revision: 4563 http://web-erp.svn.sourceforge.net/web-erp/?rev=4563&view=rev Author: daintree Date: 2011-05-11 09:59:44 +0000 (Wed, 11 May 2011) Log Message: ----------- various Modified Paths: -------------- trunk/AccountSections.php trunk/Areas.php trunk/AuditTrail.php trunk/CustomerTypes.php trunk/FixedAssetItems.php trunk/FormDesigner.php trunk/GLJournal.php trunk/GLTags.php trunk/PDFBankingSummary.php trunk/PDFOrderStatus.php trunk/PO_AuthorisationLevels.php trunk/SecurityTokens.php trunk/Shipt_Select.php trunk/Stocks.php trunk/SupplierAllocations.php trunk/UpgradeDatabase.php trunk/Z_ImportStocks.php trunk/Z_MakeNewCompany.php trunk/doc/Change.log trunk/includes/session.inc Modified: trunk/AccountSections.php =================================================================== --- trunk/AccountSections.php 2011-05-07 00:24:37 UTC (rev 4562) +++ trunk/AccountSections.php 2011-05-11 09:59:44 UTC (rev 4563) @@ -28,7 +28,7 @@ $myrow = DB_fetch_row($result); if( $myrow[0] == 0 ) { $sql = "INSERT INTO accountsection ( - sectionid, + sectionid,21 sectionname ) VALUES ( 2, @@ -68,9 +68,9 @@ $i++; } } - if (strpos($_POST['SectionName'],'&')>0 OR strpos($_POST['SectionName'],"'")>0) { + if (ContainsIllegalCharacters($_POST['SectionName'])>0) { $InputError = 1; - prnMsg( _('The account section name cannot contain the character') . " '&' " . _('or the character') ." '",'error'); + prnMsg( _('The account section name cannot contain any of the illegal characters') ." '",'error'); $Errors[$i] = 'SectionName'; $i++; } @@ -274,4 +274,4 @@ } //end if record deleted no point displaying form to add record include('includes/footer.inc'); -?> +?> \ No newline at end of file Modified: trunk/Areas.php =================================================================== --- trunk/Areas.php 2011-05-07 00:24:37 UTC (rev 4562) +++ trunk/Areas.php 2011-05-11 09:59:44 UTC (rev 4563) @@ -138,16 +138,17 @@ if (!isset($SelectedArea)) { - $sql = 'SELECT * FROM areas'; + $sql = "SELECT * FROM areas"; $result = DB_query($sql,$db); echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/maintenance.png" title="' . _('Search') . '" alt="" />' . ' ' . $title.'</p><br />'; - echo '<table>'; - echo "<tr> - <th>" . _('Area Code') . "</th> - <th>" . _('Area Name') . '</th>'; + echo '<table> + <tr> + <th>' . _('Area Code') . '</th> + <th>' . _('Area Name') . '</th> + </tr>'; $k=0; //row colour counter @@ -159,13 +160,11 @@ echo '<tr class="OddTableRows">'; $k++; } - - echo '<td>' . $myrow[0] . '</td>'; - echo '<td>' . $myrow[1] . '</td>'; - echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?' . SID . '&SelectedArea=' . $myrow[0] . '">' . _('Edit') . '</a></td>'; - echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?' . SID . '&SelectedArea=' . $myrow[0] . '&delete=yes">' . _('Delete') . '</a></td>'; - echo '<td><a href="SelectCustomer.php'. '?' . SID . '&Area=' . $myrow[0] . '">' . _('View Customers from this Area') . '</a></td>'; - + echo '<td>' . $myrow[0] . '</td> + <td>' . $myrow[1] . '</td>'; + echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedArea=' . $myrow[0] . '">' . _('Edit') . '</a></td>'; + echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedArea=' . $myrow[0] . '&delete=yes">' . _('Delete') . '</a></td>'; + echo '<td><a href="SelectCustomer.php'. '?Area=' . $myrow[0] . '">' . _('View Customers from this Area') . '</a></td>'; } //END WHILE LIST LOOP echo '</table>'; Modified: trunk/AuditTrail.php =================================================================== --- trunk/AuditTrail.php 2011-05-07 00:24:37 UTC (rev 4562) +++ trunk/AuditTrail.php 2011-05-11 09:59:44 UTC (rev 4563) @@ -101,7 +101,8 @@ $SQLString = str_replace('SET','',$SQLString); $SQLString = str_replace('WHERE',',',$SQLString); $SQLString = str_replace('AND',',',$SQLString); - $FieldArray = preg_split("/[[:space:]]*([[:alnum:].]+[[:space:]]*=[[:space:]]*(?:'[^']*'|[[:digit:].]+))[[:space:]]*,/", $SQLString, 0, PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY); for ($i=0; $i<sizeof($FieldArray); $i++) { + $FieldArray = preg_split("/[[:space:]]*([[:alnum:].]+[[:space:]]*=[[:space:]]*(?:'[^']*'|[[:digit:].]+))[[:space:]]*,/", $SQLString, 0, PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY); + for ($i=0; $i<sizeof($FieldArray); $i++) { $Assigment = explode('=', $FieldArray[$i]); $_SESSION['SQLString']['fields'][$i] = $Assigment[0]; if (sizeof($Assigment)>1) { @@ -176,7 +177,7 @@ if (isset($_SESSION['SQLString']['values'][$i]) and (trim(str_replace("'","",$_SESSION['SQLString']['values'][$i])) != "") & (trim($_SESSION['SQLString']['fields'][$i]) != 'password') & (trim($_SESSION['SQLString']['fields'][$i]) != "www_users.password")) { - echo '<tr bgcolor='.$RowColour.'>'; + echo '<tr bgcolor="' . $RowColour . '">'; echo '<td></td> <td></td> <td></td> @@ -186,7 +187,7 @@ echo '</tr>'; } } - echo '<tr bgcolor=black><td></td><td></td><td></td><td></td><td></td><td></td></tr>'; + echo '<tr bgcolor=black> <td colspan="6"></td> </tr>'; } unset($_SESSION['SQLString']); } Modified: trunk/CustomerTypes.php =================================================================== --- trunk/CustomerTypes.php 2011-05-07 00:24:37 UTC (rev 4562) +++ trunk/CustomerTypes.php 2011-05-11 09:59:44 UTC (rev 4563) @@ -177,7 +177,7 @@ links to delete or edit each. These will call the same page again and allow update/input or deletion of the records*/ - $sql = 'SELECT typeid, typename FROM debtortype'; + $sql = "SELECT typeid, typename FROM debtortype"; $result = DB_query($sql,$db); echo '<br /><table class=selection>'; @@ -255,9 +255,11 @@ if (!isset($_POST['typename'])) { $_POST['typename']=''; } - echo '<tr><td>' . _('Type Name') . ':</td><td><input type="Text" name="typename" value="' . $_POST['typename'] . '"></td></tr>'; + echo '<tr><td>' . _('Type Name') . ':</td> + <td><input type="Text" name="typename" value="' . $_POST['typename'] . '"></td></tr>'; - echo '</td></tr></table>'; // close main table + echo '</td></tr> + </table>'; // close main table echo '<p><div class="centre"><input type=submit name=submit value="' . _('Accept') . '"></div>'; @@ -265,6 +267,5 @@ } // end if user wish to delete - include('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/FixedAssetItems.php =================================================================== --- trunk/FixedAssetItems.php 2011-05-07 00:24:37 UTC (rev 4562) +++ trunk/FixedAssetItems.php 2011-05-11 09:59:44 UTC (rev 4563) @@ -130,9 +130,9 @@ $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); + accumdepnact + FROM fixedassetcategories + WHERE categoryid='" . $_POST['AssetCategoryID'] . "'",$db); $NewAccounts = DB_fetch_array($result); $TransNo = GetNextTransNo( 42, $db); /* transaction type is asset category change */ @@ -145,7 +145,7 @@ account, narrative, amount) - VALUES ('42', + VALUES ('42', '" . $TransNo . "', '" . Date('Y-m-d') . "', '" . $PeriodNo . "', @@ -159,75 +159,75 @@ //debit cost for the new category $SQL = "INSERT INTO gltrans (type, - typeno, - trandate, - periodno, - account, - narrative, - amount) + 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']. "' - )"; + '" . $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) - 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) - 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); } /*end if there was accumulated depreciation for the asset */ } /* end if there is a change in asset category */ $sql = "UPDATE fixedassets - SET longdescription='" . $_POST['LongDescription'] . "', - description='" . $_POST['Description'] . "', - assetcategoryid='" . $_POST['AssetCategoryID'] . "', - assetlocation='" . $_POST['AssetLocation'] . "', - depntype='" . $_POST['DepnType'] . "', - depnrate='" . $_POST['DepnRate'] . "', - barcode='" . $_POST['BarCode'] . "', - serialno='" . $_POST['SerialNo'] . "' - WHERE assetid='" . $AssetID . "'"; + SET longdescription='" . $_POST['LongDescription'] . "', + description='" . $_POST['Description'] . "', + assetcategoryid='" . $_POST['AssetCategoryID'] . "', + assetlocation='" . $_POST['AssetLocation'] . "', + depntype='" . $_POST['DepnType'] . "', + depnrate='" . $_POST['DepnRate'] . "', + barcode='" . $_POST['BarCode'] . "', + serialno='" . $_POST['SerialNo'] . "' + WHERE assetid='" . $AssetID . "'"; $ErrMsg = _('The asset could not be updated because'); $DbgMsg = _('The SQL that was used to update the asset and failed was'); @@ -237,22 +237,22 @@ 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); @@ -278,12 +278,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) { @@ -309,40 +309,40 @@ if ($AssetRow['cost'] > 0){ //credit cost for the asset deleted $SQL = "INSERT INTO gltrans (type, - typeno, - trandate, - periodno, - account, - narrative, - amount) - 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) - 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); @@ -394,17 +394,17 @@ } elseif ($InputError!=1) { // Must be modifying an existing item and no changes made yet - need to lookup the details $sql = "SELECT assetid, - description, - longdescription, - assetcategoryid, - serialno, - assetlocation, - datepurchased, - depntype, - depnrate, - cost, - accumdepn, - barcode + description, + longdescription, + assetcategoryid, + serialno, + assetlocation, + datepurchased, + depntype, + depnrate, + cost, + accumdepn, + barcode FROM fixedassets WHERE assetid ='" . $AssetID . "'"; @@ -421,11 +421,11 @@ $_POST['DepnRate'] = $AssetRow['depnrate']; echo '<tr><td>' . _('Asset Code') . ':</td><td>'.$AssetID.'</td></tr>'. "\n"; - echo '<input type="Hidden" name="AssetID" value='.$AssetID.'>'. "\n"; + echo '<input type="Hidden" name="AssetID" value="'.$AssetID.'"/>'. "\n"; } else { // some changes were made to the data so don't re-set form variables to DB ie the code above echo '<tr><td>' . _('Asset Code') . ':</td><td>' . $AssetID . '</td></tr>'; - echo '<input type="Hidden" name="AssetID" value="' . $AssetID . '">'; + echo '<input type="Hidden" name="AssetID" value="' . $AssetID . '"/>'; } if (isset($_POST['Description'])) { @@ -434,7 +434,7 @@ $Description =''; } echo '<tr><td>' . _('Asset Description') . ' (' . _('short') . '):</td> - <td><input ' . (in_array('Description',$Errors) ? 'class="inputerror"' : '' ) .' type="Text" name="Description" size=52 maxlength=50 value="' . $Description . '"></td></tr>'."\n"; + <td><input ' . (in_array('Description',$Errors) ? 'class="inputerror"' : '' ) .' type="Text" name="Description" size=52 maxlength=50 value="' . $Description . '"></td></tr>'."\n"; if (isset($_POST['LongDescription'])) { $LongDescription = AddCarriageReturns($_POST['LongDescription']); Modified: trunk/FormDesigner.php =================================================================== --- trunk/FormDesigner.php 2011-05-07 00:24:37 UTC (rev 4562) +++ trunk/FormDesigner.php 2011-05-11 09:59:44 UTC (rev 4563) @@ -1,6 +1,6 @@ <?php /* $Id$ */ -//$PageSecurity = 14; + include('includes/session.inc'); $title = _('Form Designer'); include('includes/header.inc'); @@ -108,9 +108,6 @@ case 'GoodsReceived.xml': echo '<meta http-equiv="Refresh" content="0; url=' . $rootpath . '/PDFGrn.php?' . SID .'GRNNo=Preview&PONo=1">'; break; - case 'SalesInvoice.xml': - echo '<meta http-equiv="Refresh" content="0; url=' . $rootpath . '/PrintCustTrans.php?' . SID .'FromTransNo=Preview&InvOrCredit=Invoice&PrintPDF=True">'; - break; case 'PickingList.xml': echo '<meta http-equiv="Refresh" content="0; url=' . $rootpath . '/PDFPickingList.php?' . SID .'TransNo=Preview">'; break; Modified: trunk/GLJournal.php =================================================================== --- trunk/GLJournal.php 2011-05-07 00:24:37 UTC (rev 4562) +++ trunk/GLJournal.php 2011-05-11 09:59:44 UTC (rev 4563) @@ -22,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)){ @@ -158,8 +158,8 @@ if ($AllowThisPosting) { $SQL = "SELECT accountname - FROM chartmaster - WHERE accountcode='" . $_POST['GLManualCode'] . "'"; + FROM chartmaster + WHERE accountcode='" . $_POST['GLManualCode'] . "'"; $Result=DB_query($SQL,$db); if (DB_num_rows($Result)==0){ @@ -270,13 +270,13 @@ //Select the tag echo '<tr><td><select name="tag">'; -$SQL = 'SELECT tagref, - tagdescription +$SQL = "SELECT tagref, + tagdescription FROM tags - ORDER BY tagref'; + ORDER BY tagref"; $result=DB_query($SQL,$db); -echo '<option value="0">0 - None</option>'; +echo '<option value="0">0 - ' . _('None') . '</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'].'</option>'; @@ -294,10 +294,10 @@ "'".'The account code '."'".'+ this.value+ '."'".' doesnt exist'."'".')"' . ' value="'. $_POST['GLManualCode'] .'" /></td>'; -$sql='SELECT accountcode, - accountname - FROM chartmaster - ORDER BY accountcode'; +$sql="SELECT accountcode, + accountname + FROM chartmaster + ORDER BY accountcode"; $result=DB_query($sql, $db); echo '<td><select name="GLCode" onChange="return assignComboToInput(this,'.'GLManualCode'.')">'; @@ -321,7 +321,7 @@ $_POST['Debit'] = ''; } -echo '</tr><tr><th>' . _('Debit') . '</th>'.'<td><input type="text" class="number" Name = "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" ' . @@ -333,21 +333,22 @@ echo '<td><input type="text" name="GLNarrative" maxlength="100" size="100" value="' . $_POST['GLNarrative'] . '" /></td>'; echo '</tr></table><br />'; /*Close the main table */ -echo "<div class='centre'><input type='submit' name='Process' value='" . _('Accept') . "' /></div><br /><br />"; +echo '<div class="centre"><input type="submi2t" name="Process" value="' . _('Accept') . '" /></div><br /><br />'; echo '<table class="selection" width="85%">'; echo '<tr><th colspan="6"><div class="centre"><font size="3" color="blue"><b>' . _('Journal Summary') . '</b></font></div></th></tr>'; echo '<tr> - <th>'._('GL Tag').'</th> - <th>'._('GL Account').'</th> - <th>'._('Debit').'</th> - <th>'._('Credit').'</th> - <th>'._('Narrative').'</th></tr>'; + <th>'._('GL Tag').'</th> + <th>'._('GL Account').'</th> + <th>'._('Debit').'</th> + <th>'._('Credit').'</th> + <th>'._('Narrative').'</th> + </tr>'; -$debittotal=0; -$credittotal=0; +$DebitTotal=0; +$CreditTotal=0; $j=0; foreach ($_SESSION['JournalDetail']->GLEntries as $JournalItem) { @@ -364,39 +365,38 @@ $result=DB_query($sql, $db); $myrow=DB_fetch_row($result); if ($JournalItem->tag==0) { - $tagdescription='None'; + $TagDescription=_('None'); } else { - $tagdescription=$myrow[0]; + $TagDescription=$myrow[0]; } - echo '<td>' . $JournalItem->tag . ' - ' . $tagdescription . '</td>'; + echo '<td>' . $JournalItem->tag . ' - ' . $TagDescription . '</td>'; echo '<td>' . $JournalItem->GLCode . ' - ' . $JournalItem->GLActName . '</td>'; if ($JournalItem->Amount>0) { - echo '<td class="number">' . number_format($JournalItem->Amount,2) . '</td><td></td>'; - $debittotal=$debittotal+$JournalItem->Amount; - + echo '<td class="number">' . number_format($JournalItem->Amount,$_SESSION['CompanyRecord']['decimalplaces']) . '</td><td></td>'; + $DebitTotal=$DebitTotal+$JournalItem->Amount; } elseif($JournalItem->Amount<0) { - $credit=(-1 * $JournalItem->Amount); + $Credit=(-1 * $JournalItem->Amount); echo '<td></td> - <td class="number">' . number_format($credit,2) . '</td>'; - $credittotal=$credittotal+$credit; + <td class="number">' . number_format($Credit,$_SESSION['CompanyRecord']['decimalplaces']) . '</td>'; + $CreditTotal=$CreditTotal+$Credit; } - echo '<td>' . $JournalItem->Narrative . "</td> - <td><a href='" . $_SERVER['PHP_SELF'] . '?Delete=' . $JournalItem->ID . "'>"._('Delete').'</a></td> + echo '<td>' . $JournalItem->Narrative . '</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>' . number_format($debittotal,2) . '</b></td> - <td class="number"><b>' . number_format($credittotal,2) . '</b></td></tr>'; -if ($debittotal!=$credittotal) { + <td class="number"><b>' . _('Total') . '</b></td> + <td class="number"><b>' . number_format($DebitTotal,$_SESSION['CompanyRecord']['decimalplaces']) . '</b></td> + <td class="number"><b>' . number_format($CreditTotal,$_SESSION['CompanyRecord']['decimalplaces']) . '</b></td></tr>'; +if ($DebitTotal!=$CreditTotal) { echo '<td align="center" style="background-color: #fddbdb"><b>' . _('Required to balance') .' - </b>' . - number_format(abs($debittotal-$credittotal),2); + number_format(abs($DebitTotal-$CreditTotal),$_SESSION['CompanyRecord']['decimalplaces']); } -if ($debittotal>$credittotal) { +if ($DebitTotal>$CreditTotal) { echo ' ' . _('Credit') . '</td></tr>'; -} else if ($debittotal<$credittotal) { +} else if ($DebitTotal<$CreditTotal) { echo ' ' . _('Debit') . '</td></tr>'; } echo '</table>'; @@ -409,9 +409,9 @@ } if (!isset($_GET['NewJournal']) or $_GET['NewJournal']=='') { - echo "<script>defaultControl(document.form.GLManualCode);</script>"; + echo '<script>defaultControl(document.form.GLManualCode);</script>'; } else { - echo "<script>defaultControl(document.form.JournalProcessDate);</script>"; + echo '<script>defaultControl(document.form.JournalProcessDate);</script>'; } echo '</form>'; Modified: trunk/GLTags.php =================================================================== --- trunk/GLTags.php 2011-05-07 00:24:37 UTC (rev 4562) +++ trunk/GLTags.php 2011-05-11 09:59:44 UTC (rev 4563) @@ -8,39 +8,57 @@ include('includes/header.inc'); if (isset($_GET['SelectedTag'])) { - $sql="SELECT tagref, tagdescription FROM tags where tagref='".$_GET['SelectedTag']."'"; - $result= DB_query($sql,$db); - $myrow = DB_fetch_array($result,$db); - $ref=$myrow[0]; - $description=$myrow[1]; + if($_GET['Action']=='delete'){ + //first off test there are no transactions created with this tag + $Result = DB_query("SELECT counterindex + FROM gltrans + WHERE tag='" . $_GET['SelectedTag'] . "'",$db); + if (DB_num_rows($Result)>0){ + prnMsg(_('This tag cannot be deleted since there are already general ledger transactions created using it.'),'error'); + } else { + $Result = DB_query("DELETE FROM tags WHERE tagref='" . $_GET['SelectedTag'] . "'",$db); + prnMsg(_('The selected tag has been deleted'),'success'); + } + } else { + $sql="SELECT tagref, + tagdescription + FROM tags + WHERE tagref='".$_GET['SelectedTag']."'"; + + $result= DB_query($sql,$db); + $myrow = DB_fetch_array($result,$db); + $ref=$myrow['tagref']; + $Description=$myrow['tagdescription']; + } } else { - $description=''; + $Description=''; $_GET['SelectedTag']=''; } if (isset($_POST['submit'])) { - $sql = "INSERT INTO tags values(NULL, '".$_POST['description']."')"; + $sql = "INSERT INTO tags values(NULL, '".$_POST['Description']."')"; $result= DB_query($sql,$db); } if (isset($_POST['update'])) { - $sql = "UPDATE tags SET tagdescription='".$_POST['description']. - "' WHERE tagref='".$_POST['reference']."'"; + $sql = "UPDATE tags SET tagdescription='".$_POST['Description']. "' + WHERE tagref='".$_POST['reference']."'"; $result= DB_query($sql,$db); } echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/maintenance.png" title="' . _('Print') . '" alt="" />' . ' ' . $title . '</p>'; -echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . ' name="form">'; +echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '" name="form">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; -echo '<br><table><tr>'; +echo '<br /> + <table><tr>'; echo '<td>'. _('Description') . '</td> - <td><input type="text" size=30 maxlength=30 name="description" value="'.$description.'"></td><td> - <input type="hidden" name="reference" value="'.$_GET['SelectedTag'].'">'; + <td><input type="text" size=30 maxlength=30 name="Description" value="'.$Description.'"></td><td> + <input type="hidden" name="reference" value="'.$_GET['SelectedTag'].'">'; -if (isset($_GET['Action']) and $_GET['Action']=='edit') { +if (isset($_GET['Action']) AND $_GET['Action']=='edit') { echo '<input type="submit" name=update value=' . _('Update') . '>'; } else { echo '<input type="submit" name=submit value=' . _('Insert') . '>'; @@ -50,21 +68,25 @@ echo '</form>'; -echo '<table class=selection>'; -echo '<tr><th>'. _('Tag ID') .'</th>'; -echo '<th>'. _('Description'). '</th>'; +echo '<table class="selection">'; +echo '<tr><th>'. _('Tag ID') .'</th> + <th>'. _('Description'). '</th> + </tr>'; $sql="SELECT tagref, tagdescription FROM tags order by tagref"; $result= DB_query($sql,$db); while ($myrow = DB_fetch_array($result,$db)){ - echo '<tr><td>'.$myrow[0].'</td><td>'.$myrow[1].'</td> - <td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedTag=' . $myrow[0] . '&Action=edit">' . _('Edit') . '</a></td></tr>'; + echo '<tr><td>' . $myrow['tagref'].'</td> + <td>' . $myrow['tagdescription'].'</td> + <td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedTag=' . $myrow['tagref'] . '&Action=edit">' . _('Edit') . '</a></td> + <td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedTag=' . $myrow['tagref'] . '&Action=delete">' . _('Delete') . '</a></td> + </tr>'; } echo '</table><p></p>'; -echo '<script>defaultControl(document.form.description);</script>'; +echo '<script>defaultControl(document.form.Description);</script>'; include('includes/footer.inc'); Modified: trunk/PDFBankingSummary.php =================================================================== --- trunk/PDFBankingSummary.php 2011-05-07 00:24:37 UTC (rev 4562) +++ trunk/PDFBankingSummary.php 2011-05-11 09:59:44 UTC (rev 4563) @@ -25,7 +25,7 @@ $result=DB_query($sql, $db); echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '"> - <table class=selection>'; + <table class="selection">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<tr><td>' . _('Select the batch number of receipts to be printed') . ':</td>'; echo '<td><select name="BatchNo">'; @@ -41,19 +41,19 @@ if (isset($_POST['BatchNo']) and $_POST['BatchNo']!='') { $SQL= "SELECT bankaccountname, - bankaccountnumber, - ref, - transdate, - banktranstype, - bankact, - banktrans.exrate, - banktrans.functionalexrate, - banktrans.currcode - FROM bankaccounts, - banktrans - WHERE bankaccounts.accountcode=banktrans.bankact - AND banktrans.transno='" . $_POST['BatchNo'] . "' - AND banktrans.type=12"; + bankaccountnumber, + ref, + transdate, + banktranstype, + bankact, + banktrans.exrate, + banktrans.functionalexrate, + banktrans.currcode + FROM bankaccounts, + banktrans + WHERE bankaccounts.accountcode=banktrans.bankact + AND banktrans.transno='" . $_POST['BatchNo'] . "' + AND banktrans.type=12"; $ErrMsg = _('An error occurred getting the header information about the receipt batch number') . ' ' . $_POST['BatchNo']; $DbgMsg = _('The SQL used to get the receipt header information that failed was'); @@ -79,14 +79,14 @@ $SQL = "SELECT debtorsmaster.name, - ovamount, - invtext, - reference - FROM debtorsmaster INNER JOIN debtortrans - ON debtorsmaster.debtorno=debtortrans.debtorno - WHERE debtortrans.transno='" . $_POST['BatchNo'] . "' - AND debtortrans.type=12"; - + ovamount, + invtext, + reference + FROM debtorsmaster INNER JOIN debtortrans + ON debtorsmaster.debtorno=debtortrans.debtorno + WHERE debtortrans.transno='" . $_POST['BatchNo'] . "' + AND debtortrans.type=12"; + $CustRecs=DB_query($SQL,$db,'','',false,false); if (DB_error_no($db)!=0){ $title = _('Create PDF Print-out For A Batch Of Receipts'); @@ -99,13 +99,13 @@ exit; } $SQL = "SELECT narrative, - amount - FROM gltrans - WHERE gltrans.typeno='" . $_POST['BatchNo'] . "' - AND gltrans.type=12 and gltrans.amount <0 - AND gltrans.account !='" . $myrow['bankact'] . "' - AND gltrans.account !='" . $_SESSION['CompanyRecord']['debtorsact'] . "'"; - + amount + FROM gltrans + WHERE gltrans.typeno='" . $_POST['BatchNo'] . "' + AND gltrans.type=12 and gltrans.amount <0 + AND gltrans.account !='" . $myrow['bankact'] . "' + AND gltrans.account !='" . $_SESSION['CompanyRecord']['debtorsact'] . "'"; + $GLRecs=DB_query($SQL,$db,'','',false,false); if (DB_error_no($db)!=0){ $title = _('Create PDF Print-out For A Batch Of Receipts'); Modified: trunk/PDFOrderStatus.php =================================================================== --- trunk/PDFOrderStatus.php 2011-05-07 00:24:37 UTC (rev 4562) +++ trunk/PDFOrderStatus.php 2011-05-11 09:59:44 UTC (rev 4563) @@ -48,7 +48,7 @@ echo '<option selected value="All">' . _('Over All Categories') . '</option>'; while ($myrow=DB_fetch_array($result)){ - echo '<option value=' . $myrow['categoryid'] . '>' . $myrow['categorydescription'] . '</option>'; + echo '<option value="' . $myrow['categoryid'] . '">' . $myrow['categorydescription'] . '</option>'; } echo '</select></td></tr>'; Modified: trunk/PO_AuthorisationLevels.php =================================================================== --- trunk/PO_AuthorisationLevels.php 2011-05-07 00:24:37 UTC (rev 4562) +++ trunk/PO_AuthorisationLevels.php 2011-05-11 09:59:44 UTC (rev 4563) @@ -28,28 +28,27 @@ $_POST['AuthLevel']=0; } $sql="SELECT COUNT(*) - FROM purchorderauth - WHERE userid='" . $_POST['UserID'] . "' - AND currabrev='" . $_POST['CurrCode'] . "'"; + FROM purchorderauth + WHERE userid='" . $_POST['UserID'] . "' + AND currabrev='" . $_POST['CurrCode'] . "'"; $result=DB_query($sql, $db); $myrow=DB_fetch_array($result); if ($myrow[0]==0) { $sql="INSERT INTO purchorderauth ( userid, - currabrev, - cancreate, - offhold, - authlevel) - VALUES( - '".$_POST['UserID']."', - '".$_POST['CurrCode']."', - '".$CanCreate."', - '".$OffHold."', - '".$_POST['AuthLevel']."')"; - $ErrMsg = _('The authentication details cannot be inserted because'); - $Result=DB_query($sql,$db,$ErrMsg); + currabrev, + cancreate, + offhold, + authlevel) + VALUES( '".$_POST['UserID']."', + '".$_POST['CurrCode']."', + '".$CanCreate."', + '".$OffHold."', + '".$_POST['AuthLevel']."')"; + $ErrMsg = _('The authentication details cannot be inserted because'); + $Result=DB_query($sql,$db,$ErrMsg); } else { prnMsg(_('There already exists an entry for this user/currency combination'), 'error'); - echo '<br />'; + echo '<br />'; } } @@ -136,16 +135,16 @@ $OffHold=_('No'); } echo '<tr><td>' . $myrow['userid'] . '</td> - <td>' . $myrow['realname'] . '</td> - <td>' . $myrow['currency'] . '</td> - <td>' . $CanCreate . '</td> - <td>' . $OffHold . '</td> - <td class="number">'.number_format($myrow['authlevel'],2).'</td> - <td><a href="'.$rootpath.'/PO_AuthorisationLevels.php?Edit=Yes&UserID=' . $myrow['userid'] . - '&Currency='.$myrow['currabrev'].'">'._('Edit').'</td> - <td><a href="'.$rootpath.'/PO_AuthorisationLevels.php?Delete=Yes&UserID=' . $myrow['userid'] . - '&Currency='.$myrow['currabrev'].'">'._('Delete').'</td> - </tr>'; + <td>' . $myrow['realname'] . '</td> + <td>' . $myrow['currency'] . '</td> + <td>' . $CanCreate . '</td> + <td>' . $OffHold . '</td> + <td class="number">'.number_format($myrow['authlevel'],2).'</td> + <td><a href="'.$rootpath.'/PO_AuthorisationLevels.php?Edit=Yes&UserID=' . $myrow['userid'] . +'&Currency='.$myrow['currabrev'].'">'._('Edit').'</td> + <td><a href="'.$rootpath.'/PO_AuthorisationLevels.php?Delete=Yes&UserID=' . $myrow['userid'] . +'&Currency='.$myrow['currabrev'].'">'._('Delete').'</td> + </tr>'; } echo '</table><br><br>'; @@ -176,7 +175,7 @@ $CurrencyResult=DB_query($CurrencySQL,$db); $myrow=DB_fetch_array($CurrencyResult); echo '<tr><td>'._('Currency').'</td> - <td>' . $myrow['currency'] . '</td></tr>'; + <td>' . $myrow['currency'] . '</td></tr>'; echo '<input type=hidden name="currabrev" value="'.$Currency.'"'; } else { echo '<tr><td>'._('Currency').'</td><td><select name="CurrCode">'; Modified: trunk/SecurityTokens.php =================================================================== --- trunk/SecurityTokens.php 2011-05-07 00:24:37 UTC (rev 4562) +++ trunk/SecurityTokens.php 2011-05-11 09:59:44 UTC (rev 4563) @@ -80,7 +80,7 @@ echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '" name="form">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; -echo '<br><table><tr>'; +echo '<br /><table><tr>'; if (isset($_GET['Action']) and $_GET['Action']=='edit') { echo '<td>'. _('Description') . '</td> @@ -99,7 +99,7 @@ echo '<table class="selection">'; echo '<tr><th>'. _('Token ID') .'</th> - <th>'. _('Description'). '</th>'; + <th>'. _('Description'). '</th>'; $sql="SELECT tokenid, tokenname FROM securitytokens ORDER BY tokenid"; $Result= DB_query($sql,$db); Modified: trunk/Shipt_Select.php =================================================================== --- trunk/Shipt_Select.php 2011-05-07 00:24:37 UTC (rev 4562) +++ trunk/Shipt_Select.php 2011-05-11 09:59:44 UTC (rev 4563) @@ -223,7 +223,7 @@ //figure out the SQL required from the inputs available - if (isset($ShiptRef) AND $ShiptRef !='') { + if (isset($ShiptRef) && $ShiptRef !="") { $SQL = "SELECT shipments.shiptref, vessel, voyageref, @@ -231,7 +231,7 @@ shipments.eta, shipments.closed FROM shipments INNER JOIN suppliers - ON shipments.supplierid = suppliers.supplierid + ON shipments.supplierid = suppliers.supplierid WHERE shipments.shiptref='". $ShiptRef . "'"; } else { $SQL = "SELECT DISTINCT shipments.shiptref, vessel, voyageref, suppliers.suppname, shipments.eta, shipments.closed @@ -250,17 +250,17 @@ AND purchorders.intostocklocation = '". $_POST['StockLocation'] . "' AND shipments.closed='" . $_POST['OpenOrClosed'] . "'"; } else { - $SQL .= " WHERE shipments.supplierid='" . $SelectedSupplier ."' + $SQL .= "WHERE shipments.supplierid='" . $SelectedSupplier ."' AND purchorders.intostocklocation = '". $_POST['StockLocation'] . "' AND shipments.closed='" . $_POST['OpenOrClosed'] ."'"; } } else { //no supplier selected if (isset($SelectedStockItem)) { - $SQL .= " WHERE purchorderdetails.itemcode='". $SelectedStockItem ."' + $SQL .= "WHERE purchorderdetails.itemcode='". $SelectedStockItem ."' AND purchorders.intostocklocation = '". $_POST['StockLocation'] . "' AND shipments.closed='" . $_POST['OpenOrClosed'] . "'"; } else { - $SQL .= " WHERE purchorders.intostocklocation = '". $_POST['StockLocation'] . "' + $SQL .= "WHERE purchorders.intostocklocation = '". $_POST['StockLocation'] . "' AND shipments.closed='" . $_POST['OpenOrClosed'] . "'"; } Modified: trunk/Stocks.php =================================================================== --- trunk/Stocks.php 2011-05-07 00:24:37 UTC (rev 4562) +++ trunk/Stocks.php 2011-05-11 09:59:44 UTC (rev 4563) @@ -466,7 +466,7 @@ // PREVENT DELETES IF DEPENDENT RECORDS IN 'StockMoves' - $sql= "SELECT COUNT(*) FROM stockmoves WHERE stockid='".$StockID."'"; + $sql= "SELECT COUNT(*) FROM stockmoves WHERE stockid='".$StockID."' GROUP BY stockid"; $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); if ($myrow[0]>0) { @@ -475,7 +475,7 @@ echo '<br />' . _('There are') . ' ' . $myrow[0] . ' ' . _('stock movements that refer to this item'); } else { - $sql= "SELECT COUNT(*) FROM bom WHERE component='".$StockID."'"; + $sql= "SELECT COUNT(*) FROM bom WHERE component='".$StockID."' GROUP BY component"; $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); if ($myrow[0]>0) { @@ -483,7 +483,7 @@ prnMsg( _('Cannot delete this item record because there are bills of material that require this part as a component'),'warn'); echo '<br />' . _('There are') . ' ' . $myrow[0] . ' ' . _('bills of material that require this part as a component'); } else { - $sql= "SELECT COUNT(*) FROM salesorderdetails WHERE stkcode='".$StockID."'"; + $sql= "SELECT COUNT(*) FROM salesorderdetails WHERE stkcode='".$StockID."' GROUP BY stkcode"; $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); if ($myrow[0]>0) { @@ -491,7 +491,7 @@ prnMsg( _('Cannot delete this item record because there are existing sales orders for this part'),'warn'); echo '<br />' . _('There are') . ' ' . $myrow[0] . ' ' . _('sales order items against this part'); } else { - $sql= "SELECT COUNT(*) FROM salesanalysis WHERE stockid='".$StockID."'"; + $sql= "SELECT COUNT(*) FROM salesanalysis WHERE stockid='".$StockID."' GROUP BY stockid"; $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); if ($myrow[0]>0) { @@ -499,7 +499,7 @@ prnMsg(_('Cannot delete this item because sales analysis records exist for it'),'warn'); echo '<br />' . _('There are') . ' ' . $myrow[0] . ' ' . _('sales analysis records against this part'); } else { - $sql= "SELECT COUNT(*) FROM purchorderdetails WHERE itemcode='".$StockID."'"; + $sql= "SELECT COUNT(*) FROM purchorderdetails WHERE itemcode='".$StockID."' GROUP BY itemcode"; $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); if ($myrow[0]>0) { @@ -507,7 +507,7 @@ prnMsg(_('Cannot delete this item because there are existing purchase order items for it'),'warn'); echo '<br />' . _('There are') . ' ' . $myrow[0] . ' ' . _('purchase order item record relating to this part'); } else { - $sql = "SELECT SUM(quantity) AS qoh FROM locstock WHERE stockid='".$StockID."'"; + $sql = "SELECT SUM(quantity) AS qoh FROM locstock WHERE stockid='".$StockID."' GROUP BY stockid"; $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); if ($myrow[0]!=0) { Modified: trunk/SupplierAllocations.php =================================================================== --- trunk/SupplierAllocations.php 2011-05-07 00:24:37 UTC (rev 4562) +++ trunk/SupplierAllocations.php 2011-05-11 09:59:44 UTC (rev 4563) @@ -294,21 +294,21 @@ $SQL= "SELECT systypes.typename, - supptrans.type, - supptrans.transno, - supptrans.trandate, - supptrans.supplierno, - suppliers.suppname, - rate, - (supptrans.ovamount+supptrans.ovgst) AS total, - supptrans.diffonexch, - supptrans.alloc - FROM supptrans, - systypes, - suppliers - WHERE supptrans.type = systypes.typeid - AND supptrans.supplierno = suppliers.supplierid - AND supptrans.id='" . $_SESSION['AllocTrans'] . "'"; + supptrans.type, + supptrans.transno, + supptrans.trandate, + supptrans.supplierno, + suppliers.suppname, + rate, + (supptrans.ovamount+supptrans.ovgst) AS total, + supptrans.diffonexch, + supptrans.alloc + FROM supptrans, + systypes, + suppliers + WHERE supptrans.type = systypes.typeid + AND supptrans.supplierno = suppliers.supplierid + AND supptrans.id='" . $_SESSION['AllocTrans'] . "'"; $Result = DB_query($SQL, $db); if (DB_num_rows($Result) != 1){ @@ -336,21 +336,21 @@ /*First get the transactions that have outstanding balances ie Total-Alloc >0 */ $SQL= "SELECT supptrans.id, - typename, - transno, - trandate, - suppreference, - rate, - ovamount+ovgst AS total, - diffonexch, - alloc - FROM supptrans, - systypes - WHERE supptrans.type = systypes.typeid - AND supptrans.settled=0 - AND abs(ovamount+ovgst-alloc)>0.009 - AND supplierno='" . $_SESSION['Alloc']->SupplierID . "'"; - + typename, + transno, + trandate, + suppreference, + rate, + ovamount+ovgst AS total, + diffonexch, + alloc + FROM supptrans, + systypes + WHERE supptrans.type = systypes.typeid + AND supptrans.settled=0 + AND abs(ovamount+ovgst-alloc)>0.009 + AND supplierno='" . $_SESSION['Alloc']->SupplierID . "'"; + $ErrMsg = _('There was a problem retrieving the transactions available to allocate to'); $DbgMsg = _('The SQL that was used to retrieve the transaction information was'); @@ -359,41 +359,41 @@ while ($myrow=DB_fetch_array($Result)){ $_SESSION['Alloc']->add_to_AllocsAllocn ($myrow['id'], - $myrow['typename'], - $myrow['transno'], - ConvertSQLDate($myrow['trandate']), - $myrow['suppreference'], - 0, - $myrow['total'], - $myrow['rate'], - $myrow['diffonexch'], - $myrow['diffonexch'], - $myrow['alloc'], - 'NA'); - } + $myrow['typename'], + $myrow['transno'], + ConvertSQLDate($myrow['trandate']), + $myrow['suppreference'], + 0, + $myrow['total'], + $myrow['rate'], + $myrow['diffonexch'], + $myrow['diffonexch'], + $myrow['alloc'], + 'NA'); +} /* Now get trans that might have previously been allocated to by this trans NB existing entries where still some of the trans outstanding entered from above logic will be overwritten with the prev alloc detail below */ $SQL = "SELECT supptrans.id, - typename, - transno, - trandate, - suppreference, - rate, - ovamount+ovgst AS total, - diffonexch, - supptrans.alloc-suppallocs.amt AS prevallocs, - amt, - suppallocs.id AS allocid - FROM supptrans, - systypes, - suppallocs - WHERE supptrans.type = systypes.typeid - AND supptrans.id=suppallocs.transid_allocto - AND suppallocs.transid_allocfrom='" . $_SESSION['AllocTrans'] . - "' AND supplierno='" . $_SESSION['Alloc']->SupplierID . "'"; + typename, + transno, + trandate, + suppreference, + rate, + ovamount+ovgst AS total, + diffonexch, + supptrans.alloc-suppallocs.amt AS prevallocs, + amt, + suppallocs.id AS allocid + FROM supptrans, + systypes, + suppallocs + WHERE supptrans.type = systypes.typeid + AND supptrans.id=suppallocs.transid_allocto + AND suppallocs.transid_allocfrom='" . $_SESSION['AllocTrans'] . + "' AND supplierno='" . $_SESSION['Alloc']->SupplierID . "'"; $ErrMsg = _('There was a problem retrieving the previously allocated transactions for modification'); @@ -405,14 +405,16 @@ $DiffOnExchThisOne = ($myrow['amt']/$myrow['rate']) - ($myrow['amt']/$_SESSION['Alloc']->TransExRate); - $_SESSION['Alloc']->add_to_AllocsAllocn ($myrow['id'], $myrow['typename'], $myrow['transno'], - ConvertSQLDate($myrow['trandate']), $myrow['suppreference'], $myrow['amt'], - $myrow['total'], - $myrow['rate'], - $DiffOnExchThisOne, - ($myrow['diffonexch'] - $DiffOnExchThisOne), - $myrow['prevallocs'], - $myrow['allocid']); + $_SESSION['Alloc']->add_to_AllocsAllocn ($myrow['id'], + $myrow['typename'], + $myrow['transno'], + ConvertSQLDate($myrow['trandate']), $myrow['suppreference'], $myrow['amt'], + $myrow['total'], + $myrow['rate'], + $DiffOnExchThisOne, + ($myrow['diffonexch'] - $DiffOnExchThisOne), + $myrow['prevallocs'], + $myrow['allocid']); } } @@ -444,12 +446,12 @@ echo '<table cellpadding=2 colspan=7 class=selection>'; $TableHeader = '<tr><th>' . _('Type') . '</th> - <th>' . _('Trans') . '<br />' . _('Number') . '</th> - <th>' . _('Trans') .'<br />' . _('Date') . '</th> - <th>' . _('Supp') . '<br />' . _('Ref') . '</th> - <th>' . _('Total') . '<br />' . _('Amount') .'</th> - <th>' . _('Yet to') . '<br />' . _('Allocate') . '</th> - <th>' . _('This') . '<br />' . _('Allocation') . '</th></tr>'; + <th>' . _('Trans') . '<br />' . _('Number') . '</th> + <th>' . _('Trans') .'<br />' . _('Date') . '</th> + <th>' . _('Supp') . '<br />' . _('Ref') . '</th> + <th>' . _('Total') . '<br />' . _('Amount') .'</th> + <th>' . _('Yet to') . '<br />' . _('Allocate') . '</th> + <th>' . _('This') . '<br />' . _('Allocation') . '</th></tr>'; $k = 0; $Counter = 0; $RowCounter = 0; @@ -481,11 +483,11 @@ $YetToAlloc = ($AllocnItem->TransAmount - $AllocnItem->PrevAlloc); echo '<td>' . $AllocnItem->TransType . '</td> - <td>' . $AllocnItem->TypeNo . '</td> - <td>' . $AllocnItem->TransDate . '</td> - <td>' . $AllocnItem->SuppRef . '</td> - <td class="number">' . number_format($AllocnItem->TransAmount,2) . '</td> - <td class="number">' . number_format($YetToAlloc,2) . '<input type="hidden" name="YetToAlloc' . + <td>' . $AllocnItem->TypeNo . '</td> + <td>' . $AllocnItem->TransDate . '</td> + <td>' . $AllocnItem->SuppRef . '</td> + <td class="number">' . number_format($AllocnItem->TransAmount,2) . '</td> + <td class="number">' . number_format($YetToAlloc,2) . '<input type="hidden" name="YetToAlloc' . $Counter . '" VALUE=' . $YetToAlloc . '></td>'; echo '<td class="number"><input type="checkbox" name="All' . $Counter . '"'; @@ -551,12 +553,12 @@ echo '<table class=selection>'; $TableHeader = '<tr><th>' . _('Trans Type') .'</th> - <th>' . _('Supplier') . '</th> - <th>' . _('Number') . '</th> - <th>' . _('Date') . '</th> - <th>' . _('Total') . '</th> - <th>' . _('To Alloc') . '</th> - </tr>\n'; + <th>' . _('Supplier') . '</th> + <th>' . _('Number') . '</th> + <th>' . _('Date') . '</th> + <th>' . _('Total') . '</th> + <th>' . _('To Alloc') . '</th> + </tr>\n'; echo $TableHeader; @@ -587,7 +589,7 @@ ConvertSQLDate($myrow['trandate']), $myrow['total'], $myrow['total']-$myrow['alloc'], - $_SERVER['PHP_SELF'] . "?" . SID, + $_SERVER['PHP_SELF'] . '?', $myrow['id']); } @@ -600,35 +602,35 @@ unset($_SESSION['Alloc']); $sql = "SELECT id, - transno, - typename, - type, - suppliers.supplierid, - suppname, - trandate, - suppreference, - rate, - ovamount+ovgst AS total, - alloc - FROM supptrans, - suppliers, - systypes - WHERE supptrans.type=systypes.typeid - AND supptrans.supplierno=suppliers.supplierid - AND (type=21 or type=22) - AND settled=0 ORDER BY id"; + transno, + typename, + type, + suppliers.supplierid, + suppname, + trandate, + suppreference, + rate, + ovamount+ovgst AS total, + alloc + FROM supptrans, + suppliers, + systypes + WHERE supptrans.type=systypes.typeid + AND supptrans.supplierno=suppliers.supplierid + AND (type=21 or type=22) + AND settled=0 ORDER BY id"; $result = DB_query($sql, $db); echo '<table class=selection>'; $TableHeader = '<tr><th>' . _('Trans Type') . '</th> - <th>' . _('Supplier') . '</th> - <th>' . _('Number') . '</th> - <th>' . _('Date') . '</th> - <th>' . _('Total') . '</th> - <th>' . _('To Alloc') . '</th> - <th>' . _('More Info') . '</th> - </tr>' ; + <th>' . _('Supplier') . '</th> + <th>' . _('Number') . '</th> + <th>' . _('Date') . '</th> + <th>' . _('Total') . '</th> + <th>' . _('To Alloc') . '</th> + <th>' . _('More Info') . '</th> + </tr>' ; echo $TableHeader; Modified: trunk/UpgradeDatabase.php =================================================================== --- trunk/UpgradeDatabase.php 2011-05-07 00:24:37 UTC (rev 4562) +++ trunk/UpgradeDatabase.php 2011-05-11 09:59:44 UTC (rev 4563) @@ -98,6 +98,7 @@ case '3.10': $SQLScripts[] = './sql/mysql/upgrade3.10-3.11.sql'; case '3.11': + case '3.12.32': case '4.0RC1': case '4.01': case '4.02': @@ -195,4 +196,4 @@ } /*Dont do upgrade */ include('includes/footer.inc'); -?> +?> \ No newline at end of file Modified: trunk/Z_ImportStocks.php =================================================================== --- trunk/Z_ImportStocks.php 2011-05-07 00:24:37 UTC (rev 4562) +++ trunk/Z_ImportStocks.php 2011-05-11 09:59:44 UTC (rev 4563) @@ -1,308 +1,308 @@ -<?php -/* $Id: Z_ImportStocks.php 4043 2010-09-30 16:17:53Z tim_schofield $*/ -/* Script to make stock locations for all parts that do not have stock location records set up*/ - -//$PageSecurity = 15; -include('includes/session.inc'); -$title = _('Import Items'); -include('includes/header.inc'); - -// If this script is called with a file object, then the file contents are imported -// If this script is called with the gettemplate flag, then a template file is served -// Otherwise, a file upload form is displayed - -$headers = array( - 'StockID', // 0 'STOCKID', - 'Description', // 1 'DESCRIPTION', - 'LongDescription', // 2 'LONGDESCRIPTION', - 'CategoryID', // 3 'CATEGORYID', - 'Units', // 4 'UNITS', - 'MBFlag', // 5 'MBFLAG', - 'EOQ', // 6 'EOQ', - 'Discontinued', // 7 'DISCONTINUED', - 'Controlled', // 8 'CONTROLLED', - 'Serialised', // 9 'SERIALISED', - 'Perishable', // 10 'PERISHABLE', - 'Volume', // 11 'VOLUME', - 'KGS', // 12 'KGS', - 'BarCode', // 13 'BARCODE', - 'DiscountCategory', // 14 'DISCOUNTCATEGORY', - 'TaxCat', // 15 'TAXCAT', - 'DecimalPlaces', // 16 'DECIMALPLACES', - 'ItemPDF' // 17 'ITEMPDF' -); - -if ($_FILES['userfile']['name']) { //start file processing - - //initialize - $allowType='text/csv'; - $fieldTarget = 18; - $InputError = 0; - - //check file info - $fileName = $_FILES['userfile']['name']; - $tmpName = $_FILES['userfile']['tmp_name']; - $fileSize = $_FILES['userfile']['size']; - $fileType = $_FILES['userfile']['type']; - if ($fileType != $allowType) { - prnMsg (_('File has type '. $fileType. ', but only '. $allowType. ' is allowed.'),'error'); - include('includes/footer.inc'); - exit; - } - - //get file handle - $handle = fopen($tmpName, 'r'); - - //get the header row - $headRow = fgetcsv($handle, 10000, ","); - - //check for correct number of fields - if ( count($headRow) != count($headers) ) { - prnMsg (_('File contains '. count($headRow). ' columns, expected '. count($headers). '. Try downloading a new template.'),'error'); - fclose($handle); - include('includes/footer.inc'); - exit; - } - - //test header row field name and sequence - $head = 0; - foreach ($headRow as $headField) { - if ( strtoupper($headField) != strtoupper($headers[$head]) ) { - prnMsg (_('File contains incorrect headers ('. strtoupper($headField). ' != '. strtoupper($header[$head]). '. Try downloading a new template.'),'error'); - fclose($handle); - include('includes/footer.inc'); - exit; - } - $head++; - } - - //start database transaction - DB_Txn_Begin($db); - - //loop through file rows - $row = 1; - while ( ($myrow = fgetcsv($handle, 10000, ",")) !== FALSE ) { - - //check for correct number of fields - $fieldCount = count($myrow); - if ($fieldCount != $fieldTarget){ - prnMsg (_($fieldTarget. ' fields required, '. $fieldCount. ' fields received'),'error'); - fclose($handle); - include('includes/footer.inc'); - exit; - } - - // cleanup the data (csv files often import with empty strings and such) - $StockID = strtoupper($myrow[0]); - foreach ($myrow as &$value) { - $value = trim($value); - } - - //first off check if the item already exists - $sql = "SELECT COUNT(stockid) FROM stockmaster WHERE stockid='".$StockID."'"; - $result = DB_query($sql,$db); - $testrow = DB_fetch_row($result); - if ($testrow[0] != 0) { - $InputError = 1; - prnMsg (_('Stock item "'. $StockID. '" already exists'),'error'); - } - - //next validate inputs are sensible - if (!$myrow[1] or strlen($myrow[1]) > 50 OR strlen($myrow[1])==0) { - $InputError = 1; - prnMsg (_('The stock item description must be entered and be fifty characters or less long') . '. ' . _('It cannot be a zero length string either') . ' - ' . _('a description is required'). ' ("'. implode('","',$myrow). $stockid. '") ','error'); - } - if (strlen($myrow[2])==0) { - $InputError = 1; - prnMsg (_('The stock item description cannot be a zero length string') . ' - ' . _('a long description is required'),'error'); - } - if (strlen($StockID) ==0) { - $InputError = 1; - prnMsg (_('The Stock Item code cannot be empty'),'error'); - } - if (strstr($StockID,' ') OR strstr($StockID,"'") OR strstr($StockID,'+') OR strstr($StockID,"\\") OR strstr($StockID,"\"") OR strstr($StockID,'&') OR strstr($StockID,'"')) { - $InputError = 1; - prnMsg(_('The stock item code cannot contain any of the following characters') . " ' & + \" \\ " . _('or a space'). " (". $StockID. ")",'error'); - $StockID=''; - } - if (strlen($myrow[4]) >20) { - $InputError = 1; - prnMsg(_('The unit of measure must be 20 characters or less long'),'error'); - } - if (strlen($myrow[13]) >20) { - $InputError = 1; - prnMsg(_('The barcode must be 20 characters or less long'),'error'); - } - if ($myrow[10]!=0 AND $myrow[10]!=1) { - $InputError = 1; - prnMsg (_('Values in the Perishable field must be either 0 (No) or 1 (Yes)') ,'error'); - } - if (!is_numeric($myrow[11])) { - $InputError = 1; - prnMsg (_('The volume of the packaged item in cubic metres must be numeric') ,'error'); - } - if ($myrow[11] <0) { - $InputError = 1; - prnMsg(_('The volume of the packaged item must be a positive number'),'error'); - } - if (!is_numeric($myrow[12])) { - $InputError = 1; - prnMsg(_('The weight of the packaged item in KGs must be numeric'),'error'); - } - if ($myrow[12]<0) { - $InputError = 1; - prnMsg(_('The weight of the packaged item must be a positive number'),'error'); - } - if (!is_numeric($myrow[6])) { - $InputError = 1; - prnMsg(_('The economic order quantity must be numeric'),'error'); - } - if ($$myrow[6] <0) { - $InputError = 1; - prnMsg (_('The economic order quantity must be a positive number'),'error'); - } - if ($myrow[8]==0 AND $myrow[9]==1){ - $InputError = 1; - prnMsg(_('The item can only be serialised if there is lot control enabled already') . '. ' . _('Batch control') . ' - ' . _('with any number of items in a lot/bundle/roll is enabled when controlled is enabled') . '. ' . _('Serialised control requires that only one item is in the batch') . '. ' . _('For serialised control') . ', ' . _('both controlled and serialised must be enabled'),'error'); - } - - $mbflag = $myrow[5]; - if ($mbflag!='M' and $mbflag!='K' and $mbflag!='A' and $mbflag!='B' and $mbflag!='D' and $mbflag!='G') { - $InputError = 1; - prnMsg(_('Items must be of MBFlag type Manufactured(M), Assembly(A), Kit-Set(K), Purchased(B), Dummy(D) or Phantom(G)'),'error'); - } - if (($mbflag=='A' OR $mbflag=='K' OR $mbflag=='D' OR $mbflag=='G') AND $myrow[8]==1){ - $InputError = 1; - prnMsg(_('Assembly/Kitset/Phantom/Service items cannot also be controlled items') . '. ' . _('Assemblies, Dummies and Kitsets are not physical items and batch/serial control is therefore not appropriate'),'error'); - } - if ($myrow[3]==''){ - $InputError = 1; - prnMsg(_('There are no inventory categories defined. All inventory items must belong to a valid inventory category,'),'error'); - } - if ($myrow[17]==''){ - $InputError = 1; - prnMsg(_('ItemPDF must contain either a filename, or the keyword `none`'),'error'); - } - - if ($InputError !=1){ - if ($myrow[9]==1){ /*Not appropriate to have several dp on serial items */ - $myrow[16]=0; - } - - //attempt ... [truncated message content] |
From: <dai...@us...> - 2011-05-11 09:59:52
|
Revision: 4563 http://web-erp.svn.sourceforge.net/web-erp/?rev=4563&view=rev Author: daintree Date: 2011-05-11 09:59:44 +0000 (Wed, 11 May 2011) Log Message: ----------- various Modified Paths: -------------- trunk/AccountSections.php trunk/Areas.php trunk/AuditTrail.php trunk/CustomerTypes.php trunk/FixedAssetItems.php trunk/FormDesigner.php trunk/GLJournal.php trunk/GLTags.php trunk/PDFBankingSummary.php trunk/PDFOrderStatus.php trunk/PO_AuthorisationLevels.php trunk/SecurityTokens.php trunk/Shipt_Select.php trunk/Stocks.php trunk/SupplierAllocations.php trunk/UpgradeDatabase.php trunk/Z_ImportStocks.php trunk/Z_MakeNewCompany.php trunk/doc/Change.log trunk/includes/session.inc Modified: trunk/AccountSections.php =================================================================== --- trunk/AccountSections.php 2011-05-07 00:24:37 UTC (rev 4562) +++ trunk/AccountSections.php 2011-05-11 09:59:44 UTC (rev 4563) @@ -28,7 +28,7 @@ $myrow = DB_fetch_row($result); if( $myrow[0] == 0 ) { $sql = "INSERT INTO accountsection ( - sectionid, + sectionid,21 sectionname ) VALUES ( 2, @@ -68,9 +68,9 @@ $i++; } } - if (strpos($_POST['SectionName'],'&')>0 OR strpos($_POST['SectionName'],"'")>0) { + if (ContainsIllegalCharacters($_POST['SectionName'])>0) { $InputError = 1; - prnMsg( _('The account section name cannot contain the character') . " '&' " . _('or the character') ." '",'error'); + prnMsg( _('The account section name cannot contain any of the illegal characters') ." '",'error'); $Errors[$i] = 'SectionName'; $i++; } @@ -274,4 +274,4 @@ } //end if record deleted no point displaying form to add record include('includes/footer.inc'); -?> +?> \ No newline at end of file Modified: trunk/Areas.php =================================================================== --- trunk/Areas.php 2011-05-07 00:24:37 UTC (rev 4562) +++ trunk/Areas.php 2011-05-11 09:59:44 UTC (rev 4563) @@ -138,16 +138,17 @@ if (!isset($SelectedArea)) { - $sql = 'SELECT * FROM areas'; + $sql = "SELECT * FROM areas"; $result = DB_query($sql,$db); echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/maintenance.png" title="' . _('Search') . '" alt="" />' . ' ' . $title.'</p><br />'; - echo '<table>'; - echo "<tr> - <th>" . _('Area Code') . "</th> - <th>" . _('Area Name') . '</th>'; + echo '<table> + <tr> + <th>' . _('Area Code') . '</th> + <th>' . _('Area Name') . '</th> + </tr>'; $k=0; //row colour counter @@ -159,13 +160,11 @@ echo '<tr class="OddTableRows">'; $k++; } - - echo '<td>' . $myrow[0] . '</td>'; - echo '<td>' . $myrow[1] . '</td>'; - echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?' . SID . '&SelectedArea=' . $myrow[0] . '">' . _('Edit') . '</a></td>'; - echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?' . SID . '&SelectedArea=' . $myrow[0] . '&delete=yes">' . _('Delete') . '</a></td>'; - echo '<td><a href="SelectCustomer.php'. '?' . SID . '&Area=' . $myrow[0] . '">' . _('View Customers from this Area') . '</a></td>'; - + echo '<td>' . $myrow[0] . '</td> + <td>' . $myrow[1] . '</td>'; + echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedArea=' . $myrow[0] . '">' . _('Edit') . '</a></td>'; + echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedArea=' . $myrow[0] . '&delete=yes">' . _('Delete') . '</a></td>'; + echo '<td><a href="SelectCustomer.php'. '?Area=' . $myrow[0] . '">' . _('View Customers from this Area') . '</a></td>'; } //END WHILE LIST LOOP echo '</table>'; Modified: trunk/AuditTrail.php =================================================================== --- trunk/AuditTrail.php 2011-05-07 00:24:37 UTC (rev 4562) +++ trunk/AuditTrail.php 2011-05-11 09:59:44 UTC (rev 4563) @@ -101,7 +101,8 @@ $SQLString = str_replace('SET','',$SQLString); $SQLString = str_replace('WHERE',',',$SQLString); $SQLString = str_replace('AND',',',$SQLString); - $FieldArray = preg_split("/[[:space:]]*([[:alnum:].]+[[:space:]]*=[[:space:]]*(?:'[^']*'|[[:digit:].]+))[[:space:]]*,/", $SQLString, 0, PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY); for ($i=0; $i<sizeof($FieldArray); $i++) { + $FieldArray = preg_split("/[[:space:]]*([[:alnum:].]+[[:space:]]*=[[:space:]]*(?:'[^']*'|[[:digit:].]+))[[:space:]]*,/", $SQLString, 0, PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY); + for ($i=0; $i<sizeof($FieldArray); $i++) { $Assigment = explode('=', $FieldArray[$i]); $_SESSION['SQLString']['fields'][$i] = $Assigment[0]; if (sizeof($Assigment)>1) { @@ -176,7 +177,7 @@ if (isset($_SESSION['SQLString']['values'][$i]) and (trim(str_replace("'","",$_SESSION['SQLString']['values'][$i])) != "") & (trim($_SESSION['SQLString']['fields'][$i]) != 'password') & (trim($_SESSION['SQLString']['fields'][$i]) != "www_users.password")) { - echo '<tr bgcolor='.$RowColour.'>'; + echo '<tr bgcolor="' . $RowColour . '">'; echo '<td></td> <td></td> <td></td> @@ -186,7 +187,7 @@ echo '</tr>'; } } - echo '<tr bgcolor=black><td></td><td></td><td></td><td></td><td></td><td></td></tr>'; + echo '<tr bgcolor=black> <td colspan="6"></td> </tr>'; } unset($_SESSION['SQLString']); } Modified: trunk/CustomerTypes.php =================================================================== --- trunk/CustomerTypes.php 2011-05-07 00:24:37 UTC (rev 4562) +++ trunk/CustomerTypes.php 2011-05-11 09:59:44 UTC (rev 4563) @@ -177,7 +177,7 @@ links to delete or edit each. These will call the same page again and allow update/input or deletion of the records*/ - $sql = 'SELECT typeid, typename FROM debtortype'; + $sql = "SELECT typeid, typename FROM debtortype"; $result = DB_query($sql,$db); echo '<br /><table class=selection>'; @@ -255,9 +255,11 @@ if (!isset($_POST['typename'])) { $_POST['typename']=''; } - echo '<tr><td>' . _('Type Name') . ':</td><td><input type="Text" name="typename" value="' . $_POST['typename'] . '"></td></tr>'; + echo '<tr><td>' . _('Type Name') . ':</td> + <td><input type="Text" name="typename" value="' . $_POST['typename'] . '"></td></tr>'; - echo '</td></tr></table>'; // close main table + echo '</td></tr> + </table>'; // close main table echo '<p><div class="centre"><input type=submit name=submit value="' . _('Accept') . '"></div>'; @@ -265,6 +267,5 @@ } // end if user wish to delete - include('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/FixedAssetItems.php =================================================================== --- trunk/FixedAssetItems.php 2011-05-07 00:24:37 UTC (rev 4562) +++ trunk/FixedAssetItems.php 2011-05-11 09:59:44 UTC (rev 4563) @@ -130,9 +130,9 @@ $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); + accumdepnact + FROM fixedassetcategories + WHERE categoryid='" . $_POST['AssetCategoryID'] . "'",$db); $NewAccounts = DB_fetch_array($result); $TransNo = GetNextTransNo( 42, $db); /* transaction type is asset category change */ @@ -145,7 +145,7 @@ account, narrative, amount) - VALUES ('42', + VALUES ('42', '" . $TransNo . "', '" . Date('Y-m-d') . "', '" . $PeriodNo . "', @@ -159,75 +159,75 @@ //debit cost for the new category $SQL = "INSERT INTO gltrans (type, - typeno, - trandate, - periodno, - account, - narrative, - amount) + 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']. "' - )"; + '" . $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) - 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) - 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); } /*end if there was accumulated depreciation for the asset */ } /* end if there is a change in asset category */ $sql = "UPDATE fixedassets - SET longdescription='" . $_POST['LongDescription'] . "', - description='" . $_POST['Description'] . "', - assetcategoryid='" . $_POST['AssetCategoryID'] . "', - assetlocation='" . $_POST['AssetLocation'] . "', - depntype='" . $_POST['DepnType'] . "', - depnrate='" . $_POST['DepnRate'] . "', - barcode='" . $_POST['BarCode'] . "', - serialno='" . $_POST['SerialNo'] . "' - WHERE assetid='" . $AssetID . "'"; + SET longdescription='" . $_POST['LongDescription'] . "', + description='" . $_POST['Description'] . "', + assetcategoryid='" . $_POST['AssetCategoryID'] . "', + assetlocation='" . $_POST['AssetLocation'] . "', + depntype='" . $_POST['DepnType'] . "', + depnrate='" . $_POST['DepnRate'] . "', + barcode='" . $_POST['BarCode'] . "', + serialno='" . $_POST['SerialNo'] . "' + WHERE assetid='" . $AssetID . "'"; $ErrMsg = _('The asset could not be updated because'); $DbgMsg = _('The SQL that was used to update the asset and failed was'); @@ -237,22 +237,22 @@ 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); @@ -278,12 +278,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) { @@ -309,40 +309,40 @@ if ($AssetRow['cost'] > 0){ //credit cost for the asset deleted $SQL = "INSERT INTO gltrans (type, - typeno, - trandate, - periodno, - account, - narrative, - amount) - 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) - 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); @@ -394,17 +394,17 @@ } elseif ($InputError!=1) { // Must be modifying an existing item and no changes made yet - need to lookup the details $sql = "SELECT assetid, - description, - longdescription, - assetcategoryid, - serialno, - assetlocation, - datepurchased, - depntype, - depnrate, - cost, - accumdepn, - barcode + description, + longdescription, + assetcategoryid, + serialno, + assetlocation, + datepurchased, + depntype, + depnrate, + cost, + accumdepn, + barcode FROM fixedassets WHERE assetid ='" . $AssetID . "'"; @@ -421,11 +421,11 @@ $_POST['DepnRate'] = $AssetRow['depnrate']; echo '<tr><td>' . _('Asset Code') . ':</td><td>'.$AssetID.'</td></tr>'. "\n"; - echo '<input type="Hidden" name="AssetID" value='.$AssetID.'>'. "\n"; + echo '<input type="Hidden" name="AssetID" value="'.$AssetID.'"/>'. "\n"; } else { // some changes were made to the data so don't re-set form variables to DB ie the code above echo '<tr><td>' . _('Asset Code') . ':</td><td>' . $AssetID . '</td></tr>'; - echo '<input type="Hidden" name="AssetID" value="' . $AssetID . '">'; + echo '<input type="Hidden" name="AssetID" value="' . $AssetID . '"/>'; } if (isset($_POST['Description'])) { @@ -434,7 +434,7 @@ $Description =''; } echo '<tr><td>' . _('Asset Description') . ' (' . _('short') . '):</td> - <td><input ' . (in_array('Description',$Errors) ? 'class="inputerror"' : '' ) .' type="Text" name="Description" size=52 maxlength=50 value="' . $Description . '"></td></tr>'."\n"; + <td><input ' . (in_array('Description',$Errors) ? 'class="inputerror"' : '' ) .' type="Text" name="Description" size=52 maxlength=50 value="' . $Description . '"></td></tr>'."\n"; if (isset($_POST['LongDescription'])) { $LongDescription = AddCarriageReturns($_POST['LongDescription']); Modified: trunk/FormDesigner.php =================================================================== --- trunk/FormDesigner.php 2011-05-07 00:24:37 UTC (rev 4562) +++ trunk/FormDesigner.php 2011-05-11 09:59:44 UTC (rev 4563) @@ -1,6 +1,6 @@ <?php /* $Id$ */ -//$PageSecurity = 14; + include('includes/session.inc'); $title = _('Form Designer'); include('includes/header.inc'); @@ -108,9 +108,6 @@ case 'GoodsReceived.xml': echo '<meta http-equiv="Refresh" content="0; url=' . $rootpath . '/PDFGrn.php?' . SID .'GRNNo=Preview&PONo=1">'; break; - case 'SalesInvoice.xml': - echo '<meta http-equiv="Refresh" content="0; url=' . $rootpath . '/PrintCustTrans.php?' . SID .'FromTransNo=Preview&InvOrCredit=Invoice&PrintPDF=True">'; - break; case 'PickingList.xml': echo '<meta http-equiv="Refresh" content="0; url=' . $rootpath . '/PDFPickingList.php?' . SID .'TransNo=Preview">'; break; Modified: trunk/GLJournal.php =================================================================== --- trunk/GLJournal.php 2011-05-07 00:24:37 UTC (rev 4562) +++ trunk/GLJournal.php 2011-05-11 09:59:44 UTC (rev 4563) @@ -22,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)){ @@ -158,8 +158,8 @@ if ($AllowThisPosting) { $SQL = "SELECT accountname - FROM chartmaster - WHERE accountcode='" . $_POST['GLManualCode'] . "'"; + FROM chartmaster + WHERE accountcode='" . $_POST['GLManualCode'] . "'"; $Result=DB_query($SQL,$db); if (DB_num_rows($Result)==0){ @@ -270,13 +270,13 @@ //Select the tag echo '<tr><td><select name="tag">'; -$SQL = 'SELECT tagref, - tagdescription +$SQL = "SELECT tagref, + tagdescription FROM tags - ORDER BY tagref'; + ORDER BY tagref"; $result=DB_query($SQL,$db); -echo '<option value="0">0 - None</option>'; +echo '<option value="0">0 - ' . _('None') . '</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'].'</option>'; @@ -294,10 +294,10 @@ "'".'The account code '."'".'+ this.value+ '."'".' doesnt exist'."'".')"' . ' value="'. $_POST['GLManualCode'] .'" /></td>'; -$sql='SELECT accountcode, - accountname - FROM chartmaster - ORDER BY accountcode'; +$sql="SELECT accountcode, + accountname + FROM chartmaster + ORDER BY accountcode"; $result=DB_query($sql, $db); echo '<td><select name="GLCode" onChange="return assignComboToInput(this,'.'GLManualCode'.')">'; @@ -321,7 +321,7 @@ $_POST['Debit'] = ''; } -echo '</tr><tr><th>' . _('Debit') . '</th>'.'<td><input type="text" class="number" Name = "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" ' . @@ -333,21 +333,22 @@ echo '<td><input type="text" name="GLNarrative" maxlength="100" size="100" value="' . $_POST['GLNarrative'] . '" /></td>'; echo '</tr></table><br />'; /*Close the main table */ -echo "<div class='centre'><input type='submit' name='Process' value='" . _('Accept') . "' /></div><br /><br />"; +echo '<div class="centre"><input type="submi2t" name="Process" value="' . _('Accept') . '" /></div><br /><br />'; echo '<table class="selection" width="85%">'; echo '<tr><th colspan="6"><div class="centre"><font size="3" color="blue"><b>' . _('Journal Summary') . '</b></font></div></th></tr>'; echo '<tr> - <th>'._('GL Tag').'</th> - <th>'._('GL Account').'</th> - <th>'._('Debit').'</th> - <th>'._('Credit').'</th> - <th>'._('Narrative').'</th></tr>'; + <th>'._('GL Tag').'</th> + <th>'._('GL Account').'</th> + <th>'._('Debit').'</th> + <th>'._('Credit').'</th> + <th>'._('Narrative').'</th> + </tr>'; -$debittotal=0; -$credittotal=0; +$DebitTotal=0; +$CreditTotal=0; $j=0; foreach ($_SESSION['JournalDetail']->GLEntries as $JournalItem) { @@ -364,39 +365,38 @@ $result=DB_query($sql, $db); $myrow=DB_fetch_row($result); if ($JournalItem->tag==0) { - $tagdescription='None'; + $TagDescription=_('None'); } else { - $tagdescription=$myrow[0]; + $TagDescription=$myrow[0]; } - echo '<td>' . $JournalItem->tag . ' - ' . $tagdescription . '</td>'; + echo '<td>' . $JournalItem->tag . ' - ' . $TagDescription . '</td>'; echo '<td>' . $JournalItem->GLCode . ' - ' . $JournalItem->GLActName . '</td>'; if ($JournalItem->Amount>0) { - echo '<td class="number">' . number_format($JournalItem->Amount,2) . '</td><td></td>'; - $debittotal=$debittotal+$JournalItem->Amount; - + echo '<td class="number">' . number_format($JournalItem->Amount,$_SESSION['CompanyRecord']['decimalplaces']) . '</td><td></td>'; + $DebitTotal=$DebitTotal+$JournalItem->Amount; } elseif($JournalItem->Amount<0) { - $credit=(-1 * $JournalItem->Amount); + $Credit=(-1 * $JournalItem->Amount); echo '<td></td> - <td class="number">' . number_format($credit,2) . '</td>'; - $credittotal=$credittotal+$credit; + <td class="number">' . number_format($Credit,$_SESSION['CompanyRecord']['decimalplaces']) . '</td>'; + $CreditTotal=$CreditTotal+$Credit; } - echo '<td>' . $JournalItem->Narrative . "</td> - <td><a href='" . $_SERVER['PHP_SELF'] . '?Delete=' . $JournalItem->ID . "'>"._('Delete').'</a></td> + echo '<td>' . $JournalItem->Narrative . '</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>' . number_format($debittotal,2) . '</b></td> - <td class="number"><b>' . number_format($credittotal,2) . '</b></td></tr>'; -if ($debittotal!=$credittotal) { + <td class="number"><b>' . _('Total') . '</b></td> + <td class="number"><b>' . number_format($DebitTotal,$_SESSION['CompanyRecord']['decimalplaces']) . '</b></td> + <td class="number"><b>' . number_format($CreditTotal,$_SESSION['CompanyRecord']['decimalplaces']) . '</b></td></tr>'; +if ($DebitTotal!=$CreditTotal) { echo '<td align="center" style="background-color: #fddbdb"><b>' . _('Required to balance') .' - </b>' . - number_format(abs($debittotal-$credittotal),2); + number_format(abs($DebitTotal-$CreditTotal),$_SESSION['CompanyRecord']['decimalplaces']); } -if ($debittotal>$credittotal) { +if ($DebitTotal>$CreditTotal) { echo ' ' . _('Credit') . '</td></tr>'; -} else if ($debittotal<$credittotal) { +} else if ($DebitTotal<$CreditTotal) { echo ' ' . _('Debit') . '</td></tr>'; } echo '</table>'; @@ -409,9 +409,9 @@ } if (!isset($_GET['NewJournal']) or $_GET['NewJournal']=='') { - echo "<script>defaultControl(document.form.GLManualCode);</script>"; + echo '<script>defaultControl(document.form.GLManualCode);</script>'; } else { - echo "<script>defaultControl(document.form.JournalProcessDate);</script>"; + echo '<script>defaultControl(document.form.JournalProcessDate);</script>'; } echo '</form>'; Modified: trunk/GLTags.php =================================================================== --- trunk/GLTags.php 2011-05-07 00:24:37 UTC (rev 4562) +++ trunk/GLTags.php 2011-05-11 09:59:44 UTC (rev 4563) @@ -8,39 +8,57 @@ include('includes/header.inc'); if (isset($_GET['SelectedTag'])) { - $sql="SELECT tagref, tagdescription FROM tags where tagref='".$_GET['SelectedTag']."'"; - $result= DB_query($sql,$db); - $myrow = DB_fetch_array($result,$db); - $ref=$myrow[0]; - $description=$myrow[1]; + if($_GET['Action']=='delete'){ + //first off test there are no transactions created with this tag + $Result = DB_query("SELECT counterindex + FROM gltrans + WHERE tag='" . $_GET['SelectedTag'] . "'",$db); + if (DB_num_rows($Result)>0){ + prnMsg(_('This tag cannot be deleted since there are already general ledger transactions created using it.'),'error'); + } else { + $Result = DB_query("DELETE FROM tags WHERE tagref='" . $_GET['SelectedTag'] . "'",$db); + prnMsg(_('The selected tag has been deleted'),'success'); + } + } else { + $sql="SELECT tagref, + tagdescription + FROM tags + WHERE tagref='".$_GET['SelectedTag']."'"; + + $result= DB_query($sql,$db); + $myrow = DB_fetch_array($result,$db); + $ref=$myrow['tagref']; + $Description=$myrow['tagdescription']; + } } else { - $description=''; + $Description=''; $_GET['SelectedTag']=''; } if (isset($_POST['submit'])) { - $sql = "INSERT INTO tags values(NULL, '".$_POST['description']."')"; + $sql = "INSERT INTO tags values(NULL, '".$_POST['Description']."')"; $result= DB_query($sql,$db); } if (isset($_POST['update'])) { - $sql = "UPDATE tags SET tagdescription='".$_POST['description']. - "' WHERE tagref='".$_POST['reference']."'"; + $sql = "UPDATE tags SET tagdescription='".$_POST['Description']. "' + WHERE tagref='".$_POST['reference']."'"; $result= DB_query($sql,$db); } echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/maintenance.png" title="' . _('Print') . '" alt="" />' . ' ' . $title . '</p>'; -echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . ' name="form">'; +echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '" name="form">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; -echo '<br><table><tr>'; +echo '<br /> + <table><tr>'; echo '<td>'. _('Description') . '</td> - <td><input type="text" size=30 maxlength=30 name="description" value="'.$description.'"></td><td> - <input type="hidden" name="reference" value="'.$_GET['SelectedTag'].'">'; + <td><input type="text" size=30 maxlength=30 name="Description" value="'.$Description.'"></td><td> + <input type="hidden" name="reference" value="'.$_GET['SelectedTag'].'">'; -if (isset($_GET['Action']) and $_GET['Action']=='edit') { +if (isset($_GET['Action']) AND $_GET['Action']=='edit') { echo '<input type="submit" name=update value=' . _('Update') . '>'; } else { echo '<input type="submit" name=submit value=' . _('Insert') . '>'; @@ -50,21 +68,25 @@ echo '</form>'; -echo '<table class=selection>'; -echo '<tr><th>'. _('Tag ID') .'</th>'; -echo '<th>'. _('Description'). '</th>'; +echo '<table class="selection">'; +echo '<tr><th>'. _('Tag ID') .'</th> + <th>'. _('Description'). '</th> + </tr>'; $sql="SELECT tagref, tagdescription FROM tags order by tagref"; $result= DB_query($sql,$db); while ($myrow = DB_fetch_array($result,$db)){ - echo '<tr><td>'.$myrow[0].'</td><td>'.$myrow[1].'</td> - <td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedTag=' . $myrow[0] . '&Action=edit">' . _('Edit') . '</a></td></tr>'; + echo '<tr><td>' . $myrow['tagref'].'</td> + <td>' . $myrow['tagdescription'].'</td> + <td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedTag=' . $myrow['tagref'] . '&Action=edit">' . _('Edit') . '</a></td> + <td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedTag=' . $myrow['tagref'] . '&Action=delete">' . _('Delete') . '</a></td> + </tr>'; } echo '</table><p></p>'; -echo '<script>defaultControl(document.form.description);</script>'; +echo '<script>defaultControl(document.form.Description);</script>'; include('includes/footer.inc'); Modified: trunk/PDFBankingSummary.php =================================================================== --- trunk/PDFBankingSummary.php 2011-05-07 00:24:37 UTC (rev 4562) +++ trunk/PDFBankingSummary.php 2011-05-11 09:59:44 UTC (rev 4563) @@ -25,7 +25,7 @@ $result=DB_query($sql, $db); echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '"> - <table class=selection>'; + <table class="selection">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<tr><td>' . _('Select the batch number of receipts to be printed') . ':</td>'; echo '<td><select name="BatchNo">'; @@ -41,19 +41,19 @@ if (isset($_POST['BatchNo']) and $_POST['BatchNo']!='') { $SQL= "SELECT bankaccountname, - bankaccountnumber, - ref, - transdate, - banktranstype, - bankact, - banktrans.exrate, - banktrans.functionalexrate, - banktrans.currcode - FROM bankaccounts, - banktrans - WHERE bankaccounts.accountcode=banktrans.bankact - AND banktrans.transno='" . $_POST['BatchNo'] . "' - AND banktrans.type=12"; + bankaccountnumber, + ref, + transdate, + banktranstype, + bankact, + banktrans.exrate, + banktrans.functionalexrate, + banktrans.currcode + FROM bankaccounts, + banktrans + WHERE bankaccounts.accountcode=banktrans.bankact + AND banktrans.transno='" . $_POST['BatchNo'] . "' + AND banktrans.type=12"; $ErrMsg = _('An error occurred getting the header information about the receipt batch number') . ' ' . $_POST['BatchNo']; $DbgMsg = _('The SQL used to get the receipt header information that failed was'); @@ -79,14 +79,14 @@ $SQL = "SELECT debtorsmaster.name, - ovamount, - invtext, - reference - FROM debtorsmaster INNER JOIN debtortrans - ON debtorsmaster.debtorno=debtortrans.debtorno - WHERE debtortrans.transno='" . $_POST['BatchNo'] . "' - AND debtortrans.type=12"; - + ovamount, + invtext, + reference + FROM debtorsmaster INNER JOIN debtortrans + ON debtorsmaster.debtorno=debtortrans.debtorno + WHERE debtortrans.transno='" . $_POST['BatchNo'] . "' + AND debtortrans.type=12"; + $CustRecs=DB_query($SQL,$db,'','',false,false); if (DB_error_no($db)!=0){ $title = _('Create PDF Print-out For A Batch Of Receipts'); @@ -99,13 +99,13 @@ exit; } $SQL = "SELECT narrative, - amount - FROM gltrans - WHERE gltrans.typeno='" . $_POST['BatchNo'] . "' - AND gltrans.type=12 and gltrans.amount <0 - AND gltrans.account !='" . $myrow['bankact'] . "' - AND gltrans.account !='" . $_SESSION['CompanyRecord']['debtorsact'] . "'"; - + amount + FROM gltrans + WHERE gltrans.typeno='" . $_POST['BatchNo'] . "' + AND gltrans.type=12 and gltrans.amount <0 + AND gltrans.account !='" . $myrow['bankact'] . "' + AND gltrans.account !='" . $_SESSION['CompanyRecord']['debtorsact'] . "'"; + $GLRecs=DB_query($SQL,$db,'','',false,false); if (DB_error_no($db)!=0){ $title = _('Create PDF Print-out For A Batch Of Receipts'); Modified: trunk/PDFOrderStatus.php =================================================================== --- trunk/PDFOrderStatus.php 2011-05-07 00:24:37 UTC (rev 4562) +++ trunk/PDFOrderStatus.php 2011-05-11 09:59:44 UTC (rev 4563) @@ -48,7 +48,7 @@ echo '<option selected value="All">' . _('Over All Categories') . '</option>'; while ($myrow=DB_fetch_array($result)){ - echo '<option value=' . $myrow['categoryid'] . '>' . $myrow['categorydescription'] . '</option>'; + echo '<option value="' . $myrow['categoryid'] . '">' . $myrow['categorydescription'] . '</option>'; } echo '</select></td></tr>'; Modified: trunk/PO_AuthorisationLevels.php =================================================================== --- trunk/PO_AuthorisationLevels.php 2011-05-07 00:24:37 UTC (rev 4562) +++ trunk/PO_AuthorisationLevels.php 2011-05-11 09:59:44 UTC (rev 4563) @@ -28,28 +28,27 @@ $_POST['AuthLevel']=0; } $sql="SELECT COUNT(*) - FROM purchorderauth - WHERE userid='" . $_POST['UserID'] . "' - AND currabrev='" . $_POST['CurrCode'] . "'"; + FROM purchorderauth + WHERE userid='" . $_POST['UserID'] . "' + AND currabrev='" . $_POST['CurrCode'] . "'"; $result=DB_query($sql, $db); $myrow=DB_fetch_array($result); if ($myrow[0]==0) { $sql="INSERT INTO purchorderauth ( userid, - currabrev, - cancreate, - offhold, - authlevel) - VALUES( - '".$_POST['UserID']."', - '".$_POST['CurrCode']."', - '".$CanCreate."', - '".$OffHold."', - '".$_POST['AuthLevel']."')"; - $ErrMsg = _('The authentication details cannot be inserted because'); - $Result=DB_query($sql,$db,$ErrMsg); + currabrev, + cancreate, + offhold, + authlevel) + VALUES( '".$_POST['UserID']."', + '".$_POST['CurrCode']."', + '".$CanCreate."', + '".$OffHold."', + '".$_POST['AuthLevel']."')"; + $ErrMsg = _('The authentication details cannot be inserted because'); + $Result=DB_query($sql,$db,$ErrMsg); } else { prnMsg(_('There already exists an entry for this user/currency combination'), 'error'); - echo '<br />'; + echo '<br />'; } } @@ -136,16 +135,16 @@ $OffHold=_('No'); } echo '<tr><td>' . $myrow['userid'] . '</td> - <td>' . $myrow['realname'] . '</td> - <td>' . $myrow['currency'] . '</td> - <td>' . $CanCreate . '</td> - <td>' . $OffHold . '</td> - <td class="number">'.number_format($myrow['authlevel'],2).'</td> - <td><a href="'.$rootpath.'/PO_AuthorisationLevels.php?Edit=Yes&UserID=' . $myrow['userid'] . - '&Currency='.$myrow['currabrev'].'">'._('Edit').'</td> - <td><a href="'.$rootpath.'/PO_AuthorisationLevels.php?Delete=Yes&UserID=' . $myrow['userid'] . - '&Currency='.$myrow['currabrev'].'">'._('Delete').'</td> - </tr>'; + <td>' . $myrow['realname'] . '</td> + <td>' . $myrow['currency'] . '</td> + <td>' . $CanCreate . '</td> + <td>' . $OffHold . '</td> + <td class="number">'.number_format($myrow['authlevel'],2).'</td> + <td><a href="'.$rootpath.'/PO_AuthorisationLevels.php?Edit=Yes&UserID=' . $myrow['userid'] . +'&Currency='.$myrow['currabrev'].'">'._('Edit').'</td> + <td><a href="'.$rootpath.'/PO_AuthorisationLevels.php?Delete=Yes&UserID=' . $myrow['userid'] . +'&Currency='.$myrow['currabrev'].'">'._('Delete').'</td> + </tr>'; } echo '</table><br><br>'; @@ -176,7 +175,7 @@ $CurrencyResult=DB_query($CurrencySQL,$db); $myrow=DB_fetch_array($CurrencyResult); echo '<tr><td>'._('Currency').'</td> - <td>' . $myrow['currency'] . '</td></tr>'; + <td>' . $myrow['currency'] . '</td></tr>'; echo '<input type=hidden name="currabrev" value="'.$Currency.'"'; } else { echo '<tr><td>'._('Currency').'</td><td><select name="CurrCode">'; Modified: trunk/SecurityTokens.php =================================================================== --- trunk/SecurityTokens.php 2011-05-07 00:24:37 UTC (rev 4562) +++ trunk/SecurityTokens.php 2011-05-11 09:59:44 UTC (rev 4563) @@ -80,7 +80,7 @@ echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '" name="form">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; -echo '<br><table><tr>'; +echo '<br /><table><tr>'; if (isset($_GET['Action']) and $_GET['Action']=='edit') { echo '<td>'. _('Description') . '</td> @@ -99,7 +99,7 @@ echo '<table class="selection">'; echo '<tr><th>'. _('Token ID') .'</th> - <th>'. _('Description'). '</th>'; + <th>'. _('Description'). '</th>'; $sql="SELECT tokenid, tokenname FROM securitytokens ORDER BY tokenid"; $Result= DB_query($sql,$db); Modified: trunk/Shipt_Select.php =================================================================== --- trunk/Shipt_Select.php 2011-05-07 00:24:37 UTC (rev 4562) +++ trunk/Shipt_Select.php 2011-05-11 09:59:44 UTC (rev 4563) @@ -223,7 +223,7 @@ //figure out the SQL required from the inputs available - if (isset($ShiptRef) AND $ShiptRef !='') { + if (isset($ShiptRef) && $ShiptRef !="") { $SQL = "SELECT shipments.shiptref, vessel, voyageref, @@ -231,7 +231,7 @@ shipments.eta, shipments.closed FROM shipments INNER JOIN suppliers - ON shipments.supplierid = suppliers.supplierid + ON shipments.supplierid = suppliers.supplierid WHERE shipments.shiptref='". $ShiptRef . "'"; } else { $SQL = "SELECT DISTINCT shipments.shiptref, vessel, voyageref, suppliers.suppname, shipments.eta, shipments.closed @@ -250,17 +250,17 @@ AND purchorders.intostocklocation = '". $_POST['StockLocation'] . "' AND shipments.closed='" . $_POST['OpenOrClosed'] . "'"; } else { - $SQL .= " WHERE shipments.supplierid='" . $SelectedSupplier ."' + $SQL .= "WHERE shipments.supplierid='" . $SelectedSupplier ."' AND purchorders.intostocklocation = '". $_POST['StockLocation'] . "' AND shipments.closed='" . $_POST['OpenOrClosed'] ."'"; } } else { //no supplier selected if (isset($SelectedStockItem)) { - $SQL .= " WHERE purchorderdetails.itemcode='". $SelectedStockItem ."' + $SQL .= "WHERE purchorderdetails.itemcode='". $SelectedStockItem ."' AND purchorders.intostocklocation = '". $_POST['StockLocation'] . "' AND shipments.closed='" . $_POST['OpenOrClosed'] . "'"; } else { - $SQL .= " WHERE purchorders.intostocklocation = '". $_POST['StockLocation'] . "' + $SQL .= "WHERE purchorders.intostocklocation = '". $_POST['StockLocation'] . "' AND shipments.closed='" . $_POST['OpenOrClosed'] . "'"; } Modified: trunk/Stocks.php =================================================================== --- trunk/Stocks.php 2011-05-07 00:24:37 UTC (rev 4562) +++ trunk/Stocks.php 2011-05-11 09:59:44 UTC (rev 4563) @@ -466,7 +466,7 @@ // PREVENT DELETES IF DEPENDENT RECORDS IN 'StockMoves' - $sql= "SELECT COUNT(*) FROM stockmoves WHERE stockid='".$StockID."'"; + $sql= "SELECT COUNT(*) FROM stockmoves WHERE stockid='".$StockID."' GROUP BY stockid"; $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); if ($myrow[0]>0) { @@ -475,7 +475,7 @@ echo '<br />' . _('There are') . ' ' . $myrow[0] . ' ' . _('stock movements that refer to this item'); } else { - $sql= "SELECT COUNT(*) FROM bom WHERE component='".$StockID."'"; + $sql= "SELECT COUNT(*) FROM bom WHERE component='".$StockID."' GROUP BY component"; $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); if ($myrow[0]>0) { @@ -483,7 +483,7 @@ prnMsg( _('Cannot delete this item record because there are bills of material that require this part as a component'),'warn'); echo '<br />' . _('There are') . ' ' . $myrow[0] . ' ' . _('bills of material that require this part as a component'); } else { - $sql= "SELECT COUNT(*) FROM salesorderdetails WHERE stkcode='".$StockID."'"; + $sql= "SELECT COUNT(*) FROM salesorderdetails WHERE stkcode='".$StockID."' GROUP BY stkcode"; $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); if ($myrow[0]>0) { @@ -491,7 +491,7 @@ prnMsg( _('Cannot delete this item record because there are existing sales orders for this part'),'warn'); echo '<br />' . _('There are') . ' ' . $myrow[0] . ' ' . _('sales order items against this part'); } else { - $sql= "SELECT COUNT(*) FROM salesanalysis WHERE stockid='".$StockID."'"; + $sql= "SELECT COUNT(*) FROM salesanalysis WHERE stockid='".$StockID."' GROUP BY stockid"; $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); if ($myrow[0]>0) { @@ -499,7 +499,7 @@ prnMsg(_('Cannot delete this item because sales analysis records exist for it'),'warn'); echo '<br />' . _('There are') . ' ' . $myrow[0] . ' ' . _('sales analysis records against this part'); } else { - $sql= "SELECT COUNT(*) FROM purchorderdetails WHERE itemcode='".$StockID."'"; + $sql= "SELECT COUNT(*) FROM purchorderdetails WHERE itemcode='".$StockID."' GROUP BY itemcode"; $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); if ($myrow[0]>0) { @@ -507,7 +507,7 @@ prnMsg(_('Cannot delete this item because there are existing purchase order items for it'),'warn'); echo '<br />' . _('There are') . ' ' . $myrow[0] . ' ' . _('purchase order item record relating to this part'); } else { - $sql = "SELECT SUM(quantity) AS qoh FROM locstock WHERE stockid='".$StockID."'"; + $sql = "SELECT SUM(quantity) AS qoh FROM locstock WHERE stockid='".$StockID."' GROUP BY stockid"; $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); if ($myrow[0]!=0) { Modified: trunk/SupplierAllocations.php =================================================================== --- trunk/SupplierAllocations.php 2011-05-07 00:24:37 UTC (rev 4562) +++ trunk/SupplierAllocations.php 2011-05-11 09:59:44 UTC (rev 4563) @@ -294,21 +294,21 @@ $SQL= "SELECT systypes.typename, - supptrans.type, - supptrans.transno, - supptrans.trandate, - supptrans.supplierno, - suppliers.suppname, - rate, - (supptrans.ovamount+supptrans.ovgst) AS total, - supptrans.diffonexch, - supptrans.alloc - FROM supptrans, - systypes, - suppliers - WHERE supptrans.type = systypes.typeid - AND supptrans.supplierno = suppliers.supplierid - AND supptrans.id='" . $_SESSION['AllocTrans'] . "'"; + supptrans.type, + supptrans.transno, + supptrans.trandate, + supptrans.supplierno, + suppliers.suppname, + rate, + (supptrans.ovamount+supptrans.ovgst) AS total, + supptrans.diffonexch, + supptrans.alloc + FROM supptrans, + systypes, + suppliers + WHERE supptrans.type = systypes.typeid + AND supptrans.supplierno = suppliers.supplierid + AND supptrans.id='" . $_SESSION['AllocTrans'] . "'"; $Result = DB_query($SQL, $db); if (DB_num_rows($Result) != 1){ @@ -336,21 +336,21 @@ /*First get the transactions that have outstanding balances ie Total-Alloc >0 */ $SQL= "SELECT supptrans.id, - typename, - transno, - trandate, - suppreference, - rate, - ovamount+ovgst AS total, - diffonexch, - alloc - FROM supptrans, - systypes - WHERE supptrans.type = systypes.typeid - AND supptrans.settled=0 - AND abs(ovamount+ovgst-alloc)>0.009 - AND supplierno='" . $_SESSION['Alloc']->SupplierID . "'"; - + typename, + transno, + trandate, + suppreference, + rate, + ovamount+ovgst AS total, + diffonexch, + alloc + FROM supptrans, + systypes + WHERE supptrans.type = systypes.typeid + AND supptrans.settled=0 + AND abs(ovamount+ovgst-alloc)>0.009 + AND supplierno='" . $_SESSION['Alloc']->SupplierID . "'"; + $ErrMsg = _('There was a problem retrieving the transactions available to allocate to'); $DbgMsg = _('The SQL that was used to retrieve the transaction information was'); @@ -359,41 +359,41 @@ while ($myrow=DB_fetch_array($Result)){ $_SESSION['Alloc']->add_to_AllocsAllocn ($myrow['id'], - $myrow['typename'], - $myrow['transno'], - ConvertSQLDate($myrow['trandate']), - $myrow['suppreference'], - 0, - $myrow['total'], - $myrow['rate'], - $myrow['diffonexch'], - $myrow['diffonexch'], - $myrow['alloc'], - 'NA'); - } + $myrow['typename'], + $myrow['transno'], + ConvertSQLDate($myrow['trandate']), + $myrow['suppreference'], + 0, + $myrow['total'], + $myrow['rate'], + $myrow['diffonexch'], + $myrow['diffonexch'], + $myrow['alloc'], + 'NA'); +} /* Now get trans that might have previously been allocated to by this trans NB existing entries where still some of the trans outstanding entered from above logic will be overwritten with the prev alloc detail below */ $SQL = "SELECT supptrans.id, - typename, - transno, - trandate, - suppreference, - rate, - ovamount+ovgst AS total, - diffonexch, - supptrans.alloc-suppallocs.amt AS prevallocs, - amt, - suppallocs.id AS allocid - FROM supptrans, - systypes, - suppallocs - WHERE supptrans.type = systypes.typeid - AND supptrans.id=suppallocs.transid_allocto - AND suppallocs.transid_allocfrom='" . $_SESSION['AllocTrans'] . - "' AND supplierno='" . $_SESSION['Alloc']->SupplierID . "'"; + typename, + transno, + trandate, + suppreference, + rate, + ovamount+ovgst AS total, + diffonexch, + supptrans.alloc-suppallocs.amt AS prevallocs, + amt, + suppallocs.id AS allocid + FROM supptrans, + systypes, + suppallocs + WHERE supptrans.type = systypes.typeid + AND supptrans.id=suppallocs.transid_allocto + AND suppallocs.transid_allocfrom='" . $_SESSION['AllocTrans'] . + "' AND supplierno='" . $_SESSION['Alloc']->SupplierID . "'"; $ErrMsg = _('There was a problem retrieving the previously allocated transactions for modification'); @@ -405,14 +405,16 @@ $DiffOnExchThisOne = ($myrow['amt']/$myrow['rate']) - ($myrow['amt']/$_SESSION['Alloc']->TransExRate); - $_SESSION['Alloc']->add_to_AllocsAllocn ($myrow['id'], $myrow['typename'], $myrow['transno'], - ConvertSQLDate($myrow['trandate']), $myrow['suppreference'], $myrow['amt'], - $myrow['total'], - $myrow['rate'], - $DiffOnExchThisOne, - ($myrow['diffonexch'] - $DiffOnExchThisOne), - $myrow['prevallocs'], - $myrow['allocid']); + $_SESSION['Alloc']->add_to_AllocsAllocn ($myrow['id'], + $myrow['typename'], + $myrow['transno'], + ConvertSQLDate($myrow['trandate']), $myrow['suppreference'], $myrow['amt'], + $myrow['total'], + $myrow['rate'], + $DiffOnExchThisOne, + ($myrow['diffonexch'] - $DiffOnExchThisOne), + $myrow['prevallocs'], + $myrow['allocid']); } } @@ -444,12 +446,12 @@ echo '<table cellpadding=2 colspan=7 class=selection>'; $TableHeader = '<tr><th>' . _('Type') . '</th> - <th>' . _('Trans') . '<br />' . _('Number') . '</th> - <th>' . _('Trans') .'<br />' . _('Date') . '</th> - <th>' . _('Supp') . '<br />' . _('Ref') . '</th> - <th>' . _('Total') . '<br />' . _('Amount') .'</th> - <th>' . _('Yet to') . '<br />' . _('Allocate') . '</th> - <th>' . _('This') . '<br />' . _('Allocation') . '</th></tr>'; + <th>' . _('Trans') . '<br />' . _('Number') . '</th> + <th>' . _('Trans') .'<br />' . _('Date') . '</th> + <th>' . _('Supp') . '<br />' . _('Ref') . '</th> + <th>' . _('Total') . '<br />' . _('Amount') .'</th> + <th>' . _('Yet to') . '<br />' . _('Allocate') . '</th> + <th>' . _('This') . '<br />' . _('Allocation') . '</th></tr>'; $k = 0; $Counter = 0; $RowCounter = 0; @@ -481,11 +483,11 @@ $YetToAlloc = ($AllocnItem->TransAmount - $AllocnItem->PrevAlloc); echo '<td>' . $AllocnItem->TransType . '</td> - <td>' . $AllocnItem->TypeNo . '</td> - <td>' . $AllocnItem->TransDate . '</td> - <td>' . $AllocnItem->SuppRef . '</td> - <td class="number">' . number_format($AllocnItem->TransAmount,2) . '</td> - <td class="number">' . number_format($YetToAlloc,2) . '<input type="hidden" name="YetToAlloc' . + <td>' . $AllocnItem->TypeNo . '</td> + <td>' . $AllocnItem->TransDate . '</td> + <td>' . $AllocnItem->SuppRef . '</td> + <td class="number">' . number_format($AllocnItem->TransAmount,2) . '</td> + <td class="number">' . number_format($YetToAlloc,2) . '<input type="hidden" name="YetToAlloc' . $Counter . '" VALUE=' . $YetToAlloc . '></td>'; echo '<td class="number"><input type="checkbox" name="All' . $Counter . '"'; @@ -551,12 +553,12 @@ echo '<table class=selection>'; $TableHeader = '<tr><th>' . _('Trans Type') .'</th> - <th>' . _('Supplier') . '</th> - <th>' . _('Number') . '</th> - <th>' . _('Date') . '</th> - <th>' . _('Total') . '</th> - <th>' . _('To Alloc') . '</th> - </tr>\n'; + <th>' . _('Supplier') . '</th> + <th>' . _('Number') . '</th> + <th>' . _('Date') . '</th> + <th>' . _('Total') . '</th> + <th>' . _('To Alloc') . '</th> + </tr>\n'; echo $TableHeader; @@ -587,7 +589,7 @@ ConvertSQLDate($myrow['trandate']), $myrow['total'], $myrow['total']-$myrow['alloc'], - $_SERVER['PHP_SELF'] . "?" . SID, + $_SERVER['PHP_SELF'] . '?', $myrow['id']); } @@ -600,35 +602,35 @@ unset($_SESSION['Alloc']); $sql = "SELECT id, - transno, - typename, - type, - suppliers.supplierid, - suppname, - trandate, - suppreference, - rate, - ovamount+ovgst AS total, - alloc - FROM supptrans, - suppliers, - systypes - WHERE supptrans.type=systypes.typeid - AND supptrans.supplierno=suppliers.supplierid - AND (type=21 or type=22) - AND settled=0 ORDER BY id"; + transno, + typename, + type, + suppliers.supplierid, + suppname, + trandate, + suppreference, + rate, + ovamount+ovgst AS total, + alloc + FROM supptrans, + suppliers, + systypes + WHERE supptrans.type=systypes.typeid + AND supptrans.supplierno=suppliers.supplierid + AND (type=21 or type=22) + AND settled=0 ORDER BY id"; $result = DB_query($sql, $db); echo '<table class=selection>'; $TableHeader = '<tr><th>' . _('Trans Type') . '</th> - <th>' . _('Supplier') . '</th> - <th>' . _('Number') . '</th> - <th>' . _('Date') . '</th> - <th>' . _('Total') . '</th> - <th>' . _('To Alloc') . '</th> - <th>' . _('More Info') . '</th> - </tr>' ; + <th>' . _('Supplier') . '</th> + <th>' . _('Number') . '</th> + <th>' . _('Date') . '</th> + <th>' . _('Total') . '</th> + <th>' . _('To Alloc') . '</th> + <th>' . _('More Info') . '</th> + </tr>' ; echo $TableHeader; Modified: trunk/UpgradeDatabase.php =================================================================== --- trunk/UpgradeDatabase.php 2011-05-07 00:24:37 UTC (rev 4562) +++ trunk/UpgradeDatabase.php 2011-05-11 09:59:44 UTC (rev 4563) @@ -98,6 +98,7 @@ case '3.10': $SQLScripts[] = './sql/mysql/upgrade3.10-3.11.sql'; case '3.11': + case '3.12.32': case '4.0RC1': case '4.01': case '4.02': @@ -195,4 +196,4 @@ } /*Dont do upgrade */ include('includes/footer.inc'); -?> +?> \ No newline at end of file Modified: trunk/Z_ImportStocks.php =================================================================== --- trunk/Z_ImportStocks.php 2011-05-07 00:24:37 UTC (rev 4562) +++ trunk/Z_ImportStocks.php 2011-05-11 09:59:44 UTC (rev 4563) @@ -1,308 +1,308 @@ -<?php -/* $Id: Z_ImportStocks.php 4043 2010-09-30 16:17:53Z tim_schofield $*/ -/* Script to make stock locations for all parts that do not have stock location records set up*/ - -//$PageSecurity = 15; -include('includes/session.inc'); -$title = _('Import Items'); -include('includes/header.inc'); - -// If this script is called with a file object, then the file contents are imported -// If this script is called with the gettemplate flag, then a template file is served -// Otherwise, a file upload form is displayed - -$headers = array( - 'StockID', // 0 'STOCKID', - 'Description', // 1 'DESCRIPTION', - 'LongDescription', // 2 'LONGDESCRIPTION', - 'CategoryID', // 3 'CATEGORYID', - 'Units', // 4 'UNITS', - 'MBFlag', // 5 'MBFLAG', - 'EOQ', // 6 'EOQ', - 'Discontinued', // 7 'DISCONTINUED', - 'Controlled', // 8 'CONTROLLED', - 'Serialised', // 9 'SERIALISED', - 'Perishable', // 10 'PERISHABLE', - 'Volume', // 11 'VOLUME', - 'KGS', // 12 'KGS', - 'BarCode', // 13 'BARCODE', - 'DiscountCategory', // 14 'DISCOUNTCATEGORY', - 'TaxCat', // 15 'TAXCAT', - 'DecimalPlaces', // 16 'DECIMALPLACES', - 'ItemPDF' // 17 'ITEMPDF' -); - -if ($_FILES['userfile']['name']) { //start file processing - - //initialize - $allowType='text/csv'; - $fieldTarget = 18; - $InputError = 0; - - //check file info - $fileName = $_FILES['userfile']['name']; - $tmpName = $_FILES['userfile']['tmp_name']; - $fileSize = $_FILES['userfile']['size']; - $fileType = $_FILES['userfile']['type']; - if ($fileType != $allowType) { - prnMsg (_('File has type '. $fileType. ', but only '. $allowType. ' is allowed.'),'error'); - include('includes/footer.inc'); - exit; - } - - //get file handle - $handle = fopen($tmpName, 'r'); - - //get the header row - $headRow = fgetcsv($handle, 10000, ","); - - //check for correct number of fields - if ( count($headRow) != count($headers) ) { - prnMsg (_('File contains '. count($headRow). ' columns, expected '. count($headers). '. Try downloading a new template.'),'error'); - fclose($handle); - include('includes/footer.inc'); - exit; - } - - //test header row field name and sequence - $head = 0; - foreach ($headRow as $headField) { - if ( strtoupper($headField) != strtoupper($headers[$head]) ) { - prnMsg (_('File contains incorrect headers ('. strtoupper($headField). ' != '. strtoupper($header[$head]). '. Try downloading a new template.'),'error'); - fclose($handle); - include('includes/footer.inc'); - exit; - } - $head++; - } - - //start database transaction - DB_Txn_Begin($db); - - //loop through file rows - $row = 1; - while ( ($myrow = fgetcsv($handle, 10000, ",")) !== FALSE ) { - - //check for correct number of fields - $fieldCount = count($myrow); - if ($fieldCount != $fieldTarget){ - prnMsg (_($fieldTarget. ' fields required, '. $fieldCount. ' fields received'),'error'); - fclose($handle); - include('includes/footer.inc'); - exit; - } - - // cleanup the data (csv files often import with empty strings and such) - $StockID = strtoupper($myrow[0]); - foreach ($myrow as &$value) { - $value = trim($value); - } - - //first off check if the item already exists - $sql = "SELECT COUNT(stockid) FROM stockmaster WHERE stockid='".$StockID."'"; - $result = DB_query($sql,$db); - $testrow = DB_fetch_row($result); - if ($testrow[0] != 0) { - $InputError = 1; - prnMsg (_('Stock item "'. $StockID. '" already exists'),'error'); - } - - //next validate inputs are sensible - if (!$myrow[1] or strlen($myrow[1]) > 50 OR strlen($myrow[1])==0) { - $InputError = 1; - prnMsg (_('The stock item description must be entered and be fifty characters or less long') . '. ' . _('It cannot be a zero length string either') . ' - ' . _('a description is required'). ' ("'. implode('","',$myrow). $stockid. '") ','error'); - } - if (strlen($myrow[2])==0) { - $InputError = 1; - prnMsg (_('The stock item description cannot be a zero length string') . ' - ' . _('a long description is required'),'error'); - } - if (strlen($StockID) ==0) { - $InputError = 1; - prnMsg (_('The Stock Item code cannot be empty'),'error'); - } - if (strstr($StockID,' ') OR strstr($StockID,"'") OR strstr($StockID,'+') OR strstr($StockID,"\\") OR strstr($StockID,"\"") OR strstr($StockID,'&') OR strstr($StockID,'"')) { - $InputError = 1; - prnMsg(_('The stock item code cannot contain any of the following characters') . " ' & + \" \\ " . _('or a space'). " (". $StockID. ")",'error'); - $StockID=''; - } - if (strlen($myrow[4]) >20) { - $InputError = 1; - prnMsg(_('The unit of measure must be 20 characters or less long'),'error'); - } - if (strlen($myrow[13]) >20) { - $InputError = 1; - prnMsg(_('The barcode must be 20 characters or less long'),'error'); - } - if ($myrow[10]!=0 AND $myrow[10]!=1) { - $InputError = 1; - prnMsg (_('Values in the Perishable field must be either 0 (No) or 1 (Yes)') ,'error'); - } - if (!is_numeric($myrow[11])) { - $InputError = 1; - prnMsg (_('The volume of the packaged item in cubic metres must be numeric') ,'error'); - } - if ($myrow[11] <0) { - $InputError = 1; - prnMsg(_('The volume of the packaged item must be a positive number'),'error'); - } - if (!is_numeric($myrow[12])) { - $InputError = 1; - prnMsg(_('The weight of the packaged item in KGs must be numeric'),'error'); - } - if ($myrow[12]<0) { - $InputError = 1; - prnMsg(_('The weight of the packaged item must be a positive number'),'error'); - } - if (!is_numeric($myrow[6])) { - $InputError = 1; - prnMsg(_('The economic order quantity must be numeric'),'error'); - } - if ($$myrow[6] <0) { - $InputError = 1; - prnMsg (_('The economic order quantity must be a positive number'),'error'); - } - if ($myrow[8]==0 AND $myrow[9]==1){ - $InputError = 1; - prnMsg(_('The item can only be serialised if there is lot control enabled already') . '. ' . _('Batch control') . ' - ' . _('with any number of items in a lot/bundle/roll is enabled when controlled is enabled') . '. ' . _('Serialised control requires that only one item is in the batch') . '. ' . _('For serialised control') . ', ' . _('both controlled and serialised must be enabled'),'error'); - } - - $mbflag = $myrow[5]; - if ($mbflag!='M' and $mbflag!='K' and $mbflag!='A' and $mbflag!='B' and $mbflag!='D' and $mbflag!='G') { - $InputError = 1; - prnMsg(_('Items must be of MBFlag type Manufactured(M), Assembly(A), Kit-Set(K), Purchased(B), Dummy(D) or Phantom(G)'),'error'); - } - if (($mbflag=='A' OR $mbflag=='K' OR $mbflag=='D' OR $mbflag=='G') AND $myrow[8]==1){ - $InputError = 1; - prnMsg(_('Assembly/Kitset/Phantom/Service items cannot also be controlled items') . '. ' . _('Assemblies, Dummies and Kitsets are not physical items and batch/serial control is therefore not appropriate'),'error'); - } - if ($myrow[3]==''){ - $InputError = 1; - prnMsg(_('There are no inventory categories defined. All inventory items must belong to a valid inventory category,'),'error'); - } - if ($myrow[17]==''){ - $InputError = 1; - prnMsg(_('ItemPDF must contain either a filename, or the keyword `none`'),'error'); - } - - if ($InputError !=1){ - if ($myrow[9]==1){ /*Not appropriate to have several dp on serial items */ - $myrow[16]=0; - } - - //attempt ... [truncated message content] |
From: <dai...@us...> - 2011-05-13 10:50:51
|
Revision: 4565 http://web-erp.svn.sourceforge.net/web-erp/?rev=4565&view=rev Author: daintree Date: 2011-05-13 10:50:42 +0000 (Fri, 13 May 2011) Log Message: ----------- various Modified Paths: -------------- trunk/BOMs.php trunk/Factors.php trunk/GLJournal.php trunk/GLTags.php trunk/GoodsReceived.php trunk/MRPDemands.php trunk/OffersReceived.php trunk/PO_AuthorisationLevels.php trunk/PO_AuthoriseMyOrders.php trunk/PO_SelectPurchOrder.php trunk/Payments.php trunk/PcAssignCashToTab.php trunk/PcClaimExpensesFromTab.php trunk/PcTabs.php trunk/Prices.php trunk/Prices_Customer.php trunk/SalesCategories.php trunk/SalesTypes.php trunk/SelectProduct.php trunk/SelectRecurringSalesOrder.php trunk/SelectSalesOrder.php trunk/SupplierAllocations.php trunk/includes/header.inc Modified: trunk/BOMs.php =================================================================== --- trunk/BOMs.php 2011-05-11 10:03:40 UTC (rev 4564) +++ trunk/BOMs.php 2011-05-13 10:50:42 UTC (rev 4565) @@ -131,20 +131,20 @@ } else { $QuantityOnHand = number_format($myrow[10],$myrow[11]); } - printf("<td>%s</td> + printf('<td>%s</td> <td>%s</td> - <td>%s</td> <td>%s</td> <td>%s</td> + <td>%s</td> <td class=number>%s</td> <td>%s</td> <td>%s</td> <td>%s</td> <td class=number>%s</td> - <td><a href=\"%s&Select=%s&SelectedComponent=%s\">" . _('Edit') . "</a></td> - <td>".$DrillText."</a></td> - <td><a href=\"%s&Select=%s&SelectedComponent=%s&delete=1&ReSelect=%s\">" . _('Delete') . "</a></td> - </tr>", + <td><a href="%s&Select=%s&SelectedComponent=%s">' . _('Edit') . '</a></td> + <td>'.$DrillText.'</a></td> + <td><a href="%s&Select=%s&SelectedComponent=%s&delete=1&ReSelect=%s">' . _('Delete') . '</a></td> + </tr>', $Level1, $myrow[0], $myrow[1], @@ -789,7 +789,7 @@ echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/magnifier.png" title="' . _('Search') . '" alt="">' . ' ' . $title; echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">' . - '<div class="page_help_text">'. _('Select a manufactured part') . " (" . _('or Assembly or Kit part') . ") " . + '<div class="page_help_text">'. _('Select a manufactured part') . ' (' . _('or Assembly or Kit part') . ') ' . _('to maintain the bill of material for using the options below') . '<br /><font size=1>' . _('Parts must be defined in the stock item entry') . '/' . _('modification screen as manufactured') . ', ' . _('kits or assemblies to be available for construction of a bill of material') .'</div>'. @@ -806,7 +806,7 @@ <br /><div class="centre"><input tabindex="3" type="submit" name="Search" value="' . _('Search Now') . '"></div>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; -if (isset($_POST['Search']) and isset($result) AND !isset($SelectedParent)) { +if (isset($_POST['Search']) AND isset($result) AND !isset($SelectedParent)) { echo '<br /><table cellpadding=2 colspan=7 class=selection>'; $TableHeader = '<tr><th>' . _('Code') . '</th> Modified: trunk/Factors.php =================================================================== --- trunk/Factors.php 2011-05-11 10:03:40 UTC (rev 4564) +++ trunk/Factors.php 2011-05-13 10:50:42 UTC (rev 4565) @@ -1,6 +1,6 @@ <?php -//$PageSecurity = 5; +/* $Id$*/ include('includes/session.inc'); @@ -10,7 +10,7 @@ if (isset($_GET['FactorID'])){ $FactorID = strtoupper($_GET['FactorID']); - $_POST['amend']=True; + $_POST['Amend']=True; } elseif (isset($_POST['FactorID'])){ $FactorID = strtoupper($_POST['FactorID']); } else { @@ -19,7 +19,7 @@ if (isset($_POST['Create'])) { $FactorID = 0; - $_POST['New'] = "Yes"; + $_POST['New'] = 'Yes'; }; echo '<div class="centre"><p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' @@ -31,22 +31,25 @@ //initialise no input errors assumed initially before we test $InputError = 0; -if (isset($_POST['submit']) or isset($_POST['update']) or isset($_POST['delete'])) { +if (isset($_POST['Submit']) OR isset($_POST['Update'])) { if (strlen($_POST['FactorName']) > 40 or strlen($_POST['FactorName']) == 0 or $_POST['FactorName'] == '') { $InputError = 1; prnMsg(_('The factoring company name must be entered and be forty characters or less long'),'error'); } - + if (strlen($_POST['Email'])>0 AND !IsEmailAddress($_POST['Email'])){ + prnMsg(_('The email address entered does not appear to be a valid email address format'),'error'); + $InputError = 1; + } // But if errors were found in the input if ($InputError>0) { - prnMsg(_('Validation failed') . _('no updates or deletes took place'),'warn'); + prnMsg(_('Validation failed no insert or update took place'),'warn'); include('includes/footer.inc'); exit; } - + /* If no input errors have been recieved */ - if ($InputError == 0 and isset($_POST['submit'])){ + if ($InputError == 0 and isset($_POST['Submit'])){ //And if its not a new part then update existing one $sql = "INSERT INTO factorcompanies (id, @@ -81,22 +84,7 @@ prnMsg(_('A new factoring company for') . ' ' . $_POST['FactorName'] . ' ' . _('has been added to the database'),'success'); - unset ($FactorID); - unset($_POST['FactorName']); - unset($_POST['Address1']); - unset($_POST['Address2']); - unset($_POST['Address3']); - unset($_POST['Address4']); - unset($_POST['Address5']); - unset($_POST['Address6']); - unset($_POST['ContactName']); - unset($_POST['Telephone']); - unset($_POST['Fax']); - unset($_POST['Email']); - - } - - if ($InputError == 0 and isset($_POST['update'])) { + }elseif ($InputError == 0 and isset($_POST['Update'])) { $sql = "UPDATE factorcompanies SET coyname='" . $_POST['FactorName'] . "', address1='" . $_POST['Address1'] . "', address2='" . $_POST['Address2'] . "', @@ -118,105 +106,50 @@ //If it is a new part then insert it } + unset ($FactorID); + unset($_POST['FactorName']); + unset($_POST['Address1']); + unset($_POST['Address2']); + unset($_POST['Address3']); + unset($_POST['Address4']); + unset($_POST['Address5']); + unset($_POST['Address6']); + unset($_POST['ContactName']); + unset($_POST['Telephone']); + unset($_POST['Fax']); + unset($_POST['Email']); +} +if (isset($_POST['Delete'])) { - /* If neither the Update or Insert buttons were pushed was it the delete button? */ + $CancelDelete = 0; - if (isset($_POST['delete'])) { + // PREVENT DELETES IF DEPENDENT RECORDS IN 'SuppTrans' , PurchOrders, SupplierContacts - $CancelDelete = 0; + $sql= "SELECT COUNT(*) FROM suppliers WHERE factorcompanyid='".$FactorID."'"; + $result = DB_query($sql, $db); + $myrow = DB_fetch_row($result); + if ($myrow[0] > 0) { + $CancelDelete = 1; + prnMsg(_('Cannot delete this factor because there are suppliers using them'),'warn'); + echo '<br />' . _('There are') . ' ' . $myrow[0] . ' ' . _('suppliers using this factor company'); + } - // PREVENT DELETES IF DEPENDENT RECORDS IN 'SuppTrans' , PurchOrders, SupplierContacts - - $sql= "SELECT COUNT(*) FROM suppliers WHERE factorcompanyid='".$FactorID."'"; + if ($CancelDelete == 0) { + $sql="DELETE FROM factorcompanies WHERE id='".$FactorID."'"; $result = DB_query($sql, $db); - $myrow = DB_fetch_row($result); - if ($myrow[0] > 0) { - $CancelDelete = 1; - prnMsg(_('Cannot delete this factor because there are suppliers using them'),'warn'); - echo '<br>' . _('There are') . ' ' . $myrow[0] . ' ' . _('suppliers using this factor company'); - } - - if ($CancelDelete == 0) { - $sql="DELETE FROM factorcompanies WHERE id='".$FactorID."'"; - $result = DB_query($sql, $db); - prnMsg(_('Factoring company record record for') . ' ' . $_POST['FactorName'] . ' ' . _('has been deleted'),'success'); - echo '<br>'; - unset($_SESSION['FactorID']); - } //end if Delete factor - } + prnMsg(_('Factoring company record record for') . ' ' . $_POST['FactorName'] . ' ' . _('has been deleted'),'success'); + echo '<br />'; + unset($_SESSION['FactorID']); + } //end if Delete factor unset($FactorID); } -/* So the page hasn't called itself with the input/update/delete/buttons */ -/* If it didn't come with a $FactorID it must be a completely fresh start, so choose a new $factorID or give the - option to create a new one*/ -if (empty($FactorID)) { +/* So the page hasn't called itself with the input/update/delete/buttons */ - echo "<form method='post' action='" . $_SERVER['PHP_SELF'] . "?" . SID . "'>"; - echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo "<input type='hidden' name='New' VALUE='No'>"; - echo '<table class=selection><tr>'; - echo '<th>' . _('ID') . '</th>'; - echo '<th>' . _('Company Name').'</th>'; - echo '<th>' . _('Address 1').'</th>'; - echo '<th>' . _('Address 2').'</th>'; - echo '<th>' . _('Address 3').'</th>'; - echo '<th>' . _('Address 4').'</th>'; - echo '<th>' . _('Address 5').'</th>'; - echo '<th>' . _('Address 6').'</th>'; - echo '<th>' . _('Contact').'</th>'; - echo '<th>' . _('Telephone').'</th>'; - echo '<th>' . _('Fax Number').'</th>'; - echo '<th>' . _('Email').'</th></tr>'; - $sql = "SELECT id, - coyname, - address1, - address2, - address3, - address4, - address5, - address6, - contact, - telephone, - fax, - email - FROM factorcompanies"; - $result=DB_query($sql, $db); - $j=1; - while ($myrow = DB_fetch_array($result)) { - if ($j==1) { - echo '<tr class="OddTableRows">'; - $j=0; - } else { - echo '<tr class="EvenTableRows">'; - $j++; - } - echo '<td>' . $myrow['id'] . '</td>'; - echo '<td>' . $myrow['coyname'].'</td>'; - echo '<td>' . $myrow['address1'].'</td>'; - echo '<td>' . $myrow['address2'].'</td>'; - echo '<td>' . $myrow['address3'].'</td>'; - echo '<td>' . $myrow['address4'].'</td>'; - echo '<td>' . $myrow['address5'].'</td>'; - echo '<td>' . $myrow['address6'].'</td>'; - echo '<td>' . $myrow['contact'].'</td>'; - echo '<td>' . $myrow['telephone'].'</td>'; - echo '<td>' . $myrow['fax'].'</td>'; - echo '<td>' . $myrow['email'].'</td>'; - echo '<td><a href="'.$rootpath . '/Factors.php?' . SID . '&FactorID='.$myrow['id'].'">'._('Edit').'</a></td></tr>'; - } - echo "</table><p><div class='centre'>"; - echo "<br><input tabindex=3 type='Submit' name='Create' value='" . _('Create New Factor') . "'>"; - echo '</div></form>'; - include('includes/footer.inc'); - exit; +if (isset($FactorID) and isset($_POST['Amend'])) { -} - -if (isset($FactorID) and isset($_POST['amend'])) { - $sql = "SELECT id, coyname, address1, @@ -261,37 +194,119 @@ $_POST['Email'] = ''; } -if (isset($_POST['amend']) or isset($_POST['Create'])) { +if (isset($_POST['Amend']) or isset($_POST['Create'])) { // its a new factor being added - 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'] . '" />'; - echo "<input type=hidden name='FactorID' value='".$FactorID."'>"; + echo '<input type="hidden" name="FactorID" value="' . $FactorID .'">'; echo '<table class=selection>'; - echo "<input type=hidden name='New' value='Yes'>"; - echo '<tr><td>' . _('Factor company Name') . ":</td><td><input tabindex=1 type='text' name='FactorName' size=42 maxlength=40 value='".$_POST['FactorName']."'></td></tr>"; - echo '<tr><td>' . _('Address Line 1') . ":</td><td><input tabindex=2 type='text' name='Address1' size=42 maxlength=40 value='".$_POST['Address1']."'></td></tr>"; - echo '<tr><td>' . _('Address Line 2') . ":</td><td><input tabindex=3 type='text' name='Address2' size=42 maxlength=40 value='".$_POST['Address2']."'></td></tr>"; - echo '<tr><td>' . _('Address Line 3') . ":</td><td><input tabindex=4 type='text' name='Address3' size=42 maxlength=40 value='".$_POST['Address3']."'></td></tr>"; - echo '<tr><td>' . _('Address Line 4') . ":</td><td><input tabindex=5 type='text' name='Address4' size=42 maxlength=40 value='".$_POST['Address4']."'></td></tr>"; - echo '<tr><td>' . _('Address Line 5') . ":</td><td><input tabindex=6 type='text' name='Address5' size=42 maxlength=40 value='".$_POST['Address5']."'></td></tr>"; - echo '<tr><td>' . _('Address Line 6') . ":</td><td><input tabindex=7 type='text' name='Address6' size=42 maxlength=40 value='".$_POST['Address6']."'></td></tr>"; - echo '<tr><td>' . _('Contact Name') . ":</td><td><input tabindex=8 type='text' name='ContactName' size=13 maxlength=25 value='".$_POST['ContactName']."'></td></tr>"; - echo '<tr><td>' . _('Telephone') . ":</td><td><input tabindex=9 type='text' name='Telephone' size=13 maxlength=25 value='".$_POST['Telephone']."'></td></tr>"; - echo '<tr><td>' . _('Fax') . ":</td><td><input tabindex=10 type='text' name='Fax' VALUE=0 size=13 maxlength=25 value='".$_POST['Fax']."'></td></tr>"; - echo '<tr><td>' . _('Email') . ":</td><td><input tabindex=11 type='text' name='Email' size=55 maxlength=55 value='".$_POST['Email']."'></td></tr>"; + echo '<input type="hidden" name="New" value="Yes">'; + echo '<tr><td>' . _('Factor company Name') . ':</td> + <td><input tabindex=1 type="text" name="FactorName" size=42 maxlength=40 value="' .$_POST['FactorName'].'"></td></tr>'; + echo '<tr><td>' . _('Address Line 1') . ':</td> + <td><input tabindex=2 type="text" name="Address1" size=42 maxlength=40 value="' . $_POST['Address1'] .'"></td></tr>'; + echo '<tr><td>' . _('Address Line 2') . ':</td> + <td><input tabindex=3 type="text" name="Address2" size=42 maxlength=40 value="' . $_POST['Address2'] .'"></td></tr>'; + + echo '<tr><td>' . _('Address Line 3') . ':</td> + <td><input tabindex=4 type="text" name="Address3" size=42 maxlength=40 value="' .$_POST['Address3'] .'"></td></tr>'; + echo '<tr><td>' . _('Address Line 4') . ':</td> + <td><input tabindex=5 type="text" name="Address4" size=42 maxlength=40 value="' . $_POST['Address4'].'"></td></tr>'; + echo '<tr><td>' . _('Address Line 5') . ':</td> + <td><input tabindex=6 type="text" name="Address5" size=42 maxlength=40 value="' . $_POST['Address5'] .'"></td></tr>'; + echo '<tr><td>' . _('Address Line 6') . ':</td> + <td><input tabindex=7 type="text" name="Address6" size=42 maxlength=40 value="' .$_POST['Address6'] . '"></td></tr>'; + echo '<tr><td>' . _('Contact Name') . ':</td> + <td><input tabindex=8 type="text" name="ContactName" size=13 maxlength=25 value="' . $_POST['ContactName'] .'"></td></tr>'; + echo '<tr><td>' . _('Telephone') . ':</td> + <td><input tabindex=9 type="text" name="Telephone" size=13 maxlength=25 value="' .$_POST['Telephone'].'"></td></tr>'; + echo '<tr><td>' . _('Fax') . ':</td> + <td><input tabindex=10 type="text" name="Fax" value=0 size=13 maxlength=25 value="' . $_POST['Fax'] .'"></td></tr>'; + echo '<tr><td>' . _('Email') . ':</td> + <td><input tabindex=11 type="text" name="Email" size=55 maxlength=55 value="' . $_POST['Email'] . '"></td></tr>'; echo '</form>'; } if (isset($_POST['Create'])) { - echo "</table><p><div class='centre'><input tabindex=12 type='Submit' name='submit' VALUE='" . _('Insert New Factor') . "'></div>"; -} else if (isset($_POST['amend'])) { - echo "</table><p><div class='centre'><input tabindex=13 type='Submit' name='update' VALUE='" . _('Update Factor') . "'><p>"; + echo '</table><p><div class="centre"><input tabindex=12 type="submit" name="Submit" value="' . _('Insert New Factor') . '"></div>'; +} else if (isset($_POST['Amend'])) { + echo '</table> + <p><div class="centre"><input tabindex=13 type="submit" name="Update" value="' . _('Update Factor') . '"><p>'; prnMsg ( _('There is no second warning if you hit the delete button below') . '. ' . _('However checks will be made to ensure there are no suppliers are using this factor before the deletion is processed'), 'warn'); - echo "<p><input tabindex=14 type='Submit' name='delete' VALUE='" . _('Delete Factor') . "' onclick=\"return confirm('" . _('Are you sure you wish to delete this factoring company?') . "');\"></form></div>"; + echo '<p><input tabindex=14 type="submit" name="Delete" value="' . _('Delete Factor') . '" onclick="return confirm(\'' . _('Are you sure you wish to delete this factoring company?') . '\');"></form></div>'; } +/* If it didn't come with a $FactorID it must be a completely fresh start, so choose a new $factorID or give the + option to create a new one*/ + +if (empty($FactorID) AND !isset($_POST['Create']) AND !isset($_POST['Amend'])) { + + echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; + echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; + + echo '<input type="hidden" name="New" value="No">'; + echo '<table class=selection><tr> + <th>' . _('ID') . '</th> + <th>' . _('Company Name').'</th> + <th>' . _('Address 1').'</th> + <th>' . _('Address 2').'</th> + <th>' . _('Address 3').'</th> + <th>' . _('Address 4').'</th> + <th>' . _('Address 5').'</th> + <th>' . _('Address 6').'</th> + <th>' . _('Contact').'</th> + <th>' . _('Telephone').'</th> + <th>' . _('Fax Number').'</th> + <th>' . _('Email').'</th></tr>'; + $sql = "SELECT id, + coyname, + address1, + address2, + address3, + address4, + address5, + address6, + contact, + telephone, + fax, + email + FROM factorcompanies"; + $result=DB_query($sql, $db); + $j=1; + while ($myrow = DB_fetch_array($result)) { + if ($j==1) { + echo '<tr class="OddTableRows">'; + $j=0; + } else { + echo '<tr class="EvenTableRows">'; + $j++; + } + echo '<td>' . $myrow['id'] . '</td> + <td>' . $myrow['coyname'].'</td> + <td>' . $myrow['address1'].'</td> + <td>' . $myrow['address2'].'</td> + <td>' . $myrow['address3'].'</td> + <td>' . $myrow['address4'].'</td> + <td>' . $myrow['address5'].'</td> + <td>' . $myrow['address6'].'</td> + <td>' . $myrow['contact'].'</td> + <td>' . $myrow['telephone'].'</td> + <td>' . $myrow['fax'].'</td> + <td>' . $myrow['email'].'</td> + <td><a href="'.$rootpath . '/Factors.php?FactorID='.$myrow['id'].'">'._('Edit').'</a></td> + </tr>'; + } + echo '</table><p><div class="centre">'; + echo '<br /><input tabindex=3 type="submit" name="Create" value="' . _('Create New Factor') . '">'; + echo '</div></form>'; + include('includes/footer.inc'); + exit; + +} + + include('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/GLJournal.php =================================================================== --- trunk/GLJournal.php 2011-05-11 10:03:40 UTC (rev 4564) +++ trunk/GLJournal.php 2011-05-13 10:50:42 UTC (rev 4565) @@ -235,9 +235,8 @@ } echo '<table><tr> - <td colspan="5"><table class="selection"><tr><td>'._('Date to Process Journal').":</td> - <td><input type='text' class='date' alt='".$_SESSION['DefaultDateFormat']."' name='JournalProcessDate' maxlength='10' size='11' value='" . - $_SESSION['JournalDetail']->JnlDate . "' /></td>"; + <td colspan="5"><table class="selection"><tr><td>'._('Date to Process Journal') . ':</td> + <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="JournalProcessDate" maxlength="10" size="11" value="' . $_SESSION['JournalDetail']->JnlDate . '" /></td>'; echo '<td>' . _('Type') . ':</td> <td><select name="JournalType">'; @@ -261,9 +260,9 @@ echo '<tr><th colspan="3"><div class="centre"><font size="3" color="blue"><b>' . _('Journal Line Entry') . '</b></font></div></th></tr>'; /*now set up a GLCode field to select from avaialble GL accounts */ -echo '<tr><th>' . _('GL Tag') . '</th>'; -echo '<th>' . _('GL Account Code') . '</th>'; -echo '<th>' . _('Select GL Account') . '</th></tr>'; +echo '<tr><th>' . _('GL Tag') . '</th> + <th>' . _('GL Account Code') . '</th> + <th>' . _('Select GL Account') . '</th></tr>'; /* Set upthe form for the transaction entry for a GL Payment Analysis item */ @@ -321,19 +320,17 @@ $_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" ' . - 'onChange="eitherOr(this, '.'Debit'.')"'. - ' Maxlength="12" size="10" value="' . $_POST['Credit'] . '" /></td>'; +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" 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 '<td><input type="text" name="GLNarrative" maxlength="100" size="100" value="' . $_POST['GLNarrative'] . '" /></td>'; echo '</tr></table><br />'; /*Close the main table */ -echo '<div class="centre"><input type="submi2t" name="Process" value="' . _('Accept') . '" /></div><br /><br />'; +echo '<div class="centre"><input type="submit" name="Process" value="' . _('Accept') . '" /></div><br /><br />'; echo '<table class="selection" width="85%">'; @@ -369,8 +366,8 @@ } else { $TagDescription=$myrow[0]; } - echo '<td>' . $JournalItem->tag . ' - ' . $TagDescription . '</td>'; - echo '<td>' . $JournalItem->GLCode . ' - ' . $JournalItem->GLActName . '</td>'; + echo '<td>' . $JournalItem->tag . ' - ' . $TagDescription . '</td> + <td>' . $JournalItem->GLCode . ' - ' . $JournalItem->GLActName . '</td>'; if ($JournalItem->Amount>0) { echo '<td class="number">' . number_format($JournalItem->Amount,$_SESSION['CompanyRecord']['decimalplaces']) . '</td><td></td>'; $DebitTotal=$DebitTotal+$JournalItem->Amount; @@ -402,7 +399,7 @@ echo '</table>'; if (ABS($_SESSION['JournalDetail']->JournalTotal)<0.001 AND $_SESSION['JournalDetail']->GLItemCounter > 0){ - echo "<br /><br /><div class='centre'><input type='submit' name='CommitBatch' value='"._('Accept and Process Journal')."' /></div>"; + echo '<br /><br /><div class="centre"><input type="submit" name="CommitBatch" value="' ._('Accept and Process Journal').'" /></div>'; } elseif(count($_SESSION['JournalDetail']->GLEntries)>0) { echo '<br /><br />'; prnMsg(_('The journal must balance ie debits equal to credits before it can be processed'),'warn'); Modified: trunk/GLTags.php =================================================================== --- trunk/GLTags.php 2011-05-11 10:03:40 UTC (rev 4564) +++ trunk/GLTags.php 2011-05-13 10:50:42 UTC (rev 4565) @@ -80,7 +80,7 @@ echo '<tr><td>' . $myrow['tagref'].'</td> <td>' . $myrow['tagdescription'].'</td> <td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedTag=' . $myrow['tagref'] . '&Action=edit">' . _('Edit') . '</a></td> - <td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedTag=' . $myrow['tagref'] . '&Action=delete">' . _('Delete') . '</a></td> + <td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedTag=' . $myrow['tagref'] . '&Action=delete" onclick="return confirm(\'' . _('Are you sure you wish to delete this GL tag?') . '\');">' . _('Delete') . '</a></td> </tr>'; } Modified: trunk/GoodsReceived.php =================================================================== --- trunk/GoodsReceived.php 2011-05-11 10:03:40 UTC (rev 4564) +++ trunk/GoodsReceived.php 2011-05-13 10:50:42 UTC (rev 4565) @@ -79,10 +79,10 @@ echo '<table cellpadding=2 class=selection> <tr><th colspan="2"></th> - <th align="centre" colspan="3"><b>' . _('Supplier Units') . '</b></th> - <th></th> - <th align="centre" colspan="5"><b>' . _('Our Receiving Units') . '</b></th> - </tr> + <th align="centre" colspan="3"><b>' . _('Supplier Units') . '</b></th> + <th></th> + <th align="centre" colspan="5"><b>' . _('Our Receiving Units') . '</b></th> + </tr> <tr><th>' . _('Item Code') . '</th> <th>' . _('Description') . '</th> <th>' . _('Quantity') . '<br />' . _('Ordered') . '</th> Modified: trunk/MRPDemands.php =================================================================== --- trunk/MRPDemands.php 2011-05-11 10:03:40 UTC (rev 4564) +++ trunk/MRPDemands.php 2011-05-13 10:50:42 UTC (rev 4565) @@ -1,6 +1,7 @@ <?php -/* $Revision: 1.5 $ */ + /* $Id$*/ + // Add, Edit, Delete, and List MRP demand records. Table is mrpdemands. // Have separate functions for each routine. Use pass-by-reference - (&$db,&$StockID) - // to pass values of $db and $StockID to functions. - when just used $db as variable, Modified: trunk/OffersReceived.php =================================================================== --- trunk/OffersReceived.php 2011-05-11 10:03:40 UTC (rev 4564) +++ trunk/OffersReceived.php 2011-05-13 10:50:42 UTC (rev 4565) @@ -87,19 +87,20 @@ echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . _('Supplier Offers') . '" alt="" />' . ' ' . _('Supplier Offers') . '</p>'; - echo '<table class=selection>'; - echo '<tr><th>'._('Offer ID').'</th>'; - echo '<th>'._('Supplier').'</th>'; - echo '<th>'._('Stock Item').'</th>'; - echo '<th>'._('Quantity').'</th>'; - echo '<th>'._('Units').'</th>'; - echo '<th>'._('Price').'</th>'; - echo '<th>'._('Total').'</th>'; - echo '<th>'._('Currency').'</th>'; - echo '<th>'._('Offer Expires').'</th>'; - echo '<th>'._('Accept').'</th>'; - echo '<th>'._('Reject').'</th>'; - echo '<th>'._('Defer').'</th></tr>'; + echo '<table class=selection> + <tr> + <th>'._('Offer ID').'</th> + <th>'._('Supplier').'</th> + <th>'._('Stock Item').'</th> + <th>'._('Quantity').'</th> + <th>'._('Units').'</th> + <th>'._('Price').'</th> + <th>'._('Total').'</th> + <th>'._('Currency').'</th> + <th>'._('Offer Expires').'</th> + <th>'._('Accept').'</th> + <th>'._('Reject').'</th> + <th>'._('Defer').'</th></tr>'; $k=0; while ($myrow=DB_fetch_array($result)) { @@ -110,22 +111,22 @@ echo '<tr class="OddTableRows">'; $k++; } - echo '<td>'.$myrow['offerid'].'</td>'; - echo '<td>'.$myrow['suppname'].'</td>'; - echo '<td>'.$myrow['description'].'</td>'; - echo '<td class=number>'.number_format($myrow['quantity'],$myrow['decimalplaces']).'</td>'; - echo '<td>'.$myrow['uom'].'</td>'; - echo '<td class=number>'.number_format($myrow['price'],2).'</td>'; - echo '<td class=number>'.number_format($myrow['price']*$myrow['quantity'],2).'</td>'; - echo '<td>'.$myrow['currcode'].'</td>'; - echo '<td>'.$myrow['expirydate'].'</td>'; - echo '<td><input type="radio" name="action'.$myrow['offerid'].'" value="1"></td>'; - echo '<td><input type="radio" name="action'.$myrow['offerid'].'" value="2"></td>'; - echo '<td><input type="radio" checked name="action'.$myrow['offerid'].'" value="3"></td>'; - echo '<td><input type="hidden" name="supplierid" value="'.$myrow['supplierid'].'"></td>'; - echo '</tr>'; + echo '<td>'.$myrow['offerid'].'</td> + <td>'.$myrow['suppname'].'</td> + <td>'.$myrow['description'].'</td> + <td class=number>'.number_format($myrow['quantity'],$myrow['decimalplaces']).'</td> + <td>'.$myrow['uom'].'</td> + <td class=number>'.number_format($myrow['price'],2).'</td> + <td class=number>'.number_format($myrow['price']*$myrow['quantity'],2).'</td> + <td>'.$myrow['currcode'].'</td> + <td>'.$myrow['expirydate'].'</td> + <td><input type="radio" name="action'.$myrow['offerid'].'" value="1"></td> + <td><input type="radio" name="action'.$myrow['offerid'].'" value="2"></td> + <td><input type="radio" checked name="action'.$myrow['offerid'].'" value="3"></td> + <td><input type="hidden" name="supplierid" value="'.$myrow['supplierid'].'"></td> + </tr>'; } - echo '<tr><td colspan=12><div class="centre"><input type=Submit name=submit value=' . _('Enter Information') . '></div></td></tr>'; + echo '<tr><td colspan=12><div class="centre"><input type="submit" name="submit" value=' . _('Enter Information') . '></div></td></tr>'; echo '</form></table>'; } else if(isset($_POST['submit']) and isset($_POST['supplierid'])) { include ('includes/htmlMimeMail.php'); @@ -203,7 +204,6 @@ unitprice, actprice, quantityord, - itemno, suppliersunit) VALUES ( '".$OrderNo."', @@ -213,7 +213,6 @@ '".$myrow['price']."', '".$myrow['price']."', '".$myrow['quantity']."', - '".$myrow['stockid']."', '".$myrow['uom']."')"; $result=DB_query($sql, $db); $sql="DELETE FROM offers WHERE offerid='".$AcceptID."'"; @@ -226,7 +225,7 @@ $result = $mail->send(array($Email), 'smtp'); prnMsg(_('The accepted offers from').' '.$SupplierName.' '._('have been converted to purchase orders and an email sent to') .' '.$Email."\n"._('Please review the order contents').' '.'<a href="'.$rootpath . - "/PO_Header.php?ModifyOrderNumber=" . $OrderNo.'">'._('here').'</a>"', 'success'); + '/PO_Header.php?ModifyOrderNumber=' . $OrderNo.'">'._('here').'</a>', 'success'); } if (sizeOf($rejects)>0){ $MailText=_('This email has been automatically generated by the webERP installation at').' '. @@ -259,4 +258,4 @@ } include('includes/footer.inc'); -?> +?> \ No newline at end of file Modified: trunk/PO_AuthorisationLevels.php =================================================================== --- trunk/PO_AuthorisationLevels.php 2011-05-11 10:03:40 UTC (rev 4564) +++ trunk/PO_AuthorisationLevels.php 2011-05-13 10:50:42 UTC (rev 4565) @@ -67,8 +67,8 @@ cancreate='".$CanCreate."', offhold='".$OffHold."', authlevel='".$_POST['AuthLevel']."' - WHERE userid='".$_POST['UserID']."' - AND currabrev='".$_POST['CurrCode']."'"; + WHERE userid='".$_POST['UserID']."' + AND currabrev='".$_POST['CurrCode']."'"; $ErrMsg = _('The authentication details cannot be updated because'); $Result=DB_query($sql,$db,$ErrMsg); @@ -88,8 +88,8 @@ offhold, authlevel FROM purchorderauth - WHERE userid='".$_GET['UserID']."' - AND currabrev='".$_GET['Currency']."'"; + WHERE userid='".$_GET['UserID']."' + AND currabrev='".$_GET['Currency']."'"; $ErrMsg = _('The authentication details cannot be retrieved because'); $result=DB_query($sql,$db,$ErrMsg); $myrow=DB_fetch_array($result); @@ -100,7 +100,7 @@ $AuthLevel=$myrow['authlevel']; } -$sql='SELECT purchorderauth.userid, +$sql="SELECT purchorderauth.userid, www_users.realname, currencies.currabrev, currencies.currency, @@ -110,7 +110,7 @@ FROM purchorderauth INNER JOIN www_users ON purchorderauth.userid=www_users.userid INNER JOIN currencies - ON purchorderauth.currabrev=currencies.currabrev'; + ON purchorderauth.currabrev=currencies.currabrev"; $ErrMsg = _('The authentication details cannot be retrieved because'); $Result=DB_query($sql,$db,$ErrMsg); @@ -134,17 +134,18 @@ } else { $OffHold=_('No'); } - echo '<tr><td>' . $myrow['userid'] . '</td> - <td>' . $myrow['realname'] . '</td> - <td>' . $myrow['currency'] . '</td> - <td>' . $CanCreate . '</td> - <td>' . $OffHold . '</td> - <td class="number">'.number_format($myrow['authlevel'],2).'</td> - <td><a href="'.$rootpath.'/PO_AuthorisationLevels.php?Edit=Yes&UserID=' . $myrow['userid'] . -'&Currency='.$myrow['currabrev'].'">'._('Edit').'</td> - <td><a href="'.$rootpath.'/PO_AuthorisationLevels.php?Delete=Yes&UserID=' . $myrow['userid'] . -'&Currency='.$myrow['currabrev'].'">'._('Delete').'</td> - </tr>'; + echo '<tr> + <td>' . $myrow['userid'] . '</td> + <td>' . $myrow['realname'] . '</td> + <td>' . $myrow['currency'] . '</td> + <td>' . $CanCreate . '</td> + <td>' . $OffHold . '</td> + <td class="number">'.number_format($myrow['authlevel'],2).'</td> + <td><a href="'.$rootpath.'/PO_AuthorisationLevels.php?Edit=Yes&UserID=' . $myrow['userid'] . + '&Currency='.$myrow['currabrev'].'">'._('Edit').'</td> + <td><a href="'.$rootpath.'/PO_AuthorisationLevels.php?Delete=Yes&UserID=' . $myrow['userid'] . + '&Currency='.$myrow['currabrev'].'" onclick="return confirm(\'' . _('Are you sure you wish to delete this authorisation level?') . '\');">'._('Delete').'</td> + </tr>'; } echo '</table><br><br>'; @@ -158,7 +159,7 @@ echo '<input type=hidden name=UserID value="'.$UserID.'"'; } else { echo '<tr><td>'._('User ID').'</td><td><select name=UserID>'; - $usersql='SELECT userid FROM www_users'; + $usersql="SELECT userid FROM www_users"; $userresult=DB_query($usersql,$db); while ($myrow=DB_fetch_array($userresult)) { if ($myrow['userid']==$UserID) { @@ -174,12 +175,14 @@ $CurrencySQL="SELECT currency FROM currencies WHERE currabrev='".$Currency."'"; $CurrencyResult=DB_query($CurrencySQL,$db); $myrow=DB_fetch_array($CurrencyResult); - echo '<tr><td>'._('Currency').'</td> - <td>' . $myrow['currency'] . '</td></tr>'; + echo '<tr> + <td>'._('Currency').'</td> + <td>' . $myrow['currency'] . '</td> + </tr>'; echo '<input type=hidden name="currabrev" value="'.$Currency.'"'; } else { echo '<tr><td>'._('Currency').'</td><td><select name="CurrCode">'; - $currencysql='SELECT currabrev,currency FROM currencies'; + $currencysql="SELECT currabrev,currency FROM currencies"; $currencyresult=DB_query($currencysql,$db); while ($myrow=DB_fetch_array($currencyresult)) { if ($myrow['currabrev']==$Currency) { Modified: trunk/PO_AuthoriseMyOrders.php =================================================================== --- trunk/PO_AuthoriseMyOrders.php 2011-05-11 10:03:40 UTC (rev 4564) +++ trunk/PO_AuthoriseMyOrders.php 2011-05-13 10:50:42 UTC (rev 4565) @@ -1,7 +1,7 @@ <?php /* $Id$*/ -//$PageSecurity = 4; + include('includes/session.inc'); $title = _('Authorise Purchase Orders'); @@ -11,22 +11,22 @@ echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/transactions.png" title="' . $title . '" alt="" />' . ' ' . $title . '</p>'; -$emailsql="SELECT email FROM www_users WHERE userid='".$_SESSION['UserID']."'"; -$emailresult=DB_query($emailsql, $db); -$emailrow=DB_fetch_array($emailresult); +$EmailSQL="SELECT email FROM www_users WHERE userid='".$_SESSION['UserID']."'"; +$EmailResult=DB_query($EmailSQL, $db); +$EmailRow=DB_fetch_array($EmailResult); -if (isset($_POST['updateall'])) { +if (isset($_POST['UpdateAll'])) { foreach ($_POST as $key => $value) { if (substr($key,0,6)=='status') { - $orderno=substr($key,6); - $status=$_POST['status'.$orderno]; - $comment=date($_SESSION['DefaultDateFormat']).' - '._('Authorised by').' '.'<a href="mailto:'. - $emailrow['email'].'">'.$_SESSION['UserID'].'</a><br>'.$_POST['comment']; + $OrderNo=substr($key,6); + $Status=$_POST['status'.$OrderNo]; + $Comment=date($_SESSION['DefaultDateFormat']).' - '._('Authorised by').' '.'<a href="mailto:' . $EmailRow['email'].'">'.$_SESSION['UserID'].'</a> + <br />' . $_POST['comment']; $sql="UPDATE purchorders - SET status='".$status."', - stat_comment='".$comment."', - allowprint=1 - WHERE orderno='".$orderno."'"; + SET status='".$Status."', + stat_comment='".$Comment."', + allowprint=1 + WHERE orderno='".$OrderNo."'"; $result=DB_query($sql, $db); } } @@ -38,91 +38,98 @@ suppliers.suppname, suppliers.currcode, www_users.realname, - www_users.email - FROM purchorders - LEFT JOIN suppliers + www_users.email, + currencies.decimalplaces + FROM purchorders INNER JOIN suppliers ON suppliers.supplierid=purchorders.supplierno - LEFT JOIN www_users + INNER JOIN currencies + ON suppliers.currcode=currencies.currabrev + INNER JOIN www_users ON www_users.userid=purchorders.initiator WHERE status='Pending'"; $result=DB_query($sql, $db); echo '<form method=post action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; -echo '<table class=selection><tr>'; +echo '<table class="selection">'; /* Create the table for the purchase order header */ -echo '<th>'._('Order Number').'</th>'; -echo '<th>'._('Supplier').'</th>'; -echo '<th>'._('Date Ordered').'</th>'; -echo '<th>'._('Initiator').'</th>'; -echo '<th>'._('Delivery Date').'</th>'; -echo '<th>'._('Status').'</th>'; -echo '</tr>'; +echo '<tr> + <th>'._('Order Number').'</th> + <th>'._('Supplier').'</th> + <th>'._('Date Ordered').'</th> + <th>'._('Initiator').'</th> + <th>'._('Delivery Date').'</th> + <th>'._('Status').'</th> + </tr>'; while ($myrow=DB_fetch_array($result)) { - $authsql="SELECT authlevel FROM purchorderauth + $AuthSQL="SELECT authlevel FROM purchorderauth WHERE userid='".$_SESSION['UserID']."' AND currabrev='".$myrow['currcode']."'"; - $authresult=DB_query($authsql, $db); - $myauthrow=DB_fetch_array($authresult); - $authlevel=$myauthrow['authlevel']; + $AuthResult=DB_query($AuthSQL, $db); + $myauthrow=DB_fetch_array($AuthResult); + $AuthLevel=$myauthrow['authlevel']; - $ordervaluesql="SELECT sum(unitprice*quantityord) as ordervalue + $OrderValueSQL="SELECT sum(unitprice*quantityord) as ordervalue FROM purchorderdetails WHERE orderno='".$myrow['orderno'] . "'"; - $ordervalueresult=DB_query($ordervaluesql, $db); - $myordervaluerow=DB_fetch_array($ordervalueresult); - $ordervalue=$myordervaluerow['ordervalue']; + $OrderValueResult=DB_query($OrderValueSQL, $db); + $MyOrderValueRow=DB_fetch_array($OrderValueResult); + $OrderValue=$MyOrderValueRow['ordervalue']; - if ($authlevel>=$ordervalue) { - echo '<tr>'; - echo '<td>'.$myrow['orderno'].'</td>'; - echo '<td>'.$myrow['suppname'].'</td>'; - echo '<td>'.ConvertSQLDate($myrow['orddate']).'</td>'; - echo '<td><a href="mailto:'.$myrow['email'].'">'.$myrow['realname'].'</td>'; - echo '<td>'.ConvertSQLDate($myrow['deliverydate']).'</td>'; - echo '<td><select name=status'.$myrow['orderno'].'>'; - echo '<option selected value="Pending">'._('Pending').'</option>'; - echo '<option value="Authorised">'._('Authorised').'</option>'; - echo '<option value="Rejected">'._('Rejected').'</option>'; - echo '<option value="Cancelled">'._('Cancelled').'</option>'; - echo '</select></td>'; - echo '</tr>'; + if ($AuthLevel>=$OrderValue) { + echo '<tr> + <td>'.$myrow['orderno'].'</td> + <td>'.$myrow['suppname'].'</td> + <td>'.ConvertSQLDate($myrow['orddate']).'</td> + <td><a href="mailto:'.$myrow['email'].'">'.$myrow['realname'].'</td> + <td>'.ConvertSQLDate($myrow['deliverydate']).'</td> + <td><select name=status'.$myrow['orderno'].'> + <option selected value="Pending">'._('Pending').'</option> + <option value="Authorised">'._('Authorised').'</option> + <option value="Rejected">'._('Rejected').'</option> + <option value="Cancelled">'._('Cancelled').'</option> + </select></td> + </tr>'; echo "<input type='hidden' name='comment' value='".$myrow['stat_comment']."'>"; - $linesql="SELECT purchorderdetails.*, + $LineSQL="SELECT purchorderdetails.*, stockmaster.description FROM purchorderdetails LEFT JOIN stockmaster ON stockmaster.stockid=purchorderdetails.itemcode WHERE orderno='".$myrow['orderno'] . "'"; - $lineresult=DB_query($linesql, $db); + $LineResult=DB_query($LineSQL, $db); - echo '<tr><td></td><td colspan=5 align=left><table class=selection align=left>'; - echo '<th>'._('Product').'</th>'; - echo '<th>'._('Quantity Ordered').'</th>'; - echo '<th>'._('Currency').'</th>'; - echo '<th>'._('Price').'</th>'; - echo '<th>'._('Line Total').'</th>'; - echo '</tr>'; + echo '<tr> + <td></td> + <td colspan="5" align="left"> + <table class="selection" align="left"> + <tr> + <th>'._('Product').'</th> + <th>'._('Quantity Ordered').'</th> + <th>'._('Currency').'</th> + <th>'._('Price').'</th> + <th>'._('Line Total').'</th> + </tr>'; - while ($linerow=DB_fetch_array($lineresult)) { - echo '<tr>'; - echo '<td>'.$linerow['description'].'</td>'; - echo '<td class="number">'.number_format($linerow['quantityord'],2).'</td>'; - echo '<td>'.$myrow['currcode'].'</td>'; - echo '<td class="number">'.number_format($linerow['unitprice'],2).'</td>'; - echo '<td class="number">'.number_format($linerow['unitprice']*$linerow['quantityord'],2).'</td>'; - echo '</tr>'; + while ($linerow=DB_fetch_array($LineResult)) { + echo '<tr> + <td>'.$linerow['description'].'</td> + <td class="number">'.number_format($linerow['quantityord'],2).'</td> + <td>'.$myrow['currcode'].'</td> + <td class="number">'.number_format($linerow['unitprice'],$myrow['decimalplaces']).'</td> + <td class="number">'.number_format($linerow['unitprice']*$linerow['quantityord'],$myrow['decimalplaces']).'</td> + </tr>'; } // end while order line detail echo '</table></td></tr>'; } } //end while header loop echo '</table>'; -echo '<br><div class="centre"><input type="submit" name="updateall" value="' . _('Update'). '"></form>'; +echo '<br><div class="centre"><input type="submit" name="UpdateAll" value="' . _('Update'). '"></form>'; include('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/PO_SelectPurchOrder.php =================================================================== --- trunk/PO_SelectPurchOrder.php 2011-05-11 10:03:40 UTC (rev 4564) +++ trunk/PO_SelectPurchOrder.php 2011-05-13 10:50:42 UTC (rev 4565) @@ -1,6 +1,6 @@ <?php /* $Id$*/ -//$PageSecurity = 2; + include ('includes/session.inc'); $title = _('Search Purchase Orders'); include ('includes/header.inc'); @@ -110,14 +110,14 @@ while ($myrow = DB_fetch_array($resultStkLocs)) { if (isset($_POST['StockLocation'])) { if ($myrow['loccode'] == $_POST['StockLocation']) { - echo '<option selected Value="' . $myrow['loccode'] . '">' . $myrow['locationname']; + echo '<option selected Value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } else { - echo '<option Value="' . $myrow['loccode'] . '">' . $myrow['locationname']; + echo '<option Value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } } elseif ($myrow['loccode'] == $_SESSION['UserStockLocation']) { - echo '<option selected Value="' . $myrow['loccode'] . '">' . $myrow['locationname']; + echo '<option selected Value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } else { - echo '<option Value="' . $myrow['loccode'] . '">' . $myrow['locationname']; + echo '<option Value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } } echo '</select> ' . _('Order Status:') .' <select name="Status">'; @@ -160,9 +160,9 @@ echo '<tr><td><font size=1>' . _('Select a stock category') . ':</font><select name="StockCat">'; while ($myrow1 = DB_fetch_array($result1)) { if (isset($_POST['StockCat']) and $myrow1['categoryid'] == $_POST['StockCat']) { - echo "<option selected value='" . $myrow1['categoryid'] . "'>" . $myrow1['categorydescription']; + echo '<option selected value="' . $myrow1['categoryid'] . '">' . $myrow1['categorydescription'] . '</option>'; } else { - echo "<option value='" . $myrow1['categoryid'] . "'>" . $myrow1['categorydescription']; + echo '<option value="' . $myrow1['categoryid'] . '">' . $myrow1['categorydescription'] . '</option>'; } } echo '</select><td><font size=1>' . _('Enter text extracts in the') . ' <b>' . _('description') . '</b>:</font></td>'; @@ -191,12 +191,12 @@ echo '<tr bgcolor="#EEEEEE">'; $k = 1; } - echo "<td><input type=submit name='SelectedStockItem' value='" . $myrow['stockid'] . "'</td> - <td>" . $myrow['description'] . "</td> - <td class=number>" . $myrow['qoh'] . "</td> - <td class=number>" . $myrow['qord'] . "</td> - <td>" . $myrow['units'] . "</td> - </tr>"; + echo '<td><input type="submit" name="SelectedStockItem" value="' . $myrow['stockid'] . '"</td> + <td>' . $myrow['description'] . '</td> + <td class=number>' . $myrow['qoh'] . '</td> + <td class=number>' . $myrow['qord'] . '</td> + <td>' . $myrow['units'] . '</td> + </tr>'; $j++; if ($j == 12) { $j = 1; @@ -234,14 +234,25 @@ purchorders.allowprint, purchorders.status, suppliers.currcode, + currencies.decimalplaces, SUM(purchorderdetails.unitprice*purchorderdetails.quantityord) AS ordervalue - FROM purchorders, - purchorderdetails, - suppliers - WHERE purchorders.orderno = purchorderdetails.orderno - AND purchorders.supplierno = suppliers.supplierid - AND purchorders.orderno='" . $OrderNumber . "' - GROUP BY purchorders.orderno"; + FROM purchorders + INNER JOIN purchorderdetails + ON purchorders.orderno = purchorderdetails.orderno + INNER JOIN suppliers + ON purchorders.supplierno = suppliers.supplierid + INNER JOIN currencies + ON suppliers.currcode=currencies.currabrev + WHERE purchorders.orderno='" . $OrderNumber . "' + GROUP BY purchorders.orderno, + suppliers.suppname, + purchorders.orddate, + purchorders.initiator, + purchorders.requisitionno, + purchorders.allowprint, + purchorders.status, + suppliers.currcode, + currencies.decimalplaces"; } else { /* $DateAfterCriteria = FormatDateforSQL($OrdersAfterDate); */ if (empty($_POST['StockLocation'])) { @@ -257,13 +268,16 @@ purchorders.allowprint, purchorders.status, suppliers.currcode, + currencies.decimalplaces, SUM(purchorderdetails.unitprice*purchorderdetails.quantityord) AS ordervalue - FROM purchorders, - purchorderdetails, - suppliers - WHERE purchorders.orderno = purchorderdetails.orderno - AND purchorders.supplierno = suppliers.supplierid - AND purchorderdetails.itemcode='" . $SelectedStockItem . "' + FROM purchorders + INNER JOIN purchorderdetails + ON purchorders.orderno = purchorderdetails.orderno + INNER JOIN suppliers + ON purchorders.supplierno = suppliers.supplierid + INNER JOIN currencies + ON suppliers.currcode=currencies.currabrev + WHERE purchorderdetails.itemcode='" . $SelectedStockItem . "' AND purchorders.supplierno='" . $SelectedSupplier . "' AND purchorders.intostocklocation = '" . $_POST['StockLocation'] . "' " . $StatusCriteria . " @@ -273,7 +287,8 @@ purchorders.initiator, purchorders.requisitionno, purchorders.allowprint, - suppliers.currcode"; + suppliers.currcode, + currencies.decimalplaces"; } else { $SQL = "SELECT purchorders.orderno, suppliers.suppname, @@ -283,13 +298,16 @@ purchorders.allowprint, purchorders.status, suppliers.currcode, + currencies.decimalplaces, SUM(purchorderdetails.unitprice*purchorderdetails.quantityord) AS ordervalue - FROM purchorders, - purchorderdetails, - suppliers - WHERE purchorders.orderno = purchorderdetails.orderno - AND purchorders.supplierno = suppliers.supplierid - AND purchorders.supplierno='" . $SelectedSupplier . "' + FROM purchorders + INNER JOIN purchorderdetails + ON purchorders.orderno = purchorderdetails.orderno + INNER JOIN suppliers + ON purchorders.supplierno = suppliers.supplierid + INNER JOIN currencies + ON suppliers.currcode=currencies.currabrev + WHERE purchorders.supplierno='" . $SelectedSupplier . "' AND purchorders.intostocklocation = '" . $_POST['StockLocation'] . "' " . $StatusCriteria . " GROUP BY purchorders.orderno, @@ -298,7 +316,8 @@ purchorders.initiator, purchorders.requisitionno, purchorders.allowprint, - suppliers.currcode"; + suppliers.currcode, + currencies.decimalplaces"; } } else { //no supplier selected if (isset($SelectedStockItem)) { @@ -310,13 +329,16 @@ purchorders.allowprint, purchorders.status, suppliers.currcode, + currencies.decimalplaces, SUM(purchorderdetails.unitprice*purchorderdetails.quantityord) AS ordervalue - FROM purchorders, - purchorderdetails, - suppliers - WHERE purchorders.orderno = purchorderdetails.orderno - AND purchorders.supplierno = suppliers.supplierid - AND purchorderdetails.itemcode='" . $SelectedStockItem . "' + FROM purchorders + INNER JOIN purchorderdetails + ON purchorders.orderno = purchorderdetails.orderno + INNER JOIN suppliers + ON purchorders.supplierno = suppliers.supplierid + INNER JOIN currencies + ON suppliers.currcode=currencies.currabrev + WHERE purchorderdetails.itemcode='" . $SelectedStockItem . "' AND purchorders.intostocklocation = '" . $_POST['StockLocation'] . "' " . $StatusCriteria . " GROUP BY purchorders.orderno, @@ -325,7 +347,8 @@ purchorders.initiator, purchorders.requisitionno, purchorders.allowprint, - suppliers.currcode"; + suppliers.currcode, + currencies.decimalplaces"; } else { $SQL = "SELECT purchorders.orderno, suppliers.suppname, @@ -335,13 +358,16 @@ purchorders.allowprint, purchorders.status, suppliers.currcode, + currencies.decimalplaces, sum(purchorderdetails.unitprice*purchorderdetails.quantityord) as ordervalue - FROM purchorders, - purchorderdetails, - suppliers - WHERE purchorders.orderno = purchorderdetails.orderno - AND purchorders.supplierno = suppliers.supplierid - AND purchorders.intostocklocation = '" . $_POST['StockLocation'] . "' + FROM purchorders + INNER JOIN purchorderdetails + ON purchorders.orderno = purchorderdetails.orderno + INNER JOIN suppliers + ON purchorders.supplierno = suppliers.supplierid + INNER JOIN currencies + ON suppliers.currcode=currencies.currabrev + WHERE purchorders.intostocklocation = '" . $_POST['StockLocation'] . "' " . $StatusCriteria . " GROUP BY purchorders.orderno, suppliers.suppname, @@ -349,7 +375,8 @@ purchorders.initiator, purchorders.requisitionno, purchorders.allowprint, - suppliers.currcode"; + suppliers.currcode, + currencies.decimalplaces"; } } //end selected supplier @@ -360,15 +387,16 @@ if (DB_num_rows($PurchOrdersResult) > 0) { /*show a table of the orders returned by the SQL */ echo '<table cellpadding=2 colspan=7 width=90% class=selection>'; - $TableHeader = '<tr><th>' . _('View') . '</th> - <th>' . _('Supplier') . '</th> - <th>' . _('Currency') . '</th> - <th>' . _('Requisition') . '</th> - <th>' . _('Order Date') . '</th> - <th>' . _('Initiator') . '</th> - <th>' . _('Order Total') . '</th> - <th>' . _('Status') . '</th> - </tr>'; + $TableHeader = '<tr> + <th>' . _('View') . '</th> + <th>' . _('Supplier') . '</th> + <th>' . _('Currency') . '</th> + <th>' . _('Requisition') . '</th> + <th>' . _('Order Date') . '</th> + <th>' . _('Initiator') . '</th> + <th>' . _('Order Total') . '</th> + <th>' . _('Status') . '</th> + </tr>'; echo $TableHeader; $j = 1; $k = 0; //row colour counter @@ -380,9 +408,9 @@ echo '<tr bgcolor="#EEEEEE">'; $k++; } - $ViewPurchOrder = $rootpath . '/PO_OrderDetails.php?' . SID . 'OrderNo=' . $myrow['orderno']; + $ViewPurchOrder = $rootpath . '/PO_OrderDetails.php?OrderNo=' . $myrow['orderno']; $FormatedOrderDate = ConvertSQLDate($myrow['orddate']); - $FormatedOrderValue = number_format($myrow['ordervalue'], 2); + $FormatedOrderValue = number_format($myrow['ordervalue'], $myrow['decimalplaces']); /* View Supplier Currency Requisition Order Date Initiator Order Total ModifyPage, $myrow["orderno"], $myrow["suppname"], $myrow["currcode"], $myrow["requisitionno"] $FormatedOrderDate, $myrow["initiator"] $FormatedOrderValue Order Status*/ echo '<td><a href="' . $ViewPurchOrder . '">' . $myrow['orderno'] . '</a></td> Modified: trunk/Payments.php =================================================================== --- trunk/Payments.php 2011-05-11 10:03:40 UTC (rev 4564) +++ trunk/Payments.php 2011-05-13 10:50:42 UTC (rev 4565) @@ -231,10 +231,10 @@ } /*Make an array of the defined bank accounts */ - $SQL = 'SELECT bankaccounts.accountcode + $SQL = "SELECT bankaccounts.accountcode FROM bankaccounts, chartmaster - WHERE bankaccounts.accountcode=chartmaster.accountcode'; + WHERE bankaccounts.accountcode=chartmaster.accountcode"; $result = DB_query($SQL,$db); $BankAccounts = array(); $i=0; @@ -270,8 +270,8 @@ } else { //Start a transaction to do the whole lot inside - $SQL = 'BEGIN'; - $result = DB_query($SQL,$db); + + $result = DB_Txn_Begin($db); if ($_SESSION['PaymentDetail']->SupplierID=='') { @@ -643,7 +643,7 @@ } else if ($_POST['GLCode'] == '') { prnMsg( _('No General Ledger code has been chosen') . ' - ' . _('so this GL analysis item could not be added'),'warn'); } else { - $SQL = "select accountname FROM chartmaster WHERE accountcode='" . $_POST['GLCode'] . "'"; + $SQL = "SELECT accountname FROM chartmaster WHERE accountcode='" . $_POST['GLCode'] . "'"; $Result=DB_query($SQL,$db); $myrow=DB_fetch_array($Result); $_SESSION['PaymentDetail']->add_to_glanalysis($_POST['GLAmount'], @@ -702,7 +702,7 @@ } -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'] . '" />'; Modified: trunk/PcAssignCashToTab.php =================================================================== --- trunk/PcAssignCashToTab.php 2011-05-11 10:03:40 UTC (rev 4564) +++ trunk/PcAssignCashToTab.php 2011-05-13 10:50:42 UTC (rev 4565) @@ -49,8 +49,8 @@ } $sqlLimit = "SELECT tablimit - FROM pctabs - WHERE tabcode='" . $SelectedTabs . "'"; + FROM pctabs + WHERE tabcode='" . $SelectedTabs . "'"; $ResultLimit = DB_query($sqlLimit,$db); $Limit=DB_fetch_array($ResultLimit); @@ -63,10 +63,10 @@ $sql = "UPDATE pcashdetails SET date = '".FormatDateForSQL($_POST['Date'])."', - amount = '" . $_POST['Amount'] . "', - authorized = '0000-00-00', - notes = '" . $_POST['Notes'] . "', - receipt = '" . $_POST['Receipt'] . "' + amount = '" . $_POST['Amount'] . "', + authorized = '0000-00-00', + notes = '" . $_POST['Notes'] . "', + receipt = '" . $_POST['Receipt'] . "' WHERE counterindex = '" . $SelectedIndex . "'"; $msg = _('Assignment of cash to PC Tab ') . ' ' . $SelectedTabs . ' ' . _('has been updated'); @@ -163,7 +163,7 @@ echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/money_add.png" title="' . _('Search') . '" alt="" />' . ' ' . $title. '</p>'; } - echo '<p><div class="centre"><a href="' . $_SERVER['PHP_SELF'] . '?' . SID . '">' . _('Details Of Petty Cash Tab ') . '' .$SelectedTabs. '<a/></div>'; + echo '<p><div class="centre"><a href="' . $_SERVER['PHP_SELF'] . '">' . _('Details Of Petty Cash Tab ') . '' .$SelectedTabs. '<a/></div>'; if (! isset($_GET['edit']) OR isset ($_POST['GO'])){ @@ -263,7 +263,7 @@ } echo '<tr><td colspan="2" style="text-align:right"><b>' . _('Current balance') . ':</b></td> - <td>' . number_format($Amount['0'],2) . '</td></tr>'; + <td>' . number_format($Amount['0'],2) . '</td></tr>'; echo '</table>'; @@ -277,7 +277,7 @@ echo '<form method="post" action="' . $_SERVER['PHP_SELF'] .'">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<p><table class=selection>'; //Main table + echo '<p><table class="selection">'; //Main table if (isset($_GET['SelectedIndex'])) { echo '<tr><th colspan="2"><font color=blue size=3>'._('Update Cash Assignment').'</font></th></tr>'; } else { Modified: trunk/PcClaimExpensesFromTab.php =================================================================== --- trunk/PcClaimExpensesFromTab.php 2011-05-11 10:03:40 UTC (rev 4564) +++ trunk/PcClaimExpensesFromTab.php 2011-05-13 10:50:42 UTC (rev 4565) @@ -43,7 +43,7 @@ if ($_POST['amount']==0) { $InputError = 1; - prnMsg('<br>' . _('The Amount must be greater than 0'),'error'); + prnMsg( _('The Amount must be greater than 0'),'error'); $Errors[$i] = 'TabCode'; $i++; } @@ -83,7 +83,7 @@ '" . $_POST['Receipt'] . "' )"; - $msg = _('The Expense Claim on Tab') . ' ' . $_POST["SelectedTabs"] . ' ' . _('has been created'); + $msg = _('The Expense Claim on Tab') . ' ' . $_POST['SelectedTabs'] . ' ' . _('has been created'); } if ( $InputError !=1) { @@ -154,7 +154,7 @@ //end of ifs and buts! if (isset($_POST['process'])OR isset($SelectedTabs)) { - echo '<p><div class="centre"><a href="' . $_SERVER['PHP_SELF'] . '?' . SID . '">' . _('Petty Cash Tab ') . '' .$SelectedTabs. '<a/></div><p>'; + echo '<p><div class="centre"><a href="' . $_SERVER['PHP_SELF'] . '">' . _('Petty Cash Tab ') . '' .$SelectedTabs. '<a/></div><p>'; /* RICARD */ if (! isset($_GET['edit']) OR isset ($_POST['GO'])){ echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; @@ -186,13 +186,13 @@ echo '<br><table border=1>'; echo '<tr> - <th>' . _('Date Of Expense') . '</th> - <th>' . _('Expense Description') . '</th> - <th>' . _('Amount') . '</th> - <th>' . _('Authorized') . '</th> - <th>' . _('Notes') . '</th> - <th>' . _('Receipt') . '</th> - </tr>'; + <th>' . _('Date Of Expense') . '</th> + <th>' . _('Expense Description') . '</th> + <th>' . _('Amount') . '</th> + <th>' . _('Authorized') . '</th> + <th>' . _('Notes') . '</th> + <th>' . _('Receipt') . '</th> + </tr>'; $k=0; //row colour counter @@ -216,17 +216,17 @@ $Description['0']='ASSIGNCASH'; } - if (($myrow['5'] == "0000-00-00") and ($Description['0'] != 'ASSIGNCASH')){ + if (($myrow['5'] == '0000-00-00') and ($Description['0'] != 'ASSIGNCASH')){ // only movements NOT authorized can be modified or deleted - printf("<td>%s</td> + printf('<td>%s</td> <td>%s</td> <td class=number>%s</td> <td>%s</td> <td>%s</td> <td>%s</td> - <td><a href='%sSelectedIndex=%s&SelectedTabs=$SelectedTabs&Days=$Days&edit=yes'>" . _('Edit') . "</td> - <td><a href='%sSelectedIndex=%s&SelectedTabs=$SelectedTabs&Days=$Days&delete=yes' onclick=\"return confirm('" . _('Are you sure you wish to delete this code and the expense it may have set up?') . "');\">" . _('Delete') . "</td> - </tr>", + <td><a href="%sSelectedIndex=%s&SelectedTabs=' . $SelectedTabs . '&Days=' . $Days . '&edit=yes">' . _('Edit') . '</td> + <td><a href="%sSelectedIndex=%s&SelectedTabs=' . $SelectedTabs . '&Days=' . $Days . '&delete=yes" onclick=\'return confirm("' . _('Are you sure you wish to delete this code and the expenses it may have set up?') . '");\'>' . _('Delete') . '</td> + </tr>', ConvertSQLDate($myrow['2']), $Description['0'], number_format($myrow['4'],2), @@ -236,13 +236,13 @@ $_SERVER['PHP_SELF'] . '?', $myrow['0'], $_SERVER['PHP_SELF'] . '?', $myrow['0']); } else { - printf("<td>%s</td> + printf('<td>%s</td> <td>%s</td> <td class=number>%s</td> <td>%s</td> <td>%s</td> <td>%s</td> - </tr>", + </tr>', ConvertSQLDate($myrow['2']), $Description['0'], number_format($myrow['4'],2), @@ -325,7 +325,7 @@ if (isset($_POST['SelectedExpense']) and $myrow['codeexpense']==$_POST['SelectedExpense']) { echo '<option selected value="'; } else { - echo '<option VALUE="'; + echo '<option value="'; } echo $myrow['codeexpense'] . '">' . $myrow['codeexpense'] . ' - ' . $myrow['description'] . '</option>'; @@ -357,7 +357,7 @@ echo '<input type="hidden" name="Days" value="' .$Days. '">'; echo '</table>'; // close table in first column echo '</td></tr></table>'; // close main table - echo '<p><div class="centre"><input type=submit name=submit VALUE="' . _('Accept') . '"><in... [truncated message content] |
From: <dai...@us...> - 2011-05-13 10:50:51
|
Revision: 4565 http://web-erp.svn.sourceforge.net/web-erp/?rev=4565&view=rev Author: daintree Date: 2011-05-13 10:50:42 +0000 (Fri, 13 May 2011) Log Message: ----------- various Modified Paths: -------------- trunk/BOMs.php trunk/Factors.php trunk/GLJournal.php trunk/GLTags.php trunk/GoodsReceived.php trunk/MRPDemands.php trunk/OffersReceived.php trunk/PO_AuthorisationLevels.php trunk/PO_AuthoriseMyOrders.php trunk/PO_SelectPurchOrder.php trunk/Payments.php trunk/PcAssignCashToTab.php trunk/PcClaimExpensesFromTab.php trunk/PcTabs.php trunk/Prices.php trunk/Prices_Customer.php trunk/SalesCategories.php trunk/SalesTypes.php trunk/SelectProduct.php trunk/SelectRecurringSalesOrder.php trunk/SelectSalesOrder.php trunk/SupplierAllocations.php trunk/includes/header.inc Modified: trunk/BOMs.php =================================================================== --- trunk/BOMs.php 2011-05-11 10:03:40 UTC (rev 4564) +++ trunk/BOMs.php 2011-05-13 10:50:42 UTC (rev 4565) @@ -131,20 +131,20 @@ } else { $QuantityOnHand = number_format($myrow[10],$myrow[11]); } - printf("<td>%s</td> + printf('<td>%s</td> <td>%s</td> - <td>%s</td> <td>%s</td> <td>%s</td> + <td>%s</td> <td class=number>%s</td> <td>%s</td> <td>%s</td> <td>%s</td> <td class=number>%s</td> - <td><a href=\"%s&Select=%s&SelectedComponent=%s\">" . _('Edit') . "</a></td> - <td>".$DrillText."</a></td> - <td><a href=\"%s&Select=%s&SelectedComponent=%s&delete=1&ReSelect=%s\">" . _('Delete') . "</a></td> - </tr>", + <td><a href="%s&Select=%s&SelectedComponent=%s">' . _('Edit') . '</a></td> + <td>'.$DrillText.'</a></td> + <td><a href="%s&Select=%s&SelectedComponent=%s&delete=1&ReSelect=%s">' . _('Delete') . '</a></td> + </tr>', $Level1, $myrow[0], $myrow[1], @@ -789,7 +789,7 @@ echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/magnifier.png" title="' . _('Search') . '" alt="">' . ' ' . $title; echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">' . - '<div class="page_help_text">'. _('Select a manufactured part') . " (" . _('or Assembly or Kit part') . ") " . + '<div class="page_help_text">'. _('Select a manufactured part') . ' (' . _('or Assembly or Kit part') . ') ' . _('to maintain the bill of material for using the options below') . '<br /><font size=1>' . _('Parts must be defined in the stock item entry') . '/' . _('modification screen as manufactured') . ', ' . _('kits or assemblies to be available for construction of a bill of material') .'</div>'. @@ -806,7 +806,7 @@ <br /><div class="centre"><input tabindex="3" type="submit" name="Search" value="' . _('Search Now') . '"></div>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; -if (isset($_POST['Search']) and isset($result) AND !isset($SelectedParent)) { +if (isset($_POST['Search']) AND isset($result) AND !isset($SelectedParent)) { echo '<br /><table cellpadding=2 colspan=7 class=selection>'; $TableHeader = '<tr><th>' . _('Code') . '</th> Modified: trunk/Factors.php =================================================================== --- trunk/Factors.php 2011-05-11 10:03:40 UTC (rev 4564) +++ trunk/Factors.php 2011-05-13 10:50:42 UTC (rev 4565) @@ -1,6 +1,6 @@ <?php -//$PageSecurity = 5; +/* $Id$*/ include('includes/session.inc'); @@ -10,7 +10,7 @@ if (isset($_GET['FactorID'])){ $FactorID = strtoupper($_GET['FactorID']); - $_POST['amend']=True; + $_POST['Amend']=True; } elseif (isset($_POST['FactorID'])){ $FactorID = strtoupper($_POST['FactorID']); } else { @@ -19,7 +19,7 @@ if (isset($_POST['Create'])) { $FactorID = 0; - $_POST['New'] = "Yes"; + $_POST['New'] = 'Yes'; }; echo '<div class="centre"><p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' @@ -31,22 +31,25 @@ //initialise no input errors assumed initially before we test $InputError = 0; -if (isset($_POST['submit']) or isset($_POST['update']) or isset($_POST['delete'])) { +if (isset($_POST['Submit']) OR isset($_POST['Update'])) { if (strlen($_POST['FactorName']) > 40 or strlen($_POST['FactorName']) == 0 or $_POST['FactorName'] == '') { $InputError = 1; prnMsg(_('The factoring company name must be entered and be forty characters or less long'),'error'); } - + if (strlen($_POST['Email'])>0 AND !IsEmailAddress($_POST['Email'])){ + prnMsg(_('The email address entered does not appear to be a valid email address format'),'error'); + $InputError = 1; + } // But if errors were found in the input if ($InputError>0) { - prnMsg(_('Validation failed') . _('no updates or deletes took place'),'warn'); + prnMsg(_('Validation failed no insert or update took place'),'warn'); include('includes/footer.inc'); exit; } - + /* If no input errors have been recieved */ - if ($InputError == 0 and isset($_POST['submit'])){ + if ($InputError == 0 and isset($_POST['Submit'])){ //And if its not a new part then update existing one $sql = "INSERT INTO factorcompanies (id, @@ -81,22 +84,7 @@ prnMsg(_('A new factoring company for') . ' ' . $_POST['FactorName'] . ' ' . _('has been added to the database'),'success'); - unset ($FactorID); - unset($_POST['FactorName']); - unset($_POST['Address1']); - unset($_POST['Address2']); - unset($_POST['Address3']); - unset($_POST['Address4']); - unset($_POST['Address5']); - unset($_POST['Address6']); - unset($_POST['ContactName']); - unset($_POST['Telephone']); - unset($_POST['Fax']); - unset($_POST['Email']); - - } - - if ($InputError == 0 and isset($_POST['update'])) { + }elseif ($InputError == 0 and isset($_POST['Update'])) { $sql = "UPDATE factorcompanies SET coyname='" . $_POST['FactorName'] . "', address1='" . $_POST['Address1'] . "', address2='" . $_POST['Address2'] . "', @@ -118,105 +106,50 @@ //If it is a new part then insert it } + unset ($FactorID); + unset($_POST['FactorName']); + unset($_POST['Address1']); + unset($_POST['Address2']); + unset($_POST['Address3']); + unset($_POST['Address4']); + unset($_POST['Address5']); + unset($_POST['Address6']); + unset($_POST['ContactName']); + unset($_POST['Telephone']); + unset($_POST['Fax']); + unset($_POST['Email']); +} +if (isset($_POST['Delete'])) { - /* If neither the Update or Insert buttons were pushed was it the delete button? */ + $CancelDelete = 0; - if (isset($_POST['delete'])) { + // PREVENT DELETES IF DEPENDENT RECORDS IN 'SuppTrans' , PurchOrders, SupplierContacts - $CancelDelete = 0; + $sql= "SELECT COUNT(*) FROM suppliers WHERE factorcompanyid='".$FactorID."'"; + $result = DB_query($sql, $db); + $myrow = DB_fetch_row($result); + if ($myrow[0] > 0) { + $CancelDelete = 1; + prnMsg(_('Cannot delete this factor because there are suppliers using them'),'warn'); + echo '<br />' . _('There are') . ' ' . $myrow[0] . ' ' . _('suppliers using this factor company'); + } - // PREVENT DELETES IF DEPENDENT RECORDS IN 'SuppTrans' , PurchOrders, SupplierContacts - - $sql= "SELECT COUNT(*) FROM suppliers WHERE factorcompanyid='".$FactorID."'"; + if ($CancelDelete == 0) { + $sql="DELETE FROM factorcompanies WHERE id='".$FactorID."'"; $result = DB_query($sql, $db); - $myrow = DB_fetch_row($result); - if ($myrow[0] > 0) { - $CancelDelete = 1; - prnMsg(_('Cannot delete this factor because there are suppliers using them'),'warn'); - echo '<br>' . _('There are') . ' ' . $myrow[0] . ' ' . _('suppliers using this factor company'); - } - - if ($CancelDelete == 0) { - $sql="DELETE FROM factorcompanies WHERE id='".$FactorID."'"; - $result = DB_query($sql, $db); - prnMsg(_('Factoring company record record for') . ' ' . $_POST['FactorName'] . ' ' . _('has been deleted'),'success'); - echo '<br>'; - unset($_SESSION['FactorID']); - } //end if Delete factor - } + prnMsg(_('Factoring company record record for') . ' ' . $_POST['FactorName'] . ' ' . _('has been deleted'),'success'); + echo '<br />'; + unset($_SESSION['FactorID']); + } //end if Delete factor unset($FactorID); } -/* So the page hasn't called itself with the input/update/delete/buttons */ -/* If it didn't come with a $FactorID it must be a completely fresh start, so choose a new $factorID or give the - option to create a new one*/ -if (empty($FactorID)) { +/* So the page hasn't called itself with the input/update/delete/buttons */ - echo "<form method='post' action='" . $_SERVER['PHP_SELF'] . "?" . SID . "'>"; - echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo "<input type='hidden' name='New' VALUE='No'>"; - echo '<table class=selection><tr>'; - echo '<th>' . _('ID') . '</th>'; - echo '<th>' . _('Company Name').'</th>'; - echo '<th>' . _('Address 1').'</th>'; - echo '<th>' . _('Address 2').'</th>'; - echo '<th>' . _('Address 3').'</th>'; - echo '<th>' . _('Address 4').'</th>'; - echo '<th>' . _('Address 5').'</th>'; - echo '<th>' . _('Address 6').'</th>'; - echo '<th>' . _('Contact').'</th>'; - echo '<th>' . _('Telephone').'</th>'; - echo '<th>' . _('Fax Number').'</th>'; - echo '<th>' . _('Email').'</th></tr>'; - $sql = "SELECT id, - coyname, - address1, - address2, - address3, - address4, - address5, - address6, - contact, - telephone, - fax, - email - FROM factorcompanies"; - $result=DB_query($sql, $db); - $j=1; - while ($myrow = DB_fetch_array($result)) { - if ($j==1) { - echo '<tr class="OddTableRows">'; - $j=0; - } else { - echo '<tr class="EvenTableRows">'; - $j++; - } - echo '<td>' . $myrow['id'] . '</td>'; - echo '<td>' . $myrow['coyname'].'</td>'; - echo '<td>' . $myrow['address1'].'</td>'; - echo '<td>' . $myrow['address2'].'</td>'; - echo '<td>' . $myrow['address3'].'</td>'; - echo '<td>' . $myrow['address4'].'</td>'; - echo '<td>' . $myrow['address5'].'</td>'; - echo '<td>' . $myrow['address6'].'</td>'; - echo '<td>' . $myrow['contact'].'</td>'; - echo '<td>' . $myrow['telephone'].'</td>'; - echo '<td>' . $myrow['fax'].'</td>'; - echo '<td>' . $myrow['email'].'</td>'; - echo '<td><a href="'.$rootpath . '/Factors.php?' . SID . '&FactorID='.$myrow['id'].'">'._('Edit').'</a></td></tr>'; - } - echo "</table><p><div class='centre'>"; - echo "<br><input tabindex=3 type='Submit' name='Create' value='" . _('Create New Factor') . "'>"; - echo '</div></form>'; - include('includes/footer.inc'); - exit; +if (isset($FactorID) and isset($_POST['Amend'])) { -} - -if (isset($FactorID) and isset($_POST['amend'])) { - $sql = "SELECT id, coyname, address1, @@ -261,37 +194,119 @@ $_POST['Email'] = ''; } -if (isset($_POST['amend']) or isset($_POST['Create'])) { +if (isset($_POST['Amend']) or isset($_POST['Create'])) { // its a new factor being added - 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'] . '" />'; - echo "<input type=hidden name='FactorID' value='".$FactorID."'>"; + echo '<input type="hidden" name="FactorID" value="' . $FactorID .'">'; echo '<table class=selection>'; - echo "<input type=hidden name='New' value='Yes'>"; - echo '<tr><td>' . _('Factor company Name') . ":</td><td><input tabindex=1 type='text' name='FactorName' size=42 maxlength=40 value='".$_POST['FactorName']."'></td></tr>"; - echo '<tr><td>' . _('Address Line 1') . ":</td><td><input tabindex=2 type='text' name='Address1' size=42 maxlength=40 value='".$_POST['Address1']."'></td></tr>"; - echo '<tr><td>' . _('Address Line 2') . ":</td><td><input tabindex=3 type='text' name='Address2' size=42 maxlength=40 value='".$_POST['Address2']."'></td></tr>"; - echo '<tr><td>' . _('Address Line 3') . ":</td><td><input tabindex=4 type='text' name='Address3' size=42 maxlength=40 value='".$_POST['Address3']."'></td></tr>"; - echo '<tr><td>' . _('Address Line 4') . ":</td><td><input tabindex=5 type='text' name='Address4' size=42 maxlength=40 value='".$_POST['Address4']."'></td></tr>"; - echo '<tr><td>' . _('Address Line 5') . ":</td><td><input tabindex=6 type='text' name='Address5' size=42 maxlength=40 value='".$_POST['Address5']."'></td></tr>"; - echo '<tr><td>' . _('Address Line 6') . ":</td><td><input tabindex=7 type='text' name='Address6' size=42 maxlength=40 value='".$_POST['Address6']."'></td></tr>"; - echo '<tr><td>' . _('Contact Name') . ":</td><td><input tabindex=8 type='text' name='ContactName' size=13 maxlength=25 value='".$_POST['ContactName']."'></td></tr>"; - echo '<tr><td>' . _('Telephone') . ":</td><td><input tabindex=9 type='text' name='Telephone' size=13 maxlength=25 value='".$_POST['Telephone']."'></td></tr>"; - echo '<tr><td>' . _('Fax') . ":</td><td><input tabindex=10 type='text' name='Fax' VALUE=0 size=13 maxlength=25 value='".$_POST['Fax']."'></td></tr>"; - echo '<tr><td>' . _('Email') . ":</td><td><input tabindex=11 type='text' name='Email' size=55 maxlength=55 value='".$_POST['Email']."'></td></tr>"; + echo '<input type="hidden" name="New" value="Yes">'; + echo '<tr><td>' . _('Factor company Name') . ':</td> + <td><input tabindex=1 type="text" name="FactorName" size=42 maxlength=40 value="' .$_POST['FactorName'].'"></td></tr>'; + echo '<tr><td>' . _('Address Line 1') . ':</td> + <td><input tabindex=2 type="text" name="Address1" size=42 maxlength=40 value="' . $_POST['Address1'] .'"></td></tr>'; + echo '<tr><td>' . _('Address Line 2') . ':</td> + <td><input tabindex=3 type="text" name="Address2" size=42 maxlength=40 value="' . $_POST['Address2'] .'"></td></tr>'; + + echo '<tr><td>' . _('Address Line 3') . ':</td> + <td><input tabindex=4 type="text" name="Address3" size=42 maxlength=40 value="' .$_POST['Address3'] .'"></td></tr>'; + echo '<tr><td>' . _('Address Line 4') . ':</td> + <td><input tabindex=5 type="text" name="Address4" size=42 maxlength=40 value="' . $_POST['Address4'].'"></td></tr>'; + echo '<tr><td>' . _('Address Line 5') . ':</td> + <td><input tabindex=6 type="text" name="Address5" size=42 maxlength=40 value="' . $_POST['Address5'] .'"></td></tr>'; + echo '<tr><td>' . _('Address Line 6') . ':</td> + <td><input tabindex=7 type="text" name="Address6" size=42 maxlength=40 value="' .$_POST['Address6'] . '"></td></tr>'; + echo '<tr><td>' . _('Contact Name') . ':</td> + <td><input tabindex=8 type="text" name="ContactName" size=13 maxlength=25 value="' . $_POST['ContactName'] .'"></td></tr>'; + echo '<tr><td>' . _('Telephone') . ':</td> + <td><input tabindex=9 type="text" name="Telephone" size=13 maxlength=25 value="' .$_POST['Telephone'].'"></td></tr>'; + echo '<tr><td>' . _('Fax') . ':</td> + <td><input tabindex=10 type="text" name="Fax" value=0 size=13 maxlength=25 value="' . $_POST['Fax'] .'"></td></tr>'; + echo '<tr><td>' . _('Email') . ':</td> + <td><input tabindex=11 type="text" name="Email" size=55 maxlength=55 value="' . $_POST['Email'] . '"></td></tr>'; echo '</form>'; } if (isset($_POST['Create'])) { - echo "</table><p><div class='centre'><input tabindex=12 type='Submit' name='submit' VALUE='" . _('Insert New Factor') . "'></div>"; -} else if (isset($_POST['amend'])) { - echo "</table><p><div class='centre'><input tabindex=13 type='Submit' name='update' VALUE='" . _('Update Factor') . "'><p>"; + echo '</table><p><div class="centre"><input tabindex=12 type="submit" name="Submit" value="' . _('Insert New Factor') . '"></div>'; +} else if (isset($_POST['Amend'])) { + echo '</table> + <p><div class="centre"><input tabindex=13 type="submit" name="Update" value="' . _('Update Factor') . '"><p>'; prnMsg ( _('There is no second warning if you hit the delete button below') . '. ' . _('However checks will be made to ensure there are no suppliers are using this factor before the deletion is processed'), 'warn'); - echo "<p><input tabindex=14 type='Submit' name='delete' VALUE='" . _('Delete Factor') . "' onclick=\"return confirm('" . _('Are you sure you wish to delete this factoring company?') . "');\"></form></div>"; + echo '<p><input tabindex=14 type="submit" name="Delete" value="' . _('Delete Factor') . '" onclick="return confirm(\'' . _('Are you sure you wish to delete this factoring company?') . '\');"></form></div>'; } +/* If it didn't come with a $FactorID it must be a completely fresh start, so choose a new $factorID or give the + option to create a new one*/ + +if (empty($FactorID) AND !isset($_POST['Create']) AND !isset($_POST['Amend'])) { + + echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; + echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; + + echo '<input type="hidden" name="New" value="No">'; + echo '<table class=selection><tr> + <th>' . _('ID') . '</th> + <th>' . _('Company Name').'</th> + <th>' . _('Address 1').'</th> + <th>' . _('Address 2').'</th> + <th>' . _('Address 3').'</th> + <th>' . _('Address 4').'</th> + <th>' . _('Address 5').'</th> + <th>' . _('Address 6').'</th> + <th>' . _('Contact').'</th> + <th>' . _('Telephone').'</th> + <th>' . _('Fax Number').'</th> + <th>' . _('Email').'</th></tr>'; + $sql = "SELECT id, + coyname, + address1, + address2, + address3, + address4, + address5, + address6, + contact, + telephone, + fax, + email + FROM factorcompanies"; + $result=DB_query($sql, $db); + $j=1; + while ($myrow = DB_fetch_array($result)) { + if ($j==1) { + echo '<tr class="OddTableRows">'; + $j=0; + } else { + echo '<tr class="EvenTableRows">'; + $j++; + } + echo '<td>' . $myrow['id'] . '</td> + <td>' . $myrow['coyname'].'</td> + <td>' . $myrow['address1'].'</td> + <td>' . $myrow['address2'].'</td> + <td>' . $myrow['address3'].'</td> + <td>' . $myrow['address4'].'</td> + <td>' . $myrow['address5'].'</td> + <td>' . $myrow['address6'].'</td> + <td>' . $myrow['contact'].'</td> + <td>' . $myrow['telephone'].'</td> + <td>' . $myrow['fax'].'</td> + <td>' . $myrow['email'].'</td> + <td><a href="'.$rootpath . '/Factors.php?FactorID='.$myrow['id'].'">'._('Edit').'</a></td> + </tr>'; + } + echo '</table><p><div class="centre">'; + echo '<br /><input tabindex=3 type="submit" name="Create" value="' . _('Create New Factor') . '">'; + echo '</div></form>'; + include('includes/footer.inc'); + exit; + +} + + include('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/GLJournal.php =================================================================== --- trunk/GLJournal.php 2011-05-11 10:03:40 UTC (rev 4564) +++ trunk/GLJournal.php 2011-05-13 10:50:42 UTC (rev 4565) @@ -235,9 +235,8 @@ } echo '<table><tr> - <td colspan="5"><table class="selection"><tr><td>'._('Date to Process Journal').":</td> - <td><input type='text' class='date' alt='".$_SESSION['DefaultDateFormat']."' name='JournalProcessDate' maxlength='10' size='11' value='" . - $_SESSION['JournalDetail']->JnlDate . "' /></td>"; + <td colspan="5"><table class="selection"><tr><td>'._('Date to Process Journal') . ':</td> + <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="JournalProcessDate" maxlength="10" size="11" value="' . $_SESSION['JournalDetail']->JnlDate . '" /></td>'; echo '<td>' . _('Type') . ':</td> <td><select name="JournalType">'; @@ -261,9 +260,9 @@ echo '<tr><th colspan="3"><div class="centre"><font size="3" color="blue"><b>' . _('Journal Line Entry') . '</b></font></div></th></tr>'; /*now set up a GLCode field to select from avaialble GL accounts */ -echo '<tr><th>' . _('GL Tag') . '</th>'; -echo '<th>' . _('GL Account Code') . '</th>'; -echo '<th>' . _('Select GL Account') . '</th></tr>'; +echo '<tr><th>' . _('GL Tag') . '</th> + <th>' . _('GL Account Code') . '</th> + <th>' . _('Select GL Account') . '</th></tr>'; /* Set upthe form for the transaction entry for a GL Payment Analysis item */ @@ -321,19 +320,17 @@ $_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" ' . - 'onChange="eitherOr(this, '.'Debit'.')"'. - ' Maxlength="12" size="10" value="' . $_POST['Credit'] . '" /></td>'; +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" 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 '<td><input type="text" name="GLNarrative" maxlength="100" size="100" value="' . $_POST['GLNarrative'] . '" /></td>'; echo '</tr></table><br />'; /*Close the main table */ -echo '<div class="centre"><input type="submi2t" name="Process" value="' . _('Accept') . '" /></div><br /><br />'; +echo '<div class="centre"><input type="submit" name="Process" value="' . _('Accept') . '" /></div><br /><br />'; echo '<table class="selection" width="85%">'; @@ -369,8 +366,8 @@ } else { $TagDescription=$myrow[0]; } - echo '<td>' . $JournalItem->tag . ' - ' . $TagDescription . '</td>'; - echo '<td>' . $JournalItem->GLCode . ' - ' . $JournalItem->GLActName . '</td>'; + echo '<td>' . $JournalItem->tag . ' - ' . $TagDescription . '</td> + <td>' . $JournalItem->GLCode . ' - ' . $JournalItem->GLActName . '</td>'; if ($JournalItem->Amount>0) { echo '<td class="number">' . number_format($JournalItem->Amount,$_SESSION['CompanyRecord']['decimalplaces']) . '</td><td></td>'; $DebitTotal=$DebitTotal+$JournalItem->Amount; @@ -402,7 +399,7 @@ echo '</table>'; if (ABS($_SESSION['JournalDetail']->JournalTotal)<0.001 AND $_SESSION['JournalDetail']->GLItemCounter > 0){ - echo "<br /><br /><div class='centre'><input type='submit' name='CommitBatch' value='"._('Accept and Process Journal')."' /></div>"; + echo '<br /><br /><div class="centre"><input type="submit" name="CommitBatch" value="' ._('Accept and Process Journal').'" /></div>'; } elseif(count($_SESSION['JournalDetail']->GLEntries)>0) { echo '<br /><br />'; prnMsg(_('The journal must balance ie debits equal to credits before it can be processed'),'warn'); Modified: trunk/GLTags.php =================================================================== --- trunk/GLTags.php 2011-05-11 10:03:40 UTC (rev 4564) +++ trunk/GLTags.php 2011-05-13 10:50:42 UTC (rev 4565) @@ -80,7 +80,7 @@ echo '<tr><td>' . $myrow['tagref'].'</td> <td>' . $myrow['tagdescription'].'</td> <td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedTag=' . $myrow['tagref'] . '&Action=edit">' . _('Edit') . '</a></td> - <td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedTag=' . $myrow['tagref'] . '&Action=delete">' . _('Delete') . '</a></td> + <td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedTag=' . $myrow['tagref'] . '&Action=delete" onclick="return confirm(\'' . _('Are you sure you wish to delete this GL tag?') . '\');">' . _('Delete') . '</a></td> </tr>'; } Modified: trunk/GoodsReceived.php =================================================================== --- trunk/GoodsReceived.php 2011-05-11 10:03:40 UTC (rev 4564) +++ trunk/GoodsReceived.php 2011-05-13 10:50:42 UTC (rev 4565) @@ -79,10 +79,10 @@ echo '<table cellpadding=2 class=selection> <tr><th colspan="2"></th> - <th align="centre" colspan="3"><b>' . _('Supplier Units') . '</b></th> - <th></th> - <th align="centre" colspan="5"><b>' . _('Our Receiving Units') . '</b></th> - </tr> + <th align="centre" colspan="3"><b>' . _('Supplier Units') . '</b></th> + <th></th> + <th align="centre" colspan="5"><b>' . _('Our Receiving Units') . '</b></th> + </tr> <tr><th>' . _('Item Code') . '</th> <th>' . _('Description') . '</th> <th>' . _('Quantity') . '<br />' . _('Ordered') . '</th> Modified: trunk/MRPDemands.php =================================================================== --- trunk/MRPDemands.php 2011-05-11 10:03:40 UTC (rev 4564) +++ trunk/MRPDemands.php 2011-05-13 10:50:42 UTC (rev 4565) @@ -1,6 +1,7 @@ <?php -/* $Revision: 1.5 $ */ + /* $Id$*/ + // Add, Edit, Delete, and List MRP demand records. Table is mrpdemands. // Have separate functions for each routine. Use pass-by-reference - (&$db,&$StockID) - // to pass values of $db and $StockID to functions. - when just used $db as variable, Modified: trunk/OffersReceived.php =================================================================== --- trunk/OffersReceived.php 2011-05-11 10:03:40 UTC (rev 4564) +++ trunk/OffersReceived.php 2011-05-13 10:50:42 UTC (rev 4565) @@ -87,19 +87,20 @@ echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . _('Supplier Offers') . '" alt="" />' . ' ' . _('Supplier Offers') . '</p>'; - echo '<table class=selection>'; - echo '<tr><th>'._('Offer ID').'</th>'; - echo '<th>'._('Supplier').'</th>'; - echo '<th>'._('Stock Item').'</th>'; - echo '<th>'._('Quantity').'</th>'; - echo '<th>'._('Units').'</th>'; - echo '<th>'._('Price').'</th>'; - echo '<th>'._('Total').'</th>'; - echo '<th>'._('Currency').'</th>'; - echo '<th>'._('Offer Expires').'</th>'; - echo '<th>'._('Accept').'</th>'; - echo '<th>'._('Reject').'</th>'; - echo '<th>'._('Defer').'</th></tr>'; + echo '<table class=selection> + <tr> + <th>'._('Offer ID').'</th> + <th>'._('Supplier').'</th> + <th>'._('Stock Item').'</th> + <th>'._('Quantity').'</th> + <th>'._('Units').'</th> + <th>'._('Price').'</th> + <th>'._('Total').'</th> + <th>'._('Currency').'</th> + <th>'._('Offer Expires').'</th> + <th>'._('Accept').'</th> + <th>'._('Reject').'</th> + <th>'._('Defer').'</th></tr>'; $k=0; while ($myrow=DB_fetch_array($result)) { @@ -110,22 +111,22 @@ echo '<tr class="OddTableRows">'; $k++; } - echo '<td>'.$myrow['offerid'].'</td>'; - echo '<td>'.$myrow['suppname'].'</td>'; - echo '<td>'.$myrow['description'].'</td>'; - echo '<td class=number>'.number_format($myrow['quantity'],$myrow['decimalplaces']).'</td>'; - echo '<td>'.$myrow['uom'].'</td>'; - echo '<td class=number>'.number_format($myrow['price'],2).'</td>'; - echo '<td class=number>'.number_format($myrow['price']*$myrow['quantity'],2).'</td>'; - echo '<td>'.$myrow['currcode'].'</td>'; - echo '<td>'.$myrow['expirydate'].'</td>'; - echo '<td><input type="radio" name="action'.$myrow['offerid'].'" value="1"></td>'; - echo '<td><input type="radio" name="action'.$myrow['offerid'].'" value="2"></td>'; - echo '<td><input type="radio" checked name="action'.$myrow['offerid'].'" value="3"></td>'; - echo '<td><input type="hidden" name="supplierid" value="'.$myrow['supplierid'].'"></td>'; - echo '</tr>'; + echo '<td>'.$myrow['offerid'].'</td> + <td>'.$myrow['suppname'].'</td> + <td>'.$myrow['description'].'</td> + <td class=number>'.number_format($myrow['quantity'],$myrow['decimalplaces']).'</td> + <td>'.$myrow['uom'].'</td> + <td class=number>'.number_format($myrow['price'],2).'</td> + <td class=number>'.number_format($myrow['price']*$myrow['quantity'],2).'</td> + <td>'.$myrow['currcode'].'</td> + <td>'.$myrow['expirydate'].'</td> + <td><input type="radio" name="action'.$myrow['offerid'].'" value="1"></td> + <td><input type="radio" name="action'.$myrow['offerid'].'" value="2"></td> + <td><input type="radio" checked name="action'.$myrow['offerid'].'" value="3"></td> + <td><input type="hidden" name="supplierid" value="'.$myrow['supplierid'].'"></td> + </tr>'; } - echo '<tr><td colspan=12><div class="centre"><input type=Submit name=submit value=' . _('Enter Information') . '></div></td></tr>'; + echo '<tr><td colspan=12><div class="centre"><input type="submit" name="submit" value=' . _('Enter Information') . '></div></td></tr>'; echo '</form></table>'; } else if(isset($_POST['submit']) and isset($_POST['supplierid'])) { include ('includes/htmlMimeMail.php'); @@ -203,7 +204,6 @@ unitprice, actprice, quantityord, - itemno, suppliersunit) VALUES ( '".$OrderNo."', @@ -213,7 +213,6 @@ '".$myrow['price']."', '".$myrow['price']."', '".$myrow['quantity']."', - '".$myrow['stockid']."', '".$myrow['uom']."')"; $result=DB_query($sql, $db); $sql="DELETE FROM offers WHERE offerid='".$AcceptID."'"; @@ -226,7 +225,7 @@ $result = $mail->send(array($Email), 'smtp'); prnMsg(_('The accepted offers from').' '.$SupplierName.' '._('have been converted to purchase orders and an email sent to') .' '.$Email."\n"._('Please review the order contents').' '.'<a href="'.$rootpath . - "/PO_Header.php?ModifyOrderNumber=" . $OrderNo.'">'._('here').'</a>"', 'success'); + '/PO_Header.php?ModifyOrderNumber=' . $OrderNo.'">'._('here').'</a>', 'success'); } if (sizeOf($rejects)>0){ $MailText=_('This email has been automatically generated by the webERP installation at').' '. @@ -259,4 +258,4 @@ } include('includes/footer.inc'); -?> +?> \ No newline at end of file Modified: trunk/PO_AuthorisationLevels.php =================================================================== --- trunk/PO_AuthorisationLevels.php 2011-05-11 10:03:40 UTC (rev 4564) +++ trunk/PO_AuthorisationLevels.php 2011-05-13 10:50:42 UTC (rev 4565) @@ -67,8 +67,8 @@ cancreate='".$CanCreate."', offhold='".$OffHold."', authlevel='".$_POST['AuthLevel']."' - WHERE userid='".$_POST['UserID']."' - AND currabrev='".$_POST['CurrCode']."'"; + WHERE userid='".$_POST['UserID']."' + AND currabrev='".$_POST['CurrCode']."'"; $ErrMsg = _('The authentication details cannot be updated because'); $Result=DB_query($sql,$db,$ErrMsg); @@ -88,8 +88,8 @@ offhold, authlevel FROM purchorderauth - WHERE userid='".$_GET['UserID']."' - AND currabrev='".$_GET['Currency']."'"; + WHERE userid='".$_GET['UserID']."' + AND currabrev='".$_GET['Currency']."'"; $ErrMsg = _('The authentication details cannot be retrieved because'); $result=DB_query($sql,$db,$ErrMsg); $myrow=DB_fetch_array($result); @@ -100,7 +100,7 @@ $AuthLevel=$myrow['authlevel']; } -$sql='SELECT purchorderauth.userid, +$sql="SELECT purchorderauth.userid, www_users.realname, currencies.currabrev, currencies.currency, @@ -110,7 +110,7 @@ FROM purchorderauth INNER JOIN www_users ON purchorderauth.userid=www_users.userid INNER JOIN currencies - ON purchorderauth.currabrev=currencies.currabrev'; + ON purchorderauth.currabrev=currencies.currabrev"; $ErrMsg = _('The authentication details cannot be retrieved because'); $Result=DB_query($sql,$db,$ErrMsg); @@ -134,17 +134,18 @@ } else { $OffHold=_('No'); } - echo '<tr><td>' . $myrow['userid'] . '</td> - <td>' . $myrow['realname'] . '</td> - <td>' . $myrow['currency'] . '</td> - <td>' . $CanCreate . '</td> - <td>' . $OffHold . '</td> - <td class="number">'.number_format($myrow['authlevel'],2).'</td> - <td><a href="'.$rootpath.'/PO_AuthorisationLevels.php?Edit=Yes&UserID=' . $myrow['userid'] . -'&Currency='.$myrow['currabrev'].'">'._('Edit').'</td> - <td><a href="'.$rootpath.'/PO_AuthorisationLevels.php?Delete=Yes&UserID=' . $myrow['userid'] . -'&Currency='.$myrow['currabrev'].'">'._('Delete').'</td> - </tr>'; + echo '<tr> + <td>' . $myrow['userid'] . '</td> + <td>' . $myrow['realname'] . '</td> + <td>' . $myrow['currency'] . '</td> + <td>' . $CanCreate . '</td> + <td>' . $OffHold . '</td> + <td class="number">'.number_format($myrow['authlevel'],2).'</td> + <td><a href="'.$rootpath.'/PO_AuthorisationLevels.php?Edit=Yes&UserID=' . $myrow['userid'] . + '&Currency='.$myrow['currabrev'].'">'._('Edit').'</td> + <td><a href="'.$rootpath.'/PO_AuthorisationLevels.php?Delete=Yes&UserID=' . $myrow['userid'] . + '&Currency='.$myrow['currabrev'].'" onclick="return confirm(\'' . _('Are you sure you wish to delete this authorisation level?') . '\');">'._('Delete').'</td> + </tr>'; } echo '</table><br><br>'; @@ -158,7 +159,7 @@ echo '<input type=hidden name=UserID value="'.$UserID.'"'; } else { echo '<tr><td>'._('User ID').'</td><td><select name=UserID>'; - $usersql='SELECT userid FROM www_users'; + $usersql="SELECT userid FROM www_users"; $userresult=DB_query($usersql,$db); while ($myrow=DB_fetch_array($userresult)) { if ($myrow['userid']==$UserID) { @@ -174,12 +175,14 @@ $CurrencySQL="SELECT currency FROM currencies WHERE currabrev='".$Currency."'"; $CurrencyResult=DB_query($CurrencySQL,$db); $myrow=DB_fetch_array($CurrencyResult); - echo '<tr><td>'._('Currency').'</td> - <td>' . $myrow['currency'] . '</td></tr>'; + echo '<tr> + <td>'._('Currency').'</td> + <td>' . $myrow['currency'] . '</td> + </tr>'; echo '<input type=hidden name="currabrev" value="'.$Currency.'"'; } else { echo '<tr><td>'._('Currency').'</td><td><select name="CurrCode">'; - $currencysql='SELECT currabrev,currency FROM currencies'; + $currencysql="SELECT currabrev,currency FROM currencies"; $currencyresult=DB_query($currencysql,$db); while ($myrow=DB_fetch_array($currencyresult)) { if ($myrow['currabrev']==$Currency) { Modified: trunk/PO_AuthoriseMyOrders.php =================================================================== --- trunk/PO_AuthoriseMyOrders.php 2011-05-11 10:03:40 UTC (rev 4564) +++ trunk/PO_AuthoriseMyOrders.php 2011-05-13 10:50:42 UTC (rev 4565) @@ -1,7 +1,7 @@ <?php /* $Id$*/ -//$PageSecurity = 4; + include('includes/session.inc'); $title = _('Authorise Purchase Orders'); @@ -11,22 +11,22 @@ echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/transactions.png" title="' . $title . '" alt="" />' . ' ' . $title . '</p>'; -$emailsql="SELECT email FROM www_users WHERE userid='".$_SESSION['UserID']."'"; -$emailresult=DB_query($emailsql, $db); -$emailrow=DB_fetch_array($emailresult); +$EmailSQL="SELECT email FROM www_users WHERE userid='".$_SESSION['UserID']."'"; +$EmailResult=DB_query($EmailSQL, $db); +$EmailRow=DB_fetch_array($EmailResult); -if (isset($_POST['updateall'])) { +if (isset($_POST['UpdateAll'])) { foreach ($_POST as $key => $value) { if (substr($key,0,6)=='status') { - $orderno=substr($key,6); - $status=$_POST['status'.$orderno]; - $comment=date($_SESSION['DefaultDateFormat']).' - '._('Authorised by').' '.'<a href="mailto:'. - $emailrow['email'].'">'.$_SESSION['UserID'].'</a><br>'.$_POST['comment']; + $OrderNo=substr($key,6); + $Status=$_POST['status'.$OrderNo]; + $Comment=date($_SESSION['DefaultDateFormat']).' - '._('Authorised by').' '.'<a href="mailto:' . $EmailRow['email'].'">'.$_SESSION['UserID'].'</a> + <br />' . $_POST['comment']; $sql="UPDATE purchorders - SET status='".$status."', - stat_comment='".$comment."', - allowprint=1 - WHERE orderno='".$orderno."'"; + SET status='".$Status."', + stat_comment='".$Comment."', + allowprint=1 + WHERE orderno='".$OrderNo."'"; $result=DB_query($sql, $db); } } @@ -38,91 +38,98 @@ suppliers.suppname, suppliers.currcode, www_users.realname, - www_users.email - FROM purchorders - LEFT JOIN suppliers + www_users.email, + currencies.decimalplaces + FROM purchorders INNER JOIN suppliers ON suppliers.supplierid=purchorders.supplierno - LEFT JOIN www_users + INNER JOIN currencies + ON suppliers.currcode=currencies.currabrev + INNER JOIN www_users ON www_users.userid=purchorders.initiator WHERE status='Pending'"; $result=DB_query($sql, $db); echo '<form method=post action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; -echo '<table class=selection><tr>'; +echo '<table class="selection">'; /* Create the table for the purchase order header */ -echo '<th>'._('Order Number').'</th>'; -echo '<th>'._('Supplier').'</th>'; -echo '<th>'._('Date Ordered').'</th>'; -echo '<th>'._('Initiator').'</th>'; -echo '<th>'._('Delivery Date').'</th>'; -echo '<th>'._('Status').'</th>'; -echo '</tr>'; +echo '<tr> + <th>'._('Order Number').'</th> + <th>'._('Supplier').'</th> + <th>'._('Date Ordered').'</th> + <th>'._('Initiator').'</th> + <th>'._('Delivery Date').'</th> + <th>'._('Status').'</th> + </tr>'; while ($myrow=DB_fetch_array($result)) { - $authsql="SELECT authlevel FROM purchorderauth + $AuthSQL="SELECT authlevel FROM purchorderauth WHERE userid='".$_SESSION['UserID']."' AND currabrev='".$myrow['currcode']."'"; - $authresult=DB_query($authsql, $db); - $myauthrow=DB_fetch_array($authresult); - $authlevel=$myauthrow['authlevel']; + $AuthResult=DB_query($AuthSQL, $db); + $myauthrow=DB_fetch_array($AuthResult); + $AuthLevel=$myauthrow['authlevel']; - $ordervaluesql="SELECT sum(unitprice*quantityord) as ordervalue + $OrderValueSQL="SELECT sum(unitprice*quantityord) as ordervalue FROM purchorderdetails WHERE orderno='".$myrow['orderno'] . "'"; - $ordervalueresult=DB_query($ordervaluesql, $db); - $myordervaluerow=DB_fetch_array($ordervalueresult); - $ordervalue=$myordervaluerow['ordervalue']; + $OrderValueResult=DB_query($OrderValueSQL, $db); + $MyOrderValueRow=DB_fetch_array($OrderValueResult); + $OrderValue=$MyOrderValueRow['ordervalue']; - if ($authlevel>=$ordervalue) { - echo '<tr>'; - echo '<td>'.$myrow['orderno'].'</td>'; - echo '<td>'.$myrow['suppname'].'</td>'; - echo '<td>'.ConvertSQLDate($myrow['orddate']).'</td>'; - echo '<td><a href="mailto:'.$myrow['email'].'">'.$myrow['realname'].'</td>'; - echo '<td>'.ConvertSQLDate($myrow['deliverydate']).'</td>'; - echo '<td><select name=status'.$myrow['orderno'].'>'; - echo '<option selected value="Pending">'._('Pending').'</option>'; - echo '<option value="Authorised">'._('Authorised').'</option>'; - echo '<option value="Rejected">'._('Rejected').'</option>'; - echo '<option value="Cancelled">'._('Cancelled').'</option>'; - echo '</select></td>'; - echo '</tr>'; + if ($AuthLevel>=$OrderValue) { + echo '<tr> + <td>'.$myrow['orderno'].'</td> + <td>'.$myrow['suppname'].'</td> + <td>'.ConvertSQLDate($myrow['orddate']).'</td> + <td><a href="mailto:'.$myrow['email'].'">'.$myrow['realname'].'</td> + <td>'.ConvertSQLDate($myrow['deliverydate']).'</td> + <td><select name=status'.$myrow['orderno'].'> + <option selected value="Pending">'._('Pending').'</option> + <option value="Authorised">'._('Authorised').'</option> + <option value="Rejected">'._('Rejected').'</option> + <option value="Cancelled">'._('Cancelled').'</option> + </select></td> + </tr>'; echo "<input type='hidden' name='comment' value='".$myrow['stat_comment']."'>"; - $linesql="SELECT purchorderdetails.*, + $LineSQL="SELECT purchorderdetails.*, stockmaster.description FROM purchorderdetails LEFT JOIN stockmaster ON stockmaster.stockid=purchorderdetails.itemcode WHERE orderno='".$myrow['orderno'] . "'"; - $lineresult=DB_query($linesql, $db); + $LineResult=DB_query($LineSQL, $db); - echo '<tr><td></td><td colspan=5 align=left><table class=selection align=left>'; - echo '<th>'._('Product').'</th>'; - echo '<th>'._('Quantity Ordered').'</th>'; - echo '<th>'._('Currency').'</th>'; - echo '<th>'._('Price').'</th>'; - echo '<th>'._('Line Total').'</th>'; - echo '</tr>'; + echo '<tr> + <td></td> + <td colspan="5" align="left"> + <table class="selection" align="left"> + <tr> + <th>'._('Product').'</th> + <th>'._('Quantity Ordered').'</th> + <th>'._('Currency').'</th> + <th>'._('Price').'</th> + <th>'._('Line Total').'</th> + </tr>'; - while ($linerow=DB_fetch_array($lineresult)) { - echo '<tr>'; - echo '<td>'.$linerow['description'].'</td>'; - echo '<td class="number">'.number_format($linerow['quantityord'],2).'</td>'; - echo '<td>'.$myrow['currcode'].'</td>'; - echo '<td class="number">'.number_format($linerow['unitprice'],2).'</td>'; - echo '<td class="number">'.number_format($linerow['unitprice']*$linerow['quantityord'],2).'</td>'; - echo '</tr>'; + while ($linerow=DB_fetch_array($LineResult)) { + echo '<tr> + <td>'.$linerow['description'].'</td> + <td class="number">'.number_format($linerow['quantityord'],2).'</td> + <td>'.$myrow['currcode'].'</td> + <td class="number">'.number_format($linerow['unitprice'],$myrow['decimalplaces']).'</td> + <td class="number">'.number_format($linerow['unitprice']*$linerow['quantityord'],$myrow['decimalplaces']).'</td> + </tr>'; } // end while order line detail echo '</table></td></tr>'; } } //end while header loop echo '</table>'; -echo '<br><div class="centre"><input type="submit" name="updateall" value="' . _('Update'). '"></form>'; +echo '<br><div class="centre"><input type="submit" name="UpdateAll" value="' . _('Update'). '"></form>'; include('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/PO_SelectPurchOrder.php =================================================================== --- trunk/PO_SelectPurchOrder.php 2011-05-11 10:03:40 UTC (rev 4564) +++ trunk/PO_SelectPurchOrder.php 2011-05-13 10:50:42 UTC (rev 4565) @@ -1,6 +1,6 @@ <?php /* $Id$*/ -//$PageSecurity = 2; + include ('includes/session.inc'); $title = _('Search Purchase Orders'); include ('includes/header.inc'); @@ -110,14 +110,14 @@ while ($myrow = DB_fetch_array($resultStkLocs)) { if (isset($_POST['StockLocation'])) { if ($myrow['loccode'] == $_POST['StockLocation']) { - echo '<option selected Value="' . $myrow['loccode'] . '">' . $myrow['locationname']; + echo '<option selected Value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } else { - echo '<option Value="' . $myrow['loccode'] . '">' . $myrow['locationname']; + echo '<option Value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } } elseif ($myrow['loccode'] == $_SESSION['UserStockLocation']) { - echo '<option selected Value="' . $myrow['loccode'] . '">' . $myrow['locationname']; + echo '<option selected Value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } else { - echo '<option Value="' . $myrow['loccode'] . '">' . $myrow['locationname']; + echo '<option Value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } } echo '</select> ' . _('Order Status:') .' <select name="Status">'; @@ -160,9 +160,9 @@ echo '<tr><td><font size=1>' . _('Select a stock category') . ':</font><select name="StockCat">'; while ($myrow1 = DB_fetch_array($result1)) { if (isset($_POST['StockCat']) and $myrow1['categoryid'] == $_POST['StockCat']) { - echo "<option selected value='" . $myrow1['categoryid'] . "'>" . $myrow1['categorydescription']; + echo '<option selected value="' . $myrow1['categoryid'] . '">' . $myrow1['categorydescription'] . '</option>'; } else { - echo "<option value='" . $myrow1['categoryid'] . "'>" . $myrow1['categorydescription']; + echo '<option value="' . $myrow1['categoryid'] . '">' . $myrow1['categorydescription'] . '</option>'; } } echo '</select><td><font size=1>' . _('Enter text extracts in the') . ' <b>' . _('description') . '</b>:</font></td>'; @@ -191,12 +191,12 @@ echo '<tr bgcolor="#EEEEEE">'; $k = 1; } - echo "<td><input type=submit name='SelectedStockItem' value='" . $myrow['stockid'] . "'</td> - <td>" . $myrow['description'] . "</td> - <td class=number>" . $myrow['qoh'] . "</td> - <td class=number>" . $myrow['qord'] . "</td> - <td>" . $myrow['units'] . "</td> - </tr>"; + echo '<td><input type="submit" name="SelectedStockItem" value="' . $myrow['stockid'] . '"</td> + <td>' . $myrow['description'] . '</td> + <td class=number>' . $myrow['qoh'] . '</td> + <td class=number>' . $myrow['qord'] . '</td> + <td>' . $myrow['units'] . '</td> + </tr>'; $j++; if ($j == 12) { $j = 1; @@ -234,14 +234,25 @@ purchorders.allowprint, purchorders.status, suppliers.currcode, + currencies.decimalplaces, SUM(purchorderdetails.unitprice*purchorderdetails.quantityord) AS ordervalue - FROM purchorders, - purchorderdetails, - suppliers - WHERE purchorders.orderno = purchorderdetails.orderno - AND purchorders.supplierno = suppliers.supplierid - AND purchorders.orderno='" . $OrderNumber . "' - GROUP BY purchorders.orderno"; + FROM purchorders + INNER JOIN purchorderdetails + ON purchorders.orderno = purchorderdetails.orderno + INNER JOIN suppliers + ON purchorders.supplierno = suppliers.supplierid + INNER JOIN currencies + ON suppliers.currcode=currencies.currabrev + WHERE purchorders.orderno='" . $OrderNumber . "' + GROUP BY purchorders.orderno, + suppliers.suppname, + purchorders.orddate, + purchorders.initiator, + purchorders.requisitionno, + purchorders.allowprint, + purchorders.status, + suppliers.currcode, + currencies.decimalplaces"; } else { /* $DateAfterCriteria = FormatDateforSQL($OrdersAfterDate); */ if (empty($_POST['StockLocation'])) { @@ -257,13 +268,16 @@ purchorders.allowprint, purchorders.status, suppliers.currcode, + currencies.decimalplaces, SUM(purchorderdetails.unitprice*purchorderdetails.quantityord) AS ordervalue - FROM purchorders, - purchorderdetails, - suppliers - WHERE purchorders.orderno = purchorderdetails.orderno - AND purchorders.supplierno = suppliers.supplierid - AND purchorderdetails.itemcode='" . $SelectedStockItem . "' + FROM purchorders + INNER JOIN purchorderdetails + ON purchorders.orderno = purchorderdetails.orderno + INNER JOIN suppliers + ON purchorders.supplierno = suppliers.supplierid + INNER JOIN currencies + ON suppliers.currcode=currencies.currabrev + WHERE purchorderdetails.itemcode='" . $SelectedStockItem . "' AND purchorders.supplierno='" . $SelectedSupplier . "' AND purchorders.intostocklocation = '" . $_POST['StockLocation'] . "' " . $StatusCriteria . " @@ -273,7 +287,8 @@ purchorders.initiator, purchorders.requisitionno, purchorders.allowprint, - suppliers.currcode"; + suppliers.currcode, + currencies.decimalplaces"; } else { $SQL = "SELECT purchorders.orderno, suppliers.suppname, @@ -283,13 +298,16 @@ purchorders.allowprint, purchorders.status, suppliers.currcode, + currencies.decimalplaces, SUM(purchorderdetails.unitprice*purchorderdetails.quantityord) AS ordervalue - FROM purchorders, - purchorderdetails, - suppliers - WHERE purchorders.orderno = purchorderdetails.orderno - AND purchorders.supplierno = suppliers.supplierid - AND purchorders.supplierno='" . $SelectedSupplier . "' + FROM purchorders + INNER JOIN purchorderdetails + ON purchorders.orderno = purchorderdetails.orderno + INNER JOIN suppliers + ON purchorders.supplierno = suppliers.supplierid + INNER JOIN currencies + ON suppliers.currcode=currencies.currabrev + WHERE purchorders.supplierno='" . $SelectedSupplier . "' AND purchorders.intostocklocation = '" . $_POST['StockLocation'] . "' " . $StatusCriteria . " GROUP BY purchorders.orderno, @@ -298,7 +316,8 @@ purchorders.initiator, purchorders.requisitionno, purchorders.allowprint, - suppliers.currcode"; + suppliers.currcode, + currencies.decimalplaces"; } } else { //no supplier selected if (isset($SelectedStockItem)) { @@ -310,13 +329,16 @@ purchorders.allowprint, purchorders.status, suppliers.currcode, + currencies.decimalplaces, SUM(purchorderdetails.unitprice*purchorderdetails.quantityord) AS ordervalue - FROM purchorders, - purchorderdetails, - suppliers - WHERE purchorders.orderno = purchorderdetails.orderno - AND purchorders.supplierno = suppliers.supplierid - AND purchorderdetails.itemcode='" . $SelectedStockItem . "' + FROM purchorders + INNER JOIN purchorderdetails + ON purchorders.orderno = purchorderdetails.orderno + INNER JOIN suppliers + ON purchorders.supplierno = suppliers.supplierid + INNER JOIN currencies + ON suppliers.currcode=currencies.currabrev + WHERE purchorderdetails.itemcode='" . $SelectedStockItem . "' AND purchorders.intostocklocation = '" . $_POST['StockLocation'] . "' " . $StatusCriteria . " GROUP BY purchorders.orderno, @@ -325,7 +347,8 @@ purchorders.initiator, purchorders.requisitionno, purchorders.allowprint, - suppliers.currcode"; + suppliers.currcode, + currencies.decimalplaces"; } else { $SQL = "SELECT purchorders.orderno, suppliers.suppname, @@ -335,13 +358,16 @@ purchorders.allowprint, purchorders.status, suppliers.currcode, + currencies.decimalplaces, sum(purchorderdetails.unitprice*purchorderdetails.quantityord) as ordervalue - FROM purchorders, - purchorderdetails, - suppliers - WHERE purchorders.orderno = purchorderdetails.orderno - AND purchorders.supplierno = suppliers.supplierid - AND purchorders.intostocklocation = '" . $_POST['StockLocation'] . "' + FROM purchorders + INNER JOIN purchorderdetails + ON purchorders.orderno = purchorderdetails.orderno + INNER JOIN suppliers + ON purchorders.supplierno = suppliers.supplierid + INNER JOIN currencies + ON suppliers.currcode=currencies.currabrev + WHERE purchorders.intostocklocation = '" . $_POST['StockLocation'] . "' " . $StatusCriteria . " GROUP BY purchorders.orderno, suppliers.suppname, @@ -349,7 +375,8 @@ purchorders.initiator, purchorders.requisitionno, purchorders.allowprint, - suppliers.currcode"; + suppliers.currcode, + currencies.decimalplaces"; } } //end selected supplier @@ -360,15 +387,16 @@ if (DB_num_rows($PurchOrdersResult) > 0) { /*show a table of the orders returned by the SQL */ echo '<table cellpadding=2 colspan=7 width=90% class=selection>'; - $TableHeader = '<tr><th>' . _('View') . '</th> - <th>' . _('Supplier') . '</th> - <th>' . _('Currency') . '</th> - <th>' . _('Requisition') . '</th> - <th>' . _('Order Date') . '</th> - <th>' . _('Initiator') . '</th> - <th>' . _('Order Total') . '</th> - <th>' . _('Status') . '</th> - </tr>'; + $TableHeader = '<tr> + <th>' . _('View') . '</th> + <th>' . _('Supplier') . '</th> + <th>' . _('Currency') . '</th> + <th>' . _('Requisition') . '</th> + <th>' . _('Order Date') . '</th> + <th>' . _('Initiator') . '</th> + <th>' . _('Order Total') . '</th> + <th>' . _('Status') . '</th> + </tr>'; echo $TableHeader; $j = 1; $k = 0; //row colour counter @@ -380,9 +408,9 @@ echo '<tr bgcolor="#EEEEEE">'; $k++; } - $ViewPurchOrder = $rootpath . '/PO_OrderDetails.php?' . SID . 'OrderNo=' . $myrow['orderno']; + $ViewPurchOrder = $rootpath . '/PO_OrderDetails.php?OrderNo=' . $myrow['orderno']; $FormatedOrderDate = ConvertSQLDate($myrow['orddate']); - $FormatedOrderValue = number_format($myrow['ordervalue'], 2); + $FormatedOrderValue = number_format($myrow['ordervalue'], $myrow['decimalplaces']); /* View Supplier Currency Requisition Order Date Initiator Order Total ModifyPage, $myrow["orderno"], $myrow["suppname"], $myrow["currcode"], $myrow["requisitionno"] $FormatedOrderDate, $myrow["initiator"] $FormatedOrderValue Order Status*/ echo '<td><a href="' . $ViewPurchOrder . '">' . $myrow['orderno'] . '</a></td> Modified: trunk/Payments.php =================================================================== --- trunk/Payments.php 2011-05-11 10:03:40 UTC (rev 4564) +++ trunk/Payments.php 2011-05-13 10:50:42 UTC (rev 4565) @@ -231,10 +231,10 @@ } /*Make an array of the defined bank accounts */ - $SQL = 'SELECT bankaccounts.accountcode + $SQL = "SELECT bankaccounts.accountcode FROM bankaccounts, chartmaster - WHERE bankaccounts.accountcode=chartmaster.accountcode'; + WHERE bankaccounts.accountcode=chartmaster.accountcode"; $result = DB_query($SQL,$db); $BankAccounts = array(); $i=0; @@ -270,8 +270,8 @@ } else { //Start a transaction to do the whole lot inside - $SQL = 'BEGIN'; - $result = DB_query($SQL,$db); + + $result = DB_Txn_Begin($db); if ($_SESSION['PaymentDetail']->SupplierID=='') { @@ -643,7 +643,7 @@ } else if ($_POST['GLCode'] == '') { prnMsg( _('No General Ledger code has been chosen') . ' - ' . _('so this GL analysis item could not be added'),'warn'); } else { - $SQL = "select accountname FROM chartmaster WHERE accountcode='" . $_POST['GLCode'] . "'"; + $SQL = "SELECT accountname FROM chartmaster WHERE accountcode='" . $_POST['GLCode'] . "'"; $Result=DB_query($SQL,$db); $myrow=DB_fetch_array($Result); $_SESSION['PaymentDetail']->add_to_glanalysis($_POST['GLAmount'], @@ -702,7 +702,7 @@ } -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'] . '" />'; Modified: trunk/PcAssignCashToTab.php =================================================================== --- trunk/PcAssignCashToTab.php 2011-05-11 10:03:40 UTC (rev 4564) +++ trunk/PcAssignCashToTab.php 2011-05-13 10:50:42 UTC (rev 4565) @@ -49,8 +49,8 @@ } $sqlLimit = "SELECT tablimit - FROM pctabs - WHERE tabcode='" . $SelectedTabs . "'"; + FROM pctabs + WHERE tabcode='" . $SelectedTabs . "'"; $ResultLimit = DB_query($sqlLimit,$db); $Limit=DB_fetch_array($ResultLimit); @@ -63,10 +63,10 @@ $sql = "UPDATE pcashdetails SET date = '".FormatDateForSQL($_POST['Date'])."', - amount = '" . $_POST['Amount'] . "', - authorized = '0000-00-00', - notes = '" . $_POST['Notes'] . "', - receipt = '" . $_POST['Receipt'] . "' + amount = '" . $_POST['Amount'] . "', + authorized = '0000-00-00', + notes = '" . $_POST['Notes'] . "', + receipt = '" . $_POST['Receipt'] . "' WHERE counterindex = '" . $SelectedIndex . "'"; $msg = _('Assignment of cash to PC Tab ') . ' ' . $SelectedTabs . ' ' . _('has been updated'); @@ -163,7 +163,7 @@ echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/money_add.png" title="' . _('Search') . '" alt="" />' . ' ' . $title. '</p>'; } - echo '<p><div class="centre"><a href="' . $_SERVER['PHP_SELF'] . '?' . SID . '">' . _('Details Of Petty Cash Tab ') . '' .$SelectedTabs. '<a/></div>'; + echo '<p><div class="centre"><a href="' . $_SERVER['PHP_SELF'] . '">' . _('Details Of Petty Cash Tab ') . '' .$SelectedTabs. '<a/></div>'; if (! isset($_GET['edit']) OR isset ($_POST['GO'])){ @@ -263,7 +263,7 @@ } echo '<tr><td colspan="2" style="text-align:right"><b>' . _('Current balance') . ':</b></td> - <td>' . number_format($Amount['0'],2) . '</td></tr>'; + <td>' . number_format($Amount['0'],2) . '</td></tr>'; echo '</table>'; @@ -277,7 +277,7 @@ echo '<form method="post" action="' . $_SERVER['PHP_SELF'] .'">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<p><table class=selection>'; //Main table + echo '<p><table class="selection">'; //Main table if (isset($_GET['SelectedIndex'])) { echo '<tr><th colspan="2"><font color=blue size=3>'._('Update Cash Assignment').'</font></th></tr>'; } else { Modified: trunk/PcClaimExpensesFromTab.php =================================================================== --- trunk/PcClaimExpensesFromTab.php 2011-05-11 10:03:40 UTC (rev 4564) +++ trunk/PcClaimExpensesFromTab.php 2011-05-13 10:50:42 UTC (rev 4565) @@ -43,7 +43,7 @@ if ($_POST['amount']==0) { $InputError = 1; - prnMsg('<br>' . _('The Amount must be greater than 0'),'error'); + prnMsg( _('The Amount must be greater than 0'),'error'); $Errors[$i] = 'TabCode'; $i++; } @@ -83,7 +83,7 @@ '" . $_POST['Receipt'] . "' )"; - $msg = _('The Expense Claim on Tab') . ' ' . $_POST["SelectedTabs"] . ' ' . _('has been created'); + $msg = _('The Expense Claim on Tab') . ' ' . $_POST['SelectedTabs'] . ' ' . _('has been created'); } if ( $InputError !=1) { @@ -154,7 +154,7 @@ //end of ifs and buts! if (isset($_POST['process'])OR isset($SelectedTabs)) { - echo '<p><div class="centre"><a href="' . $_SERVER['PHP_SELF'] . '?' . SID . '">' . _('Petty Cash Tab ') . '' .$SelectedTabs. '<a/></div><p>'; + echo '<p><div class="centre"><a href="' . $_SERVER['PHP_SELF'] . '">' . _('Petty Cash Tab ') . '' .$SelectedTabs. '<a/></div><p>'; /* RICARD */ if (! isset($_GET['edit']) OR isset ($_POST['GO'])){ echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; @@ -186,13 +186,13 @@ echo '<br><table border=1>'; echo '<tr> - <th>' . _('Date Of Expense') . '</th> - <th>' . _('Expense Description') . '</th> - <th>' . _('Amount') . '</th> - <th>' . _('Authorized') . '</th> - <th>' . _('Notes') . '</th> - <th>' . _('Receipt') . '</th> - </tr>'; + <th>' . _('Date Of Expense') . '</th> + <th>' . _('Expense Description') . '</th> + <th>' . _('Amount') . '</th> + <th>' . _('Authorized') . '</th> + <th>' . _('Notes') . '</th> + <th>' . _('Receipt') . '</th> + </tr>'; $k=0; //row colour counter @@ -216,17 +216,17 @@ $Description['0']='ASSIGNCASH'; } - if (($myrow['5'] == "0000-00-00") and ($Description['0'] != 'ASSIGNCASH')){ + if (($myrow['5'] == '0000-00-00') and ($Description['0'] != 'ASSIGNCASH')){ // only movements NOT authorized can be modified or deleted - printf("<td>%s</td> + printf('<td>%s</td> <td>%s</td> <td class=number>%s</td> <td>%s</td> <td>%s</td> <td>%s</td> - <td><a href='%sSelectedIndex=%s&SelectedTabs=$SelectedTabs&Days=$Days&edit=yes'>" . _('Edit') . "</td> - <td><a href='%sSelectedIndex=%s&SelectedTabs=$SelectedTabs&Days=$Days&delete=yes' onclick=\"return confirm('" . _('Are you sure you wish to delete this code and the expense it may have set up?') . "');\">" . _('Delete') . "</td> - </tr>", + <td><a href="%sSelectedIndex=%s&SelectedTabs=' . $SelectedTabs . '&Days=' . $Days . '&edit=yes">' . _('Edit') . '</td> + <td><a href="%sSelectedIndex=%s&SelectedTabs=' . $SelectedTabs . '&Days=' . $Days . '&delete=yes" onclick=\'return confirm("' . _('Are you sure you wish to delete this code and the expenses it may have set up?') . '");\'>' . _('Delete') . '</td> + </tr>', ConvertSQLDate($myrow['2']), $Description['0'], number_format($myrow['4'],2), @@ -236,13 +236,13 @@ $_SERVER['PHP_SELF'] . '?', $myrow['0'], $_SERVER['PHP_SELF'] . '?', $myrow['0']); } else { - printf("<td>%s</td> + printf('<td>%s</td> <td>%s</td> <td class=number>%s</td> <td>%s</td> <td>%s</td> <td>%s</td> - </tr>", + </tr>', ConvertSQLDate($myrow['2']), $Description['0'], number_format($myrow['4'],2), @@ -325,7 +325,7 @@ if (isset($_POST['SelectedExpense']) and $myrow['codeexpense']==$_POST['SelectedExpense']) { echo '<option selected value="'; } else { - echo '<option VALUE="'; + echo '<option value="'; } echo $myrow['codeexpense'] . '">' . $myrow['codeexpense'] . ' - ' . $myrow['description'] . '</option>'; @@ -357,7 +357,7 @@ echo '<input type="hidden" name="Days" value="' .$Days. '">'; echo '</table>'; // close table in first column echo '</td></tr></table>'; // close main table - echo '<p><div class="centre"><input type=submit name=submit VALUE="' . _('Accept') . '"><in... [truncated message content] |
From: <dai...@us...> - 2011-05-14 11:24:31
|
Revision: 4566 http://web-erp.svn.sourceforge.net/web-erp/?rev=4566&view=rev Author: daintree Date: 2011-05-14 11:24:22 +0000 (Sat, 14 May 2011) Log Message: ----------- various Modified Paths: -------------- trunk/COGSGLPostings.php trunk/ContractBOM.php trunk/CreditStatus.php trunk/CustomerBranches.php trunk/CustomerInquiry.php trunk/CustomerReceipt.php trunk/DailyBankTransactions.php trunk/FTP_RadioBeacon.php trunk/FreightCosts.php trunk/POReport.php trunk/PageSecurity.php trunk/Prices.php trunk/StockQties_csv.php trunk/StockTransfers.php trunk/SupplierCredit.php trunk/TaxCategories.php trunk/doc/Change.log Modified: trunk/COGSGLPostings.php =================================================================== --- trunk/COGSGLPostings.php 2011-05-13 10:50:42 UTC (rev 4565) +++ trunk/COGSGLPostings.php 2011-05-14 11:24:22 UTC (rev 4566) @@ -92,7 +92,7 @@ </tr>'; $k=0; //row colour counter - while ($myrow = DB_fetch_row($result)) { + while ($myrow = DB_fetch_array($result)) { if ($k==1){ echo '<tr class="EvenTableRows">'; $k=0; @@ -106,24 +106,24 @@ <td>%s</td> <td>%s</td> <td><a href="%sSelectedCOGSPostingID=%s">' . _('Edit') . '</td> - <td><a href="%sSelectedCOGSPostingID=%s&delete=yes">'. _('Delete') . '</td></tr>', - $myrow[1], - $myrow[2], - $myrow[3], - $myrow[4], + <td><a href="%sSelectedCOGSPostingID=%s&delete=yes" onclick="return confirm(\'' . _('Are you sure you wish to delete this COGS GL posting record?') . '\');">'. _('Delete') . '</td></tr>', + $myrow['area'], + $myrow['stkcat'], + $myrow['salestype'], + $myrow['accountname'], $_SERVER['PHP_SELF'] . '?', - $myrow[0], + $myrow['id'], $_SERVER['PHP_SELF']. '?', - $myrow[0]); + $myrow['id']); }//end while echo '</table>'; } $sql = "SELECT cogsglpostings.id, - cogsglpostings.area, - cogsglpostings.stkcat, - cogsglpostings.salestype - FROM cogsglpostings"; + cogsglpostings.area, + cogsglpostings.stkcat, + cogsglpostings.salestype + FROM cogsglpostings"; $result = DB_query($sql,$db); @@ -147,7 +147,7 @@ $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 */ @@ -195,7 +195,7 @@ <th>' . _('GL Account') . '</th> </tr>'; $k = 0; - while ($myrow = DB_fetch_row($result)) { + while ($myrow = DB_fetch_array($result)) { if ($k==1){ echo '<tr class="EvenTableRows">'; $k=0; @@ -211,14 +211,14 @@ <td><a href="%sSelectedCOGSPostingID=%s">' . _('Edit') . '</td> <td><a href="%sSelectedCOGSPostingID=%s&delete=yes">' . _('Delete') . '</td> </tr>', - $myrow[1], - $myrow[2], - $myrow[3], - $myrow[4], + $myrow['area'], + $myrow['stkcat'], + $myrow['salestype'], + $myrow['salestype'], $_SERVER['PHP_SELF'] . '?', - $myrow[0], + $myrow['id'], $_SERVER['PHP_SELF'] . '?', - $myrow[0]); + $myrow['id']); }//END WHILE LIST LOOP echo '</table>'; @@ -305,7 +305,7 @@ echo '</select></td></tr> <tr><td>' . _('Sales Type') . ' / ' . _('Price List') . ':</td> <td><select tabindex=3 name="SalesType"> - <option VALUE="AN">' . _('Any Other') . '</option>'; + <option value="AN">' . _('Any Other') . '</option>'; while ($myrow = DB_fetch_array($result)) { if (isset($_POST['SalesType']) and $myrow['typeabbrev']==$_POST['SalesType']) { Modified: trunk/ContractBOM.php =================================================================== --- trunk/ContractBOM.php 2011-05-13 10:50:42 UTC (rev 4565) +++ trunk/ContractBOM.php 2011-05-14 11:24:22 UTC (rev 4566) @@ -323,8 +323,7 @@ <td><input type="text" name="StockCode" size="15" maxlength="18" value="' . $_POST['StockCode'] . '" /></td> </tr> <tr><td></td> - <td><font size="3"><b>' . _('OR') . ' </b></font><font size="2"><a target="_blank" href="'.$rootpath.'/Stocks.php?' . SID . - '">' . _('Create a New Stock Item') . '</a></font></td></tr> + <td><font size="3"><b>' . _('OR') . ' </b></font><font size="2"><a target="_blank" href="'.$rootpath.'/Stocks.php">' . _('Create a New Stock Item') . '</a></font></td></tr> </table><br /> <div class="centre"><input type="submit" name="Search" value="' . _('Search Now') . '" /> </div><br />'; Modified: trunk/CreditStatus.php =================================================================== --- trunk/CreditStatus.php 2011-05-13 10:50:42 UTC (rev 4565) +++ trunk/CreditStatus.php 2011-05-14 11:24:22 UTC (rev 4566) @@ -1,8 +1,7 @@ <?php -/* $Revision: 1.16 $ */ + /* $Id$*/ -//$PageSecurity = 3; include('includes/session.inc'); $title = _('Credit Status Code Maintenance'); include('includes/header.inc'); @@ -127,7 +126,7 @@ } else { //only delete if used in neither customer or supplier accounts - $sql="DELETE FROM holdreasons WHERE reasoncode=$SelectedReason"; + $sql="DELETE FROM holdreasons WHERE reasoncode='" . $SelectedReason . "'"; $result = DB_query($sql,$db); prnMsg(_('This credit status code has been deleted'),'success'); } @@ -154,9 +153,9 @@ <th>'. _('Disallow Invoices') .'</th>'; $k=0; //row colour counter - while ($myrow=DB_fetch_row($result)) { + while ($myrow=DB_fetch_array($result)) { - if ($myrow[2]==0) { + if ($myrow['dissallowinvoices']==0) { $DissallowText = _('Invoice OK'); } else { $DissallowText = '<b>'. _('NO INVOICING') .'</b>'; @@ -169,20 +168,20 @@ $k=1; } - printf("<td>%s</td> - <td>%s</td> - <td>%s</td> - <td><a href=\"%s?SelectedReason=%s\">" . _('Edit') . "</a></td> - <td><a href=\"%s?SelectedReason=%s&delete=1\">". _('Delete') .'</a></td> - </tr>', - $myrow[0], - $myrow[1], - $DissallowText, - $_SERVER['PHP_SELF'], - $myrow[0], - $_SERVER['PHP_SELF'], - $myrow[0]); - + printf('<td>%s</td> + <td>%s</td> + <td>%s</td> + <td><a href="%s?SelectedReason=%s">' . _('Edit') . '</a></td> + <td><a href="%s?SelectedReason=%s&delete=1" onclick="return confirm(\'' . _('Are you sure you wish to delete this credit stuatus record?') . '\');">'. _('Delete') .'</a></td> + </tr>', + $myrow['reasoncode'], + $myrow['reasondescription'], + $DissallowText, + $_SERVER['PHP_SELF'], + $myrow['reasoncode'], + $_SERVER['PHP_SELF'], + $myrow['reasoncode']); + } //END WHILE LIST LOOP echo '</table>'; @@ -213,9 +212,9 @@ $_POST['ReasonDescription'] = $myrow['reasondescription']; $_POST['DisallowInvoices'] = $myrow['dissallowinvoices']; - echo "<input type=hidden name='SelectedReason' VALUE='" . $SelectedReason . "'>"; - echo "<input type=hidden name='ReasonCode' VALUE='" . $_POST['ReasonCode'] . "'>"; - echo "<table class=selection><tr><td>". _('Status Code') .':</td><td>'; + echo '<input type="hidden" name="SelectedReason" value="' . $SelectedReason . '">'; + echo '<input type="hidden" name="ReasonCode" value="' . $_POST['ReasonCode'] . '">'; + echo '<table class="selection"><tr><td>'. _('Status Code') .':</td><td>'; echo $_POST['ReasonCode'] . '</td></tr>'; } else { //end of if $SelectedReason only do the else when a new record is being entered @@ -224,10 +223,9 @@ } echo '<br><table class=selection> <tr> - <td>'. _('Status Code') .":</td> - <td><input " . (in_array('ReasonCode',$Errors) ? 'class="inputerror"' : '' ) . - " tabindex=1 type='Text' name='ReasonCode' VALUE='". $_POST['ReasonCode'] ."' size=3 maxlength=2></td> - </tr>"; + <td>'. _('Status Code') .':</td> + <td><input ' . (in_array('ReasonCode',$Errors) ? 'class="inputerror"' : '' ) . ' tabindex=1 type="text" name="ReasonCode" value="'. $_POST['ReasonCode'] .'" size=3 maxlength=2></td> + </tr>'; } if (!isset($_POST['ReasonDescription'])) { @@ -247,4 +245,4 @@ echo '</table><br><div class="centre"><input tabindex=4 type="submit" name="submit" value="' . _('Enter Information') . '"></div></form>'; } //end if record deleted no point displaying form to add record include('includes/footer.inc'); -?> +?> \ No newline at end of file Modified: trunk/CustomerBranches.php =================================================================== --- trunk/CustomerBranches.php 2011-05-13 10:50:42 UTC (rev 4565) +++ trunk/CustomerBranches.php 2011-05-14 11:24:22 UTC (rev 4566) @@ -97,8 +97,8 @@ $row = DB_fetch_array($resultgeo); $api_key = $row['geocode_key']; $map_host = $row['map_host']; - define("MAPS_HOST", $map_host); - define("KEY", $api_key); + define('MAPS_HOST', $map_host); + define('KEY', $api_key); if ($map_host=="") { // check that some sane values are setup already in geocode tables, if not skip the geocoding but add the record anyway. echo '<div class="warn">' . _('Warning - Geocode Integration is enabled, but no hosts are setup. Go to Geocode Setup') . '</div>'; @@ -417,8 +417,12 @@ $DebtorNo, urlencode($myrow[1]), _('Delete Branch')); - if ($myrow[11]){ $TotalDisable++; } - else { $TotalEnable++; } + + if ($myrow[11]){ + $TotalDisable++; + }else { + $TotalEnable++; + } } while ($myrow = DB_fetch_row($result)); //END WHILE LIST LOOP @@ -628,9 +632,9 @@ while ($myrow = DB_fetch_array($result)) { if (isset($_POST['Salesman']) and $myrow['salesmancode']==$_POST['Salesman']) { - echo '<option selected VALUE='; + echo '<option selected value='; } else { - echo '<option VALUE='; + echo '<option value='; } echo $myrow['salesmancode'] . '>' . $myrow['salesmanname']; @@ -654,11 +658,11 @@ echo '<td><select tabindex=14 name="Area">'; 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']; } //end while loop @@ -666,7 +670,7 @@ echo '</select></td></tr>'; DB_data_seek($result,0); - $sql = 'SELECT loccode, locationname FROM locations'; + $sql = "SELECT loccode, locationname FROM locations"; $result = DB_query($sql,$db); if (DB_num_rows($result)==0){ @@ -682,11 +686,11 @@ while ($myrow = DB_fetch_array($result)) { if (isset($_POST['DefaultLocation']) and $myrow['loccode']==$_POST['DefaultLocation']) { - echo '<option selected value='; + echo '<option selected value="'; } else { - echo '<option value='; + echo '<option value="'; } - echo $myrow['loccode'] . '>' . $myrow['locationname'] . '</option>'; + echo $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } //end while loop @@ -714,11 +718,11 @@ while ($myrow = DB_fetch_array($result)) { if (isset($_POST['TaxGroup']) and $myrow['taxgroupid']==$_POST['TaxGroup']) { - echo '<option selected VALUE='; + echo '<option selected value="'; } else { - echo '<option VALUE='; + echo '<option value="'; } - echo $myrow['taxgroupid'] . '>' . $myrow['taxgroupdescription'] . '</option>'; + echo $myrow['taxgroupid'] . '">' . $myrow['taxgroupdescription'] . '</option>'; } //end while loop @@ -779,7 +783,7 @@ if (!isset($_POST['CustBranchCode'])) {$_POST['CustBranchCode']='';} echo '<td><input tabindex=27 type="Text" name="CustBranchCode" size=31 maxlength=30 value="'. $_POST['CustBranchCode'].'"></td></tr>'; echo '</table>'; - echo '<br /><div class="centre"><input tabindex=28 type="Submit" name="submit" value="' . _('Enter Branch') . '"></div>'; + echo '<br /><div class="centre"><input tabindex=28 type="submit" name="submit" value="' . _('Enter Branch') . '"></div>'; echo '</form>'; } //end if record deleted no point displaying form to add record Modified: trunk/CustomerInquiry.php =================================================================== --- trunk/CustomerInquiry.php 2011-05-13 10:50:42 UTC (rev 4565) +++ trunk/CustomerInquiry.php 2011-05-14 11:24:22 UTC (rev 4566) @@ -1,12 +1,9 @@ <?php -/* $Revision: 1.30 $ */ /* $Id$*/ include('includes/SQL_CommonFunctions.inc'); -//$PageSecurity = 1; - include('includes/session.inc'); $title = _('Customer Inquiry'); include('includes/header.inc'); @@ -15,7 +12,7 @@ if(!isset($_GET['CustomerID']) AND !isset($_SESSION['CustomerID'])){ prnMsg(_('To display the enquiry a customer must first be selected from the customer selection screen'),'info'); - echo '<br><div class="centre"><a href="'. $rootpath . '/SelectCustomer.php?' . SID . '">' . _('Select a Customer to Inquire On') . '</a><br></div>'; + echo '<br /><div class="centre"><a href="'. $rootpath . '/SelectCustomer.php?' . SID . '">' . _('Select a Customer to Inquire On') . '</a><br /></div>'; include('includes/footer.inc'); exit; } else { @@ -37,6 +34,7 @@ $SQL = "SELECT debtorsmaster.name, currencies.currency, + currencies.decimalplaces, paymentterms.terms, debtorsmaster.creditlimit, holdreasons.dissallowinvoices, @@ -93,18 +91,21 @@ $NIL_BALANCE = True; - $SQL = "SELECT debtorsmaster.name, currencies.currency, paymentterms.terms, - debtorsmaster.creditlimit, 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 = '" . $CustomerID . "'"; - + $SQL = "SELECT debtorsmaster.name, + currencies.currency, + currencies.decimalplaces, + paymentterms.terms, + debtorsmaster.creditlimit, + holdreasons.dissallowinvoices, + holdreasons.reasondescription + FROM debtorsmaster INNER JOIN paymentterms + ON debtorsmaster.paymentterms = paymentterms.termsindicator + INNER JOIN holdreasons + ON debtorsmaster.holdreason = holdreasons.reasoncode + INNER JOIN currencies + debtorsmaster.currcode = currencies.currabrev + WHERE debtorsmaster.debtorno = '" . $CustomerID . "'"; + $ErrMsg =_('The customer details could not be retrieved by the SQL because'); $CustomerResult = DB_query($SQL,$db,$ErrMsg); @@ -123,33 +124,32 @@ echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/customer.png" title="' . _('Customer') . '" alt="" />' . ' ' . _('Customer') . ' : ' . $CustomerRecord['name'] . ' - (' . _('All amounts stated in') . - ' ' . $CustomerRecord['currency'] . ')<br><br>' . _('Terms') . ' : ' . $CustomerRecord['terms'] . '<br>' . _('Credit Limit') . + ' ' . $CustomerRecord['currency'] . ')<br /><br />' . _('Terms') . ' : ' . $CustomerRecord['terms'] . '<br />' . _('Credit Limit') . ': ' . number_format($CustomerRecord['creditlimit'],0) . ' ' . _('Credit Status') . ': ' . $CustomerRecord['reasondescription'] . '</p>'; if ($CustomerRecord['dissallowinvoices']!=0){ - echo '<br><font color=RED size=4><b>' . _('ACCOUNT ON HOLD') . '</font></b><br>'; + echo '<br /><font color=RED size=4><b>' . _('ACCOUNT ON HOLD') . '</font></b><br />'; } -echo "<table class=selection width=70%> +echo '<table class=selection width=70%> <tr> - <th width=20%>" . _('Total Balance') . "</th> - <th width=20%>" . _('Current') . "</th> - <th width=20%>" . _('Now Due') . "</th> - <th width=20%>" . $_SESSION['PastDueDays1'] . "-" . $_SESSION['PastDueDays2'] . ' ' . _('Days Overdue') . "</th> - <th width=20%>" . _('Over') . ' ' . $_SESSION['PastDueDays2'] . ' ' . _('Days Overdue') . '</th></tr>'; + <th width=20%>' . _('Total Balance') . '</th> + <th width=20%>' . _('Current') . '</th> + <th width=20%>' . _('Now Due') . '</th> + <th width=20%>' . $_SESSION['PastDueDays1'] . '-' . $_SESSION['PastDueDays2'] . ' ' . _('Days Overdue') . '</th> + <th width=20%>' . _('Over') . ' ' . $_SESSION['PastDueDays2'] . ' ' . _('Days Overdue') . '</th></tr>'; -echo '<tr><td class=number>' . number_format($CustomerRecord['balance'],2) . '</td> - <td class=number>' . number_format(($CustomerRecord['balance'] - $CustomerRecord['due']),2) . '</td> - <td class=number>' . number_format(($CustomerRecord['due']-$CustomerRecord['overdue1']),2) . '</td> - <td class=number>' . number_format(($CustomerRecord['overdue1']-$CustomerRecord['overdue2']) ,2) . '</td> - <td class=number>' . number_format($CustomerRecord['overdue2'],2) . '</td> +echo '<tr><td class=number>' . number_format($CustomerRecord['balance'],$CustomerRecord['decimalplaces']) . '</td> + <td class=number>' . number_format(($CustomerRecord['balance'] - $CustomerRecord['due']),$CustomerRecord['decimalplaces']) . '</td> + <td class=number>' . number_format(($CustomerRecord['due']-$CustomerRecord['overdue1']),$CustomerRecord['decimalplaces']) . '</td> + <td class=number>' . number_format(($CustomerRecord['overdue1']-$CustomerRecord['overdue2']) ,$CustomerRecord['decimalplaces']) . '</td> + <td class=number>' . number_format($CustomerRecord['overdue2'],$CustomerRecord['decimalplaces']) . '</td> </tr> </table>'; -echo "<br><div class='centre'><form action='" . $_SERVER['PHP_SELF'] . "' method=post>"; +echo '<br /><div class="centre"><form action="' . $_SERVER['PHP_SELF'] . '" method=post>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; -echo _('Show all transactions after') . ": <input tabindex=1 type=text class='date' alt='".$_SESSION['DefaultDateFormat']."' id='datepicker' name='TransAfterDate' Value='" . $_POST['TransAfterDate'] . "' MAXLENGTH =10 size=12>" . - " <input tabindex=2 type=submit name='Refresh Inquiry' value='" . _('Refresh Inquiry') . "'></div></form><br>"; +echo _('Show all transactions after') . ': <input tabindex=1 type=text class="date" alt="' .$_SESSION['DefaultDateFormat']. '" id="datepicker" name="TransAfterDate" Value="' . $_POST['TransAfterDate'] . '" maxlength =10 size=12>' . '<input tabindex=2 type="submit" name="Refresh Inquiry" value="' . _('Refresh Inquiry') . '"></div></form><br />'; $DateAfterCriteria = FormatDateForSQL($_POST['TransAfterDate']); @@ -186,21 +186,22 @@ echo '<table class="selection" cellpadding="2" colspan="7">'; $tableheader = '<tr> - <th>' . _('Type') . '</th> - <th>' . _('Number') . '</th> - <th>' . _('Date') . '</th> - <th>' . _('Branch') . '</th> - <th>' . _('Reference') . '</th> - <th>' . _('Comments') . '</th> - <th>' . _('Order') . '</th> - <th>' . _('Total') . '</th> - <th>' . _('Allocated') . '</th> - <th>' . _('Balance') . '</th> - <th>' . _('More Info') . '</th> - <th>' . _('More Info') . '</th> - <th>' . _('More Info') . '</th> - <th>' . _('More Info') . '</th> - <th>' . _('More Info') . '</th></tr>'; + <th>' . _('Type') . '</th> + <th>' . _('Number') . '</th> + <th>' . _('Date') . '</th> + <th>' . _('Branch') . '</th> + <th>' . _('Reference') . '</th> + <th>' . _('Comments') . '</th> + <th>' . _('Order') . '</th> + <th>' . _('Total') . '</th> + <th>' . _('Allocated') . '</th> + <th>' . _('Balance') . '</th> + <th>' . _('More Info') . '</th> + <th>' . _('More Info') . '</th> + <th>' . _('More Info') . '</th> + <th>' . _('More Info') . '</th> + <th>' . _('More Info') . '</th> + </tr>'; echo $tableheader; @@ -225,25 +226,26 @@ } $BaseFormatString = '<td>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td width="200">%s</td> - <td>%s</td> - <td class=number>%s</td> - <td class=number>%s</td> - <td class=number>%s</td>'; + <td>%s</td> + <td>%s</td> + <td>%s</td> + <td>%s</td> + <td width="200">%s</td> + <td>%s</td> + <td class=number>%s</td> + <td class=number>%s</td> + <td class=number>%s</td>'; + - $CreditInvoiceFormatString = '<td><a href="%s/Credit_Invoice.php?InvoiceNumber=%s">' . _('Credit ') .'<IMG SRC="%s/credit.gif" title="' . _('Click to credit the invoice') . '"></a></td>'; + $CreditInvoiceFormatString = '<td><a href="%s/Credit_Invoice.php?InvoiceNumber=%s">' . _('Credit ') .'<img src="%s/credit.gif" title="' . _('Click to credit the invoice') . '"></a></td>'; - $PreviewInvoiceFormatString = '<td><a href="%s/PrintCustTrans.php?FromTransNo=%s&InvOrCredit=Invoice">' . _('HTML ') . '<IMG SRC="%s/preview.gif" title="' . _('Click to preview the invoice') . '"></a></td> - <td><a href="%s/%s?FromTransNo=%s&InvOrCredit=Invoice&PrintPDF=True">' . _('PDF ') . '<IMG SRC="%s/css/' . $theme . '/images/pdf.png" title="' . _('Click for PDF') . '"></a></td> - <td><a href="%s/EmailCustTrans.php?FromTransNo=%s&InvOrCredit=Invoice">' . _('Email ') . '<IMG SRC="%s/email.gif" title="' . _('Click to email the invoice') . '"></a></td>'; + $PreviewInvoiceFormatString = '<td><a href="%s/PrintCustTrans.php?FromTransNo=%s&InvOrCredit=Invoice">' . _('HTML ') . '<img src="%s/preview.gif" title="' . _('Click to preview the invoice') . '"></a></td> + <td><a href="%s/%s?FromTransNo=%s&InvOrCredit=Invoice&PrintPDF=True">' . _('PDF ') . '<img src="%s/css/' . $theme . '/images/pdf.png" title="' . _('Click for PDF') . '"></a></td> + <td><a href="%s/EmailCustTrans.php?FromTransNo=%s&InvOrCredit=Invoice">' . _('Email ') . '<img src="%s/email.gif" title="' . _('Click to email the invoice') . '"></a></td>'; $PreviewCreditFormatString = '<td><a href="%s/PrintCustTrans.php?FromTransNo=%s&InvOrCredit=Credit">' . _('HTML ') . ' <IMG SRC="%s/preview.gif" title="' . _('Click to preview the credit note') . '"></a></td> - <td><a href="%s/%s?FromTransNo=%s&InvOrCredit=Credit&PrintPDF=True">' . _('PDF ') . '<IMG SRC="%s/css/' . $theme . '/images/pdf.png" title="' . _('Click for PDF') . '"></a></td> - <td><a href="%s/EmailCustTrans.php?FromTransNo=%s&InvOrCredit=Credit">' . _('Email') . ' <IMG SRC="%s/email.gif" title="' . _('Click to email the credit note') . '"></a></td>'; + <td><a href="%s/%s?FromTransNo=%s&InvOrCredit=Credit&PrintPDF=True">' . _('PDF ') . '<img src="%s/css/' . $theme . '/images/pdf.png" title="' . _('Click for PDF') . '"></a></td> + <td><a href="%s/EmailCustTrans.php?FromTransNo=%s&InvOrCredit=Credit">' . _('Email') . ' <img src="%s/email.gif" title="' . _('Click to email the credit note') . '"></a></td>'; /* assumed allowed page security token 3 allows the user to create credits for invoices */ if (in_array(3,$_SESSION['AllowedPageSecurityTokens']) && $myrow['type']==10){ @@ -255,7 +257,7 @@ /* format string with GL inquiry options and for invoice to be credited */ printf($BaseFormatString . $CreditInvoiceFormatString . $PreviewInvoiceFormatString . - '<td><a href="%s/GLTransInquiry.php?%s&TypeID=%s&TransNo=%s">' . _('View GL Entries') . ' <IMG SRC="' .$rootpath. '/css/'.$theme.'/images/gl.png" title="' . _('View the GL Entries') . '"></a></td> + '<td><a href="%s/GLTransInquiry.php?TypeID=%s&TransNo=%s">' . _('View GL Entries') . ' <img src="' .$rootpath. '/css/'.$theme.'/images/gl.png" title="' . _('View the GL Entries') . '"></a></td> </tr>', //$BaseFormatString parameters $myrow['typename'], @@ -265,9 +267,9 @@ $myrow['reference'], $myrow['invtext'], $myrow['order_'], - number_format($myrow['totalamount'],2), - number_format($myrow['allocated'],2), - number_format($myrow['totalamount']-$myrow['allocated'],2), + number_format($myrow['totalamount'],$CustomerRecord['decimalplaces']), + number_format($myrow['allocated'],$CustomerRecord['decimalplaces']), + number_format($myrow['totalamount']-$myrow['allocated'],$CustomerRecord['decimalplaces']), //$CreditInvoiceFormatString parameters $rootpath, $myrow['transno'], @@ -279,13 +281,12 @@ $rootpath, $PrintCustomerTransactionScript, $myrow['transno'], - $rootpath.'/css/'.$theme.'/images', $rootpath, + $rootpath, $myrow['transno'], $rootpath.'/css/'.$theme.'/images', //Parameter for string for GL Trans Inquiries $rootpath, - SID, $myrow['type'], $myrow['transno']); } else { //user does not have privileges to see GL inquiry stuff @@ -299,9 +300,9 @@ $myrow['reference'], $myrow['invtext'], $myrow['order_'], - number_format($myrow['totalamount'],2), - number_format($myrow['allocated'],2), - number_format($myrow['totalamount']-$myrow['allocated'],2), + number_format($myrow['totalamount'],$CustomerRecord['decimalplaces']), + number_format($myrow['allocated'],$CustomerRecord['decimalplaces']), + number_format($myrow['totalamount']-$myrow['allocated'],$CustomerRecord['decimalplaces']), //CreditInvoiceFormatString parameters $rootpath, $myrow['transno'], @@ -313,8 +314,8 @@ $rootpath, $PrintCustomerTransactionScript, $myrow['transno'], - $rootpath.'/css/'.$theme.'/images', $rootpath, + $rootpath, $myrow['transno'], $rootpath.'/css/'.$theme.'/images'); } @@ -332,9 +333,9 @@ $myrow['reference'], $myrow['invtext'], $myrow['order_'], - number_format($myrow['totalamount'],2), - number_format($myrow['allocated'],2), - number_format($myrow['totalamount']-$myrow['allocated'],2), + number_format($myrow['totalamount'],$CustomerRecord['decimalplaces']), + number_format($myrow['allocated'],$CustomerRecord['decimalplaces']), + number_format($myrow['totalamount']-$myrow['allocated'],$CustomerRecord['decimalplaces']), //$PreviewInvoiceFormatString parameters $rootpath, $myrow['transno'], @@ -342,8 +343,8 @@ $rootpath, $PrintCustomerTransactionScript, $myrow['transno'], - $rootpath.'/css/'.$theme.'/images', $rootpath, + $rootpath, $myrow['transno'], $rootpath.'/css/'.$theme.'/images'); @@ -351,8 +352,8 @@ if ($_SESSION['CompanyRecord']['gllink_debtors']== 1 AND in_array(8,$_SESSION['AllowedPageSecurityTokens'])){ printf($BaseFormatString . $PreviewCreditFormatString . - "<td><a href='%s/CustomerAllocations.php?AllocTrans=%s'>" . _('Allocation') . "<IMG SRC='" .$rootpath."/css/".$theme."/images/allocation.png' title='" . _('Click to allocate funds') . "'></a></td> - <td><a href='%s/GLTransInquiry.php?%sTypeID=%s&TransNo=%s'>" . _('View GL Entries') . ' <a><IMG SRC="' .$rootpath.'/css/'.$theme.'/images/gl.png" title="' . _('View the GL Entries') . '"></a></td></tr>', + '<td><a href="%s/CustomerAllocations.php?AllocTrans=%s">' . _('Allocation') . '<img src="' .$rootpath .'/css/' . $theme .'/images/allocation.png" title="' . _('Click to allocate funds') . '"></a></td> + <td><a href="%s/GLTransInquiry.php?TypeID=%s&TransNo=%s">' . _('View GL Entries') . ' <a><img src="' .$rootpath.'/css/'.$theme.'/images/gl.png" title="' . _('View the GL Entries') . '"></a></td></tr>', //$BaseFormatString parameters $myrow['typename'], $myrow['transno'], @@ -361,9 +362,9 @@ $myrow['reference'], $myrow['invtext'], $myrow['order_'], - number_format($myrow['totalamount'],2), - number_format($myrow['allocated'],2), - number_format($myrow['totalamount']-$myrow['allocated'],2), + number_format($myrow['totalamount'],$CustomerRecord['decimalplaces']), + number_format($myrow['allocated'],$CustomerRecord['decimalplaces']), + number_format($myrow['totalamount']-$myrow['allocated'],$CustomerRecord['decimalplaces']), //$PreviewCreditFormatString parameters $rootpath, $myrow['transno'], @@ -371,22 +372,21 @@ $rootpath, $PrintCustomerTransactionScript, $myrow['transno'], - $rootpath.'/css/'.$theme.'/images', $rootpath, + $rootpath, $myrow['transno'], $rootpath.'/css/'.$theme.'/images', // hand coded format string for Allocations and GLTrans Inquiry parameters $rootpath, $myrow['id'], $rootpath, - SID, $myrow['type'], $myrow['transno']); } else { printf($BaseFormatString . $PreviewCreditFormatString . - "<td><a href='%s/CustomerAllocations.php?AllocTrans=%s'>" . _('Allocation') . "<IMG SRC='%s/allocation.png' title='" . _('Click to allocate funds') . "'></a></td> - </tr>", + '<td><a href="%s/CustomerAllocations.php?AllocTrans=%s">' . _('Allocation') . '<img src="%s/allocation.png" title="' . _('Click to allocate funds') . '"></a></td> + </tr>', $myrow['typename'], $myrow['transno'], ConvertSQLDate($myrow['trandate']), @@ -394,9 +394,9 @@ $myrow['reference'], $myrow['invtext'], $myrow['order_'], - number_format($myrow['totalamount'],2), - number_format($myrow['allocated'],2), - number_format($myrow['totalamount']-$myrow['allocated'],2), + number_format($myrow['totalamount'],$CustomerRecord['decimalplaces']), + number_format($myrow['allocated'],$CustomerRecord['decimalplaces']), + number_format($myrow['totalamount']-$myrow['allocated'],$CustomerRecord['decimalplaces']), //$PreviewCreditFormatString parameters $rootpath, $myrow['transno'], @@ -404,8 +404,8 @@ $rootpath, $PrintCustomerTransactionScript, $myrow['transno'], - $rootpath.'/css/'.$theme.'/images', $rootpath, + $rootpath, $myrow['transno'], $rootpath.'/css/'.$theme.'/images', //Parameters for hand coded string to show allocations @@ -418,9 +418,9 @@ //If security token 8 in the allowed page security tokens then assumed ok for GL trans inquiries if ($_SESSION['CompanyRecord']['gllink_debtors']== 1 AND in_array(8,$_SESSION['AllowedPageSecurityTokens'])){ printf($BaseFormatString . - "<td><a href='%s/CustomerAllocations.php?AllocTrans=%s'>" . _('Allocation') . "<IMG SRC='" .$rootpath."/css/".$theme."/images/allocation.png' title='" . _('Click to allocate funds') . "'></a></td> - <td><a href='%s/GLTransInquiry.php?%s&TypeID=%s&TransNo=%s'>" . _('View GL Entries') . " <IMG SRC='" .$rootpath."/css/".$theme."/images/gl.png' title='" . _('View the GL Entries') . "'></a></td> - </tr>", + '<td><a href="%s/CustomerAllocations.php?AllocTrans=%s">' . _('Allocation') . '<img src="' .$rootpath . '/css/' . $theme .'/images/allocation.png" title="' . _('Click to allocate funds') . '"></a></td> + <td><a href="%s/GLTransInquiry.php?TypeID=%s&TransNo=%s">' . _('View GL Entries') . ' <img src="' .$rootpath . '/css/' . $theme .'/images/gl.png" title="' . _('View the GL Entries') . '"></a></td> + </tr>', $myrow['typename'], $myrow['transno'], ConvertSQLDate($myrow['trandate']), @@ -428,19 +428,18 @@ $myrow['reference'], $myrow['invtext'], $myrow['order_'], - number_format($myrow['totalamount'],2), - number_format($myrow['allocated'],2), - number_format($myrow['totalamount']-$myrow['allocated'],2), + number_format($myrow['totalamount'],$CustomerRecord['decimalplaces']), + number_format($myrow['allocated'],$CustomerRecord['decimalplaces']), + number_format($myrow['totalamount']-$myrow['allocated'],$CustomerRecord['decimalplaces']), $rootpath, $myrow['id'], $rootpath, - SID, $myrow['type'], $myrow['transno']); } else { //no permission for GLTrans Inquiries printf($BaseFormatString . - "<td><a href='%s/CustomerAllocations.php?AllocTrans=%s'>" . _('Allocation') . "<IMG SRC='" .$rootpath."/css/".$theme."/images/allocation.png' title='" . _('Click to allocate funds') . "'></a></td> - </tr>", + '<td><a href="%s/CustomerAllocations.php?AllocTrans=%s">' . _('Allocation') . '<img src="' .$rootpath . '/css/' . $theme .'/images/allocation.png" title="' . _('Click to allocate funds') . '"></a></td> + </tr>', $myrow['typename'], $myrow['transno'], ConvertSQLDate($myrow['trandate']), @@ -448,9 +447,9 @@ $myrow['reference'], $myrow['invtext'], $myrow['order_'], - number_format($myrow['totalamount'],2), - number_format($myrow['allocated'],2), - number_format($myrow['totalamount']-$myrow['allocated'],2), + number_format($myrow['totalamount'],$CustomerRecord['decimalplaces']), + number_format($myrow['allocated'],$CustomerRecord['decimalplaces']), + number_format($myrow['totalamount']-$myrow['allocated'],$CustomerRecord['decimalplaces']), $rootpath, $myrow['id']); } @@ -459,7 +458,7 @@ //If security token 8 in the allowed page security tokens then assumed ok for GL trans inquiries if ($_SESSION['CompanyRecord']['gllink_debtors']== 1 AND in_array(8,$_SESSION['AllowedPageSecurityTokens'])){ printf($BaseFormatString . - '<td><a href="%s/GLTransInquiry.php?%s&TypeID=%s&TransNo=%s">' . _('View GL Entries') . ' <a></td></tr>', + '<td><a href="%s/GLTransInquiry.php?TypeID=%s&TransNo=%s">' . _('View GL Entries') . ' <a></td></tr>', $myrow['typename'], $myrow['transno'], ConvertSQLDate($myrow['trandate']), @@ -467,11 +466,10 @@ $myrow['reference'], $myrow['invtext'], $myrow['order_'], - number_format($myrow['totalamount'],2), - number_format($myrow['allocated'],2), - number_format($myrow['totalamount']-$myrow['allocated'],2), + number_format($myrow['totalamount'],$CustomerRecord['decimalplaces']), + number_format($myrow['allocated'],$CustomerRecord['decimalplaces']), + number_format($myrow['totalamount']-$myrow['allocated'],$CustomerRecord['decimalplaces']), $rootpath, - SID, $myrow['type'], $myrow['transno']); } else { //no permission for GLTrans Inquiries @@ -483,15 +481,15 @@ $myrow['reference'], $myrow['invtext'], $myrow['order_'], - number_format($myrow['totalamount'],2), - number_format($myrow['allocated'],2), - number_format($myrow['totalamount']-$myrow['allocated'],2)); + number_format($myrow['totalamount'],$CustomerRecord['decimalplaces']), + number_format($myrow['allocated'],$CustomerRecord['decimalplaces']), + number_format($myrow['totalamount']-$myrow['allocated'],$CustomerRecord['decimalplaces'])); } } else { //If security token 8 in the allowed page security tokens then assumed ok for GL trans inquiries if ($_SESSION['CompanyRecord']['gllink_debtors']== 1 AND in_array(8,$_SESSION['AllowedPageSecurityTokens'])){ printf($BaseFormatString . - '<td><a href="%s/GLTransInquiry.php?%s&TypeID=%s&TransNo=%s">' . _('View GL Entries') . ' <a></td></tr>', + '<td><a href="%s/GLTransInquiry.php?TypeID=%s&TransNo=%s">' . _('View GL Entries') . ' <a></td></tr>', $myrow['typename'], $myrow['transno'], ConvertSQLDate($myrow['trandate']), @@ -499,11 +497,10 @@ $myrow['reference'], $myrow['invtext'], $myrow['order_'], - number_format($myrow['totalamount'],2), - number_format($myrow['allocated'],2), - number_format($myrow['totalamount']-$myrow['allocated'],2), + number_format($myrow['totalamount'],$CustomerRecord['decimalplaces']), + number_format($myrow['allocated'],$CustomerRecord['decimalplaces']), + number_format($myrow['totalamount']-$myrow['allocated'],$CustomerRecord['decimalplaces']), $rootpath, - SID, $myrow['type'], $myrow['transno']); } else { @@ -515,9 +512,9 @@ $myrow['reference'], $myrow['invtext'], $myrow['order_'], - number_format($myrow['totalamount'],2), - number_format($myrow['allocated'],2), - number_format($myrow['totalamount']-$myrow['allocated'],2)); + number_format($myrow['totalamount'],$CustomerRecord['decimalplaces']), + number_format($myrow['allocated'],$CustomerRecord['decimalplaces']), + number_format($myrow['totalamount']-$myrow['allocated'],$CustomerRecord['decimalplaces'])); } } @@ -526,4 +523,4 @@ echo '</table>'; include('includes/footer.inc'); -?> +?> \ No newline at end of file Modified: trunk/CustomerReceipt.php =================================================================== --- trunk/CustomerReceipt.php 2011-05-13 10:50:42 UTC (rev 4565) +++ trunk/CustomerReceipt.php 2011-05-14 11:24:22 UTC (rev 4566) @@ -700,7 +700,7 @@ /*set up the form whatever */ -echo '<form action=' . $_SERVER['PHP_SELF'] . '?Type='.$_GET['Type'] . ' method=post name=form1>'; +echo '<form action="' . $_SERVER['PHP_SELF'] . '?Type='.$_GET['Type'] . '" method=post name=form1>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; /*show the batch header details and the entries in the batch so far */ Modified: trunk/DailyBankTransactions.php =================================================================== --- trunk/DailyBankTransactions.php 2011-05-13 10:50:42 UTC (rev 4565) +++ trunk/DailyBankTransactions.php 2011-05-14 11:24:22 UTC (rev 4566) @@ -1,6 +1,7 @@ <?php -//$PageSecurity = 8; now from Database Scripts table +/* $Id: DailyBankTransactions.php 4556 2011-04-26 11:03:36Z daintree $ */ + include ('includes/session.inc'); $title = _('Bank Transactions Inquiry'); include('includes/header.inc'); @@ -9,23 +10,24 @@ _('Search') . '" alt="" />' . ' ' . $title.'</p>'; if (!isset($_POST['Show'])) { - 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 class=selection>'; - $SQL = 'SELECT bankaccountname, - bankaccounts.accountcode, - bankaccounts.currcode - FROM bankaccounts, - chartmaster - WHERE bankaccounts.accountcode=chartmaster.accountcode'; + $SQL = "SELECT bankaccountname, + bankaccounts.accountcode, + bankaccounts.currcode + FROM bankaccounts, + chartmaster + WHERE bankaccounts.accountcode=chartmaster.accountcode"; $ErrMsg = _('The bank accounts could not be retrieved because'); $DbgMsg = _('The SQL used to retrieve the bank accounts was'); $AccountsResults = DB_query($SQL,$db,$ErrMsg,$DbgMsg); - echo '<tr><td>' . _('Bank Account') . ':</td><td><select name="BankAccount">'; + echo '<tr><td>' . _('Bank Account') . ':</td> + <td><select name="BankAccount">'; if (DB_num_rows($AccountsResults)==0){ echo '</select></td></tr></table><p>'; @@ -60,30 +62,33 @@ echo '</form>'; } else { $SQL = "SELECT bankaccountname, - bankaccounts.currcode - FROM bankaccounts - WHERE bankaccounts.accountcode='" . $_POST['BankAccount'] . "'"; + bankaccounts.currcode, + currencies.decimalplaces + FROM bankaccounts + INNER JOIN currencies + ON bankaccounts.currcode = currencies.currabrev + WHERE bankaccounts.accountcode='" . $_POST['BankAccount'] . "'"; $BankResult = DB_query($SQL,$db,_('Could not retrieve the bank account details')); $sql="SELECT banktrans.currcode, - banktrans.amount, - banktrans.functionalexrate, - banktrans.exrate, - banktrans.banktranstype, - banktrans.transdate, - bankaccounts.bankaccountname, - systypes.typename, - systypes.typeid - FROM banktrans - INNER JOIN bankaccounts - ON banktrans.bankact=bankaccounts.accountcode - INNER JOIN systypes - ON banktrans.type=systypes.typeid - WHERE bankact='".$_POST['BankAccount']."' - AND transdate>='" . FormatDateForSQL($_POST['FromTransDate']) . "' - AND transdate<='" . FormatDateForSQL($_POST['ToTransDate']) . "' - ORDER BY banktrans.transdate"; + banktrans.amount, + banktrans.functionalexrate, + banktrans.exrate, + banktrans.banktranstype, + banktrans.transdate, + bankaccounts.bankaccountname, + systypes.typename, + systypes.typeid + FROM banktrans + INNER JOIN bankaccounts + ON banktrans.bankact=bankaccounts.accountcode + INNER JOIN systypes + ON banktrans.type=systypes.typeid + WHERE bankact='".$_POST['BankAccount']."' + AND transdate>='" . FormatDateForSQL($_POST['FromTransDate']) . "' + AND transdate<='" . FormatDateForSQL($_POST['ToTransDate']) . "' + ORDER BY banktrans.transdate"; $result = DB_query($sql, $db); if (DB_num_rows($result)==0) { prnMsg(_('There are no transactions for this account in the date range selected'), 'info'); @@ -94,15 +99,15 @@ <th colspan=7><font size=3 color=blue>' . _('Account Transactions For').' '.$BankDetailRow['bankaccountname'].' '._('Between').' '.$_POST['FromTransDate'] . ' ' . _('and') . ' ' . $_POST['ToTransDate'] . '</font></th> </tr>'; echo '<tr> - <th>' . ('Date') . '</th> - <th>'._('Transaction type').'</th> - <th>'._('Type').'</th> - <th>'._('Reference').'</th> - <th>'._('Amount in').' '.$BankDetailRow['currcode'].'</th> - <th>'._('Running Total').' '.$BankDetailRow['currcode'].'</th> - <th>'._('Amount in').' '.$_SESSION['CompanyRecord']['currencydefault'].'</th> - <th>'._('Running Total').' '.$_SESSION['CompanyRecord']['currencydefault'].'</th> - </tr>'; + <th>' . ('Date') . '</th> + <th>'._('Transaction type').'</th> + <th>'._('Type').'</th> + <th>'._('Reference').'</th> + <th>'._('Amount in').' '.$BankDetailRow['currcode'].'</th> + <th>'._('Running Total').' '.$BankDetailRow['currcode'].'</th> + <th>'._('Amount in').' '.$_SESSION['CompanyRecord']['currencydefault'].'</th> + <th>'._('Running Total').' '.$_SESSION['CompanyRecord']['currencydefault'].'</th> + </tr>'; $AccountCurrTotal=0; $LocalCurrTotal =0; @@ -113,20 +118,20 @@ $LocalCurrTotal += $myrow['amount']/$myrow['functionalexrate']/$myrow['exrate']; echo '<tr> - <td>'. ConvertSQLDate($myrow['transdate']) . '</td> - <td>'.$myrow['typename'].'</td> - <td>'.$myrow['banktranstype'].'</td> - <td>'.$myrow['ref'].'</td> - <td class=number>'.number_format($myrow['amount'],2).'</td> - <td class=number>'.number_format($AccountCurrTotal,2).'</td> - <td class=number>'.number_format($myrow['amount']/$myrow['functionalexrate']/$myrow['exrate'],2).'</td> - <td class=number>'.number_format($LocalCurrTotal,2).'</td> - </tr>'; + <td>'. ConvertSQLDate($myrow['transdate']) . '</td> + <td>'.$myrow['typename'].'</td> + <td>'.$myrow['banktranstype'].'</td> + <td>'.$myrow['ref'].'</td> + <td class=number>'.number_format($myrow['amount'],$BankDetailRow['decimalplaces']).'</td> + <td class=number>'.number_format($AccountCurrTotal,$BankDetailRow['decimalplaces']).'</td> + <td class=number>'.number_format($myrow['amount']/$myrow['functionalexrate']/$myrow['exrate'],$_SESSION['CompanyRecord']['decimalplaces']).'</td> + <td class=number>'.number_format($LocalCurrTotal,$_SESSION['CompanyRecord']['decimalplaces']).'</td> + </tr>'; } echo '</table>'; } //end if no bank trans in the range to show - 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 '<br><div class="centre"><input type="submit" name="Return" value="' . _('Select Another Date'). '"></div>'; echo '</form>'; Modified: trunk/FTP_RadioBeacon.php =================================================================== --- trunk/FTP_RadioBeacon.php 2011-05-13 10:50:42 UTC (rev 4565) +++ trunk/FTP_RadioBeacon.php 2011-05-14 11:24:22 UTC (rev 4566) @@ -1,10 +1,9 @@ <?php -/* $Revision: 1.10 $ */ + /* $Id$*/ /*Variables required to configure this script must be set in config.php */ -//$PageSecurity = 2; include('includes/session.inc'); $title=_('FTP order to Radio Beacon'); include('includes/header.inc'); @@ -47,17 +46,17 @@ echo '<table cellpadding=2 colspan=7 WIDTH=100%>'; $TableHeader = '<tr> - <td class=tableheader>' . _('Modify') . '</td> - <td class=tableheader>' . _('Send to') . '<br>' . _('Radio Beacon') . '</td> - <td class=tableheader>' . _('Customer') . '</td> - <td class=tableheader>' . _('Branch') . '</td> - <td class=tableheader>' . _('Cust Order') . ' #</td> - <td class=tableheader>' . _('Order Date') . '</td> - <td class=tableheader>' . _('Req Del Date') . '</td> - <td class=tableheader>' . _('Delivery To') . '</td> - <td class=tableheader>' . _('Order Total') . '</td> - <td class=tableheader>' . _('Last Send') . '</td> - </tr>'; + <td class=tableheader>' . _('Modify') . '</td> + <td class=tableheader>' . _('Send to') . '<br />' . _('Radio Beacon') . '</td> + <td class=tableheader>' . _('Customer') . '</td> + <td class=tableheader>' . _('Branch') . '</td> + <td class=tableheader>' . _('Cust Order') . ' #</td> + <td class=tableheader>' . _('Order Date') . '</td> + <td class=tableheader>' . _('Req Del Date') . '</td> + <td class=tableheader>' . _('Delivery To') . '</td> + <td class=tableheader>' . _('Order Total') . '</td> + <td class=tableheader>' . _('Last Send') . '</td> + </tr>'; echo $TableHeader; @@ -72,7 +71,7 @@ $k=1; } - $FTPDispatchNote = $_SERVER['PHP_SELF'] . '?' . SID . '&OrderNo=' . $myrow['orderno']; + $FTPDispatchNote = $_SERVER['PHP_SELF'] . '?OrderNo=' . $myrow['orderno']; $FormatedDelDate = ConvertSQLDate($myrow['deliverydate']); $FormatedOrderDate = ConvertSQLDate($myrow['orddate']); $FormatedOrderValue = number_format($myrow['ordervalue'],2); @@ -80,48 +79,48 @@ $ModifyPage = $rootpath . 'SelectOrderItems.php?' . SID . '&ModifyOrderNumber=' . $myrow['orderno']; if ($myrow['printedpackingslip'] ==1){ - printf("<td><font size=2><a href='%s'>%s</a></font></td> - <td><font color=RED size=2>" . _('Already') . '<br>' . _('Sent') . "</font></td> - <td><font size=2>%s</font></td> - <td><font size=2>%s</font></td> - <td><font size=2>%s</font></td> - <td><font size=2>%s</font></td> - <td><font size=2>%s</font></td> - <td><font size=2>%s</font></td> - <td class=number><font size=2>%s</font></td> - <td><font size=2>%s</font></td></tr>", - $ModifyPage, - $myrow['orderno'], - $myrow['name'], - $myrow['brname'], - $myrow['customerref'], - $FormatedOrderDate, - $FormatedDelDate, - $myrow['deliverto'], - $FormatedOrderValue, - $FormatedDateLastSent); + printf('<td><font size=2><a href="%s">%s</a></font></td> + <td><font color=RED size=2>' . _('Already') . '<br />' . _('Sent') . '</font></td> + <td><font size=2>%s</font></td> + <td><font size=2>%s</font></td> + <td><font size=2>%s</font></td> + <td><font size=2>%s</font></td> + <td><font size=2>%s</font></td> + <td><font size=2>%s</font></td> + <td class=number><font size=2>%s</font></td> + <td><font size=2>%s</font></td></tr>', + $ModifyPage, + $myrow['orderno'], + $myrow['name'], + $myrow['brname'], + $myrow['customerref'], + $FormatedOrderDate, + $FormatedDelDate, + $myrow['deliverto'], + $FormatedOrderValue, + $FormatedDateLastSent); } else { - printf("<td><font size=2><a href='%s'>%s</a></font></td> - <td><font size=2><a href='%s'>" . _('Send') . "</a></font></td> - <td><font size=2>%s</font></td> - <td><font size=2>%s</font></td> - <td><font size=2>%s</font></td> - <td><font size=2>%s</font></td> - <td><font size=2>%s</font></td> - <td><font size=2>%s</font></td> - <td class=number><font size=2>%s</font></td> - <td><font size=2>%s</font></td></tr>", - $ModifyPage, - $myrow['orderno'], - $FTPDispatchNote, - $myrow['name'], - $myrow['brname'], - $myrow['customerref'], - $FormatedOrderDate, - $FormatedDelDate, - $myrow['deliverto'], - $FormatedOrderValue, - $FormatedDateLastSent); + printf('<td><font size=2><a href="%s">%s</a></font></td> + <td><font size=2><a href="%s">' . _('Send') . '</a></font></td> + <td><font size=2>%s</font></td> + <td><font size=2>%s</font></td> + <td><font size=2>%s</font></td> + <td><font size=2>%s</font></td> + <td><font size=2>%s</font></td> + <td><font size=2>%s</font></td> + <td class=number><font size=2>%s</font></td> + <td><font size=2>%s</font></td></tr>', + $ModifyPage, + $myrow['orderno'], + $FTPDispatchNote, + $myrow['name'], + $myrow['brname'], + $myrow['customerref'], + $FormatedOrderDate, + $FormatedDelDate, + $myrow['deliverto'], + $FormatedOrderValue, + $FormatedDateLastSent); } $j++; if ($j == 12){ @@ -173,7 +172,7 @@ debtorsmaster WHERE salesorders.debtorno=debtorsmaster.debtorno AND salesorders.fromstkloc = '". $_SESSION['RadioBeaconStockLocation'] . "' - AND salesorders.orderno=" . $_GET['OrderNo']; + AND salesorders.orderno='" . $_GET['OrderNo'] . "'"; $ErrMsg = _('There was a problem retrieving the order header details for Order Number') . ' ' . $_GET['OrderNo'] . ' ' . _('from the database'); @@ -183,24 +182,24 @@ $myrow = DB_fetch_array($result); if ($myrow['printedpackingslip']==1){ - prnMsg(_('Order Number') . ' ' . $_GET['OrderNo'] . ' ' . _('has previously been sent to Radio Beacon') . '. ' . _('It was sent on') . ' ' . ConvertSQLDate($myrow['datepackingslipprinted']) . '<br>' . _('To re-send the order with the balance not previously dispatched and invoiced the order must be modified to allow a reprint (or re-send)') . '.<br>' . _('This check is there to ensure that duplication of dispatches to the customer are avoided'),'warn'); - echo "<p><a href='$rootpath/SelectOrderItems.php?" . SID . "&ModifyOrderNumber=" . $_GET['OrderNo'] . "'>" . _('Modify the order to allow a re-send or reprint') . ' (' . _('Select Delivery Details') . ')' . '</a>'; - echo "<p><a href='$rootpath/index.php'>" . _('Back to the menu') . '</a>'; + prnMsg(_('Order Number') . ' ' . $_GET['OrderNo'] . ' ' . _('has previously been sent to Radio Beacon') . '. ' . _('It was sent on') . ' ' . ConvertSQLDate($myrow['datepackingslipprinted']) . '<br />' . _('To re-send the order with the balance not previously dispatched and invoiced the order must be modified to allow a reprint (or re-send)') . '.<br />' . _('This check is there to ensure that duplication of dispatches to the customer are avoided'),'warn'); + echo '<p><a href="' . $rootpath . '/SelectOrderItems.php?ModifyOrderNumber=' . $_GET['OrderNo'] . '">' . _('Modify the order to allow a re-send or reprint') . ' (' . _('Select Delivery Details') . ')' . '</a>'; + echo '<p><a href="' . $rootpath/index.php . '">' . _('Back to the menu') . '</a>'; include('includes/footer.inc'); exit; } /*Now get the line items */ $sql = "SELECT stkcode, - description, - quantity, - units, - qtyinvoiced, - unitprice - FROM salesorderdetails, - stockmaster - WHERE salesorderdetails.stkcode=stockmaster.stockid - AND salesorderdetails.orderno=" . $_GET['OrderNo']; + description, + quantity, + units, + qtyinvoiced, + unitprice + FROM salesorderdetails, + stockmaster + WHERE salesorderdetails.stkcode=stockmaster.stockid + AND salesorderdetails.orderno=" . $_GET['OrderNo']; $ErrMsg = _('There was a problem retrieving the line details for order number') . ' ' . $_GET['OrderNo'] . ' ' . _('from the database because'); $result=DB_query($sql,$db, $ErrMsg); @@ -267,18 +266,18 @@ $conn_id = ftp_connect($_SESSION['RadioBeaconFTP_server']); // login with username and password $login_result = ftp_login($conn_id, $_SESSION['RadioBeaconFTP_user_name'], $_SESSION['RadioBeaconFTP_user_pass']); // check connection if ((!$conn_id) || (!$login_result)) { - echo '<br>' . _('Ftp connection has failed'); - echo '<br>' . _('Attempted to connect to') . ' ' . $_SESSION['RadioBeaconFTP_server'] . ' ' . _('for user') . ' ' . $_SESSION['RadioBeaconFTP_user_name']; + echo '<br />' . _('Ftp connection has failed'); + echo '<br />' . _('Attempted to connect to') . ' ' . $_SESSION['RadioBeaconFTP_server'] . ' ' . _('for user') . ' ' . $_SESSION['RadioBeaconFTP_user_name']; die; } else { - echo '<br>' . _('Connected to Radio Beacon FTP server at') . ' ' . $_SESSION['RadioBeaconFTP_server'] . ' ' . _('with user name') . ' ' . $_SESSION['RadioBeaconFTP_user_name']; + echo '<br />' . _('Connected to Radio Beacon FTP server at') . ' ' . $_SESSION['RadioBeaconFTP_server'] . ' ' . _('with user name') . ' ' . $_SESSION['RadioBeaconFTP_user_name']; } // upload the file $upload = ftp_put($conn_id, $FilePrefix . $FileNumber . '.txt', $FileName, FTP_ASCII); // check upload status if (!$upload) { prnMsg(_('FTP upload has failed'),'success'); exit; } else { - echo '<br>' . _('Uploaded') . ' ' . $FileName . ' ' . _('to') . ' ' . $_SESSION['RadioBeaconFTP_server']; + echo '<br />' . _('Uploaded') . ' ' . $FileName . ' ' . _('to') . ' ' . $_SESSION['RadioBeaconFTP_server']; } // close the FTP stream ftp_quit($conn_id); @@ -286,7 +285,7 @@ $sql = "UPDATE salesorders SET printedpackingslip=1, datepackingslipprinted='" . Date('Y-m-d') . "' WHERE salesorders.orderno=" . $_GET['OrderNo']; $result = DB_query($sql,$db); - echo '<p>' . _('Order Number') . ' ' . $_GET['OrderNo'] . ' ' . _('has been sent via FTP to Radio Beacon a copy of the file that was sent is held on the server at') . '<br>' . $FileName; + echo '<p>' . _('Order Number') . ' ' . $_GET['OrderNo'] . ' ' . _('has been sent via FTP to Radio Beacon a copy of the file that was sent is held on the server at') . '<br />' . $FileName; } else { /*perhaps several order headers returned or none (more likely) */ Modified: trunk/FreightCosts.php =================================================================== --- trunk/FreightCosts.php 2011-05-13 10:50:42 UTC (rev 4565) +++ trunk/FreightCosts.php 2011-05-14 11:24:22 UTC (rev 4566) @@ -1,17 +1,11 @@ <?php /* $Id$*/ -/* $Revision: 1.14 $ */ -//$PageSecurity = 11; include('includes/session.inc'); $title = _('Freight Costs Set Up'); include('includes/header.inc'); -?> - -<?php - if (isset($_GET['LocationFrom'])){ $LocationFrom = $_GET['LocationFrom']; } elseif (isset($_POST['LocationFrom'])){ @@ -33,32 +27,37 @@ if (!isset($LocationFrom) OR !isset($ShipperID)) { - 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'] . '" />'; - $sql = 'SELECT shippername, shipper_id FROM shippers'; + $sql = "SELECT shippername, shipper_id FROM shippers"; $ShipperResults = DB_query($sql,$db); echo '<table class=selection> <tr> - <td>' . _('Select A Freight Company to set up costs for') . "</td> - <td><select name='ShipperID'>"; + <td>' . _('Select A Freight Company to set up costs for') . '</td> + <td><select name="ShipperID">'; while ($myrow = DB_fetch_array($ShipperResults)){ - echo '<option VALUE=' . $myrow['shipper_id'] . '>' . $myrow['shippername']; + echo '<option value=' . $myrow['shipper_id'] . '>' . $myrow['shippername'] . '</option>'; } echo '</select></td></tr> <tr> - <td>' . _('Select the warehouse') . ' (' . _('ship from location') . ")</td> - <td><select name='LocationFrom'>"; + <td>' . _('Select the warehouse') . ' (' . _('ship from location') . ')</td> + <td><select name="LocationFrom">'; - $sql = 'SELECT loccode, locationname FROM locations'; + $sql = "SELECT loccode, + locationname + FROM locations"; $LocationResults = DB_query($sql,$db); while ($myrow = DB_fetch_array($LocationResults)){ - echo '<option VALUE=' . $myrow['loccode'] . '>' . $myrow['locationname']; + echo '<option value=' . $myrow['loccode'] . '>' . $myrow['locationname']; } - echo "</select></td></tr></table><br><div class='centre'><input type=submit value='" . _('Accept') . "' name='Accept'></div></form>"; + echo '</select></td></tr> + </table> + <br><div class="centre"><input type="submit" value="' . _('Accept') . '" name="Accept"></div> + </form>'; } else { @@ -115,8 +114,7 @@ if (isset($SelectedFreightCost) AND $InputError !=1) { $sql = "UPDATE freightcosts - SET - locationfrom='".$LocationFrom."', + SET locationfrom='".$LocationFrom."', destination='" . $_POST['Destination'] . "', shipperid='" . $ShipperID . "', cubrate='" . $_POST['CubRate'] . "', @@ -133,28 +131,27 @@ /*Selected freight cost is null cos no item selected on first time round so must be adding a record must be submitting new entries */ - $sql = "INSERT INTO freightcosts ( - locationfrom, - destination, - shipperid, - cubrate, - kgrate, - maxkgs, - maxcub, - fixedprice, - minimumchg) - VALUES ( - '".$LocationFrom."', - '" . $_POST['Destination'] . "', - '" . $ShipperID . "', - '" . $_POST['CubRate'] . "', - '" . $_POST['KGRate'] . "', - '" . $_POST['MAXKGs'] . "', - '" . $_POST['MAXCub'] . "', - '" . $_POST['FixedPrice'] ."', - '" . $_POST['MinimumChg'] . "' - )"; - + $sql = "INSERT INTO freightcosts (locationfrom, + destination, + shipperid, + cubrate, + kgrate, + maxkgs, + maxcub, + fixedprice, + minimumchg) + VALUES ( + '".$LocationFrom."', + '" . $_POST['Destination'] . "', + '" . $ShipperID . "', + '" . $_POST['CubRate'] . "', + '" . $_POST['KGRate'] . "', + '" . $_POST['MAXKGs'] . "', + '" . $_POST['MAXCub'] . "', + '" . $_POST['FixedPrice'] ."', + '" . $_POST['MinimumChg'] . "' + )"; + $msg = _('Freight cost record inserted'); } @@ -187,30 +184,30 @@ $sql = "SELECT shipcostfromid, - destination, - cubrate, - kgrate, - maxkgs, - maxcub, - fixedprice, - minimumchg - FROM freightcosts - WHERE freightcosts.locationfrom = '".$LocationFrom. "' - AND freightcosts.shipperid = '" . $ShipperID . "' - ORDER BY destination"; - + destination, + cubrate, + kgrate, + maxkgs, + maxcub, + fixedprice, + minimumchg + FROM freightcosts + WHERE freightcosts.locationfrom = '".$LocationFrom. "' + AND freightcosts.shipperid = '" . $ShipperID . "' + ORDER BY destination"; + $result = DB_query($sql,$db); echo '<br><table class=selection>'; - $TableHeader = "<tr> - <th>" . _('Destination') . "</th> - <th>" . _('Cubic Rate') . "</th> - <th>" . _('KG Rate') . "</th> - <th>" . _('MAX KGs') . "</th> - <th>" . _('MAX Volume') . "</th> - <th>" . _('Fixed Price') . "</th> - <th>" . _('Minimum Charge') . "</th> - </tr>"; + $TableHeader = '<tr> + <th>' . _('Destination') . '</th> + <th>' . _('Cubic Rate') . '</th> + <th>' . _('KG Rate') . '</th> + <th>' . _('MAX KGs') . '</th> + <th>' . _('MAX Volume') . '</th> + <th>' . _('Fixed Price') . '</th> + <th>' . _('Minimum Charge') . '</th> + </tr>'; echo $TableHeader; @@ -233,15 +230,15 @@ } - printf("<td>%s</td> + printf('<td>%s</td> <td class=number>%s</td> <td class=number>%s</td> <td class=number>%s</td> <td class=number>%s</td> <td class=number>%s</td> <td class=number>%s</td> - <td><a href=\"%s&SelectedFreightCost=%s&LocationFrom=%s&ShipperID=%s\">" . _('Edit') . "</td> - <td><a href=\"%s&SelectedFreightCost=%s&LocationFrom=%s&ShipperID=%s&delete=yes\">" . _('Delete') . "</td></tr>", + <td><a href="%s&SelectedFreightCost=%s&LocationFrom=%s&ShipperID=%s">' . _('Edit') . '</td> + <td><a href="%s&SelectedFreightCost=%s&LocationFrom=%s&ShipperID=%s&delete=yes" onclick="return confirm(\'' . _('Are you sure you wish to delete this freight cost') . '\');">' . _('Delete') . '</td></tr>', $myrow[1], $myrow[2], $myrow[3], @@ -249,11 +246,11 @@ $myrow[5], $myrow[6], $myrow[7], - $_SERVER['PHP_SELF'] . '?' . SID, + $_SERVER['PHP_SELF'] . '?', $myrow[0], $LocationFrom, $ShipperID, - $_SERVER['PHP_SELF'] . '?' . SID, + $_SERVER['PHP_SELF'] . '?', $myrow[0], $LocationFrom, $ShipperID); @@ -267,28 +264,28 @@ //end of ifs and buts! if (isset($SelectedFreightCost)) { - echo "<div class='centre'><a href='" . $_SERVER['PHP_SELF'] . "?" . SID . '&LocationFrom=' . $LocationFrom . '&ShipperID=' . $ShipperID . "'>" . _('Show all freight costs for') . ' ' . $ShipperName . ' ' . _('from') . ' ' . $LocationName . '</a></div>'; + echo '<div class="centre"><a href="' . $_SERVER['PHP_SELF'] . '?LocationFrom=' . $LocationFrom . '&ShipperID=' . $ShipperID . '">' . _('Show all fr... [truncated message content] |
From: <dai...@us...> - 2011-05-14 11:24:31
|
Revision: 4566 http://web-erp.svn.sourceforge.net/web-erp/?rev=4566&view=rev Author: daintree Date: 2011-05-14 11:24:22 +0000 (Sat, 14 May 2011) Log Message: ----------- various Modified Paths: -------------- trunk/COGSGLPostings.php trunk/ContractBOM.php trunk/CreditStatus.php trunk/CustomerBranches.php trunk/CustomerInquiry.php trunk/CustomerReceipt.php trunk/DailyBankTransactions.php trunk/FTP_RadioBeacon.php trunk/FreightCosts.php trunk/POReport.php trunk/PageSecurity.php trunk/Prices.php trunk/StockQties_csv.php trunk/StockTransfers.php trunk/SupplierCredit.php trunk/TaxCategories.php trunk/doc/Change.log Modified: trunk/COGSGLPostings.php =================================================================== --- trunk/COGSGLPostings.php 2011-05-13 10:50:42 UTC (rev 4565) +++ trunk/COGSGLPostings.php 2011-05-14 11:24:22 UTC (rev 4566) @@ -92,7 +92,7 @@ </tr>'; $k=0; //row colour counter - while ($myrow = DB_fetch_row($result)) { + while ($myrow = DB_fetch_array($result)) { if ($k==1){ echo '<tr class="EvenTableRows">'; $k=0; @@ -106,24 +106,24 @@ <td>%s</td> <td>%s</td> <td><a href="%sSelectedCOGSPostingID=%s">' . _('Edit') . '</td> - <td><a href="%sSelectedCOGSPostingID=%s&delete=yes">'. _('Delete') . '</td></tr>', - $myrow[1], - $myrow[2], - $myrow[3], - $myrow[4], + <td><a href="%sSelectedCOGSPostingID=%s&delete=yes" onclick="return confirm(\'' . _('Are you sure you wish to delete this COGS GL posting record?') . '\');">'. _('Delete') . '</td></tr>', + $myrow['area'], + $myrow['stkcat'], + $myrow['salestype'], + $myrow['accountname'], $_SERVER['PHP_SELF'] . '?', - $myrow[0], + $myrow['id'], $_SERVER['PHP_SELF']. '?', - $myrow[0]); + $myrow['id']); }//end while echo '</table>'; } $sql = "SELECT cogsglpostings.id, - cogsglpostings.area, - cogsglpostings.stkcat, - cogsglpostings.salestype - FROM cogsglpostings"; + cogsglpostings.area, + cogsglpostings.stkcat, + cogsglpostings.salestype + FROM cogsglpostings"; $result = DB_query($sql,$db); @@ -147,7 +147,7 @@ $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 */ @@ -195,7 +195,7 @@ <th>' . _('GL Account') . '</th> </tr>'; $k = 0; - while ($myrow = DB_fetch_row($result)) { + while ($myrow = DB_fetch_array($result)) { if ($k==1){ echo '<tr class="EvenTableRows">'; $k=0; @@ -211,14 +211,14 @@ <td><a href="%sSelectedCOGSPostingID=%s">' . _('Edit') . '</td> <td><a href="%sSelectedCOGSPostingID=%s&delete=yes">' . _('Delete') . '</td> </tr>', - $myrow[1], - $myrow[2], - $myrow[3], - $myrow[4], + $myrow['area'], + $myrow['stkcat'], + $myrow['salestype'], + $myrow['salestype'], $_SERVER['PHP_SELF'] . '?', - $myrow[0], + $myrow['id'], $_SERVER['PHP_SELF'] . '?', - $myrow[0]); + $myrow['id']); }//END WHILE LIST LOOP echo '</table>'; @@ -305,7 +305,7 @@ echo '</select></td></tr> <tr><td>' . _('Sales Type') . ' / ' . _('Price List') . ':</td> <td><select tabindex=3 name="SalesType"> - <option VALUE="AN">' . _('Any Other') . '</option>'; + <option value="AN">' . _('Any Other') . '</option>'; while ($myrow = DB_fetch_array($result)) { if (isset($_POST['SalesType']) and $myrow['typeabbrev']==$_POST['SalesType']) { Modified: trunk/ContractBOM.php =================================================================== --- trunk/ContractBOM.php 2011-05-13 10:50:42 UTC (rev 4565) +++ trunk/ContractBOM.php 2011-05-14 11:24:22 UTC (rev 4566) @@ -323,8 +323,7 @@ <td><input type="text" name="StockCode" size="15" maxlength="18" value="' . $_POST['StockCode'] . '" /></td> </tr> <tr><td></td> - <td><font size="3"><b>' . _('OR') . ' </b></font><font size="2"><a target="_blank" href="'.$rootpath.'/Stocks.php?' . SID . - '">' . _('Create a New Stock Item') . '</a></font></td></tr> + <td><font size="3"><b>' . _('OR') . ' </b></font><font size="2"><a target="_blank" href="'.$rootpath.'/Stocks.php">' . _('Create a New Stock Item') . '</a></font></td></tr> </table><br /> <div class="centre"><input type="submit" name="Search" value="' . _('Search Now') . '" /> </div><br />'; Modified: trunk/CreditStatus.php =================================================================== --- trunk/CreditStatus.php 2011-05-13 10:50:42 UTC (rev 4565) +++ trunk/CreditStatus.php 2011-05-14 11:24:22 UTC (rev 4566) @@ -1,8 +1,7 @@ <?php -/* $Revision: 1.16 $ */ + /* $Id$*/ -//$PageSecurity = 3; include('includes/session.inc'); $title = _('Credit Status Code Maintenance'); include('includes/header.inc'); @@ -127,7 +126,7 @@ } else { //only delete if used in neither customer or supplier accounts - $sql="DELETE FROM holdreasons WHERE reasoncode=$SelectedReason"; + $sql="DELETE FROM holdreasons WHERE reasoncode='" . $SelectedReason . "'"; $result = DB_query($sql,$db); prnMsg(_('This credit status code has been deleted'),'success'); } @@ -154,9 +153,9 @@ <th>'. _('Disallow Invoices') .'</th>'; $k=0; //row colour counter - while ($myrow=DB_fetch_row($result)) { + while ($myrow=DB_fetch_array($result)) { - if ($myrow[2]==0) { + if ($myrow['dissallowinvoices']==0) { $DissallowText = _('Invoice OK'); } else { $DissallowText = '<b>'. _('NO INVOICING') .'</b>'; @@ -169,20 +168,20 @@ $k=1; } - printf("<td>%s</td> - <td>%s</td> - <td>%s</td> - <td><a href=\"%s?SelectedReason=%s\">" . _('Edit') . "</a></td> - <td><a href=\"%s?SelectedReason=%s&delete=1\">". _('Delete') .'</a></td> - </tr>', - $myrow[0], - $myrow[1], - $DissallowText, - $_SERVER['PHP_SELF'], - $myrow[0], - $_SERVER['PHP_SELF'], - $myrow[0]); - + printf('<td>%s</td> + <td>%s</td> + <td>%s</td> + <td><a href="%s?SelectedReason=%s">' . _('Edit') . '</a></td> + <td><a href="%s?SelectedReason=%s&delete=1" onclick="return confirm(\'' . _('Are you sure you wish to delete this credit stuatus record?') . '\');">'. _('Delete') .'</a></td> + </tr>', + $myrow['reasoncode'], + $myrow['reasondescription'], + $DissallowText, + $_SERVER['PHP_SELF'], + $myrow['reasoncode'], + $_SERVER['PHP_SELF'], + $myrow['reasoncode']); + } //END WHILE LIST LOOP echo '</table>'; @@ -213,9 +212,9 @@ $_POST['ReasonDescription'] = $myrow['reasondescription']; $_POST['DisallowInvoices'] = $myrow['dissallowinvoices']; - echo "<input type=hidden name='SelectedReason' VALUE='" . $SelectedReason . "'>"; - echo "<input type=hidden name='ReasonCode' VALUE='" . $_POST['ReasonCode'] . "'>"; - echo "<table class=selection><tr><td>". _('Status Code') .':</td><td>'; + echo '<input type="hidden" name="SelectedReason" value="' . $SelectedReason . '">'; + echo '<input type="hidden" name="ReasonCode" value="' . $_POST['ReasonCode'] . '">'; + echo '<table class="selection"><tr><td>'. _('Status Code') .':</td><td>'; echo $_POST['ReasonCode'] . '</td></tr>'; } else { //end of if $SelectedReason only do the else when a new record is being entered @@ -224,10 +223,9 @@ } echo '<br><table class=selection> <tr> - <td>'. _('Status Code') .":</td> - <td><input " . (in_array('ReasonCode',$Errors) ? 'class="inputerror"' : '' ) . - " tabindex=1 type='Text' name='ReasonCode' VALUE='". $_POST['ReasonCode'] ."' size=3 maxlength=2></td> - </tr>"; + <td>'. _('Status Code') .':</td> + <td><input ' . (in_array('ReasonCode',$Errors) ? 'class="inputerror"' : '' ) . ' tabindex=1 type="text" name="ReasonCode" value="'. $_POST['ReasonCode'] .'" size=3 maxlength=2></td> + </tr>'; } if (!isset($_POST['ReasonDescription'])) { @@ -247,4 +245,4 @@ echo '</table><br><div class="centre"><input tabindex=4 type="submit" name="submit" value="' . _('Enter Information') . '"></div></form>'; } //end if record deleted no point displaying form to add record include('includes/footer.inc'); -?> +?> \ No newline at end of file Modified: trunk/CustomerBranches.php =================================================================== --- trunk/CustomerBranches.php 2011-05-13 10:50:42 UTC (rev 4565) +++ trunk/CustomerBranches.php 2011-05-14 11:24:22 UTC (rev 4566) @@ -97,8 +97,8 @@ $row = DB_fetch_array($resultgeo); $api_key = $row['geocode_key']; $map_host = $row['map_host']; - define("MAPS_HOST", $map_host); - define("KEY", $api_key); + define('MAPS_HOST', $map_host); + define('KEY', $api_key); if ($map_host=="") { // check that some sane values are setup already in geocode tables, if not skip the geocoding but add the record anyway. echo '<div class="warn">' . _('Warning - Geocode Integration is enabled, but no hosts are setup. Go to Geocode Setup') . '</div>'; @@ -417,8 +417,12 @@ $DebtorNo, urlencode($myrow[1]), _('Delete Branch')); - if ($myrow[11]){ $TotalDisable++; } - else { $TotalEnable++; } + + if ($myrow[11]){ + $TotalDisable++; + }else { + $TotalEnable++; + } } while ($myrow = DB_fetch_row($result)); //END WHILE LIST LOOP @@ -628,9 +632,9 @@ while ($myrow = DB_fetch_array($result)) { if (isset($_POST['Salesman']) and $myrow['salesmancode']==$_POST['Salesman']) { - echo '<option selected VALUE='; + echo '<option selected value='; } else { - echo '<option VALUE='; + echo '<option value='; } echo $myrow['salesmancode'] . '>' . $myrow['salesmanname']; @@ -654,11 +658,11 @@ echo '<td><select tabindex=14 name="Area">'; 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']; } //end while loop @@ -666,7 +670,7 @@ echo '</select></td></tr>'; DB_data_seek($result,0); - $sql = 'SELECT loccode, locationname FROM locations'; + $sql = "SELECT loccode, locationname FROM locations"; $result = DB_query($sql,$db); if (DB_num_rows($result)==0){ @@ -682,11 +686,11 @@ while ($myrow = DB_fetch_array($result)) { if (isset($_POST['DefaultLocation']) and $myrow['loccode']==$_POST['DefaultLocation']) { - echo '<option selected value='; + echo '<option selected value="'; } else { - echo '<option value='; + echo '<option value="'; } - echo $myrow['loccode'] . '>' . $myrow['locationname'] . '</option>'; + echo $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } //end while loop @@ -714,11 +718,11 @@ while ($myrow = DB_fetch_array($result)) { if (isset($_POST['TaxGroup']) and $myrow['taxgroupid']==$_POST['TaxGroup']) { - echo '<option selected VALUE='; + echo '<option selected value="'; } else { - echo '<option VALUE='; + echo '<option value="'; } - echo $myrow['taxgroupid'] . '>' . $myrow['taxgroupdescription'] . '</option>'; + echo $myrow['taxgroupid'] . '">' . $myrow['taxgroupdescription'] . '</option>'; } //end while loop @@ -779,7 +783,7 @@ if (!isset($_POST['CustBranchCode'])) {$_POST['CustBranchCode']='';} echo '<td><input tabindex=27 type="Text" name="CustBranchCode" size=31 maxlength=30 value="'. $_POST['CustBranchCode'].'"></td></tr>'; echo '</table>'; - echo '<br /><div class="centre"><input tabindex=28 type="Submit" name="submit" value="' . _('Enter Branch') . '"></div>'; + echo '<br /><div class="centre"><input tabindex=28 type="submit" name="submit" value="' . _('Enter Branch') . '"></div>'; echo '</form>'; } //end if record deleted no point displaying form to add record Modified: trunk/CustomerInquiry.php =================================================================== --- trunk/CustomerInquiry.php 2011-05-13 10:50:42 UTC (rev 4565) +++ trunk/CustomerInquiry.php 2011-05-14 11:24:22 UTC (rev 4566) @@ -1,12 +1,9 @@ <?php -/* $Revision: 1.30 $ */ /* $Id$*/ include('includes/SQL_CommonFunctions.inc'); -//$PageSecurity = 1; - include('includes/session.inc'); $title = _('Customer Inquiry'); include('includes/header.inc'); @@ -15,7 +12,7 @@ if(!isset($_GET['CustomerID']) AND !isset($_SESSION['CustomerID'])){ prnMsg(_('To display the enquiry a customer must first be selected from the customer selection screen'),'info'); - echo '<br><div class="centre"><a href="'. $rootpath . '/SelectCustomer.php?' . SID . '">' . _('Select a Customer to Inquire On') . '</a><br></div>'; + echo '<br /><div class="centre"><a href="'. $rootpath . '/SelectCustomer.php?' . SID . '">' . _('Select a Customer to Inquire On') . '</a><br /></div>'; include('includes/footer.inc'); exit; } else { @@ -37,6 +34,7 @@ $SQL = "SELECT debtorsmaster.name, currencies.currency, + currencies.decimalplaces, paymentterms.terms, debtorsmaster.creditlimit, holdreasons.dissallowinvoices, @@ -93,18 +91,21 @@ $NIL_BALANCE = True; - $SQL = "SELECT debtorsmaster.name, currencies.currency, paymentterms.terms, - debtorsmaster.creditlimit, 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 = '" . $CustomerID . "'"; - + $SQL = "SELECT debtorsmaster.name, + currencies.currency, + currencies.decimalplaces, + paymentterms.terms, + debtorsmaster.creditlimit, + holdreasons.dissallowinvoices, + holdreasons.reasondescription + FROM debtorsmaster INNER JOIN paymentterms + ON debtorsmaster.paymentterms = paymentterms.termsindicator + INNER JOIN holdreasons + ON debtorsmaster.holdreason = holdreasons.reasoncode + INNER JOIN currencies + debtorsmaster.currcode = currencies.currabrev + WHERE debtorsmaster.debtorno = '" . $CustomerID . "'"; + $ErrMsg =_('The customer details could not be retrieved by the SQL because'); $CustomerResult = DB_query($SQL,$db,$ErrMsg); @@ -123,33 +124,32 @@ echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/customer.png" title="' . _('Customer') . '" alt="" />' . ' ' . _('Customer') . ' : ' . $CustomerRecord['name'] . ' - (' . _('All amounts stated in') . - ' ' . $CustomerRecord['currency'] . ')<br><br>' . _('Terms') . ' : ' . $CustomerRecord['terms'] . '<br>' . _('Credit Limit') . + ' ' . $CustomerRecord['currency'] . ')<br /><br />' . _('Terms') . ' : ' . $CustomerRecord['terms'] . '<br />' . _('Credit Limit') . ': ' . number_format($CustomerRecord['creditlimit'],0) . ' ' . _('Credit Status') . ': ' . $CustomerRecord['reasondescription'] . '</p>'; if ($CustomerRecord['dissallowinvoices']!=0){ - echo '<br><font color=RED size=4><b>' . _('ACCOUNT ON HOLD') . '</font></b><br>'; + echo '<br /><font color=RED size=4><b>' . _('ACCOUNT ON HOLD') . '</font></b><br />'; } -echo "<table class=selection width=70%> +echo '<table class=selection width=70%> <tr> - <th width=20%>" . _('Total Balance') . "</th> - <th width=20%>" . _('Current') . "</th> - <th width=20%>" . _('Now Due') . "</th> - <th width=20%>" . $_SESSION['PastDueDays1'] . "-" . $_SESSION['PastDueDays2'] . ' ' . _('Days Overdue') . "</th> - <th width=20%>" . _('Over') . ' ' . $_SESSION['PastDueDays2'] . ' ' . _('Days Overdue') . '</th></tr>'; + <th width=20%>' . _('Total Balance') . '</th> + <th width=20%>' . _('Current') . '</th> + <th width=20%>' . _('Now Due') . '</th> + <th width=20%>' . $_SESSION['PastDueDays1'] . '-' . $_SESSION['PastDueDays2'] . ' ' . _('Days Overdue') . '</th> + <th width=20%>' . _('Over') . ' ' . $_SESSION['PastDueDays2'] . ' ' . _('Days Overdue') . '</th></tr>'; -echo '<tr><td class=number>' . number_format($CustomerRecord['balance'],2) . '</td> - <td class=number>' . number_format(($CustomerRecord['balance'] - $CustomerRecord['due']),2) . '</td> - <td class=number>' . number_format(($CustomerRecord['due']-$CustomerRecord['overdue1']),2) . '</td> - <td class=number>' . number_format(($CustomerRecord['overdue1']-$CustomerRecord['overdue2']) ,2) . '</td> - <td class=number>' . number_format($CustomerRecord['overdue2'],2) . '</td> +echo '<tr><td class=number>' . number_format($CustomerRecord['balance'],$CustomerRecord['decimalplaces']) . '</td> + <td class=number>' . number_format(($CustomerRecord['balance'] - $CustomerRecord['due']),$CustomerRecord['decimalplaces']) . '</td> + <td class=number>' . number_format(($CustomerRecord['due']-$CustomerRecord['overdue1']),$CustomerRecord['decimalplaces']) . '</td> + <td class=number>' . number_format(($CustomerRecord['overdue1']-$CustomerRecord['overdue2']) ,$CustomerRecord['decimalplaces']) . '</td> + <td class=number>' . number_format($CustomerRecord['overdue2'],$CustomerRecord['decimalplaces']) . '</td> </tr> </table>'; -echo "<br><div class='centre'><form action='" . $_SERVER['PHP_SELF'] . "' method=post>"; +echo '<br /><div class="centre"><form action="' . $_SERVER['PHP_SELF'] . '" method=post>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; -echo _('Show all transactions after') . ": <input tabindex=1 type=text class='date' alt='".$_SESSION['DefaultDateFormat']."' id='datepicker' name='TransAfterDate' Value='" . $_POST['TransAfterDate'] . "' MAXLENGTH =10 size=12>" . - " <input tabindex=2 type=submit name='Refresh Inquiry' value='" . _('Refresh Inquiry') . "'></div></form><br>"; +echo _('Show all transactions after') . ': <input tabindex=1 type=text class="date" alt="' .$_SESSION['DefaultDateFormat']. '" id="datepicker" name="TransAfterDate" Value="' . $_POST['TransAfterDate'] . '" maxlength =10 size=12>' . '<input tabindex=2 type="submit" name="Refresh Inquiry" value="' . _('Refresh Inquiry') . '"></div></form><br />'; $DateAfterCriteria = FormatDateForSQL($_POST['TransAfterDate']); @@ -186,21 +186,22 @@ echo '<table class="selection" cellpadding="2" colspan="7">'; $tableheader = '<tr> - <th>' . _('Type') . '</th> - <th>' . _('Number') . '</th> - <th>' . _('Date') . '</th> - <th>' . _('Branch') . '</th> - <th>' . _('Reference') . '</th> - <th>' . _('Comments') . '</th> - <th>' . _('Order') . '</th> - <th>' . _('Total') . '</th> - <th>' . _('Allocated') . '</th> - <th>' . _('Balance') . '</th> - <th>' . _('More Info') . '</th> - <th>' . _('More Info') . '</th> - <th>' . _('More Info') . '</th> - <th>' . _('More Info') . '</th> - <th>' . _('More Info') . '</th></tr>'; + <th>' . _('Type') . '</th> + <th>' . _('Number') . '</th> + <th>' . _('Date') . '</th> + <th>' . _('Branch') . '</th> + <th>' . _('Reference') . '</th> + <th>' . _('Comments') . '</th> + <th>' . _('Order') . '</th> + <th>' . _('Total') . '</th> + <th>' . _('Allocated') . '</th> + <th>' . _('Balance') . '</th> + <th>' . _('More Info') . '</th> + <th>' . _('More Info') . '</th> + <th>' . _('More Info') . '</th> + <th>' . _('More Info') . '</th> + <th>' . _('More Info') . '</th> + </tr>'; echo $tableheader; @@ -225,25 +226,26 @@ } $BaseFormatString = '<td>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td width="200">%s</td> - <td>%s</td> - <td class=number>%s</td> - <td class=number>%s</td> - <td class=number>%s</td>'; + <td>%s</td> + <td>%s</td> + <td>%s</td> + <td>%s</td> + <td width="200">%s</td> + <td>%s</td> + <td class=number>%s</td> + <td class=number>%s</td> + <td class=number>%s</td>'; + - $CreditInvoiceFormatString = '<td><a href="%s/Credit_Invoice.php?InvoiceNumber=%s">' . _('Credit ') .'<IMG SRC="%s/credit.gif" title="' . _('Click to credit the invoice') . '"></a></td>'; + $CreditInvoiceFormatString = '<td><a href="%s/Credit_Invoice.php?InvoiceNumber=%s">' . _('Credit ') .'<img src="%s/credit.gif" title="' . _('Click to credit the invoice') . '"></a></td>'; - $PreviewInvoiceFormatString = '<td><a href="%s/PrintCustTrans.php?FromTransNo=%s&InvOrCredit=Invoice">' . _('HTML ') . '<IMG SRC="%s/preview.gif" title="' . _('Click to preview the invoice') . '"></a></td> - <td><a href="%s/%s?FromTransNo=%s&InvOrCredit=Invoice&PrintPDF=True">' . _('PDF ') . '<IMG SRC="%s/css/' . $theme . '/images/pdf.png" title="' . _('Click for PDF') . '"></a></td> - <td><a href="%s/EmailCustTrans.php?FromTransNo=%s&InvOrCredit=Invoice">' . _('Email ') . '<IMG SRC="%s/email.gif" title="' . _('Click to email the invoice') . '"></a></td>'; + $PreviewInvoiceFormatString = '<td><a href="%s/PrintCustTrans.php?FromTransNo=%s&InvOrCredit=Invoice">' . _('HTML ') . '<img src="%s/preview.gif" title="' . _('Click to preview the invoice') . '"></a></td> + <td><a href="%s/%s?FromTransNo=%s&InvOrCredit=Invoice&PrintPDF=True">' . _('PDF ') . '<img src="%s/css/' . $theme . '/images/pdf.png" title="' . _('Click for PDF') . '"></a></td> + <td><a href="%s/EmailCustTrans.php?FromTransNo=%s&InvOrCredit=Invoice">' . _('Email ') . '<img src="%s/email.gif" title="' . _('Click to email the invoice') . '"></a></td>'; $PreviewCreditFormatString = '<td><a href="%s/PrintCustTrans.php?FromTransNo=%s&InvOrCredit=Credit">' . _('HTML ') . ' <IMG SRC="%s/preview.gif" title="' . _('Click to preview the credit note') . '"></a></td> - <td><a href="%s/%s?FromTransNo=%s&InvOrCredit=Credit&PrintPDF=True">' . _('PDF ') . '<IMG SRC="%s/css/' . $theme . '/images/pdf.png" title="' . _('Click for PDF') . '"></a></td> - <td><a href="%s/EmailCustTrans.php?FromTransNo=%s&InvOrCredit=Credit">' . _('Email') . ' <IMG SRC="%s/email.gif" title="' . _('Click to email the credit note') . '"></a></td>'; + <td><a href="%s/%s?FromTransNo=%s&InvOrCredit=Credit&PrintPDF=True">' . _('PDF ') . '<img src="%s/css/' . $theme . '/images/pdf.png" title="' . _('Click for PDF') . '"></a></td> + <td><a href="%s/EmailCustTrans.php?FromTransNo=%s&InvOrCredit=Credit">' . _('Email') . ' <img src="%s/email.gif" title="' . _('Click to email the credit note') . '"></a></td>'; /* assumed allowed page security token 3 allows the user to create credits for invoices */ if (in_array(3,$_SESSION['AllowedPageSecurityTokens']) && $myrow['type']==10){ @@ -255,7 +257,7 @@ /* format string with GL inquiry options and for invoice to be credited */ printf($BaseFormatString . $CreditInvoiceFormatString . $PreviewInvoiceFormatString . - '<td><a href="%s/GLTransInquiry.php?%s&TypeID=%s&TransNo=%s">' . _('View GL Entries') . ' <IMG SRC="' .$rootpath. '/css/'.$theme.'/images/gl.png" title="' . _('View the GL Entries') . '"></a></td> + '<td><a href="%s/GLTransInquiry.php?TypeID=%s&TransNo=%s">' . _('View GL Entries') . ' <img src="' .$rootpath. '/css/'.$theme.'/images/gl.png" title="' . _('View the GL Entries') . '"></a></td> </tr>', //$BaseFormatString parameters $myrow['typename'], @@ -265,9 +267,9 @@ $myrow['reference'], $myrow['invtext'], $myrow['order_'], - number_format($myrow['totalamount'],2), - number_format($myrow['allocated'],2), - number_format($myrow['totalamount']-$myrow['allocated'],2), + number_format($myrow['totalamount'],$CustomerRecord['decimalplaces']), + number_format($myrow['allocated'],$CustomerRecord['decimalplaces']), + number_format($myrow['totalamount']-$myrow['allocated'],$CustomerRecord['decimalplaces']), //$CreditInvoiceFormatString parameters $rootpath, $myrow['transno'], @@ -279,13 +281,12 @@ $rootpath, $PrintCustomerTransactionScript, $myrow['transno'], - $rootpath.'/css/'.$theme.'/images', $rootpath, + $rootpath, $myrow['transno'], $rootpath.'/css/'.$theme.'/images', //Parameter for string for GL Trans Inquiries $rootpath, - SID, $myrow['type'], $myrow['transno']); } else { //user does not have privileges to see GL inquiry stuff @@ -299,9 +300,9 @@ $myrow['reference'], $myrow['invtext'], $myrow['order_'], - number_format($myrow['totalamount'],2), - number_format($myrow['allocated'],2), - number_format($myrow['totalamount']-$myrow['allocated'],2), + number_format($myrow['totalamount'],$CustomerRecord['decimalplaces']), + number_format($myrow['allocated'],$CustomerRecord['decimalplaces']), + number_format($myrow['totalamount']-$myrow['allocated'],$CustomerRecord['decimalplaces']), //CreditInvoiceFormatString parameters $rootpath, $myrow['transno'], @@ -313,8 +314,8 @@ $rootpath, $PrintCustomerTransactionScript, $myrow['transno'], - $rootpath.'/css/'.$theme.'/images', $rootpath, + $rootpath, $myrow['transno'], $rootpath.'/css/'.$theme.'/images'); } @@ -332,9 +333,9 @@ $myrow['reference'], $myrow['invtext'], $myrow['order_'], - number_format($myrow['totalamount'],2), - number_format($myrow['allocated'],2), - number_format($myrow['totalamount']-$myrow['allocated'],2), + number_format($myrow['totalamount'],$CustomerRecord['decimalplaces']), + number_format($myrow['allocated'],$CustomerRecord['decimalplaces']), + number_format($myrow['totalamount']-$myrow['allocated'],$CustomerRecord['decimalplaces']), //$PreviewInvoiceFormatString parameters $rootpath, $myrow['transno'], @@ -342,8 +343,8 @@ $rootpath, $PrintCustomerTransactionScript, $myrow['transno'], - $rootpath.'/css/'.$theme.'/images', $rootpath, + $rootpath, $myrow['transno'], $rootpath.'/css/'.$theme.'/images'); @@ -351,8 +352,8 @@ if ($_SESSION['CompanyRecord']['gllink_debtors']== 1 AND in_array(8,$_SESSION['AllowedPageSecurityTokens'])){ printf($BaseFormatString . $PreviewCreditFormatString . - "<td><a href='%s/CustomerAllocations.php?AllocTrans=%s'>" . _('Allocation') . "<IMG SRC='" .$rootpath."/css/".$theme."/images/allocation.png' title='" . _('Click to allocate funds') . "'></a></td> - <td><a href='%s/GLTransInquiry.php?%sTypeID=%s&TransNo=%s'>" . _('View GL Entries') . ' <a><IMG SRC="' .$rootpath.'/css/'.$theme.'/images/gl.png" title="' . _('View the GL Entries') . '"></a></td></tr>', + '<td><a href="%s/CustomerAllocations.php?AllocTrans=%s">' . _('Allocation') . '<img src="' .$rootpath .'/css/' . $theme .'/images/allocation.png" title="' . _('Click to allocate funds') . '"></a></td> + <td><a href="%s/GLTransInquiry.php?TypeID=%s&TransNo=%s">' . _('View GL Entries') . ' <a><img src="' .$rootpath.'/css/'.$theme.'/images/gl.png" title="' . _('View the GL Entries') . '"></a></td></tr>', //$BaseFormatString parameters $myrow['typename'], $myrow['transno'], @@ -361,9 +362,9 @@ $myrow['reference'], $myrow['invtext'], $myrow['order_'], - number_format($myrow['totalamount'],2), - number_format($myrow['allocated'],2), - number_format($myrow['totalamount']-$myrow['allocated'],2), + number_format($myrow['totalamount'],$CustomerRecord['decimalplaces']), + number_format($myrow['allocated'],$CustomerRecord['decimalplaces']), + number_format($myrow['totalamount']-$myrow['allocated'],$CustomerRecord['decimalplaces']), //$PreviewCreditFormatString parameters $rootpath, $myrow['transno'], @@ -371,22 +372,21 @@ $rootpath, $PrintCustomerTransactionScript, $myrow['transno'], - $rootpath.'/css/'.$theme.'/images', $rootpath, + $rootpath, $myrow['transno'], $rootpath.'/css/'.$theme.'/images', // hand coded format string for Allocations and GLTrans Inquiry parameters $rootpath, $myrow['id'], $rootpath, - SID, $myrow['type'], $myrow['transno']); } else { printf($BaseFormatString . $PreviewCreditFormatString . - "<td><a href='%s/CustomerAllocations.php?AllocTrans=%s'>" . _('Allocation') . "<IMG SRC='%s/allocation.png' title='" . _('Click to allocate funds') . "'></a></td> - </tr>", + '<td><a href="%s/CustomerAllocations.php?AllocTrans=%s">' . _('Allocation') . '<img src="%s/allocation.png" title="' . _('Click to allocate funds') . '"></a></td> + </tr>', $myrow['typename'], $myrow['transno'], ConvertSQLDate($myrow['trandate']), @@ -394,9 +394,9 @@ $myrow['reference'], $myrow['invtext'], $myrow['order_'], - number_format($myrow['totalamount'],2), - number_format($myrow['allocated'],2), - number_format($myrow['totalamount']-$myrow['allocated'],2), + number_format($myrow['totalamount'],$CustomerRecord['decimalplaces']), + number_format($myrow['allocated'],$CustomerRecord['decimalplaces']), + number_format($myrow['totalamount']-$myrow['allocated'],$CustomerRecord['decimalplaces']), //$PreviewCreditFormatString parameters $rootpath, $myrow['transno'], @@ -404,8 +404,8 @@ $rootpath, $PrintCustomerTransactionScript, $myrow['transno'], - $rootpath.'/css/'.$theme.'/images', $rootpath, + $rootpath, $myrow['transno'], $rootpath.'/css/'.$theme.'/images', //Parameters for hand coded string to show allocations @@ -418,9 +418,9 @@ //If security token 8 in the allowed page security tokens then assumed ok for GL trans inquiries if ($_SESSION['CompanyRecord']['gllink_debtors']== 1 AND in_array(8,$_SESSION['AllowedPageSecurityTokens'])){ printf($BaseFormatString . - "<td><a href='%s/CustomerAllocations.php?AllocTrans=%s'>" . _('Allocation') . "<IMG SRC='" .$rootpath."/css/".$theme."/images/allocation.png' title='" . _('Click to allocate funds') . "'></a></td> - <td><a href='%s/GLTransInquiry.php?%s&TypeID=%s&TransNo=%s'>" . _('View GL Entries') . " <IMG SRC='" .$rootpath."/css/".$theme."/images/gl.png' title='" . _('View the GL Entries') . "'></a></td> - </tr>", + '<td><a href="%s/CustomerAllocations.php?AllocTrans=%s">' . _('Allocation') . '<img src="' .$rootpath . '/css/' . $theme .'/images/allocation.png" title="' . _('Click to allocate funds') . '"></a></td> + <td><a href="%s/GLTransInquiry.php?TypeID=%s&TransNo=%s">' . _('View GL Entries') . ' <img src="' .$rootpath . '/css/' . $theme .'/images/gl.png" title="' . _('View the GL Entries') . '"></a></td> + </tr>', $myrow['typename'], $myrow['transno'], ConvertSQLDate($myrow['trandate']), @@ -428,19 +428,18 @@ $myrow['reference'], $myrow['invtext'], $myrow['order_'], - number_format($myrow['totalamount'],2), - number_format($myrow['allocated'],2), - number_format($myrow['totalamount']-$myrow['allocated'],2), + number_format($myrow['totalamount'],$CustomerRecord['decimalplaces']), + number_format($myrow['allocated'],$CustomerRecord['decimalplaces']), + number_format($myrow['totalamount']-$myrow['allocated'],$CustomerRecord['decimalplaces']), $rootpath, $myrow['id'], $rootpath, - SID, $myrow['type'], $myrow['transno']); } else { //no permission for GLTrans Inquiries printf($BaseFormatString . - "<td><a href='%s/CustomerAllocations.php?AllocTrans=%s'>" . _('Allocation') . "<IMG SRC='" .$rootpath."/css/".$theme."/images/allocation.png' title='" . _('Click to allocate funds') . "'></a></td> - </tr>", + '<td><a href="%s/CustomerAllocations.php?AllocTrans=%s">' . _('Allocation') . '<img src="' .$rootpath . '/css/' . $theme .'/images/allocation.png" title="' . _('Click to allocate funds') . '"></a></td> + </tr>', $myrow['typename'], $myrow['transno'], ConvertSQLDate($myrow['trandate']), @@ -448,9 +447,9 @@ $myrow['reference'], $myrow['invtext'], $myrow['order_'], - number_format($myrow['totalamount'],2), - number_format($myrow['allocated'],2), - number_format($myrow['totalamount']-$myrow['allocated'],2), + number_format($myrow['totalamount'],$CustomerRecord['decimalplaces']), + number_format($myrow['allocated'],$CustomerRecord['decimalplaces']), + number_format($myrow['totalamount']-$myrow['allocated'],$CustomerRecord['decimalplaces']), $rootpath, $myrow['id']); } @@ -459,7 +458,7 @@ //If security token 8 in the allowed page security tokens then assumed ok for GL trans inquiries if ($_SESSION['CompanyRecord']['gllink_debtors']== 1 AND in_array(8,$_SESSION['AllowedPageSecurityTokens'])){ printf($BaseFormatString . - '<td><a href="%s/GLTransInquiry.php?%s&TypeID=%s&TransNo=%s">' . _('View GL Entries') . ' <a></td></tr>', + '<td><a href="%s/GLTransInquiry.php?TypeID=%s&TransNo=%s">' . _('View GL Entries') . ' <a></td></tr>', $myrow['typename'], $myrow['transno'], ConvertSQLDate($myrow['trandate']), @@ -467,11 +466,10 @@ $myrow['reference'], $myrow['invtext'], $myrow['order_'], - number_format($myrow['totalamount'],2), - number_format($myrow['allocated'],2), - number_format($myrow['totalamount']-$myrow['allocated'],2), + number_format($myrow['totalamount'],$CustomerRecord['decimalplaces']), + number_format($myrow['allocated'],$CustomerRecord['decimalplaces']), + number_format($myrow['totalamount']-$myrow['allocated'],$CustomerRecord['decimalplaces']), $rootpath, - SID, $myrow['type'], $myrow['transno']); } else { //no permission for GLTrans Inquiries @@ -483,15 +481,15 @@ $myrow['reference'], $myrow['invtext'], $myrow['order_'], - number_format($myrow['totalamount'],2), - number_format($myrow['allocated'],2), - number_format($myrow['totalamount']-$myrow['allocated'],2)); + number_format($myrow['totalamount'],$CustomerRecord['decimalplaces']), + number_format($myrow['allocated'],$CustomerRecord['decimalplaces']), + number_format($myrow['totalamount']-$myrow['allocated'],$CustomerRecord['decimalplaces'])); } } else { //If security token 8 in the allowed page security tokens then assumed ok for GL trans inquiries if ($_SESSION['CompanyRecord']['gllink_debtors']== 1 AND in_array(8,$_SESSION['AllowedPageSecurityTokens'])){ printf($BaseFormatString . - '<td><a href="%s/GLTransInquiry.php?%s&TypeID=%s&TransNo=%s">' . _('View GL Entries') . ' <a></td></tr>', + '<td><a href="%s/GLTransInquiry.php?TypeID=%s&TransNo=%s">' . _('View GL Entries') . ' <a></td></tr>', $myrow['typename'], $myrow['transno'], ConvertSQLDate($myrow['trandate']), @@ -499,11 +497,10 @@ $myrow['reference'], $myrow['invtext'], $myrow['order_'], - number_format($myrow['totalamount'],2), - number_format($myrow['allocated'],2), - number_format($myrow['totalamount']-$myrow['allocated'],2), + number_format($myrow['totalamount'],$CustomerRecord['decimalplaces']), + number_format($myrow['allocated'],$CustomerRecord['decimalplaces']), + number_format($myrow['totalamount']-$myrow['allocated'],$CustomerRecord['decimalplaces']), $rootpath, - SID, $myrow['type'], $myrow['transno']); } else { @@ -515,9 +512,9 @@ $myrow['reference'], $myrow['invtext'], $myrow['order_'], - number_format($myrow['totalamount'],2), - number_format($myrow['allocated'],2), - number_format($myrow['totalamount']-$myrow['allocated'],2)); + number_format($myrow['totalamount'],$CustomerRecord['decimalplaces']), + number_format($myrow['allocated'],$CustomerRecord['decimalplaces']), + number_format($myrow['totalamount']-$myrow['allocated'],$CustomerRecord['decimalplaces'])); } } @@ -526,4 +523,4 @@ echo '</table>'; include('includes/footer.inc'); -?> +?> \ No newline at end of file Modified: trunk/CustomerReceipt.php =================================================================== --- trunk/CustomerReceipt.php 2011-05-13 10:50:42 UTC (rev 4565) +++ trunk/CustomerReceipt.php 2011-05-14 11:24:22 UTC (rev 4566) @@ -700,7 +700,7 @@ /*set up the form whatever */ -echo '<form action=' . $_SERVER['PHP_SELF'] . '?Type='.$_GET['Type'] . ' method=post name=form1>'; +echo '<form action="' . $_SERVER['PHP_SELF'] . '?Type='.$_GET['Type'] . '" method=post name=form1>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; /*show the batch header details and the entries in the batch so far */ Modified: trunk/DailyBankTransactions.php =================================================================== --- trunk/DailyBankTransactions.php 2011-05-13 10:50:42 UTC (rev 4565) +++ trunk/DailyBankTransactions.php 2011-05-14 11:24:22 UTC (rev 4566) @@ -1,6 +1,7 @@ <?php -//$PageSecurity = 8; now from Database Scripts table +/* $Id: DailyBankTransactions.php 4556 2011-04-26 11:03:36Z daintree $ */ + include ('includes/session.inc'); $title = _('Bank Transactions Inquiry'); include('includes/header.inc'); @@ -9,23 +10,24 @@ _('Search') . '" alt="" />' . ' ' . $title.'</p>'; if (!isset($_POST['Show'])) { - 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 class=selection>'; - $SQL = 'SELECT bankaccountname, - bankaccounts.accountcode, - bankaccounts.currcode - FROM bankaccounts, - chartmaster - WHERE bankaccounts.accountcode=chartmaster.accountcode'; + $SQL = "SELECT bankaccountname, + bankaccounts.accountcode, + bankaccounts.currcode + FROM bankaccounts, + chartmaster + WHERE bankaccounts.accountcode=chartmaster.accountcode"; $ErrMsg = _('The bank accounts could not be retrieved because'); $DbgMsg = _('The SQL used to retrieve the bank accounts was'); $AccountsResults = DB_query($SQL,$db,$ErrMsg,$DbgMsg); - echo '<tr><td>' . _('Bank Account') . ':</td><td><select name="BankAccount">'; + echo '<tr><td>' . _('Bank Account') . ':</td> + <td><select name="BankAccount">'; if (DB_num_rows($AccountsResults)==0){ echo '</select></td></tr></table><p>'; @@ -60,30 +62,33 @@ echo '</form>'; } else { $SQL = "SELECT bankaccountname, - bankaccounts.currcode - FROM bankaccounts - WHERE bankaccounts.accountcode='" . $_POST['BankAccount'] . "'"; + bankaccounts.currcode, + currencies.decimalplaces + FROM bankaccounts + INNER JOIN currencies + ON bankaccounts.currcode = currencies.currabrev + WHERE bankaccounts.accountcode='" . $_POST['BankAccount'] . "'"; $BankResult = DB_query($SQL,$db,_('Could not retrieve the bank account details')); $sql="SELECT banktrans.currcode, - banktrans.amount, - banktrans.functionalexrate, - banktrans.exrate, - banktrans.banktranstype, - banktrans.transdate, - bankaccounts.bankaccountname, - systypes.typename, - systypes.typeid - FROM banktrans - INNER JOIN bankaccounts - ON banktrans.bankact=bankaccounts.accountcode - INNER JOIN systypes - ON banktrans.type=systypes.typeid - WHERE bankact='".$_POST['BankAccount']."' - AND transdate>='" . FormatDateForSQL($_POST['FromTransDate']) . "' - AND transdate<='" . FormatDateForSQL($_POST['ToTransDate']) . "' - ORDER BY banktrans.transdate"; + banktrans.amount, + banktrans.functionalexrate, + banktrans.exrate, + banktrans.banktranstype, + banktrans.transdate, + bankaccounts.bankaccountname, + systypes.typename, + systypes.typeid + FROM banktrans + INNER JOIN bankaccounts + ON banktrans.bankact=bankaccounts.accountcode + INNER JOIN systypes + ON banktrans.type=systypes.typeid + WHERE bankact='".$_POST['BankAccount']."' + AND transdate>='" . FormatDateForSQL($_POST['FromTransDate']) . "' + AND transdate<='" . FormatDateForSQL($_POST['ToTransDate']) . "' + ORDER BY banktrans.transdate"; $result = DB_query($sql, $db); if (DB_num_rows($result)==0) { prnMsg(_('There are no transactions for this account in the date range selected'), 'info'); @@ -94,15 +99,15 @@ <th colspan=7><font size=3 color=blue>' . _('Account Transactions For').' '.$BankDetailRow['bankaccountname'].' '._('Between').' '.$_POST['FromTransDate'] . ' ' . _('and') . ' ' . $_POST['ToTransDate'] . '</font></th> </tr>'; echo '<tr> - <th>' . ('Date') . '</th> - <th>'._('Transaction type').'</th> - <th>'._('Type').'</th> - <th>'._('Reference').'</th> - <th>'._('Amount in').' '.$BankDetailRow['currcode'].'</th> - <th>'._('Running Total').' '.$BankDetailRow['currcode'].'</th> - <th>'._('Amount in').' '.$_SESSION['CompanyRecord']['currencydefault'].'</th> - <th>'._('Running Total').' '.$_SESSION['CompanyRecord']['currencydefault'].'</th> - </tr>'; + <th>' . ('Date') . '</th> + <th>'._('Transaction type').'</th> + <th>'._('Type').'</th> + <th>'._('Reference').'</th> + <th>'._('Amount in').' '.$BankDetailRow['currcode'].'</th> + <th>'._('Running Total').' '.$BankDetailRow['currcode'].'</th> + <th>'._('Amount in').' '.$_SESSION['CompanyRecord']['currencydefault'].'</th> + <th>'._('Running Total').' '.$_SESSION['CompanyRecord']['currencydefault'].'</th> + </tr>'; $AccountCurrTotal=0; $LocalCurrTotal =0; @@ -113,20 +118,20 @@ $LocalCurrTotal += $myrow['amount']/$myrow['functionalexrate']/$myrow['exrate']; echo '<tr> - <td>'. ConvertSQLDate($myrow['transdate']) . '</td> - <td>'.$myrow['typename'].'</td> - <td>'.$myrow['banktranstype'].'</td> - <td>'.$myrow['ref'].'</td> - <td class=number>'.number_format($myrow['amount'],2).'</td> - <td class=number>'.number_format($AccountCurrTotal,2).'</td> - <td class=number>'.number_format($myrow['amount']/$myrow['functionalexrate']/$myrow['exrate'],2).'</td> - <td class=number>'.number_format($LocalCurrTotal,2).'</td> - </tr>'; + <td>'. ConvertSQLDate($myrow['transdate']) . '</td> + <td>'.$myrow['typename'].'</td> + <td>'.$myrow['banktranstype'].'</td> + <td>'.$myrow['ref'].'</td> + <td class=number>'.number_format($myrow['amount'],$BankDetailRow['decimalplaces']).'</td> + <td class=number>'.number_format($AccountCurrTotal,$BankDetailRow['decimalplaces']).'</td> + <td class=number>'.number_format($myrow['amount']/$myrow['functionalexrate']/$myrow['exrate'],$_SESSION['CompanyRecord']['decimalplaces']).'</td> + <td class=number>'.number_format($LocalCurrTotal,$_SESSION['CompanyRecord']['decimalplaces']).'</td> + </tr>'; } echo '</table>'; } //end if no bank trans in the range to show - 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 '<br><div class="centre"><input type="submit" name="Return" value="' . _('Select Another Date'). '"></div>'; echo '</form>'; Modified: trunk/FTP_RadioBeacon.php =================================================================== --- trunk/FTP_RadioBeacon.php 2011-05-13 10:50:42 UTC (rev 4565) +++ trunk/FTP_RadioBeacon.php 2011-05-14 11:24:22 UTC (rev 4566) @@ -1,10 +1,9 @@ <?php -/* $Revision: 1.10 $ */ + /* $Id$*/ /*Variables required to configure this script must be set in config.php */ -//$PageSecurity = 2; include('includes/session.inc'); $title=_('FTP order to Radio Beacon'); include('includes/header.inc'); @@ -47,17 +46,17 @@ echo '<table cellpadding=2 colspan=7 WIDTH=100%>'; $TableHeader = '<tr> - <td class=tableheader>' . _('Modify') . '</td> - <td class=tableheader>' . _('Send to') . '<br>' . _('Radio Beacon') . '</td> - <td class=tableheader>' . _('Customer') . '</td> - <td class=tableheader>' . _('Branch') . '</td> - <td class=tableheader>' . _('Cust Order') . ' #</td> - <td class=tableheader>' . _('Order Date') . '</td> - <td class=tableheader>' . _('Req Del Date') . '</td> - <td class=tableheader>' . _('Delivery To') . '</td> - <td class=tableheader>' . _('Order Total') . '</td> - <td class=tableheader>' . _('Last Send') . '</td> - </tr>'; + <td class=tableheader>' . _('Modify') . '</td> + <td class=tableheader>' . _('Send to') . '<br />' . _('Radio Beacon') . '</td> + <td class=tableheader>' . _('Customer') . '</td> + <td class=tableheader>' . _('Branch') . '</td> + <td class=tableheader>' . _('Cust Order') . ' #</td> + <td class=tableheader>' . _('Order Date') . '</td> + <td class=tableheader>' . _('Req Del Date') . '</td> + <td class=tableheader>' . _('Delivery To') . '</td> + <td class=tableheader>' . _('Order Total') . '</td> + <td class=tableheader>' . _('Last Send') . '</td> + </tr>'; echo $TableHeader; @@ -72,7 +71,7 @@ $k=1; } - $FTPDispatchNote = $_SERVER['PHP_SELF'] . '?' . SID . '&OrderNo=' . $myrow['orderno']; + $FTPDispatchNote = $_SERVER['PHP_SELF'] . '?OrderNo=' . $myrow['orderno']; $FormatedDelDate = ConvertSQLDate($myrow['deliverydate']); $FormatedOrderDate = ConvertSQLDate($myrow['orddate']); $FormatedOrderValue = number_format($myrow['ordervalue'],2); @@ -80,48 +79,48 @@ $ModifyPage = $rootpath . 'SelectOrderItems.php?' . SID . '&ModifyOrderNumber=' . $myrow['orderno']; if ($myrow['printedpackingslip'] ==1){ - printf("<td><font size=2><a href='%s'>%s</a></font></td> - <td><font color=RED size=2>" . _('Already') . '<br>' . _('Sent') . "</font></td> - <td><font size=2>%s</font></td> - <td><font size=2>%s</font></td> - <td><font size=2>%s</font></td> - <td><font size=2>%s</font></td> - <td><font size=2>%s</font></td> - <td><font size=2>%s</font></td> - <td class=number><font size=2>%s</font></td> - <td><font size=2>%s</font></td></tr>", - $ModifyPage, - $myrow['orderno'], - $myrow['name'], - $myrow['brname'], - $myrow['customerref'], - $FormatedOrderDate, - $FormatedDelDate, - $myrow['deliverto'], - $FormatedOrderValue, - $FormatedDateLastSent); + printf('<td><font size=2><a href="%s">%s</a></font></td> + <td><font color=RED size=2>' . _('Already') . '<br />' . _('Sent') . '</font></td> + <td><font size=2>%s</font></td> + <td><font size=2>%s</font></td> + <td><font size=2>%s</font></td> + <td><font size=2>%s</font></td> + <td><font size=2>%s</font></td> + <td><font size=2>%s</font></td> + <td class=number><font size=2>%s</font></td> + <td><font size=2>%s</font></td></tr>', + $ModifyPage, + $myrow['orderno'], + $myrow['name'], + $myrow['brname'], + $myrow['customerref'], + $FormatedOrderDate, + $FormatedDelDate, + $myrow['deliverto'], + $FormatedOrderValue, + $FormatedDateLastSent); } else { - printf("<td><font size=2><a href='%s'>%s</a></font></td> - <td><font size=2><a href='%s'>" . _('Send') . "</a></font></td> - <td><font size=2>%s</font></td> - <td><font size=2>%s</font></td> - <td><font size=2>%s</font></td> - <td><font size=2>%s</font></td> - <td><font size=2>%s</font></td> - <td><font size=2>%s</font></td> - <td class=number><font size=2>%s</font></td> - <td><font size=2>%s</font></td></tr>", - $ModifyPage, - $myrow['orderno'], - $FTPDispatchNote, - $myrow['name'], - $myrow['brname'], - $myrow['customerref'], - $FormatedOrderDate, - $FormatedDelDate, - $myrow['deliverto'], - $FormatedOrderValue, - $FormatedDateLastSent); + printf('<td><font size=2><a href="%s">%s</a></font></td> + <td><font size=2><a href="%s">' . _('Send') . '</a></font></td> + <td><font size=2>%s</font></td> + <td><font size=2>%s</font></td> + <td><font size=2>%s</font></td> + <td><font size=2>%s</font></td> + <td><font size=2>%s</font></td> + <td><font size=2>%s</font></td> + <td class=number><font size=2>%s</font></td> + <td><font size=2>%s</font></td></tr>', + $ModifyPage, + $myrow['orderno'], + $FTPDispatchNote, + $myrow['name'], + $myrow['brname'], + $myrow['customerref'], + $FormatedOrderDate, + $FormatedDelDate, + $myrow['deliverto'], + $FormatedOrderValue, + $FormatedDateLastSent); } $j++; if ($j == 12){ @@ -173,7 +172,7 @@ debtorsmaster WHERE salesorders.debtorno=debtorsmaster.debtorno AND salesorders.fromstkloc = '". $_SESSION['RadioBeaconStockLocation'] . "' - AND salesorders.orderno=" . $_GET['OrderNo']; + AND salesorders.orderno='" . $_GET['OrderNo'] . "'"; $ErrMsg = _('There was a problem retrieving the order header details for Order Number') . ' ' . $_GET['OrderNo'] . ' ' . _('from the database'); @@ -183,24 +182,24 @@ $myrow = DB_fetch_array($result); if ($myrow['printedpackingslip']==1){ - prnMsg(_('Order Number') . ' ' . $_GET['OrderNo'] . ' ' . _('has previously been sent to Radio Beacon') . '. ' . _('It was sent on') . ' ' . ConvertSQLDate($myrow['datepackingslipprinted']) . '<br>' . _('To re-send the order with the balance not previously dispatched and invoiced the order must be modified to allow a reprint (or re-send)') . '.<br>' . _('This check is there to ensure that duplication of dispatches to the customer are avoided'),'warn'); - echo "<p><a href='$rootpath/SelectOrderItems.php?" . SID . "&ModifyOrderNumber=" . $_GET['OrderNo'] . "'>" . _('Modify the order to allow a re-send or reprint') . ' (' . _('Select Delivery Details') . ')' . '</a>'; - echo "<p><a href='$rootpath/index.php'>" . _('Back to the menu') . '</a>'; + prnMsg(_('Order Number') . ' ' . $_GET['OrderNo'] . ' ' . _('has previously been sent to Radio Beacon') . '. ' . _('It was sent on') . ' ' . ConvertSQLDate($myrow['datepackingslipprinted']) . '<br />' . _('To re-send the order with the balance not previously dispatched and invoiced the order must be modified to allow a reprint (or re-send)') . '.<br />' . _('This check is there to ensure that duplication of dispatches to the customer are avoided'),'warn'); + echo '<p><a href="' . $rootpath . '/SelectOrderItems.php?ModifyOrderNumber=' . $_GET['OrderNo'] . '">' . _('Modify the order to allow a re-send or reprint') . ' (' . _('Select Delivery Details') . ')' . '</a>'; + echo '<p><a href="' . $rootpath/index.php . '">' . _('Back to the menu') . '</a>'; include('includes/footer.inc'); exit; } /*Now get the line items */ $sql = "SELECT stkcode, - description, - quantity, - units, - qtyinvoiced, - unitprice - FROM salesorderdetails, - stockmaster - WHERE salesorderdetails.stkcode=stockmaster.stockid - AND salesorderdetails.orderno=" . $_GET['OrderNo']; + description, + quantity, + units, + qtyinvoiced, + unitprice + FROM salesorderdetails, + stockmaster + WHERE salesorderdetails.stkcode=stockmaster.stockid + AND salesorderdetails.orderno=" . $_GET['OrderNo']; $ErrMsg = _('There was a problem retrieving the line details for order number') . ' ' . $_GET['OrderNo'] . ' ' . _('from the database because'); $result=DB_query($sql,$db, $ErrMsg); @@ -267,18 +266,18 @@ $conn_id = ftp_connect($_SESSION['RadioBeaconFTP_server']); // login with username and password $login_result = ftp_login($conn_id, $_SESSION['RadioBeaconFTP_user_name'], $_SESSION['RadioBeaconFTP_user_pass']); // check connection if ((!$conn_id) || (!$login_result)) { - echo '<br>' . _('Ftp connection has failed'); - echo '<br>' . _('Attempted to connect to') . ' ' . $_SESSION['RadioBeaconFTP_server'] . ' ' . _('for user') . ' ' . $_SESSION['RadioBeaconFTP_user_name']; + echo '<br />' . _('Ftp connection has failed'); + echo '<br />' . _('Attempted to connect to') . ' ' . $_SESSION['RadioBeaconFTP_server'] . ' ' . _('for user') . ' ' . $_SESSION['RadioBeaconFTP_user_name']; die; } else { - echo '<br>' . _('Connected to Radio Beacon FTP server at') . ' ' . $_SESSION['RadioBeaconFTP_server'] . ' ' . _('with user name') . ' ' . $_SESSION['RadioBeaconFTP_user_name']; + echo '<br />' . _('Connected to Radio Beacon FTP server at') . ' ' . $_SESSION['RadioBeaconFTP_server'] . ' ' . _('with user name') . ' ' . $_SESSION['RadioBeaconFTP_user_name']; } // upload the file $upload = ftp_put($conn_id, $FilePrefix . $FileNumber . '.txt', $FileName, FTP_ASCII); // check upload status if (!$upload) { prnMsg(_('FTP upload has failed'),'success'); exit; } else { - echo '<br>' . _('Uploaded') . ' ' . $FileName . ' ' . _('to') . ' ' . $_SESSION['RadioBeaconFTP_server']; + echo '<br />' . _('Uploaded') . ' ' . $FileName . ' ' . _('to') . ' ' . $_SESSION['RadioBeaconFTP_server']; } // close the FTP stream ftp_quit($conn_id); @@ -286,7 +285,7 @@ $sql = "UPDATE salesorders SET printedpackingslip=1, datepackingslipprinted='" . Date('Y-m-d') . "' WHERE salesorders.orderno=" . $_GET['OrderNo']; $result = DB_query($sql,$db); - echo '<p>' . _('Order Number') . ' ' . $_GET['OrderNo'] . ' ' . _('has been sent via FTP to Radio Beacon a copy of the file that was sent is held on the server at') . '<br>' . $FileName; + echo '<p>' . _('Order Number') . ' ' . $_GET['OrderNo'] . ' ' . _('has been sent via FTP to Radio Beacon a copy of the file that was sent is held on the server at') . '<br />' . $FileName; } else { /*perhaps several order headers returned or none (more likely) */ Modified: trunk/FreightCosts.php =================================================================== --- trunk/FreightCosts.php 2011-05-13 10:50:42 UTC (rev 4565) +++ trunk/FreightCosts.php 2011-05-14 11:24:22 UTC (rev 4566) @@ -1,17 +1,11 @@ <?php /* $Id$*/ -/* $Revision: 1.14 $ */ -//$PageSecurity = 11; include('includes/session.inc'); $title = _('Freight Costs Set Up'); include('includes/header.inc'); -?> - -<?php - if (isset($_GET['LocationFrom'])){ $LocationFrom = $_GET['LocationFrom']; } elseif (isset($_POST['LocationFrom'])){ @@ -33,32 +27,37 @@ if (!isset($LocationFrom) OR !isset($ShipperID)) { - 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'] . '" />'; - $sql = 'SELECT shippername, shipper_id FROM shippers'; + $sql = "SELECT shippername, shipper_id FROM shippers"; $ShipperResults = DB_query($sql,$db); echo '<table class=selection> <tr> - <td>' . _('Select A Freight Company to set up costs for') . "</td> - <td><select name='ShipperID'>"; + <td>' . _('Select A Freight Company to set up costs for') . '</td> + <td><select name="ShipperID">'; while ($myrow = DB_fetch_array($ShipperResults)){ - echo '<option VALUE=' . $myrow['shipper_id'] . '>' . $myrow['shippername']; + echo '<option value=' . $myrow['shipper_id'] . '>' . $myrow['shippername'] . '</option>'; } echo '</select></td></tr> <tr> - <td>' . _('Select the warehouse') . ' (' . _('ship from location') . ")</td> - <td><select name='LocationFrom'>"; + <td>' . _('Select the warehouse') . ' (' . _('ship from location') . ')</td> + <td><select name="LocationFrom">'; - $sql = 'SELECT loccode, locationname FROM locations'; + $sql = "SELECT loccode, + locationname + FROM locations"; $LocationResults = DB_query($sql,$db); while ($myrow = DB_fetch_array($LocationResults)){ - echo '<option VALUE=' . $myrow['loccode'] . '>' . $myrow['locationname']; + echo '<option value=' . $myrow['loccode'] . '>' . $myrow['locationname']; } - echo "</select></td></tr></table><br><div class='centre'><input type=submit value='" . _('Accept') . "' name='Accept'></div></form>"; + echo '</select></td></tr> + </table> + <br><div class="centre"><input type="submit" value="' . _('Accept') . '" name="Accept"></div> + </form>'; } else { @@ -115,8 +114,7 @@ if (isset($SelectedFreightCost) AND $InputError !=1) { $sql = "UPDATE freightcosts - SET - locationfrom='".$LocationFrom."', + SET locationfrom='".$LocationFrom."', destination='" . $_POST['Destination'] . "', shipperid='" . $ShipperID . "', cubrate='" . $_POST['CubRate'] . "', @@ -133,28 +131,27 @@ /*Selected freight cost is null cos no item selected on first time round so must be adding a record must be submitting new entries */ - $sql = "INSERT INTO freightcosts ( - locationfrom, - destination, - shipperid, - cubrate, - kgrate, - maxkgs, - maxcub, - fixedprice, - minimumchg) - VALUES ( - '".$LocationFrom."', - '" . $_POST['Destination'] . "', - '" . $ShipperID . "', - '" . $_POST['CubRate'] . "', - '" . $_POST['KGRate'] . "', - '" . $_POST['MAXKGs'] . "', - '" . $_POST['MAXCub'] . "', - '" . $_POST['FixedPrice'] ."', - '" . $_POST['MinimumChg'] . "' - )"; - + $sql = "INSERT INTO freightcosts (locationfrom, + destination, + shipperid, + cubrate, + kgrate, + maxkgs, + maxcub, + fixedprice, + minimumchg) + VALUES ( + '".$LocationFrom."', + '" . $_POST['Destination'] . "', + '" . $ShipperID . "', + '" . $_POST['CubRate'] . "', + '" . $_POST['KGRate'] . "', + '" . $_POST['MAXKGs'] . "', + '" . $_POST['MAXCub'] . "', + '" . $_POST['FixedPrice'] ."', + '" . $_POST['MinimumChg'] . "' + )"; + $msg = _('Freight cost record inserted'); } @@ -187,30 +184,30 @@ $sql = "SELECT shipcostfromid, - destination, - cubrate, - kgrate, - maxkgs, - maxcub, - fixedprice, - minimumchg - FROM freightcosts - WHERE freightcosts.locationfrom = '".$LocationFrom. "' - AND freightcosts.shipperid = '" . $ShipperID . "' - ORDER BY destination"; - + destination, + cubrate, + kgrate, + maxkgs, + maxcub, + fixedprice, + minimumchg + FROM freightcosts + WHERE freightcosts.locationfrom = '".$LocationFrom. "' + AND freightcosts.shipperid = '" . $ShipperID . "' + ORDER BY destination"; + $result = DB_query($sql,$db); echo '<br><table class=selection>'; - $TableHeader = "<tr> - <th>" . _('Destination') . "</th> - <th>" . _('Cubic Rate') . "</th> - <th>" . _('KG Rate') . "</th> - <th>" . _('MAX KGs') . "</th> - <th>" . _('MAX Volume') . "</th> - <th>" . _('Fixed Price') . "</th> - <th>" . _('Minimum Charge') . "</th> - </tr>"; + $TableHeader = '<tr> + <th>' . _('Destination') . '</th> + <th>' . _('Cubic Rate') . '</th> + <th>' . _('KG Rate') . '</th> + <th>' . _('MAX KGs') . '</th> + <th>' . _('MAX Volume') . '</th> + <th>' . _('Fixed Price') . '</th> + <th>' . _('Minimum Charge') . '</th> + </tr>'; echo $TableHeader; @@ -233,15 +230,15 @@ } - printf("<td>%s</td> + printf('<td>%s</td> <td class=number>%s</td> <td class=number>%s</td> <td class=number>%s</td> <td class=number>%s</td> <td class=number>%s</td> <td class=number>%s</td> - <td><a href=\"%s&SelectedFreightCost=%s&LocationFrom=%s&ShipperID=%s\">" . _('Edit') . "</td> - <td><a href=\"%s&SelectedFreightCost=%s&LocationFrom=%s&ShipperID=%s&delete=yes\">" . _('Delete') . "</td></tr>", + <td><a href="%s&SelectedFreightCost=%s&LocationFrom=%s&ShipperID=%s">' . _('Edit') . '</td> + <td><a href="%s&SelectedFreightCost=%s&LocationFrom=%s&ShipperID=%s&delete=yes" onclick="return confirm(\'' . _('Are you sure you wish to delete this freight cost') . '\');">' . _('Delete') . '</td></tr>', $myrow[1], $myrow[2], $myrow[3], @@ -249,11 +246,11 @@ $myrow[5], $myrow[6], $myrow[7], - $_SERVER['PHP_SELF'] . '?' . SID, + $_SERVER['PHP_SELF'] . '?', $myrow[0], $LocationFrom, $ShipperID, - $_SERVER['PHP_SELF'] . '?' . SID, + $_SERVER['PHP_SELF'] . '?', $myrow[0], $LocationFrom, $ShipperID); @@ -267,28 +264,28 @@ //end of ifs and buts! if (isset($SelectedFreightCost)) { - echo "<div class='centre'><a href='" . $_SERVER['PHP_SELF'] . "?" . SID . '&LocationFrom=' . $LocationFrom . '&ShipperID=' . $ShipperID . "'>" . _('Show all freight costs for') . ' ' . $ShipperName . ' ' . _('from') . ' ' . $LocationName . '</a></div>'; + echo '<div class="centre"><a href="' . $_SERVER['PHP_SELF'] . '?LocationFrom=' . $LocationFrom . '&ShipperID=' . $ShipperID . '">' . _('Show all fr... [truncated message content] |
From: <dai...@us...> - 2011-05-15 04:34:57
|
Revision: 4567 http://web-erp.svn.sourceforge.net/web-erp/?rev=4567&view=rev Author: daintree Date: 2011-05-15 04:34:49 +0000 (Sun, 15 May 2011) Log Message: ----------- various Modified Paths: -------------- trunk/FixedAssetCategories.php trunk/Logout.php trunk/PO_AuthorisationLevels.php trunk/PO_Header.php trunk/PcAssignCashToTab.php trunk/PcAuthorizeExpenses.php trunk/PcClaimExpensesFromTab.php trunk/PcExpenses.php trunk/PcExpensesTypeTab.php trunk/PcReportTab.php trunk/PcTabs.php trunk/PcTypeTabs.php trunk/UnitsOfMeasure.php trunk/doc/Change.log trunk/includes/Login.php Modified: trunk/FixedAssetCategories.php =================================================================== --- trunk/FixedAssetCategories.php 2011-05-14 11:24:22 UTC (rev 4566) +++ trunk/FixedAssetCategories.php 2011-05-15 04:34:49 UTC (rev 4567) @@ -50,10 +50,9 @@ $InputError =1; } /*Make an array of the defined bank accounts */ - $SQL = 'SELECT bankaccounts.accountcode - FROM bankaccounts, - chartmaster - WHERE bankaccounts.accountcode=chartmaster.accountcode'; + $SQL = "SELECT bankaccounts.accountcode + FROM bankaccounts INNER JOIN chartmaster + ON bankaccounts.accountcode=chartmaster.accountcode"; $result = DB_query($SQL,$db); $BankAccounts = array(); $i=0; @@ -123,7 +122,7 @@ // PREVENT DELETES IF DEPENDENT RECORDS IN 'fixedassets' - $sql= "SELECT COUNT(*) FROM fixedasset WHERE fixedassets.assetcategoryid='" . $SelectedCategory . "'"; + $sql= "SELECT COUNT(*) FROM fixedassets WHERE fixedassets.assetcategoryid='" . $SelectedCategory . "'"; $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); if ($myrow[0]>0) { Modified: trunk/Logout.php =================================================================== --- trunk/Logout.php 2011-05-14 11:24:22 UTC (rev 4566) +++ trunk/Logout.php 2011-05-15 04:34:49 UTC (rev 4567) @@ -23,7 +23,7 @@ <?php echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; ?> - <span><?php echo _('Thank you for using webERP'); ?></span> + <span><?php echo _('Thank you for using webERP'); ?></span> <br /> <input class="button" type="submit" value="<?php echo _('Login'); ?>" name="SubmitUser" /> </form> Modified: trunk/PO_AuthorisationLevels.php =================================================================== --- trunk/PO_AuthorisationLevels.php 2011-05-14 11:24:22 UTC (rev 4566) +++ trunk/PO_AuthorisationLevels.php 2011-05-15 04:34:49 UTC (rev 4567) @@ -8,18 +8,21 @@ include('includes/header.inc'); echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/group_add.png" title="' . _('Search') . '" alt="" />' . ' ' . $title.'</p><br />'; -$User=''; -$Currency=''; -$CanCreate=1; -$OffHold=1; -$AuthLevel=0; + + +/*Note: If CanCreate==0 then this means the user can create orders + * Also if OffHold==0 then the user can release purchase invocies + * This logic confused me a bit to start with + */ + + if (isset($_POST['Submit'])) { - if (isset($_POST['CanCreate']) and $_POST['CanCreate']=='on') { + if (isset($_POST['CanCreate']) AND $_POST['CanCreate']=='on') { $CanCreate=0; } else { $CanCreate=1; } - if (isset($_POST['OffHold']) and $_POST['OffHold']=='on') { + if (isset($_POST['OffHold']) AND $_POST['OffHold']=='on') { $OffHold=0; } else { $OffHold=1; @@ -48,17 +51,17 @@ $Result=DB_query($sql,$db,$ErrMsg); } else { prnMsg(_('There already exists an entry for this user/currency combination'), 'error'); - echo '<br />'; + echo '<br />'; } } if (isset($_POST['Update'])) { - if (isset($_POST['CanCreate']) and $_POST['CanCreate']=='on') { + if (isset($_POST['CanCreate']) AND $_POST['CanCreate']=='on') { $CanCreate=0; } else { $CanCreate=1; } - if (isset($_POST['OffHold']) and $_POST['OffHold']=='on') { + if (isset($_POST['OffHold']) AND $_POST['OffHold']=='on') { $OffHold=0; } else { $OffHold=1; @@ -69,7 +72,7 @@ authlevel='".$_POST['AuthLevel']."' WHERE userid='".$_POST['UserID']."' AND currabrev='".$_POST['CurrCode']."'"; - + $ErrMsg = _('The authentication details cannot be updated because'); $Result=DB_query($sql,$db,$ErrMsg); } @@ -104,6 +107,7 @@ www_users.realname, currencies.currabrev, currencies.currency, + currencies.decimalplaces, purchorderauth.cancreate, purchorderauth.offhold, purchorderauth.authlevel @@ -125,22 +129,22 @@ while ($myrow=DB_fetch_array($Result)) { if ($myrow['cancreate']==0) { - $CanCreate=_('Yes'); + $DisplayCanCreate=_('Yes'); } else { - $CanCreate=_('No'); + $DisplayCanCreate=_('No'); } if ($myrow['offhold']==0) { - $OffHold=_('Yes'); + $DisplayOffHold=_('Yes'); } else { - $OffHold=_('No'); + $DisplayOffHold=_('No'); } echo '<tr> <td>' . $myrow['userid'] . '</td> <td>' . $myrow['realname'] . '</td> <td>' . $myrow['currency'] . '</td> - <td>' . $CanCreate . '</td> - <td>' . $OffHold . '</td> - <td class="number">'.number_format($myrow['authlevel'],2).'</td> + <td>' . $DisplayCanCreate . '</td> + <td>' . $DisplayOffHold . '</td> + <td class="number">'.number_format($myrow['authlevel'],$myrow['decimalplaces']).'</td> <td><a href="'.$rootpath.'/PO_AuthorisationLevels.php?Edit=Yes&UserID=' . $myrow['userid'] . '&Currency='.$myrow['currabrev'].'">'._('Edit').'</td> <td><a href="'.$rootpath.'/PO_AuthorisationLevels.php?Delete=Yes&UserID=' . $myrow['userid'] . @@ -150,15 +154,23 @@ echo '</table><br><br>'; +if (!isset($_GET['Edit'])) { + $UserID=$_SESSION['UserID']; + $Currency=$_SESSION['CompanyRecord']['currencydefault']; + $CanCreate=0; + $OffHold=0; + $AuthLevel=0; +} + echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post" name="form1">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<table class=selection>'; if (isset($_GET['Edit'])) { - echo '<tr><td>'._('User ID').'</td><td>'.$UserID.'</td></tr>'; - echo '<input type=hidden name=UserID value="'.$UserID.'"'; + echo '<tr><td>'._('User ID').'</td><td>'.$_GET['UserID'].'</td></tr>'; + echo '<input type="hidden" name="UserID" value="'.$_GET['UserID'].'" />'; } else { - echo '<tr><td>'._('User ID').'</td><td><select name=UserID>'; + echo '<tr><td>'._('User ID').'</td><td><select name="UserID">'; $usersql="SELECT userid FROM www_users"; $userresult=DB_query($usersql,$db); while ($myrow=DB_fetch_array($userresult)) { @@ -172,14 +184,28 @@ } if (isset($_GET['Edit'])) { - $CurrencySQL="SELECT currency FROM currencies WHERE currabrev='".$Currency."'"; - $CurrencyResult=DB_query($CurrencySQL,$db); - $myrow=DB_fetch_array($CurrencyResult); + $sql="SELECT cancreate, + offhold, + authlevel, + currency + FROM purchorderauth INNER JOIN currencies + ON purchorderauth.currabrev=currencies.currabrev + WHERE userid='".$_GET['UserID']."' + AND purchorderauth.currabrev='".$_GET['Currency']."'"; + $ErrMsg = _('The authentication details cannot be retrieved because'); + $result=DB_query($sql,$db,$ErrMsg); + $myrow=DB_fetch_array($result); + $UserID=$_GET['UserID']; + $Currency=$_GET['Currency']; + $CanCreate=$myrow['cancreate']; + $OffHold=$myrow['offhold']; + $AuthLevel=$myrow['authlevel']; + echo '<tr> <td>'._('Currency').'</td> <td>' . $myrow['currency'] . '</td> </tr>'; - echo '<input type=hidden name="currabrev" value="'.$Currency.'"'; + echo '<input type=hidden name="CurrCode" value="'.$Currency.'"'; } else { echo '<tr><td>'._('Currency').'</td><td><select name="CurrCode">'; $currencysql="SELECT currabrev,currency FROM currencies"; Modified: trunk/PO_Header.php =================================================================== --- trunk/PO_Header.php 2011-05-14 11:24:22 UTC (rev 4566) +++ trunk/PO_Header.php 2011-05-15 04:34:49 UTC (rev 4567) @@ -653,7 +653,7 @@ $PurchItemRow['leadtime'], $PurchItemRow['suppliers_partno'] ); - echo "<meta http-equiv='Refresh' content='0; url=" . $rootpath . '/PO_Items.php?identifier='.$identifier. "'>"; + echo '<meta http-equiv="refresh" content="0; url=' . $rootpath . '/PO_Items.php?identifier='.$identifier. '">'; } /*Set up form for entry of order header stuff */ Modified: trunk/PcAssignCashToTab.php =================================================================== --- trunk/PcAssignCashToTab.php 2011-05-14 11:24:22 UTC (rev 4566) +++ trunk/PcAssignCashToTab.php 2011-05-15 04:34:49 UTC (rev 4567) @@ -23,12 +23,31 @@ $Days = $_GET['Days']; } -if (isset($Errors)) { - unset($Errors); +if (isset($_POST['Cancel'])) { + unset($SelectedTabs); + unset($SelectedIndex); + unset($Days); + unset($_POST['Amount']); + unset($_POST['Notes']); + unset($_POST['Receipt']); } -$Errors = array(); +if (isset($_POST['process'])) { + if ($SelectedTabs=='') { + prnMsg(_('You Must First Select a Petty Cash Tab To Assign Cash'),'error'); + unset($SelectedTabs); + } +} +if (isset($_POST['Go'])) { + $InputError = 0; + if ($Days<=0) { + $InputError = 1; + prnMsg(_('The number of days must be a positive number'),'error'); + $Days=30; + } +} + if (isset($_POST['submit'])) { //initialise no input errors assumed initially before we test $InputError = 0; @@ -43,9 +62,7 @@ if ($_POST['Amount']==0) { $InputError = 1; - prnMsg('<br />' . _('The Amount must be inputed'),'error'); - $Errors[$i] = 'TabCode'; - $i++; + prnMsg('<br />' . _('The Amount must be input'),'error'); } $sqlLimit = "SELECT tablimit @@ -56,7 +73,7 @@ $Limit=DB_fetch_array($ResultLimit); if (($_POST['CurrentAmount']+$_POST['Amount'])>$Limit['tablimit']){ - prnMsg('<br />' . _('The balance after this assignment would be greater than the specified limit for this PC tab'),'warning'); + prnMsg(_('The balance after this assignment would be greater than the specified limit for this PC tab'),'warning'); } if ($InputError !=1 AND isset($SelectedIndex) ) { @@ -92,7 +109,7 @@ '" . $_POST['Notes'] . "', '" . $_POST['Receipt'] . "' )"; - $msg = _('Assignment of cash to PC Tab ') . ' ' . $_POST["SelectedTabs"] . ' ' . _('has been created'); + $msg = _('Assignment of cash to PC Tab ') . ' ' . $_POST['SelectedTabs'] . ' ' . _('has been created'); } if ( $InputError !=1) { @@ -103,6 +120,8 @@ unset($_POST['Amount']); unset($_POST['Notes']); unset($_POST['Receipt']); + unset($_POST['SelectedTabs']); + unset($_POST['Date']); } } elseif ( isset($_GET['delete']) ) { @@ -128,16 +147,16 @@ echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<p><table class=selection>'; //Main table + echo '<p><table class="selection">'; //Main table echo '<tr><td>' . _('Petty Cash Tab To Assign Cash') . ':</td> <td><select name="SelectedTabs">'; DB_free_result($result); $SQL = "SELECT tabcode - FROM pctabs - WHERE authorizer='" . $_SESSION['UserID'] . "' - ORDER BY tabcode"; + FROM pctabs + WHERE authorizer='" . $_SESSION['UserID'] . "' + ORDER BY tabcode"; $result = DB_query($SQL,$db); @@ -179,7 +198,7 @@ } $sql = "SELECT * FROM pcashdetails WHERE tabcode='" . $SelectedTabs . "' - AND date >=DATE_SUB(CURDATE(), INTERVAL '".$Days."' DAY) + AND date >=DATE_SUB(CURDATE(), INTERVAL , '".$Days."' DAY) ORDER BY date, counterindex ASC"; @@ -188,7 +207,7 @@ echo '<table class=selection>'; echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<tr><th colspan="8">' . _('Detail Of PC Tab Movements For Last ') .': '; + echo '<tr><th colspan="8">' . _('Detail Of PC Tab Movements For Last') .': '; echo '<input type="hidden" name="SelectedTabs" value="' . $SelectedTabs . '">'; echo '<input type="text" class="number" name="Days" value="' . $Days . '" maxlength="3" size="4" /> ' . _('Days'); echo '<input type=submit name="Go" value="' . _('Go') . '">'; @@ -228,7 +247,7 @@ // only cash assignations NOT authorized can be modified or deleted echo '<td>' . ConvertSQLDate($myrow['date']) . '</td> <td>' . $Description['0'] . '</td> - <td class=number>' . number_format($myrow['amount'],2) . '</td> + <td class=number>' . number_format($myrow['amount'],$_SESSION['CompanyRecord']['decimalplaces']) . '</td> <td>' . ConvertSQLDate($myrow['authorized']) . '</td> <td>' . $myrow['notes'] . '</td> <td>' . $myrow['receipt'] . '</td> @@ -242,7 +261,7 @@ }else{ echo '<td>' . ConvertSQLDate($myrow['date']) . '</td> <td>' . $Description['0'] . '</td> - <td class=number>' . number_format($myrow['amount'],2).'</td> + <td class=number>' . number_format($myrow['amount'],$_SESSION['CompanyRecord']['decimalplaces']).'</td> <td>' . ConvertSQLDate($myrow['authorized']) . '</td> <td>' . $myrow['notes'] . '</td> <td>' . $myrow['receipt'] . '</td> @@ -263,7 +282,7 @@ } echo '<tr><td colspan="2" style="text-align:right"><b>' . _('Current balance') . ':</b></td> - <td>' . number_format($Amount['0'],2) . '</td></tr>'; + <td>' . number_format($Amount['0'],$_SESSION['CompanyRecord']['decimalplaces']) . '</td></tr>'; echo '</table>'; @@ -286,7 +305,7 @@ if ( isset($_GET['edit'])) { $sql = "SELECT * FROM pcashdetails - WHERE counterindex='".$SelectedIndex."'"; + WHERE counterindex='".$SelectedIndex."'"; $result = DB_query($sql, $db); $myrow = DB_fetch_array($result); @@ -340,13 +359,12 @@ echo '</td></tr></table>'; // close main table - echo '<p><div class="centre"><input type=submit name=submit value="' . _('Accept') . '"><input type=submit name=Cancel value="' . _('Cancel') . '"></div>'; + echo '<p><div class="centre"><input type=submit name=submit value="' . _('Accept') . '"> + <input type=submit name=Cancel value="' . _('Cancel') . '"></div>'; echo '</form>'; } // end if user wish to delete - } - include('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/PcAuthorizeExpenses.php =================================================================== --- trunk/PcAuthorizeExpenses.php 2011-05-14 11:24:22 UTC (rev 4566) +++ trunk/PcAuthorizeExpenses.php 2011-05-15 04:34:49 UTC (rev 4567) @@ -24,11 +24,19 @@ $Days = $_GET['Days']; } -if (isset($Errors)) { - unset($Errors); +if (isset($_POST['Process'])) { + if ($SelectedTabs=='') { + prnMsg(_('You Must First Select a Petty Cash Tab To Authorise'),'error'); + unset($SelectedTabs); + } } -$Errors = array(); +if (isset($_POST['Go'])) { + if ($Days<=0) { + prnMsg(_('The number of days must be a positive number'),'error'); + $Days=30; + } +} if (isset($SelectedTabs)) { echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/magnifier.png" title="' . _('Petty Cash') . @@ -37,7 +45,7 @@ echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/magnifier.png" title="' . _('Petty Cash') . '" alt="" />' . _('Authorization Of Petty Cash Expenses ') . '</p>'; } -if (isset($_POST['submit']) or isset($_POST['update']) OR isset($SelectedTabs) OR isset ($_POST['GO'])) { +if (isset($_POST['Submit']) or isset($_POST['update']) OR isset($SelectedTabs) OR isset ($_POST['GO'])) { echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; @@ -82,7 +90,7 @@ <th>' . _('Posted') . '</th> <th>' . _('Notes') . '</th> <th>' . _('Receipt') . '</th> - <th>' . _('Authorized') . '</th> + <th>' . _('Authorised') . '</th> </tr>'; $k=0; //row colour counter @@ -92,7 +100,7 @@ while ($myrow=DB_fetch_array($result)) { //update database if update pressed - if ((isset($_POST['submit']) and $_POST['submit']=='Update') AND isset($_POST[$myrow['counterindex']])){ + if ((isset($_POST['Submit']) AND $_POST['Submit']=='Update') AND isset($_POST[$myrow['counterindex']])){ $PeriodNo = GetPeriod(ConvertSQLDate($myrow['date']), $db); @@ -225,13 +233,17 @@ echo '<tr class="OddTableRows">'; $k=1; } - + if ($myrow['posted']==0) { + $Posted=_('No'); + } else { + $Posted=_('Yes'); + } echo'<td>'.ConvertSQLDate($myrow['date']).'</td> <td>'.$myrow['codeexpense'].'</td> <td class="number">'.number_format($myrow['amount'],2).'</td> - <td>'.$myrow['posted'].'</td> - <td>'.$myrow['notes'].'</td> - <td>'.$myrow['receipt'].'</td>'; + <td>' . $Posted . '</td> + <td>' .$myrow['notes'] . '</td> + <td>' . $myrow['receipt'] . '</td>'; if (isset($_POST[$myrow['counterindex']])){ echo'<td>'.ConvertSQLDate(Date('Y-m-d')).'</td>'; @@ -263,14 +275,14 @@ $Amount['0']=0; } - echo '<tr><td colspan="4" style="text-align:right" >' . _('Current balance') . ':</td> - <td colspan="2">' . number_format($Amount['0'],2) . '</td></tr>'; + echo '<tr><td colspan=2 class="number">' . _('Current balance') . ':</td> + <td class=number>'.number_format($Amount['0'],2).'</td></tr>'; // Do the postings include ('includes/GLPostings.inc'); + echo'</table><br /><div class="centre"><input type="submit" name="Submit" value=' . _('Update') . '></div></form>'; + - echo'<tr><td style="text-align:right" colspan=4><input type="submit" name="submit" value="' . _('Update') . '"></td></tr></form>'; - } else { /*The option to submit was not hit so display form */ @@ -278,7 +290,7 @@ echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<p><table class="selection">'; //Main table -echo '<tr><td>' . _('Authorize expenses to Petty Cash Tab') . ':</td> +echo '<tr><td>' . _('Authorise expenses to Petty Cash Tab') . ':</td> <td><select name="SelectedTabs">'; DB_free_result($result); @@ -292,7 +304,7 @@ if (isset($_POST['SelectTabs']) and $myrow['tabcode']==$_POST['SelectTabs']) { echo '<option selected value="'; } else { - echo '<option VALUE="'; + echo '<option value="'; } echo $myrow['tabcode'] . '">' . $myrow['tabcode'] . '</option>'; @@ -302,7 +314,8 @@ echo '</td></tr></table>'; // close main table - echo '<p><div class="centre"><input type=submit name=process VALUE="' . _('Accept') . '"><input type=submit name=Cancel VALUE="' . _('Cancel') . '"></div>'; + echo '<p><div class="centre"><input type=submit name="Process" value="' . _('Accept') . '"> + <input type="submit" name="Cancel" value="' . _('Cancel') . '"></div>'; echo '</form>'; } /*end of else not submit */ Modified: trunk/PcClaimExpensesFromTab.php =================================================================== --- trunk/PcClaimExpensesFromTab.php 2011-05-14 11:24:22 UTC (rev 4566) +++ trunk/PcClaimExpensesFromTab.php 2011-05-15 04:34:49 UTC (rev 4567) @@ -25,12 +25,31 @@ $Days = $_GET['Days']; } -if (isset($Errors)) { - unset($Errors); +if (isset($_POST['Cancel'])) { + unset($SelectedTabs); + unset($SelectedIndex); + unset($Days); + unset($_POST['Amount']); + unset($_POST['Notes']); + unset($_POST['Receipt']); } -$Errors = array(); +if (isset($_POST['Process'])) { + + if ($_POST['SelectedTabs']=='') { + echo prnMsg(_('You have not selected a tab to claim the expenses on'),'error'); + unset($SelectedTabs); + } +} + +if (isset($_POST['Go'])) { + if ($Days<=0) { + prnMsg(_('The number of days must be a positive number'),'error'); + $Days=30; + } +} + if (isset($_POST['submit'])) { //initialise no input errors assumed initially before we test $InputError = 0; @@ -39,13 +58,13 @@ ie the page has called itself with some user input */ //first off validate inputs sensible - $i=1; - if ($_POST['amount']==0) { + if ($_POST['SelectedExpense']=='') { + $InputError=1; + prnMsg(_('You have not selected an expense to claim on this tab'),'error'); + } elseif ($_POST['amount']==0) { $InputError = 1; prnMsg( _('The Amount must be greater than 0'),'error'); - $Errors[$i] = 'TabCode'; - $i++; } if (isset($SelectedIndex) AND $InputError !=1) { @@ -120,7 +139,7 @@ echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<p><table class="selection">'; //Main table + echo '<br /><table class="selection">'; //Main table echo '<tr><td>' . _('Petty Cash Tabs for User ') . $_SESSION['UserID'] . ':</td> <td><select name="SelectedTabs">'; @@ -131,7 +150,7 @@ WHERE usercode='" . $_SESSION['UserID'] . "'"; $result = DB_query($SQL,$db); - + echo '<option value="">' . _('Not Yet Selected') . '</option>'; while ($myrow = DB_fetch_array($result)) { if (isset($_POST['SelectTabs']) and $myrow['tabcode']==$_POST['SelectTabs']) { echo '<option selected value="'; @@ -145,21 +164,24 @@ echo '</select></td></tr>'; echo '</td></tr></table>'; // close main table - echo '<p><div class="centre"><input type="submit" name="process" value="' . _('Accept') . '"><input type=submit name="Cancel" value="' . _('Cancel') . '"></div>'; + echo '<p><div class="centre"><input type="submit" name="Process" value="' . _('Accept') . '"><input type=submit name="Cancel" value="' . _('Cancel') . '"></div>'; echo '</form>'; -} +} else { // isset($SelectedTabs) -//end of ifs and buts! -if (isset($_POST['process'])OR isset($SelectedTabs)) { + echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/money_add.png" title="' . _('Petty Cash Claim Entry') + . '" alt="" />' . ' ' . $title . '</p>'; - echo '<p><div class="centre"><a href="' . $_SERVER['PHP_SELF'] . '">' . _('Petty Cash Tab ') . '' .$SelectedTabs. '<a/></div><p>'; -/* RICARD */ + echo '<p><div class="centre"><a href="' . $_SERVER['PHP_SELF'] . '">' . _('Select another tab') . '</a></div></p>'; + if (! isset($_GET['edit']) OR isset ($_POST['GO'])){ echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<div class="centre"><p>' . _('Detail Of Movements For Last ') .': '; + echo '<br /><table class=selection>'; + echo '<tr><th colspan="8"><font color="navy" size="3">' . _('Petty Cash Tab') . ' ' .$SelectedTabs. '</font></th></tr>'; + echo '<tr><th colspan="8">' . _('Detail Of Movements For Last ') .': '; + if(!isset ($Days)){ $Days=30; @@ -167,7 +189,7 @@ echo '<input type="hidden" name="SelectedTabs" value="' . $SelectedTabs . '">'; echo '<input type="text" class="number" name="Days" value="' . $Days . '" maxlength="3" size="4" /> ' ._('Days'); echo '<input type="submit" name="Go" value="' . _('Go') . '" />'; - echo '<p></div></form>'; + echo '</th></div></form>'; if (isset($_POST['Cancel'])) { unset($_POST['SelectedExpense']); @@ -184,7 +206,6 @@ $result = DB_query($sql,$db); - echo '<br><table border=1>'; echo '<tr> <th>' . _('Date Of Expense') . '</th> <th>' . _('Expense Description') . '</th> @@ -215,7 +236,11 @@ if (!isset($Description['0'])){ $Description['0']='ASSIGNCASH'; } - + if ($myrow['5']=='0000-00-00') { + $AuthorisedDate=_('Unauthorised'); + } else { + $AuthorisedDate=ConvertSQLDate($myrow['5']); + } if (($myrow['5'] == '0000-00-00') and ($Description['0'] != 'ASSIGNCASH')){ // only movements NOT authorized can be modified or deleted printf('<td>%s</td> @@ -230,7 +255,7 @@ ConvertSQLDate($myrow['2']), $Description['0'], number_format($myrow['4'],2), - ConvertSQLDate($myrow['5']), + $AuthorisedDate, $myrow['7'], $myrow['8'], $_SERVER['PHP_SELF'] . '?', $myrow['0'], @@ -246,7 +271,7 @@ ConvertSQLDate($myrow['2']), $Description['0'], number_format($myrow['4'],2), - ConvertSQLDate($myrow['5']), + $AuthorisedDate, $myrow['7'], $myrow['8']); @@ -265,11 +290,11 @@ if (!isset($Amount['0'])) { $Amount['0']=0; } + + echo '<tr><td colspan="2" style="text-align:right" >' . _('Current balance') . ':</td> + <td class="number">'.number_format($Amount['0'],2) . '</td></tr>'; - echo '<tr><td colspan="4" style="text-align:right" >' . _('Current balance') . ':</td> - <td colspan=2>'.number_format($Amount['0'],2) . '</td></tr>'; - echo '</table>'; } @@ -277,8 +302,8 @@ echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<p><table border=1>'; //Main table - echo '<td><table>'; // First column + + echo '<br /><table class="selection">'; //Main table if ( isset($_GET['edit'])) { @@ -320,7 +345,7 @@ ORDER BY pcexpenses.codeexpense ASC"; $result = DB_query($SQL,$db); - + echo '<option value="">' . _('Not Yet Selected') . '</option>'; while ($myrow = DB_fetch_array($result)) { if (isset($_POST['SelectedExpense']) and $myrow['codeexpense']==$_POST['SelectedExpense']) { echo '<option selected value="'; @@ -336,7 +361,7 @@ if (!isset($_POST['Amount'])) { $_POST['Amount']=0; } - + echo '<tr><td>' . _('Amount') . ':</td> <td><input type="text" class="number" name="amount" size="12" maxlength="11" value="' . $_POST['Amount'] . '"></td></tr>'; @@ -355,7 +380,7 @@ <td><input type="text" name="Receipt" size="50" maxlength="49" value="' . $_POST['Receipt'] . '"></td></tr>'; echo '<input type="hidden" name="SelectedTabs" value="' . $SelectedTabs . '">'; echo '<input type="hidden" name="Days" value="' .$Days. '">'; - echo '</table>'; // close table in first column + echo '</td></tr></table>'; // close main table echo '<p><div class="centre"><input type="submit" name="submit" value="' . _('Accept') . '"><input type=submit name="Cancel" value="' . _('Cancel') . '"></div>'; echo '</form>'; Modified: trunk/PcExpenses.php =================================================================== --- trunk/PcExpenses.php 2011-05-14 11:24:22 UTC (rev 4566) +++ trunk/PcExpenses.php 2011-05-15 04:34:49 UTC (rev 4567) @@ -15,6 +15,14 @@ $SelectedExpense = strtoupper($_GET['SelectedExpense']); } +if (isset($_POST['Cancel'])) { + unset($SelectedExpense); + unset($_POST['CodeExpense']); + unset($_POST['Description']); + unset($_POST['GLAccount']); +} + + if (isset($Errors)) { unset($Errors); } @@ -32,39 +40,55 @@ //first off validate inputs sensible $i=1; - if ($_POST['codeexpense']=='' OR $_POST['codeexpense']==' ' OR $_POST['codeexpense']==' ') { + if ($_POST['CodeExpense']=='' OR $_POST['CodeExpense']==' ' OR $_POST['CodeExpense']==' ') { $InputError = 1; prnMsg(_('The Expense type code cannot be an empty string or spaces'),'error'); - $Errors[$i] = 'PcExpenses'; + echo '<br />'; + $Errors[$i] = 'CodeExpense'; $i++; - } elseif (strlen($_POST['codeexpense']) >20) { + } elseif (strlen($_POST['CodeExpense']) >20) { $InputError = 1; prnMsg(_('The Expense code must be twenty characters or less long'),'error'); - $Errors[$i] = 'PcExpenses'; + echo '<br />'; + $Errors[$i] = 'CodeExpense'; $i++; - }elseif (ContainsIllegalCharacters($_POST['codeexpense'])){ + }elseif (ContainsIllegalCharacters($_POST['CodeExpense'])){ $InputError = 1; prnMsg(_('The Expense code cannot contain any of the following characters " \' - &'),'error'); - $Errors[$i] = 'PcExpenses'; + echo '<br />'; + $Errors[$i] = 'CodeExpense'; $i++; - } elseif (ContainsIllegalCharacters($_POST['description'])){ + } elseif (ContainsIllegalCharacters($_POST['Description'])){ $InputError = 1; prnMsg(_('The Expense description cannot contain any of the following characters " \' - &'),'error'); - $Errors[$i] = 'TypeTabCode'; + echo '<br />'; + $Errors[$i] = 'Description'; $i++; - } elseif (strlen($_POST['description']) >50) { + } elseif (strlen($_POST['Description']) >50) { $InputError = 1; prnMsg(_('The tab code must be Fifty characters or less long'),'error'); - $Errors[$i] = 'TypeTabCode'; + echo '<br />'; + echo '<br />'; + $Errors[$i] = 'Description'; $i++; + } elseif (strlen($_POST['Description'])==0) { + $InputError = 1; + echo prnMsg(_('The tab code description must be entered'),'error'); + echo '<br />'; + $Errors[$i] = 'Description'; + $i++; + } elseif ($_POST['GLAccount']=='') { + $InputError = 1; + echo prnMsg(_('A general ledger code must be selected for this expense'),'error'); + echo '<br />'; } - + if (isset($SelectedExpense) AND $InputError !=1) { $sql = "UPDATE pcexpenses - SET description = '" . $_POST['description'] . "', - glaccount = '" . $_POST['glaccount'] . "' - WHERE codeexpense = '$SelectedExpense'"; + SET description = '" . $_POST['Description'] . "', + glaccount = '" . $_POST['GLAccount'] . "' + WHERE codeexpense = '" . $SelectedExpense . "'"; $msg = _('The Expenses type') . ' ' . $SelectedExpense . ' ' . _('has been updated'); } elseif ( $InputError !=1 ) { @@ -73,14 +97,14 @@ $checkSql = "SELECT count(*) FROM pcexpenses - WHERE codeexpense = '" . $_POST['codeexpense'] . "'"; + WHERE codeexpense = '" . $_POST['CodeExpense'] . "'"; $checkresult = DB_query($checkSql,$db); $checkrow = DB_fetch_row($checkresult); if ( $checkrow[0] > 0 ) { $InputError = 1; - prnMsg( _('The Expense type ') . $_POST['codeexpense'] . _(' already exists.'),'error'); + prnMsg( _('The Expense type ') . $_POST['CodeExpense'] . _(' already exists.'),'error'); } else { // Add new record on submit @@ -88,11 +112,11 @@ $sql = "INSERT INTO pcexpenses (codeexpense, description,glaccount) - VALUES ('" . $_POST['codeexpense'] . "', - '" . $_POST['description'] . "', - '" . $_POST['glaccount'] . "')"; + VALUES ('" . $_POST['CodeExpense'] . "', + '" . $_POST['Description'] . "', + '" . $_POST['GLAccount'] . "')"; - $msg = _('Expense ') . ' ' . $_POST['codeexpense'] . ' ' . _('has been created'); + $msg = _('Expense ') . ' ' . $_POST['CodeExpense'] . ' ' . _('has been created'); $checkSql = "SELECT count(codeexpense) FROM pcexpenses"; $result = DB_query($checkSql, $db); @@ -105,11 +129,11 @@ //run the SQL from either of the above possibilites $result = DB_query($sql,$db); prnMsg($msg,'success'); - + echo '<br />'; unset($SelectedExpense); - unset($_POST['codeexpense']); - unset($_POST['description']); - unset($_POST['glaccount']); + unset($_POST['CodeExpense']); + unset($_POST['Description']); + unset($_POST['GLAccount']); } } elseif ( isset($_GET['delete']) ) { @@ -118,7 +142,7 @@ $sql= "SELECT COUNT(*) FROM pctabexpenses - WHERE codeexpense='$SelectedExpense'"; + WHERE codeexpense='" . $SelectedExpense . "'"; $ErrMsg = _('The number of type of tabs using this expense code could not be retrieved'); $result = DB_query($sql,$db,$ErrMsg); @@ -130,14 +154,13 @@ } else { $sql="DELETE FROM pcexpenses - WHERE codeexpense='$SelectedExpense'"; + WHERE codeexpense='" . $SelectedExpense . "'"; $ErrMsg = _('The expense type record could not be deleted because'); $result = DB_query($sql,$db,$ErrMsg); prnMsg(_('Expense type') . ' ' . $SelectedExpense . ' ' . _('has been deleted') ,'success'); + echo '<br />'; unset ($SelectedExpense); unset($_GET['delete']); - - } //end if tab type used in transactions } @@ -148,17 +171,17 @@ links to delete or edit each. These will call the same page again and allow update/input or deletion of the records*/ - $sql = 'SELECT * - FROM pcexpenses'; + $sql = "SELECT * + FROM pcexpenses"; $result = DB_query($sql,$db); - echo '<table class=selection>'; + echo '<table class="selection">'; echo '<tr> <th>' . _('Code Of Expense') . '</th> <th>' . _('Description') . '</th> <th>' . _('Account Code') . '</th> <th>' . _('Account Description') . '</th> - </tr>'; + </tr>'; $k=0; //row colour counter @@ -178,19 +201,19 @@ $ResultDes = DB_query($sqldesc,$db); $Description=DB_fetch_array($ResultDes); - printf("<td>%s</td> + printf('<td>%s</td> <td>%s</td> <td class=number>%s</td> <td>%s</td> - <td><a href='%sSelectedExpense=%s'>" . _('Edit') . "</td> - <td><a href='%sSelectedExpense=%s&delete=yes' onclick=\"return confirm('" . _('Are you sure you wish to delete this expense code and all the details it may have set up?') . "');\">" . _('Delete') . "</td> - </tr>", + <td><a href="%sSelectedExpense=%s">' . _('Edit') . '</td> + <td><a href="%sSelectedExpense=%s&delete=yes" onclick="return confirm(\'' . _('Are you sure you wish to delete this expense code and all the details it may have set up?') . '\');">' . _('Delete') . '</td> + </tr>', $myrow[0], $myrow[1], $myrow[2], $Description[0], $_SERVER['PHP_SELF'] . '?', $myrow[0], - $_SERVER['PHP_SELF'] . '?', $myrow[0]); + $_SERVER['PHP_SELF'] . '?', $myrow[0]); } //END WHILE LIST LOOP echo '</table>'; @@ -208,8 +231,7 @@ echo '<p><table class=selection>'; //Main table // The user wish to EDIT an existing type - if ( isset($SelectedExpense) AND $SelectedExpense!='' ) - { + if ( isset($SelectedExpense) AND $SelectedExpense!='' ){ $sql = "SELECT codeexpense, description, @@ -220,44 +242,49 @@ $result = DB_query($sql, $db); $myrow = DB_fetch_array($result); - $_POST['codeexpense'] = $myrow['codeexpense']; - $_POST['description'] = $myrow['description']; - $_POST['glaccount'] = $myrow['glaccount']; + $_POST['CodeExpense'] = $myrow['codeexpense']; + $_POST['Description'] = $myrow['description']; + $_POST['GLAccount'] = $myrow['glaccount']; echo '<input type=hidden name="SelectedExpense" value="' . $SelectedExpense . '">'; - echo '<input type=hidden name="codeexpense" VALUE="' . $_POST['codeexpense']. '">'; - echo '<table class="selection"> <tr><td>' . _('Code Of Expense') . ':</td><td>'; - + echo '<input type=hidden name="CodeExpense" VALUE="' . $_POST['CodeExpense']. '">'; // We dont allow the user to change an existing type code + echo '<table class="selection"> + <tr> + <td>' . _('Code Of Expense') . ':</td> + <td>' . $_POST['CodeExpense'] . '</td></tr>'; - echo $_POST['codeexpense'] . '</td></tr>'; - } else { // This is a new type so the user may volunteer a type code - echo '<table class=selection> - <tr><td>' . _('Code Of Expense') . ':</td> - <td><input type="Text"' . (in_array('SalesType',$Errors) ? 'class="inputerror"' : '' ) .' name="codeexpense"></td></tr>'; + echo '<table class="selection"> + <tr> + <td>' . _('Code Of Expense') . ':</td> + <td><input type="text"' . (in_array('CodeExpense',$Errors) ? 'class="inputerror"' : '' ) .' name="CodeExpense"></td> + </tr>'; } - if (!isset($_POST['description'])) { - $_POST['description']=''; + if (!isset($_POST['Description'])) { + $_POST['Description']=''; } - echo '<tr><td>' . _('Description') . ':</td><td><input type="Text" name="description" size=50 maxlength=49 value="' . $_POST['description'] . '"></td></tr>'; + echo '<tr> + <td>' . _('Description') . ':</td> + <td><input type="text" ' . (in_array('Description',$Errors) ? 'class="inputerror"' : '' ) . ' name="Description" size=50 maxlength=49 value="' . $_POST['Description'] . '"></td> + </tr>'; - echo '<tr><td>' . _('Account Code') . ':</td><td><select name="glaccount">'; + echo '<tr><td>' . _('Account Code') . ':</td><td><select name="GLAccount">'; DB_free_result($result); - $SQL = 'SELECT accountcode, + $SQL = "SELECT accountcode, accountname FROM chartmaster - ORDER BY accountcode'; + ORDER BY accountcode"; $result = DB_query($SQL,$db); - + echo '<option value="">' . _('Not Yet Selected') . '</option>'; while ($myrow = DB_fetch_array($result)) { - if (isset($_POST['glaccount']) and $myrow['accountcode']==$_POST['glaccount']) { + if (isset($_POST['GLAccount']) and $myrow['accountcode']==$_POST['GLAccount']) { echo '<option selected VALUE="'; } else { echo '<option VALUE="'; @@ -270,7 +297,7 @@ echo '</td></tr></table>'; // close main table - echo '<p><div class="centre"><input type=submit name=submit VALUE="' . _('Accept') . '"><input type=submit name=Cancel VALUE="' . _('Cancel') . '"></div>'; + echo '<p><div class="centre"><input type="submit" name=submit VALUE="' . _('Accept') . '"><input type=submit name=Cancel VALUE="' . _('Cancel') . '"></div>'; echo '</form>'; Modified: trunk/PcExpensesTypeTab.php =================================================================== --- trunk/PcExpensesTypeTab.php 2011-05-14 11:24:22 UTC (rev 4566) +++ trunk/PcExpensesTypeTab.php 2011-05-15 04:34:49 UTC (rev 4567) @@ -16,31 +16,51 @@ } else { $SelectedType=''; } -if (ContainsIllegalCharacters($SelectedType) OR strpos($SelectedType,' ')>0){ + +if (!isset($_GET['delete']) and (ContainsIllegalCharacters($SelectedType) OR strpos($SelectedType,' ')>0)){ $InputError = 1; prnMsg(_('The petty cash tab type contain any of the following characters " \' - & or a space'),'error'); } -if (isset($_POST['SelectedTabs'])){ - $SelectedTabs = strtoupper($_POST['SelectedTabs']); -} elseif (isset($_GET['SelectedTabs'])){ - $SelectedTabs = strtoupper($_GET['SelectedTabs']); + +if (isset($_POST['SelectedTab'])){ + $SelectedTab = strtoupper($_POST['SelectedTab']); +} elseif (isset($_GET['SelectedTab'])){ + $SelectedTab = strtoupper($_GET['SelectedTab']); } -if (isset($Errors)) { - unset($Errors); +if (isset($_POST['Cancel'])) { + unset($SelectedTab); + unset($SelectedType); } -$Errors = array(); -$InputError=0; +if (isset($_POST['Process'])) { + + if ($_POST['SelectedTab'] == '') { + echo prnMsg(_('You have not selected a tab to maintain the expenses on'),'error'); + echo '<br />'; + unset($SelectedTab); + unset($_POST['SelectedTab']); + } +} + if (isset($_POST['submit'])) { + $InputError=0; + + if ($_POST['SelectedExpense']=='') { + $InputError=1; + echo prnMsg(_('You have not selected an expense to add to this tab'),'error'); + echo '<br />'; + unset($SelectedTab); + } + if ( $InputError !=1 ) { // First check the type is not being duplicated $checkSql = "SELECT count(*) FROM pctabexpenses - WHERE typetabcode= '" . $_POST['SelectedTabs'] . "' + WHERE typetabcode= '" . $_POST['SelectedTab'] . "' AND codeexpense = '" . $_POST['SelectedExpense'] . "'"; $checkresult = DB_query($checkSql,$db); @@ -48,23 +68,19 @@ if ( $checkrow[0] >0) { $InputError = 1; - prnMsg( _('The Expense ') . $_POST['codeexpense'] . _(' already exist in this Type of Tab.'),'error'); + prnMsg( _('The Expense') . ' ' . $_POST['codeexpense'] . ' ' ._('already exists in this Type of Tab'),'error'); } else { - // Add new record on submit + $sql = "INSERT INTO pctabexpenses (typetabcode, + codeexpense) + VALUES ('" . $_POST['SelectedTab'] . "', + '" . $_POST['SelectedExpense'] . "')"; - $sql = "INSERT INTO pctabexpenses - (typetabcode, - codeexpense) - VALUES ('" . $_POST['SelectedTabs'] . "', - '" . $_POST['SelectedExpense'] . "')"; - - $msg = _('Expense code:') . ' ' . $_POST['SelectedExpense'].' '._('for Type of Tab:') .' '. $_POST['SelectedTabs'] . ' ' . _('has been created'); + $msg = _('Expense code:') . ' ' . $_POST['SelectedExpense'].' '._('for Type of Tab:') .' '. $_POST['SelectedTab'] . ' ' . _('has been created'); $checkSql = "SELECT count(typetabcode) - FROM pctypetabs"; + FROM pctypetabs"; $result = DB_query($checkSql, $db); $row = DB_fetch_row($result); - } } @@ -77,21 +93,17 @@ } } elseif ( isset($_GET['delete']) ) { - - - $sql="DELETE FROM pctabexpenses - WHERE typetabcode='".$SelectedTabs."' - AND codeexpense='".$SelectedType."'"; - $ErrMsg = _('The Tab Type record could not be deleted because'); - $result = DB_query($sql,$db,$ErrMsg); - prnMsg(_('Expense code').' '. $SelectedType .' '. _('for type of tab').' '. $SelectedTabs .' '. _('has been deleted') ,'success'); - unset ($SelectedType); - unset($_GET['delete']); - - + $sql="DELETE FROM pctabexpenses + WHERE typetabcode='".$SelectedTab."' + AND codeexpense='".$SelectedType."'"; + $ErrMsg = _('The Tab Type record could not be deleted because'); + $result = DB_query($sql,$db,$ErrMsg); + prnMsg(_('Expense code').' '. $SelectedType .' '. _('for type of tab').' '. $SelectedTab .' '. _('has been deleted') ,'success'); + unset ($SelectedType); + unset($_GET['delete']); } -if (!isset($SelectedTabs)){ +if (!isset($SelectedTab)){ /* It could still be the second time the page has been run and a record has been selected for modification - SelectedType will exist because it was sent with the new call. If its the first time the page has been displayed with no parameters then none of the above are true and the list of sales types will be displayed with @@ -101,7 +113,7 @@ echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<table class=selection>'; //Main table - echo '<tr><td>' . _('Select Type of Tab') . ':</td><td><select name="SelectedTabs">'; + echo '<tr><td>' . _('Select Type of Tab') . ':</td><td><select name="SelectedTab">'; DB_free_result($result); $SQL = "SELECT typetabcode, @@ -109,12 +121,12 @@ FROM pctypetabs"; $result = DB_query($SQL,$db); - + echo '<option value="">' . _('Not Yet Selected') . '</option>'; while ($myrow = DB_fetch_array($result)) { - if (isset($_POST['SelectedTabs']) and $myrow['typetabcode']==$_POST['SelectedTabs']) { + if (isset($SelectedTab) and $myrow['typetabcode']==$SelectedTab) { echo '<option selected value="'; } else { - echo '<option VALUE="'; + echo '<option value="'; } echo $myrow['typetabcode'] . '">' . $myrow['typetabcode'] . ' - ' . $myrow['typetabdescription'] . '</option>'; @@ -125,26 +137,30 @@ echo '</table>'; // close table in first column echo '</td></tr></table>'; // close main table - echo '<p><div class="centre"><input type=submit name=process VALUE="' . _('Accept') . '"><input type=submit name=Cancel VALUE="' . _('Cancel') . '"></div>'; + echo '<p><div class="centre"><input type=submit name="Process" value="' . _('Accept') . '"> + <input type=submit name="Cancel" value="' . _('Cancel') . '"></div>'; echo '</form>'; } //end of ifs and buts! -if (isset($_POST['process'])OR isset($SelectedTabs)) { +if (isset($_POST['process'])OR isset($SelectedTab)) { - echo '<p><div class="centre"><a href="' . $_SERVER['PHP_SELF'] . '?' . SID . '">' . _('Expense Codes for Type of Tab ') . ' ' .$SelectedTabs. '</a></div><p>'; + echo '<p><div class="centre"><a href="' . $_SERVER['PHP_SELF'] . '">' . _('Expense Codes for Type of Tab ') . ' ' .$SelectedTab. '</a></div><p>'; - $sql = "SELECT pctabexpenses.codeexpense, pcexpenses.description - FROM pctabexpenses,pcexpenses - WHERE pctabexpenses.codeexpense=pcexpenses.codeexpense - AND pctabexpenses.typetabcode='".$SelectedTabs."' + $sql = "SELECT pctabexpenses.codeexpense, + pcexpenses.description + FROM pctabexpenses INNER JOIN pcexpenses + ON pctabexpenses.codeexpense=pcexpenses.codeexpense + WHERE pctabexpenses.typetabcode='".$SelectedTab."' ORDER BY pctabexpenses.codeexpense ASC"; $result = DB_query($sql,$db); - echo '<table class="selection">'; + echo '<br /> + <table class="selection">'; + echo '<tr><th colspan="3"><font size="2" color="navy">' . _('Expense Codes for Type of Tab ') . ' ' .$SelectedTab. '</font></th></tr>'; echo '<tr> <th>' . _('Expense Code') . '</th> <th>' . _('Description') . '</th> @@ -152,7 +168,7 @@ $k=0; //row colour counter -while ($myrow = DB_fetch_row($result)) { +while ($myrow = DB_fetch_array($result)) { if ($k==1){ echo '<tr class="EvenTableRows">'; $k=0; @@ -161,29 +177,24 @@ $k=1; } - printf("<td>%s</td> - <td>%s</td> - <td><a href='%sSelectedType=%s&delete=yes&SelectedTabs=$_POST[SelectedTabs]' onclick=\"return confirm('" . _('Are you sure you wish to delete this code and the expense it may have set up?') . "');\">" . _('Delete') . "</td> - </tr>", - $myrow[0], - $myrow[1], - $_SERVER['PHP_SELF'], $myrow[0], - $_SERVER['PHP_SELF'], $myrow[0]); + printf('<td>%s</td> + <td>%s</td> + <td><a href="%sSelectedType=%s&delete=yes&SelectedTab=' . $_POST['SelectedTab'] . '" onclick="return confirm(\'' . _('Are you sure you wish to delete this code and the expense it may have set up?') . '\');">' . _('Delete') . '</td> + </tr>', + $myrow['codeexpense'], + $myrow['description'], + $_SERVER['PHP_SELF'], $myrow['codeexpense'], + $_SERVER['PHP_SELF'], $myrow['codeexpense']); } //END WHILE LIST LOOP echo '</table>'; - - - if (! isset($_GET['delete'])) { echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<br /><table class="selection">'; //Main table - - echo '<tr><td>' . _('Select Expense Code') . ':</td><td><select name="SelectedExpense">'; DB_free_result($result); @@ -192,9 +203,11 @@ FROM pcexpenses"; $result = DB_query($SQL,$db); - + if (!isset($_POST['SelectedExpense'])){ + echo '<option selected value="">' . _('Not Yet Selected') . '</option>'; + } while ($myrow = DB_fetch_array($result)) { - if (isset($_POST['SelectedExpense']) and $myrow['codeexpense']==$_POST['SelectedExpense']) { + if (isset($_POST['SelectedExpense']) AND $myrow['codeexpense']==$_POST['SelectedExpense']) { echo '<option selected value="'; } else { echo '<option value="'; @@ -206,11 +219,12 @@ echo '</select></td></tr>'; - echo '<input type="hidden" name="SelectedTabs" value="' . $SelectedTabs . '">'; + echo '<input type="hidden" name="SelectedTab" value="' . $SelectedTab . '">'; echo '</td></tr></table>'; // close main table - echo '<p><div class="centre"><input type=submit name=submit VALUE="' . _('Accept') . '"><input type=submit name=Cancel VALUE="' . _('Cancel') . '"></div>'; + echo '<p><div class="centre"><input type=submit name=submit value="' . _('Accept') . '"> + <input type=submit name="Cancel" value="' . _('Cancel') . '"></div>'; echo '</form>'; Modified: trunk/PcReportTab.php =================================================================== --- trunk/PcReportTab.php 2011-05-14 11:24:22 UTC (rev 4566) +++ trunk/PcReportTab.php 2011-05-15 04:34:49 UTC (rev 4567) @@ -48,7 +48,7 @@ $result = DB_query($SQL,$db); while ($myrow = DB_fetch_array($result)) { - if (isset($_POST['SelectTabs']) and $myrow['tabcode']==$_POST['SelectTabs']) { + if (isset($_POST['SelectedTabs']) and $myrow['tabcode']==$_POST['SelectedTabs']) { echo '<option selected value="'; } else { echo '<option value="'; @@ -117,11 +117,11 @@ $Tabs=DB_fetch_array($TabResult); $SqlBalance = "SELECT SUM(amount) FROM pcashdetails - WHERE tabcode='".$SelectedTabs."' - AND date<'".$SQL_FromDate."'"; + WHERE tabcode='".$SelectedTabs."' + AND date<'".$SQL_FromDate."'"; $TabBalance = DB_query($SqlBalance, - $db); + $db); $Balance=DB_fetch_array($TabBalance); @@ -177,17 +177,17 @@ while ($myrow=DB_fetch_array($TabDetail)) { - $sqldes="SELECT description - FROM pcexpenses - WHERE codeexpense='". $myrow[3] . "'"; + $sqldes="SELECT description + FROM pcexpenses + WHERE codeexpense='". $myrow[3] . "'"; + + $ResultDes = DB_query($sqldes,$db); + $Description=DB_fetch_array($ResultDes); + + if (!isset($Description[0])){ + $Description[0]='ASSIGNCASH'; + } - $ResultDes = DB_query($sqldes,$db); - $Description=DB_fetch_array($ResultDes); - - if (!isset($Description[0])){ - $Description[0]='ASSIGNCASH'; - } - // Print total for each account $LeftOvers = $pdf->addTextWrap($Left_Margin,$YPos,70,$FontSize,ConvertSQLDate($myrow['date'])); $LeftOvers = $pdf->addTextWrap($Left_Margin+70,$YPos,130,$FontSize,$Description[0]); Modified: trunk/PcTabs.php =================================================================== --- trunk/PcTabs.php 2011-05-14 11:24:22 UTC (rev 4566) +++ trunk/PcTabs.php 2011-05-15 04:34:49 UTC (rev 4567) @@ -14,13 +14,26 @@ $SelectedTab = strtoupper($_GET['SelectedTab']); } +if (isset($_POST['Cancel'])) { + unset($SelectedTab); + unset($_POST['TabCode'] ); + unset($_POST['SelectUser'] ); + unset($_POST['SelectTabs']); + unset($_POST['SelectCurrency']); + unset($_POST['TabLimit']); + unset($_POST['SelectAuthorizer']); + unset($_POST['GLAccountCash']); + unset($_POST['GLAccountPcashTab']); +} + + if (isset($Errors)) { unset($Errors); } $Errors = array(); -if (isset($_POST['submit'])) { +if (isset($_POST['Submit'])) { //initialise no input errors assumed initially before we test $InputError = 0; @@ -41,18 +54,42 @@ echo prnMsg(_('The Tab code must be twenty characters or less long'),'error'); $Errors[$i] = 'TabCode'; $i++; + } elseif (($_POST['SelectUser'])=='') { + $InputError = 1; + echo prnMsg(_('You must select a User for this tab'),'error'); + $Errors[$i] = 'UserName'; + $i++; + } elseif (($_POST['SelectTabs'])=='') { + $InputError = 1; + echo prnMsg(_('You must select a type of tab from the list'),'error'); + $Errors[$i] = 'TabType'; + $i++; + } elseif (($_POST['SelectAuthorizer'])=='') { + $InputError = 1; + echo prnMsg(_('You must select a User to authorise this tab'),'error'); + $Errors[$i] = 'AuthorizerName'; + $i++; + } elseif (($_POST['GLAccountCash'])=='') { + $InputError = 1; + echo prnMsg(_('You must select a General ledger code for the cash to be assigned from'),'error'); + $Errors[$i] = 'GLCash'; + $i++; + } elseif (($_POST['GLAccountPcashTab'])=='') { + $InputError = 1; + echo prnMsg(_('You must select a General ledger code for this petty cash tab'),'error'); + $Errors[$i] = 'GLTab'; + $i++; } if (isset($SelectedTab) AND $InputError !=1) { - $sql = "UPDATE pctabs - SET usercode = '" . $_POST['SelectUser'] . "', - typetabcode = '" . $_POST['SelectTabs'] . "', - currency = '" . $_POST['SelectCurrency'] . "', - tablimit = '" . $_POST['TabLimit'] . "', - authorizer = '" . $_POST['SelectAuthorizer'] . "', - glaccountassignment = '" . $_POST['glaccountcash'] . "', - glaccountpcash = '" . $_POST['GLAccountPcashTab'] . "' + $sql = "UPDATE pctabs SET usercode = '" . $_POST['SelectUser'] . "', + typetabcode = '" . $_POST['SelectTabs'] . "', + currency = '" . $_POST['SelectCurrency'] . "', + tablimit = '" . $_POST['TabLimit'] . "', + authorizer = '" . $_POST['SelectAuthorizer'] . "', + glaccountassignment = '" . $_POST['GLAccountCash'] . "', + glaccountpcash = '" . $_POST['GLAccountPcashTab'] . "' WHERE tabcode = '".$SelectedTab."'"; $msg = _('The Tabs Of Code') . ' ' . $SelectedTab . ' ' . _('has been updated'); @@ -61,8 +98,8 @@ // First check the type is not being duplicated $checkSql = "SELECT count(*) - FROM pctabs - WHERE tabcode = '" . $_POST['TabCode'] . "'"; + FROM pctabs + WHERE tabcode = '" . $_POST['TabCode'] . "'"; $CheckResult = DB_query($checkSql,$db); $CheckRow = DB_fetch_row($CheckResult); @@ -74,24 +111,23 @@ // Add new record on submit - $sql = "INSERT INTO pctabs - (tabcode, - usercode, - typetabcode, - currency, - tablimit, - authorizer, - glaccountassignment, - glaccountpcash) - VALUES ('" . $_POST['TabCode'] . "', - '" . $_POST['SelectUser'] . "', - '" . $_POST['SelectTabs'] . "', - '" . $_POST['SelectCurrency'] . "', - '" . $_POST['TabLimit'] . "', - '" . $_POST['SelectAuthorizer'] . "', - '" . $_POST['glaccountcash'] . "', - '" . $_POST['GLAccountPcashTab'] . "')"; - + $sql = "INSERT INTO pctabs (tabcode, + usercode, + typetabcode, + currency, + tablimit, + authorizer, + glaccountassignment, + glaccountpcash) + VALUES ('" . $_POST['TabCode'] . "', + '" . $_POST['SelectUser'] . "', + '" . $_POST['SelectTabs'] . "', + '" . $_POST['SelectCurrency'] . "', + '" . $_POST['TabLimit'] . "', + '" . $_POST['SelectAuthorizer'] . "', + '" . $_POST['GLAccountCash'] . "', + '" . $_POST['GLAccountPcashTab'] . "')"; + $msg = _('Tab with Code ') . ' ' . $_POST['TabCode'] . ' ' . _('has been created'); } @@ -102,15 +138,14 @@ $result = DB_query($sql,$db); prnMsg($msg,'success'); unset($SelectedTab); - unset($_POST['SelectUser'] ); + unset($_POST['SelectUser']); + unset($_POST['TabCode']); unset($_POST['SelectTabs']); unset($_POST['SelectCurrency']); unset($_POST['TabLimit']); unset($_POST['SelectAuthorizer']); - unset($_POST['glaccountcash']); + unset($_POST['GLAccountCash']); unset($_POST['GLAccountPcashTab']); - - } } elseif ( isset($_GET['delete']) ) { @@ -130,73 +165,76 @@ links to delete or edit each. These will call the same page again and allow update/input or deletion of the records*/ - $sql = 'SELECT * - FROM pctabs - ORDER BY tabcode'; + $sql = "SELECT tabcode, + usercode, + typetabdescription, + currabrev, + tablimit, + authorizer, + glaccountassignment, + glaccountpcash, + currencies.decimalplaces, + chartmaster1.accountname AS glactassigntname, + chartmaster2.accountname AS glactpcashname + FROM pctabs INNER JOIN currencies + ON pctabs.currency=currencies.currabrev + INNER JOIN pctypetabs + ON pctabs.typetabcode=pctypetabs.typetabcode + INNER JOIN chartmaster AS chartmaster1 ON + pctabs.glaccountassignment = chartmaster1.accountcode + INNER JOIN chartmaster AS chartmaster2 ON + pctabs.glaccountpcash = chartmaster2.accountcode + ORDER BY tabcode"; $result = DB_query($sql,$db); - - echo '<br><table class=selection>'; - echo '<tr> - <th>' . _('Tab Code') . '</th> - <th>' . _('User Name') . '</th> - <th>' . _('Type Of Tab') . '</th> - <th>' . _('Currency') . '</th> - <th>' . _('Limit') . '</th> - <th>' . _('Authorizer') . '</th> - <th>' . _('GL Account For Cash Assignment') . '</th> - <th>' . _('GL Account Petty Cash Tab') . '</th> - </tr>'; - -$k=0; //row colour counter - -while ($myrow = DB_fetch_row($result)) { - if ($k==1){ - echo '<tr class="EvenTableRows">'; - $k=0; - } else { - echo '<tr class="OddTableRows">'; - $k=1; - } - - $sqldes="SELECT accountname - FROM chartmaster - WHERE accountcode='". $myrow[6] . "'"; - - $ResultDes = DB_query($sqldes,$db); - $Description=DB_fetch_array($ResultDes); - - $sqlname="SELECT accountname - FROM chartmaster - WHERE accountcode='". $myrow[7] . "'"; - - $ResultName = DB_query($sqlname,$db); - $DescriptionName=DB_fetch_array($ResultName); - - - printf('<td>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td class=number>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td><a href="%sSelectedTab=%s">' . _('Edit') . '</td> - <td><a href="%sSelectedTab=%s&delete=yes" onclick=\' return confirm("' . _('Are you sure you wish to delete this tab code?') . '");\'>' . _('Delete') . '</td> - </tr>', - $myrow[0], - $myrow[1], - $myrow[2], - $myrow[3], - number_format($myrow[4],2), - $myrow[5], - $myrow[6].' - '.$Description[0], - $myrow[7].' - '.$DescriptionName[0], - $_SERVER['PHP_SELF'] . '?', $myrow[0], - $_SERVER['PHP_SELF'] . '?', $myrow[0]); - } - //END WHILE LIST LOOP - echo '</table>'; + if (DB_num_rows($result)>0){ + echo '<br><table class=selection>'; + echo '<tr> + <th>' . _('Tab Code') . '</th> + <th>' . _('User Name') . '</th> + <th>' . _('Type Of Tab') . '</th> + <th>' . _('Currency') . '</th> + <th>' . _('Limit') . '</th> + <th>' . _('Authorizer') . '</th> + <th>' . _('GL Account For Cash Assignment') . '</th> + <th>' . _('GL Account Petty Cash Tab') . '</th> + </tr>'; + + $k=0; //row colour counter + + while ($myrow = DB_fetch_array($result)) { + if ($k==1){ + echo '<tr class="EvenTableRows">'; + $k=0; + } else { + echo '<tr class="OddTableRows">'; + $k=1; + } + + printf('<td>%s</td> + <td>%s</td> + <td>%s</td> + <td>%s</td> + <td class=number>%s</td> + <td>%s</td> + <td>%s</td> + <td>%s</td> + <td><a href="%sSelectedTab=%s">' . _('Edit') . '</td> + <td><a href="%sSelectedTab=%s&delete=yes" onclick=\' return confirm("' . _('Are you sure you wish to delete this tab code?') . '");\'>' . _('Delete') . '</td> + </tr>', + $myrow['tabcode'], + $myrow['usercode'], + $myrow['typetabdescription'], + $myrow['currabrev'], + number_format($myrow['tablimit'],$myrow['decimalplaces']), + $myrow['authorizer'], + $myrow['glaccountassignment'].' - '. $myrow['glactassigntname'], + $myrow['glaccountpcash'].' - '.$myrow['glactpcashname'], + $_SERVER['PHP_SELF'] . '?', $myrow['tabcode'], + $_SERVER['PHP_SELF'] . '?', $myrow['tabcode']); + } + //END WHILE LIST LOOP + echo '</table>'; + } //if there are tabs to show } //end of ifs and buts! @@ -208,7 +246,7 @@ echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<p><table class=selection>'; //Main table + echo '<p><table class="selection">'; //Main table if ( isset($SelectedTab) AND $SelectedTab!='' ) { @@ -225,20 +263,18 @@ $_POST['SelectCurrency'] = $myrow['currency']; $_POST['TabLimit'] = $myrow['tablimit']; $_POST['SelectAuthorizer'] = $myrow['authorizer']; - $_POST['glaccountcash'] = $myrow['glaccountassignment']; + $_POST['GLAccountCash'] = $myrow['glaccountassignment']; $_POST['GLAccountPcashTab'] = $myrow['glaccountpcash']; echo '<input type=hidden name="SelectedTab" value="' . $SelectedTab . '">'; echo '<input type=hidden name="TabCode" value="' . $_POST['TabCode']. '">'; - echo '<table class="selection"> <tr><td>' . _('Tab Code') . ':</td><td>'; - - // We dont allow the user to change an existing type code - - echo $_POST['TabCode'] . '</td></tr>'; - + echo '<table class="selection"> + <tr> + <td>' . _('Tab Code') . ':</td> + <td>' . $_POST['TabCode'] . '</td> + </tr>'; } else { - // This is a new type so the user may volunteer a type code echo '<table class="selection"> <tr><td>' . _('Tab Code') . ':</td> @@ -254,7 +290,8 @@ <td><select name="SelectUser">'; DB_free_result($result); - $SQL = "SELECT userid + $SQL = "SELECT userid, + realname FROM www_users ORDER BY userid"; $result = DB_query($SQL,$db); @@ -265,7 +302,7 @@ } else { echo '<option value="'; } - echo $myrow['userid'] . '">' . $myrow['userid'] . '</option>'; + echo $myrow['userid'] . '">' . $myrow['userid'] . ' - ' . $myrow['realname'] . '</option>'; } //end while loop get user @@ -275,7 +312,10 @@ <td><select name="SelectTabs">'; DB_free_result($result); - $SQL = "SELECT typetabcode FROM pctypetabs ORDER BY typetabcode"; + $SQL = "SELECT typetabcode, + typetabdescription + FROM pctypetabs + ORDER BY typetabcode"; $result = DB_query($SQL,$db); @@ -285,7 +325,7 @@ } else { echo '<option value="'; } - echo $myrow['typetabcode'] . '">' . $myrow['typetabcode'] . '</option>'; + echo $myrow['typetabcode'] . '">' . $myrow['typetabcode'] . ' - ' . $myrow['typetabdescription'] . '</option>'; } //end while loop get type of tab @@ -318,11 +358,12 @@ echo '<tr><td>' . _('Limit Of Tab') . ':</td> <td><input type="Text" class="number" name="TabLimit" size="12" maxlength="11" value="' . $_POST['TabLimit'] . '"></td></tr>'; - echo '<tr><td>' . _('Authorizer') . ':</td> + echo '<tr><td>' . _('Authoriser') . ':</td> <td><select name="SelectAuthorizer">'; DB_free_result($result); - $SQL = "SELECT userid + $SQL = "SELECT userid, + realname FROM www_users ORDER BY userid"; @@ -334,14 +375,14 @@ } else { echo '<option value="'; } - echo $myrow['userid'] . '">' . $myrow['userid'] . '</option>'; + echo $myrow['userid'] . '">' . $myrow['userid'] . ' - ' . $myrow['realname'] . '</option>'; } //end while loop get authorizer echo '</select></td></tr>'; echo '<tr><td>' . _('GL Account Cash Assignment') . ':</td> - <td><select name="glaccountcash">'; + <... [truncated message content] |
From: <dai...@us...> - 2011-05-15 04:34:58
|
Revision: 4567 http://web-erp.svn.sourceforge.net/web-erp/?rev=4567&view=rev Author: daintree Date: 2011-05-15 04:34:49 +0000 (Sun, 15 May 2011) Log Message: ----------- various Modified Paths: -------------- trunk/FixedAssetCategories.php trunk/Logout.php trunk/PO_AuthorisationLevels.php trunk/PO_Header.php trunk/PcAssignCashToTab.php trunk/PcAuthorizeExpenses.php trunk/PcClaimExpensesFromTab.php trunk/PcExpenses.php trunk/PcExpensesTypeTab.php trunk/PcReportTab.php trunk/PcTabs.php trunk/PcTypeTabs.php trunk/UnitsOfMeasure.php trunk/doc/Change.log trunk/includes/Login.php Modified: trunk/FixedAssetCategories.php =================================================================== --- trunk/FixedAssetCategories.php 2011-05-14 11:24:22 UTC (rev 4566) +++ trunk/FixedAssetCategories.php 2011-05-15 04:34:49 UTC (rev 4567) @@ -50,10 +50,9 @@ $InputError =1; } /*Make an array of the defined bank accounts */ - $SQL = 'SELECT bankaccounts.accountcode - FROM bankaccounts, - chartmaster - WHERE bankaccounts.accountcode=chartmaster.accountcode'; + $SQL = "SELECT bankaccounts.accountcode + FROM bankaccounts INNER JOIN chartmaster + ON bankaccounts.accountcode=chartmaster.accountcode"; $result = DB_query($SQL,$db); $BankAccounts = array(); $i=0; @@ -123,7 +122,7 @@ // PREVENT DELETES IF DEPENDENT RECORDS IN 'fixedassets' - $sql= "SELECT COUNT(*) FROM fixedasset WHERE fixedassets.assetcategoryid='" . $SelectedCategory . "'"; + $sql= "SELECT COUNT(*) FROM fixedassets WHERE fixedassets.assetcategoryid='" . $SelectedCategory . "'"; $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); if ($myrow[0]>0) { Modified: trunk/Logout.php =================================================================== --- trunk/Logout.php 2011-05-14 11:24:22 UTC (rev 4566) +++ trunk/Logout.php 2011-05-15 04:34:49 UTC (rev 4567) @@ -23,7 +23,7 @@ <?php echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; ?> - <span><?php echo _('Thank you for using webERP'); ?></span> + <span><?php echo _('Thank you for using webERP'); ?></span> <br /> <input class="button" type="submit" value="<?php echo _('Login'); ?>" name="SubmitUser" /> </form> Modified: trunk/PO_AuthorisationLevels.php =================================================================== --- trunk/PO_AuthorisationLevels.php 2011-05-14 11:24:22 UTC (rev 4566) +++ trunk/PO_AuthorisationLevels.php 2011-05-15 04:34:49 UTC (rev 4567) @@ -8,18 +8,21 @@ include('includes/header.inc'); echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/group_add.png" title="' . _('Search') . '" alt="" />' . ' ' . $title.'</p><br />'; -$User=''; -$Currency=''; -$CanCreate=1; -$OffHold=1; -$AuthLevel=0; + + +/*Note: If CanCreate==0 then this means the user can create orders + * Also if OffHold==0 then the user can release purchase invocies + * This logic confused me a bit to start with + */ + + if (isset($_POST['Submit'])) { - if (isset($_POST['CanCreate']) and $_POST['CanCreate']=='on') { + if (isset($_POST['CanCreate']) AND $_POST['CanCreate']=='on') { $CanCreate=0; } else { $CanCreate=1; } - if (isset($_POST['OffHold']) and $_POST['OffHold']=='on') { + if (isset($_POST['OffHold']) AND $_POST['OffHold']=='on') { $OffHold=0; } else { $OffHold=1; @@ -48,17 +51,17 @@ $Result=DB_query($sql,$db,$ErrMsg); } else { prnMsg(_('There already exists an entry for this user/currency combination'), 'error'); - echo '<br />'; + echo '<br />'; } } if (isset($_POST['Update'])) { - if (isset($_POST['CanCreate']) and $_POST['CanCreate']=='on') { + if (isset($_POST['CanCreate']) AND $_POST['CanCreate']=='on') { $CanCreate=0; } else { $CanCreate=1; } - if (isset($_POST['OffHold']) and $_POST['OffHold']=='on') { + if (isset($_POST['OffHold']) AND $_POST['OffHold']=='on') { $OffHold=0; } else { $OffHold=1; @@ -69,7 +72,7 @@ authlevel='".$_POST['AuthLevel']."' WHERE userid='".$_POST['UserID']."' AND currabrev='".$_POST['CurrCode']."'"; - + $ErrMsg = _('The authentication details cannot be updated because'); $Result=DB_query($sql,$db,$ErrMsg); } @@ -104,6 +107,7 @@ www_users.realname, currencies.currabrev, currencies.currency, + currencies.decimalplaces, purchorderauth.cancreate, purchorderauth.offhold, purchorderauth.authlevel @@ -125,22 +129,22 @@ while ($myrow=DB_fetch_array($Result)) { if ($myrow['cancreate']==0) { - $CanCreate=_('Yes'); + $DisplayCanCreate=_('Yes'); } else { - $CanCreate=_('No'); + $DisplayCanCreate=_('No'); } if ($myrow['offhold']==0) { - $OffHold=_('Yes'); + $DisplayOffHold=_('Yes'); } else { - $OffHold=_('No'); + $DisplayOffHold=_('No'); } echo '<tr> <td>' . $myrow['userid'] . '</td> <td>' . $myrow['realname'] . '</td> <td>' . $myrow['currency'] . '</td> - <td>' . $CanCreate . '</td> - <td>' . $OffHold . '</td> - <td class="number">'.number_format($myrow['authlevel'],2).'</td> + <td>' . $DisplayCanCreate . '</td> + <td>' . $DisplayOffHold . '</td> + <td class="number">'.number_format($myrow['authlevel'],$myrow['decimalplaces']).'</td> <td><a href="'.$rootpath.'/PO_AuthorisationLevels.php?Edit=Yes&UserID=' . $myrow['userid'] . '&Currency='.$myrow['currabrev'].'">'._('Edit').'</td> <td><a href="'.$rootpath.'/PO_AuthorisationLevels.php?Delete=Yes&UserID=' . $myrow['userid'] . @@ -150,15 +154,23 @@ echo '</table><br><br>'; +if (!isset($_GET['Edit'])) { + $UserID=$_SESSION['UserID']; + $Currency=$_SESSION['CompanyRecord']['currencydefault']; + $CanCreate=0; + $OffHold=0; + $AuthLevel=0; +} + echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post" name="form1">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<table class=selection>'; if (isset($_GET['Edit'])) { - echo '<tr><td>'._('User ID').'</td><td>'.$UserID.'</td></tr>'; - echo '<input type=hidden name=UserID value="'.$UserID.'"'; + echo '<tr><td>'._('User ID').'</td><td>'.$_GET['UserID'].'</td></tr>'; + echo '<input type="hidden" name="UserID" value="'.$_GET['UserID'].'" />'; } else { - echo '<tr><td>'._('User ID').'</td><td><select name=UserID>'; + echo '<tr><td>'._('User ID').'</td><td><select name="UserID">'; $usersql="SELECT userid FROM www_users"; $userresult=DB_query($usersql,$db); while ($myrow=DB_fetch_array($userresult)) { @@ -172,14 +184,28 @@ } if (isset($_GET['Edit'])) { - $CurrencySQL="SELECT currency FROM currencies WHERE currabrev='".$Currency."'"; - $CurrencyResult=DB_query($CurrencySQL,$db); - $myrow=DB_fetch_array($CurrencyResult); + $sql="SELECT cancreate, + offhold, + authlevel, + currency + FROM purchorderauth INNER JOIN currencies + ON purchorderauth.currabrev=currencies.currabrev + WHERE userid='".$_GET['UserID']."' + AND purchorderauth.currabrev='".$_GET['Currency']."'"; + $ErrMsg = _('The authentication details cannot be retrieved because'); + $result=DB_query($sql,$db,$ErrMsg); + $myrow=DB_fetch_array($result); + $UserID=$_GET['UserID']; + $Currency=$_GET['Currency']; + $CanCreate=$myrow['cancreate']; + $OffHold=$myrow['offhold']; + $AuthLevel=$myrow['authlevel']; + echo '<tr> <td>'._('Currency').'</td> <td>' . $myrow['currency'] . '</td> </tr>'; - echo '<input type=hidden name="currabrev" value="'.$Currency.'"'; + echo '<input type=hidden name="CurrCode" value="'.$Currency.'"'; } else { echo '<tr><td>'._('Currency').'</td><td><select name="CurrCode">'; $currencysql="SELECT currabrev,currency FROM currencies"; Modified: trunk/PO_Header.php =================================================================== --- trunk/PO_Header.php 2011-05-14 11:24:22 UTC (rev 4566) +++ trunk/PO_Header.php 2011-05-15 04:34:49 UTC (rev 4567) @@ -653,7 +653,7 @@ $PurchItemRow['leadtime'], $PurchItemRow['suppliers_partno'] ); - echo "<meta http-equiv='Refresh' content='0; url=" . $rootpath . '/PO_Items.php?identifier='.$identifier. "'>"; + echo '<meta http-equiv="refresh" content="0; url=' . $rootpath . '/PO_Items.php?identifier='.$identifier. '">'; } /*Set up form for entry of order header stuff */ Modified: trunk/PcAssignCashToTab.php =================================================================== --- trunk/PcAssignCashToTab.php 2011-05-14 11:24:22 UTC (rev 4566) +++ trunk/PcAssignCashToTab.php 2011-05-15 04:34:49 UTC (rev 4567) @@ -23,12 +23,31 @@ $Days = $_GET['Days']; } -if (isset($Errors)) { - unset($Errors); +if (isset($_POST['Cancel'])) { + unset($SelectedTabs); + unset($SelectedIndex); + unset($Days); + unset($_POST['Amount']); + unset($_POST['Notes']); + unset($_POST['Receipt']); } -$Errors = array(); +if (isset($_POST['process'])) { + if ($SelectedTabs=='') { + prnMsg(_('You Must First Select a Petty Cash Tab To Assign Cash'),'error'); + unset($SelectedTabs); + } +} +if (isset($_POST['Go'])) { + $InputError = 0; + if ($Days<=0) { + $InputError = 1; + prnMsg(_('The number of days must be a positive number'),'error'); + $Days=30; + } +} + if (isset($_POST['submit'])) { //initialise no input errors assumed initially before we test $InputError = 0; @@ -43,9 +62,7 @@ if ($_POST['Amount']==0) { $InputError = 1; - prnMsg('<br />' . _('The Amount must be inputed'),'error'); - $Errors[$i] = 'TabCode'; - $i++; + prnMsg('<br />' . _('The Amount must be input'),'error'); } $sqlLimit = "SELECT tablimit @@ -56,7 +73,7 @@ $Limit=DB_fetch_array($ResultLimit); if (($_POST['CurrentAmount']+$_POST['Amount'])>$Limit['tablimit']){ - prnMsg('<br />' . _('The balance after this assignment would be greater than the specified limit for this PC tab'),'warning'); + prnMsg(_('The balance after this assignment would be greater than the specified limit for this PC tab'),'warning'); } if ($InputError !=1 AND isset($SelectedIndex) ) { @@ -92,7 +109,7 @@ '" . $_POST['Notes'] . "', '" . $_POST['Receipt'] . "' )"; - $msg = _('Assignment of cash to PC Tab ') . ' ' . $_POST["SelectedTabs"] . ' ' . _('has been created'); + $msg = _('Assignment of cash to PC Tab ') . ' ' . $_POST['SelectedTabs'] . ' ' . _('has been created'); } if ( $InputError !=1) { @@ -103,6 +120,8 @@ unset($_POST['Amount']); unset($_POST['Notes']); unset($_POST['Receipt']); + unset($_POST['SelectedTabs']); + unset($_POST['Date']); } } elseif ( isset($_GET['delete']) ) { @@ -128,16 +147,16 @@ echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<p><table class=selection>'; //Main table + echo '<p><table class="selection">'; //Main table echo '<tr><td>' . _('Petty Cash Tab To Assign Cash') . ':</td> <td><select name="SelectedTabs">'; DB_free_result($result); $SQL = "SELECT tabcode - FROM pctabs - WHERE authorizer='" . $_SESSION['UserID'] . "' - ORDER BY tabcode"; + FROM pctabs + WHERE authorizer='" . $_SESSION['UserID'] . "' + ORDER BY tabcode"; $result = DB_query($SQL,$db); @@ -179,7 +198,7 @@ } $sql = "SELECT * FROM pcashdetails WHERE tabcode='" . $SelectedTabs . "' - AND date >=DATE_SUB(CURDATE(), INTERVAL '".$Days."' DAY) + AND date >=DATE_SUB(CURDATE(), INTERVAL , '".$Days."' DAY) ORDER BY date, counterindex ASC"; @@ -188,7 +207,7 @@ echo '<table class=selection>'; echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<tr><th colspan="8">' . _('Detail Of PC Tab Movements For Last ') .': '; + echo '<tr><th colspan="8">' . _('Detail Of PC Tab Movements For Last') .': '; echo '<input type="hidden" name="SelectedTabs" value="' . $SelectedTabs . '">'; echo '<input type="text" class="number" name="Days" value="' . $Days . '" maxlength="3" size="4" /> ' . _('Days'); echo '<input type=submit name="Go" value="' . _('Go') . '">'; @@ -228,7 +247,7 @@ // only cash assignations NOT authorized can be modified or deleted echo '<td>' . ConvertSQLDate($myrow['date']) . '</td> <td>' . $Description['0'] . '</td> - <td class=number>' . number_format($myrow['amount'],2) . '</td> + <td class=number>' . number_format($myrow['amount'],$_SESSION['CompanyRecord']['decimalplaces']) . '</td> <td>' . ConvertSQLDate($myrow['authorized']) . '</td> <td>' . $myrow['notes'] . '</td> <td>' . $myrow['receipt'] . '</td> @@ -242,7 +261,7 @@ }else{ echo '<td>' . ConvertSQLDate($myrow['date']) . '</td> <td>' . $Description['0'] . '</td> - <td class=number>' . number_format($myrow['amount'],2).'</td> + <td class=number>' . number_format($myrow['amount'],$_SESSION['CompanyRecord']['decimalplaces']).'</td> <td>' . ConvertSQLDate($myrow['authorized']) . '</td> <td>' . $myrow['notes'] . '</td> <td>' . $myrow['receipt'] . '</td> @@ -263,7 +282,7 @@ } echo '<tr><td colspan="2" style="text-align:right"><b>' . _('Current balance') . ':</b></td> - <td>' . number_format($Amount['0'],2) . '</td></tr>'; + <td>' . number_format($Amount['0'],$_SESSION['CompanyRecord']['decimalplaces']) . '</td></tr>'; echo '</table>'; @@ -286,7 +305,7 @@ if ( isset($_GET['edit'])) { $sql = "SELECT * FROM pcashdetails - WHERE counterindex='".$SelectedIndex."'"; + WHERE counterindex='".$SelectedIndex."'"; $result = DB_query($sql, $db); $myrow = DB_fetch_array($result); @@ -340,13 +359,12 @@ echo '</td></tr></table>'; // close main table - echo '<p><div class="centre"><input type=submit name=submit value="' . _('Accept') . '"><input type=submit name=Cancel value="' . _('Cancel') . '"></div>'; + echo '<p><div class="centre"><input type=submit name=submit value="' . _('Accept') . '"> + <input type=submit name=Cancel value="' . _('Cancel') . '"></div>'; echo '</form>'; } // end if user wish to delete - } - include('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/PcAuthorizeExpenses.php =================================================================== --- trunk/PcAuthorizeExpenses.php 2011-05-14 11:24:22 UTC (rev 4566) +++ trunk/PcAuthorizeExpenses.php 2011-05-15 04:34:49 UTC (rev 4567) @@ -24,11 +24,19 @@ $Days = $_GET['Days']; } -if (isset($Errors)) { - unset($Errors); +if (isset($_POST['Process'])) { + if ($SelectedTabs=='') { + prnMsg(_('You Must First Select a Petty Cash Tab To Authorise'),'error'); + unset($SelectedTabs); + } } -$Errors = array(); +if (isset($_POST['Go'])) { + if ($Days<=0) { + prnMsg(_('The number of days must be a positive number'),'error'); + $Days=30; + } +} if (isset($SelectedTabs)) { echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/magnifier.png" title="' . _('Petty Cash') . @@ -37,7 +45,7 @@ echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/magnifier.png" title="' . _('Petty Cash') . '" alt="" />' . _('Authorization Of Petty Cash Expenses ') . '</p>'; } -if (isset($_POST['submit']) or isset($_POST['update']) OR isset($SelectedTabs) OR isset ($_POST['GO'])) { +if (isset($_POST['Submit']) or isset($_POST['update']) OR isset($SelectedTabs) OR isset ($_POST['GO'])) { echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; @@ -82,7 +90,7 @@ <th>' . _('Posted') . '</th> <th>' . _('Notes') . '</th> <th>' . _('Receipt') . '</th> - <th>' . _('Authorized') . '</th> + <th>' . _('Authorised') . '</th> </tr>'; $k=0; //row colour counter @@ -92,7 +100,7 @@ while ($myrow=DB_fetch_array($result)) { //update database if update pressed - if ((isset($_POST['submit']) and $_POST['submit']=='Update') AND isset($_POST[$myrow['counterindex']])){ + if ((isset($_POST['Submit']) AND $_POST['Submit']=='Update') AND isset($_POST[$myrow['counterindex']])){ $PeriodNo = GetPeriod(ConvertSQLDate($myrow['date']), $db); @@ -225,13 +233,17 @@ echo '<tr class="OddTableRows">'; $k=1; } - + if ($myrow['posted']==0) { + $Posted=_('No'); + } else { + $Posted=_('Yes'); + } echo'<td>'.ConvertSQLDate($myrow['date']).'</td> <td>'.$myrow['codeexpense'].'</td> <td class="number">'.number_format($myrow['amount'],2).'</td> - <td>'.$myrow['posted'].'</td> - <td>'.$myrow['notes'].'</td> - <td>'.$myrow['receipt'].'</td>'; + <td>' . $Posted . '</td> + <td>' .$myrow['notes'] . '</td> + <td>' . $myrow['receipt'] . '</td>'; if (isset($_POST[$myrow['counterindex']])){ echo'<td>'.ConvertSQLDate(Date('Y-m-d')).'</td>'; @@ -263,14 +275,14 @@ $Amount['0']=0; } - echo '<tr><td colspan="4" style="text-align:right" >' . _('Current balance') . ':</td> - <td colspan="2">' . number_format($Amount['0'],2) . '</td></tr>'; + echo '<tr><td colspan=2 class="number">' . _('Current balance') . ':</td> + <td class=number>'.number_format($Amount['0'],2).'</td></tr>'; // Do the postings include ('includes/GLPostings.inc'); + echo'</table><br /><div class="centre"><input type="submit" name="Submit" value=' . _('Update') . '></div></form>'; + - echo'<tr><td style="text-align:right" colspan=4><input type="submit" name="submit" value="' . _('Update') . '"></td></tr></form>'; - } else { /*The option to submit was not hit so display form */ @@ -278,7 +290,7 @@ echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<p><table class="selection">'; //Main table -echo '<tr><td>' . _('Authorize expenses to Petty Cash Tab') . ':</td> +echo '<tr><td>' . _('Authorise expenses to Petty Cash Tab') . ':</td> <td><select name="SelectedTabs">'; DB_free_result($result); @@ -292,7 +304,7 @@ if (isset($_POST['SelectTabs']) and $myrow['tabcode']==$_POST['SelectTabs']) { echo '<option selected value="'; } else { - echo '<option VALUE="'; + echo '<option value="'; } echo $myrow['tabcode'] . '">' . $myrow['tabcode'] . '</option>'; @@ -302,7 +314,8 @@ echo '</td></tr></table>'; // close main table - echo '<p><div class="centre"><input type=submit name=process VALUE="' . _('Accept') . '"><input type=submit name=Cancel VALUE="' . _('Cancel') . '"></div>'; + echo '<p><div class="centre"><input type=submit name="Process" value="' . _('Accept') . '"> + <input type="submit" name="Cancel" value="' . _('Cancel') . '"></div>'; echo '</form>'; } /*end of else not submit */ Modified: trunk/PcClaimExpensesFromTab.php =================================================================== --- trunk/PcClaimExpensesFromTab.php 2011-05-14 11:24:22 UTC (rev 4566) +++ trunk/PcClaimExpensesFromTab.php 2011-05-15 04:34:49 UTC (rev 4567) @@ -25,12 +25,31 @@ $Days = $_GET['Days']; } -if (isset($Errors)) { - unset($Errors); +if (isset($_POST['Cancel'])) { + unset($SelectedTabs); + unset($SelectedIndex); + unset($Days); + unset($_POST['Amount']); + unset($_POST['Notes']); + unset($_POST['Receipt']); } -$Errors = array(); +if (isset($_POST['Process'])) { + + if ($_POST['SelectedTabs']=='') { + echo prnMsg(_('You have not selected a tab to claim the expenses on'),'error'); + unset($SelectedTabs); + } +} + +if (isset($_POST['Go'])) { + if ($Days<=0) { + prnMsg(_('The number of days must be a positive number'),'error'); + $Days=30; + } +} + if (isset($_POST['submit'])) { //initialise no input errors assumed initially before we test $InputError = 0; @@ -39,13 +58,13 @@ ie the page has called itself with some user input */ //first off validate inputs sensible - $i=1; - if ($_POST['amount']==0) { + if ($_POST['SelectedExpense']=='') { + $InputError=1; + prnMsg(_('You have not selected an expense to claim on this tab'),'error'); + } elseif ($_POST['amount']==0) { $InputError = 1; prnMsg( _('The Amount must be greater than 0'),'error'); - $Errors[$i] = 'TabCode'; - $i++; } if (isset($SelectedIndex) AND $InputError !=1) { @@ -120,7 +139,7 @@ echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<p><table class="selection">'; //Main table + echo '<br /><table class="selection">'; //Main table echo '<tr><td>' . _('Petty Cash Tabs for User ') . $_SESSION['UserID'] . ':</td> <td><select name="SelectedTabs">'; @@ -131,7 +150,7 @@ WHERE usercode='" . $_SESSION['UserID'] . "'"; $result = DB_query($SQL,$db); - + echo '<option value="">' . _('Not Yet Selected') . '</option>'; while ($myrow = DB_fetch_array($result)) { if (isset($_POST['SelectTabs']) and $myrow['tabcode']==$_POST['SelectTabs']) { echo '<option selected value="'; @@ -145,21 +164,24 @@ echo '</select></td></tr>'; echo '</td></tr></table>'; // close main table - echo '<p><div class="centre"><input type="submit" name="process" value="' . _('Accept') . '"><input type=submit name="Cancel" value="' . _('Cancel') . '"></div>'; + echo '<p><div class="centre"><input type="submit" name="Process" value="' . _('Accept') . '"><input type=submit name="Cancel" value="' . _('Cancel') . '"></div>'; echo '</form>'; -} +} else { // isset($SelectedTabs) -//end of ifs and buts! -if (isset($_POST['process'])OR isset($SelectedTabs)) { + echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/money_add.png" title="' . _('Petty Cash Claim Entry') + . '" alt="" />' . ' ' . $title . '</p>'; - echo '<p><div class="centre"><a href="' . $_SERVER['PHP_SELF'] . '">' . _('Petty Cash Tab ') . '' .$SelectedTabs. '<a/></div><p>'; -/* RICARD */ + echo '<p><div class="centre"><a href="' . $_SERVER['PHP_SELF'] . '">' . _('Select another tab') . '</a></div></p>'; + if (! isset($_GET['edit']) OR isset ($_POST['GO'])){ echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<div class="centre"><p>' . _('Detail Of Movements For Last ') .': '; + echo '<br /><table class=selection>'; + echo '<tr><th colspan="8"><font color="navy" size="3">' . _('Petty Cash Tab') . ' ' .$SelectedTabs. '</font></th></tr>'; + echo '<tr><th colspan="8">' . _('Detail Of Movements For Last ') .': '; + if(!isset ($Days)){ $Days=30; @@ -167,7 +189,7 @@ echo '<input type="hidden" name="SelectedTabs" value="' . $SelectedTabs . '">'; echo '<input type="text" class="number" name="Days" value="' . $Days . '" maxlength="3" size="4" /> ' ._('Days'); echo '<input type="submit" name="Go" value="' . _('Go') . '" />'; - echo '<p></div></form>'; + echo '</th></div></form>'; if (isset($_POST['Cancel'])) { unset($_POST['SelectedExpense']); @@ -184,7 +206,6 @@ $result = DB_query($sql,$db); - echo '<br><table border=1>'; echo '<tr> <th>' . _('Date Of Expense') . '</th> <th>' . _('Expense Description') . '</th> @@ -215,7 +236,11 @@ if (!isset($Description['0'])){ $Description['0']='ASSIGNCASH'; } - + if ($myrow['5']=='0000-00-00') { + $AuthorisedDate=_('Unauthorised'); + } else { + $AuthorisedDate=ConvertSQLDate($myrow['5']); + } if (($myrow['5'] == '0000-00-00') and ($Description['0'] != 'ASSIGNCASH')){ // only movements NOT authorized can be modified or deleted printf('<td>%s</td> @@ -230,7 +255,7 @@ ConvertSQLDate($myrow['2']), $Description['0'], number_format($myrow['4'],2), - ConvertSQLDate($myrow['5']), + $AuthorisedDate, $myrow['7'], $myrow['8'], $_SERVER['PHP_SELF'] . '?', $myrow['0'], @@ -246,7 +271,7 @@ ConvertSQLDate($myrow['2']), $Description['0'], number_format($myrow['4'],2), - ConvertSQLDate($myrow['5']), + $AuthorisedDate, $myrow['7'], $myrow['8']); @@ -265,11 +290,11 @@ if (!isset($Amount['0'])) { $Amount['0']=0; } + + echo '<tr><td colspan="2" style="text-align:right" >' . _('Current balance') . ':</td> + <td class="number">'.number_format($Amount['0'],2) . '</td></tr>'; - echo '<tr><td colspan="4" style="text-align:right" >' . _('Current balance') . ':</td> - <td colspan=2>'.number_format($Amount['0'],2) . '</td></tr>'; - echo '</table>'; } @@ -277,8 +302,8 @@ echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<p><table border=1>'; //Main table - echo '<td><table>'; // First column + + echo '<br /><table class="selection">'; //Main table if ( isset($_GET['edit'])) { @@ -320,7 +345,7 @@ ORDER BY pcexpenses.codeexpense ASC"; $result = DB_query($SQL,$db); - + echo '<option value="">' . _('Not Yet Selected') . '</option>'; while ($myrow = DB_fetch_array($result)) { if (isset($_POST['SelectedExpense']) and $myrow['codeexpense']==$_POST['SelectedExpense']) { echo '<option selected value="'; @@ -336,7 +361,7 @@ if (!isset($_POST['Amount'])) { $_POST['Amount']=0; } - + echo '<tr><td>' . _('Amount') . ':</td> <td><input type="text" class="number" name="amount" size="12" maxlength="11" value="' . $_POST['Amount'] . '"></td></tr>'; @@ -355,7 +380,7 @@ <td><input type="text" name="Receipt" size="50" maxlength="49" value="' . $_POST['Receipt'] . '"></td></tr>'; echo '<input type="hidden" name="SelectedTabs" value="' . $SelectedTabs . '">'; echo '<input type="hidden" name="Days" value="' .$Days. '">'; - echo '</table>'; // close table in first column + echo '</td></tr></table>'; // close main table echo '<p><div class="centre"><input type="submit" name="submit" value="' . _('Accept') . '"><input type=submit name="Cancel" value="' . _('Cancel') . '"></div>'; echo '</form>'; Modified: trunk/PcExpenses.php =================================================================== --- trunk/PcExpenses.php 2011-05-14 11:24:22 UTC (rev 4566) +++ trunk/PcExpenses.php 2011-05-15 04:34:49 UTC (rev 4567) @@ -15,6 +15,14 @@ $SelectedExpense = strtoupper($_GET['SelectedExpense']); } +if (isset($_POST['Cancel'])) { + unset($SelectedExpense); + unset($_POST['CodeExpense']); + unset($_POST['Description']); + unset($_POST['GLAccount']); +} + + if (isset($Errors)) { unset($Errors); } @@ -32,39 +40,55 @@ //first off validate inputs sensible $i=1; - if ($_POST['codeexpense']=='' OR $_POST['codeexpense']==' ' OR $_POST['codeexpense']==' ') { + if ($_POST['CodeExpense']=='' OR $_POST['CodeExpense']==' ' OR $_POST['CodeExpense']==' ') { $InputError = 1; prnMsg(_('The Expense type code cannot be an empty string or spaces'),'error'); - $Errors[$i] = 'PcExpenses'; + echo '<br />'; + $Errors[$i] = 'CodeExpense'; $i++; - } elseif (strlen($_POST['codeexpense']) >20) { + } elseif (strlen($_POST['CodeExpense']) >20) { $InputError = 1; prnMsg(_('The Expense code must be twenty characters or less long'),'error'); - $Errors[$i] = 'PcExpenses'; + echo '<br />'; + $Errors[$i] = 'CodeExpense'; $i++; - }elseif (ContainsIllegalCharacters($_POST['codeexpense'])){ + }elseif (ContainsIllegalCharacters($_POST['CodeExpense'])){ $InputError = 1; prnMsg(_('The Expense code cannot contain any of the following characters " \' - &'),'error'); - $Errors[$i] = 'PcExpenses'; + echo '<br />'; + $Errors[$i] = 'CodeExpense'; $i++; - } elseif (ContainsIllegalCharacters($_POST['description'])){ + } elseif (ContainsIllegalCharacters($_POST['Description'])){ $InputError = 1; prnMsg(_('The Expense description cannot contain any of the following characters " \' - &'),'error'); - $Errors[$i] = 'TypeTabCode'; + echo '<br />'; + $Errors[$i] = 'Description'; $i++; - } elseif (strlen($_POST['description']) >50) { + } elseif (strlen($_POST['Description']) >50) { $InputError = 1; prnMsg(_('The tab code must be Fifty characters or less long'),'error'); - $Errors[$i] = 'TypeTabCode'; + echo '<br />'; + echo '<br />'; + $Errors[$i] = 'Description'; $i++; + } elseif (strlen($_POST['Description'])==0) { + $InputError = 1; + echo prnMsg(_('The tab code description must be entered'),'error'); + echo '<br />'; + $Errors[$i] = 'Description'; + $i++; + } elseif ($_POST['GLAccount']=='') { + $InputError = 1; + echo prnMsg(_('A general ledger code must be selected for this expense'),'error'); + echo '<br />'; } - + if (isset($SelectedExpense) AND $InputError !=1) { $sql = "UPDATE pcexpenses - SET description = '" . $_POST['description'] . "', - glaccount = '" . $_POST['glaccount'] . "' - WHERE codeexpense = '$SelectedExpense'"; + SET description = '" . $_POST['Description'] . "', + glaccount = '" . $_POST['GLAccount'] . "' + WHERE codeexpense = '" . $SelectedExpense . "'"; $msg = _('The Expenses type') . ' ' . $SelectedExpense . ' ' . _('has been updated'); } elseif ( $InputError !=1 ) { @@ -73,14 +97,14 @@ $checkSql = "SELECT count(*) FROM pcexpenses - WHERE codeexpense = '" . $_POST['codeexpense'] . "'"; + WHERE codeexpense = '" . $_POST['CodeExpense'] . "'"; $checkresult = DB_query($checkSql,$db); $checkrow = DB_fetch_row($checkresult); if ( $checkrow[0] > 0 ) { $InputError = 1; - prnMsg( _('The Expense type ') . $_POST['codeexpense'] . _(' already exists.'),'error'); + prnMsg( _('The Expense type ') . $_POST['CodeExpense'] . _(' already exists.'),'error'); } else { // Add new record on submit @@ -88,11 +112,11 @@ $sql = "INSERT INTO pcexpenses (codeexpense, description,glaccount) - VALUES ('" . $_POST['codeexpense'] . "', - '" . $_POST['description'] . "', - '" . $_POST['glaccount'] . "')"; + VALUES ('" . $_POST['CodeExpense'] . "', + '" . $_POST['Description'] . "', + '" . $_POST['GLAccount'] . "')"; - $msg = _('Expense ') . ' ' . $_POST['codeexpense'] . ' ' . _('has been created'); + $msg = _('Expense ') . ' ' . $_POST['CodeExpense'] . ' ' . _('has been created'); $checkSql = "SELECT count(codeexpense) FROM pcexpenses"; $result = DB_query($checkSql, $db); @@ -105,11 +129,11 @@ //run the SQL from either of the above possibilites $result = DB_query($sql,$db); prnMsg($msg,'success'); - + echo '<br />'; unset($SelectedExpense); - unset($_POST['codeexpense']); - unset($_POST['description']); - unset($_POST['glaccount']); + unset($_POST['CodeExpense']); + unset($_POST['Description']); + unset($_POST['GLAccount']); } } elseif ( isset($_GET['delete']) ) { @@ -118,7 +142,7 @@ $sql= "SELECT COUNT(*) FROM pctabexpenses - WHERE codeexpense='$SelectedExpense'"; + WHERE codeexpense='" . $SelectedExpense . "'"; $ErrMsg = _('The number of type of tabs using this expense code could not be retrieved'); $result = DB_query($sql,$db,$ErrMsg); @@ -130,14 +154,13 @@ } else { $sql="DELETE FROM pcexpenses - WHERE codeexpense='$SelectedExpense'"; + WHERE codeexpense='" . $SelectedExpense . "'"; $ErrMsg = _('The expense type record could not be deleted because'); $result = DB_query($sql,$db,$ErrMsg); prnMsg(_('Expense type') . ' ' . $SelectedExpense . ' ' . _('has been deleted') ,'success'); + echo '<br />'; unset ($SelectedExpense); unset($_GET['delete']); - - } //end if tab type used in transactions } @@ -148,17 +171,17 @@ links to delete or edit each. These will call the same page again and allow update/input or deletion of the records*/ - $sql = 'SELECT * - FROM pcexpenses'; + $sql = "SELECT * + FROM pcexpenses"; $result = DB_query($sql,$db); - echo '<table class=selection>'; + echo '<table class="selection">'; echo '<tr> <th>' . _('Code Of Expense') . '</th> <th>' . _('Description') . '</th> <th>' . _('Account Code') . '</th> <th>' . _('Account Description') . '</th> - </tr>'; + </tr>'; $k=0; //row colour counter @@ -178,19 +201,19 @@ $ResultDes = DB_query($sqldesc,$db); $Description=DB_fetch_array($ResultDes); - printf("<td>%s</td> + printf('<td>%s</td> <td>%s</td> <td class=number>%s</td> <td>%s</td> - <td><a href='%sSelectedExpense=%s'>" . _('Edit') . "</td> - <td><a href='%sSelectedExpense=%s&delete=yes' onclick=\"return confirm('" . _('Are you sure you wish to delete this expense code and all the details it may have set up?') . "');\">" . _('Delete') . "</td> - </tr>", + <td><a href="%sSelectedExpense=%s">' . _('Edit') . '</td> + <td><a href="%sSelectedExpense=%s&delete=yes" onclick="return confirm(\'' . _('Are you sure you wish to delete this expense code and all the details it may have set up?') . '\');">' . _('Delete') . '</td> + </tr>', $myrow[0], $myrow[1], $myrow[2], $Description[0], $_SERVER['PHP_SELF'] . '?', $myrow[0], - $_SERVER['PHP_SELF'] . '?', $myrow[0]); + $_SERVER['PHP_SELF'] . '?', $myrow[0]); } //END WHILE LIST LOOP echo '</table>'; @@ -208,8 +231,7 @@ echo '<p><table class=selection>'; //Main table // The user wish to EDIT an existing type - if ( isset($SelectedExpense) AND $SelectedExpense!='' ) - { + if ( isset($SelectedExpense) AND $SelectedExpense!='' ){ $sql = "SELECT codeexpense, description, @@ -220,44 +242,49 @@ $result = DB_query($sql, $db); $myrow = DB_fetch_array($result); - $_POST['codeexpense'] = $myrow['codeexpense']; - $_POST['description'] = $myrow['description']; - $_POST['glaccount'] = $myrow['glaccount']; + $_POST['CodeExpense'] = $myrow['codeexpense']; + $_POST['Description'] = $myrow['description']; + $_POST['GLAccount'] = $myrow['glaccount']; echo '<input type=hidden name="SelectedExpense" value="' . $SelectedExpense . '">'; - echo '<input type=hidden name="codeexpense" VALUE="' . $_POST['codeexpense']. '">'; - echo '<table class="selection"> <tr><td>' . _('Code Of Expense') . ':</td><td>'; - + echo '<input type=hidden name="CodeExpense" VALUE="' . $_POST['CodeExpense']. '">'; // We dont allow the user to change an existing type code + echo '<table class="selection"> + <tr> + <td>' . _('Code Of Expense') . ':</td> + <td>' . $_POST['CodeExpense'] . '</td></tr>'; - echo $_POST['codeexpense'] . '</td></tr>'; - } else { // This is a new type so the user may volunteer a type code - echo '<table class=selection> - <tr><td>' . _('Code Of Expense') . ':</td> - <td><input type="Text"' . (in_array('SalesType',$Errors) ? 'class="inputerror"' : '' ) .' name="codeexpense"></td></tr>'; + echo '<table class="selection"> + <tr> + <td>' . _('Code Of Expense') . ':</td> + <td><input type="text"' . (in_array('CodeExpense',$Errors) ? 'class="inputerror"' : '' ) .' name="CodeExpense"></td> + </tr>'; } - if (!isset($_POST['description'])) { - $_POST['description']=''; + if (!isset($_POST['Description'])) { + $_POST['Description']=''; } - echo '<tr><td>' . _('Description') . ':</td><td><input type="Text" name="description" size=50 maxlength=49 value="' . $_POST['description'] . '"></td></tr>'; + echo '<tr> + <td>' . _('Description') . ':</td> + <td><input type="text" ' . (in_array('Description',$Errors) ? 'class="inputerror"' : '' ) . ' name="Description" size=50 maxlength=49 value="' . $_POST['Description'] . '"></td> + </tr>'; - echo '<tr><td>' . _('Account Code') . ':</td><td><select name="glaccount">'; + echo '<tr><td>' . _('Account Code') . ':</td><td><select name="GLAccount">'; DB_free_result($result); - $SQL = 'SELECT accountcode, + $SQL = "SELECT accountcode, accountname FROM chartmaster - ORDER BY accountcode'; + ORDER BY accountcode"; $result = DB_query($SQL,$db); - + echo '<option value="">' . _('Not Yet Selected') . '</option>'; while ($myrow = DB_fetch_array($result)) { - if (isset($_POST['glaccount']) and $myrow['accountcode']==$_POST['glaccount']) { + if (isset($_POST['GLAccount']) and $myrow['accountcode']==$_POST['GLAccount']) { echo '<option selected VALUE="'; } else { echo '<option VALUE="'; @@ -270,7 +297,7 @@ echo '</td></tr></table>'; // close main table - echo '<p><div class="centre"><input type=submit name=submit VALUE="' . _('Accept') . '"><input type=submit name=Cancel VALUE="' . _('Cancel') . '"></div>'; + echo '<p><div class="centre"><input type="submit" name=submit VALUE="' . _('Accept') . '"><input type=submit name=Cancel VALUE="' . _('Cancel') . '"></div>'; echo '</form>'; Modified: trunk/PcExpensesTypeTab.php =================================================================== --- trunk/PcExpensesTypeTab.php 2011-05-14 11:24:22 UTC (rev 4566) +++ trunk/PcExpensesTypeTab.php 2011-05-15 04:34:49 UTC (rev 4567) @@ -16,31 +16,51 @@ } else { $SelectedType=''; } -if (ContainsIllegalCharacters($SelectedType) OR strpos($SelectedType,' ')>0){ + +if (!isset($_GET['delete']) and (ContainsIllegalCharacters($SelectedType) OR strpos($SelectedType,' ')>0)){ $InputError = 1; prnMsg(_('The petty cash tab type contain any of the following characters " \' - & or a space'),'error'); } -if (isset($_POST['SelectedTabs'])){ - $SelectedTabs = strtoupper($_POST['SelectedTabs']); -} elseif (isset($_GET['SelectedTabs'])){ - $SelectedTabs = strtoupper($_GET['SelectedTabs']); + +if (isset($_POST['SelectedTab'])){ + $SelectedTab = strtoupper($_POST['SelectedTab']); +} elseif (isset($_GET['SelectedTab'])){ + $SelectedTab = strtoupper($_GET['SelectedTab']); } -if (isset($Errors)) { - unset($Errors); +if (isset($_POST['Cancel'])) { + unset($SelectedTab); + unset($SelectedType); } -$Errors = array(); -$InputError=0; +if (isset($_POST['Process'])) { + + if ($_POST['SelectedTab'] == '') { + echo prnMsg(_('You have not selected a tab to maintain the expenses on'),'error'); + echo '<br />'; + unset($SelectedTab); + unset($_POST['SelectedTab']); + } +} + if (isset($_POST['submit'])) { + $InputError=0; + + if ($_POST['SelectedExpense']=='') { + $InputError=1; + echo prnMsg(_('You have not selected an expense to add to this tab'),'error'); + echo '<br />'; + unset($SelectedTab); + } + if ( $InputError !=1 ) { // First check the type is not being duplicated $checkSql = "SELECT count(*) FROM pctabexpenses - WHERE typetabcode= '" . $_POST['SelectedTabs'] . "' + WHERE typetabcode= '" . $_POST['SelectedTab'] . "' AND codeexpense = '" . $_POST['SelectedExpense'] . "'"; $checkresult = DB_query($checkSql,$db); @@ -48,23 +68,19 @@ if ( $checkrow[0] >0) { $InputError = 1; - prnMsg( _('The Expense ') . $_POST['codeexpense'] . _(' already exist in this Type of Tab.'),'error'); + prnMsg( _('The Expense') . ' ' . $_POST['codeexpense'] . ' ' ._('already exists in this Type of Tab'),'error'); } else { - // Add new record on submit + $sql = "INSERT INTO pctabexpenses (typetabcode, + codeexpense) + VALUES ('" . $_POST['SelectedTab'] . "', + '" . $_POST['SelectedExpense'] . "')"; - $sql = "INSERT INTO pctabexpenses - (typetabcode, - codeexpense) - VALUES ('" . $_POST['SelectedTabs'] . "', - '" . $_POST['SelectedExpense'] . "')"; - - $msg = _('Expense code:') . ' ' . $_POST['SelectedExpense'].' '._('for Type of Tab:') .' '. $_POST['SelectedTabs'] . ' ' . _('has been created'); + $msg = _('Expense code:') . ' ' . $_POST['SelectedExpense'].' '._('for Type of Tab:') .' '. $_POST['SelectedTab'] . ' ' . _('has been created'); $checkSql = "SELECT count(typetabcode) - FROM pctypetabs"; + FROM pctypetabs"; $result = DB_query($checkSql, $db); $row = DB_fetch_row($result); - } } @@ -77,21 +93,17 @@ } } elseif ( isset($_GET['delete']) ) { - - - $sql="DELETE FROM pctabexpenses - WHERE typetabcode='".$SelectedTabs."' - AND codeexpense='".$SelectedType."'"; - $ErrMsg = _('The Tab Type record could not be deleted because'); - $result = DB_query($sql,$db,$ErrMsg); - prnMsg(_('Expense code').' '. $SelectedType .' '. _('for type of tab').' '. $SelectedTabs .' '. _('has been deleted') ,'success'); - unset ($SelectedType); - unset($_GET['delete']); - - + $sql="DELETE FROM pctabexpenses + WHERE typetabcode='".$SelectedTab."' + AND codeexpense='".$SelectedType."'"; + $ErrMsg = _('The Tab Type record could not be deleted because'); + $result = DB_query($sql,$db,$ErrMsg); + prnMsg(_('Expense code').' '. $SelectedType .' '. _('for type of tab').' '. $SelectedTab .' '. _('has been deleted') ,'success'); + unset ($SelectedType); + unset($_GET['delete']); } -if (!isset($SelectedTabs)){ +if (!isset($SelectedTab)){ /* It could still be the second time the page has been run and a record has been selected for modification - SelectedType will exist because it was sent with the new call. If its the first time the page has been displayed with no parameters then none of the above are true and the list of sales types will be displayed with @@ -101,7 +113,7 @@ echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<table class=selection>'; //Main table - echo '<tr><td>' . _('Select Type of Tab') . ':</td><td><select name="SelectedTabs">'; + echo '<tr><td>' . _('Select Type of Tab') . ':</td><td><select name="SelectedTab">'; DB_free_result($result); $SQL = "SELECT typetabcode, @@ -109,12 +121,12 @@ FROM pctypetabs"; $result = DB_query($SQL,$db); - + echo '<option value="">' . _('Not Yet Selected') . '</option>'; while ($myrow = DB_fetch_array($result)) { - if (isset($_POST['SelectedTabs']) and $myrow['typetabcode']==$_POST['SelectedTabs']) { + if (isset($SelectedTab) and $myrow['typetabcode']==$SelectedTab) { echo '<option selected value="'; } else { - echo '<option VALUE="'; + echo '<option value="'; } echo $myrow['typetabcode'] . '">' . $myrow['typetabcode'] . ' - ' . $myrow['typetabdescription'] . '</option>'; @@ -125,26 +137,30 @@ echo '</table>'; // close table in first column echo '</td></tr></table>'; // close main table - echo '<p><div class="centre"><input type=submit name=process VALUE="' . _('Accept') . '"><input type=submit name=Cancel VALUE="' . _('Cancel') . '"></div>'; + echo '<p><div class="centre"><input type=submit name="Process" value="' . _('Accept') . '"> + <input type=submit name="Cancel" value="' . _('Cancel') . '"></div>'; echo '</form>'; } //end of ifs and buts! -if (isset($_POST['process'])OR isset($SelectedTabs)) { +if (isset($_POST['process'])OR isset($SelectedTab)) { - echo '<p><div class="centre"><a href="' . $_SERVER['PHP_SELF'] . '?' . SID . '">' . _('Expense Codes for Type of Tab ') . ' ' .$SelectedTabs. '</a></div><p>'; + echo '<p><div class="centre"><a href="' . $_SERVER['PHP_SELF'] . '">' . _('Expense Codes for Type of Tab ') . ' ' .$SelectedTab. '</a></div><p>'; - $sql = "SELECT pctabexpenses.codeexpense, pcexpenses.description - FROM pctabexpenses,pcexpenses - WHERE pctabexpenses.codeexpense=pcexpenses.codeexpense - AND pctabexpenses.typetabcode='".$SelectedTabs."' + $sql = "SELECT pctabexpenses.codeexpense, + pcexpenses.description + FROM pctabexpenses INNER JOIN pcexpenses + ON pctabexpenses.codeexpense=pcexpenses.codeexpense + WHERE pctabexpenses.typetabcode='".$SelectedTab."' ORDER BY pctabexpenses.codeexpense ASC"; $result = DB_query($sql,$db); - echo '<table class="selection">'; + echo '<br /> + <table class="selection">'; + echo '<tr><th colspan="3"><font size="2" color="navy">' . _('Expense Codes for Type of Tab ') . ' ' .$SelectedTab. '</font></th></tr>'; echo '<tr> <th>' . _('Expense Code') . '</th> <th>' . _('Description') . '</th> @@ -152,7 +168,7 @@ $k=0; //row colour counter -while ($myrow = DB_fetch_row($result)) { +while ($myrow = DB_fetch_array($result)) { if ($k==1){ echo '<tr class="EvenTableRows">'; $k=0; @@ -161,29 +177,24 @@ $k=1; } - printf("<td>%s</td> - <td>%s</td> - <td><a href='%sSelectedType=%s&delete=yes&SelectedTabs=$_POST[SelectedTabs]' onclick=\"return confirm('" . _('Are you sure you wish to delete this code and the expense it may have set up?') . "');\">" . _('Delete') . "</td> - </tr>", - $myrow[0], - $myrow[1], - $_SERVER['PHP_SELF'], $myrow[0], - $_SERVER['PHP_SELF'], $myrow[0]); + printf('<td>%s</td> + <td>%s</td> + <td><a href="%sSelectedType=%s&delete=yes&SelectedTab=' . $_POST['SelectedTab'] . '" onclick="return confirm(\'' . _('Are you sure you wish to delete this code and the expense it may have set up?') . '\');">' . _('Delete') . '</td> + </tr>', + $myrow['codeexpense'], + $myrow['description'], + $_SERVER['PHP_SELF'], $myrow['codeexpense'], + $_SERVER['PHP_SELF'], $myrow['codeexpense']); } //END WHILE LIST LOOP echo '</table>'; - - - if (! isset($_GET['delete'])) { echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<br /><table class="selection">'; //Main table - - echo '<tr><td>' . _('Select Expense Code') . ':</td><td><select name="SelectedExpense">'; DB_free_result($result); @@ -192,9 +203,11 @@ FROM pcexpenses"; $result = DB_query($SQL,$db); - + if (!isset($_POST['SelectedExpense'])){ + echo '<option selected value="">' . _('Not Yet Selected') . '</option>'; + } while ($myrow = DB_fetch_array($result)) { - if (isset($_POST['SelectedExpense']) and $myrow['codeexpense']==$_POST['SelectedExpense']) { + if (isset($_POST['SelectedExpense']) AND $myrow['codeexpense']==$_POST['SelectedExpense']) { echo '<option selected value="'; } else { echo '<option value="'; @@ -206,11 +219,12 @@ echo '</select></td></tr>'; - echo '<input type="hidden" name="SelectedTabs" value="' . $SelectedTabs . '">'; + echo '<input type="hidden" name="SelectedTab" value="' . $SelectedTab . '">'; echo '</td></tr></table>'; // close main table - echo '<p><div class="centre"><input type=submit name=submit VALUE="' . _('Accept') . '"><input type=submit name=Cancel VALUE="' . _('Cancel') . '"></div>'; + echo '<p><div class="centre"><input type=submit name=submit value="' . _('Accept') . '"> + <input type=submit name="Cancel" value="' . _('Cancel') . '"></div>'; echo '</form>'; Modified: trunk/PcReportTab.php =================================================================== --- trunk/PcReportTab.php 2011-05-14 11:24:22 UTC (rev 4566) +++ trunk/PcReportTab.php 2011-05-15 04:34:49 UTC (rev 4567) @@ -48,7 +48,7 @@ $result = DB_query($SQL,$db); while ($myrow = DB_fetch_array($result)) { - if (isset($_POST['SelectTabs']) and $myrow['tabcode']==$_POST['SelectTabs']) { + if (isset($_POST['SelectedTabs']) and $myrow['tabcode']==$_POST['SelectedTabs']) { echo '<option selected value="'; } else { echo '<option value="'; @@ -117,11 +117,11 @@ $Tabs=DB_fetch_array($TabResult); $SqlBalance = "SELECT SUM(amount) FROM pcashdetails - WHERE tabcode='".$SelectedTabs."' - AND date<'".$SQL_FromDate."'"; + WHERE tabcode='".$SelectedTabs."' + AND date<'".$SQL_FromDate."'"; $TabBalance = DB_query($SqlBalance, - $db); + $db); $Balance=DB_fetch_array($TabBalance); @@ -177,17 +177,17 @@ while ($myrow=DB_fetch_array($TabDetail)) { - $sqldes="SELECT description - FROM pcexpenses - WHERE codeexpense='". $myrow[3] . "'"; + $sqldes="SELECT description + FROM pcexpenses + WHERE codeexpense='". $myrow[3] . "'"; + + $ResultDes = DB_query($sqldes,$db); + $Description=DB_fetch_array($ResultDes); + + if (!isset($Description[0])){ + $Description[0]='ASSIGNCASH'; + } - $ResultDes = DB_query($sqldes,$db); - $Description=DB_fetch_array($ResultDes); - - if (!isset($Description[0])){ - $Description[0]='ASSIGNCASH'; - } - // Print total for each account $LeftOvers = $pdf->addTextWrap($Left_Margin,$YPos,70,$FontSize,ConvertSQLDate($myrow['date'])); $LeftOvers = $pdf->addTextWrap($Left_Margin+70,$YPos,130,$FontSize,$Description[0]); Modified: trunk/PcTabs.php =================================================================== --- trunk/PcTabs.php 2011-05-14 11:24:22 UTC (rev 4566) +++ trunk/PcTabs.php 2011-05-15 04:34:49 UTC (rev 4567) @@ -14,13 +14,26 @@ $SelectedTab = strtoupper($_GET['SelectedTab']); } +if (isset($_POST['Cancel'])) { + unset($SelectedTab); + unset($_POST['TabCode'] ); + unset($_POST['SelectUser'] ); + unset($_POST['SelectTabs']); + unset($_POST['SelectCurrency']); + unset($_POST['TabLimit']); + unset($_POST['SelectAuthorizer']); + unset($_POST['GLAccountCash']); + unset($_POST['GLAccountPcashTab']); +} + + if (isset($Errors)) { unset($Errors); } $Errors = array(); -if (isset($_POST['submit'])) { +if (isset($_POST['Submit'])) { //initialise no input errors assumed initially before we test $InputError = 0; @@ -41,18 +54,42 @@ echo prnMsg(_('The Tab code must be twenty characters or less long'),'error'); $Errors[$i] = 'TabCode'; $i++; + } elseif (($_POST['SelectUser'])=='') { + $InputError = 1; + echo prnMsg(_('You must select a User for this tab'),'error'); + $Errors[$i] = 'UserName'; + $i++; + } elseif (($_POST['SelectTabs'])=='') { + $InputError = 1; + echo prnMsg(_('You must select a type of tab from the list'),'error'); + $Errors[$i] = 'TabType'; + $i++; + } elseif (($_POST['SelectAuthorizer'])=='') { + $InputError = 1; + echo prnMsg(_('You must select a User to authorise this tab'),'error'); + $Errors[$i] = 'AuthorizerName'; + $i++; + } elseif (($_POST['GLAccountCash'])=='') { + $InputError = 1; + echo prnMsg(_('You must select a General ledger code for the cash to be assigned from'),'error'); + $Errors[$i] = 'GLCash'; + $i++; + } elseif (($_POST['GLAccountPcashTab'])=='') { + $InputError = 1; + echo prnMsg(_('You must select a General ledger code for this petty cash tab'),'error'); + $Errors[$i] = 'GLTab'; + $i++; } if (isset($SelectedTab) AND $InputError !=1) { - $sql = "UPDATE pctabs - SET usercode = '" . $_POST['SelectUser'] . "', - typetabcode = '" . $_POST['SelectTabs'] . "', - currency = '" . $_POST['SelectCurrency'] . "', - tablimit = '" . $_POST['TabLimit'] . "', - authorizer = '" . $_POST['SelectAuthorizer'] . "', - glaccountassignment = '" . $_POST['glaccountcash'] . "', - glaccountpcash = '" . $_POST['GLAccountPcashTab'] . "' + $sql = "UPDATE pctabs SET usercode = '" . $_POST['SelectUser'] . "', + typetabcode = '" . $_POST['SelectTabs'] . "', + currency = '" . $_POST['SelectCurrency'] . "', + tablimit = '" . $_POST['TabLimit'] . "', + authorizer = '" . $_POST['SelectAuthorizer'] . "', + glaccountassignment = '" . $_POST['GLAccountCash'] . "', + glaccountpcash = '" . $_POST['GLAccountPcashTab'] . "' WHERE tabcode = '".$SelectedTab."'"; $msg = _('The Tabs Of Code') . ' ' . $SelectedTab . ' ' . _('has been updated'); @@ -61,8 +98,8 @@ // First check the type is not being duplicated $checkSql = "SELECT count(*) - FROM pctabs - WHERE tabcode = '" . $_POST['TabCode'] . "'"; + FROM pctabs + WHERE tabcode = '" . $_POST['TabCode'] . "'"; $CheckResult = DB_query($checkSql,$db); $CheckRow = DB_fetch_row($CheckResult); @@ -74,24 +111,23 @@ // Add new record on submit - $sql = "INSERT INTO pctabs - (tabcode, - usercode, - typetabcode, - currency, - tablimit, - authorizer, - glaccountassignment, - glaccountpcash) - VALUES ('" . $_POST['TabCode'] . "', - '" . $_POST['SelectUser'] . "', - '" . $_POST['SelectTabs'] . "', - '" . $_POST['SelectCurrency'] . "', - '" . $_POST['TabLimit'] . "', - '" . $_POST['SelectAuthorizer'] . "', - '" . $_POST['glaccountcash'] . "', - '" . $_POST['GLAccountPcashTab'] . "')"; - + $sql = "INSERT INTO pctabs (tabcode, + usercode, + typetabcode, + currency, + tablimit, + authorizer, + glaccountassignment, + glaccountpcash) + VALUES ('" . $_POST['TabCode'] . "', + '" . $_POST['SelectUser'] . "', + '" . $_POST['SelectTabs'] . "', + '" . $_POST['SelectCurrency'] . "', + '" . $_POST['TabLimit'] . "', + '" . $_POST['SelectAuthorizer'] . "', + '" . $_POST['GLAccountCash'] . "', + '" . $_POST['GLAccountPcashTab'] . "')"; + $msg = _('Tab with Code ') . ' ' . $_POST['TabCode'] . ' ' . _('has been created'); } @@ -102,15 +138,14 @@ $result = DB_query($sql,$db); prnMsg($msg,'success'); unset($SelectedTab); - unset($_POST['SelectUser'] ); + unset($_POST['SelectUser']); + unset($_POST['TabCode']); unset($_POST['SelectTabs']); unset($_POST['SelectCurrency']); unset($_POST['TabLimit']); unset($_POST['SelectAuthorizer']); - unset($_POST['glaccountcash']); + unset($_POST['GLAccountCash']); unset($_POST['GLAccountPcashTab']); - - } } elseif ( isset($_GET['delete']) ) { @@ -130,73 +165,76 @@ links to delete or edit each. These will call the same page again and allow update/input or deletion of the records*/ - $sql = 'SELECT * - FROM pctabs - ORDER BY tabcode'; + $sql = "SELECT tabcode, + usercode, + typetabdescription, + currabrev, + tablimit, + authorizer, + glaccountassignment, + glaccountpcash, + currencies.decimalplaces, + chartmaster1.accountname AS glactassigntname, + chartmaster2.accountname AS glactpcashname + FROM pctabs INNER JOIN currencies + ON pctabs.currency=currencies.currabrev + INNER JOIN pctypetabs + ON pctabs.typetabcode=pctypetabs.typetabcode + INNER JOIN chartmaster AS chartmaster1 ON + pctabs.glaccountassignment = chartmaster1.accountcode + INNER JOIN chartmaster AS chartmaster2 ON + pctabs.glaccountpcash = chartmaster2.accountcode + ORDER BY tabcode"; $result = DB_query($sql,$db); - - echo '<br><table class=selection>'; - echo '<tr> - <th>' . _('Tab Code') . '</th> - <th>' . _('User Name') . '</th> - <th>' . _('Type Of Tab') . '</th> - <th>' . _('Currency') . '</th> - <th>' . _('Limit') . '</th> - <th>' . _('Authorizer') . '</th> - <th>' . _('GL Account For Cash Assignment') . '</th> - <th>' . _('GL Account Petty Cash Tab') . '</th> - </tr>'; - -$k=0; //row colour counter - -while ($myrow = DB_fetch_row($result)) { - if ($k==1){ - echo '<tr class="EvenTableRows">'; - $k=0; - } else { - echo '<tr class="OddTableRows">'; - $k=1; - } - - $sqldes="SELECT accountname - FROM chartmaster - WHERE accountcode='". $myrow[6] . "'"; - - $ResultDes = DB_query($sqldes,$db); - $Description=DB_fetch_array($ResultDes); - - $sqlname="SELECT accountname - FROM chartmaster - WHERE accountcode='". $myrow[7] . "'"; - - $ResultName = DB_query($sqlname,$db); - $DescriptionName=DB_fetch_array($ResultName); - - - printf('<td>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td class=number>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td><a href="%sSelectedTab=%s">' . _('Edit') . '</td> - <td><a href="%sSelectedTab=%s&delete=yes" onclick=\' return confirm("' . _('Are you sure you wish to delete this tab code?') . '");\'>' . _('Delete') . '</td> - </tr>', - $myrow[0], - $myrow[1], - $myrow[2], - $myrow[3], - number_format($myrow[4],2), - $myrow[5], - $myrow[6].' - '.$Description[0], - $myrow[7].' - '.$DescriptionName[0], - $_SERVER['PHP_SELF'] . '?', $myrow[0], - $_SERVER['PHP_SELF'] . '?', $myrow[0]); - } - //END WHILE LIST LOOP - echo '</table>'; + if (DB_num_rows($result)>0){ + echo '<br><table class=selection>'; + echo '<tr> + <th>' . _('Tab Code') . '</th> + <th>' . _('User Name') . '</th> + <th>' . _('Type Of Tab') . '</th> + <th>' . _('Currency') . '</th> + <th>' . _('Limit') . '</th> + <th>' . _('Authorizer') . '</th> + <th>' . _('GL Account For Cash Assignment') . '</th> + <th>' . _('GL Account Petty Cash Tab') . '</th> + </tr>'; + + $k=0; //row colour counter + + while ($myrow = DB_fetch_array($result)) { + if ($k==1){ + echo '<tr class="EvenTableRows">'; + $k=0; + } else { + echo '<tr class="OddTableRows">'; + $k=1; + } + + printf('<td>%s</td> + <td>%s</td> + <td>%s</td> + <td>%s</td> + <td class=number>%s</td> + <td>%s</td> + <td>%s</td> + <td>%s</td> + <td><a href="%sSelectedTab=%s">' . _('Edit') . '</td> + <td><a href="%sSelectedTab=%s&delete=yes" onclick=\' return confirm("' . _('Are you sure you wish to delete this tab code?') . '");\'>' . _('Delete') . '</td> + </tr>', + $myrow['tabcode'], + $myrow['usercode'], + $myrow['typetabdescription'], + $myrow['currabrev'], + number_format($myrow['tablimit'],$myrow['decimalplaces']), + $myrow['authorizer'], + $myrow['glaccountassignment'].' - '. $myrow['glactassigntname'], + $myrow['glaccountpcash'].' - '.$myrow['glactpcashname'], + $_SERVER['PHP_SELF'] . '?', $myrow['tabcode'], + $_SERVER['PHP_SELF'] . '?', $myrow['tabcode']); + } + //END WHILE LIST LOOP + echo '</table>'; + } //if there are tabs to show } //end of ifs and buts! @@ -208,7 +246,7 @@ echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<p><table class=selection>'; //Main table + echo '<p><table class="selection">'; //Main table if ( isset($SelectedTab) AND $SelectedTab!='' ) { @@ -225,20 +263,18 @@ $_POST['SelectCurrency'] = $myrow['currency']; $_POST['TabLimit'] = $myrow['tablimit']; $_POST['SelectAuthorizer'] = $myrow['authorizer']; - $_POST['glaccountcash'] = $myrow['glaccountassignment']; + $_POST['GLAccountCash'] = $myrow['glaccountassignment']; $_POST['GLAccountPcashTab'] = $myrow['glaccountpcash']; echo '<input type=hidden name="SelectedTab" value="' . $SelectedTab . '">'; echo '<input type=hidden name="TabCode" value="' . $_POST['TabCode']. '">'; - echo '<table class="selection"> <tr><td>' . _('Tab Code') . ':</td><td>'; - - // We dont allow the user to change an existing type code - - echo $_POST['TabCode'] . '</td></tr>'; - + echo '<table class="selection"> + <tr> + <td>' . _('Tab Code') . ':</td> + <td>' . $_POST['TabCode'] . '</td> + </tr>'; } else { - // This is a new type so the user may volunteer a type code echo '<table class="selection"> <tr><td>' . _('Tab Code') . ':</td> @@ -254,7 +290,8 @@ <td><select name="SelectUser">'; DB_free_result($result); - $SQL = "SELECT userid + $SQL = "SELECT userid, + realname FROM www_users ORDER BY userid"; $result = DB_query($SQL,$db); @@ -265,7 +302,7 @@ } else { echo '<option value="'; } - echo $myrow['userid'] . '">' . $myrow['userid'] . '</option>'; + echo $myrow['userid'] . '">' . $myrow['userid'] . ' - ' . $myrow['realname'] . '</option>'; } //end while loop get user @@ -275,7 +312,10 @@ <td><select name="SelectTabs">'; DB_free_result($result); - $SQL = "SELECT typetabcode FROM pctypetabs ORDER BY typetabcode"; + $SQL = "SELECT typetabcode, + typetabdescription + FROM pctypetabs + ORDER BY typetabcode"; $result = DB_query($SQL,$db); @@ -285,7 +325,7 @@ } else { echo '<option value="'; } - echo $myrow['typetabcode'] . '">' . $myrow['typetabcode'] . '</option>'; + echo $myrow['typetabcode'] . '">' . $myrow['typetabcode'] . ' - ' . $myrow['typetabdescription'] . '</option>'; } //end while loop get type of tab @@ -318,11 +358,12 @@ echo '<tr><td>' . _('Limit Of Tab') . ':</td> <td><input type="Text" class="number" name="TabLimit" size="12" maxlength="11" value="' . $_POST['TabLimit'] . '"></td></tr>'; - echo '<tr><td>' . _('Authorizer') . ':</td> + echo '<tr><td>' . _('Authoriser') . ':</td> <td><select name="SelectAuthorizer">'; DB_free_result($result); - $SQL = "SELECT userid + $SQL = "SELECT userid, + realname FROM www_users ORDER BY userid"; @@ -334,14 +375,14 @@ } else { echo '<option value="'; } - echo $myrow['userid'] . '">' . $myrow['userid'] . '</option>'; + echo $myrow['userid'] . '">' . $myrow['userid'] . ' - ' . $myrow['realname'] . '</option>'; } //end while loop get authorizer echo '</select></td></tr>'; echo '<tr><td>' . _('GL Account Cash Assignment') . ':</td> - <td><select name="glaccountcash">'; + <... [truncated message content] |
From: <dai...@us...> - 2011-05-15 07:53:49
|
Revision: 4569 http://web-erp.svn.sourceforge.net/web-erp/?rev=4569&view=rev Author: daintree Date: 2011-05-15 07:53:42 +0000 (Sun, 15 May 2011) Log Message: ----------- Change Stock Code fix Modified Paths: -------------- trunk/MRP.php trunk/Z_ChangeStockCode.php trunk/build/make_release.sh trunk/doc/Change.log Modified: trunk/MRP.php =================================================================== --- trunk/MRP.php 2011-05-15 07:12:43 UTC (rev 4568) +++ trunk/MRP.php 2011-05-15 07:53:42 UTC (rev 4569) @@ -314,16 +314,16 @@ prnMsg(_('Loading requirements based on reorder level'),'info'); flush(); - $result = DB_query('ALTER TABLE mrprequirements ADD INDEX part(part)',$db); + $result = DB_query("ALTER TABLE mrprequirements ADD INDEX part(part)",$db); // In the following section, create mrpsupplies from open purchase orders, // open work orders, and current quantity onhand from locstock prnMsg(_('Creating supplies table'),'info'); flush(); - $result = DB_query('DROP TABLE IF EXISTS mrpsupplies',$db); + $result = DB_query("DROP TABLE IF EXISTS mrpsupplies",$db); // updateflag is set to 1 in UpdateSupplies if change date when matching requirements to // supplies. Actually only change update flag in the array created from mrpsupplies - $sql = 'CREATE TABLE mrpsupplies ( id int(11) NOT NULL auto_increment, + $sql = "CREATE TABLE mrpsupplies ( id int(11) NOT NULL auto_increment, part char(20), duedate date, supplyquantity double, @@ -331,7 +331,7 @@ orderno int(11), mrpdate date, updateflag smallint(6), - PRIMARY KEY (id)) DEFAULT CHARSET=utf8'; + PRIMARY KEY (id)) DEFAULT CHARSET=utf8"; $result = DB_query($sql,$db,_('Create of mrpsupplies failed because')); prnMsg(_('Loading supplies from purchase orders'),'info'); @@ -424,7 +424,7 @@ WHERE workorders.closed=0"; $result = DB_query($sql,$db); - $sql = 'ALTER TABLE mrpsupplies ADD INDEX part(part)'; + $sql = "ALTER TABLE mrpsupplies ADD INDEX part(part)"; $result = DB_query($sql,$db); // Create mrpplannedorders table to create a record for any unmet requirments @@ -432,8 +432,8 @@ // open work orders, and current quantity onhand from locstock prnMsg(_('Creating planned orders table'),'info'); flush(); - $result = DB_query('DROP TABLE IF EXISTS mrpplannedorders',$db); - $sql = 'CREATE TABLE mrpplannedorders (id int(11) NOT NULL auto_increment, + $result = DB_query("DROP TABLE IF EXISTS mrpplannedorders",$db); + $sql = "CREATE TABLE mrpplannedorders (id int(11) NOT NULL auto_increment, part char(20), duedate date, supplyquantity double, @@ -441,11 +441,11 @@ orderno int(11), mrpdate date, updateflag smallint(6), - PRIMARY KEY (id)) DEFAULT CHARSET=utf8'; + PRIMARY KEY (id)) DEFAULT CHARSET=utf8"; $result = DB_query($sql,$db,_('Create of mrpplannedorders failed because')); // Find the highest and lowest level number - $sql = 'SELECT MAX(level),MIN(level) from levels'; + $sql = "SELECT MAX(level),MIN(level) from levels"; $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); @@ -471,16 +471,16 @@ echo '</br>' . _('End time') . ': ' . date('h:i:s') . '</br>'; // Create mrpparameters table - $sql = 'DROP TABLE IF EXISTS mrpparameters'; + $sql = "DROP TABLE IF EXISTS mrpparameters"; $result = DB_query($sql,$db); - $sql = 'CREATE TABLE mrpparameters ( + $sql = "CREATE TABLE mrpparameters ( runtime datetime, location varchar(50), pansizeflag varchar(5), shrinkageflag varchar(5), eoqflag varchar(5), usemrpdemands varchar(5), - leeway smallint) DEFAULT CHARSET=utf8'; + leeway smallint) DEFAULT CHARSET=utf8"; $result = DB_query($sql,$db); // Create entry for location field from $_POST['location'], which is an array // since multiple locations can be selected @@ -515,7 +515,7 @@ _('Inventory') . '" alt="" />' . ' ' . $title . '</p>'; // Display parameters from last run - $sql = 'SELECT * FROM mrpparameters'; + $sql = "SELECT * FROM mrpparameters"; $result = DB_query($sql,$db,'','',false,false); if (DB_error_no($db)==0){ @@ -551,7 +551,7 @@ echo '<td>' . _('Use Shrinkage') . ':  </td><td>' . $useshrinkage . '</td></tr>'; echo '</table></td>'; } - echo "<p><form method='post' action='" . $_SERVER['PHP_SELF'] . "'>"; + echo '<p><form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<table class=selection>'; // Generate selections for Location @@ -560,9 +560,9 @@ <td>' . _('Location') . '</td> <td><select name="location[]" multiple> <option value="All" selected>' . _('All') . '</option>'; - $sql = 'SELECT loccode, + $sql = "SELECT loccode, locationname - FROM locations'; + FROM locations"; $result = DB_query($sql,$db); while ($myrow = DB_fetch_array($result)) { echo '<option value="'; Modified: trunk/Z_ChangeStockCode.php =================================================================== --- trunk/Z_ChangeStockCode.php 2011-05-15 07:12:43 UTC (rev 4568) +++ trunk/Z_ChangeStockCode.php 2011-05-15 07:53:42 UTC (rev 4569) @@ -1,53 +1,72 @@ <?php /* $Id$*/ + /*Script to Delete all sales transactions*/ -//$PageSecurity=15; include ('includes/session.inc'); $title = _('UTILITY PAGE Change A Stock Code'); include('includes/header.inc'); include('includes/SQL_CommonFunctions.inc'); if (isset($_POST['ProcessStockChange'])){ - + + $InputError =0; + $_POST['NewStockID'] = strtoupper($_POST['NewStockID']); /*First check the stock code exists */ $result=DB_query("SELECT stockid FROM stockmaster WHERE stockid='" . $_POST['OldStockID'] . "'",$db); if (DB_num_rows($result)==0){ prnMsg(_('The stock code') . ': ' . $_POST['OldStockID'] . ' ' . _('does not currently exist as a stock code in the system'),'error'); - include('includes/footer.inc'); - exit; + $InputError =1; } if (ContainsIllegalCharacters($_POST['NewStockID'])){ prnMsg(_('The new stock code to change the old code to contains illegal characters - no changes will be made'),'error'); - include('includes/footer.inc'); - exit; + $InputError =1; } if ($_POST['NewStockID']==''){ prnMsg(_('The new stock code to change the old code to must be entered as well'),'error'); - include('includes/footer.inc'); - exit; + $InputError =1; } /*Now check that the new code doesn't already exist */ $result=DB_query("SELECT stockid FROM stockmaster WHERE stockid='" . $_POST['NewStockID'] . "'",$db); if (DB_num_rows($result)!=0){ - echo '<br><br>'; + echo '<br /><br />'; prnMsg(_('The replacement stock code') . ': ' . $_POST['NewStockID'] . ' ' . _('already exists as a stock code in the system') . ' - ' . _('a unique stock code must be entered for the new code'),'error'); - include('includes/footer.inc'); - exit; + $InputError =1; } - - $result = DB_Txn_Begin($db); - - echo '<br>' . _('Adding the new stock master record'); - $sql = "INSERT INTO stockmaster (stockid, + if ($InputError ==0){ // no input errors + $result = DB_Txn_Begin($db); + + echo '<br />' . _('Adding the new stock master record'); + $sql = "INSERT INTO stockmaster (stockid, + categoryid, + description, + longdescription, + units, + mbflag, + lastcurcostdate, + actualcost, + lastcost, + materialcost, + labourcost, + overheadcost, + lowestlevel, + discontinued, + controlled, + eoq, + volume, + kgs, + barcode, + discountcategory, + taxcatid) + SELECT '" . $_POST['NewStockID'] . "', categoryid, description, longdescription, @@ -67,256 +86,238 @@ kgs, barcode, discountcategory, - taxcatid) - SELECT '" . $_POST['NewStockID'] . "', - categoryid, - description, - longdescription, - units, - mbflag, - lastcurcostdate, - actualcost, - lastcost, - materialcost, - labourcost, - overheadcost, - lowestlevel, - discontinued, - controlled, - eoq, - volume, - kgs, - barcode, - discountcategory, - taxcatid - FROM stockmaster - WHERE stockid='" . $_POST['OldStockID'] . "'"; - - $DbgMsg = _('The SQL statement that failed was'); - $ErrMsg =_('The SQL to insert the new stock master record failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - echo '<br>' . _('Changing stock location records'); - $sql = "UPDATE locstock SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update stock location records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - echo '<br>' . _('Changing stock movement records'); - $sql = "UPDATE stockmoves SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update stock movement transaction records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - echo '<BR>' . _('Changing location transfer information'); - - $sql = "UPDATE loctransfers SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update the loctransfers records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - echo '<BR>' . _('Changing MRP demands information'); - - $sql = "UPDATE mrpdemands SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update the mrpdemands records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - $sql="select count(table_name) from information_schema.tables where table_schema='".$_SESSION['DatabaseName']."' and table_name='mrpplannedorders'"; - $result = DB_query($sql,$db); - $row=DB_fetch_row($result); - if ($row[0]>0) { - echo '<BR>' . _('Changing MRP planned orders information'); - - $sql = "UPDATE mrpplannedorders SET part='" . $_POST['NewStockID'] . "' WHERE part='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update the mrpplannedorders records failed'); + taxcatid + FROM stockmaster + WHERE stockid='" . $_POST['OldStockID'] . "'"; + + $DbgMsg = _('The SQL statement that failed was'); + $ErrMsg =_('The SQL to insert the new stock master record failed'); $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); echo ' ... ' . _('completed'); - } - - echo '<BR>' . _('Changing MRP requirements information'); - - $sql = "UPDATE mrprequirements SET part='" . $_POST['NewStockID'] . "' WHERE part='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update the mrprequirements records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - echo '<BR>' . _('Changing MRP supplies information'); - - $sql = "UPDATE mrpsupplies SET part='" . $_POST['NewStockID'] . "' WHERE part='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update the mrpsupplies records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - - - echo '<br>' . _('Changing sales analysis records'); - $sql = "UPDATE salesanalysis SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update Sales Analysis records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - - echo '<br>' . _('Changing order delivery differences records'); - $sql = "UPDATE orderdeliverydifferenceslog SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update order delivery differences records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - - echo '<br>' . _('Changing pricing records'); - $sql = "UPDATE prices SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update the pricing records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - - echo '<br>' . _('Changing sales orders detail records'); - $sql = "UPDATE salesorderdetails SET stkcode='" . $_POST['NewStockID'] . "' WHERE stkcode='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update the sales order header records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - - echo '<br>' . _('Changing purchase order details records'); - $sql = "UPDATE purchorderdetails SET itemcode='" . $_POST['NewStockID'] . "' WHERE itemcode='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update the purchase order detail records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - - echo '<br>' . _('Changing purchasing data records'); - $sql = "UPDATE purchdata SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update the purchasing data records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - echo '<br>' . _('Changing the stock code in shipment charges records'); - $sql = "UPDATE shipmentcharges SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update Shipment Charges records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - echo '<br>' . _('Changing the stock check freeze file records'); - $sql = "UPDATE stockcheckfreeze SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update stock check freeze records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - echo '<br>' . _('Changing the stock counts table records'); - $sql = "UPDATE stockcounts SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update stock counts records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - - echo '<br>' . _('Changing the GRNs table records'); - $sql = "UPDATE grns SET itemcode='" . $_POST['NewStockID'] . "' WHERE itemcode='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update GRN records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - - echo '<br>' . _('Changing the contract BOM table records'); - $sql = "UPDATE contractbom SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to contract BOM records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - - echo '<br>' . _('Changing the BOM table records') . ' - ' . _('components'); - $sql = "UPDATE bom SET component='" . $_POST['NewStockID'] . "' WHERE component='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update the BOM records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - - echo '<br>' . _('Changing the BOM table records') . ' - ' . _('parents'); - $sql = "UPDATE bom SET parent='" . $_POST['NewStockID'] . "' WHERE parent='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update the BOM parent records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - echo '<br>' . _('Changing any image files'); - if (file_exists($_SESSION['part_pics_dir'] . '/' .$_POST['OldStockID'].'.jpg')) { - if (rename($_SESSION['part_pics_dir'] . '/' .$_POST['OldStockID'].'.jpg', - $_SESSION['part_pics_dir'] . '/' .$_POST['NewStockID'].'.jpg')) { - echo ' ... ' . _('completed'); - } else { - echo ' ... ' . _('failed'); - } - } else { + + echo '<br />' . _('Changing stock location records'); + $sql = "UPDATE locstock SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update stock location records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); echo ' ... ' . _('completed'); - } - - echo '<br>' . _('Changing the item properties table records') . ' - ' . _('parents'); - $sql = "UPDATE stockitemproperties SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update the item properties records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - $sql = 'SET FOREIGN_KEY_CHECKS=0'; - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - - echo '<BR>' . _('Changing work order requirements information'); - - $sql = "UPDATE worequirements SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update the stockid worequirements records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - $sql = "UPDATE worequirements SET parentstockid='" . $_POST['NewStockID'] . "' WHERE parentstockid='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update the parent stockid worequirements records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - echo '<BR>' . _('Changing work order information'); - - $sql = "UPDATE woitems SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update the woitem records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - - echo '<br>' . _('Changing any serialised item information'); - - - $sql = "UPDATE stockserialitems SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update the stockserialitem records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - $sql = "UPDATE stockserialmoves SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update the stockserialitem records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - $sql = 'SET FOREIGN_KEY_CHECKS=1'; - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - - $result = DB_Txn_Commit($db); - - echo '<br>' . _('Deleting the old stock master record'); - $sql = "DELETE FROM stockmaster WHERE stockid='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to delete the old stock master record failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - - echo '<p>' . _('Stock Code') . ': ' . $_POST['OldStockID'] . ' ' . _('was successfully changed to') . ' : ' . $_POST['NewStockID']; - + + echo '<br />' . _('Changing stock movement records'); + $sql = "UPDATE stockmoves SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update stock movement transaction records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + + echo '<br />' . _('Changing location transfer information'); + + $sql = "UPDATE loctransfers SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update the loctransfers records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + + + + echo '<br />' . _('Changing MRP demands information'); + $sql = "UPDATE mrpdemands SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update the mrpdemands records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + + //check if MRP tables exist before assuming + + $result = DB_query("SELECT COUNT(*) FROM mrpplannedorders",$db); + if ($DB_error_no==0) { + echo '<br />' . _('Changing MRP planned orders information'); + $sql = "UPDATE mrpplannedorders SET part='" . $_POST['NewStockID'] . "' WHERE part='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update the mrpplannedorders records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + } + + $result = DB_query("SELECT * FROM mrprequirements" , $db); + if (DB_error_no($db)==0){ + echo '<br />' . _('Changing MRP requirements information'); + $sql = "UPDATE mrprequirements SET part='" . $_POST['NewStockID'] . "' WHERE part='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update the mrprequirements records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + } + $result = DB_query("SELECT * FROM mrpsupplies" , $db); + if (DB_error_no($db)==0){ + echo '<br />' . _('Changing MRP supplies information'); + $sql = "UPDATE mrpsupplies SET part='" . $_POST['NewStockID'] . "' WHERE part='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update the mrpsupplies records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + } + + echo '<br />' . _('Changing sales analysis records'); + $sql = "UPDATE salesanalysis SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update Sales Analysis records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + + + echo '<br />' . _('Changing order delivery differences records'); + $sql = "UPDATE orderdeliverydifferenceslog SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update order delivery differences records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + + + echo '<br />' . _('Changing pricing records'); + $sql = "UPDATE prices SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update the pricing records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + + + echo '<br />' . _('Changing sales orders detail records'); + $sql = "UPDATE salesorderdetails SET stkcode='" . $_POST['NewStockID'] . "' WHERE stkcode='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update the sales order header records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + + + echo '<br />' . _('Changing purchase order details records'); + $sql = "UPDATE purchorderdetails SET itemcode='" . $_POST['NewStockID'] . "' WHERE itemcode='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update the purchase order detail records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + + + echo '<br />' . _('Changing purchasing data records'); + $sql = "UPDATE purchdata SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update the purchasing data records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + + echo '<br />' . _('Changing the stock code in shipment charges records'); + $sql = "UPDATE shipmentcharges SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update Shipment Charges records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + + echo '<br />' . _('Changing the stock check freeze file records'); + $sql = "UPDATE stockcheckfreeze SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update stock check freeze records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + + echo '<br />' . _('Changing the stock counts table records'); + $sql = "UPDATE stockcounts SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update stock counts records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + + + echo '<br />' . _('Changing the GRNs table records'); + $sql = "UPDATE grns SET itemcode='" . $_POST['NewStockID'] . "' WHERE itemcode='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update GRN records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + + + echo '<br />' . _('Changing the contract BOM table records'); + $sql = "UPDATE contractbom SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to contract BOM records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + + + echo '<br />' . _('Changing the BOM table records') . ' - ' . _('components'); + $sql = "UPDATE bom SET component='" . $_POST['NewStockID'] . "' WHERE component='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update the BOM records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + + + echo '<br />' . _('Changing the BOM table records') . ' - ' . _('parents'); + $sql = "UPDATE bom SET parent='" . $_POST['NewStockID'] . "' WHERE parent='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update the BOM parent records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + + echo '<br />' . _('Changing any image files'); + if (file_exists($_SESSION['part_pics_dir'] . '/' .$_POST['OldStockID'].'.jpg')) { + if (rename($_SESSION['part_pics_dir'] . '/' .$_POST['OldStockID'].'.jpg', + $_SESSION['part_pics_dir'] . '/' .$_POST['NewStockID'].'.jpg')) { + echo ' ... ' . _('completed'); + } else { + echo ' ... ' . _('failed'); + } + } else { + echo ' ... ' . _('completed'); + } + + echo '<br />' . _('Changing the item properties table records') . ' - ' . _('parents'); + $sql = "UPDATE stockitemproperties SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update the item properties records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + + $sql = 'SET FOREIGN_KEY_CHECKS=0'; + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + + echo '<br />' . _('Changing work order requirements information'); + + $sql = "UPDATE worequirements SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update the stockid worequirements records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + + $sql = "UPDATE worequirements SET parentstockid='" . $_POST['NewStockID'] . "' WHERE parentstockid='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update the parent stockid worequirements records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + + echo '<br />' . _('Changing work order information'); + + $sql = "UPDATE woitems SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update the woitem records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + + + echo '<br />' . _('Changing any serialised item information'); + + + $sql = "UPDATE stockserialitems SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update the stockserialitem records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + $sql = "UPDATE stockserialmoves SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update the stockserialitem records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + + $sql = 'SET FOREIGN_KEY_CHECKS=1'; + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + + $result = DB_Txn_Commit($db); + + echo '<br />' . _('Deleting the old stock master record'); + $sql = "DELETE FROM stockmaster WHERE stockid='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to delete the old stock master record failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + + + echo '<p>' . _('Stock Code') . ': ' . $_POST['OldStockID'] . ' ' . _('was successfully changed to') . ' : ' . $_POST['NewStockID']; + } //only do the stuff above if $InputError==0 + } -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 '<p><table> - <tr><td>' . _('Existing Inventory Code') . ":</td> - <td><input type=Text name='OldStockID' size=20 maxlength=20></td></tr>"; + <tr><td>' . _('Existing Inventory Code') . ':</td> + <td><input type=Text name="OldStockID" size=20 maxlength=20></td></tr>'; -echo '<tr><td>' . _('New Inventory Code') . ":</td><td><input type=Text name='NewStockID' size=20 maxlength=20></td></tr>"; +echo '<tr><td>' . _('New Inventory Code') . ':</td> + <td><input type="text" name="NewStockID" size=20 maxlength=20></td></tr>'; echo '</table>'; -echo "<div class=centre><input type=submit name='ProcessStockChange' VALUE='" . _('Process') . "'></div>"; +echo '<div class="centre"><input type="submit" name="ProcessStockChange" value="' . _('Process') . '"></div>'; echo '</form>'; Modified: trunk/build/make_release.sh =================================================================== --- trunk/build/make_release.sh 2011-05-15 07:12:43 UTC (rev 4568) +++ trunk/build/make_release.sh 2011-05-15 07:53:42 UTC (rev 4569) @@ -69,7 +69,7 @@ echo "SET FOREIGN_KEY_CHECKS = 0;" > $BASE_DIR/sql/mysql/weberp-new.sql -mysqldump -u$MYSQL_USER -p$MYSQL_PWD --skip-opt --create-options --skip-set-charset --no-data weberpdemo >> $BASE_DIR/sql/mysql/weberp-new.sql +mysqldump -u$MYSQL_USER -p$MYSQL_PWD --skip-opt --create-options --skip-set-charset --ignore-table=weberpdemo.mrpsupplies --ignore-table=weberpdemo.mrpplanedorders --ignore-table=weberpdemo.mrpparameters --ignore-table=weberpdemo.levels --ignore-table=weberpdemo.mrprequirements --ignore-table=weberpdemo.audittrail --no-data weberpdemo >> $BASE_DIR/sql/mysql/weberp-new.sql mysqldump -u$MYSQL_USER -p$MYSQL_PWD --skip-opt --skip-set-charset --quick --no-create-info weberpdemo \ accountgroups \ @@ -101,10 +101,10 @@ accountsection \ > $BASE_DIR/sql/mysql/weberp-base.sql -mysqldump -u$MYSQL_USER -p$MYSQL_PWD --skip-opt --skip-set-charset --quick --no-create-info weberpdemo > $BASE_DIR/sql/mysql/weberp-demo_data.sql +mysqldump -u$MYSQL_USER -p$MYSQL_PWD --skip-opt --skip-set-charset --quick --ignore-table=weberpdemo.mrpsupplies --ignore-table=weberpdemo.mrpplanedorders --ignore-table=weberpdemo.mrpparameters --ignore-table=weberpdemo.levels --ignore-table=weberpdemo.mrprequirements --no-create-info weberpdemo > $BASE_DIR/sql/mysql/weberp-demo_data.sql rm $BASE_DIR/sql/mysql/weberp-demo.sql -echo "CREATE DATABASE weberpdemo;" > $BASE_DIR/sql/mysql/weberp-demo.sql +echo "CREATE DATABASE IF NOT EXISTS weberpdemo;" > $BASE_DIR/sql/mysql/weberp-demo.sql echo "USE weberpdemo;" >> $BASE_DIR/sql/mysql/weberp-demo.sql cat $BASE_DIR/sql/mysql/weberp-new.sql >> $BASE_DIR/sql/mysql/weberp-demo.sql Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2011-05-15 07:12:43 UTC (rev 4568) +++ trunk/doc/Change.log 2011-05-15 07:53:42 UTC (rev 4569) @@ -1,6 +1,6 @@ webERP Change Log - +15/5/11 Z_ChangeStockCode.php modified to test if MRP tables exist before doing the updates 15/5/11 Tim: FixedAssetCategories prior to deletion of a category check for existing assets in the category failed due to typo in SQL - fixed 14/5/11 Tim: StockTransfer now checks for negative stock before allowing transfer - launchpad changes to 4691 14/5/11 CustomerInquiry.php now shows the currency decimal places This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-05-15 07:53:49
|
Revision: 4569 http://web-erp.svn.sourceforge.net/web-erp/?rev=4569&view=rev Author: daintree Date: 2011-05-15 07:53:42 +0000 (Sun, 15 May 2011) Log Message: ----------- Change Stock Code fix Modified Paths: -------------- trunk/MRP.php trunk/Z_ChangeStockCode.php trunk/build/make_release.sh trunk/doc/Change.log Modified: trunk/MRP.php =================================================================== --- trunk/MRP.php 2011-05-15 07:12:43 UTC (rev 4568) +++ trunk/MRP.php 2011-05-15 07:53:42 UTC (rev 4569) @@ -314,16 +314,16 @@ prnMsg(_('Loading requirements based on reorder level'),'info'); flush(); - $result = DB_query('ALTER TABLE mrprequirements ADD INDEX part(part)',$db); + $result = DB_query("ALTER TABLE mrprequirements ADD INDEX part(part)",$db); // In the following section, create mrpsupplies from open purchase orders, // open work orders, and current quantity onhand from locstock prnMsg(_('Creating supplies table'),'info'); flush(); - $result = DB_query('DROP TABLE IF EXISTS mrpsupplies',$db); + $result = DB_query("DROP TABLE IF EXISTS mrpsupplies",$db); // updateflag is set to 1 in UpdateSupplies if change date when matching requirements to // supplies. Actually only change update flag in the array created from mrpsupplies - $sql = 'CREATE TABLE mrpsupplies ( id int(11) NOT NULL auto_increment, + $sql = "CREATE TABLE mrpsupplies ( id int(11) NOT NULL auto_increment, part char(20), duedate date, supplyquantity double, @@ -331,7 +331,7 @@ orderno int(11), mrpdate date, updateflag smallint(6), - PRIMARY KEY (id)) DEFAULT CHARSET=utf8'; + PRIMARY KEY (id)) DEFAULT CHARSET=utf8"; $result = DB_query($sql,$db,_('Create of mrpsupplies failed because')); prnMsg(_('Loading supplies from purchase orders'),'info'); @@ -424,7 +424,7 @@ WHERE workorders.closed=0"; $result = DB_query($sql,$db); - $sql = 'ALTER TABLE mrpsupplies ADD INDEX part(part)'; + $sql = "ALTER TABLE mrpsupplies ADD INDEX part(part)"; $result = DB_query($sql,$db); // Create mrpplannedorders table to create a record for any unmet requirments @@ -432,8 +432,8 @@ // open work orders, and current quantity onhand from locstock prnMsg(_('Creating planned orders table'),'info'); flush(); - $result = DB_query('DROP TABLE IF EXISTS mrpplannedorders',$db); - $sql = 'CREATE TABLE mrpplannedorders (id int(11) NOT NULL auto_increment, + $result = DB_query("DROP TABLE IF EXISTS mrpplannedorders",$db); + $sql = "CREATE TABLE mrpplannedorders (id int(11) NOT NULL auto_increment, part char(20), duedate date, supplyquantity double, @@ -441,11 +441,11 @@ orderno int(11), mrpdate date, updateflag smallint(6), - PRIMARY KEY (id)) DEFAULT CHARSET=utf8'; + PRIMARY KEY (id)) DEFAULT CHARSET=utf8"; $result = DB_query($sql,$db,_('Create of mrpplannedorders failed because')); // Find the highest and lowest level number - $sql = 'SELECT MAX(level),MIN(level) from levels'; + $sql = "SELECT MAX(level),MIN(level) from levels"; $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); @@ -471,16 +471,16 @@ echo '</br>' . _('End time') . ': ' . date('h:i:s') . '</br>'; // Create mrpparameters table - $sql = 'DROP TABLE IF EXISTS mrpparameters'; + $sql = "DROP TABLE IF EXISTS mrpparameters"; $result = DB_query($sql,$db); - $sql = 'CREATE TABLE mrpparameters ( + $sql = "CREATE TABLE mrpparameters ( runtime datetime, location varchar(50), pansizeflag varchar(5), shrinkageflag varchar(5), eoqflag varchar(5), usemrpdemands varchar(5), - leeway smallint) DEFAULT CHARSET=utf8'; + leeway smallint) DEFAULT CHARSET=utf8"; $result = DB_query($sql,$db); // Create entry for location field from $_POST['location'], which is an array // since multiple locations can be selected @@ -515,7 +515,7 @@ _('Inventory') . '" alt="" />' . ' ' . $title . '</p>'; // Display parameters from last run - $sql = 'SELECT * FROM mrpparameters'; + $sql = "SELECT * FROM mrpparameters"; $result = DB_query($sql,$db,'','',false,false); if (DB_error_no($db)==0){ @@ -551,7 +551,7 @@ echo '<td>' . _('Use Shrinkage') . ':  </td><td>' . $useshrinkage . '</td></tr>'; echo '</table></td>'; } - echo "<p><form method='post' action='" . $_SERVER['PHP_SELF'] . "'>"; + echo '<p><form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<table class=selection>'; // Generate selections for Location @@ -560,9 +560,9 @@ <td>' . _('Location') . '</td> <td><select name="location[]" multiple> <option value="All" selected>' . _('All') . '</option>'; - $sql = 'SELECT loccode, + $sql = "SELECT loccode, locationname - FROM locations'; + FROM locations"; $result = DB_query($sql,$db); while ($myrow = DB_fetch_array($result)) { echo '<option value="'; Modified: trunk/Z_ChangeStockCode.php =================================================================== --- trunk/Z_ChangeStockCode.php 2011-05-15 07:12:43 UTC (rev 4568) +++ trunk/Z_ChangeStockCode.php 2011-05-15 07:53:42 UTC (rev 4569) @@ -1,53 +1,72 @@ <?php /* $Id$*/ + /*Script to Delete all sales transactions*/ -//$PageSecurity=15; include ('includes/session.inc'); $title = _('UTILITY PAGE Change A Stock Code'); include('includes/header.inc'); include('includes/SQL_CommonFunctions.inc'); if (isset($_POST['ProcessStockChange'])){ - + + $InputError =0; + $_POST['NewStockID'] = strtoupper($_POST['NewStockID']); /*First check the stock code exists */ $result=DB_query("SELECT stockid FROM stockmaster WHERE stockid='" . $_POST['OldStockID'] . "'",$db); if (DB_num_rows($result)==0){ prnMsg(_('The stock code') . ': ' . $_POST['OldStockID'] . ' ' . _('does not currently exist as a stock code in the system'),'error'); - include('includes/footer.inc'); - exit; + $InputError =1; } if (ContainsIllegalCharacters($_POST['NewStockID'])){ prnMsg(_('The new stock code to change the old code to contains illegal characters - no changes will be made'),'error'); - include('includes/footer.inc'); - exit; + $InputError =1; } if ($_POST['NewStockID']==''){ prnMsg(_('The new stock code to change the old code to must be entered as well'),'error'); - include('includes/footer.inc'); - exit; + $InputError =1; } /*Now check that the new code doesn't already exist */ $result=DB_query("SELECT stockid FROM stockmaster WHERE stockid='" . $_POST['NewStockID'] . "'",$db); if (DB_num_rows($result)!=0){ - echo '<br><br>'; + echo '<br /><br />'; prnMsg(_('The replacement stock code') . ': ' . $_POST['NewStockID'] . ' ' . _('already exists as a stock code in the system') . ' - ' . _('a unique stock code must be entered for the new code'),'error'); - include('includes/footer.inc'); - exit; + $InputError =1; } - - $result = DB_Txn_Begin($db); - - echo '<br>' . _('Adding the new stock master record'); - $sql = "INSERT INTO stockmaster (stockid, + if ($InputError ==0){ // no input errors + $result = DB_Txn_Begin($db); + + echo '<br />' . _('Adding the new stock master record'); + $sql = "INSERT INTO stockmaster (stockid, + categoryid, + description, + longdescription, + units, + mbflag, + lastcurcostdate, + actualcost, + lastcost, + materialcost, + labourcost, + overheadcost, + lowestlevel, + discontinued, + controlled, + eoq, + volume, + kgs, + barcode, + discountcategory, + taxcatid) + SELECT '" . $_POST['NewStockID'] . "', categoryid, description, longdescription, @@ -67,256 +86,238 @@ kgs, barcode, discountcategory, - taxcatid) - SELECT '" . $_POST['NewStockID'] . "', - categoryid, - description, - longdescription, - units, - mbflag, - lastcurcostdate, - actualcost, - lastcost, - materialcost, - labourcost, - overheadcost, - lowestlevel, - discontinued, - controlled, - eoq, - volume, - kgs, - barcode, - discountcategory, - taxcatid - FROM stockmaster - WHERE stockid='" . $_POST['OldStockID'] . "'"; - - $DbgMsg = _('The SQL statement that failed was'); - $ErrMsg =_('The SQL to insert the new stock master record failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - echo '<br>' . _('Changing stock location records'); - $sql = "UPDATE locstock SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update stock location records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - echo '<br>' . _('Changing stock movement records'); - $sql = "UPDATE stockmoves SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update stock movement transaction records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - echo '<BR>' . _('Changing location transfer information'); - - $sql = "UPDATE loctransfers SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update the loctransfers records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - echo '<BR>' . _('Changing MRP demands information'); - - $sql = "UPDATE mrpdemands SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update the mrpdemands records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - $sql="select count(table_name) from information_schema.tables where table_schema='".$_SESSION['DatabaseName']."' and table_name='mrpplannedorders'"; - $result = DB_query($sql,$db); - $row=DB_fetch_row($result); - if ($row[0]>0) { - echo '<BR>' . _('Changing MRP planned orders information'); - - $sql = "UPDATE mrpplannedorders SET part='" . $_POST['NewStockID'] . "' WHERE part='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update the mrpplannedorders records failed'); + taxcatid + FROM stockmaster + WHERE stockid='" . $_POST['OldStockID'] . "'"; + + $DbgMsg = _('The SQL statement that failed was'); + $ErrMsg =_('The SQL to insert the new stock master record failed'); $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); echo ' ... ' . _('completed'); - } - - echo '<BR>' . _('Changing MRP requirements information'); - - $sql = "UPDATE mrprequirements SET part='" . $_POST['NewStockID'] . "' WHERE part='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update the mrprequirements records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - echo '<BR>' . _('Changing MRP supplies information'); - - $sql = "UPDATE mrpsupplies SET part='" . $_POST['NewStockID'] . "' WHERE part='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update the mrpsupplies records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - - - echo '<br>' . _('Changing sales analysis records'); - $sql = "UPDATE salesanalysis SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update Sales Analysis records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - - echo '<br>' . _('Changing order delivery differences records'); - $sql = "UPDATE orderdeliverydifferenceslog SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update order delivery differences records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - - echo '<br>' . _('Changing pricing records'); - $sql = "UPDATE prices SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update the pricing records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - - echo '<br>' . _('Changing sales orders detail records'); - $sql = "UPDATE salesorderdetails SET stkcode='" . $_POST['NewStockID'] . "' WHERE stkcode='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update the sales order header records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - - echo '<br>' . _('Changing purchase order details records'); - $sql = "UPDATE purchorderdetails SET itemcode='" . $_POST['NewStockID'] . "' WHERE itemcode='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update the purchase order detail records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - - echo '<br>' . _('Changing purchasing data records'); - $sql = "UPDATE purchdata SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update the purchasing data records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - echo '<br>' . _('Changing the stock code in shipment charges records'); - $sql = "UPDATE shipmentcharges SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update Shipment Charges records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - echo '<br>' . _('Changing the stock check freeze file records'); - $sql = "UPDATE stockcheckfreeze SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update stock check freeze records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - echo '<br>' . _('Changing the stock counts table records'); - $sql = "UPDATE stockcounts SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update stock counts records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - - echo '<br>' . _('Changing the GRNs table records'); - $sql = "UPDATE grns SET itemcode='" . $_POST['NewStockID'] . "' WHERE itemcode='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update GRN records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - - echo '<br>' . _('Changing the contract BOM table records'); - $sql = "UPDATE contractbom SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to contract BOM records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - - echo '<br>' . _('Changing the BOM table records') . ' - ' . _('components'); - $sql = "UPDATE bom SET component='" . $_POST['NewStockID'] . "' WHERE component='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update the BOM records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - - echo '<br>' . _('Changing the BOM table records') . ' - ' . _('parents'); - $sql = "UPDATE bom SET parent='" . $_POST['NewStockID'] . "' WHERE parent='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update the BOM parent records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - echo '<br>' . _('Changing any image files'); - if (file_exists($_SESSION['part_pics_dir'] . '/' .$_POST['OldStockID'].'.jpg')) { - if (rename($_SESSION['part_pics_dir'] . '/' .$_POST['OldStockID'].'.jpg', - $_SESSION['part_pics_dir'] . '/' .$_POST['NewStockID'].'.jpg')) { - echo ' ... ' . _('completed'); - } else { - echo ' ... ' . _('failed'); - } - } else { + + echo '<br />' . _('Changing stock location records'); + $sql = "UPDATE locstock SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update stock location records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); echo ' ... ' . _('completed'); - } - - echo '<br>' . _('Changing the item properties table records') . ' - ' . _('parents'); - $sql = "UPDATE stockitemproperties SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update the item properties records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - $sql = 'SET FOREIGN_KEY_CHECKS=0'; - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - - echo '<BR>' . _('Changing work order requirements information'); - - $sql = "UPDATE worequirements SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update the stockid worequirements records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - $sql = "UPDATE worequirements SET parentstockid='" . $_POST['NewStockID'] . "' WHERE parentstockid='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update the parent stockid worequirements records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - echo '<BR>' . _('Changing work order information'); - - $sql = "UPDATE woitems SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update the woitem records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - - echo '<br>' . _('Changing any serialised item information'); - - - $sql = "UPDATE stockserialitems SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update the stockserialitem records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - $sql = "UPDATE stockserialmoves SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update the stockserialitem records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - $sql = 'SET FOREIGN_KEY_CHECKS=1'; - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - - $result = DB_Txn_Commit($db); - - echo '<br>' . _('Deleting the old stock master record'); - $sql = "DELETE FROM stockmaster WHERE stockid='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to delete the old stock master record failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - - echo '<p>' . _('Stock Code') . ': ' . $_POST['OldStockID'] . ' ' . _('was successfully changed to') . ' : ' . $_POST['NewStockID']; - + + echo '<br />' . _('Changing stock movement records'); + $sql = "UPDATE stockmoves SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update stock movement transaction records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + + echo '<br />' . _('Changing location transfer information'); + + $sql = "UPDATE loctransfers SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update the loctransfers records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + + + + echo '<br />' . _('Changing MRP demands information'); + $sql = "UPDATE mrpdemands SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update the mrpdemands records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + + //check if MRP tables exist before assuming + + $result = DB_query("SELECT COUNT(*) FROM mrpplannedorders",$db); + if ($DB_error_no==0) { + echo '<br />' . _('Changing MRP planned orders information'); + $sql = "UPDATE mrpplannedorders SET part='" . $_POST['NewStockID'] . "' WHERE part='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update the mrpplannedorders records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + } + + $result = DB_query("SELECT * FROM mrprequirements" , $db); + if (DB_error_no($db)==0){ + echo '<br />' . _('Changing MRP requirements information'); + $sql = "UPDATE mrprequirements SET part='" . $_POST['NewStockID'] . "' WHERE part='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update the mrprequirements records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + } + $result = DB_query("SELECT * FROM mrpsupplies" , $db); + if (DB_error_no($db)==0){ + echo '<br />' . _('Changing MRP supplies information'); + $sql = "UPDATE mrpsupplies SET part='" . $_POST['NewStockID'] . "' WHERE part='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update the mrpsupplies records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + } + + echo '<br />' . _('Changing sales analysis records'); + $sql = "UPDATE salesanalysis SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update Sales Analysis records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + + + echo '<br />' . _('Changing order delivery differences records'); + $sql = "UPDATE orderdeliverydifferenceslog SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update order delivery differences records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + + + echo '<br />' . _('Changing pricing records'); + $sql = "UPDATE prices SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update the pricing records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + + + echo '<br />' . _('Changing sales orders detail records'); + $sql = "UPDATE salesorderdetails SET stkcode='" . $_POST['NewStockID'] . "' WHERE stkcode='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update the sales order header records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + + + echo '<br />' . _('Changing purchase order details records'); + $sql = "UPDATE purchorderdetails SET itemcode='" . $_POST['NewStockID'] . "' WHERE itemcode='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update the purchase order detail records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + + + echo '<br />' . _('Changing purchasing data records'); + $sql = "UPDATE purchdata SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update the purchasing data records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + + echo '<br />' . _('Changing the stock code in shipment charges records'); + $sql = "UPDATE shipmentcharges SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update Shipment Charges records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + + echo '<br />' . _('Changing the stock check freeze file records'); + $sql = "UPDATE stockcheckfreeze SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update stock check freeze records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + + echo '<br />' . _('Changing the stock counts table records'); + $sql = "UPDATE stockcounts SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update stock counts records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + + + echo '<br />' . _('Changing the GRNs table records'); + $sql = "UPDATE grns SET itemcode='" . $_POST['NewStockID'] . "' WHERE itemcode='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update GRN records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + + + echo '<br />' . _('Changing the contract BOM table records'); + $sql = "UPDATE contractbom SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to contract BOM records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + + + echo '<br />' . _('Changing the BOM table records') . ' - ' . _('components'); + $sql = "UPDATE bom SET component='" . $_POST['NewStockID'] . "' WHERE component='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update the BOM records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + + + echo '<br />' . _('Changing the BOM table records') . ' - ' . _('parents'); + $sql = "UPDATE bom SET parent='" . $_POST['NewStockID'] . "' WHERE parent='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update the BOM parent records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + + echo '<br />' . _('Changing any image files'); + if (file_exists($_SESSION['part_pics_dir'] . '/' .$_POST['OldStockID'].'.jpg')) { + if (rename($_SESSION['part_pics_dir'] . '/' .$_POST['OldStockID'].'.jpg', + $_SESSION['part_pics_dir'] . '/' .$_POST['NewStockID'].'.jpg')) { + echo ' ... ' . _('completed'); + } else { + echo ' ... ' . _('failed'); + } + } else { + echo ' ... ' . _('completed'); + } + + echo '<br />' . _('Changing the item properties table records') . ' - ' . _('parents'); + $sql = "UPDATE stockitemproperties SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update the item properties records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + + $sql = 'SET FOREIGN_KEY_CHECKS=0'; + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + + echo '<br />' . _('Changing work order requirements information'); + + $sql = "UPDATE worequirements SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update the stockid worequirements records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + + $sql = "UPDATE worequirements SET parentstockid='" . $_POST['NewStockID'] . "' WHERE parentstockid='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update the parent stockid worequirements records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + + echo '<br />' . _('Changing work order information'); + + $sql = "UPDATE woitems SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update the woitem records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + + + echo '<br />' . _('Changing any serialised item information'); + + + $sql = "UPDATE stockserialitems SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update the stockserialitem records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + $sql = "UPDATE stockserialmoves SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update the stockserialitem records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + + $sql = 'SET FOREIGN_KEY_CHECKS=1'; + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + + $result = DB_Txn_Commit($db); + + echo '<br />' . _('Deleting the old stock master record'); + $sql = "DELETE FROM stockmaster WHERE stockid='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to delete the old stock master record failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + + + echo '<p>' . _('Stock Code') . ': ' . $_POST['OldStockID'] . ' ' . _('was successfully changed to') . ' : ' . $_POST['NewStockID']; + } //only do the stuff above if $InputError==0 + } -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 '<p><table> - <tr><td>' . _('Existing Inventory Code') . ":</td> - <td><input type=Text name='OldStockID' size=20 maxlength=20></td></tr>"; + <tr><td>' . _('Existing Inventory Code') . ':</td> + <td><input type=Text name="OldStockID" size=20 maxlength=20></td></tr>'; -echo '<tr><td>' . _('New Inventory Code') . ":</td><td><input type=Text name='NewStockID' size=20 maxlength=20></td></tr>"; +echo '<tr><td>' . _('New Inventory Code') . ':</td> + <td><input type="text" name="NewStockID" size=20 maxlength=20></td></tr>'; echo '</table>'; -echo "<div class=centre><input type=submit name='ProcessStockChange' VALUE='" . _('Process') . "'></div>"; +echo '<div class="centre"><input type="submit" name="ProcessStockChange" value="' . _('Process') . '"></div>'; echo '</form>'; Modified: trunk/build/make_release.sh =================================================================== --- trunk/build/make_release.sh 2011-05-15 07:12:43 UTC (rev 4568) +++ trunk/build/make_release.sh 2011-05-15 07:53:42 UTC (rev 4569) @@ -69,7 +69,7 @@ echo "SET FOREIGN_KEY_CHECKS = 0;" > $BASE_DIR/sql/mysql/weberp-new.sql -mysqldump -u$MYSQL_USER -p$MYSQL_PWD --skip-opt --create-options --skip-set-charset --no-data weberpdemo >> $BASE_DIR/sql/mysql/weberp-new.sql +mysqldump -u$MYSQL_USER -p$MYSQL_PWD --skip-opt --create-options --skip-set-charset --ignore-table=weberpdemo.mrpsupplies --ignore-table=weberpdemo.mrpplanedorders --ignore-table=weberpdemo.mrpparameters --ignore-table=weberpdemo.levels --ignore-table=weberpdemo.mrprequirements --ignore-table=weberpdemo.audittrail --no-data weberpdemo >> $BASE_DIR/sql/mysql/weberp-new.sql mysqldump -u$MYSQL_USER -p$MYSQL_PWD --skip-opt --skip-set-charset --quick --no-create-info weberpdemo \ accountgroups \ @@ -101,10 +101,10 @@ accountsection \ > $BASE_DIR/sql/mysql/weberp-base.sql -mysqldump -u$MYSQL_USER -p$MYSQL_PWD --skip-opt --skip-set-charset --quick --no-create-info weberpdemo > $BASE_DIR/sql/mysql/weberp-demo_data.sql +mysqldump -u$MYSQL_USER -p$MYSQL_PWD --skip-opt --skip-set-charset --quick --ignore-table=weberpdemo.mrpsupplies --ignore-table=weberpdemo.mrpplanedorders --ignore-table=weberpdemo.mrpparameters --ignore-table=weberpdemo.levels --ignore-table=weberpdemo.mrprequirements --no-create-info weberpdemo > $BASE_DIR/sql/mysql/weberp-demo_data.sql rm $BASE_DIR/sql/mysql/weberp-demo.sql -echo "CREATE DATABASE weberpdemo;" > $BASE_DIR/sql/mysql/weberp-demo.sql +echo "CREATE DATABASE IF NOT EXISTS weberpdemo;" > $BASE_DIR/sql/mysql/weberp-demo.sql echo "USE weberpdemo;" >> $BASE_DIR/sql/mysql/weberp-demo.sql cat $BASE_DIR/sql/mysql/weberp-new.sql >> $BASE_DIR/sql/mysql/weberp-demo.sql Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2011-05-15 07:12:43 UTC (rev 4568) +++ trunk/doc/Change.log 2011-05-15 07:53:42 UTC (rev 4569) @@ -1,6 +1,6 @@ webERP Change Log - +15/5/11 Z_ChangeStockCode.php modified to test if MRP tables exist before doing the updates 15/5/11 Tim: FixedAssetCategories prior to deletion of a category check for existing assets in the category failed due to typo in SQL - fixed 14/5/11 Tim: StockTransfer now checks for negative stock before allowing transfer - launchpad changes to 4691 14/5/11 CustomerInquiry.php now shows the currency decimal places This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |