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 ty... [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>"... [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>"... [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=' . $myr... [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=' . $myr... [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><... [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><... [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['Form... [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['Form... [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, - ... [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, - ... [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 cred... [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 cred... [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') . '<... [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') . '<... [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... [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... [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 ... [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 ... [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') . '... [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') . '... [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 @@... [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 @@... [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... [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... [truncated message content] |