This list is closed, nobody may subscribe to it.
2011 |
Jan
(14) |
Feb
(42) |
Mar
(56) |
Apr
(60) |
May
(54) |
Jun
(48) |
Jul
(74) |
Aug
(52) |
Sep
(68) |
Oct
(64) |
Nov
(42) |
Dec
(62) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2012 |
Jan
(142) |
Feb
(270) |
Mar
(374) |
Apr
(230) |
May
(214) |
Jun
(116) |
Jul
(234) |
Aug
(66) |
Sep
(120) |
Oct
(16) |
Nov
(17) |
Dec
(41) |
2013 |
Jan
(19) |
Feb
(18) |
Mar
(8) |
Apr
(40) |
May
(121) |
Jun
(42) |
Jul
(127) |
Aug
(145) |
Sep
(27) |
Oct
(38) |
Nov
(83) |
Dec
(61) |
2014 |
Jan
(33) |
Feb
(35) |
Mar
(59) |
Apr
(41) |
May
(38) |
Jun
(45) |
Jul
(17) |
Aug
(58) |
Sep
(46) |
Oct
(51) |
Nov
(55) |
Dec
(36) |
2015 |
Jan
(57) |
Feb
(67) |
Mar
(70) |
Apr
(34) |
May
(32) |
Jun
(11) |
Jul
(3) |
Aug
(17) |
Sep
(16) |
Oct
(13) |
Nov
(30) |
Dec
(30) |
2016 |
Jan
(17) |
Feb
(12) |
Mar
(17) |
Apr
(20) |
May
(47) |
Jun
(15) |
Jul
(13) |
Aug
(30) |
Sep
(32) |
Oct
(20) |
Nov
(32) |
Dec
(24) |
2017 |
Jan
(16) |
Feb
|
Mar
(11) |
Apr
(11) |
May
(5) |
Jun
(42) |
Jul
(9) |
Aug
(10) |
Sep
(14) |
Oct
(15) |
Nov
(2) |
Dec
(29) |
2018 |
Jan
(28) |
Feb
(49) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <dai...@us...> - 2011-08-19 10:13:22
|
Revision: 4662 http://web-erp.svn.sourceforge.net/web-erp/?rev=4662&view=rev Author: daintree Date: 2011-08-19 10:13:15 +0000 (Fri, 19 Aug 2011) Log Message: ----------- Ricard formatting changes Modified Paths: -------------- trunk/PDFStockNegatives.php trunk/doc/Change.log Modified: trunk/PDFStockNegatives.php =================================================================== --- trunk/PDFStockNegatives.php 2011-08-19 06:17:03 UTC (rev 4661) +++ trunk/PDFStockNegatives.php 2011-08-19 10:13:15 UTC (rev 4662) @@ -1,17 +1,13 @@ <?php -/* $Revision: 1.7 $ */ /* $Id$*/ -/* $Revision: 1.8 $ */ - -//$PageSecurity =1; include('includes/session.inc'); include('includes/PDFStarter.php'); $pdf->addInfo('Title', _('Inventory Negatives Listing') ); $pdf->addInfo('Subject', _('Inventory Negatives Listing')); -$FontSize=10; +$FontSize=9; $PageNumber=1; $line_height=15; @@ -47,9 +43,9 @@ do { - $LeftOvers = $pdf->addTextWrap($Left_Margin,$YPos,100,$FontSize, $NegativesRow['loccode'] . ' - ' . $NegativesRow['locationname'], 'left'); - $LeftOvers = $pdf->addTextWrap(130,$YPos,250,$FontSize,$NegativesRow['stockid'] . ' - ' .$NegativesRow['description'], 'left'); - $LeftOvers = $pdf->addTextWrap(400,$YPos,70,$FontSize,$NegativesRow['quantity'], 'right'); + $LeftOvers = $pdf->addTextWrap($Left_Margin,$YPos,130,$FontSize, $NegativesRow['loccode'] . ' - ' . $NegativesRow['locationname'], 'left'); + $LeftOvers = $pdf->addTextWrap(170,$YPos,350,$FontSize,$NegativesRow['stockid'] . ' - ' .$NegativesRow['description'], 'left'); + $LeftOvers = $pdf->addTextWrap(520,$YPos,30,$FontSize,$NegativesRow['quantity'], 'right'); $pdf->line($Left_Margin, $YPos-2,$Page_Width-$Right_Margin, $YPos-2); @@ -62,6 +58,13 @@ } while ($NegativesRow = DB_fetch_array($result)); -$pdf->OutputD($_SESSION['DatabaseName'] . '_NegativeStocks_' . date('Y-m-d') . '.pdf');//UldisN -$pdf->__destruct(); //UldisN +if (DB_num_rows($result)>0){ + $pdf->OutputD($_SESSION['DatabaseName'] . '_NegativeStocks_' . date('Y-m-d') . '.pdf'); + $pdf->__destruct(); +} else { + $title = _('Negative Stock Listing Problem'); + include('includes/header.inc'); + prnMsg(_('There are no negative stocks to list'),'info'); + include('includes/footer.inc'); +} ?> Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2011-08-19 06:17:03 UTC (rev 4661) +++ trunk/doc/Change.log 2011-08-19 10:13:15 UTC (rev 4662) @@ -1,5 +1,7 @@ webERP Change Log +19/8/11 Ricard: Fine tuning formatting PDFStockNegatives.php +19/8/11 Carlos Urbieta Cabrera: security.png image was missing now added 14/8/11 Phil: SystemParameters.php default ProhibitPostingsBefore to 1900-01-01 when no default is currently set - can cause errors at the moment as defaults to the latest period if not previously set. 14/8/11 Phil: Stocks.php now does a journal for any work in progress on a change of category where the new category has a different GL account for WIP - and bug fixes as per Ricard 12/8/11 Phil: Backed out changes on 7/8 that prevented SelectProduct.php transaction links - now only purchase order links blocked if an item is obsolete This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-08-19 06:17:09
|
Revision: 4661 http://web-erp.svn.sourceforge.net/web-erp/?rev=4661&view=rev Author: daintree Date: 2011-08-19 06:17:03 +0000 (Fri, 19 Aug 2011) Log Message: ----------- added Carlos secuirty.png Added Paths: ----------- trunk/css/default/images/security.png trunk/css/fresh/images/security.png trunk/css/gel/images/security.png trunk/css/jelly/images/security.png trunk/css/professional/images/security.png trunk/css/professional-rtl/images/security.png trunk/css/silverwolf/images/security.png Added: trunk/css/default/images/security.png =================================================================== (Binary files differ) Property changes on: trunk/css/default/images/security.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/css/fresh/images/security.png =================================================================== (Binary files differ) Property changes on: trunk/css/fresh/images/security.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/css/gel/images/security.png =================================================================== (Binary files differ) Property changes on: trunk/css/gel/images/security.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/css/jelly/images/security.png =================================================================== (Binary files differ) Property changes on: trunk/css/jelly/images/security.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/css/professional/images/security.png =================================================================== (Binary files differ) Property changes on: trunk/css/professional/images/security.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/css/professional-rtl/images/security.png =================================================================== (Binary files differ) Property changes on: trunk/css/professional-rtl/images/security.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/css/silverwolf/images/security.png =================================================================== (Binary files differ) Property changes on: trunk/css/silverwolf/images/security.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-08-19 06:17:09
|
Revision: 4661 http://web-erp.svn.sourceforge.net/web-erp/?rev=4661&view=rev Author: daintree Date: 2011-08-19 06:17:03 +0000 (Fri, 19 Aug 2011) Log Message: ----------- added Carlos secuirty.png Added Paths: ----------- trunk/css/default/images/security.png trunk/css/fresh/images/security.png trunk/css/gel/images/security.png trunk/css/jelly/images/security.png trunk/css/professional/images/security.png trunk/css/professional-rtl/images/security.png trunk/css/silverwolf/images/security.png Added: trunk/css/default/images/security.png =================================================================== (Binary files differ) Property changes on: trunk/css/default/images/security.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/css/fresh/images/security.png =================================================================== (Binary files differ) Property changes on: trunk/css/fresh/images/security.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/css/gel/images/security.png =================================================================== (Binary files differ) Property changes on: trunk/css/gel/images/security.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/css/jelly/images/security.png =================================================================== (Binary files differ) Property changes on: trunk/css/jelly/images/security.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/css/professional/images/security.png =================================================================== (Binary files differ) Property changes on: trunk/css/professional/images/security.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/css/professional-rtl/images/security.png =================================================================== (Binary files differ) Property changes on: trunk/css/professional-rtl/images/security.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/css/silverwolf/images/security.png =================================================================== (Binary files differ) Property changes on: trunk/css/silverwolf/images/security.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2011-08-16 16:00:28
|
Revision: 4660 http://web-erp.svn.sourceforge.net/web-erp/?rev=4660&view=rev Author: tim_schofield Date: 2011-08-16 16:00:22 +0000 (Tue, 16 Aug 2011) Log Message: ----------- Apply counting bug fix when selecting a customer Modified Paths: -------------- trunk/SelectCustomer.php Modified: trunk/SelectCustomer.php =================================================================== --- trunk/SelectCustomer.php 2011-08-14 09:22:19 UTC (rev 4659) +++ trunk/SelectCustomer.php 2011-08-16 16:00:22 UTC (rev 4660) @@ -243,8 +243,8 @@ } $SQL.= " ORDER BY debtorsmaster.name"; $ErrMsg = _('The searched customer records requested cannot be retrieved because'); - - + + $result = DB_query($SQL, $db, $ErrMsg); if (DB_num_rows($result) == 1) { $myrow = DB_fetch_array($result); @@ -259,7 +259,7 @@ if (isset($_POST['JustSelectedACustomer'])){ /*Need to figure out the number of the form variable that the user clicked on */ - for ($i=1; $i< count($_POST); $i++){ //loop through the returned customers + for ($i=0; $i< count($_POST); $i++){ //loop through the returned customers if(isset($_POST['SubmitCustomerSelection'.$i])){ break; } @@ -273,13 +273,13 @@ } //AND !isset($_POST['Keywords']) AND !isset($_POST['CustCode']) AND !isset($_POST['CustType']) AND !isset($_POST['CustPhone']) if ($_SESSION['CustomerID'] != '' AND !isset($_POST['Search']) AND !isset($_POST['CSV'])) { - $SQL = "SELECT debtorsmaster.name, - custbranch.phoneno - FROM debtorsmaster INNER JOIN custbranch + $SQL = "SELECT debtorsmaster.name, + custbranch.phoneno + FROM debtorsmaster INNER JOIN custbranch ON debtorsmaster.debtorno=custbranch.debtorno - WHERE custbranch.debtorno='" . $_SESSION['CustomerID'] . "' + WHERE custbranch.debtorno='" . $_SESSION['CustomerID'] . "' AND custbranch.branchcode='" . $_SESSION['BranchCode'] . "'"; - + $ErrMsg = _('The customer name requested cannot be retrieved because'); $result = DB_query($SQL, $db, $ErrMsg); if ($myrow = DB_fetch_array($result)) { @@ -287,7 +287,7 @@ $PhoneNo = $myrow['phoneno']; } unset($result); - + echo '<p class="page_title_text"><img src="' . $rootpath . '/css/' . $theme . '/images/customer.png" title="' . _('Customer') . '" alt="" />' . ' ' . _('Customer') . ' : ' . $_SESSION['CustomerID'] . ' - ' . $CustomerName . ' - ' . $PhoneNo . _(' has been selected') . '</p>'; echo '<div class="page_help_text">' . _('Select a menu option to operate using this customer') . '.</div><br />'; @@ -599,9 +599,9 @@ $DataResult = DB_query($SQL, $db); $myrow = DB_fetch_array($DataResult); // Select some more data about the customer - $SQL = "SELECT sum(ovamount+ovgst) as total - FROM debtortrans - WHERE debtorno = '" . $_SESSION['CustomerID'] . "' + $SQL = "SELECT sum(ovamount+ovgst) as total + FROM debtortrans + WHERE debtorno = '" . $_SESSION['CustomerID'] . "' AND type !=12"; $Total1Result = DB_query($SQL, $db); $row = DB_fetch_array($Total1Result); @@ -652,8 +652,8 @@ } // Customer Contacts echo '<tr><td colspan="2">'; - $sql = "SELECT * FROM custcontacts - WHERE debtorno='" . $_SESSION['CustomerID'] . "' + $sql = "SELECT * FROM custcontacts + WHERE debtorno='" . $_SESSION['CustomerID'] . "' ORDER BY contid"; $result = DB_query($sql, $db); if (DB_num_rows($result) <> 0) { @@ -695,8 +695,8 @@ } // Customer Notes echo '<tr><td colspan="2">'; - $sql = "SELECT * FROM custnotes - WHERE debtorno='" . $_SESSION['CustomerID'] . "' + $sql = "SELECT * FROM custnotes + WHERE debtorno='" . $_SESSION['CustomerID'] . "' ORDER BY date DESC"; $result = DB_query($sql, $db); if (DB_num_rows($result) <> 0) { @@ -736,8 +736,8 @@ } // Custome Type Notes echo '<tr><td colspan="2">'; - $sql = "SELECT * FROM debtortypenotes - WHERE typeid='" . $CustomerType . "' + $sql = "SELECT * FROM debtortypenotes + WHERE typeid='" . $CustomerType . "' ORDER BY date DESC"; $result = DB_query($sql, $db); if (DB_num_rows($result) <> 0) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2011-08-16 16:00:28
|
Revision: 4660 http://web-erp.svn.sourceforge.net/web-erp/?rev=4660&view=rev Author: tim_schofield Date: 2011-08-16 16:00:22 +0000 (Tue, 16 Aug 2011) Log Message: ----------- Apply counting bug fix when selecting a customer Modified Paths: -------------- trunk/SelectCustomer.php Modified: trunk/SelectCustomer.php =================================================================== --- trunk/SelectCustomer.php 2011-08-14 09:22:19 UTC (rev 4659) +++ trunk/SelectCustomer.php 2011-08-16 16:00:22 UTC (rev 4660) @@ -243,8 +243,8 @@ } $SQL.= " ORDER BY debtorsmaster.name"; $ErrMsg = _('The searched customer records requested cannot be retrieved because'); - - + + $result = DB_query($SQL, $db, $ErrMsg); if (DB_num_rows($result) == 1) { $myrow = DB_fetch_array($result); @@ -259,7 +259,7 @@ if (isset($_POST['JustSelectedACustomer'])){ /*Need to figure out the number of the form variable that the user clicked on */ - for ($i=1; $i< count($_POST); $i++){ //loop through the returned customers + for ($i=0; $i< count($_POST); $i++){ //loop through the returned customers if(isset($_POST['SubmitCustomerSelection'.$i])){ break; } @@ -273,13 +273,13 @@ } //AND !isset($_POST['Keywords']) AND !isset($_POST['CustCode']) AND !isset($_POST['CustType']) AND !isset($_POST['CustPhone']) if ($_SESSION['CustomerID'] != '' AND !isset($_POST['Search']) AND !isset($_POST['CSV'])) { - $SQL = "SELECT debtorsmaster.name, - custbranch.phoneno - FROM debtorsmaster INNER JOIN custbranch + $SQL = "SELECT debtorsmaster.name, + custbranch.phoneno + FROM debtorsmaster INNER JOIN custbranch ON debtorsmaster.debtorno=custbranch.debtorno - WHERE custbranch.debtorno='" . $_SESSION['CustomerID'] . "' + WHERE custbranch.debtorno='" . $_SESSION['CustomerID'] . "' AND custbranch.branchcode='" . $_SESSION['BranchCode'] . "'"; - + $ErrMsg = _('The customer name requested cannot be retrieved because'); $result = DB_query($SQL, $db, $ErrMsg); if ($myrow = DB_fetch_array($result)) { @@ -287,7 +287,7 @@ $PhoneNo = $myrow['phoneno']; } unset($result); - + echo '<p class="page_title_text"><img src="' . $rootpath . '/css/' . $theme . '/images/customer.png" title="' . _('Customer') . '" alt="" />' . ' ' . _('Customer') . ' : ' . $_SESSION['CustomerID'] . ' - ' . $CustomerName . ' - ' . $PhoneNo . _(' has been selected') . '</p>'; echo '<div class="page_help_text">' . _('Select a menu option to operate using this customer') . '.</div><br />'; @@ -599,9 +599,9 @@ $DataResult = DB_query($SQL, $db); $myrow = DB_fetch_array($DataResult); // Select some more data about the customer - $SQL = "SELECT sum(ovamount+ovgst) as total - FROM debtortrans - WHERE debtorno = '" . $_SESSION['CustomerID'] . "' + $SQL = "SELECT sum(ovamount+ovgst) as total + FROM debtortrans + WHERE debtorno = '" . $_SESSION['CustomerID'] . "' AND type !=12"; $Total1Result = DB_query($SQL, $db); $row = DB_fetch_array($Total1Result); @@ -652,8 +652,8 @@ } // Customer Contacts echo '<tr><td colspan="2">'; - $sql = "SELECT * FROM custcontacts - WHERE debtorno='" . $_SESSION['CustomerID'] . "' + $sql = "SELECT * FROM custcontacts + WHERE debtorno='" . $_SESSION['CustomerID'] . "' ORDER BY contid"; $result = DB_query($sql, $db); if (DB_num_rows($result) <> 0) { @@ -695,8 +695,8 @@ } // Customer Notes echo '<tr><td colspan="2">'; - $sql = "SELECT * FROM custnotes - WHERE debtorno='" . $_SESSION['CustomerID'] . "' + $sql = "SELECT * FROM custnotes + WHERE debtorno='" . $_SESSION['CustomerID'] . "' ORDER BY date DESC"; $result = DB_query($sql, $db); if (DB_num_rows($result) <> 0) { @@ -736,8 +736,8 @@ } // Custome Type Notes echo '<tr><td colspan="2">'; - $sql = "SELECT * FROM debtortypenotes - WHERE typeid='" . $CustomerType . "' + $sql = "SELECT * FROM debtortypenotes + WHERE typeid='" . $CustomerType . "' ORDER BY date DESC"; $result = DB_query($sql, $db); if (DB_num_rows($result) <> 0) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-08-14 09:22:26
|
Revision: 4659 http://web-erp.svn.sourceforge.net/web-erp/?rev=4659&view=rev Author: daintree Date: 2011-08-14 09:22:19 +0000 (Sun, 14 Aug 2011) Log Message: ----------- 14/8/11 Phil: SystemParameters.php default ProhibitPostingsBefore to 1900-01-01 when no default is currently set - can cause errors at the moment as defaults to the latest period if not previously set. Modified Paths: -------------- trunk/SystemParameters.php trunk/doc/Change.log Modified: trunk/SystemParameters.php =================================================================== --- trunk/SystemParameters.php 2011-08-14 04:28:42 UTC (rev 4658) +++ trunk/SystemParameters.php 2011-08-14 09:22:19 UTC (rev 4659) @@ -326,7 +326,7 @@ // DefaultDateFormat echo '<tr style="outline: 1px solid"><td>' . _('Default Date Format') . ':</td> - <td><select Name="X_DefaultDateFormat"> + <td><select name="X_DefaultDateFormat"> <option '.(($_SESSION['DefaultDateFormat']=='d/m/Y')?'selected ':'').'Value="d/m/Y">d/m/Y</option> <option '.(($_SESSION['DefaultDateFormat']=='d.m.Y')?'selected ':'').'Value="d.m.Y">d.m.Y</option> <option '.(($_SESSION['DefaultDateFormat']=='m/d/Y')?'selected ':'').'Value="m/d/Y">m/d/Y</option> @@ -336,7 +336,7 @@ // DefaultTheme echo '<tr style="outline: 1px solid"><td>' . _('New Users Default Theme') . ':</td> - <td><select Name="X_DefaultTheme">'; + <td><select name="X_DefaultTheme">'; $ThemeDirectory = dir('css/'); while (false != ($ThemeName = $ThemeDirectory->read())){ if (is_dir("css/$ThemeName") AND $ThemeName != '.' AND $ThemeName != '..' AND $ThemeName != '.svn'){ @@ -354,23 +354,23 @@ // PastDueDays1 echo '<tr style="outline: 1px solid"><td>' . _('First Overdue Deadline in (days)') . ':</td> - <td><input type="Text" class="number" Name="X_PastDueDays1" value="' . $_SESSION['PastDueDays1'] . '" size=3 maxlength=3></td> + <td><input type="text" class="number" name="X_PastDueDays1" value="' . $_SESSION['PastDueDays1'] . '" size=3 maxlength=3></td> <td>' . _('Customer and supplier balances are displayed as overdue by this many days. This parameter is used on customer and supplier enquiry screens and aged listings') . '</td></tr>'; // PastDueDays2 echo '<tr style="outline: 1px solid"><td>' . _('Second Overdue Deadline in (days)') . ':</td> - <td><input type="Text" class="number" Name="X_PastDueDays2" value="' . $_SESSION['PastDueDays2'] . '" size=3 maxlength=3></td> + <td><input type="text" class="number" name="X_PastDueDays2" value="' . $_SESSION['PastDueDays2'] . '" size=3 maxlength=3></td> <td>' . _('As above but the next level of overdue') . '</td></tr>'; // DefaultCreditLimit echo '<tr style="outline: 1px solid"><td>' . _('Default Credit Limit') . ':</td> - <td><input type="Text" class="number" Name="X_DefaultCreditLimit" value="' . $_SESSION['DefaultCreditLimit'] . '" size=12 maxlength=12></td> + <td><input type="text" class="number" name="X_DefaultCreditLimit" value="' . $_SESSION['DefaultCreditLimit'] . '" size=12 maxlength=12></td> <td>' . _('The default used in new customer set up') . '</td></tr>'; // Check Credit Limits echo '<tr style="outline: 1px solid"><td>' . _('Check Credit Limits') . ':</td> - <td><select Name="X_CheckCreditLimits"> + <td><select name="X_CheckCreditLimits"> <option '.($_SESSION['CheckCreditLimits']==0?'selected ':'').'value="0">'._('Do not check').'</option> <option '.($_SESSION['CheckCreditLimits']==1?'selected ':'').'value="1">'._('Warn on breach').'</option> <option '.($_SESSION['CheckCreditLimits']==2?'selected ':'').'value="2">'._('Prohibit Sales').'</option> @@ -379,7 +379,7 @@ // Show_Settled_LastMonth echo '<tr style="outline: 1px solid"><td>' . _('Show Settled Last Month') . ':</td> - <td><select Name="X_Show_Settled_LastMonth"> + <td><select name="X_Show_Settled_LastMonth"> <option '.($_SESSION['Show_Settled_LastMonth']?'selected ':'').'value="1">'._('Yes').'</option> <option '.(!$_SESSION['Show_Settled_LastMonth']?'selected ':'').'value="0">'._('No').'</option> </select></td> @@ -387,29 +387,29 @@ //RomalpaClause echo '<tr style="outline: 1px solid"><td>' . _('Romalpa Clause') . ':</td> - <td><textarea Name="X_RomalpaClause" rows=3 cols=40>' . $_SESSION['RomalpaClause'] . '</textarea></td> + <td><textarea name="X_RomalpaClause" rows=3 cols=40>' . $_SESSION['RomalpaClause'] . '</textarea></td> <td>' . _('This text appears on invoices and credit notes in small print. Normally a reservation of title clause that gives the company rights to collect goods which have not been paid for - to give some protection for bad debts.') . '</td></tr>'; // QuickEntries echo '<tr style="outline: 1px solid"><td>' . _('Quick Entries') . ':</td> - <td><input type="Text" class="number" Name="X_QuickEntries" value="' . $_SESSION['QuickEntries'] . '" size=3 maxlength=2></td> + <td><input type="text" class="number" name="X_QuickEntries" value="' . $_SESSION['QuickEntries'] . '" size=3 maxlength=2></td> <td>' . _('This parameter defines the layout of the sales order entry screen. The number of fields available for quick entries. Any number from 1 to 99 can be entered.') . '</td></tr>'; // Frequently Ordered Items echo '<tr style="outline: 1px solid"><td>' . _('Frequently Ordered Items') . ':</td> - <td><input type="Text" class="number" Name="X_FrequentlyOrderedItems" value="' . $_SESSION['FrequentlyOrderedItems'] . '" size=3 maxlength=2></td> + <td><input type="text" class="number" name="X_FrequentlyOrderedItems" value="' . $_SESSION['FrequentlyOrderedItems'] . '" size=3 maxlength=2></td> <td>' . _('To show the most frequently ordered items enter the number of frequently ordered items you wish to display from 1 to 99. If you do not wish to display the frequently ordered item list enter 0.') . '</td></tr>'; // SO_AllowSameItemMultipleTimes echo '<tr style="outline: 1px solid"><td>' . _('Sales Order Allows Same Item Multiple Times') . ':</td> - <td><select Name="X_SO_AllowSameItemMultipleTimes"> + <td><select name="X_SO_AllowSameItemMultipleTimes"> <option '.($_SESSION['SO_AllowSameItemMultipleTimes']?'selected ':'').'value="1">'._('Yes').'</option> <option '.(!$_SESSION['SO_AllowSameItemMultipleTimes']?'selected ':'').'value="0">'._('No').'</option> </select></td><td> </td></tr>'; //'AllowOrderLineItemNarrative' echo '<tr style="outline: 1px solid"><td>' . _('Order Entry allows Line Item Narrative') . ':</td> - <td><select Name="X_AllowOrderLineItemNarrative"> + <td><select name="X_AllowOrderLineItemNarrative"> <option '.($_SESSION['AllowOrderLineItemNarrative']=='1'?'selected ':'').'value="1">'._('Allow Narrative Entry').'</option> <option '.($_SESSION['AllowOrderLineItemNarrative']=='0'?'selected ':'').'value="0">'._('No Narrative Line').'</option> </select></td> @@ -418,7 +418,7 @@ //'RequirePickingNote' echo '<tr style="outline: 1px solid"><td>' . _('A picking note must be produced before an order can be delivered') . ':</td> - <td><select Name="X_RequirePickingNote"> + <td><select name="X_RequirePickingNote"> <option '.($_SESSION['RequirePickingNote']=='1'?'selected ':'').'value="1">'._('Yes').'</option> <option '.($_SESSION['RequirePickingNote']=='0'?'selected ':'').'value="0">'._('No').'</option> </select></td> @@ -427,7 +427,7 @@ //UpdateCurrencyRatesDaily echo '<tr style="outline: 1px solid"><td>' . _('Auto Update Exchange Rates Daily') . ':</td> - <td><select Name="X_UpdateCurrencyRatesDaily"> + <td><select name="X_UpdateCurrencyRatesDaily"> <option '.($_SESSION['UpdateCurrencyRatesDaily']!='1'?'selected ':'').'value="1">'._('Automatic').'</option> <option '.($_SESSION['UpdateCurrencyRatesDaily']=='0'?'selected ':'').'value="0">'._('Manual').'</option> </select></td> @@ -436,7 +436,7 @@ //Default Packing Note Format echo '<tr style="outline: 1px solid"><td>' . _('Format of Packing Slips') . ':</td> - <td><select Name="X_PackNoteFormat"> + <td><select name="X_PackNoteFormat"> <option '.($_SESSION['PackNoteFormat']=='1'?'selected ':'').'value="1">'._('Laser Printed').'</option> <option '.($_SESSION['PackNoteFormat']=='2'?'selected ':'').'value="2">'._('Special Stationery').'</option> </select></td> @@ -445,7 +445,7 @@ //Default Invoice Format echo '<tr style="outline: 1px solid"><td>' . _('Invoice Orientation') . ':</td> - <td><select Name="X_InvoicePortraitFormat"> + <td><select name="X_InvoicePortraitFormat"> <option '.($_SESSION['InvoicePortraitFormat']=='0'?'selected ':'').'value="0">'._('Landscape').'</option> <option '.($_SESSION['InvoicePortraitFormat']=='1'?'selected ':'').'value="1">'._('Portrait').'</option> </select></td> @@ -454,7 +454,7 @@ //Blind packing note echo '<tr style="outline: 1px solid"><td>' . _('Show company details on packing slips') . ':</td> - <td><select Name="X_DefaultBlindPackNote"> + <td><select name="X_DefaultBlindPackNote"> <option '.($_SESSION['DefaultBlindPackNote']=='1'?'selected ':'').'value="1">'._('Show Company Details').'</option> <option '.($_SESSION['DefaultBlindPackNote']=='2'?'selected ':'').'value="2">'._('Hide Company Details').'</option> </select></td> @@ -463,7 +463,7 @@ // Working days on a week echo '<tr style="outline: 1px solid"><td>' . _('Working Days on a Week') . ':</td> - <td><select Name="X_WorkingDaysWeek"> + <td><select name="X_WorkingDaysWeek"> <option '.($_SESSION['WorkingDaysWeek']=='7'?'selected ':'').'value="7">7 '._('working days').'</option> <option '.($_SESSION['WorkingDaysWeek']=='6'?'selected ':'').'value="6">6 '._('working days').'</option> <option '.($_SESSION['WorkingDaysWeek']=='5'?'selected ':'').'value="5">5 '._('working days').'</option> @@ -473,7 +473,7 @@ // DispatchCutOffTime echo '<tr style="outline: 1px solid"><td>' . _('Dispatch Cut-Off Time') . ':</td> - <td><select Name="X_DispatchCutOffTime">'; + <td><select name="X_DispatchCutOffTime">'; for ($i=0; $i < 24; $i++ ) echo '<option '.($_SESSION['DispatchCutOffTime'] == $i?'selected ':'').'value="'.$i.'">'.$i; echo '</select></td> @@ -481,7 +481,7 @@ // AllowSalesOfZeroCostItems echo '<tr style="outline: 1px solid"><td>' . _('Allow Sales Of Zero Cost Items') . ':</td> - <td><select Name="X_AllowSalesOfZeroCostItems"> + <td><select name="X_AllowSalesOfZeroCostItems"> <option '.($_SESSION['AllowSalesOfZeroCostItems']?'selected ':'').'value="1">'._('Yes').'</option> <option '.(!$_SESSION['AllowSalesOfZeroCostItems']?'selected ':'').'value="0">'._('No').'</option> </select></td> @@ -489,7 +489,7 @@ // CreditingControlledItems_MustExist echo '<tr style="outline: 1px solid"><td>' . _('Controlled Items Must Exist For Crediting') . ':</td> - <td><select Name="X_CreditingControlledItems_MustExist"> + <td><select name="X_CreditingControlledItems_MustExist"> <option '.($_SESSION['CreditingControlledItems_MustExist']?'selected ':'').'value="1">'._('Yes').'</option> <option '.(!$_SESSION['CreditingControlledItems_MustExist']?'selected ':'').'value="0">'._('No').'</option> </select></td> @@ -500,7 +500,7 @@ $ErrMsg = _('Could not load price lists'); $result = DB_query($sql,$db,$ErrMsg); echo '<tr style="outline: 1px solid"><td>' . _('Default Price List') . ':</td>'; -echo '<td><select Name="X_DefaultPriceList">'; +echo '<td><select name="X_DefaultPriceList">'; if( DB_num_rows($result) == 0 ) { echo '<option selected value="">'._('Unavailable'); } else { @@ -516,7 +516,7 @@ $ErrMsg = _('Could not load shippers'); $result = DB_query($sql,$db,$ErrMsg); echo '<tr style="outline: 1px solid"><td>' . _('Default Shipper') . ':</td>'; -echo '<td><select Name="X_Default_Shipper">'; +echo '<td><select name="X_Default_Shipper">'; if( DB_num_rows($result) == 0 ) { echo '<option selected value="">'._('Unavailable') . '</option>'; } else { @@ -529,7 +529,7 @@ // DoFreightCalc echo '<tr style="outline: 1px solid"><td>' . _('Do Freight Calculation') . ':</td> - <td><select Name="X_DoFreightCalc"> + <td><select name="X_DoFreightCalc"> <option '.($_SESSION['DoFreightCalc']?'selected ':'').'value="1">'._('Yes').'</option> <option '.(!$_SESSION['DoFreightCalc']?'selected ':'').'value="0">'._('No').'</option> </select></td> @@ -537,13 +537,13 @@ //FreightChargeAppliesIfLessThan echo '<tr style="outline: 1px solid"><td>' . _('Apply freight charges if an order is less than') . ':</td> - <td><input type="Text" class="number" Name="X_FreightChargeAppliesIfLessThan" size=12 maxlength=12 value="' . $_SESSION['FreightChargeAppliesIfLessThan'] . '"></td> + <td><input type="text" class="number" name="X_FreightChargeAppliesIfLessThan" size=12 maxlength=12 value="' . $_SESSION['FreightChargeAppliesIfLessThan'] . '"></td> <td>' . _('This parameter is only effective if Do Freight Calculation is set to Yes. If it is set to 0 then freight is always charged. The total order value is compared to this value in deciding whether or not to charge freight') .'</td></tr>'; // AutoDebtorNo echo '<tr style="outline: 1px solid"><td>' . _('Create Debtor Codes Automatically') . ':</td> - <td><select Name="X_AutoDebtorNo">'; + <td><select name="X_AutoDebtorNo">'; if ($_SESSION['AutoDebtorNo']==0) { echo '<option selected value=0>' . _('Manual Entry') . '</option>'; @@ -560,7 +560,7 @@ $ErrMsg = _('Could not load tax categories table'); $result = DB_query($sql,$db,$ErrMsg); echo '<tr style="outline: 1px solid"><td>' . _('Default Tax Category') . ':</td>'; -echo '<td><select Name="X_DefaultTaxCategory">'; +echo '<td><select name="X_DefaultTaxCategory">'; if( DB_num_rows($result) == 0 ) { echo '<option selected value="">'._('Unavailable') . '</option>'; } else { @@ -573,8 +573,8 @@ //TaxAuthorityReferenceName -echo '<tr style="outline: 1px solid"><td>' . _('TaxAuthorityReferenceName') . ':</td> - <td><input type="Text" Name="X_TaxAuthotaxcatid, taxcatname FROM taxcategoriesrityReferenceName" size=16 maxlength=25 value="' . $_SESSION['TaxAuthorityReferenceName'] . '"></td> +echo '<tr style="outline: 1px solid"><td>' . _('Tax Authority Reference Name') . ':</td> + <td><input type="text" name="X_TaxAuthorityReferenceName" size="16" maxlength="25" value="' . $_SESSION['TaxAuthorityReferenceName'] . '"></td> <td>' . _('This parameter is what is displayed on tax invoices and credits for the tax authority of the company eg. in Australian this would by A.B.N.: - in NZ it would be GST No: in the UK it would be VAT Regn. No') .'</td></tr>'; // CountryOfOperation @@ -595,14 +595,14 @@ // NumberOfPeriodsOfStockUsage echo '<tr style="outline: 1px solid"><td>' . _('Number Of Periods Of StockUsage') . ':</td> - <td><select Name="X_NumberOfPeriodsOfStockUsage">'; + <td><select name="X_NumberOfPeriodsOfStockUsage">'; for ($i=1; $i <= 12; $i++ ) echo '<option '.($_SESSION['NumberOfPeriodsOfStockUsage'] == $i?'selected ':'').'value="'.$i.'">'.$i; echo '</select></td><td>' . _('In stock usage inquiries this determines how many periods of stock usage to show. An average is calculated over this many periods') .'</td></tr>'; //Show values on GRN echo '<tr style="outline: 1px solid"><td>' . _('Show order values on GRN') . ':</td> - <td><select Name="X_ShowValueOnGRN"> + <td><select name="X_ShowValueOnGRN"> <option '.($_SESSION['ShowValueOnGRN']?'selected ':'').'value="1">'._('Yes').'</option> <option '.(!$_SESSION['ShowValueOnGRN']?'selected ':'').'value="0">'._('No').'</option> </select></td> @@ -611,7 +611,7 @@ // Check_Qty_Charged_vs_Del_Qty echo '<tr style="outline: 1px solid"><td>' . _('Check Quantity Charged vs Deliver Qty') . ':</td> - <td><select Name="X_Check_Qty_Charged_vs_Del_Qty"> + <td><select name="X_Check_Qty_Charged_vs_Del_Qty"> <option '.($_SESSION['Check_Qty_Charged_vs_Del_Qty']?'selected ':'').'value="1">'._('Yes').'</option> <option '.(!$_SESSION['Check_Qty_Charged_vs_Del_Qty']?'selected ':'').'value="0">'._('No').'</option> </select></td> @@ -619,7 +619,7 @@ // Check_Price_Charged_vs_Order_Price echo '<tr style="outline: 1px solid"><td>' . _('Check Price Charged vs Order Price') . ':</td> - <td><select Name="X_Check_Price_Charged_vs_Order_Price"> + <td><select name="X_Check_Price_Charged_vs_Order_Price"> <option '.($_SESSION['Check_Price_Charged_vs_Order_Price']?'selected ':'').'value="1">'._('Yes').'</option> <option '.(!$_SESSION['Check_Price_Charged_vs_Order_Price']?'selected ':'').'value="0">'._('No').'</option> </select></td> @@ -627,24 +627,24 @@ // OverChargeProportion echo '<tr style="outline: 1px solid"><td>' . _('Allowed Over Charge Proportion') . ':</td> - <td><input type="Text" class="number" Name="X_OverChargeProportion" size=4 maxlength=3 value="' . $_SESSION['OverChargeProportion'] . '"></td> + <td><input type="text" class="number" name="X_OverChargeProportion" size=4 maxlength=3 value="' . $_SESSION['OverChargeProportion'] . '"></td> <td>' . _('If check price charges vs Order price is set to yes then this proportion determines the percentage by which invoices can be overcharged with respect to price') .'</td></tr>'; // OverReceiveProportion echo '<tr style="outline: 1px solid"><td>' . _('Allowed Over Receive Proportion') . ':</td> - <td><input type="Text" class="number" Name="X_OverReceiveProportion" size=4 maxlength=3 value="' . $_SESSION['OverReceiveProportion'] . '"></td> + <td><input type="text" class="number" name="X_OverReceiveProportion" size=4 maxlength=3 value="' . $_SESSION['OverReceiveProportion'] . '"></td> <td>' . _('If check quantity charged vs delivery quantity is set to yes then this proportion determines the percentage by which invoices can be overcharged with respect to delivery') .'</td></tr>'; // PO_AllowSameItemMultipleTimes echo '<tr style="outline: 1px solid"><td>' . _('Purchase Order Allows Same Item Multiple Times') . ':</td> - <td><select Name="X_PO_AllowSameItemMultipleTimes"> + <td><select name="X_PO_AllowSameItemMultipleTimes"> <option '.($_SESSION['PO_AllowSameItemMultipleTimes']?'selected ':'').'value="1">'._('Yes') . '</option> <option '.(!$_SESSION['PO_AllowSameItemMultipleTimes']?'selected ':'').'value="0">'._('No') . '</option> </select></td><td>' . _('If a purchase order can have the same item on the order several times this parameter should be set to yes') . '</td></tr>'; // AutoAuthorisePO echo '<tr style="outline: 1px solid"><td>' . _('Automatically authorise purchase orders if user has authority') . ':</td> - <td><select Name="X_AutoAuthorisePO"> + <td><select name="X_AutoAuthorisePO"> <option '.($_SESSION['AutoAuthorisePO'] ?'selected ':'').'value="1">'._('Yes').'</option> <option '.(!$_SESSION['AutoAuthorisePO'] ?'selected ':'').'value="0">'._('No').'</option> </select></td><td>' . _('If the user changing an existing purchase order or adding a new puchase order is set up to authorise purchase orders and the order is within their limit, then the purchase order status is automatically set to authorised') . '</td></tr>'; @@ -667,7 +667,7 @@ 11=>_('November'), 12=>_('December') ); echo '<tr style="outline: 1px solid"><td>' . _('Financial Year Ends On') . ':</td> - <td><select Name="X_YearEnd">'; + <td><select name="X_YearEnd">'; for ($i=1; $i <= sizeof($MonthNames); $i++ ) echo '<option '.($_SESSION['YearEnd'] == $i ? 'selected ' : '').'value="'.$i.'">'.$MonthNames[$i] . '</option>'; echo '</select></td> @@ -872,11 +872,14 @@ echo '<tr style="outline: 1px solid"><td>' . _('Prohibit GL Journals to Periods Prior To') . ':</td> - <td><select Name="X_ProhibitPostingsBefore">'; + <td><select name="X_ProhibitPostingsBefore">'; $sql = "SELECT lastdate_in_period FROM periods ORDER BY periodno DESC"; $ErrMsg = _('Could not load periods table'); $result = DB_query($sql,$db,$ErrMsg); +if ($_SESSION['ProhibitPostingsBefore']=='' OR $_SESSION['ProhibitPostingsBefore']=='1900-01-01' OR !isset($_SESSION['ProhibitPostingsBefore'])){ + echo '<option selected value="1900-01-01">' . ConvertSQLDate('1900-01-01') . '</option>'; +} while ($PeriodRow = DB_fetch_row($result)){ if ($_SESSION['ProhibitPostingsBefore']==$PeriodRow[0]){ echo '<option selected value="' . $PeriodRow[0] . '">' . ConvertSQLDate($PeriodRow[0]) . '</option>'; @@ -971,7 +974,7 @@ //DefineControlledOnWOEntry echo '<tr style="outline: 1px solid"><td>' . _('Controlled Items Defined At Work Order Entry') . ':</td> - <td><select Name="X_DefineControlledOnWOEntry"> + <td><select name="X_DefineControlledOnWOEntry"> <option '.($_SESSION['DefineControlledOnWOEntry']?'selected ':'').'value="1">'._('Yes').'</option> <option '.(!$_SESSION['DefineControlledOnWOEntry']?'selected ':'').'value="0">'._('No').'</option> </select></td> @@ -992,7 +995,7 @@ echo '</select></td><td>' . _('Setting this parameter to Yes will ensure that when a sales order is placed if there is insufficient stock then a new work order is created at the default factory location') . '</td></tr>' ; echo '<tr style="outline: 1px solid"><td>' . _('Default Factory Location') . ':</td> - <td><select Name="X_DefaultFactoryLocation">'; + <td><select name="X_DefaultFactoryLocation">'; $sql = "SELECT loccode,locationname FROM locations"; $ErrMsg = _('Could not load locations table'); @@ -1016,7 +1019,7 @@ echo '</table> - <br /><div class="centre"><input type="Submit" Name="submit" value="' . _('Update') . '"></div> + <br /><div class="centre"><input type="Submit" name="submit" value="' . _('Update') . '"></div> </form>'; include('includes/footer.inc'); Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2011-08-14 04:28:42 UTC (rev 4658) +++ trunk/doc/Change.log 2011-08-14 09:22:19 UTC (rev 4659) @@ -1,5 +1,6 @@ webERP Change Log +14/8/11 Phil: SystemParameters.php default ProhibitPostingsBefore to 1900-01-01 when no default is currently set - can cause errors at the moment as defaults to the latest period if not previously set. 14/8/11 Phil: Stocks.php now does a journal for any work in progress on a change of category where the new category has a different GL account for WIP - and bug fixes as per Ricard 12/8/11 Phil: Backed out changes on 7/8 that prevented SelectProduct.php transaction links - now only purchase order links blocked if an item is obsolete 12/8/11 Phil: CounterSales.php apply discountmatrix fixes This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-08-14 09:22:26
|
Revision: 4659 http://web-erp.svn.sourceforge.net/web-erp/?rev=4659&view=rev Author: daintree Date: 2011-08-14 09:22:19 +0000 (Sun, 14 Aug 2011) Log Message: ----------- 14/8/11 Phil: SystemParameters.php default ProhibitPostingsBefore to 1900-01-01 when no default is currently set - can cause errors at the moment as defaults to the latest period if not previously set. Modified Paths: -------------- trunk/SystemParameters.php trunk/doc/Change.log Modified: trunk/SystemParameters.php =================================================================== --- trunk/SystemParameters.php 2011-08-14 04:28:42 UTC (rev 4658) +++ trunk/SystemParameters.php 2011-08-14 09:22:19 UTC (rev 4659) @@ -326,7 +326,7 @@ // DefaultDateFormat echo '<tr style="outline: 1px solid"><td>' . _('Default Date Format') . ':</td> - <td><select Name="X_DefaultDateFormat"> + <td><select name="X_DefaultDateFormat"> <option '.(($_SESSION['DefaultDateFormat']=='d/m/Y')?'selected ':'').'Value="d/m/Y">d/m/Y</option> <option '.(($_SESSION['DefaultDateFormat']=='d.m.Y')?'selected ':'').'Value="d.m.Y">d.m.Y</option> <option '.(($_SESSION['DefaultDateFormat']=='m/d/Y')?'selected ':'').'Value="m/d/Y">m/d/Y</option> @@ -336,7 +336,7 @@ // DefaultTheme echo '<tr style="outline: 1px solid"><td>' . _('New Users Default Theme') . ':</td> - <td><select Name="X_DefaultTheme">'; + <td><select name="X_DefaultTheme">'; $ThemeDirectory = dir('css/'); while (false != ($ThemeName = $ThemeDirectory->read())){ if (is_dir("css/$ThemeName") AND $ThemeName != '.' AND $ThemeName != '..' AND $ThemeName != '.svn'){ @@ -354,23 +354,23 @@ // PastDueDays1 echo '<tr style="outline: 1px solid"><td>' . _('First Overdue Deadline in (days)') . ':</td> - <td><input type="Text" class="number" Name="X_PastDueDays1" value="' . $_SESSION['PastDueDays1'] . '" size=3 maxlength=3></td> + <td><input type="text" class="number" name="X_PastDueDays1" value="' . $_SESSION['PastDueDays1'] . '" size=3 maxlength=3></td> <td>' . _('Customer and supplier balances are displayed as overdue by this many days. This parameter is used on customer and supplier enquiry screens and aged listings') . '</td></tr>'; // PastDueDays2 echo '<tr style="outline: 1px solid"><td>' . _('Second Overdue Deadline in (days)') . ':</td> - <td><input type="Text" class="number" Name="X_PastDueDays2" value="' . $_SESSION['PastDueDays2'] . '" size=3 maxlength=3></td> + <td><input type="text" class="number" name="X_PastDueDays2" value="' . $_SESSION['PastDueDays2'] . '" size=3 maxlength=3></td> <td>' . _('As above but the next level of overdue') . '</td></tr>'; // DefaultCreditLimit echo '<tr style="outline: 1px solid"><td>' . _('Default Credit Limit') . ':</td> - <td><input type="Text" class="number" Name="X_DefaultCreditLimit" value="' . $_SESSION['DefaultCreditLimit'] . '" size=12 maxlength=12></td> + <td><input type="text" class="number" name="X_DefaultCreditLimit" value="' . $_SESSION['DefaultCreditLimit'] . '" size=12 maxlength=12></td> <td>' . _('The default used in new customer set up') . '</td></tr>'; // Check Credit Limits echo '<tr style="outline: 1px solid"><td>' . _('Check Credit Limits') . ':</td> - <td><select Name="X_CheckCreditLimits"> + <td><select name="X_CheckCreditLimits"> <option '.($_SESSION['CheckCreditLimits']==0?'selected ':'').'value="0">'._('Do not check').'</option> <option '.($_SESSION['CheckCreditLimits']==1?'selected ':'').'value="1">'._('Warn on breach').'</option> <option '.($_SESSION['CheckCreditLimits']==2?'selected ':'').'value="2">'._('Prohibit Sales').'</option> @@ -379,7 +379,7 @@ // Show_Settled_LastMonth echo '<tr style="outline: 1px solid"><td>' . _('Show Settled Last Month') . ':</td> - <td><select Name="X_Show_Settled_LastMonth"> + <td><select name="X_Show_Settled_LastMonth"> <option '.($_SESSION['Show_Settled_LastMonth']?'selected ':'').'value="1">'._('Yes').'</option> <option '.(!$_SESSION['Show_Settled_LastMonth']?'selected ':'').'value="0">'._('No').'</option> </select></td> @@ -387,29 +387,29 @@ //RomalpaClause echo '<tr style="outline: 1px solid"><td>' . _('Romalpa Clause') . ':</td> - <td><textarea Name="X_RomalpaClause" rows=3 cols=40>' . $_SESSION['RomalpaClause'] . '</textarea></td> + <td><textarea name="X_RomalpaClause" rows=3 cols=40>' . $_SESSION['RomalpaClause'] . '</textarea></td> <td>' . _('This text appears on invoices and credit notes in small print. Normally a reservation of title clause that gives the company rights to collect goods which have not been paid for - to give some protection for bad debts.') . '</td></tr>'; // QuickEntries echo '<tr style="outline: 1px solid"><td>' . _('Quick Entries') . ':</td> - <td><input type="Text" class="number" Name="X_QuickEntries" value="' . $_SESSION['QuickEntries'] . '" size=3 maxlength=2></td> + <td><input type="text" class="number" name="X_QuickEntries" value="' . $_SESSION['QuickEntries'] . '" size=3 maxlength=2></td> <td>' . _('This parameter defines the layout of the sales order entry screen. The number of fields available for quick entries. Any number from 1 to 99 can be entered.') . '</td></tr>'; // Frequently Ordered Items echo '<tr style="outline: 1px solid"><td>' . _('Frequently Ordered Items') . ':</td> - <td><input type="Text" class="number" Name="X_FrequentlyOrderedItems" value="' . $_SESSION['FrequentlyOrderedItems'] . '" size=3 maxlength=2></td> + <td><input type="text" class="number" name="X_FrequentlyOrderedItems" value="' . $_SESSION['FrequentlyOrderedItems'] . '" size=3 maxlength=2></td> <td>' . _('To show the most frequently ordered items enter the number of frequently ordered items you wish to display from 1 to 99. If you do not wish to display the frequently ordered item list enter 0.') . '</td></tr>'; // SO_AllowSameItemMultipleTimes echo '<tr style="outline: 1px solid"><td>' . _('Sales Order Allows Same Item Multiple Times') . ':</td> - <td><select Name="X_SO_AllowSameItemMultipleTimes"> + <td><select name="X_SO_AllowSameItemMultipleTimes"> <option '.($_SESSION['SO_AllowSameItemMultipleTimes']?'selected ':'').'value="1">'._('Yes').'</option> <option '.(!$_SESSION['SO_AllowSameItemMultipleTimes']?'selected ':'').'value="0">'._('No').'</option> </select></td><td> </td></tr>'; //'AllowOrderLineItemNarrative' echo '<tr style="outline: 1px solid"><td>' . _('Order Entry allows Line Item Narrative') . ':</td> - <td><select Name="X_AllowOrderLineItemNarrative"> + <td><select name="X_AllowOrderLineItemNarrative"> <option '.($_SESSION['AllowOrderLineItemNarrative']=='1'?'selected ':'').'value="1">'._('Allow Narrative Entry').'</option> <option '.($_SESSION['AllowOrderLineItemNarrative']=='0'?'selected ':'').'value="0">'._('No Narrative Line').'</option> </select></td> @@ -418,7 +418,7 @@ //'RequirePickingNote' echo '<tr style="outline: 1px solid"><td>' . _('A picking note must be produced before an order can be delivered') . ':</td> - <td><select Name="X_RequirePickingNote"> + <td><select name="X_RequirePickingNote"> <option '.($_SESSION['RequirePickingNote']=='1'?'selected ':'').'value="1">'._('Yes').'</option> <option '.($_SESSION['RequirePickingNote']=='0'?'selected ':'').'value="0">'._('No').'</option> </select></td> @@ -427,7 +427,7 @@ //UpdateCurrencyRatesDaily echo '<tr style="outline: 1px solid"><td>' . _('Auto Update Exchange Rates Daily') . ':</td> - <td><select Name="X_UpdateCurrencyRatesDaily"> + <td><select name="X_UpdateCurrencyRatesDaily"> <option '.($_SESSION['UpdateCurrencyRatesDaily']!='1'?'selected ':'').'value="1">'._('Automatic').'</option> <option '.($_SESSION['UpdateCurrencyRatesDaily']=='0'?'selected ':'').'value="0">'._('Manual').'</option> </select></td> @@ -436,7 +436,7 @@ //Default Packing Note Format echo '<tr style="outline: 1px solid"><td>' . _('Format of Packing Slips') . ':</td> - <td><select Name="X_PackNoteFormat"> + <td><select name="X_PackNoteFormat"> <option '.($_SESSION['PackNoteFormat']=='1'?'selected ':'').'value="1">'._('Laser Printed').'</option> <option '.($_SESSION['PackNoteFormat']=='2'?'selected ':'').'value="2">'._('Special Stationery').'</option> </select></td> @@ -445,7 +445,7 @@ //Default Invoice Format echo '<tr style="outline: 1px solid"><td>' . _('Invoice Orientation') . ':</td> - <td><select Name="X_InvoicePortraitFormat"> + <td><select name="X_InvoicePortraitFormat"> <option '.($_SESSION['InvoicePortraitFormat']=='0'?'selected ':'').'value="0">'._('Landscape').'</option> <option '.($_SESSION['InvoicePortraitFormat']=='1'?'selected ':'').'value="1">'._('Portrait').'</option> </select></td> @@ -454,7 +454,7 @@ //Blind packing note echo '<tr style="outline: 1px solid"><td>' . _('Show company details on packing slips') . ':</td> - <td><select Name="X_DefaultBlindPackNote"> + <td><select name="X_DefaultBlindPackNote"> <option '.($_SESSION['DefaultBlindPackNote']=='1'?'selected ':'').'value="1">'._('Show Company Details').'</option> <option '.($_SESSION['DefaultBlindPackNote']=='2'?'selected ':'').'value="2">'._('Hide Company Details').'</option> </select></td> @@ -463,7 +463,7 @@ // Working days on a week echo '<tr style="outline: 1px solid"><td>' . _('Working Days on a Week') . ':</td> - <td><select Name="X_WorkingDaysWeek"> + <td><select name="X_WorkingDaysWeek"> <option '.($_SESSION['WorkingDaysWeek']=='7'?'selected ':'').'value="7">7 '._('working days').'</option> <option '.($_SESSION['WorkingDaysWeek']=='6'?'selected ':'').'value="6">6 '._('working days').'</option> <option '.($_SESSION['WorkingDaysWeek']=='5'?'selected ':'').'value="5">5 '._('working days').'</option> @@ -473,7 +473,7 @@ // DispatchCutOffTime echo '<tr style="outline: 1px solid"><td>' . _('Dispatch Cut-Off Time') . ':</td> - <td><select Name="X_DispatchCutOffTime">'; + <td><select name="X_DispatchCutOffTime">'; for ($i=0; $i < 24; $i++ ) echo '<option '.($_SESSION['DispatchCutOffTime'] == $i?'selected ':'').'value="'.$i.'">'.$i; echo '</select></td> @@ -481,7 +481,7 @@ // AllowSalesOfZeroCostItems echo '<tr style="outline: 1px solid"><td>' . _('Allow Sales Of Zero Cost Items') . ':</td> - <td><select Name="X_AllowSalesOfZeroCostItems"> + <td><select name="X_AllowSalesOfZeroCostItems"> <option '.($_SESSION['AllowSalesOfZeroCostItems']?'selected ':'').'value="1">'._('Yes').'</option> <option '.(!$_SESSION['AllowSalesOfZeroCostItems']?'selected ':'').'value="0">'._('No').'</option> </select></td> @@ -489,7 +489,7 @@ // CreditingControlledItems_MustExist echo '<tr style="outline: 1px solid"><td>' . _('Controlled Items Must Exist For Crediting') . ':</td> - <td><select Name="X_CreditingControlledItems_MustExist"> + <td><select name="X_CreditingControlledItems_MustExist"> <option '.($_SESSION['CreditingControlledItems_MustExist']?'selected ':'').'value="1">'._('Yes').'</option> <option '.(!$_SESSION['CreditingControlledItems_MustExist']?'selected ':'').'value="0">'._('No').'</option> </select></td> @@ -500,7 +500,7 @@ $ErrMsg = _('Could not load price lists'); $result = DB_query($sql,$db,$ErrMsg); echo '<tr style="outline: 1px solid"><td>' . _('Default Price List') . ':</td>'; -echo '<td><select Name="X_DefaultPriceList">'; +echo '<td><select name="X_DefaultPriceList">'; if( DB_num_rows($result) == 0 ) { echo '<option selected value="">'._('Unavailable'); } else { @@ -516,7 +516,7 @@ $ErrMsg = _('Could not load shippers'); $result = DB_query($sql,$db,$ErrMsg); echo '<tr style="outline: 1px solid"><td>' . _('Default Shipper') . ':</td>'; -echo '<td><select Name="X_Default_Shipper">'; +echo '<td><select name="X_Default_Shipper">'; if( DB_num_rows($result) == 0 ) { echo '<option selected value="">'._('Unavailable') . '</option>'; } else { @@ -529,7 +529,7 @@ // DoFreightCalc echo '<tr style="outline: 1px solid"><td>' . _('Do Freight Calculation') . ':</td> - <td><select Name="X_DoFreightCalc"> + <td><select name="X_DoFreightCalc"> <option '.($_SESSION['DoFreightCalc']?'selected ':'').'value="1">'._('Yes').'</option> <option '.(!$_SESSION['DoFreightCalc']?'selected ':'').'value="0">'._('No').'</option> </select></td> @@ -537,13 +537,13 @@ //FreightChargeAppliesIfLessThan echo '<tr style="outline: 1px solid"><td>' . _('Apply freight charges if an order is less than') . ':</td> - <td><input type="Text" class="number" Name="X_FreightChargeAppliesIfLessThan" size=12 maxlength=12 value="' . $_SESSION['FreightChargeAppliesIfLessThan'] . '"></td> + <td><input type="text" class="number" name="X_FreightChargeAppliesIfLessThan" size=12 maxlength=12 value="' . $_SESSION['FreightChargeAppliesIfLessThan'] . '"></td> <td>' . _('This parameter is only effective if Do Freight Calculation is set to Yes. If it is set to 0 then freight is always charged. The total order value is compared to this value in deciding whether or not to charge freight') .'</td></tr>'; // AutoDebtorNo echo '<tr style="outline: 1px solid"><td>' . _('Create Debtor Codes Automatically') . ':</td> - <td><select Name="X_AutoDebtorNo">'; + <td><select name="X_AutoDebtorNo">'; if ($_SESSION['AutoDebtorNo']==0) { echo '<option selected value=0>' . _('Manual Entry') . '</option>'; @@ -560,7 +560,7 @@ $ErrMsg = _('Could not load tax categories table'); $result = DB_query($sql,$db,$ErrMsg); echo '<tr style="outline: 1px solid"><td>' . _('Default Tax Category') . ':</td>'; -echo '<td><select Name="X_DefaultTaxCategory">'; +echo '<td><select name="X_DefaultTaxCategory">'; if( DB_num_rows($result) == 0 ) { echo '<option selected value="">'._('Unavailable') . '</option>'; } else { @@ -573,8 +573,8 @@ //TaxAuthorityReferenceName -echo '<tr style="outline: 1px solid"><td>' . _('TaxAuthorityReferenceName') . ':</td> - <td><input type="Text" Name="X_TaxAuthotaxcatid, taxcatname FROM taxcategoriesrityReferenceName" size=16 maxlength=25 value="' . $_SESSION['TaxAuthorityReferenceName'] . '"></td> +echo '<tr style="outline: 1px solid"><td>' . _('Tax Authority Reference Name') . ':</td> + <td><input type="text" name="X_TaxAuthorityReferenceName" size="16" maxlength="25" value="' . $_SESSION['TaxAuthorityReferenceName'] . '"></td> <td>' . _('This parameter is what is displayed on tax invoices and credits for the tax authority of the company eg. in Australian this would by A.B.N.: - in NZ it would be GST No: in the UK it would be VAT Regn. No') .'</td></tr>'; // CountryOfOperation @@ -595,14 +595,14 @@ // NumberOfPeriodsOfStockUsage echo '<tr style="outline: 1px solid"><td>' . _('Number Of Periods Of StockUsage') . ':</td> - <td><select Name="X_NumberOfPeriodsOfStockUsage">'; + <td><select name="X_NumberOfPeriodsOfStockUsage">'; for ($i=1; $i <= 12; $i++ ) echo '<option '.($_SESSION['NumberOfPeriodsOfStockUsage'] == $i?'selected ':'').'value="'.$i.'">'.$i; echo '</select></td><td>' . _('In stock usage inquiries this determines how many periods of stock usage to show. An average is calculated over this many periods') .'</td></tr>'; //Show values on GRN echo '<tr style="outline: 1px solid"><td>' . _('Show order values on GRN') . ':</td> - <td><select Name="X_ShowValueOnGRN"> + <td><select name="X_ShowValueOnGRN"> <option '.($_SESSION['ShowValueOnGRN']?'selected ':'').'value="1">'._('Yes').'</option> <option '.(!$_SESSION['ShowValueOnGRN']?'selected ':'').'value="0">'._('No').'</option> </select></td> @@ -611,7 +611,7 @@ // Check_Qty_Charged_vs_Del_Qty echo '<tr style="outline: 1px solid"><td>' . _('Check Quantity Charged vs Deliver Qty') . ':</td> - <td><select Name="X_Check_Qty_Charged_vs_Del_Qty"> + <td><select name="X_Check_Qty_Charged_vs_Del_Qty"> <option '.($_SESSION['Check_Qty_Charged_vs_Del_Qty']?'selected ':'').'value="1">'._('Yes').'</option> <option '.(!$_SESSION['Check_Qty_Charged_vs_Del_Qty']?'selected ':'').'value="0">'._('No').'</option> </select></td> @@ -619,7 +619,7 @@ // Check_Price_Charged_vs_Order_Price echo '<tr style="outline: 1px solid"><td>' . _('Check Price Charged vs Order Price') . ':</td> - <td><select Name="X_Check_Price_Charged_vs_Order_Price"> + <td><select name="X_Check_Price_Charged_vs_Order_Price"> <option '.($_SESSION['Check_Price_Charged_vs_Order_Price']?'selected ':'').'value="1">'._('Yes').'</option> <option '.(!$_SESSION['Check_Price_Charged_vs_Order_Price']?'selected ':'').'value="0">'._('No').'</option> </select></td> @@ -627,24 +627,24 @@ // OverChargeProportion echo '<tr style="outline: 1px solid"><td>' . _('Allowed Over Charge Proportion') . ':</td> - <td><input type="Text" class="number" Name="X_OverChargeProportion" size=4 maxlength=3 value="' . $_SESSION['OverChargeProportion'] . '"></td> + <td><input type="text" class="number" name="X_OverChargeProportion" size=4 maxlength=3 value="' . $_SESSION['OverChargeProportion'] . '"></td> <td>' . _('If check price charges vs Order price is set to yes then this proportion determines the percentage by which invoices can be overcharged with respect to price') .'</td></tr>'; // OverReceiveProportion echo '<tr style="outline: 1px solid"><td>' . _('Allowed Over Receive Proportion') . ':</td> - <td><input type="Text" class="number" Name="X_OverReceiveProportion" size=4 maxlength=3 value="' . $_SESSION['OverReceiveProportion'] . '"></td> + <td><input type="text" class="number" name="X_OverReceiveProportion" size=4 maxlength=3 value="' . $_SESSION['OverReceiveProportion'] . '"></td> <td>' . _('If check quantity charged vs delivery quantity is set to yes then this proportion determines the percentage by which invoices can be overcharged with respect to delivery') .'</td></tr>'; // PO_AllowSameItemMultipleTimes echo '<tr style="outline: 1px solid"><td>' . _('Purchase Order Allows Same Item Multiple Times') . ':</td> - <td><select Name="X_PO_AllowSameItemMultipleTimes"> + <td><select name="X_PO_AllowSameItemMultipleTimes"> <option '.($_SESSION['PO_AllowSameItemMultipleTimes']?'selected ':'').'value="1">'._('Yes') . '</option> <option '.(!$_SESSION['PO_AllowSameItemMultipleTimes']?'selected ':'').'value="0">'._('No') . '</option> </select></td><td>' . _('If a purchase order can have the same item on the order several times this parameter should be set to yes') . '</td></tr>'; // AutoAuthorisePO echo '<tr style="outline: 1px solid"><td>' . _('Automatically authorise purchase orders if user has authority') . ':</td> - <td><select Name="X_AutoAuthorisePO"> + <td><select name="X_AutoAuthorisePO"> <option '.($_SESSION['AutoAuthorisePO'] ?'selected ':'').'value="1">'._('Yes').'</option> <option '.(!$_SESSION['AutoAuthorisePO'] ?'selected ':'').'value="0">'._('No').'</option> </select></td><td>' . _('If the user changing an existing purchase order or adding a new puchase order is set up to authorise purchase orders and the order is within their limit, then the purchase order status is automatically set to authorised') . '</td></tr>'; @@ -667,7 +667,7 @@ 11=>_('November'), 12=>_('December') ); echo '<tr style="outline: 1px solid"><td>' . _('Financial Year Ends On') . ':</td> - <td><select Name="X_YearEnd">'; + <td><select name="X_YearEnd">'; for ($i=1; $i <= sizeof($MonthNames); $i++ ) echo '<option '.($_SESSION['YearEnd'] == $i ? 'selected ' : '').'value="'.$i.'">'.$MonthNames[$i] . '</option>'; echo '</select></td> @@ -872,11 +872,14 @@ echo '<tr style="outline: 1px solid"><td>' . _('Prohibit GL Journals to Periods Prior To') . ':</td> - <td><select Name="X_ProhibitPostingsBefore">'; + <td><select name="X_ProhibitPostingsBefore">'; $sql = "SELECT lastdate_in_period FROM periods ORDER BY periodno DESC"; $ErrMsg = _('Could not load periods table'); $result = DB_query($sql,$db,$ErrMsg); +if ($_SESSION['ProhibitPostingsBefore']=='' OR $_SESSION['ProhibitPostingsBefore']=='1900-01-01' OR !isset($_SESSION['ProhibitPostingsBefore'])){ + echo '<option selected value="1900-01-01">' . ConvertSQLDate('1900-01-01') . '</option>'; +} while ($PeriodRow = DB_fetch_row($result)){ if ($_SESSION['ProhibitPostingsBefore']==$PeriodRow[0]){ echo '<option selected value="' . $PeriodRow[0] . '">' . ConvertSQLDate($PeriodRow[0]) . '</option>'; @@ -971,7 +974,7 @@ //DefineControlledOnWOEntry echo '<tr style="outline: 1px solid"><td>' . _('Controlled Items Defined At Work Order Entry') . ':</td> - <td><select Name="X_DefineControlledOnWOEntry"> + <td><select name="X_DefineControlledOnWOEntry"> <option '.($_SESSION['DefineControlledOnWOEntry']?'selected ':'').'value="1">'._('Yes').'</option> <option '.(!$_SESSION['DefineControlledOnWOEntry']?'selected ':'').'value="0">'._('No').'</option> </select></td> @@ -992,7 +995,7 @@ echo '</select></td><td>' . _('Setting this parameter to Yes will ensure that when a sales order is placed if there is insufficient stock then a new work order is created at the default factory location') . '</td></tr>' ; echo '<tr style="outline: 1px solid"><td>' . _('Default Factory Location') . ':</td> - <td><select Name="X_DefaultFactoryLocation">'; + <td><select name="X_DefaultFactoryLocation">'; $sql = "SELECT loccode,locationname FROM locations"; $ErrMsg = _('Could not load locations table'); @@ -1016,7 +1019,7 @@ echo '</table> - <br /><div class="centre"><input type="Submit" Name="submit" value="' . _('Update') . '"></div> + <br /><div class="centre"><input type="Submit" name="submit" value="' . _('Update') . '"></div> </form>'; include('includes/footer.inc'); Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2011-08-14 04:28:42 UTC (rev 4658) +++ trunk/doc/Change.log 2011-08-14 09:22:19 UTC (rev 4659) @@ -1,5 +1,6 @@ webERP Change Log +14/8/11 Phil: SystemParameters.php default ProhibitPostingsBefore to 1900-01-01 when no default is currently set - can cause errors at the moment as defaults to the latest period if not previously set. 14/8/11 Phil: Stocks.php now does a journal for any work in progress on a change of category where the new category has a different GL account for WIP - and bug fixes as per Ricard 12/8/11 Phil: Backed out changes on 7/8 that prevented SelectProduct.php transaction links - now only purchase order links blocked if an item is obsolete 12/8/11 Phil: CounterSales.php apply discountmatrix fixes This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-08-14 04:28:49
|
Revision: 4658 http://web-erp.svn.sourceforge.net/web-erp/?rev=4658&view=rev Author: daintree Date: 2011-08-14 04:28:42 +0000 (Sun, 14 Aug 2011) Log Message: ----------- 14/8/11 Phil: Stocks.php now does a journal for any work in progress on a change of category where the new category has a different GL account for WIP - and bug fixes as per Ricard Modified Paths: -------------- trunk/Stocks.php trunk/WorkOrderCosting.php trunk/doc/Change.log trunk/includes/session.inc trunk/install/save.php Modified: trunk/Stocks.php =================================================================== --- trunk/Stocks.php 2011-08-12 11:01:35 UTC (rev 4657) +++ trunk/Stocks.php 2011-08-14 04:28:42 UTC (rev 4658) @@ -5,6 +5,7 @@ include('includes/session.inc'); $title = _('Item Maintenance'); include('includes/header.inc'); +include('includes/SQL_CommonFunctions.inc'); /*If this form is called with the StockID then it is assumed that the stock item is to be modified */ @@ -213,7 +214,8 @@ controlled, serialised, materialcost+labourcost+overheadcost AS itemcost, - stockcategory.stockact + stockcategory.stockact, + stockcategory.wipact FROM stockmaster INNER JOIN stockcategory ON stockmaster.categoryid=stockcategory.categoryid @@ -225,6 +227,8 @@ $OldSerialised = $myrow[2]; $UnitCost = $myrow[3]; $OldStockAccount = $myrow[4]; + $OldWIPAccount = $myrow[5]; + $sql = "SELECT SUM(locstock.quantity) FROM locstock @@ -235,12 +239,14 @@ /*Now check the GL account of the new category to see if it is different to the old stock gl account */ - $result = DB_query("SELECT stockact + $result = DB_query("SELECT stockact, + wipact FROM stockcategory WHERE categoryid='" . $_POST['CategoryID'] . "'", $db); $NewStockActRow = DB_fetch_array($result); $NewStockAct = $NewStockActRow['stockact']; + $NewWIPAct = $NewStockActRow['wipact']; if ($OldMBFlag != $_POST['MBFlag']){ if (($OldMBFlag == 'M' OR $OldMBFlag=='B') AND ($_POST['MBFlag']=='A' OR $_POST['MBFlag']=='K' OR $_POST['MBFlag']=='D' OR $_POST['MBFlag']=='G')){ /*then need to check that there is no stock holding first */ @@ -378,7 +384,7 @@ $db,$ErrMsg,$DbgMsg,true); } //end of loop around properties defined for the category - if ($OldStockAccount != $NewStockAct AND $_SESSION['CompanyRecord']['gllinkstock']==1) { + if ($OldStockAccount != $NewStockAct AND $_SESSION['CompanyRecord']['gllink_stock']==1) { /*Then we need to make a journal to transfer the cost to the new stock account */ $JournalNo = GetNextTransNo(0,$db); //enter as a journal $SQL = "INSERT INTO gltrans (type, @@ -391,13 +397,13 @@ VALUES ( 0, '" . $JournalNo . "', '" . Date('Y-m-d') . "', - '" . GetPeriodNo(Date('Y-m-d'),true) . "', + '" . GetPeriod(Date('Y-m-d'),$db,true) . "', '" . $NewStockAccount . "', '" . $StockID . ' ' . _('Change stock category') . "', '" . ($UnitCost* $StockQtyRow[0]) . "'"; $ErrMsg = _('The stock cost journal could not be inserted because'); $DbgMsg = _('The SQL that was used to create the stock cost journal and failed was'); - $result = DB_query($sql,$db, $ErrMsg, $DbgMsg,true); + $result = DB_query($SQL,$db, $ErrMsg, $DbgMsg,true); $SQL = "INSERT INTO gltrans (type, typeno, trandate, @@ -408,13 +414,68 @@ VALUES ( 0, '" . $JournalNo . "', '" . Date('Y-m-d') . "', - '" . GetPeriodNo(Date('Y-m-d'),true) . "', + '" . GetPeriod(Date('Y-m-d'),$db,true) . "', '" . $OldStockAccount . "', '" . $StockID . ' ' . _('Change stock category') . "', '" . (-$UnitCost* $StockQtyRow[0]) . "'"; - $result = DB_query($sql,$db, $ErrMsg, $DbgMsg,true); + $result = DB_query($SQL,$db, $ErrMsg, $DbgMsg,true); } /* end if the stock category changed and forced a change in stock cost account */ + if ($OldWIPAccount != $NewWIPAct AND $_SESSION['CompanyRecord']['gllink_stock']==1) { + /*Then we need to make a journal to transfer the cost of WIP to the new WIP account */ + /*First get the total cost of WIP for this category */ + + $WOCostsResult = DB_query("SELECT workorders.costissued, + SUM(woitems.qtyreqd * woitems.stdcost) AS costrecd + FROM woitems INNER JOIN workorders + ON woitems.wo = workorders.wo + INNER JOIN stockmaster + ON woitems.stockid=stockmaster.stockid + WHERE stockmaster.stockid='". $StockID . "' + AND workorders.closed=0 + GROUP BY workorders.costissued", + $db, + _('Error retrieving value of finished goods received and cost issued against work orders for this item')); + $WIPValue = 0; + while ($WIPRow=DB_fetch_array($WOCostsResult)){ + $WIPValue += ($WIPRow['costissued']-$WIPRow['costrecd']); + } + if ($WIPValue !=0){ + $JournalNo = GetNextTransNo(0,$db); //enter as a journal + $SQL = "INSERT INTO gltrans (type, + typeno, + trandate, + periodno, + account, + narrative, + amount) + VALUES ( 0, + '" . $JournalNo . "', + '" . Date('Y-m-d') . "', + '" . GetPeriod(Date('Y-m-d'),$db,true) . "', + '" . $NewWIPAct . "', + '" . $StockID . ' ' . _('Change stock category') . "', + '" . $WIPValue . "'"; + $ErrMsg = _('The WIP cost journal could not be inserted because'); + $DbgMsg = _('The SQL that was used to create the WIP cost journal and failed was'); + $result = DB_query($SQL,$db, $ErrMsg, $DbgMsg,true); + $SQL = "INSERT INTO gltrans (type, + typeno, + trandate, + periodno, + account, + narrative, + amount) + VALUES ( 0, + '" . $JournalNo . "', + '" . Date('Y-m-d') . "', + '" . GetPeriod(Date('Y-m-d'),true) . "', + '" . $OldWIPAccount . "', + '" . $StockID . ' ' . _('Change stock category') . "', + '" . (-$WIPValue) . "'"; + $result = DB_query($SQL,$db, $ErrMsg, $DbgMsg,true); + } + } /* end if the stock category changed and forced a change in WIP account */ DB_Txn_Commit($db); prnMsg( _('Stock Item') . ' ' . $StockID . ' ' . _('has been updated'), 'success'); echo '<br />'; @@ -512,11 +573,12 @@ unset($_POST['ShrinkFactor']); unset($_POST['Pansize']); unset($StockID); + $New=1; }//ALL WORKED SO RESET THE FORM VARIABLES }//THE INSERT OF THE NEW CODE WORKED SO BANG IN THE STOCK LOCATION RECORDS TOO }//END CHECK FOR ALREADY EXISTING ITEM OF THE SAME CODE } - $New=1; + } else { echo '<br />'. "\n"; Modified: trunk/WorkOrderCosting.php =================================================================== --- trunk/WorkOrderCosting.php 2011-08-12 11:01:35 UTC (rev 4657) +++ trunk/WorkOrderCosting.php 2011-08-14 04:28:42 UTC (rev 4658) @@ -77,7 +77,7 @@ $db, $ErrMsg); -echo '<table class=selection><tr><th>' . _('Item') . '</th> +echo '<table class="selection"><tr><th>' . _('Item') . '</th> <th>' . _('Description') . '</th> <th>' . _('Quantity Required') . '</th> <th>' . _('Units') . '</th> @@ -91,12 +91,12 @@ echo '<tr><td>' . $WORow['stockid'] . '</td> <td>' . $WORow['description'] . '</td> - <td class=number>' . number_format($WORow['qtyreqd'],$WORow['decimalplaces']) . '</td> + <td class="number">' . number_format($WORow['qtyreqd'],$WORow['decimalplaces']) . '</td> <td>' . $WORow['units'] . '</td> - <td class=number>' . number_format($WORow['qtyrecd'],$WORow['decimalplaces']) . '</td> - <td class=number><a href="'. $rootpath . '/WorkOrderStatus.php?WO=' . $_POST['WO'] . '&StockID=' . $WORow['stockid'] . '">' . _('Status') . '</a></td> - <td class=number><a href="'. $rootpath . '/WorkOrderReceive.php?WO=' . $_POST['WO'] . '&StockID=' . $WORow['stockid'] . '">' . _('Receive') . '</a></td> - <td class=number><a href="'. $rootpath . '/WorkOrderIssue.php?WO=' . $_POST['WO'] . '&StockID=' . $WORow['stockid'] . '">' . _('Issue') . '</a></td> + <td class="number">' . number_format($WORow['qtyrecd'],$WORow['decimalplaces']) . '</td> + <td class="number"><a href="'. $rootpath . '/WorkOrderStatus.php?WO=' . $_POST['WO'] . '&StockID=' . $WORow['stockid'] . '">' . _('Status') . '</a></td> + <td class="number"><a href="'. $rootpath . '/WorkOrderReceive.php?WO=' . $_POST['WO'] . '&StockID=' . $WORow['stockid'] . '">' . _('Receive') . '</a></td> + <td class="number"><a href="'. $rootpath . '/WorkOrderIssue.php?WO=' . $_POST['WO'] . '&StockID=' . $WORow['stockid'] . '">' . _('Issue') . '</a></td> </tr>'; $TotalStdValueRecd +=($WORow['stdcost']*$WORow['qtyrecd']); @@ -174,8 +174,8 @@ echo '<tr class="OddTableRows">'; } echo '<td colspan=4></td><td>' . ConvertSQLDate($IssuesRow['trandate']) . '</td> - <td class=number>' . number_format(-$IssuesRow['qty'],$RequirementsRow['decimalplaces']) . '</td> - <td class=number>' . number_format(-($IssuesRow['qty']*$IssuesRow['standardcost']),$IssuesRow['decimalplaces']) . '</td></tr>'; + <td class="number">' . number_format(-$IssuesRow['qty'],$RequirementsRow['decimalplaces']) . '</td> + <td class="number">' . number_format(-($IssuesRow['qty']*$IssuesRow['standardcost']),$IssuesRow['decimalplaces']) . '</td></tr>'; $IssueQty -= $IssuesRow['qty'];// because qty for the stock movement will be negative $IssueCost -= ($IssuesRow['qty']*$IssuesRow['standardcost']); @@ -201,13 +201,13 @@ /*Required quantity is the quantity required of the component based on the quantity of the finished item received */ $UsageVar =($RequirementsRow['requiredqty']-$IssueQty)*($RequirementsRow['stdcost']); - echo '<td colspan="2"></td><td class=number>' . number_format($RequirementsRow['requiredqty'],$RequirementsRow['decimalplaces']) . '</td> - <td class=number>' . number_format($RequirementsRow['expectedcost'],$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + echo '<td colspan="2"></td><td class="number">' . number_format($RequirementsRow['requiredqty'],$RequirementsRow['decimalplaces']) . '</td> + <td class="number">' . number_format($RequirementsRow['expectedcost'],$_SESSION['CompanyRecord']['decimalplaces']) . '</td> <td></td> - <td class=number>' . number_format($IssueQty,$RequirementsRow['decimalplaces']) . '</td> - <td class=number>' . number_format($IssueCost,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> - <td class=number>' . number_format($UsageVar,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> - <td class=number>' . number_format($CostVar,$_SESSION['CompanyRecord']['decimalplaces']) . '</td></tr>'; + <td class="number">' . number_format($IssueQty,$RequirementsRow['decimalplaces']) . '</td> + <td class="number">' . number_format($IssueCost,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . number_format($UsageVar,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . number_format($CostVar,$_SESSION['CompanyRecord']['decimalplaces']) . '</td></tr>'; $TotalReqdCost += $RequirementsRow['expectedcost']; $TotalIssuedCost += $IssueCost; $TotalCostVar += $CostVar; @@ -252,13 +252,13 @@ echo '<td>' . $WOIssuesRow['stockid'] . '</td> <td>' . $WOIssuesRow['description'] . '</td> - <td class=number>0</td> - <td class=number>0</td> + <td class="number">0</td> + <td class="number">0</td> <td>' . ConvertSQLDate($WOIssuesRow['trandate']) . '</td> - <td class=number>' . number_format(-$WOIssuesRow['qty'],$WOIssuesRow['decimalplaces']) .'</td> - <td class=number>' . number_format(-$WOIssuesRow['qty']*$WOIssuesRow['standardcost'],$_SESSION['CompanyRecord']['decimalplaces']) .'</td> - <td class=number>' . number_format($WOIssuesRow['qty']*$WOIssuesRow['standardcost'],$_SESSION['CompanyRecord']['decimalplaces']) .'</td> - <td class=number>0</td></tr>'; + <td class="number">' . number_format(-$WOIssuesRow['qty'],$WOIssuesRow['decimalplaces']) .'</td> + <td class="number">' . number_format(-$WOIssuesRow['qty']*$WOIssuesRow['standardcost'],$_SESSION['CompanyRecord']['decimalplaces']) .'</td> + <td class="number">' . number_format($WOIssuesRow['qty']*$WOIssuesRow['standardcost'],$_SESSION['CompanyRecord']['decimalplaces']) .'</td> + <td class="number">0</td></tr>'; $TotalUsageVar += ($WOIssuesRow['qty']*$WOIssuesRow['standardcost']); } @@ -269,13 +269,13 @@ <td colspan="2"></td> <td colspan="3"><hr></td> </tr>'; -echo '<tr><td colspan="2" class=number>' . _('Totals') . '</td> +echo '<tr><td colspan="2" class="number">' . _('Totals') . '</td> <td></td> - <td class=number>' . number_format($TotalReqdCost,$_SESSION['CompanyRecord']['decimalplaces']) .'</td> + <td class="number">' . number_format($TotalReqdCost,$_SESSION['CompanyRecord']['decimalplaces']) .'</td> <td></td><td></td> - <td class=number>' . number_format($TotalIssuedCost,$_SESSION['CompanyRecord']['decimalplaces']) .'</td> - <td class=number>' . number_format($TotalUsageVar,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> - <td class=number>' . number_format($TotalCostVar,$_SESSION['CompanyRecord']['decimalplaces']) . '</td></tr>'; + <td class="number">' . number_format($TotalIssuedCost,$_SESSION['CompanyRecord']['decimalplaces']) .'</td> + <td class="number">' . number_format($TotalUsageVar,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . number_format($TotalCostVar,$_SESSION['CompanyRecord']['decimalplaces']) . '</td></tr>'; echo '<tr><td colspan="3"></td> <td><hr/></td> Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2011-08-12 11:01:35 UTC (rev 4657) +++ trunk/doc/Change.log 2011-08-14 04:28:42 UTC (rev 4658) @@ -1,5 +1,6 @@ webERP Change Log +14/8/11 Phil: Stocks.php now does a journal for any work in progress on a change of category where the new category has a different GL account for WIP - and bug fixes as per Ricard 12/8/11 Phil: Backed out changes on 7/8 that prevented SelectProduct.php transaction links - now only purchase order links blocked if an item is obsolete 12/8/11 Phil: CounterSales.php apply discountmatrix fixes 11/8/11 Phil: GoodsReceived.php now has checkbox to flag the order line as complete - even though the quantity delivered might be short of the order quantity. Modified: trunk/includes/session.inc =================================================================== --- trunk/includes/session.inc 2011-08-12 11:01:35 UTC (rev 4657) +++ trunk/includes/session.inc 2011-08-14 04:28:42 UTC (rev 4658) @@ -19,8 +19,12 @@ } ini_set('session.gc_Maxlifetime',$SessionLifeTime); -ini_set('max_execution_time',$MaximumExecutionTime); +if( !ini_get('safe_mode') ){ + set_time_limit($MaximumExecutionTime); + ini_set('max_execution_time',$MaximumExecutionTime); +} + session_start(); include($PathPrefix . 'includes/ConnectDB.inc'); Modified: trunk/install/save.php =================================================================== --- trunk/install/save.php 2011-08-12 11:01:35 UTC (rev 4657) +++ trunk/install/save.php 2011-08-14 04:28:42 UTC (rev 4658) @@ -3,6 +3,8 @@ error_reporting(E_ALL && ~E_NOTICE); ini_set('display_errors', 'On'); ini_set('max_execution_time', '180'); +/*Klaus Opto advised that timeout issues made it difficult to install even though max_execution_time has been set - Tim though set_time_limit should also be set - it might be a windows thing - Klaus was using WAMP */ +set_time_limit(180); require_once('../includes/MiscFunctions.php'); // Start a session This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-08-14 04:28:49
|
Revision: 4658 http://web-erp.svn.sourceforge.net/web-erp/?rev=4658&view=rev Author: daintree Date: 2011-08-14 04:28:42 +0000 (Sun, 14 Aug 2011) Log Message: ----------- 14/8/11 Phil: Stocks.php now does a journal for any work in progress on a change of category where the new category has a different GL account for WIP - and bug fixes as per Ricard Modified Paths: -------------- trunk/Stocks.php trunk/WorkOrderCosting.php trunk/doc/Change.log trunk/includes/session.inc trunk/install/save.php Modified: trunk/Stocks.php =================================================================== --- trunk/Stocks.php 2011-08-12 11:01:35 UTC (rev 4657) +++ trunk/Stocks.php 2011-08-14 04:28:42 UTC (rev 4658) @@ -5,6 +5,7 @@ include('includes/session.inc'); $title = _('Item Maintenance'); include('includes/header.inc'); +include('includes/SQL_CommonFunctions.inc'); /*If this form is called with the StockID then it is assumed that the stock item is to be modified */ @@ -213,7 +214,8 @@ controlled, serialised, materialcost+labourcost+overheadcost AS itemcost, - stockcategory.stockact + stockcategory.stockact, + stockcategory.wipact FROM stockmaster INNER JOIN stockcategory ON stockmaster.categoryid=stockcategory.categoryid @@ -225,6 +227,8 @@ $OldSerialised = $myrow[2]; $UnitCost = $myrow[3]; $OldStockAccount = $myrow[4]; + $OldWIPAccount = $myrow[5]; + $sql = "SELECT SUM(locstock.quantity) FROM locstock @@ -235,12 +239,14 @@ /*Now check the GL account of the new category to see if it is different to the old stock gl account */ - $result = DB_query("SELECT stockact + $result = DB_query("SELECT stockact, + wipact FROM stockcategory WHERE categoryid='" . $_POST['CategoryID'] . "'", $db); $NewStockActRow = DB_fetch_array($result); $NewStockAct = $NewStockActRow['stockact']; + $NewWIPAct = $NewStockActRow['wipact']; if ($OldMBFlag != $_POST['MBFlag']){ if (($OldMBFlag == 'M' OR $OldMBFlag=='B') AND ($_POST['MBFlag']=='A' OR $_POST['MBFlag']=='K' OR $_POST['MBFlag']=='D' OR $_POST['MBFlag']=='G')){ /*then need to check that there is no stock holding first */ @@ -378,7 +384,7 @@ $db,$ErrMsg,$DbgMsg,true); } //end of loop around properties defined for the category - if ($OldStockAccount != $NewStockAct AND $_SESSION['CompanyRecord']['gllinkstock']==1) { + if ($OldStockAccount != $NewStockAct AND $_SESSION['CompanyRecord']['gllink_stock']==1) { /*Then we need to make a journal to transfer the cost to the new stock account */ $JournalNo = GetNextTransNo(0,$db); //enter as a journal $SQL = "INSERT INTO gltrans (type, @@ -391,13 +397,13 @@ VALUES ( 0, '" . $JournalNo . "', '" . Date('Y-m-d') . "', - '" . GetPeriodNo(Date('Y-m-d'),true) . "', + '" . GetPeriod(Date('Y-m-d'),$db,true) . "', '" . $NewStockAccount . "', '" . $StockID . ' ' . _('Change stock category') . "', '" . ($UnitCost* $StockQtyRow[0]) . "'"; $ErrMsg = _('The stock cost journal could not be inserted because'); $DbgMsg = _('The SQL that was used to create the stock cost journal and failed was'); - $result = DB_query($sql,$db, $ErrMsg, $DbgMsg,true); + $result = DB_query($SQL,$db, $ErrMsg, $DbgMsg,true); $SQL = "INSERT INTO gltrans (type, typeno, trandate, @@ -408,13 +414,68 @@ VALUES ( 0, '" . $JournalNo . "', '" . Date('Y-m-d') . "', - '" . GetPeriodNo(Date('Y-m-d'),true) . "', + '" . GetPeriod(Date('Y-m-d'),$db,true) . "', '" . $OldStockAccount . "', '" . $StockID . ' ' . _('Change stock category') . "', '" . (-$UnitCost* $StockQtyRow[0]) . "'"; - $result = DB_query($sql,$db, $ErrMsg, $DbgMsg,true); + $result = DB_query($SQL,$db, $ErrMsg, $DbgMsg,true); } /* end if the stock category changed and forced a change in stock cost account */ + if ($OldWIPAccount != $NewWIPAct AND $_SESSION['CompanyRecord']['gllink_stock']==1) { + /*Then we need to make a journal to transfer the cost of WIP to the new WIP account */ + /*First get the total cost of WIP for this category */ + + $WOCostsResult = DB_query("SELECT workorders.costissued, + SUM(woitems.qtyreqd * woitems.stdcost) AS costrecd + FROM woitems INNER JOIN workorders + ON woitems.wo = workorders.wo + INNER JOIN stockmaster + ON woitems.stockid=stockmaster.stockid + WHERE stockmaster.stockid='". $StockID . "' + AND workorders.closed=0 + GROUP BY workorders.costissued", + $db, + _('Error retrieving value of finished goods received and cost issued against work orders for this item')); + $WIPValue = 0; + while ($WIPRow=DB_fetch_array($WOCostsResult)){ + $WIPValue += ($WIPRow['costissued']-$WIPRow['costrecd']); + } + if ($WIPValue !=0){ + $JournalNo = GetNextTransNo(0,$db); //enter as a journal + $SQL = "INSERT INTO gltrans (type, + typeno, + trandate, + periodno, + account, + narrative, + amount) + VALUES ( 0, + '" . $JournalNo . "', + '" . Date('Y-m-d') . "', + '" . GetPeriod(Date('Y-m-d'),$db,true) . "', + '" . $NewWIPAct . "', + '" . $StockID . ' ' . _('Change stock category') . "', + '" . $WIPValue . "'"; + $ErrMsg = _('The WIP cost journal could not be inserted because'); + $DbgMsg = _('The SQL that was used to create the WIP cost journal and failed was'); + $result = DB_query($SQL,$db, $ErrMsg, $DbgMsg,true); + $SQL = "INSERT INTO gltrans (type, + typeno, + trandate, + periodno, + account, + narrative, + amount) + VALUES ( 0, + '" . $JournalNo . "', + '" . Date('Y-m-d') . "', + '" . GetPeriod(Date('Y-m-d'),true) . "', + '" . $OldWIPAccount . "', + '" . $StockID . ' ' . _('Change stock category') . "', + '" . (-$WIPValue) . "'"; + $result = DB_query($SQL,$db, $ErrMsg, $DbgMsg,true); + } + } /* end if the stock category changed and forced a change in WIP account */ DB_Txn_Commit($db); prnMsg( _('Stock Item') . ' ' . $StockID . ' ' . _('has been updated'), 'success'); echo '<br />'; @@ -512,11 +573,12 @@ unset($_POST['ShrinkFactor']); unset($_POST['Pansize']); unset($StockID); + $New=1; }//ALL WORKED SO RESET THE FORM VARIABLES }//THE INSERT OF THE NEW CODE WORKED SO BANG IN THE STOCK LOCATION RECORDS TOO }//END CHECK FOR ALREADY EXISTING ITEM OF THE SAME CODE } - $New=1; + } else { echo '<br />'. "\n"; Modified: trunk/WorkOrderCosting.php =================================================================== --- trunk/WorkOrderCosting.php 2011-08-12 11:01:35 UTC (rev 4657) +++ trunk/WorkOrderCosting.php 2011-08-14 04:28:42 UTC (rev 4658) @@ -77,7 +77,7 @@ $db, $ErrMsg); -echo '<table class=selection><tr><th>' . _('Item') . '</th> +echo '<table class="selection"><tr><th>' . _('Item') . '</th> <th>' . _('Description') . '</th> <th>' . _('Quantity Required') . '</th> <th>' . _('Units') . '</th> @@ -91,12 +91,12 @@ echo '<tr><td>' . $WORow['stockid'] . '</td> <td>' . $WORow['description'] . '</td> - <td class=number>' . number_format($WORow['qtyreqd'],$WORow['decimalplaces']) . '</td> + <td class="number">' . number_format($WORow['qtyreqd'],$WORow['decimalplaces']) . '</td> <td>' . $WORow['units'] . '</td> - <td class=number>' . number_format($WORow['qtyrecd'],$WORow['decimalplaces']) . '</td> - <td class=number><a href="'. $rootpath . '/WorkOrderStatus.php?WO=' . $_POST['WO'] . '&StockID=' . $WORow['stockid'] . '">' . _('Status') . '</a></td> - <td class=number><a href="'. $rootpath . '/WorkOrderReceive.php?WO=' . $_POST['WO'] . '&StockID=' . $WORow['stockid'] . '">' . _('Receive') . '</a></td> - <td class=number><a href="'. $rootpath . '/WorkOrderIssue.php?WO=' . $_POST['WO'] . '&StockID=' . $WORow['stockid'] . '">' . _('Issue') . '</a></td> + <td class="number">' . number_format($WORow['qtyrecd'],$WORow['decimalplaces']) . '</td> + <td class="number"><a href="'. $rootpath . '/WorkOrderStatus.php?WO=' . $_POST['WO'] . '&StockID=' . $WORow['stockid'] . '">' . _('Status') . '</a></td> + <td class="number"><a href="'. $rootpath . '/WorkOrderReceive.php?WO=' . $_POST['WO'] . '&StockID=' . $WORow['stockid'] . '">' . _('Receive') . '</a></td> + <td class="number"><a href="'. $rootpath . '/WorkOrderIssue.php?WO=' . $_POST['WO'] . '&StockID=' . $WORow['stockid'] . '">' . _('Issue') . '</a></td> </tr>'; $TotalStdValueRecd +=($WORow['stdcost']*$WORow['qtyrecd']); @@ -174,8 +174,8 @@ echo '<tr class="OddTableRows">'; } echo '<td colspan=4></td><td>' . ConvertSQLDate($IssuesRow['trandate']) . '</td> - <td class=number>' . number_format(-$IssuesRow['qty'],$RequirementsRow['decimalplaces']) . '</td> - <td class=number>' . number_format(-($IssuesRow['qty']*$IssuesRow['standardcost']),$IssuesRow['decimalplaces']) . '</td></tr>'; + <td class="number">' . number_format(-$IssuesRow['qty'],$RequirementsRow['decimalplaces']) . '</td> + <td class="number">' . number_format(-($IssuesRow['qty']*$IssuesRow['standardcost']),$IssuesRow['decimalplaces']) . '</td></tr>'; $IssueQty -= $IssuesRow['qty'];// because qty for the stock movement will be negative $IssueCost -= ($IssuesRow['qty']*$IssuesRow['standardcost']); @@ -201,13 +201,13 @@ /*Required quantity is the quantity required of the component based on the quantity of the finished item received */ $UsageVar =($RequirementsRow['requiredqty']-$IssueQty)*($RequirementsRow['stdcost']); - echo '<td colspan="2"></td><td class=number>' . number_format($RequirementsRow['requiredqty'],$RequirementsRow['decimalplaces']) . '</td> - <td class=number>' . number_format($RequirementsRow['expectedcost'],$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + echo '<td colspan="2"></td><td class="number">' . number_format($RequirementsRow['requiredqty'],$RequirementsRow['decimalplaces']) . '</td> + <td class="number">' . number_format($RequirementsRow['expectedcost'],$_SESSION['CompanyRecord']['decimalplaces']) . '</td> <td></td> - <td class=number>' . number_format($IssueQty,$RequirementsRow['decimalplaces']) . '</td> - <td class=number>' . number_format($IssueCost,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> - <td class=number>' . number_format($UsageVar,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> - <td class=number>' . number_format($CostVar,$_SESSION['CompanyRecord']['decimalplaces']) . '</td></tr>'; + <td class="number">' . number_format($IssueQty,$RequirementsRow['decimalplaces']) . '</td> + <td class="number">' . number_format($IssueCost,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . number_format($UsageVar,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . number_format($CostVar,$_SESSION['CompanyRecord']['decimalplaces']) . '</td></tr>'; $TotalReqdCost += $RequirementsRow['expectedcost']; $TotalIssuedCost += $IssueCost; $TotalCostVar += $CostVar; @@ -252,13 +252,13 @@ echo '<td>' . $WOIssuesRow['stockid'] . '</td> <td>' . $WOIssuesRow['description'] . '</td> - <td class=number>0</td> - <td class=number>0</td> + <td class="number">0</td> + <td class="number">0</td> <td>' . ConvertSQLDate($WOIssuesRow['trandate']) . '</td> - <td class=number>' . number_format(-$WOIssuesRow['qty'],$WOIssuesRow['decimalplaces']) .'</td> - <td class=number>' . number_format(-$WOIssuesRow['qty']*$WOIssuesRow['standardcost'],$_SESSION['CompanyRecord']['decimalplaces']) .'</td> - <td class=number>' . number_format($WOIssuesRow['qty']*$WOIssuesRow['standardcost'],$_SESSION['CompanyRecord']['decimalplaces']) .'</td> - <td class=number>0</td></tr>'; + <td class="number">' . number_format(-$WOIssuesRow['qty'],$WOIssuesRow['decimalplaces']) .'</td> + <td class="number">' . number_format(-$WOIssuesRow['qty']*$WOIssuesRow['standardcost'],$_SESSION['CompanyRecord']['decimalplaces']) .'</td> + <td class="number">' . number_format($WOIssuesRow['qty']*$WOIssuesRow['standardcost'],$_SESSION['CompanyRecord']['decimalplaces']) .'</td> + <td class="number">0</td></tr>'; $TotalUsageVar += ($WOIssuesRow['qty']*$WOIssuesRow['standardcost']); } @@ -269,13 +269,13 @@ <td colspan="2"></td> <td colspan="3"><hr></td> </tr>'; -echo '<tr><td colspan="2" class=number>' . _('Totals') . '</td> +echo '<tr><td colspan="2" class="number">' . _('Totals') . '</td> <td></td> - <td class=number>' . number_format($TotalReqdCost,$_SESSION['CompanyRecord']['decimalplaces']) .'</td> + <td class="number">' . number_format($TotalReqdCost,$_SESSION['CompanyRecord']['decimalplaces']) .'</td> <td></td><td></td> - <td class=number>' . number_format($TotalIssuedCost,$_SESSION['CompanyRecord']['decimalplaces']) .'</td> - <td class=number>' . number_format($TotalUsageVar,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> - <td class=number>' . number_format($TotalCostVar,$_SESSION['CompanyRecord']['decimalplaces']) . '</td></tr>'; + <td class="number">' . number_format($TotalIssuedCost,$_SESSION['CompanyRecord']['decimalplaces']) .'</td> + <td class="number">' . number_format($TotalUsageVar,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . number_format($TotalCostVar,$_SESSION['CompanyRecord']['decimalplaces']) . '</td></tr>'; echo '<tr><td colspan="3"></td> <td><hr/></td> Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2011-08-12 11:01:35 UTC (rev 4657) +++ trunk/doc/Change.log 2011-08-14 04:28:42 UTC (rev 4658) @@ -1,5 +1,6 @@ webERP Change Log +14/8/11 Phil: Stocks.php now does a journal for any work in progress on a change of category where the new category has a different GL account for WIP - and bug fixes as per Ricard 12/8/11 Phil: Backed out changes on 7/8 that prevented SelectProduct.php transaction links - now only purchase order links blocked if an item is obsolete 12/8/11 Phil: CounterSales.php apply discountmatrix fixes 11/8/11 Phil: GoodsReceived.php now has checkbox to flag the order line as complete - even though the quantity delivered might be short of the order quantity. Modified: trunk/includes/session.inc =================================================================== --- trunk/includes/session.inc 2011-08-12 11:01:35 UTC (rev 4657) +++ trunk/includes/session.inc 2011-08-14 04:28:42 UTC (rev 4658) @@ -19,8 +19,12 @@ } ini_set('session.gc_Maxlifetime',$SessionLifeTime); -ini_set('max_execution_time',$MaximumExecutionTime); +if( !ini_get('safe_mode') ){ + set_time_limit($MaximumExecutionTime); + ini_set('max_execution_time',$MaximumExecutionTime); +} + session_start(); include($PathPrefix . 'includes/ConnectDB.inc'); Modified: trunk/install/save.php =================================================================== --- trunk/install/save.php 2011-08-12 11:01:35 UTC (rev 4657) +++ trunk/install/save.php 2011-08-14 04:28:42 UTC (rev 4658) @@ -3,6 +3,8 @@ error_reporting(E_ALL && ~E_NOTICE); ini_set('display_errors', 'On'); ini_set('max_execution_time', '180'); +/*Klaus Opto advised that timeout issues made it difficult to install even though max_execution_time has been set - Tim though set_time_limit should also be set - it might be a windows thing - Klaus was using WAMP */ +set_time_limit(180); require_once('../includes/MiscFunctions.php'); // Start a session This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-08-12 11:01:42
|
Revision: 4657 http://web-erp.svn.sourceforge.net/web-erp/?rev=4657&view=rev Author: daintree Date: 2011-08-12 11:01:35 +0000 (Fri, 12 Aug 2011) Log Message: ----------- 12/8/11 Phil: Backed out changes on 7/8 that prevented SelectProduct.php transaction links - now only purchase order links blocked if an item is obsolete 12/8/11 Phil: CounterSales.php apply discountmatrix fixes Modified Paths: -------------- trunk/CounterSales.php trunk/SelectProduct.php trunk/doc/Change.log Modified: trunk/CounterSales.php =================================================================== --- trunk/CounterSales.php 2011-08-11 10:08:05 UTC (rev 4656) +++ trunk/CounterSales.php 2011-08-12 11:01:35 UTC (rev 4657) @@ -665,38 +665,43 @@ } -/* Run through each line of the order and work out the appropriate discount from the discount matrix */ +/* Now Run through each line of the order again to work out the appropriate discount from the discount matrix */ $DiscCatsDone = array(); -$counter =0; foreach ($_SESSION['Items'.$identifier]->LineItems as $OrderLine) { if ($OrderLine->DiscCat !='' AND ! in_array($OrderLine->DiscCat,$DiscCatsDone)){ - $DiscCatsDone[$counter]=$OrderLine->DiscCat; - $QuantityOfDiscCat =0; + $DiscCatsDone[]=$OrderLine->DiscCat; + $QuantityOfDiscCat = 0; - foreach ($_SESSION['Items'.$identifier]->LineItems as $StkItems_2) { + foreach ($_SESSION['Items'.$identifier]->LineItems as $OrderLine_2) { /* add up total quantity of all lines of this DiscCat */ - if ($StkItems_2->DiscCat==$OrderLine->DiscCat){ - $QuantityOfDiscCat += $StkItems_2->Quantity; + if ($OrderLine_2->DiscCat==$OrderLine->DiscCat){ + $QuantityOfDiscCat += $OrderLine_2->Quantity; } } $result = DB_query("SELECT MAX(discountrate) AS discount FROM discountmatrix WHERE salestype='" . $_SESSION['Items'.$identifier]->DefaultSalesType . "' AND discountcategory ='" . $OrderLine->DiscCat . "' - AND quantitybreak <'" . $QuantityOfDiscCat . "'",$db); + AND quantitybreak <= '" . $QuantityOfDiscCat ."'",$db); $myrow = DB_fetch_row($result); + if ($myrow[0]==NULL){ + $DiscountMatrixRate = 0; + } else { + $DiscountMatrixRate = $myrow[0]; + } if ($myrow[0]!=0){ /* need to update the lines affected */ - foreach ($_SESSION['Items'.$identifier]->LineItems as $StkItems_2) { - /* add up total quantity of all lines of this DiscCat */ - if ($StkItems_2->DiscCat==$OrderLine->DiscCat AND $StkItems_2->DiscountPercent == 0){ - $_SESSION['Items'.$identifier]->LineItems[$StkItems_2->LineNumber]->DiscountPercent = $myrow[0]; + foreach ($_SESSION['Items'.$identifier]->LineItems as $OrderLine_2) { + if ($OrderLine_2->DiscCat==$OrderLine->DiscCat){ + $_SESSION['Items'.$identifier]->LineItems[$OrderLine_2->LineNumber]->DiscountPercent = $DiscountMatrixRate; + $_SESSION['Items'.$identifier]->LineItems[$OrderLine_2->LineNumber]->GPPercent = (($_SESSION['Items'.$identifier]->LineItems[$OrderLine_2->LineNumber]->Price*(1-$DiscountMatrixRate)) - $_SESSION['Items'.$identifier]->LineItems[$OrderLine_2->LineNumber]->StandardCost*$ExRate)/($_SESSION['Items'.$identifier]->LineItems[$OrderLine_2->LineNumber]->Price *(1-$DiscountMatrixRate)/100); } } } } } /* end of discount matrix lookup code */ + if (count($_SESSION['Items'.$identifier]->LineItems)>0 AND !isset($_POST['ProcessSale'])){ /*only show order lines if there are any */ /* @@ -877,7 +882,7 @@ * Invoice Processing Here * ********************************** * */ -if (isset($_POST['ProcessSale']) and $_POST['ProcessSale'] != ""){ +if (isset($_POST['ProcessSale']) and $_POST['ProcessSale'] != ''){ $InputError = false; //always assume the best //but check for the worst @@ -952,7 +957,7 @@ /* Now Get the area where the sale is to from the branches table */ $SQL = "SELECT area, - defaultshipvia + defaultshipvia FROM custbranch WHERE custbranch.debtorno ='". $_SESSION['Items'.$identifier]->DebtorNo . "' AND custbranch.branchcode = '" . $_SESSION['Items'.$identifier]->Branch . "'"; @@ -1358,35 +1363,33 @@ if (empty($AssParts['standard'])) { $AssParts['standard']=0; } - $SQL = "INSERT INTO stockmoves ( - stockid, - type, - transno, - loccode, - trandate, - debtorno, - branchcode, - prd, - reference, - qty, - standardcost, - show_on_inv_crds, - newqoh - ) VALUES ( - '" . $AssParts['component'] . "', - 10, - '" . $InvoiceNo . "', - '" . $_SESSION['Items'.$identifier]->Location . "', - '" . $DefaultDispatchDate . "', - '" . $_SESSION['Items'.$identifier]->DebtorNo . "', - '" . $_SESSION['Items'.$identifier]->Branch . "', - '" . $PeriodNo . "', - '" . _('Assembly') . ': ' . $OrderLine->StockID . ' ' . _('Order') . ': ' . $OrderNo . "', - '" . -$AssParts['quantity'] * $OrderLine->Quantity . "', - '" . $AssParts['standard'] . "', - 0, - newqoh-" . ($AssParts['quantity'] * $OrderLine->Quantity) . " - )"; + $SQL = "INSERT INTO stockmoves (stockid, + type, + transno, + loccode, + trandate, + debtorno, + branchcode, + prd, + reference, + qty, + standardcost, + show_on_inv_crds, + newqoh + ) VALUES ( + '" . $AssParts['component'] . "', + 10, + '" . $InvoiceNo . "', + '" . $_SESSION['Items'.$identifier]->Location . "', + '" . $DefaultDispatchDate . "', + '" . $_SESSION['Items'.$identifier]->DebtorNo . "', + '" . $_SESSION['Items'.$identifier]->Branch . "', + '" . $PeriodNo . "', + '" . _('Assembly') . ': ' . $OrderLine->StockID . ' ' . _('Order') . ': ' . $OrderNo . "', + '" . -$AssParts['quantity'] * $OrderLine->Quantity . "', + '" . $AssParts['standard'] . "', + 0, + newqoh-" . ($AssParts['quantity'] * $OrderLine->Quantity) . " )"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('Stock movement records for the assembly components of'). ' '. $OrderLine->StockID . ' ' . _('could not be inserted because'); $DbgMsg = _('The following SQL to insert the assembly components stock movement records was used'); @@ -1451,35 +1454,34 @@ if (empty($OrderLine->StandardCost)) { $OrderLine->StandardCost = 0; } - $SQL = "INSERT INTO stockmoves ( - stockid, - type, - transno, - loccode, - trandate, - debtorno, - branchcode, - price, - prd, - reference, - qty, - discountpercent, - standardcost, - narrative ) - VALUES ('" . $OrderLine->StockID . "', - 10, - '" . $InvoiceNo . "', - '" . $_SESSION['Items'.$identifier]->Location . "', - '" . $DefaultDispatchDate . "', - '" . $_SESSION['Items'.$identifier]->DebtorNo . "', - '" . $_SESSION['Items'.$identifier]->Branch . "', - '" . $LocalCurrencyPrice . "', - '" . $PeriodNo . "', - '" . $OrderNo . "', - '" . -$OrderLine->Quantity . "', - '" . $OrderLine->DiscountPercent . "', - '" . $OrderLine->StandardCost . "', - '" . DB_escape_string($OrderLine->Narrative) . "')"; + $SQL = "INSERT INTO stockmoves (stockid, + type, + transno, + loccode, + trandate, + debtorno, + branchcode, + price, + prd, + reference, + qty, + discountpercent, + standardcost, + narrative ) + VALUES ('" . $OrderLine->StockID . "', + 10, + '" . $InvoiceNo . "', + '" . $_SESSION['Items'.$identifier]->Location . "', + '" . $DefaultDispatchDate . "', + '" . $_SESSION['Items'.$identifier]->DebtorNo . "', + '" . $_SESSION['Items'.$identifier]->Branch . "', + '" . $LocalCurrencyPrice . "', + '" . $PeriodNo . "', + '" . $OrderNo . "', + '" . -$OrderLine->Quantity . "', + '" . $OrderLine->DiscountPercent . "', + '" . $OrderLine->StandardCost . "', + '" . DB_escape_string($OrderLine->Narrative) . "')"; } $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('Stock movement records could not be inserted because'); Modified: trunk/SelectProduct.php =================================================================== --- trunk/SelectProduct.php 2011-08-11 10:08:05 UTC (rev 4656) +++ trunk/SelectProduct.php 2011-08-12 11:01:35 UTC (rev 4657) @@ -303,17 +303,17 @@ $DemRow = DB_fetch_row($DemResult); $Demand = $DemRow[0]; $DemAsComponentResult = DB_query("SELECT SUM((salesorderdetails.quantity-salesorderdetails.qtyinvoiced)*bom.quantity) AS dem - FROM salesorderdetails, - salesorders, - bom, - stockmaster - WHERE salesorderdetails.stkcode=bom.parent - AND salesorders.orderno = salesorderdetails.orderno - AND salesorderdetails.quantity-salesorderdetails.qtyinvoiced > 0 - AND bom.component='" . $StockID . "' - AND stockmaster.stockid=bom.parent - AND stockmaster.mbflag='A' - AND salesorders.quotation=0", $db); + FROM salesorderdetails, + salesorders, + bom, + stockmaster + WHERE salesorderdetails.stkcode=bom.parent + AND salesorders.orderno = salesorderdetails.orderno + AND salesorderdetails.quantity-salesorderdetails.qtyinvoiced > 0 + AND bom.component='" . $StockID . "' + AND stockmaster.stockid=bom.parent + AND stockmaster.mbflag='A' + AND salesorders.quotation=0", $db); $DemAsComponentRow = DB_fetch_row($DemAsComponentResult); $Demand+= $DemAsComponentRow[0]; //Also the demand for the item as a component of works orders @@ -417,7 +417,7 @@ wikiLink('Product', $StockID); echo '</td><td valign="top" class="select">'; /* Stock Transactions */ -if ($Its_A_Kitset_Assembly_Or_Dummy == false AND $myrow['discontinued']==0) { +if ($Its_A_Kitset_Assembly_Or_Dummy == false) { echo '<a href="' . $rootpath . '/StockAdjustments.php?StockID=' . $StockID . '">' . _('Quantity Adjustments') . '</a><br />'; echo '<a href="' . $rootpath . '/StockTransfers.php?StockID=' . $StockID . '">' . _('Location Transfers') . '</a><br />'; //show the item image if it has been uploaded Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2011-08-11 10:08:05 UTC (rev 4656) +++ trunk/doc/Change.log 2011-08-12 11:01:35 UTC (rev 4657) @@ -1,5 +1,7 @@ webERP Change Log +12/8/11 Phil: Backed out changes on 7/8 that prevented SelectProduct.php transaction links - now only purchase order links blocked if an item is obsolete +12/8/11 Phil: CounterSales.php apply discountmatrix fixes 11/8/11 Phil: GoodsReceived.php now has checkbox to flag the order line as complete - even though the quantity delivered might be short of the order quantity. 11/8/11 Phil: PO_Items.php link to complete uncompleted lines - status of order is changed to complete is all lines are completed 10/8/11 Phil: POReport.php added link to detail purchase order inquiry This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-08-12 11:01:42
|
Revision: 4657 http://web-erp.svn.sourceforge.net/web-erp/?rev=4657&view=rev Author: daintree Date: 2011-08-12 11:01:35 +0000 (Fri, 12 Aug 2011) Log Message: ----------- 12/8/11 Phil: Backed out changes on 7/8 that prevented SelectProduct.php transaction links - now only purchase order links blocked if an item is obsolete 12/8/11 Phil: CounterSales.php apply discountmatrix fixes Modified Paths: -------------- trunk/CounterSales.php trunk/SelectProduct.php trunk/doc/Change.log Modified: trunk/CounterSales.php =================================================================== --- trunk/CounterSales.php 2011-08-11 10:08:05 UTC (rev 4656) +++ trunk/CounterSales.php 2011-08-12 11:01:35 UTC (rev 4657) @@ -665,38 +665,43 @@ } -/* Run through each line of the order and work out the appropriate discount from the discount matrix */ +/* Now Run through each line of the order again to work out the appropriate discount from the discount matrix */ $DiscCatsDone = array(); -$counter =0; foreach ($_SESSION['Items'.$identifier]->LineItems as $OrderLine) { if ($OrderLine->DiscCat !='' AND ! in_array($OrderLine->DiscCat,$DiscCatsDone)){ - $DiscCatsDone[$counter]=$OrderLine->DiscCat; - $QuantityOfDiscCat =0; + $DiscCatsDone[]=$OrderLine->DiscCat; + $QuantityOfDiscCat = 0; - foreach ($_SESSION['Items'.$identifier]->LineItems as $StkItems_2) { + foreach ($_SESSION['Items'.$identifier]->LineItems as $OrderLine_2) { /* add up total quantity of all lines of this DiscCat */ - if ($StkItems_2->DiscCat==$OrderLine->DiscCat){ - $QuantityOfDiscCat += $StkItems_2->Quantity; + if ($OrderLine_2->DiscCat==$OrderLine->DiscCat){ + $QuantityOfDiscCat += $OrderLine_2->Quantity; } } $result = DB_query("SELECT MAX(discountrate) AS discount FROM discountmatrix WHERE salestype='" . $_SESSION['Items'.$identifier]->DefaultSalesType . "' AND discountcategory ='" . $OrderLine->DiscCat . "' - AND quantitybreak <'" . $QuantityOfDiscCat . "'",$db); + AND quantitybreak <= '" . $QuantityOfDiscCat ."'",$db); $myrow = DB_fetch_row($result); + if ($myrow[0]==NULL){ + $DiscountMatrixRate = 0; + } else { + $DiscountMatrixRate = $myrow[0]; + } if ($myrow[0]!=0){ /* need to update the lines affected */ - foreach ($_SESSION['Items'.$identifier]->LineItems as $StkItems_2) { - /* add up total quantity of all lines of this DiscCat */ - if ($StkItems_2->DiscCat==$OrderLine->DiscCat AND $StkItems_2->DiscountPercent == 0){ - $_SESSION['Items'.$identifier]->LineItems[$StkItems_2->LineNumber]->DiscountPercent = $myrow[0]; + foreach ($_SESSION['Items'.$identifier]->LineItems as $OrderLine_2) { + if ($OrderLine_2->DiscCat==$OrderLine->DiscCat){ + $_SESSION['Items'.$identifier]->LineItems[$OrderLine_2->LineNumber]->DiscountPercent = $DiscountMatrixRate; + $_SESSION['Items'.$identifier]->LineItems[$OrderLine_2->LineNumber]->GPPercent = (($_SESSION['Items'.$identifier]->LineItems[$OrderLine_2->LineNumber]->Price*(1-$DiscountMatrixRate)) - $_SESSION['Items'.$identifier]->LineItems[$OrderLine_2->LineNumber]->StandardCost*$ExRate)/($_SESSION['Items'.$identifier]->LineItems[$OrderLine_2->LineNumber]->Price *(1-$DiscountMatrixRate)/100); } } } } } /* end of discount matrix lookup code */ + if (count($_SESSION['Items'.$identifier]->LineItems)>0 AND !isset($_POST['ProcessSale'])){ /*only show order lines if there are any */ /* @@ -877,7 +882,7 @@ * Invoice Processing Here * ********************************** * */ -if (isset($_POST['ProcessSale']) and $_POST['ProcessSale'] != ""){ +if (isset($_POST['ProcessSale']) and $_POST['ProcessSale'] != ''){ $InputError = false; //always assume the best //but check for the worst @@ -952,7 +957,7 @@ /* Now Get the area where the sale is to from the branches table */ $SQL = "SELECT area, - defaultshipvia + defaultshipvia FROM custbranch WHERE custbranch.debtorno ='". $_SESSION['Items'.$identifier]->DebtorNo . "' AND custbranch.branchcode = '" . $_SESSION['Items'.$identifier]->Branch . "'"; @@ -1358,35 +1363,33 @@ if (empty($AssParts['standard'])) { $AssParts['standard']=0; } - $SQL = "INSERT INTO stockmoves ( - stockid, - type, - transno, - loccode, - trandate, - debtorno, - branchcode, - prd, - reference, - qty, - standardcost, - show_on_inv_crds, - newqoh - ) VALUES ( - '" . $AssParts['component'] . "', - 10, - '" . $InvoiceNo . "', - '" . $_SESSION['Items'.$identifier]->Location . "', - '" . $DefaultDispatchDate . "', - '" . $_SESSION['Items'.$identifier]->DebtorNo . "', - '" . $_SESSION['Items'.$identifier]->Branch . "', - '" . $PeriodNo . "', - '" . _('Assembly') . ': ' . $OrderLine->StockID . ' ' . _('Order') . ': ' . $OrderNo . "', - '" . -$AssParts['quantity'] * $OrderLine->Quantity . "', - '" . $AssParts['standard'] . "', - 0, - newqoh-" . ($AssParts['quantity'] * $OrderLine->Quantity) . " - )"; + $SQL = "INSERT INTO stockmoves (stockid, + type, + transno, + loccode, + trandate, + debtorno, + branchcode, + prd, + reference, + qty, + standardcost, + show_on_inv_crds, + newqoh + ) VALUES ( + '" . $AssParts['component'] . "', + 10, + '" . $InvoiceNo . "', + '" . $_SESSION['Items'.$identifier]->Location . "', + '" . $DefaultDispatchDate . "', + '" . $_SESSION['Items'.$identifier]->DebtorNo . "', + '" . $_SESSION['Items'.$identifier]->Branch . "', + '" . $PeriodNo . "', + '" . _('Assembly') . ': ' . $OrderLine->StockID . ' ' . _('Order') . ': ' . $OrderNo . "', + '" . -$AssParts['quantity'] * $OrderLine->Quantity . "', + '" . $AssParts['standard'] . "', + 0, + newqoh-" . ($AssParts['quantity'] * $OrderLine->Quantity) . " )"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('Stock movement records for the assembly components of'). ' '. $OrderLine->StockID . ' ' . _('could not be inserted because'); $DbgMsg = _('The following SQL to insert the assembly components stock movement records was used'); @@ -1451,35 +1454,34 @@ if (empty($OrderLine->StandardCost)) { $OrderLine->StandardCost = 0; } - $SQL = "INSERT INTO stockmoves ( - stockid, - type, - transno, - loccode, - trandate, - debtorno, - branchcode, - price, - prd, - reference, - qty, - discountpercent, - standardcost, - narrative ) - VALUES ('" . $OrderLine->StockID . "', - 10, - '" . $InvoiceNo . "', - '" . $_SESSION['Items'.$identifier]->Location . "', - '" . $DefaultDispatchDate . "', - '" . $_SESSION['Items'.$identifier]->DebtorNo . "', - '" . $_SESSION['Items'.$identifier]->Branch . "', - '" . $LocalCurrencyPrice . "', - '" . $PeriodNo . "', - '" . $OrderNo . "', - '" . -$OrderLine->Quantity . "', - '" . $OrderLine->DiscountPercent . "', - '" . $OrderLine->StandardCost . "', - '" . DB_escape_string($OrderLine->Narrative) . "')"; + $SQL = "INSERT INTO stockmoves (stockid, + type, + transno, + loccode, + trandate, + debtorno, + branchcode, + price, + prd, + reference, + qty, + discountpercent, + standardcost, + narrative ) + VALUES ('" . $OrderLine->StockID . "', + 10, + '" . $InvoiceNo . "', + '" . $_SESSION['Items'.$identifier]->Location . "', + '" . $DefaultDispatchDate . "', + '" . $_SESSION['Items'.$identifier]->DebtorNo . "', + '" . $_SESSION['Items'.$identifier]->Branch . "', + '" . $LocalCurrencyPrice . "', + '" . $PeriodNo . "', + '" . $OrderNo . "', + '" . -$OrderLine->Quantity . "', + '" . $OrderLine->DiscountPercent . "', + '" . $OrderLine->StandardCost . "', + '" . DB_escape_string($OrderLine->Narrative) . "')"; } $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('Stock movement records could not be inserted because'); Modified: trunk/SelectProduct.php =================================================================== --- trunk/SelectProduct.php 2011-08-11 10:08:05 UTC (rev 4656) +++ trunk/SelectProduct.php 2011-08-12 11:01:35 UTC (rev 4657) @@ -303,17 +303,17 @@ $DemRow = DB_fetch_row($DemResult); $Demand = $DemRow[0]; $DemAsComponentResult = DB_query("SELECT SUM((salesorderdetails.quantity-salesorderdetails.qtyinvoiced)*bom.quantity) AS dem - FROM salesorderdetails, - salesorders, - bom, - stockmaster - WHERE salesorderdetails.stkcode=bom.parent - AND salesorders.orderno = salesorderdetails.orderno - AND salesorderdetails.quantity-salesorderdetails.qtyinvoiced > 0 - AND bom.component='" . $StockID . "' - AND stockmaster.stockid=bom.parent - AND stockmaster.mbflag='A' - AND salesorders.quotation=0", $db); + FROM salesorderdetails, + salesorders, + bom, + stockmaster + WHERE salesorderdetails.stkcode=bom.parent + AND salesorders.orderno = salesorderdetails.orderno + AND salesorderdetails.quantity-salesorderdetails.qtyinvoiced > 0 + AND bom.component='" . $StockID . "' + AND stockmaster.stockid=bom.parent + AND stockmaster.mbflag='A' + AND salesorders.quotation=0", $db); $DemAsComponentRow = DB_fetch_row($DemAsComponentResult); $Demand+= $DemAsComponentRow[0]; //Also the demand for the item as a component of works orders @@ -417,7 +417,7 @@ wikiLink('Product', $StockID); echo '</td><td valign="top" class="select">'; /* Stock Transactions */ -if ($Its_A_Kitset_Assembly_Or_Dummy == false AND $myrow['discontinued']==0) { +if ($Its_A_Kitset_Assembly_Or_Dummy == false) { echo '<a href="' . $rootpath . '/StockAdjustments.php?StockID=' . $StockID . '">' . _('Quantity Adjustments') . '</a><br />'; echo '<a href="' . $rootpath . '/StockTransfers.php?StockID=' . $StockID . '">' . _('Location Transfers') . '</a><br />'; //show the item image if it has been uploaded Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2011-08-11 10:08:05 UTC (rev 4656) +++ trunk/doc/Change.log 2011-08-12 11:01:35 UTC (rev 4657) @@ -1,5 +1,7 @@ webERP Change Log +12/8/11 Phil: Backed out changes on 7/8 that prevented SelectProduct.php transaction links - now only purchase order links blocked if an item is obsolete +12/8/11 Phil: CounterSales.php apply discountmatrix fixes 11/8/11 Phil: GoodsReceived.php now has checkbox to flag the order line as complete - even though the quantity delivered might be short of the order quantity. 11/8/11 Phil: PO_Items.php link to complete uncompleted lines - status of order is changed to complete is all lines are completed 10/8/11 Phil: POReport.php added link to detail purchase order inquiry This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-08-11 10:08:12
|
Revision: 4656 http://web-erp.svn.sourceforge.net/web-erp/?rev=4656&view=rev Author: daintree Date: 2011-08-11 10:08:05 +0000 (Thu, 11 Aug 2011) Log Message: ----------- 11/8/11 Phil: GoodsReceived.php now has checkbox to flag the order line as complete - even though the quantity delivered might be short of the order quantity. 11/8/11 Phil: PO_Items.php link to complete uncompleted lines - status of order is changed to complete is all lines are completed Modified Paths: -------------- trunk/GoodsReceived.php trunk/PO_Items.php trunk/doc/Change.log trunk/includes/DefinePOClass.php Modified: trunk/GoodsReceived.php =================================================================== --- trunk/GoodsReceived.php 2011-08-10 10:21:25 UTC (rev 4655) +++ trunk/GoodsReceived.php 2011-08-11 10:08:05 UTC (rev 4656) @@ -47,6 +47,11 @@ $RecvQty = 0; } $_SESSION['PO'.$identifier]->LineItems[$Line->LineNo]->ReceiveQty = $RecvQty; + if (isset($_POST['Complete_' . $Line->LineNo])){ + $_SESSION['PO'.$identifier]->LineItems[$Line->LineNo]->Completed = 1; + } else { + $_SESSION['PO'.$identifier]->LineItems[$Line->LineNo]->Completed = 0; + } } } @@ -75,7 +80,7 @@ echo '<table class="selection"> <tr> <td>'. _('Date Goods/Service Received'). ':</td> - <td><input type="text" class=date alt="'. $_SESSION['DefaultDateFormat'] .'" maxlength=10 size=10 onChange="return isDate(this, this.value, '."'". + <td><input type="text" class="date" alt="'. $_SESSION['DefaultDateFormat'] .'" maxlength=10 size=10 onChange="return isDate(this, this.value, '."'". $_SESSION['DefaultDateFormat']."'".')" name="DefaultReceivedDate" value="' . $_POST['DefaultReceivedDate'] . '"></td> </tr> </table> @@ -96,7 +101,8 @@ <th>' . _('Quantity') . '<br />' . _('Ordered') . '</th> <th>' . _('Units') . '</th> <th>' . _('Already') . '<br />' . _('Received') . '</th> - <th>' . _('This Delivery') . '<br />' . _('Quantity') . '</th>'; + <th>' . _('This Delivery') . '<br />' . _('Quantity') . '</th> + <th>' . _('Completed') . '</th>'; if ($_SESSION['ShowValueOnGRN']==1) { echo '<th>' . _('Price') . '</th> @@ -147,23 +153,28 @@ //Now Display LineItem echo '<td>' . $LnItm->StockID . '</td> <td>' . $LnItm->ItemDescription . '</td> - <td class=number>' . $DisplaySupplierQtyOrd . '</td> + <td class="number">' . $DisplaySupplierQtyOrd . '</td> <td>' . $LnItm->SuppliersUnit . '</td> - <td class=number>' . $DisplaySupplierQtyRec . '</td> - <td class=number>' . $LnItm->ConversionFactor . '</td> - <td class=number>' . $DisplayQtyOrd . '</td> + <td class="number">' . $DisplaySupplierQtyRec . '</td> + <td class="number">' . $LnItm->ConversionFactor . '</td> + <td class="number">' . $DisplayQtyOrd . '</td> <td>' . $LnItm->Units . '</td> - <td class=number>' . $DisplayQtyRec . '</td> - <td class=number>'; + <td class="number">' . $DisplayQtyRec . '</td> + <td class="number">'; if ($LnItm->Controlled == 1) { echo '<input type=hidden name="RecvQty_' . $LnItm->LineNo . '" value="' . $LnItm->ReceiveQty . '"><a href="GoodsReceivedControlled.php?identifier=' . $identifier . '&LineNo=' . $LnItm->LineNo . '">' . number_format($LnItm->ReceiveQty,$LnItm->DecimalPlaces) . '</a></td>'; } else { - echo '<input type="text" class=number name="RecvQty_' . $LnItm->LineNo . '" maxlength=10 size=10 value="' . $LnItm->ReceiveQty . '"></td>'; + echo '<input type="text" class="number" name="RecvQty_' . $LnItm->LineNo . '" maxlength=10 size=10 value="' . $LnItm->ReceiveQty . '"></td>'; } - + echo '<td><input type="checkbox" name="Complete_'. $LnItm->LineNo . '"'; + if ($LnItm->Completed ==1){ + echo ' checked'; + } + echo ' /></td>'; + if ($_SESSION['ShowValueOnGRN']==1) { echo '<td class="number">' . $DisplayPrice . '</td>'; echo '<td class="number">' . $DisplayLineTotal . '</td>'; @@ -341,9 +352,11 @@ $PeriodNo = GetPeriod($_POST['DefaultReceivedDate'], $db); $_POST['DefaultReceivedDate'] = FormatDateForSQL($_POST['DefaultReceivedDate']); - + $OrderCompleted = true; //assume all received and completed - now test in case not foreach ($_SESSION['PO'.$identifier]->LineItems as $OrderLine) { - + if ($OrderLine->Completed ==0){ + $OrderCompleted = false; + } if ($OrderLine->ReceiveQty !=0 AND $OrderLine->ReceiveQty!='' AND isset($OrderLine->ReceiveQty)) { $LocalCurrencyPrice = ($OrderLine->Price / $_SESSION['PO'.$identifier]->ExRate); @@ -390,7 +403,7 @@ $SQL = "UPDATE purchorderdetails SET quantityrecd = quantityrecd + '" . $OrderLine->ReceiveQty . "', stdcostunit='" . $_SESSION['PO'.$identifier]->LineItems[$OrderLine->LineNo]->StandardCost . "', - completed=0 + completed='" . $_SESSION['PO'.$identifier]->LineItems[$OrderLine->LineNo]->Completed . "' WHERE podetailitem = '" . $OrderLine->PODetailRec . "'"; } @@ -670,10 +683,8 @@ } /*Quantity received is != 0 */ } /*end of OrderLine loop */ - - - if ($_SESSION['PO'.$identifier]->AllLinesReceived()==1) { //all lines on the purchase order are now completed - $StatusComment=date($_SESSION['DefaultDateFormat']) .' - ' . _('Order Completed') .'<br />' . $_SESSION['PO'.$identifier]->StatusComments; + if ($_SESSION['PO'.$identifier]->AllLinesReceived()==1 OR $OrderCompleted) { //all lines on the purchase order are now completed + $StatusComment=date($_SESSION['DefaultDateFormat']) .' - ' . _('Order Completed on entry of GRN') .'<br />' . $_SESSION['PO'.$identifier]->StatusComments; $sql="UPDATE purchorders SET status='Completed', stat_comment='" . $StatusComment . "' Modified: trunk/PO_Items.php =================================================================== --- trunk/PO_Items.php 2011-08-10 10:21:25 UTC (rev 4655) +++ trunk/PO_Items.php 2011-08-11 10:08:05 UTC (rev 4656) @@ -83,7 +83,8 @@ } else { $UserDetails = ' ' . $_SESSION['UsersRealName'] . ' '; } - if ($_SESSION['AutoAuthorisePO']==1) { //if the user has authority to authorise the PO then it will automatically be authorised + if ($_SESSION['AutoAuthorisePO']==1) { + //if the user has authority to authorise the PO then it will automatically be authorised $AuthSQL ="SELECT authlevel FROM purchorderauth WHERE userid='".$_SESSION['UserID']."' @@ -233,7 +234,23 @@ prnMsg(_('Purchase Order') . ' ' . $_SESSION['PO'.$identifier]->OrderNo . ' ' . _('on') . ' ' . $_SESSION['PO'.$identifier]->SupplierName . ' ' . _('has been created'),'success'); } else { /*its an existing order need to update the old order info */ - + /*Check to see if there are any incomplete lines on the order */ + $Completed = true; //assume it is completed i.e. all lines are flagged as completed + foreach ($_SESSION['PO'.$identifier]->LineItems as $POLine) { + if ($POLine->Completed==0){ + $Completed = false; + break; + } + } + if ($Completed){ + $_SESSION['PO'.$identifier]->Status = 'Completed'; + if (IsEmailAddress($_SESSION['UserEmail'])){ + $UserChangedStatus = ' <a href="mailto:' . $_SESSION['UserEmail'] . '">' . $_SESSION['UsersRealName']. '</a>'; + } else { + $UserChangedStatus = ' ' . $_SESSION['UsersRealName'] . ' '; + } + $_SESSION['PO'.$identifier]->StatusComments = date($_SESSION['DefaultDateFormat']).' - ' . _('Order completed by') . $UserChangedStatus . '<br />' .$_SESSION['PO'.$identifier]->StatusComments; + } /*Update the purchase order header with any changes */ $sql = "UPDATE purchorders SET supplierno = '" . $_SESSION['PO'.$identifier]->SupplierID . "' , @@ -264,13 +281,14 @@ contact='" . $_SESSION['PO'.$identifier]->Contact . "', paymentterms='" . $_SESSION['PO'.$identifier]->PaymentTerms . "', allowprint='" . $_SESSION['PO'.$identifier]->AllowPrintPO . "', - status = '" . $_SESSION['PO'.$identifier]->Status . "' + status = '" . $_SESSION['PO'.$identifier]->Status . "', + stat_comment = '" . $_SESSION['PO'.$identifier]->StatusComments . "' WHERE orderno = '" . $_SESSION['PO'.$identifier]->OrderNo ."'"; $ErrMsg = _('The purchase order could not be updated because'); $DbgMsg = _('The SQL statement used to update the purchase order header record, that failed was'); $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - + /*Now Update the purchase order detail records */ foreach ($_SESSION['PO'.$identifier]->LineItems as $POLine) { $result=DB_query($sql,$db,'','',true); @@ -382,6 +400,9 @@ } } +if(isset($_GET['Complete'])){ + $_SESSION['PO'.$identifier]->LineItems[$_GET['Complete']]->Completed=1; +} if (isset($_POST['EnterLine'])){ /*Inputs from the form directly without selecting a stock item from the search */ $AllowUpdate = true; /*always assume the best */ @@ -683,8 +704,13 @@ <td>' . $POLine->SuppliersUnit . '</td> <td><input type="text" class="number" name="SuppPrice' . $POLine->LineNo . '" size="10" value="' . round(($POLine->Price *$POLine->ConversionFactor),$_SESSION['PO'.$identifier]->CurrDecimalPlaces) .'"></td> <td class="number">' . $DisplayLineTotal . '</td> - <td><input type="text" class="date" alt="' .$_SESSION['DefaultDateFormat'].'" name="ReqDelDate' . $POLine->LineNo.'" size="10" value="' .$POLine->ReqDelDate .'"></td> - <td><a href="' . $_SERVER['PHP_SELF'] . '?identifier='.$identifier. '&Delete=' . $POLine->LineNo . '">' . _('Delete') . '</a></td></tr>'; + <td><input type="text" class="date" alt="' .$_SESSION['DefaultDateFormat'].'" name="ReqDelDate' . $POLine->LineNo.'" size="10" value="' .$POLine->ReqDelDate .'"></td>'; + if ($POLine->QtyReceived !=0 AND $POLine->Completed!=1){ + echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?identifier='.$identifier .'&Complete=' . $POLine->LineNo . '">' . _('Complete') . '</a></td>'; + } elseif ($POLine->QtyReceived ==0) { + echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?identifier='.$identifier .'&Delete=' . $POLine->LineNo . '">' . _('Delete'). '</a></td>'; + } + echo '</tr>'; $_SESSION['PO'.$identifier]->Total += $LineTotal; } } Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2011-08-10 10:21:25 UTC (rev 4655) +++ trunk/doc/Change.log 2011-08-11 10:08:05 UTC (rev 4656) @@ -1,5 +1,7 @@ webERP Change Log +11/8/11 Phil: GoodsReceived.php now has checkbox to flag the order line as complete - even though the quantity delivered might be short of the order quantity. +11/8/11 Phil: PO_Items.php link to complete uncompleted lines - status of order is changed to complete is all lines are completed 10/8/11 Phil: POReport.php added link to detail purchase order inquiry 10/8/11 Phil: PO_SelectPurchOrder.php and outstanding purchase order searches now show the delivery date (from the purchase order header) line items may have different delivery dates. 10/8/11 Phil: Stocks.php changing the stock category to one with a different stock account now creates a journal (if stock is linked to GL) to move the cost of the stock from the old GL account to the new GL account Modified: trunk/includes/DefinePOClass.php =================================================================== --- trunk/includes/DefinePOClass.php 2011-08-10 10:21:25 UTC (rev 4655) +++ trunk/includes/DefinePOClass.php 2011-08-11 10:08:05 UTC (rev 4656) @@ -93,7 +93,7 @@ $GLCode, $ReqDelDate, $ShiptRef, - 0, + $Completed, $JobRef, $QtyInv, $QtyRecd, @@ -276,7 +276,8 @@ $this->Deleted = false; $this->SerialItems = array(); /*if Controlled then need to populate this later */ $this->SerialItemsValid=false; - $this->AssetID= $AssetID; + $this->AssetID = $AssetID; + } } ?> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-08-11 10:08:12
|
Revision: 4656 http://web-erp.svn.sourceforge.net/web-erp/?rev=4656&view=rev Author: daintree Date: 2011-08-11 10:08:05 +0000 (Thu, 11 Aug 2011) Log Message: ----------- 11/8/11 Phil: GoodsReceived.php now has checkbox to flag the order line as complete - even though the quantity delivered might be short of the order quantity. 11/8/11 Phil: PO_Items.php link to complete uncompleted lines - status of order is changed to complete is all lines are completed Modified Paths: -------------- trunk/GoodsReceived.php trunk/PO_Items.php trunk/doc/Change.log trunk/includes/DefinePOClass.php Modified: trunk/GoodsReceived.php =================================================================== --- trunk/GoodsReceived.php 2011-08-10 10:21:25 UTC (rev 4655) +++ trunk/GoodsReceived.php 2011-08-11 10:08:05 UTC (rev 4656) @@ -47,6 +47,11 @@ $RecvQty = 0; } $_SESSION['PO'.$identifier]->LineItems[$Line->LineNo]->ReceiveQty = $RecvQty; + if (isset($_POST['Complete_' . $Line->LineNo])){ + $_SESSION['PO'.$identifier]->LineItems[$Line->LineNo]->Completed = 1; + } else { + $_SESSION['PO'.$identifier]->LineItems[$Line->LineNo]->Completed = 0; + } } } @@ -75,7 +80,7 @@ echo '<table class="selection"> <tr> <td>'. _('Date Goods/Service Received'). ':</td> - <td><input type="text" class=date alt="'. $_SESSION['DefaultDateFormat'] .'" maxlength=10 size=10 onChange="return isDate(this, this.value, '."'". + <td><input type="text" class="date" alt="'. $_SESSION['DefaultDateFormat'] .'" maxlength=10 size=10 onChange="return isDate(this, this.value, '."'". $_SESSION['DefaultDateFormat']."'".')" name="DefaultReceivedDate" value="' . $_POST['DefaultReceivedDate'] . '"></td> </tr> </table> @@ -96,7 +101,8 @@ <th>' . _('Quantity') . '<br />' . _('Ordered') . '</th> <th>' . _('Units') . '</th> <th>' . _('Already') . '<br />' . _('Received') . '</th> - <th>' . _('This Delivery') . '<br />' . _('Quantity') . '</th>'; + <th>' . _('This Delivery') . '<br />' . _('Quantity') . '</th> + <th>' . _('Completed') . '</th>'; if ($_SESSION['ShowValueOnGRN']==1) { echo '<th>' . _('Price') . '</th> @@ -147,23 +153,28 @@ //Now Display LineItem echo '<td>' . $LnItm->StockID . '</td> <td>' . $LnItm->ItemDescription . '</td> - <td class=number>' . $DisplaySupplierQtyOrd . '</td> + <td class="number">' . $DisplaySupplierQtyOrd . '</td> <td>' . $LnItm->SuppliersUnit . '</td> - <td class=number>' . $DisplaySupplierQtyRec . '</td> - <td class=number>' . $LnItm->ConversionFactor . '</td> - <td class=number>' . $DisplayQtyOrd . '</td> + <td class="number">' . $DisplaySupplierQtyRec . '</td> + <td class="number">' . $LnItm->ConversionFactor . '</td> + <td class="number">' . $DisplayQtyOrd . '</td> <td>' . $LnItm->Units . '</td> - <td class=number>' . $DisplayQtyRec . '</td> - <td class=number>'; + <td class="number">' . $DisplayQtyRec . '</td> + <td class="number">'; if ($LnItm->Controlled == 1) { echo '<input type=hidden name="RecvQty_' . $LnItm->LineNo . '" value="' . $LnItm->ReceiveQty . '"><a href="GoodsReceivedControlled.php?identifier=' . $identifier . '&LineNo=' . $LnItm->LineNo . '">' . number_format($LnItm->ReceiveQty,$LnItm->DecimalPlaces) . '</a></td>'; } else { - echo '<input type="text" class=number name="RecvQty_' . $LnItm->LineNo . '" maxlength=10 size=10 value="' . $LnItm->ReceiveQty . '"></td>'; + echo '<input type="text" class="number" name="RecvQty_' . $LnItm->LineNo . '" maxlength=10 size=10 value="' . $LnItm->ReceiveQty . '"></td>'; } - + echo '<td><input type="checkbox" name="Complete_'. $LnItm->LineNo . '"'; + if ($LnItm->Completed ==1){ + echo ' checked'; + } + echo ' /></td>'; + if ($_SESSION['ShowValueOnGRN']==1) { echo '<td class="number">' . $DisplayPrice . '</td>'; echo '<td class="number">' . $DisplayLineTotal . '</td>'; @@ -341,9 +352,11 @@ $PeriodNo = GetPeriod($_POST['DefaultReceivedDate'], $db); $_POST['DefaultReceivedDate'] = FormatDateForSQL($_POST['DefaultReceivedDate']); - + $OrderCompleted = true; //assume all received and completed - now test in case not foreach ($_SESSION['PO'.$identifier]->LineItems as $OrderLine) { - + if ($OrderLine->Completed ==0){ + $OrderCompleted = false; + } if ($OrderLine->ReceiveQty !=0 AND $OrderLine->ReceiveQty!='' AND isset($OrderLine->ReceiveQty)) { $LocalCurrencyPrice = ($OrderLine->Price / $_SESSION['PO'.$identifier]->ExRate); @@ -390,7 +403,7 @@ $SQL = "UPDATE purchorderdetails SET quantityrecd = quantityrecd + '" . $OrderLine->ReceiveQty . "', stdcostunit='" . $_SESSION['PO'.$identifier]->LineItems[$OrderLine->LineNo]->StandardCost . "', - completed=0 + completed='" . $_SESSION['PO'.$identifier]->LineItems[$OrderLine->LineNo]->Completed . "' WHERE podetailitem = '" . $OrderLine->PODetailRec . "'"; } @@ -670,10 +683,8 @@ } /*Quantity received is != 0 */ } /*end of OrderLine loop */ - - - if ($_SESSION['PO'.$identifier]->AllLinesReceived()==1) { //all lines on the purchase order are now completed - $StatusComment=date($_SESSION['DefaultDateFormat']) .' - ' . _('Order Completed') .'<br />' . $_SESSION['PO'.$identifier]->StatusComments; + if ($_SESSION['PO'.$identifier]->AllLinesReceived()==1 OR $OrderCompleted) { //all lines on the purchase order are now completed + $StatusComment=date($_SESSION['DefaultDateFormat']) .' - ' . _('Order Completed on entry of GRN') .'<br />' . $_SESSION['PO'.$identifier]->StatusComments; $sql="UPDATE purchorders SET status='Completed', stat_comment='" . $StatusComment . "' Modified: trunk/PO_Items.php =================================================================== --- trunk/PO_Items.php 2011-08-10 10:21:25 UTC (rev 4655) +++ trunk/PO_Items.php 2011-08-11 10:08:05 UTC (rev 4656) @@ -83,7 +83,8 @@ } else { $UserDetails = ' ' . $_SESSION['UsersRealName'] . ' '; } - if ($_SESSION['AutoAuthorisePO']==1) { //if the user has authority to authorise the PO then it will automatically be authorised + if ($_SESSION['AutoAuthorisePO']==1) { + //if the user has authority to authorise the PO then it will automatically be authorised $AuthSQL ="SELECT authlevel FROM purchorderauth WHERE userid='".$_SESSION['UserID']."' @@ -233,7 +234,23 @@ prnMsg(_('Purchase Order') . ' ' . $_SESSION['PO'.$identifier]->OrderNo . ' ' . _('on') . ' ' . $_SESSION['PO'.$identifier]->SupplierName . ' ' . _('has been created'),'success'); } else { /*its an existing order need to update the old order info */ - + /*Check to see if there are any incomplete lines on the order */ + $Completed = true; //assume it is completed i.e. all lines are flagged as completed + foreach ($_SESSION['PO'.$identifier]->LineItems as $POLine) { + if ($POLine->Completed==0){ + $Completed = false; + break; + } + } + if ($Completed){ + $_SESSION['PO'.$identifier]->Status = 'Completed'; + if (IsEmailAddress($_SESSION['UserEmail'])){ + $UserChangedStatus = ' <a href="mailto:' . $_SESSION['UserEmail'] . '">' . $_SESSION['UsersRealName']. '</a>'; + } else { + $UserChangedStatus = ' ' . $_SESSION['UsersRealName'] . ' '; + } + $_SESSION['PO'.$identifier]->StatusComments = date($_SESSION['DefaultDateFormat']).' - ' . _('Order completed by') . $UserChangedStatus . '<br />' .$_SESSION['PO'.$identifier]->StatusComments; + } /*Update the purchase order header with any changes */ $sql = "UPDATE purchorders SET supplierno = '" . $_SESSION['PO'.$identifier]->SupplierID . "' , @@ -264,13 +281,14 @@ contact='" . $_SESSION['PO'.$identifier]->Contact . "', paymentterms='" . $_SESSION['PO'.$identifier]->PaymentTerms . "', allowprint='" . $_SESSION['PO'.$identifier]->AllowPrintPO . "', - status = '" . $_SESSION['PO'.$identifier]->Status . "' + status = '" . $_SESSION['PO'.$identifier]->Status . "', + stat_comment = '" . $_SESSION['PO'.$identifier]->StatusComments . "' WHERE orderno = '" . $_SESSION['PO'.$identifier]->OrderNo ."'"; $ErrMsg = _('The purchase order could not be updated because'); $DbgMsg = _('The SQL statement used to update the purchase order header record, that failed was'); $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - + /*Now Update the purchase order detail records */ foreach ($_SESSION['PO'.$identifier]->LineItems as $POLine) { $result=DB_query($sql,$db,'','',true); @@ -382,6 +400,9 @@ } } +if(isset($_GET['Complete'])){ + $_SESSION['PO'.$identifier]->LineItems[$_GET['Complete']]->Completed=1; +} if (isset($_POST['EnterLine'])){ /*Inputs from the form directly without selecting a stock item from the search */ $AllowUpdate = true; /*always assume the best */ @@ -683,8 +704,13 @@ <td>' . $POLine->SuppliersUnit . '</td> <td><input type="text" class="number" name="SuppPrice' . $POLine->LineNo . '" size="10" value="' . round(($POLine->Price *$POLine->ConversionFactor),$_SESSION['PO'.$identifier]->CurrDecimalPlaces) .'"></td> <td class="number">' . $DisplayLineTotal . '</td> - <td><input type="text" class="date" alt="' .$_SESSION['DefaultDateFormat'].'" name="ReqDelDate' . $POLine->LineNo.'" size="10" value="' .$POLine->ReqDelDate .'"></td> - <td><a href="' . $_SERVER['PHP_SELF'] . '?identifier='.$identifier. '&Delete=' . $POLine->LineNo . '">' . _('Delete') . '</a></td></tr>'; + <td><input type="text" class="date" alt="' .$_SESSION['DefaultDateFormat'].'" name="ReqDelDate' . $POLine->LineNo.'" size="10" value="' .$POLine->ReqDelDate .'"></td>'; + if ($POLine->QtyReceived !=0 AND $POLine->Completed!=1){ + echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?identifier='.$identifier .'&Complete=' . $POLine->LineNo . '">' . _('Complete') . '</a></td>'; + } elseif ($POLine->QtyReceived ==0) { + echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?identifier='.$identifier .'&Delete=' . $POLine->LineNo . '">' . _('Delete'). '</a></td>'; + } + echo '</tr>'; $_SESSION['PO'.$identifier]->Total += $LineTotal; } } Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2011-08-10 10:21:25 UTC (rev 4655) +++ trunk/doc/Change.log 2011-08-11 10:08:05 UTC (rev 4656) @@ -1,5 +1,7 @@ webERP Change Log +11/8/11 Phil: GoodsReceived.php now has checkbox to flag the order line as complete - even though the quantity delivered might be short of the order quantity. +11/8/11 Phil: PO_Items.php link to complete uncompleted lines - status of order is changed to complete is all lines are completed 10/8/11 Phil: POReport.php added link to detail purchase order inquiry 10/8/11 Phil: PO_SelectPurchOrder.php and outstanding purchase order searches now show the delivery date (from the purchase order header) line items may have different delivery dates. 10/8/11 Phil: Stocks.php changing the stock category to one with a different stock account now creates a journal (if stock is linked to GL) to move the cost of the stock from the old GL account to the new GL account Modified: trunk/includes/DefinePOClass.php =================================================================== --- trunk/includes/DefinePOClass.php 2011-08-10 10:21:25 UTC (rev 4655) +++ trunk/includes/DefinePOClass.php 2011-08-11 10:08:05 UTC (rev 4656) @@ -93,7 +93,7 @@ $GLCode, $ReqDelDate, $ShiptRef, - 0, + $Completed, $JobRef, $QtyInv, $QtyRecd, @@ -276,7 +276,8 @@ $this->Deleted = false; $this->SerialItems = array(); /*if Controlled then need to populate this later */ $this->SerialItemsValid=false; - $this->AssetID= $AssetID; + $this->AssetID = $AssetID; + } } ?> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-08-10 10:21:32
|
Revision: 4655 http://web-erp.svn.sourceforge.net/web-erp/?rev=4655&view=rev Author: daintree Date: 2011-08-10 10:21:25 +0000 (Wed, 10 Aug 2011) Log Message: ----------- POReport.php added link to detail purchase order inquiry 10/8/11 Phil: PO_SelectPurchOrder.php and outstanding purchase order searches now show the delivery date (from the purchase order header) line items may have different delivery dates. 10/8/11 Phil: Stocks.php changing the stock category to one with a different stock account now creates a journal (if stock is linked to GL) to move the cost of the stock from the old GL account to the new GL account Modified Paths: -------------- trunk/POReport.php trunk/PO_SelectOSPurchOrder.php trunk/PO_SelectPurchOrder.php trunk/Stocks.php trunk/doc/Change.log trunk/includes/DateFunctions.inc Modified: trunk/POReport.php =================================================================== --- trunk/POReport.php 2011-08-08 10:32:39 UTC (rev 4654) +++ trunk/POReport.php 2011-08-10 10:21:25 UTC (rev 4655) @@ -72,9 +72,9 @@ //####_SUBMIT_SUBMIT_SUBMIT_SUBMIT_SUBMIT_SUBMIT_SUBMIT_SUBMIT_SUBMIT_SUBMIT_SUBMIT_SUBMIT#### -function submit(&$db,$PartNumber,$PartNumberOp,$SupplierId,$SupplierIdOp,$SupplierName,$SupplierNameOp,$SaveSummaryType) -{ +function submit(&$db,$PartNumber,$PartNumberOp,$SupplierId,$SupplierIdOp,$SupplierName,$SupplierNameOp,$SaveSummaryType) { + global $rootpath; //initialize no input errors $InputError = 0; @@ -502,7 +502,7 @@ $Detail_Array['suppliers.suppname,suppliers.supplierid,purchorderdetails.orderno'] = _('Supplier Name'); // Display Header info - echo '<table class=selection>'; + echo '<table class="selection">'; if ($_POST['ReportType'] == 'Summary') { $SortBy_Display = $Summary_Array[$SaveSummaryType]; } else { @@ -533,7 +533,7 @@ <td>' . $_POST['Category'] . '</td></tr></table>'; if ($_POST['ReportType'] == 'Detail') { - echo '<br /><table class=selection width=98%>'; + echo '<br /><table class="selection" width=98%>'; if ($_POST['DateType'] == 'Order') { echo '<tr><th>' . _('Order No') . '</th> <th>' . _('Part Number') . '</th> @@ -561,7 +561,7 @@ } $linectr++; // Detail for both DateType of Order - printf('<td>%s</td> + printf('<td><a href="'. $rootpath . '/PO_OrderDetails.php?OrderNo=%s">%s</a></td> <td>%s</td> <td>%s</td> <td>%s</td> @@ -575,6 +575,7 @@ <td>%s</td> </tr>', $myrow['orderno'], + $myrow['orderno'], $myrow['itemcode'], ConvertSQLDate($myrow['orddate']), $myrow['supplierno'], Modified: trunk/PO_SelectOSPurchOrder.php =================================================================== --- trunk/PO_SelectOSPurchOrder.php 2011-08-08 10:32:39 UTC (rev 4654) +++ trunk/PO_SelectOSPurchOrder.php 2011-08-10 10:21:25 UTC (rev 4655) @@ -282,6 +282,7 @@ $SQL = "SELECT purchorders.orderno, suppliers.suppname, purchorders.orddate, + purchorders.deliverydate, purchorders.initiator, purchorders.status, purchorders.requisitionno, @@ -317,6 +318,7 @@ purchorders.orderno, suppliers.suppname, purchorders.orddate, + purchorders.deliverydate, purchorders.status, purchorders.initiator, purchorders.requisitionno, @@ -346,6 +348,7 @@ purchorders.orderno, suppliers.suppname, purchorders.orddate, + purchorders.deliverydate, purchorders.status, purchorders.initiator, purchorders.requisitionno, @@ -377,6 +380,7 @@ purchorders.orderno, suppliers.suppname, purchorders.orddate, + purchorders.deliverydate, purchorders.status, purchorders.initiator, purchorders.requisitionno, @@ -405,6 +409,7 @@ purchorders.orderno, suppliers.suppname, purchorders.orddate, + purchorders.deliverydate, purchorders.status, purchorders.initiator, purchorders.requisitionno, @@ -437,13 +442,13 @@ /*show a table of the orders returned by the SQL */ - echo '<table cellpadding=2 colspan=7 width=97% class=selection>'; + echo '<table cellpadding="2" colspan="7 width="97%" class="selection">'; -// '</td><td class="tableheader">' . _('Receive') . echo '<tr> <th>' . _('Order #') . '</th> <th>' . _('Order Date') . '</th> + <th>' . _('Delivery Date') . '</th> <th>' . _('Initiated by') . '</th> <th>' . _('Supplier') . '</th> <th>' . _('Currency') . '</th>'; @@ -469,8 +474,7 @@ $ModifyPage = $rootpath . '/PO_Header.php?ModifyOrderNumber=' . $myrow['orderno']; if ($myrow['status'] == 'Printed') { - $ReceiveOrder = '<a href="'.$rootpath . '/GoodsReceived.php?PONumber=' . $myrow['orderno'].'">'. - _('Receive').'</a>'; + $ReceiveOrder = '<a href="'.$rootpath . '/GoodsReceived.php?PONumber=' . $myrow['orderno'].'">'. _('Receive') . '</a>'; } else { $ReceiveOrder = ''; } @@ -487,15 +491,17 @@ $FormatedOrderDate = ConvertSQLDate($myrow['orddate']); + $FormatedDeliveryDate = ConvertSQLDate($myrow['deliverydate']); $FormatedOrderValue = number_format($myrow['ordervalue'],2); echo '<td><a href="'.$ModifyPage.'">' . $myrow['orderno'] . '</a></td> <td>' . $FormatedOrderDate . '</td> + <td>' . $FormatedDeliveryDate . '</td> <td>' . $myrow['initiator'] . '</td> <td>' . $myrow['suppname'] . '</td> <td>' . $myrow['currcode'] . '</td>'; if (in_array($PricesSecurity, $_SESSION['AllowedPageSecurityTokens']) OR !isset($PricesSecurity)) { - echo '<td class=number>'.$FormatedOrderValue . '</td>'; + echo '<td class="number">'.$FormatedOrderValue . '</td>'; } echo '<td>' . _($myrow['status']) . '</td> <td>' . $PrintPurchOrder . '</td> Modified: trunk/PO_SelectPurchOrder.php =================================================================== --- trunk/PO_SelectPurchOrder.php 2011-08-08 10:32:39 UTC (rev 4654) +++ trunk/PO_SelectPurchOrder.php 2011-08-10 10:21:25 UTC (rev 4655) @@ -193,8 +193,8 @@ } echo '<td><input type="submit" name="SelectedStockItem" value="' . $myrow['stockid'] . '"</td> <td>' . $myrow['description'] . '</td> - <td class=number>' . $myrow['qoh'] . '</td> - <td class=number>' . $myrow['qord'] . '</td> + <td class="number">' . $myrow['qoh'] . '</td> + <td class="number">' . $myrow['qord'] . '</td> <td>' . $myrow['units'] . '</td> </tr>'; $j++; @@ -229,6 +229,7 @@ $SQL = "SELECT purchorders.orderno, suppliers.suppname, purchorders.orddate, + purchorders.deliverydate, purchorders.initiator, purchorders.requisitionno, purchorders.allowprint, @@ -263,6 +264,7 @@ $SQL = "SELECT purchorders.orderno, suppliers.suppname, purchorders.orddate, + purchorders.deliverydate, purchorders.initiator, purchorders.requisitionno, purchorders.allowprint, @@ -293,6 +295,7 @@ $SQL = "SELECT purchorders.orderno, suppliers.suppname, purchorders.orddate, + purchorders.deliverydate, purchorders.initiator, purchorders.requisitionno, purchorders.allowprint, @@ -324,6 +327,7 @@ $SQL = "SELECT purchorders.orderno, suppliers.suppname, purchorders.orddate, + purchorders.deliverydate, purchorders.initiator, purchorders.requisitionno, purchorders.allowprint, @@ -353,6 +357,7 @@ $SQL = "SELECT purchorders.orderno, suppliers.suppname, purchorders.orddate, + purchorders.deliverydate, purchorders.initiator, purchorders.requisitionno, purchorders.allowprint, @@ -386,13 +391,14 @@ if (DB_num_rows($PurchOrdersResult) > 0) { /*show a table of the orders returned by the SQL */ - echo '<table cellpadding=2 colspan=7 width=90% class=selection>'; + echo '<table cellpadding="2" colspan="7" width="90%" class="selection">'; $TableHeader = '<tr> <th>' . _('View') . '</th> <th>' . _('Supplier') . '</th> <th>' . _('Currency') . '</th> <th>' . _('Requisition') . '</th> <th>' . _('Order Date') . '</th> + <th>' . _('Delivery Date') . '</th> <th>' . _('Initiator') . '</th> <th>' . _('Order Total') . '</th> <th>' . _('Status') . '</th> @@ -410,6 +416,7 @@ } $ViewPurchOrder = $rootpath . '/PO_OrderDetails.php?OrderNo=' . $myrow['orderno']; $FormatedOrderDate = ConvertSQLDate($myrow['orddate']); + $FormatedDeliveryDate = ConvertSQLDate($myrow['deliverydate']); $FormatedOrderValue = number_format($myrow['ordervalue'], $myrow['decimalplaces']); /* View Supplier Currency Requisition Order Date Initiator Order Total ModifyPage, $myrow["orderno"], $myrow["suppname"], $myrow["currcode"], $myrow["requisitionno"] $FormatedOrderDate, $myrow["initiator"] $FormatedOrderValue Order Status*/ @@ -418,8 +425,9 @@ <td>' . $myrow['currcode'] . '</td> <td>' . $myrow['requisitionno'] . '</td> <td>' . $FormatedOrderDate . '</td> + <td>' . $FormatedDeliveryDate . '</td> <td>' . $myrow['initiator'] . '</td> - <td class=number>' . $FormatedOrderValue . '</td> + <td class="number">' . $FormatedOrderValue . '</td> <td>' . _($myrow['status']) . '</td> </tr>'; //$myrow['status'] is a string which has gettext translations from PO_Header.php script Modified: trunk/Stocks.php =================================================================== --- trunk/Stocks.php 2011-08-08 10:32:39 UTC (rev 4654) +++ trunk/Stocks.php 2011-08-10 10:21:25 UTC (rev 4655) @@ -211,27 +211,43 @@ */ $sql = "SELECT mbflag, controlled, - serialised - FROM stockmaster WHERE stockid = '".$StockID."'"; + serialised, + materialcost+labourcost+overheadcost AS itemcost, + stockcategory.stockact + FROM stockmaster + INNER JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid + WHERE stockid = '".$StockID."'"; $MBFlagResult = DB_query($sql,$db); $myrow = DB_fetch_row($MBFlagResult); $OldMBFlag = $myrow[0]; $OldControlled = $myrow[1]; $OldSerialised = $myrow[2]; + $UnitCost = $myrow[3]; + $OldStockAccount = $myrow[4]; $sql = "SELECT SUM(locstock.quantity) FROM locstock WHERE stockid='".$StockID."' GROUP BY stockid"; $result = DB_query($sql,$db); - $stkqtychk = DB_fetch_row($result); + $StockQtyRow = DB_fetch_row($result); + /*Now check the GL account of the new category to see if it is different to the old stock gl account */ + + $result = DB_query("SELECT stockact + FROM stockcategory + WHERE categoryid='" . $_POST['CategoryID'] . "'", + $db); + $NewStockActRow = DB_fetch_array($result); + $NewStockAct = $NewStockActRow['stockact']; + if ($OldMBFlag != $_POST['MBFlag']){ if (($OldMBFlag == 'M' OR $OldMBFlag=='B') AND ($_POST['MBFlag']=='A' OR $_POST['MBFlag']=='K' OR $_POST['MBFlag']=='D' OR $_POST['MBFlag']=='G')){ /*then need to check that there is no stock holding first */ /* stock holding OK for phantom (ghost) items */ - if ($stkqtychk[0]!=0 AND $OldMBFlag!='G'){ + if ($StockQtyRow[0]!=0 AND $OldMBFlag!='G'){ $InputError=1; - prnMsg( _('The make or buy flag cannot be changed from') . ' ' . $OldMBFlag . ' ' . _('to') . ' ' . $_POST['MBFlag'] . ' ' . _('where there is a quantity of stock on hand at any location') . '. ' . _('Currently there are') . ' ' . $stkqtychk[0] . ' ' . _('on hand') , 'errror'); + prnMsg( _('The make or buy flag cannot be changed from') . ' ' . $OldMBFlag . ' ' . _('to') . ' ' . $_POST['MBFlag'] . ' ' . _('where there is a quantity of stock on hand at any location') . '. ' . _('Currently there are') . ' ' . $StockQtyRow[0] . ' ' . _('on hand') , 'errror'); } /* don't allow controlled/serialized */ if ($_POST['Controlled']==1){ @@ -296,18 +312,21 @@ } /* Do some checks for changes in the Serial & Controlled setups */ - if ($OldControlled != $_POST['Controlled'] AND $stkqtychk[0]!=0){ + if ($OldControlled != $_POST['Controlled'] AND $StockQtyRow[0]!=0){ $InputError=1; prnMsg( _('You can not change a Non-Controlled Item to Controlled (or back from Controlled to non-controlled when there is currently stock on hand for the item') , 'error'); } - if ($OldSerialised != $_POST['Serialised'] AND $stkqtychk[0]!=0){ + if ($OldSerialised != $_POST['Serialised'] AND $StockQtyRow[0]!=0){ $InputError=1; prnMsg( _('You can not change a Serialised Item to Non-Serialised (or vice-versa) when there is a quantity on hand for the item') , 'error'); } if ($InputError == 0){ + + DB_Txn_Begin($db); + $sql = "UPDATE stockmaster SET longdescription='" . $_POST['LongDescription'] . "', description='" . $_POST['Description'] . "', @@ -333,12 +352,12 @@ $ErrMsg = _('The stock item could not be updated because'); $DbgMsg = _('The SQL that was used to update the stock item and failed was'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); //delete any properties for the item no longer relevant with the change of category $result = DB_query("DELETE FROM stockitemproperties WHERE stockid ='" . $StockID . "'", - $db); + $db,$ErrMsg,$DbgMsg,true); //now insert any item properties for ($i=0;$i<$_POST['PropertyCounter'];$i++){ @@ -356,8 +375,47 @@ VALUES ('" . $StockID . "', '" . $_POST['PropID' . $i] . "', '" . $_POST['PropValue' . $i] . "')", - $db); + $db,$ErrMsg,$DbgMsg,true); } //end of loop around properties defined for the category + + if ($OldStockAccount != $NewStockAct AND $_SESSION['CompanyRecord']['gllinkstock']==1) { + /*Then we need to make a journal to transfer the cost to the new stock account */ + $JournalNo = GetNextTransNo(0,$db); //enter as a journal + $SQL = "INSERT INTO gltrans (type, + typeno, + trandate, + periodno, + account, + narrative, + amount) + VALUES ( 0, + '" . $JournalNo . "', + '" . Date('Y-m-d') . "', + '" . GetPeriodNo(Date('Y-m-d'),true) . "', + '" . $NewStockAccount . "', + '" . $StockID . ' ' . _('Change stock category') . "', + '" . ($UnitCost* $StockQtyRow[0]) . "'"; + $ErrMsg = _('The stock cost journal could not be inserted because'); + $DbgMsg = _('The SQL that was used to create the stock cost journal and failed was'); + $result = DB_query($sql,$db, $ErrMsg, $DbgMsg,true); + $SQL = "INSERT INTO gltrans (type, + typeno, + trandate, + periodno, + account, + narrative, + amount) + VALUES ( 0, + '" . $JournalNo . "', + '" . Date('Y-m-d') . "', + '" . GetPeriodNo(Date('Y-m-d'),true) . "', + '" . $OldStockAccount . "', + '" . $StockID . ' ' . _('Change stock category') . "', + '" . (-$UnitCost* $StockQtyRow[0]) . "'"; + $result = DB_query($sql,$db, $ErrMsg, $DbgMsg,true); + + } /* end if the stock category changed and forced a change in stock cost account */ + DB_Txn_Commit($db); prnMsg( _('Stock Item') . ' ' . $StockID . ' ' . _('has been updated'), 'success'); echo '<br />'; } Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2011-08-08 10:32:39 UTC (rev 4654) +++ trunk/doc/Change.log 2011-08-10 10:21:25 UTC (rev 4655) @@ -1,5 +1,8 @@ webERP Change Log +10/8/11 Phil: POReport.php added link to detail purchase order inquiry +10/8/11 Phil: PO_SelectPurchOrder.php and outstanding purchase order searches now show the delivery date (from the purchase order header) line items may have different delivery dates. +10/8/11 Phil: Stocks.php changing the stock category to one with a different stock account now creates a journal (if stock is linked to GL) to move the cost of the stock from the old GL account to the new GL account 7/8/11 Phil: SelectProduct.php now disables transactions on items flagged as obsolete (discontinued). Also obsolete items are shown as such in the selection list - suggested by Klaus (opto) 7/8/11 Ricard: Corrected INNER JOIN ON clause in sql used in InventoryQuantities.php script 7/8/11 Klaus: Added docuwiki links to WikiLinks function in MiscFunctions.php and allow Docuwiki option in SystemParameters.php Modified: trunk/includes/DateFunctions.inc =================================================================== --- trunk/includes/DateFunctions.inc 2011-08-08 10:32:39 UTC (rev 4654) +++ trunk/includes/DateFunctions.inc 2011-08-10 10:21:25 UTC (rev 4655) @@ -875,7 +875,7 @@ } } /* Find the unix timestamp of the last period end date in periods table */ - $sql = 'SELECT MAX(lastdate_in_period), MAX(periodno) from periods'; + $sql = "SELECT MAX(lastdate_in_period), MAX(periodno) from periods"; $result = DB_query($sql, $db); $myrow=DB_fetch_row($result); if (is_null($myrow[0])){ @@ -889,7 +889,7 @@ $LastPeriod = $myrow[1]; } /* Find the unix timestamp of the first period end date in periods table */ - $sql = 'SELECT MIN(lastdate_in_period), MIN(periodno) from periods'; + $sql = "SELECT MIN(lastdate_in_period), MIN(periodno) from periods"; $result = DB_query($sql, $db); $myrow=DB_fetch_row($result); $Date_Array = explode('-', $myrow[0]); @@ -929,7 +929,7 @@ } } else if (!PeriodExists(mktime(0,0,0,Date('m',$TransDate)+1,Date('d',$TransDate),Date('Y',$TransDate)), $db)) { /* Make sure the following months period exists */ - $sql = 'SELECT MAX(lastdate_in_period), MAX(periodno) from periods'; + $sql = "SELECT MAX(lastdate_in_period), MAX(periodno) from periods"; $result = DB_query($sql, $db); $myrow=DB_fetch_row($result); $Date_Array = explode('-', $myrow[0]); @@ -941,8 +941,10 @@ /* Now return the period number of the transaction */ $MonthAfterTransDate = Mktime(0,0,0,Date('m',$TransDate)+1,Date('d',$TransDate),Date('Y',$TransDate)); - $GetPrdSQL = "SELECT periodno FROM periods WHERE lastdate_in_period < '" . - Date('Y-m-d', $MonthAfterTransDate) . "' AND lastdate_in_period >= '" . Date('Y-m-d', $TransDate) . "'"; + $GetPrdSQL = "SELECT periodno + FROM periods + WHERE lastdate_in_period < '" . Date('Y-m-d', $MonthAfterTransDate) . "' + AND lastdate_in_period >= '" . Date('Y-m-d', $TransDate) . "'"; $ErrMsg = _('An error occurred in retrieving the period number'); $GetPrdResult = DB_query($GetPrdSQL,$db,$ErrMsg); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-08-10 10:21:32
|
Revision: 4655 http://web-erp.svn.sourceforge.net/web-erp/?rev=4655&view=rev Author: daintree Date: 2011-08-10 10:21:25 +0000 (Wed, 10 Aug 2011) Log Message: ----------- POReport.php added link to detail purchase order inquiry 10/8/11 Phil: PO_SelectPurchOrder.php and outstanding purchase order searches now show the delivery date (from the purchase order header) line items may have different delivery dates. 10/8/11 Phil: Stocks.php changing the stock category to one with a different stock account now creates a journal (if stock is linked to GL) to move the cost of the stock from the old GL account to the new GL account Modified Paths: -------------- trunk/POReport.php trunk/PO_SelectOSPurchOrder.php trunk/PO_SelectPurchOrder.php trunk/Stocks.php trunk/doc/Change.log trunk/includes/DateFunctions.inc Modified: trunk/POReport.php =================================================================== --- trunk/POReport.php 2011-08-08 10:32:39 UTC (rev 4654) +++ trunk/POReport.php 2011-08-10 10:21:25 UTC (rev 4655) @@ -72,9 +72,9 @@ //####_SUBMIT_SUBMIT_SUBMIT_SUBMIT_SUBMIT_SUBMIT_SUBMIT_SUBMIT_SUBMIT_SUBMIT_SUBMIT_SUBMIT#### -function submit(&$db,$PartNumber,$PartNumberOp,$SupplierId,$SupplierIdOp,$SupplierName,$SupplierNameOp,$SaveSummaryType) -{ +function submit(&$db,$PartNumber,$PartNumberOp,$SupplierId,$SupplierIdOp,$SupplierName,$SupplierNameOp,$SaveSummaryType) { + global $rootpath; //initialize no input errors $InputError = 0; @@ -502,7 +502,7 @@ $Detail_Array['suppliers.suppname,suppliers.supplierid,purchorderdetails.orderno'] = _('Supplier Name'); // Display Header info - echo '<table class=selection>'; + echo '<table class="selection">'; if ($_POST['ReportType'] == 'Summary') { $SortBy_Display = $Summary_Array[$SaveSummaryType]; } else { @@ -533,7 +533,7 @@ <td>' . $_POST['Category'] . '</td></tr></table>'; if ($_POST['ReportType'] == 'Detail') { - echo '<br /><table class=selection width=98%>'; + echo '<br /><table class="selection" width=98%>'; if ($_POST['DateType'] == 'Order') { echo '<tr><th>' . _('Order No') . '</th> <th>' . _('Part Number') . '</th> @@ -561,7 +561,7 @@ } $linectr++; // Detail for both DateType of Order - printf('<td>%s</td> + printf('<td><a href="'. $rootpath . '/PO_OrderDetails.php?OrderNo=%s">%s</a></td> <td>%s</td> <td>%s</td> <td>%s</td> @@ -575,6 +575,7 @@ <td>%s</td> </tr>', $myrow['orderno'], + $myrow['orderno'], $myrow['itemcode'], ConvertSQLDate($myrow['orddate']), $myrow['supplierno'], Modified: trunk/PO_SelectOSPurchOrder.php =================================================================== --- trunk/PO_SelectOSPurchOrder.php 2011-08-08 10:32:39 UTC (rev 4654) +++ trunk/PO_SelectOSPurchOrder.php 2011-08-10 10:21:25 UTC (rev 4655) @@ -282,6 +282,7 @@ $SQL = "SELECT purchorders.orderno, suppliers.suppname, purchorders.orddate, + purchorders.deliverydate, purchorders.initiator, purchorders.status, purchorders.requisitionno, @@ -317,6 +318,7 @@ purchorders.orderno, suppliers.suppname, purchorders.orddate, + purchorders.deliverydate, purchorders.status, purchorders.initiator, purchorders.requisitionno, @@ -346,6 +348,7 @@ purchorders.orderno, suppliers.suppname, purchorders.orddate, + purchorders.deliverydate, purchorders.status, purchorders.initiator, purchorders.requisitionno, @@ -377,6 +380,7 @@ purchorders.orderno, suppliers.suppname, purchorders.orddate, + purchorders.deliverydate, purchorders.status, purchorders.initiator, purchorders.requisitionno, @@ -405,6 +409,7 @@ purchorders.orderno, suppliers.suppname, purchorders.orddate, + purchorders.deliverydate, purchorders.status, purchorders.initiator, purchorders.requisitionno, @@ -437,13 +442,13 @@ /*show a table of the orders returned by the SQL */ - echo '<table cellpadding=2 colspan=7 width=97% class=selection>'; + echo '<table cellpadding="2" colspan="7 width="97%" class="selection">'; -// '</td><td class="tableheader">' . _('Receive') . echo '<tr> <th>' . _('Order #') . '</th> <th>' . _('Order Date') . '</th> + <th>' . _('Delivery Date') . '</th> <th>' . _('Initiated by') . '</th> <th>' . _('Supplier') . '</th> <th>' . _('Currency') . '</th>'; @@ -469,8 +474,7 @@ $ModifyPage = $rootpath . '/PO_Header.php?ModifyOrderNumber=' . $myrow['orderno']; if ($myrow['status'] == 'Printed') { - $ReceiveOrder = '<a href="'.$rootpath . '/GoodsReceived.php?PONumber=' . $myrow['orderno'].'">'. - _('Receive').'</a>'; + $ReceiveOrder = '<a href="'.$rootpath . '/GoodsReceived.php?PONumber=' . $myrow['orderno'].'">'. _('Receive') . '</a>'; } else { $ReceiveOrder = ''; } @@ -487,15 +491,17 @@ $FormatedOrderDate = ConvertSQLDate($myrow['orddate']); + $FormatedDeliveryDate = ConvertSQLDate($myrow['deliverydate']); $FormatedOrderValue = number_format($myrow['ordervalue'],2); echo '<td><a href="'.$ModifyPage.'">' . $myrow['orderno'] . '</a></td> <td>' . $FormatedOrderDate . '</td> + <td>' . $FormatedDeliveryDate . '</td> <td>' . $myrow['initiator'] . '</td> <td>' . $myrow['suppname'] . '</td> <td>' . $myrow['currcode'] . '</td>'; if (in_array($PricesSecurity, $_SESSION['AllowedPageSecurityTokens']) OR !isset($PricesSecurity)) { - echo '<td class=number>'.$FormatedOrderValue . '</td>'; + echo '<td class="number">'.$FormatedOrderValue . '</td>'; } echo '<td>' . _($myrow['status']) . '</td> <td>' . $PrintPurchOrder . '</td> Modified: trunk/PO_SelectPurchOrder.php =================================================================== --- trunk/PO_SelectPurchOrder.php 2011-08-08 10:32:39 UTC (rev 4654) +++ trunk/PO_SelectPurchOrder.php 2011-08-10 10:21:25 UTC (rev 4655) @@ -193,8 +193,8 @@ } echo '<td><input type="submit" name="SelectedStockItem" value="' . $myrow['stockid'] . '"</td> <td>' . $myrow['description'] . '</td> - <td class=number>' . $myrow['qoh'] . '</td> - <td class=number>' . $myrow['qord'] . '</td> + <td class="number">' . $myrow['qoh'] . '</td> + <td class="number">' . $myrow['qord'] . '</td> <td>' . $myrow['units'] . '</td> </tr>'; $j++; @@ -229,6 +229,7 @@ $SQL = "SELECT purchorders.orderno, suppliers.suppname, purchorders.orddate, + purchorders.deliverydate, purchorders.initiator, purchorders.requisitionno, purchorders.allowprint, @@ -263,6 +264,7 @@ $SQL = "SELECT purchorders.orderno, suppliers.suppname, purchorders.orddate, + purchorders.deliverydate, purchorders.initiator, purchorders.requisitionno, purchorders.allowprint, @@ -293,6 +295,7 @@ $SQL = "SELECT purchorders.orderno, suppliers.suppname, purchorders.orddate, + purchorders.deliverydate, purchorders.initiator, purchorders.requisitionno, purchorders.allowprint, @@ -324,6 +327,7 @@ $SQL = "SELECT purchorders.orderno, suppliers.suppname, purchorders.orddate, + purchorders.deliverydate, purchorders.initiator, purchorders.requisitionno, purchorders.allowprint, @@ -353,6 +357,7 @@ $SQL = "SELECT purchorders.orderno, suppliers.suppname, purchorders.orddate, + purchorders.deliverydate, purchorders.initiator, purchorders.requisitionno, purchorders.allowprint, @@ -386,13 +391,14 @@ if (DB_num_rows($PurchOrdersResult) > 0) { /*show a table of the orders returned by the SQL */ - echo '<table cellpadding=2 colspan=7 width=90% class=selection>'; + echo '<table cellpadding="2" colspan="7" width="90%" class="selection">'; $TableHeader = '<tr> <th>' . _('View') . '</th> <th>' . _('Supplier') . '</th> <th>' . _('Currency') . '</th> <th>' . _('Requisition') . '</th> <th>' . _('Order Date') . '</th> + <th>' . _('Delivery Date') . '</th> <th>' . _('Initiator') . '</th> <th>' . _('Order Total') . '</th> <th>' . _('Status') . '</th> @@ -410,6 +416,7 @@ } $ViewPurchOrder = $rootpath . '/PO_OrderDetails.php?OrderNo=' . $myrow['orderno']; $FormatedOrderDate = ConvertSQLDate($myrow['orddate']); + $FormatedDeliveryDate = ConvertSQLDate($myrow['deliverydate']); $FormatedOrderValue = number_format($myrow['ordervalue'], $myrow['decimalplaces']); /* View Supplier Currency Requisition Order Date Initiator Order Total ModifyPage, $myrow["orderno"], $myrow["suppname"], $myrow["currcode"], $myrow["requisitionno"] $FormatedOrderDate, $myrow["initiator"] $FormatedOrderValue Order Status*/ @@ -418,8 +425,9 @@ <td>' . $myrow['currcode'] . '</td> <td>' . $myrow['requisitionno'] . '</td> <td>' . $FormatedOrderDate . '</td> + <td>' . $FormatedDeliveryDate . '</td> <td>' . $myrow['initiator'] . '</td> - <td class=number>' . $FormatedOrderValue . '</td> + <td class="number">' . $FormatedOrderValue . '</td> <td>' . _($myrow['status']) . '</td> </tr>'; //$myrow['status'] is a string which has gettext translations from PO_Header.php script Modified: trunk/Stocks.php =================================================================== --- trunk/Stocks.php 2011-08-08 10:32:39 UTC (rev 4654) +++ trunk/Stocks.php 2011-08-10 10:21:25 UTC (rev 4655) @@ -211,27 +211,43 @@ */ $sql = "SELECT mbflag, controlled, - serialised - FROM stockmaster WHERE stockid = '".$StockID."'"; + serialised, + materialcost+labourcost+overheadcost AS itemcost, + stockcategory.stockact + FROM stockmaster + INNER JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid + WHERE stockid = '".$StockID."'"; $MBFlagResult = DB_query($sql,$db); $myrow = DB_fetch_row($MBFlagResult); $OldMBFlag = $myrow[0]; $OldControlled = $myrow[1]; $OldSerialised = $myrow[2]; + $UnitCost = $myrow[3]; + $OldStockAccount = $myrow[4]; $sql = "SELECT SUM(locstock.quantity) FROM locstock WHERE stockid='".$StockID."' GROUP BY stockid"; $result = DB_query($sql,$db); - $stkqtychk = DB_fetch_row($result); + $StockQtyRow = DB_fetch_row($result); + /*Now check the GL account of the new category to see if it is different to the old stock gl account */ + + $result = DB_query("SELECT stockact + FROM stockcategory + WHERE categoryid='" . $_POST['CategoryID'] . "'", + $db); + $NewStockActRow = DB_fetch_array($result); + $NewStockAct = $NewStockActRow['stockact']; + if ($OldMBFlag != $_POST['MBFlag']){ if (($OldMBFlag == 'M' OR $OldMBFlag=='B') AND ($_POST['MBFlag']=='A' OR $_POST['MBFlag']=='K' OR $_POST['MBFlag']=='D' OR $_POST['MBFlag']=='G')){ /*then need to check that there is no stock holding first */ /* stock holding OK for phantom (ghost) items */ - if ($stkqtychk[0]!=0 AND $OldMBFlag!='G'){ + if ($StockQtyRow[0]!=0 AND $OldMBFlag!='G'){ $InputError=1; - prnMsg( _('The make or buy flag cannot be changed from') . ' ' . $OldMBFlag . ' ' . _('to') . ' ' . $_POST['MBFlag'] . ' ' . _('where there is a quantity of stock on hand at any location') . '. ' . _('Currently there are') . ' ' . $stkqtychk[0] . ' ' . _('on hand') , 'errror'); + prnMsg( _('The make or buy flag cannot be changed from') . ' ' . $OldMBFlag . ' ' . _('to') . ' ' . $_POST['MBFlag'] . ' ' . _('where there is a quantity of stock on hand at any location') . '. ' . _('Currently there are') . ' ' . $StockQtyRow[0] . ' ' . _('on hand') , 'errror'); } /* don't allow controlled/serialized */ if ($_POST['Controlled']==1){ @@ -296,18 +312,21 @@ } /* Do some checks for changes in the Serial & Controlled setups */ - if ($OldControlled != $_POST['Controlled'] AND $stkqtychk[0]!=0){ + if ($OldControlled != $_POST['Controlled'] AND $StockQtyRow[0]!=0){ $InputError=1; prnMsg( _('You can not change a Non-Controlled Item to Controlled (or back from Controlled to non-controlled when there is currently stock on hand for the item') , 'error'); } - if ($OldSerialised != $_POST['Serialised'] AND $stkqtychk[0]!=0){ + if ($OldSerialised != $_POST['Serialised'] AND $StockQtyRow[0]!=0){ $InputError=1; prnMsg( _('You can not change a Serialised Item to Non-Serialised (or vice-versa) when there is a quantity on hand for the item') , 'error'); } if ($InputError == 0){ + + DB_Txn_Begin($db); + $sql = "UPDATE stockmaster SET longdescription='" . $_POST['LongDescription'] . "', description='" . $_POST['Description'] . "', @@ -333,12 +352,12 @@ $ErrMsg = _('The stock item could not be updated because'); $DbgMsg = _('The SQL that was used to update the stock item and failed was'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); //delete any properties for the item no longer relevant with the change of category $result = DB_query("DELETE FROM stockitemproperties WHERE stockid ='" . $StockID . "'", - $db); + $db,$ErrMsg,$DbgMsg,true); //now insert any item properties for ($i=0;$i<$_POST['PropertyCounter'];$i++){ @@ -356,8 +375,47 @@ VALUES ('" . $StockID . "', '" . $_POST['PropID' . $i] . "', '" . $_POST['PropValue' . $i] . "')", - $db); + $db,$ErrMsg,$DbgMsg,true); } //end of loop around properties defined for the category + + if ($OldStockAccount != $NewStockAct AND $_SESSION['CompanyRecord']['gllinkstock']==1) { + /*Then we need to make a journal to transfer the cost to the new stock account */ + $JournalNo = GetNextTransNo(0,$db); //enter as a journal + $SQL = "INSERT INTO gltrans (type, + typeno, + trandate, + periodno, + account, + narrative, + amount) + VALUES ( 0, + '" . $JournalNo . "', + '" . Date('Y-m-d') . "', + '" . GetPeriodNo(Date('Y-m-d'),true) . "', + '" . $NewStockAccount . "', + '" . $StockID . ' ' . _('Change stock category') . "', + '" . ($UnitCost* $StockQtyRow[0]) . "'"; + $ErrMsg = _('The stock cost journal could not be inserted because'); + $DbgMsg = _('The SQL that was used to create the stock cost journal and failed was'); + $result = DB_query($sql,$db, $ErrMsg, $DbgMsg,true); + $SQL = "INSERT INTO gltrans (type, + typeno, + trandate, + periodno, + account, + narrative, + amount) + VALUES ( 0, + '" . $JournalNo . "', + '" . Date('Y-m-d') . "', + '" . GetPeriodNo(Date('Y-m-d'),true) . "', + '" . $OldStockAccount . "', + '" . $StockID . ' ' . _('Change stock category') . "', + '" . (-$UnitCost* $StockQtyRow[0]) . "'"; + $result = DB_query($sql,$db, $ErrMsg, $DbgMsg,true); + + } /* end if the stock category changed and forced a change in stock cost account */ + DB_Txn_Commit($db); prnMsg( _('Stock Item') . ' ' . $StockID . ' ' . _('has been updated'), 'success'); echo '<br />'; } Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2011-08-08 10:32:39 UTC (rev 4654) +++ trunk/doc/Change.log 2011-08-10 10:21:25 UTC (rev 4655) @@ -1,5 +1,8 @@ webERP Change Log +10/8/11 Phil: POReport.php added link to detail purchase order inquiry +10/8/11 Phil: PO_SelectPurchOrder.php and outstanding purchase order searches now show the delivery date (from the purchase order header) line items may have different delivery dates. +10/8/11 Phil: Stocks.php changing the stock category to one with a different stock account now creates a journal (if stock is linked to GL) to move the cost of the stock from the old GL account to the new GL account 7/8/11 Phil: SelectProduct.php now disables transactions on items flagged as obsolete (discontinued). Also obsolete items are shown as such in the selection list - suggested by Klaus (opto) 7/8/11 Ricard: Corrected INNER JOIN ON clause in sql used in InventoryQuantities.php script 7/8/11 Klaus: Added docuwiki links to WikiLinks function in MiscFunctions.php and allow Docuwiki option in SystemParameters.php Modified: trunk/includes/DateFunctions.inc =================================================================== --- trunk/includes/DateFunctions.inc 2011-08-08 10:32:39 UTC (rev 4654) +++ trunk/includes/DateFunctions.inc 2011-08-10 10:21:25 UTC (rev 4655) @@ -875,7 +875,7 @@ } } /* Find the unix timestamp of the last period end date in periods table */ - $sql = 'SELECT MAX(lastdate_in_period), MAX(periodno) from periods'; + $sql = "SELECT MAX(lastdate_in_period), MAX(periodno) from periods"; $result = DB_query($sql, $db); $myrow=DB_fetch_row($result); if (is_null($myrow[0])){ @@ -889,7 +889,7 @@ $LastPeriod = $myrow[1]; } /* Find the unix timestamp of the first period end date in periods table */ - $sql = 'SELECT MIN(lastdate_in_period), MIN(periodno) from periods'; + $sql = "SELECT MIN(lastdate_in_period), MIN(periodno) from periods"; $result = DB_query($sql, $db); $myrow=DB_fetch_row($result); $Date_Array = explode('-', $myrow[0]); @@ -929,7 +929,7 @@ } } else if (!PeriodExists(mktime(0,0,0,Date('m',$TransDate)+1,Date('d',$TransDate),Date('Y',$TransDate)), $db)) { /* Make sure the following months period exists */ - $sql = 'SELECT MAX(lastdate_in_period), MAX(periodno) from periods'; + $sql = "SELECT MAX(lastdate_in_period), MAX(periodno) from periods"; $result = DB_query($sql, $db); $myrow=DB_fetch_row($result); $Date_Array = explode('-', $myrow[0]); @@ -941,8 +941,10 @@ /* Now return the period number of the transaction */ $MonthAfterTransDate = Mktime(0,0,0,Date('m',$TransDate)+1,Date('d',$TransDate),Date('Y',$TransDate)); - $GetPrdSQL = "SELECT periodno FROM periods WHERE lastdate_in_period < '" . - Date('Y-m-d', $MonthAfterTransDate) . "' AND lastdate_in_period >= '" . Date('Y-m-d', $TransDate) . "'"; + $GetPrdSQL = "SELECT periodno + FROM periods + WHERE lastdate_in_period < '" . Date('Y-m-d', $MonthAfterTransDate) . "' + AND lastdate_in_period >= '" . Date('Y-m-d', $TransDate) . "'"; $ErrMsg = _('An error occurred in retrieving the period number'); $GetPrdResult = DB_query($GetPrdSQL,$db,$ErrMsg); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-08-08 10:32:49
|
Revision: 4654 http://web-erp.svn.sourceforge.net/web-erp/?rev=4654&view=rev Author: daintree Date: 2011-08-08 10:32:39 +0000 (Mon, 08 Aug 2011) Log Message: ----------- update php-gettext to latest Modified Paths: -------------- trunk/includes/php-gettext/gettext.inc trunk/includes/php-gettext/gettext.php trunk/includes/php-gettext/streams.php Modified: trunk/includes/php-gettext/gettext.inc =================================================================== --- trunk/includes/php-gettext/gettext.inc 2011-08-07 10:17:52 UTC (rev 4653) +++ trunk/includes/php-gettext/gettext.inc 2011-08-08 10:32:39 UTC (rev 4654) @@ -32,7 +32,6 @@ LC_ALL 6 */ - // LC_MESSAGES is not available if php-gettext is not loaded // while the other constants are already available from session extension. if (!defined('LC_MESSAGES')) { @@ -62,6 +61,56 @@ // Utility functions /** + * Return a list of locales to try for any POSIX-style locale specification. + */ +function get_list_of_locales($locale) { + /* Figure out all possible locale names and start with the most + * specific ones. I.e. for sr_CS.UTF-8@latin, look through all of + * sr_CS.UTF-8@latin, sr_CS@latin, sr@latin, sr_CS.UTF-8, sr_CS, sr. + */ + $locale_names = array(); + $lang = NULL; + $country = NULL; + $charset = NULL; + $modifier = NULL; + if ($locale) { + if (preg_match("/^(?P<lang>[a-z]{2,3})" // language code + ."(?:_(?P<country>[A-Z]{2}))?" // country code + ."(?:\.(?P<charset>[-A-Za-z0-9_]+))?" // charset + ."(?:@(?P<modifier>[-A-Za-z0-9_]+))?$/", // @ modifier + $locale, $matches)) { + + if (isset($matches["lang"])) $lang = $matches["lang"]; + if (isset($matches["country"])) $country = $matches["country"]; + if (isset($matches["charset"])) $charset = $matches["charset"]; + if (isset($matches["modifier"])) $modifier = $matches["modifier"]; + + if ($modifier) { + if ($country) { + if ($charset) + array_push($locale_names, "${lang}_$country.$charset@$modifier"); + array_push($locale_names, "${lang}_$country@$modifier"); + } elseif ($charset) + array_push($locale_names, "${lang}.$charset@$modifier"); + array_push($locale_names, "$lang@$modifier"); + } + if ($country) { + if ($charset) + array_push($locale_names, "${lang}_$country.$charset"); + array_push($locale_names, "${lang}_$country"); + } elseif ($charset) + array_push($locale_names, "${lang}.$charset"); + array_push($locale_names, $lang); + } + + // If the locale name doesn't match POSIX style, just include it as-is. + if (!in_array($locale, $locale_names)) + array_push($locale_names, $locale); + } + return $locale_names; +} + +/** * Utility function to get a StreamReader for the given text domain. */ function _get_reader($domain=null, $category=5, $enable_cache=true) { @@ -73,27 +122,8 @@ $bound_path = isset($text_domains[$domain]->path) ? $text_domains[$domain]->path : './'; $subpath = $LC_CATEGORIES[$category] ."/$domain.mo"; - /* Figure out all possible locale names and start with the most - specific ones. I.e. for sr_CS.UTF-8@latin, look through all of - sr_CS.UTF-8@latin, sr_CS@latin, sr@latin, sr_CS.UTF-8, sr_CS, sr. - */ - $locale_names = array(); - if (preg_match("/([a-z]{2,3})" // language code - ."(_([A-Z]{2}))?" // country code - ."(\.([-A-Za-z0-9_]))?" // charset - ."(@([-A-Za-z0-9_]+))?/", // @ modifier - $locale, $matches)) { - list(,$lang,,$country,,$charset,,$modifier) = $matches; - if ($modifier) { - $locale_names = array("${lang}_$country.$charset@$modifier", - "${lang}_$country@$modifier", - "$lang@$modifier"); - } - array_push($locale_names, - "${lang}_$country.$charset", "${lang}_$country", "$lang"); - } - array_push($locale_names, $locale); + $locale_names = get_list_of_locales($locale); $input = null; foreach ($locale_names as $locale) { $full_path = $bound_path . $locale . "/" . $subpath; @@ -124,8 +154,10 @@ /** * Checks if the current locale is supported on this system. */ -function _check_locale() { +function _check_locale_and_function($function=false) { global $EMULATEGETTEXT; + if ($function and !function_exists($function)) + return false; return !$EMULATEGETTEXT; } @@ -153,11 +185,19 @@ } - - // Custom implementation of the standard gettext related functions /** + * Returns passed in $locale, or environment variable $LANG if $locale == ''. + */ +function _get_default_locale($locale) { + if ($locale == '') // emulate variable support + return getenv('LANG'); + else + return $locale; +} + +/** * Sets a requested locale, if needed emulates it. */ function _setlocale($category, $locale) { @@ -170,22 +210,27 @@ // even if we tried to read locale without setting it first return _setlocale($category, $CURRENTLOCALE); } else { - $ret = 0; - if (function_exists('setlocale')) // I don't know if this ever happens ;) - $ret = setlocale($category, $locale); - if (($ret and $locale == '') or ($ret == $locale)) { + if (function_exists('setlocale')) { + $ret = setlocale($category, $locale); + if (($locale == '' and !$ret) or // failed setting it by env + ($locale != '' and $ret != $locale)) { // failed setting it + // Failed setting it according to environment. + $CURRENTLOCALE = _get_default_locale($locale); + $EMULATEGETTEXT = 1; + } else { + $CURRENTLOCALE = $ret; $EMULATEGETTEXT = 0; - $CURRENTLOCALE = $ret; + } } else { - if ($locale == '') // emulate variable support - $CURRENTLOCALE = getenv('LANG'); - else - $CURRENTLOCALE = $locale; - $EMULATEGETTEXT = 1; + // No function setlocale(), emulate it all. + $CURRENTLOCALE = _get_default_locale($locale); + $EMULATEGETTEXT = 1; } // Allow locale to be changed on the go for one translation domain. global $text_domains, $default_domain; - unset($text_domains[$default_domain]->l10n); + if (array_key_exists($default_domain, $text_domains)) { + unset($text_domains[$default_domain]->l10n); + } return $CURRENTLOCALE; } } @@ -196,11 +241,11 @@ function _bindtextdomain($domain, $path) { global $text_domains; // ensure $path ends with a slash ('/' should work for both, but lets still play nice) - if (mb_substr(php_uname(), 0, 7) == "Windows") { - if ($path[mb_strlen($path)-1] != '\\' and $path[mb_strlen($path)-1] != '/') + if (substr(php_uname(), 0, 7) == "Windows") { + if ($path[strlen($path)-1] != '\\' and $path[strlen($path)-1] != '/') $path .= '\\'; } else { - if ($path[mb_strlen($path)-1] != '/') + if ($path[strlen($path)-1] != '/') $path .= '/'; } if (!array_key_exists($domain, $text_domains)) { @@ -231,22 +276,22 @@ */ function _gettext($msgid) { $l10n = _get_reader(); - //return $l10n->translate($msgid); return _encode($l10n->translate($msgid)); } + /** * Alias for gettext. */ function __($msgid) { return _gettext($msgid); } + /** * Plural version of gettext. */ -function _ngettext($single, $plural, $number) { +function _ngettext($singular, $plural, $number) { $l10n = _get_reader(); - //return $l10n->ngettext($single, $plural, $number); - return _encode($l10n->ngettext($single, $plural, $number)); + return _encode($l10n->ngettext($singular, $plural, $number)); } /** @@ -254,16 +299,15 @@ */ function _dgettext($domain, $msgid) { $l10n = _get_reader($domain); - //return $l10n->translate($msgid); return _encode($l10n->translate($msgid)); } + /** * Plural version of dgettext. */ -function _dngettext($domain, $single, $plural, $number) { +function _dngettext($domain, $singular, $plural, $number) { $l10n = _get_reader($domain); - //return $l10n->ngettext($single, $plural, $number); - return _encode($l10n->ngettext($single, $plural, $number)); + return _encode($l10n->ngettext($singular, $plural, $number)); } /** @@ -271,71 +315,169 @@ */ function _dcgettext($domain, $msgid, $category) { $l10n = _get_reader($domain, $category); - //return $l10n->translate($msgid); return _encode($l10n->translate($msgid)); } /** * Plural version of dcgettext. */ -function _dcngettext($domain, $single, $plural, $number, $category) { +function _dcngettext($domain, $singular, $plural, $number, $category) { $l10n = _get_reader($domain, $category); - //return $l10n->ngettext($single, $plural, $number); - return _encode($l10n->ngettext($single, $plural, $number)); + return _encode($l10n->ngettext($singular, $plural, $number)); } +/** + * Context version of gettext. + */ +function _pgettext($context, $msgid) { + $l10n = _get_reader(); + return _encode($l10n->pgettext($context, $msgid)); +} +/** + * Override the current domain in a context gettext call. + */ +function _dpgettext($domain, $context, $msgid) { + $l10n = _get_reader($domain); + return _encode($l10n->pgettext($context, $msgid)); +} -// Wrappers to use if the standard gettext functions are available, but the current locale is not supported by the system. -// Use the standard impl if the current locale is supported, use the custom impl otherwise. +/** + * Overrides the domain and category for a single context-based lookup. + */ +function _dcpgettext($domain, $context, $msgid, $category) { + $l10n = _get_reader($domain, $category); + return _encode($l10n->pgettext($context, $msgid)); +} +/** + * Context version of ngettext. + */ +function _npgettext($context, $singular, $plural) { + $l10n = _get_reader(); + return _encode($l10n->npgettext($context, $singular, $plural)); +} + +/** + * Override the current domain in a context ngettext call. + */ +function _dnpgettext($domain, $context, $singular, $plural) { + $l10n = _get_reader($domain); + return _encode($l10n->npgettext($context, $singular, $plural)); +} + +/** + * Overrides the domain and category for a plural context-based lookup. + */ +function _dcnpgettext($domain, $context, $singular, $plural, $category) { + $l10n = _get_reader($domain, $category); + return _encode($l10n->npgettext($context, $singular, $plural)); +} + + + +// Wrappers to use if the standard gettext functions are available, +// but the current locale is not supported by the system. +// Use the standard impl if the current locale is supported, use the +// custom impl otherwise. + function T_setlocale($category, $locale) { return _setlocale($category, $locale); } function T_bindtextdomain($domain, $path) { - if (_check_locale()) return bindtextdomain($domain, $path); + if (_check_locale_and_function()) return bindtextdomain($domain, $path); else return _bindtextdomain($domain, $path); } function T_bind_textdomain_codeset($domain, $codeset) { // bind_textdomain_codeset is available only in PHP 4.2.0+ - if (_check_locale() and function_exists('bind_textdomain_codeset')) return bind_textdomain_codeset($domain, $codeset); + if (_check_locale_and_function('bind_textdomain_codeset')) + return bind_textdomain_codeset($domain, $codeset); else return _bind_textdomain_codeset($domain, $codeset); } function T_textdomain($domain) { - if (_check_locale()) return textdomain($domain); + if (_check_locale_and_function()) return textdomain($domain); else return _textdomain($domain); } function T_gettext($msgid) { - if (_check_locale()) return gettext($msgid); + if (_check_locale_and_function()) return gettext($msgid); else return _gettext($msgid); } function T_($msgid) { - if (_check_locale()) return _($msgid); + if (_check_locale_and_function()) return _($msgid); return __($msgid); } -function T_ngettext($single, $plural, $number) { - if (_check_locale()) return ngettext($single, $plural, $number); - else return _ngettext($single, $plural, $number); +function T_ngettext($singular, $plural, $number) { + if (_check_locale_and_function()) + return ngettext($singular, $plural, $number); + else return _ngettext($singular, $plural, $number); } function T_dgettext($domain, $msgid) { - if (_check_locale()) return dgettext($domain, $msgid); + if (_check_locale_and_function()) return dgettext($domain, $msgid); else return _dgettext($domain, $msgid); } -function T_dngettext($domain, $single, $plural, $number) { - if (_check_locale()) return dngettext($domain, $single, $plural, $number); - else return _dngettext($domain, $single, $plural, $number); +function T_dngettext($domain, $singular, $plural, $number) { + if (_check_locale_and_function()) + return dngettext($domain, $singular, $plural, $number); + else return _dngettext($domain, $singular, $plural, $number); } function T_dcgettext($domain, $msgid, $category) { - if (_check_locale()) return dcgettext($domain, $msgid, $category); + if (_check_locale_and_function()) + return dcgettext($domain, $msgid, $category); else return _dcgettext($domain, $msgid, $category); } -function T_dcngettext($domain, $single, $plural, $number, $category) { - if (_check_locale()) return dcngettext($domain, $single, $plural, $number, $category); - else return _dcngettext($domain, $single, $plural, $number, $category); +function T_dcngettext($domain, $singular, $plural, $number, $category) { + if (_check_locale_and_function()) + return dcngettext($domain, $singular, $plural, $number, $category); + else return _dcngettext($domain, $singular, $plural, $number, $category); } +function T_pgettext($context, $msgid) { + if (_check_locale_and_function('pgettext')) + return pgettext($context, $msgid); + else + return _pgettext($context, $msgid); +} +function T_dpgettext($domain, $context, $msgid) { + if (_check_locale_and_function('dpgettext')) + return dpgettext($domain, $context, $msgid); + else + return _dpgettext($domain, $context, $msgid); +} +function T_dcpgettext($domain, $context, $msgid, $category) { + if (_check_locale_and_function('dcpgettext')) + return dcpgettext($domain, $context, $msgid, $category); + else + return _dcpgettext($domain, $context, $msgid, $category); +} + +function T_npgettext($context, $singular, $plural, $number) { + if (_check_locale_and_function('npgettext')) + return npgettext($context, $singular, $plural, $number); + else + return _npgettext($context, $singular, $plural, $number); +} + +function T_dnpgettext($domain, $context, $singular, $plural, $number) { + if (_check_locale_and_function('dnpgettext')) + return dnpgettext($domain, $context, $singular, $plural, $number); + else + return _dnpgettext($domain, $context, $singular, $plural, $number); +} + +function T_dcnpgettext($domain, $context, $singular, $plural, + $number, $category) { + if (_check_locale_and_function('dcnpgettext')) + return dcnpgettext($domain, $context, $singular, + $plural, $number, $category); + else + return _dcnpgettext($domain, $context, $singular, + $plural, $number, $category); +} + + + // Wrappers used as a drop in replacement for the standard gettext functions if (!function_exists('gettext')) { @@ -354,21 +496,41 @@ function _($msgid) { return __($msgid); } - function ngettext($single, $plural, $number) { - return _ngettext($single, $plural, $number); + function ngettext($singular, $plural, $number) { + return _ngettext($singular, $plural, $number); } function dgettext($domain, $msgid) { return _dgettext($domain, $msgid); } - function dngettext($domain, $single, $plural, $number) { - return _dngettext($domain, $single, $plural, $number); + function dngettext($domain, $singular, $plural, $number) { + return _dngettext($domain, $singular, $plural, $number); } function dcgettext($domain, $msgid, $category) { return _dcgettext($domain, $msgid, $category); } - function dcngettext($domain, $single, $plural, $number, $category) { - return _dcngettext($domain, $single, $plural, $number, $category); + function dcngettext($domain, $singular, $plural, $number, $category) { + return _dcngettext($domain, $singular, $plural, $number, $category); } + function pgettext($context, $msgid) { + return _pgettext($context, $msgid); + } + function npgettext($context, $singular, $plural, $number) { + return _npgettext($context, $singular, $plural, $number); + } + function dpgettext($domain, $context, $msgid) { + return _dpgettext($domain, $context, $msgid); + } + function dnpgettext($domain, $context, $singular, $plural, $number) { + return _dnpgettext($domain, $context, $singular, $plural, $number); + } + function dcpgettext($domain, $context, $msgid, $category) { + return _dcpgettext($domain, $context, $msgid, $category); + } + function dcnpgettext($domain, $context, $singular, $plural, + $number, $category) { + return _dcnpgettext($domain, $context, $singular, $plural, + $number, $category); + } } ?> Modified: trunk/includes/php-gettext/gettext.php =================================================================== --- trunk/includes/php-gettext/gettext.php 2011-08-07 10:17:52 UTC (rev 4653) +++ trunk/includes/php-gettext/gettext.php 2011-08-08 10:32:39 UTC (rev 4654) @@ -1,6 +1,6 @@ <?php /* - Copyright (c) 2003 Danilo Segan <da...@kv...>. + Copyright (c) 2003, 2009 Danilo Segan <da...@kv...>. Copyright (c) 2005 Nico Kaiser <ni...@si...> This file is part of PHP-gettext. @@ -63,13 +63,19 @@ function readint() { if ($this->BYTEORDER == 0) { // low endian - return array_shift(unpack('V', $this->STREAM->read(4))); + $input=unpack('V', $this->STREAM->read(4)); + return array_shift($input); } else { // big endian - return array_shift(unpack('N', $this->STREAM->read(4))); + $input=unpack('N', $this->STREAM->read(4)); + return array_shift($input); } } + function read($bytes) { + return $this->STREAM->read($bytes); + } + /** * Reads an array of Integers from the Stream * @@ -102,17 +108,15 @@ // Caching can be turned off $this->enable_cache = $enable_cache; - // $MAGIC1 = (int)0x950412de; //bug in PHP 5 - $MAGIC1 = (int) - 1794895138; - // $MAGIC2 = (int)0xde120495; //bug - $MAGIC2 = (int) - 569244523; + $MAGIC1 = "\x95\x04\x12\xde"; + $MAGIC2 = "\xde\x12\x04\x95"; $this->STREAM = $Reader; - $magic = $this->readint(); + $magic = $this->read(4); if ($magic == $MAGIC1) { + $this->BYTEORDER = 1; + } elseif ($magic == $MAGIC2) { $this->BYTEORDER = 0; - } elseif ($magic == $MAGIC2) { - $this->BYTEORDER = 1; } else { $this->error = 1; // not MO file return false; @@ -140,10 +144,14 @@ return; /* get original and translations tables */ - $this->STREAM->seekto($this->originals); - $this->table_originals = $this->readintarray($this->total * 2); - $this->STREAM->seekto($this->translations); - $this->table_translations = $this->readintarray($this->total * 2); + if (!is_array($this->table_originals)) { + $this->STREAM->seekto($this->originals); + $this->table_originals = $this->readintarray($this->total * 2); + } + if (!is_array($this->table_translations)) { + $this->STREAM->seekto($this->translations); + $this->table_translations = $this->readintarray($this->total * 2); + } if ($this->enable_cache) { $this->cache_translations = array (); @@ -262,6 +270,55 @@ } /** + * Sanitize plural form expression for use in PHP eval call. + * + * @access private + * @return string sanitized plural form expression + */ + function sanitize_plural_expression($expr) { + // Get rid of disallowed characters. + $expr = preg_replace('@[^a-zA-Z0-9_:;\(\)\?\|\&=!<>+*/\%-]@', '', $expr); + + // Add parenthesis for tertiary '?' operator. + $expr .= ';'; + $res = ''; + $p = 0; + for ($i = 0; $i < strlen($expr); $i++) { + $ch = $expr[$i]; + switch ($ch) { + case '?': + $res .= ' ? ('; + $p++; + break; + case ':': + $res .= ') : ('; + break; + case ';': + $res .= str_repeat( ')', $p) . ';'; + $p = 0; + break; + default: + $res .= $ch; + } + } + return $res; + } + + /** + * Parse full PO header and extract only plural forms line. + * + * @access private + * @return string verbatim plural form header field + */ + function extract_plural_forms_header_from_po_header($header) { + if (preg_match("/(^|\n)plural-forms: ([^\n]*)\n/i", $header, $regs)) + $expr = $regs[2]; + else + $expr = "nplurals=2; plural=n == 1 ? 0 : 1;"; + return $expr; + } + + /** * Get possible plural forms from MO header * * @access private @@ -279,11 +336,8 @@ } else { $header = $this->get_translation_string(0); } - if (preg_match("plural-forms: ([^\n]*)\n", $header, $regs)) - $expr = $regs[1]; - else - $expr = "nplurals=2; plural=n == 1 ? 0 : 1;"; - $this->pluralheader = $expr; + $expr = $this->extract_plural_forms_header_from_po_header($header); + $this->pluralheader = $this->sanitize_plural_expression($expr); } return $this->pluralheader; } @@ -330,7 +384,7 @@ $select = $this->select_string($number); // this should contains all strings separated by NULLs - $key = $single.chr(0).$plural; + $key = $single . chr(0) . $plural; if ($this->enable_cache) { @@ -353,6 +407,26 @@ } } + function pgettext($context, $msgid) { + $key = $context . chr(4) . $msgid; + $ret = $this->translate($key); + if (strpos($ret, "\004") !== FALSE) { + return $msgid; + } else { + return $ret; + } + } + + function npgettext($context, $singular, $plural, $number) { + $key = $context . chr(4) . $singular; + $ret = $this->ngettext($key, $plural, $number); + if (strpos($ret, "\004") !== FALSE) { + return $singular; + } else { + return $ret; + } + + } } ?> Modified: trunk/includes/php-gettext/streams.php =================================================================== --- trunk/includes/php-gettext/streams.php 2011-08-07 10:17:52 UTC (rev 4653) +++ trunk/includes/php-gettext/streams.php 2011-08-08 10:32:39 UTC (rev 4654) @@ -55,18 +55,18 @@ } function read($bytes) { - $data = mb_substr($this->_str, $this->_pos, $bytes); + $data = substr($this->_str, $this->_pos, $bytes); $this->_pos += $bytes; - if (mb_strlen($this->_str)<$this->_pos) - $this->_pos = mb_strlen($this->_str); + if (strlen($this->_str)<$this->_pos) + $this->_pos = strlen($this->_str); return $data; } function seekto($pos) { $this->_pos = $pos; - if (mb_strlen($this->_str)<$this->_pos) - $this->_pos = mb_strlen($this->_str); + if (strlen($this->_str)<$this->_pos) + $this->_pos = strlen($this->_str); return $this->_pos; } @@ -75,7 +75,7 @@ } function length() { - return mb_strlen($this->_str); + return strlen($this->_str); } }; @@ -112,7 +112,7 @@ while ($bytes > 0) { $chunk = fread($this->_fd, $bytes); $data .= $chunk; - $bytes -= mb_strlen($chunk); + $bytes -= strlen($chunk); } $this->_pos = ftell($this->_fd); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-08-08 10:32:47
|
Revision: 4654 http://web-erp.svn.sourceforge.net/web-erp/?rev=4654&view=rev Author: daintree Date: 2011-08-08 10:32:39 +0000 (Mon, 08 Aug 2011) Log Message: ----------- update php-gettext to latest Modified Paths: -------------- trunk/includes/php-gettext/gettext.inc trunk/includes/php-gettext/gettext.php trunk/includes/php-gettext/streams.php Modified: trunk/includes/php-gettext/gettext.inc =================================================================== --- trunk/includes/php-gettext/gettext.inc 2011-08-07 10:17:52 UTC (rev 4653) +++ trunk/includes/php-gettext/gettext.inc 2011-08-08 10:32:39 UTC (rev 4654) @@ -32,7 +32,6 @@ LC_ALL 6 */ - // LC_MESSAGES is not available if php-gettext is not loaded // while the other constants are already available from session extension. if (!defined('LC_MESSAGES')) { @@ -62,6 +61,56 @@ // Utility functions /** + * Return a list of locales to try for any POSIX-style locale specification. + */ +function get_list_of_locales($locale) { + /* Figure out all possible locale names and start with the most + * specific ones. I.e. for sr_CS.UTF-8@latin, look through all of + * sr_CS.UTF-8@latin, sr_CS@latin, sr@latin, sr_CS.UTF-8, sr_CS, sr. + */ + $locale_names = array(); + $lang = NULL; + $country = NULL; + $charset = NULL; + $modifier = NULL; + if ($locale) { + if (preg_match("/^(?P<lang>[a-z]{2,3})" // language code + ."(?:_(?P<country>[A-Z]{2}))?" // country code + ."(?:\.(?P<charset>[-A-Za-z0-9_]+))?" // charset + ."(?:@(?P<modifier>[-A-Za-z0-9_]+))?$/", // @ modifier + $locale, $matches)) { + + if (isset($matches["lang"])) $lang = $matches["lang"]; + if (isset($matches["country"])) $country = $matches["country"]; + if (isset($matches["charset"])) $charset = $matches["charset"]; + if (isset($matches["modifier"])) $modifier = $matches["modifier"]; + + if ($modifier) { + if ($country) { + if ($charset) + array_push($locale_names, "${lang}_$country.$charset@$modifier"); + array_push($locale_names, "${lang}_$country@$modifier"); + } elseif ($charset) + array_push($locale_names, "${lang}.$charset@$modifier"); + array_push($locale_names, "$lang@$modifier"); + } + if ($country) { + if ($charset) + array_push($locale_names, "${lang}_$country.$charset"); + array_push($locale_names, "${lang}_$country"); + } elseif ($charset) + array_push($locale_names, "${lang}.$charset"); + array_push($locale_names, $lang); + } + + // If the locale name doesn't match POSIX style, just include it as-is. + if (!in_array($locale, $locale_names)) + array_push($locale_names, $locale); + } + return $locale_names; +} + +/** * Utility function to get a StreamReader for the given text domain. */ function _get_reader($domain=null, $category=5, $enable_cache=true) { @@ -73,27 +122,8 @@ $bound_path = isset($text_domains[$domain]->path) ? $text_domains[$domain]->path : './'; $subpath = $LC_CATEGORIES[$category] ."/$domain.mo"; - /* Figure out all possible locale names and start with the most - specific ones. I.e. for sr_CS.UTF-8@latin, look through all of - sr_CS.UTF-8@latin, sr_CS@latin, sr@latin, sr_CS.UTF-8, sr_CS, sr. - */ - $locale_names = array(); - if (preg_match("/([a-z]{2,3})" // language code - ."(_([A-Z]{2}))?" // country code - ."(\.([-A-Za-z0-9_]))?" // charset - ."(@([-A-Za-z0-9_]+))?/", // @ modifier - $locale, $matches)) { - list(,$lang,,$country,,$charset,,$modifier) = $matches; - if ($modifier) { - $locale_names = array("${lang}_$country.$charset@$modifier", - "${lang}_$country@$modifier", - "$lang@$modifier"); - } - array_push($locale_names, - "${lang}_$country.$charset", "${lang}_$country", "$lang"); - } - array_push($locale_names, $locale); + $locale_names = get_list_of_locales($locale); $input = null; foreach ($locale_names as $locale) { $full_path = $bound_path . $locale . "/" . $subpath; @@ -124,8 +154,10 @@ /** * Checks if the current locale is supported on this system. */ -function _check_locale() { +function _check_locale_and_function($function=false) { global $EMULATEGETTEXT; + if ($function and !function_exists($function)) + return false; return !$EMULATEGETTEXT; } @@ -153,11 +185,19 @@ } - - // Custom implementation of the standard gettext related functions /** + * Returns passed in $locale, or environment variable $LANG if $locale == ''. + */ +function _get_default_locale($locale) { + if ($locale == '') // emulate variable support + return getenv('LANG'); + else + return $locale; +} + +/** * Sets a requested locale, if needed emulates it. */ function _setlocale($category, $locale) { @@ -170,22 +210,27 @@ // even if we tried to read locale without setting it first return _setlocale($category, $CURRENTLOCALE); } else { - $ret = 0; - if (function_exists('setlocale')) // I don't know if this ever happens ;) - $ret = setlocale($category, $locale); - if (($ret and $locale == '') or ($ret == $locale)) { + if (function_exists('setlocale')) { + $ret = setlocale($category, $locale); + if (($locale == '' and !$ret) or // failed setting it by env + ($locale != '' and $ret != $locale)) { // failed setting it + // Failed setting it according to environment. + $CURRENTLOCALE = _get_default_locale($locale); + $EMULATEGETTEXT = 1; + } else { + $CURRENTLOCALE = $ret; $EMULATEGETTEXT = 0; - $CURRENTLOCALE = $ret; + } } else { - if ($locale == '') // emulate variable support - $CURRENTLOCALE = getenv('LANG'); - else - $CURRENTLOCALE = $locale; - $EMULATEGETTEXT = 1; + // No function setlocale(), emulate it all. + $CURRENTLOCALE = _get_default_locale($locale); + $EMULATEGETTEXT = 1; } // Allow locale to be changed on the go for one translation domain. global $text_domains, $default_domain; - unset($text_domains[$default_domain]->l10n); + if (array_key_exists($default_domain, $text_domains)) { + unset($text_domains[$default_domain]->l10n); + } return $CURRENTLOCALE; } } @@ -196,11 +241,11 @@ function _bindtextdomain($domain, $path) { global $text_domains; // ensure $path ends with a slash ('/' should work for both, but lets still play nice) - if (mb_substr(php_uname(), 0, 7) == "Windows") { - if ($path[mb_strlen($path)-1] != '\\' and $path[mb_strlen($path)-1] != '/') + if (substr(php_uname(), 0, 7) == "Windows") { + if ($path[strlen($path)-1] != '\\' and $path[strlen($path)-1] != '/') $path .= '\\'; } else { - if ($path[mb_strlen($path)-1] != '/') + if ($path[strlen($path)-1] != '/') $path .= '/'; } if (!array_key_exists($domain, $text_domains)) { @@ -231,22 +276,22 @@ */ function _gettext($msgid) { $l10n = _get_reader(); - //return $l10n->translate($msgid); return _encode($l10n->translate($msgid)); } + /** * Alias for gettext. */ function __($msgid) { return _gettext($msgid); } + /** * Plural version of gettext. */ -function _ngettext($single, $plural, $number) { +function _ngettext($singular, $plural, $number) { $l10n = _get_reader(); - //return $l10n->ngettext($single, $plural, $number); - return _encode($l10n->ngettext($single, $plural, $number)); + return _encode($l10n->ngettext($singular, $plural, $number)); } /** @@ -254,16 +299,15 @@ */ function _dgettext($domain, $msgid) { $l10n = _get_reader($domain); - //return $l10n->translate($msgid); return _encode($l10n->translate($msgid)); } + /** * Plural version of dgettext. */ -function _dngettext($domain, $single, $plural, $number) { +function _dngettext($domain, $singular, $plural, $number) { $l10n = _get_reader($domain); - //return $l10n->ngettext($single, $plural, $number); - return _encode($l10n->ngettext($single, $plural, $number)); + return _encode($l10n->ngettext($singular, $plural, $number)); } /** @@ -271,71 +315,169 @@ */ function _dcgettext($domain, $msgid, $category) { $l10n = _get_reader($domain, $category); - //return $l10n->translate($msgid); return _encode($l10n->translate($msgid)); } /** * Plural version of dcgettext. */ -function _dcngettext($domain, $single, $plural, $number, $category) { +function _dcngettext($domain, $singular, $plural, $number, $category) { $l10n = _get_reader($domain, $category); - //return $l10n->ngettext($single, $plural, $number); - return _encode($l10n->ngettext($single, $plural, $number)); + return _encode($l10n->ngettext($singular, $plural, $number)); } +/** + * Context version of gettext. + */ +function _pgettext($context, $msgid) { + $l10n = _get_reader(); + return _encode($l10n->pgettext($context, $msgid)); +} +/** + * Override the current domain in a context gettext call. + */ +function _dpgettext($domain, $context, $msgid) { + $l10n = _get_reader($domain); + return _encode($l10n->pgettext($context, $msgid)); +} -// Wrappers to use if the standard gettext functions are available, but the current locale is not supported by the system. -// Use the standard impl if the current locale is supported, use the custom impl otherwise. +/** + * Overrides the domain and category for a single context-based lookup. + */ +function _dcpgettext($domain, $context, $msgid, $category) { + $l10n = _get_reader($domain, $category); + return _encode($l10n->pgettext($context, $msgid)); +} +/** + * Context version of ngettext. + */ +function _npgettext($context, $singular, $plural) { + $l10n = _get_reader(); + return _encode($l10n->npgettext($context, $singular, $plural)); +} + +/** + * Override the current domain in a context ngettext call. + */ +function _dnpgettext($domain, $context, $singular, $plural) { + $l10n = _get_reader($domain); + return _encode($l10n->npgettext($context, $singular, $plural)); +} + +/** + * Overrides the domain and category for a plural context-based lookup. + */ +function _dcnpgettext($domain, $context, $singular, $plural, $category) { + $l10n = _get_reader($domain, $category); + return _encode($l10n->npgettext($context, $singular, $plural)); +} + + + +// Wrappers to use if the standard gettext functions are available, +// but the current locale is not supported by the system. +// Use the standard impl if the current locale is supported, use the +// custom impl otherwise. + function T_setlocale($category, $locale) { return _setlocale($category, $locale); } function T_bindtextdomain($domain, $path) { - if (_check_locale()) return bindtextdomain($domain, $path); + if (_check_locale_and_function()) return bindtextdomain($domain, $path); else return _bindtextdomain($domain, $path); } function T_bind_textdomain_codeset($domain, $codeset) { // bind_textdomain_codeset is available only in PHP 4.2.0+ - if (_check_locale() and function_exists('bind_textdomain_codeset')) return bind_textdomain_codeset($domain, $codeset); + if (_check_locale_and_function('bind_textdomain_codeset')) + return bind_textdomain_codeset($domain, $codeset); else return _bind_textdomain_codeset($domain, $codeset); } function T_textdomain($domain) { - if (_check_locale()) return textdomain($domain); + if (_check_locale_and_function()) return textdomain($domain); else return _textdomain($domain); } function T_gettext($msgid) { - if (_check_locale()) return gettext($msgid); + if (_check_locale_and_function()) return gettext($msgid); else return _gettext($msgid); } function T_($msgid) { - if (_check_locale()) return _($msgid); + if (_check_locale_and_function()) return _($msgid); return __($msgid); } -function T_ngettext($single, $plural, $number) { - if (_check_locale()) return ngettext($single, $plural, $number); - else return _ngettext($single, $plural, $number); +function T_ngettext($singular, $plural, $number) { + if (_check_locale_and_function()) + return ngettext($singular, $plural, $number); + else return _ngettext($singular, $plural, $number); } function T_dgettext($domain, $msgid) { - if (_check_locale()) return dgettext($domain, $msgid); + if (_check_locale_and_function()) return dgettext($domain, $msgid); else return _dgettext($domain, $msgid); } -function T_dngettext($domain, $single, $plural, $number) { - if (_check_locale()) return dngettext($domain, $single, $plural, $number); - else return _dngettext($domain, $single, $plural, $number); +function T_dngettext($domain, $singular, $plural, $number) { + if (_check_locale_and_function()) + return dngettext($domain, $singular, $plural, $number); + else return _dngettext($domain, $singular, $plural, $number); } function T_dcgettext($domain, $msgid, $category) { - if (_check_locale()) return dcgettext($domain, $msgid, $category); + if (_check_locale_and_function()) + return dcgettext($domain, $msgid, $category); else return _dcgettext($domain, $msgid, $category); } -function T_dcngettext($domain, $single, $plural, $number, $category) { - if (_check_locale()) return dcngettext($domain, $single, $plural, $number, $category); - else return _dcngettext($domain, $single, $plural, $number, $category); +function T_dcngettext($domain, $singular, $plural, $number, $category) { + if (_check_locale_and_function()) + return dcngettext($domain, $singular, $plural, $number, $category); + else return _dcngettext($domain, $singular, $plural, $number, $category); } +function T_pgettext($context, $msgid) { + if (_check_locale_and_function('pgettext')) + return pgettext($context, $msgid); + else + return _pgettext($context, $msgid); +} +function T_dpgettext($domain, $context, $msgid) { + if (_check_locale_and_function('dpgettext')) + return dpgettext($domain, $context, $msgid); + else + return _dpgettext($domain, $context, $msgid); +} +function T_dcpgettext($domain, $context, $msgid, $category) { + if (_check_locale_and_function('dcpgettext')) + return dcpgettext($domain, $context, $msgid, $category); + else + return _dcpgettext($domain, $context, $msgid, $category); +} + +function T_npgettext($context, $singular, $plural, $number) { + if (_check_locale_and_function('npgettext')) + return npgettext($context, $singular, $plural, $number); + else + return _npgettext($context, $singular, $plural, $number); +} + +function T_dnpgettext($domain, $context, $singular, $plural, $number) { + if (_check_locale_and_function('dnpgettext')) + return dnpgettext($domain, $context, $singular, $plural, $number); + else + return _dnpgettext($domain, $context, $singular, $plural, $number); +} + +function T_dcnpgettext($domain, $context, $singular, $plural, + $number, $category) { + if (_check_locale_and_function('dcnpgettext')) + return dcnpgettext($domain, $context, $singular, + $plural, $number, $category); + else + return _dcnpgettext($domain, $context, $singular, + $plural, $number, $category); +} + + + // Wrappers used as a drop in replacement for the standard gettext functions if (!function_exists('gettext')) { @@ -354,21 +496,41 @@ function _($msgid) { return __($msgid); } - function ngettext($single, $plural, $number) { - return _ngettext($single, $plural, $number); + function ngettext($singular, $plural, $number) { + return _ngettext($singular, $plural, $number); } function dgettext($domain, $msgid) { return _dgettext($domain, $msgid); } - function dngettext($domain, $single, $plural, $number) { - return _dngettext($domain, $single, $plural, $number); + function dngettext($domain, $singular, $plural, $number) { + return _dngettext($domain, $singular, $plural, $number); } function dcgettext($domain, $msgid, $category) { return _dcgettext($domain, $msgid, $category); } - function dcngettext($domain, $single, $plural, $number, $category) { - return _dcngettext($domain, $single, $plural, $number, $category); + function dcngettext($domain, $singular, $plural, $number, $category) { + return _dcngettext($domain, $singular, $plural, $number, $category); } + function pgettext($context, $msgid) { + return _pgettext($context, $msgid); + } + function npgettext($context, $singular, $plural, $number) { + return _npgettext($context, $singular, $plural, $number); + } + function dpgettext($domain, $context, $msgid) { + return _dpgettext($domain, $context, $msgid); + } + function dnpgettext($domain, $context, $singular, $plural, $number) { + return _dnpgettext($domain, $context, $singular, $plural, $number); + } + function dcpgettext($domain, $context, $msgid, $category) { + return _dcpgettext($domain, $context, $msgid, $category); + } + function dcnpgettext($domain, $context, $singular, $plural, + $number, $category) { + return _dcnpgettext($domain, $context, $singular, $plural, + $number, $category); + } } ?> Modified: trunk/includes/php-gettext/gettext.php =================================================================== --- trunk/includes/php-gettext/gettext.php 2011-08-07 10:17:52 UTC (rev 4653) +++ trunk/includes/php-gettext/gettext.php 2011-08-08 10:32:39 UTC (rev 4654) @@ -1,6 +1,6 @@ <?php /* - Copyright (c) 2003 Danilo Segan <da...@kv...>. + Copyright (c) 2003, 2009 Danilo Segan <da...@kv...>. Copyright (c) 2005 Nico Kaiser <ni...@si...> This file is part of PHP-gettext. @@ -63,13 +63,19 @@ function readint() { if ($this->BYTEORDER == 0) { // low endian - return array_shift(unpack('V', $this->STREAM->read(4))); + $input=unpack('V', $this->STREAM->read(4)); + return array_shift($input); } else { // big endian - return array_shift(unpack('N', $this->STREAM->read(4))); + $input=unpack('N', $this->STREAM->read(4)); + return array_shift($input); } } + function read($bytes) { + return $this->STREAM->read($bytes); + } + /** * Reads an array of Integers from the Stream * @@ -102,17 +108,15 @@ // Caching can be turned off $this->enable_cache = $enable_cache; - // $MAGIC1 = (int)0x950412de; //bug in PHP 5 - $MAGIC1 = (int) - 1794895138; - // $MAGIC2 = (int)0xde120495; //bug - $MAGIC2 = (int) - 569244523; + $MAGIC1 = "\x95\x04\x12\xde"; + $MAGIC2 = "\xde\x12\x04\x95"; $this->STREAM = $Reader; - $magic = $this->readint(); + $magic = $this->read(4); if ($magic == $MAGIC1) { + $this->BYTEORDER = 1; + } elseif ($magic == $MAGIC2) { $this->BYTEORDER = 0; - } elseif ($magic == $MAGIC2) { - $this->BYTEORDER = 1; } else { $this->error = 1; // not MO file return false; @@ -140,10 +144,14 @@ return; /* get original and translations tables */ - $this->STREAM->seekto($this->originals); - $this->table_originals = $this->readintarray($this->total * 2); - $this->STREAM->seekto($this->translations); - $this->table_translations = $this->readintarray($this->total * 2); + if (!is_array($this->table_originals)) { + $this->STREAM->seekto($this->originals); + $this->table_originals = $this->readintarray($this->total * 2); + } + if (!is_array($this->table_translations)) { + $this->STREAM->seekto($this->translations); + $this->table_translations = $this->readintarray($this->total * 2); + } if ($this->enable_cache) { $this->cache_translations = array (); @@ -262,6 +270,55 @@ } /** + * Sanitize plural form expression for use in PHP eval call. + * + * @access private + * @return string sanitized plural form expression + */ + function sanitize_plural_expression($expr) { + // Get rid of disallowed characters. + $expr = preg_replace('@[^a-zA-Z0-9_:;\(\)\?\|\&=!<>+*/\%-]@', '', $expr); + + // Add parenthesis for tertiary '?' operator. + $expr .= ';'; + $res = ''; + $p = 0; + for ($i = 0; $i < strlen($expr); $i++) { + $ch = $expr[$i]; + switch ($ch) { + case '?': + $res .= ' ? ('; + $p++; + break; + case ':': + $res .= ') : ('; + break; + case ';': + $res .= str_repeat( ')', $p) . ';'; + $p = 0; + break; + default: + $res .= $ch; + } + } + return $res; + } + + /** + * Parse full PO header and extract only plural forms line. + * + * @access private + * @return string verbatim plural form header field + */ + function extract_plural_forms_header_from_po_header($header) { + if (preg_match("/(^|\n)plural-forms: ([^\n]*)\n/i", $header, $regs)) + $expr = $regs[2]; + else + $expr = "nplurals=2; plural=n == 1 ? 0 : 1;"; + return $expr; + } + + /** * Get possible plural forms from MO header * * @access private @@ -279,11 +336,8 @@ } else { $header = $this->get_translation_string(0); } - if (preg_match("plural-forms: ([^\n]*)\n", $header, $regs)) - $expr = $regs[1]; - else - $expr = "nplurals=2; plural=n == 1 ? 0 : 1;"; - $this->pluralheader = $expr; + $expr = $this->extract_plural_forms_header_from_po_header($header); + $this->pluralheader = $this->sanitize_plural_expression($expr); } return $this->pluralheader; } @@ -330,7 +384,7 @@ $select = $this->select_string($number); // this should contains all strings separated by NULLs - $key = $single.chr(0).$plural; + $key = $single . chr(0) . $plural; if ($this->enable_cache) { @@ -353,6 +407,26 @@ } } + function pgettext($context, $msgid) { + $key = $context . chr(4) . $msgid; + $ret = $this->translate($key); + if (strpos($ret, "\004") !== FALSE) { + return $msgid; + } else { + return $ret; + } + } + + function npgettext($context, $singular, $plural, $number) { + $key = $context . chr(4) . $singular; + $ret = $this->ngettext($key, $plural, $number); + if (strpos($ret, "\004") !== FALSE) { + return $singular; + } else { + return $ret; + } + + } } ?> Modified: trunk/includes/php-gettext/streams.php =================================================================== --- trunk/includes/php-gettext/streams.php 2011-08-07 10:17:52 UTC (rev 4653) +++ trunk/includes/php-gettext/streams.php 2011-08-08 10:32:39 UTC (rev 4654) @@ -55,18 +55,18 @@ } function read($bytes) { - $data = mb_substr($this->_str, $this->_pos, $bytes); + $data = substr($this->_str, $this->_pos, $bytes); $this->_pos += $bytes; - if (mb_strlen($this->_str)<$this->_pos) - $this->_pos = mb_strlen($this->_str); + if (strlen($this->_str)<$this->_pos) + $this->_pos = strlen($this->_str); return $data; } function seekto($pos) { $this->_pos = $pos; - if (mb_strlen($this->_str)<$this->_pos) - $this->_pos = mb_strlen($this->_str); + if (strlen($this->_str)<$this->_pos) + $this->_pos = strlen($this->_str); return $this->_pos; } @@ -75,7 +75,7 @@ } function length() { - return mb_strlen($this->_str); + return strlen($this->_str); } }; @@ -112,7 +112,7 @@ while ($bytes > 0) { $chunk = fread($this->_fd, $bytes); $data .= $chunk; - $bytes -= mb_strlen($chunk); + $bytes -= strlen($chunk); } $this->_pos = ftell($this->_fd); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-08-07 10:17:58
|
Revision: 4653 http://web-erp.svn.sourceforge.net/web-erp/?rev=4653&view=rev Author: daintree Date: 2011-08-07 10:17:52 +0000 (Sun, 07 Aug 2011) Log Message: ----------- now disables transactions on items flagged as obsolete (discontinued) Modified Paths: -------------- trunk/SelectProduct.php trunk/doc/Change.log Modified: trunk/SelectProduct.php =================================================================== --- trunk/SelectProduct.php 2011-08-07 04:37:32 UTC (rev 4652) +++ trunk/SelectProduct.php 2011-08-07 10:17:52 UTC (rev 4653) @@ -70,7 +70,12 @@ $Its_A_Dummy = false; $Its_A_Kitset = false; $Its_A_Labour_Item = false; - echo '<table width="90%"><tr><th colspan="3"><img src="' . $rootpath . '/css/' . $theme . '/images/inventory.png" title="' . _('Inventory') . '" alt="" /><b>' . ' ' . $StockID . ' - ' . $myrow['description'] . '</b></th></tr>'; + if ($myrow['discontinued']==1){ + $ItemStatus = '<font class="bad">' ._('Obsolete') . '</font>'; + } else { + $ItemStatus = ''; + } + echo '<table width="90%"><tr><th colspan="3"><img src="' . $rootpath . '/css/' . $theme . '/images/inventory.png" title="' . _('Inventory') . '" alt="" /><b>' . ' ' . $StockID . ' - ' . $myrow['description'] . ' ' . $ItemStatus . '</b></th></tr>'; echo '<tr><td width="40%" valign="top"> <table align="left">'; //nested table @@ -412,14 +417,16 @@ wikiLink('Product', $StockID); echo '</td><td valign="top" class="select">'; /* Stock Transactions */ -if ($Its_A_Kitset_Assembly_Or_Dummy == False) { +if ($Its_A_Kitset_Assembly_Or_Dummy == false AND $myrow['discontinued']==0) { echo '<a href="' . $rootpath . '/StockAdjustments.php?StockID=' . $StockID . '">' . _('Quantity Adjustments') . '</a><br />'; echo '<a href="' . $rootpath . '/StockTransfers.php?StockID=' . $StockID . '">' . _('Location Transfers') . '</a><br />'; //show the item image if it has been uploaded if( isset($StockID) and file_exists($_SESSION['part_pics_dir'] . '/' .$StockID.'.jpg') ) { echo '<div class="centre"><img src="GetStockImage.php?automake=1&textcolor=FFFFFF&bgcolor=CCCCCC&StockID=' . $StockID . '&text=&width=120&height=120">'; } - if (($myrow['mbflag'] == 'B') AND (in_array($SuppliersSecurity, $_SESSION['AllowedPageSecurityTokens']))){ + if (($myrow['mbflag'] == 'B') + AND (in_array($SuppliersSecurity, $_SESSION['AllowedPageSecurityTokens'])) + AND $myrow['discontinued']==0){ echo '<br />'; $SuppResult = DB_query("SELECT suppliers.suppname, suppliers.supplierid, @@ -542,6 +549,7 @@ SUM(locstock.quantity) AS qoh, stockmaster.units, stockmaster.mbflag, + stockmaster.discontinued, stockmaster.decimalplaces FROM stockmaster LEFT JOIN stockcategory @@ -553,6 +561,7 @@ stockmaster.description, stockmaster.units, stockmaster.mbflag, + stockmaster.discontinued, stockmaster.decimalplaces ORDER BY stockmaster.stockid"; } else { @@ -561,6 +570,7 @@ SUM(locstock.quantity) AS qoh, stockmaster.units, stockmaster.mbflag, + stockmaster.discontinued, stockmaster.decimalplaces FROM stockmaster, locstock @@ -571,6 +581,7 @@ stockmaster.description, stockmaster.units, stockmaster.mbflag, + stockmaster.discontinued, stockmaster.decimalplaces ORDER BY stockmaster.stockid"; } @@ -580,6 +591,7 @@ $SQL = "SELECT stockmaster.stockid, stockmaster.description, stockmaster.mbflag, + stockmaster.discontinued, SUM(locstock.quantity) AS qoh, stockmaster.units, stockmaster.decimalplaces @@ -593,12 +605,14 @@ stockmaster.description, stockmaster.units, stockmaster.mbflag, + stockmaster.discontinued, stockmaster.decimalplaces ORDER BY stockmaster.stockid"; } else { $SQL = "SELECT stockmaster.stockid, stockmaster.description, stockmaster.mbflag, + stockmaster.discontinued, sum(locstock.quantity) as qoh, stockmaster.units, stockmaster.decimalplaces @@ -611,6 +625,7 @@ stockmaster.description, stockmaster.units, stockmaster.mbflag, + stockmaster.discontinued, stockmaster.decimalplaces ORDER BY stockmaster.stockid"; } @@ -619,6 +634,7 @@ $SQL = "SELECT stockmaster.stockid, stockmaster.description, stockmaster.mbflag, + stockmaster.discontinued, SUM(locstock.quantity) AS qoh, stockmaster.units, stockmaster.decimalplaces @@ -631,12 +647,14 @@ stockmaster.description, stockmaster.units, stockmaster.mbflag, + stockmaster.discontinued, stockmaster.decimalplaces ORDER BY stockmaster.stockid"; } else { $SQL = "SELECT stockmaster.stockid, stockmaster.description, stockmaster.mbflag, + stockmaster.discontinued, SUM(locstock.quantity) AS qoh, stockmaster.units, stockmaster.decimalplaces @@ -648,6 +666,7 @@ stockmaster.description, stockmaster.units, stockmaster.mbflag, + stockmaster.discontinued, stockmaster.decimalplaces ORDER BY stockmaster.stockid"; } @@ -732,11 +751,18 @@ } else { $qoh = number_format($myrow['qoh'], $myrow['decimalplaces']); } + if ($myrow['discontinued']==1){ + $ItemStatus = '<font class="bad">' . _('Obsolete') . '</font>'; + } else { + $ItemStatus =''; + } + echo '<td><input type="submit" name="Select" value="' . $myrow['stockid'] . '" /></td> <td>'.$myrow['description'].'</td> <td class="number">' . $qoh . '</td> <td>' . $myrow['units'] . '</td> <td><a target="_blank" href="' . $rootpath . '/StockStatus.php?StockID=' . $myrow['stockid'].'">' . _('View') . '</a></td> + <td>' . $ItemStatus . '</td> </tr>'; $j++; if ($j == 20 AND ($RowIndex + 1 != $_SESSION['DisplayRecordsMax'])) { Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2011-08-07 04:37:32 UTC (rev 4652) +++ trunk/doc/Change.log 2011-08-07 10:17:52 UTC (rev 4653) @@ -1,5 +1,6 @@ webERP Change Log +7/8/11 Phil: SelectProduct.php now disables transactions on items flagged as obsolete (discontinued). Also obsolete items are shown as such in the selection list - suggested by Klaus (opto) 7/8/11 Ricard: Corrected INNER JOIN ON clause in sql used in InventoryQuantities.php script 7/8/11 Klaus: Added docuwiki links to WikiLinks function in MiscFunctions.php and allow Docuwiki option in SystemParameters.php 6/8/11 Ricard: SalesInquiry.php fix wording of labels to be more consistent with the rest of webERP This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-08-07 10:17:58
|
Revision: 4653 http://web-erp.svn.sourceforge.net/web-erp/?rev=4653&view=rev Author: daintree Date: 2011-08-07 10:17:52 +0000 (Sun, 07 Aug 2011) Log Message: ----------- now disables transactions on items flagged as obsolete (discontinued) Modified Paths: -------------- trunk/SelectProduct.php trunk/doc/Change.log Modified: trunk/SelectProduct.php =================================================================== --- trunk/SelectProduct.php 2011-08-07 04:37:32 UTC (rev 4652) +++ trunk/SelectProduct.php 2011-08-07 10:17:52 UTC (rev 4653) @@ -70,7 +70,12 @@ $Its_A_Dummy = false; $Its_A_Kitset = false; $Its_A_Labour_Item = false; - echo '<table width="90%"><tr><th colspan="3"><img src="' . $rootpath . '/css/' . $theme . '/images/inventory.png" title="' . _('Inventory') . '" alt="" /><b>' . ' ' . $StockID . ' - ' . $myrow['description'] . '</b></th></tr>'; + if ($myrow['discontinued']==1){ + $ItemStatus = '<font class="bad">' ._('Obsolete') . '</font>'; + } else { + $ItemStatus = ''; + } + echo '<table width="90%"><tr><th colspan="3"><img src="' . $rootpath . '/css/' . $theme . '/images/inventory.png" title="' . _('Inventory') . '" alt="" /><b>' . ' ' . $StockID . ' - ' . $myrow['description'] . ' ' . $ItemStatus . '</b></th></tr>'; echo '<tr><td width="40%" valign="top"> <table align="left">'; //nested table @@ -412,14 +417,16 @@ wikiLink('Product', $StockID); echo '</td><td valign="top" class="select">'; /* Stock Transactions */ -if ($Its_A_Kitset_Assembly_Or_Dummy == False) { +if ($Its_A_Kitset_Assembly_Or_Dummy == false AND $myrow['discontinued']==0) { echo '<a href="' . $rootpath . '/StockAdjustments.php?StockID=' . $StockID . '">' . _('Quantity Adjustments') . '</a><br />'; echo '<a href="' . $rootpath . '/StockTransfers.php?StockID=' . $StockID . '">' . _('Location Transfers') . '</a><br />'; //show the item image if it has been uploaded if( isset($StockID) and file_exists($_SESSION['part_pics_dir'] . '/' .$StockID.'.jpg') ) { echo '<div class="centre"><img src="GetStockImage.php?automake=1&textcolor=FFFFFF&bgcolor=CCCCCC&StockID=' . $StockID . '&text=&width=120&height=120">'; } - if (($myrow['mbflag'] == 'B') AND (in_array($SuppliersSecurity, $_SESSION['AllowedPageSecurityTokens']))){ + if (($myrow['mbflag'] == 'B') + AND (in_array($SuppliersSecurity, $_SESSION['AllowedPageSecurityTokens'])) + AND $myrow['discontinued']==0){ echo '<br />'; $SuppResult = DB_query("SELECT suppliers.suppname, suppliers.supplierid, @@ -542,6 +549,7 @@ SUM(locstock.quantity) AS qoh, stockmaster.units, stockmaster.mbflag, + stockmaster.discontinued, stockmaster.decimalplaces FROM stockmaster LEFT JOIN stockcategory @@ -553,6 +561,7 @@ stockmaster.description, stockmaster.units, stockmaster.mbflag, + stockmaster.discontinued, stockmaster.decimalplaces ORDER BY stockmaster.stockid"; } else { @@ -561,6 +570,7 @@ SUM(locstock.quantity) AS qoh, stockmaster.units, stockmaster.mbflag, + stockmaster.discontinued, stockmaster.decimalplaces FROM stockmaster, locstock @@ -571,6 +581,7 @@ stockmaster.description, stockmaster.units, stockmaster.mbflag, + stockmaster.discontinued, stockmaster.decimalplaces ORDER BY stockmaster.stockid"; } @@ -580,6 +591,7 @@ $SQL = "SELECT stockmaster.stockid, stockmaster.description, stockmaster.mbflag, + stockmaster.discontinued, SUM(locstock.quantity) AS qoh, stockmaster.units, stockmaster.decimalplaces @@ -593,12 +605,14 @@ stockmaster.description, stockmaster.units, stockmaster.mbflag, + stockmaster.discontinued, stockmaster.decimalplaces ORDER BY stockmaster.stockid"; } else { $SQL = "SELECT stockmaster.stockid, stockmaster.description, stockmaster.mbflag, + stockmaster.discontinued, sum(locstock.quantity) as qoh, stockmaster.units, stockmaster.decimalplaces @@ -611,6 +625,7 @@ stockmaster.description, stockmaster.units, stockmaster.mbflag, + stockmaster.discontinued, stockmaster.decimalplaces ORDER BY stockmaster.stockid"; } @@ -619,6 +634,7 @@ $SQL = "SELECT stockmaster.stockid, stockmaster.description, stockmaster.mbflag, + stockmaster.discontinued, SUM(locstock.quantity) AS qoh, stockmaster.units, stockmaster.decimalplaces @@ -631,12 +647,14 @@ stockmaster.description, stockmaster.units, stockmaster.mbflag, + stockmaster.discontinued, stockmaster.decimalplaces ORDER BY stockmaster.stockid"; } else { $SQL = "SELECT stockmaster.stockid, stockmaster.description, stockmaster.mbflag, + stockmaster.discontinued, SUM(locstock.quantity) AS qoh, stockmaster.units, stockmaster.decimalplaces @@ -648,6 +666,7 @@ stockmaster.description, stockmaster.units, stockmaster.mbflag, + stockmaster.discontinued, stockmaster.decimalplaces ORDER BY stockmaster.stockid"; } @@ -732,11 +751,18 @@ } else { $qoh = number_format($myrow['qoh'], $myrow['decimalplaces']); } + if ($myrow['discontinued']==1){ + $ItemStatus = '<font class="bad">' . _('Obsolete') . '</font>'; + } else { + $ItemStatus =''; + } + echo '<td><input type="submit" name="Select" value="' . $myrow['stockid'] . '" /></td> <td>'.$myrow['description'].'</td> <td class="number">' . $qoh . '</td> <td>' . $myrow['units'] . '</td> <td><a target="_blank" href="' . $rootpath . '/StockStatus.php?StockID=' . $myrow['stockid'].'">' . _('View') . '</a></td> + <td>' . $ItemStatus . '</td> </tr>'; $j++; if ($j == 20 AND ($RowIndex + 1 != $_SESSION['DisplayRecordsMax'])) { Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2011-08-07 04:37:32 UTC (rev 4652) +++ trunk/doc/Change.log 2011-08-07 10:17:52 UTC (rev 4653) @@ -1,5 +1,6 @@ webERP Change Log +7/8/11 Phil: SelectProduct.php now disables transactions on items flagged as obsolete (discontinued). Also obsolete items are shown as such in the selection list - suggested by Klaus (opto) 7/8/11 Ricard: Corrected INNER JOIN ON clause in sql used in InventoryQuantities.php script 7/8/11 Klaus: Added docuwiki links to WikiLinks function in MiscFunctions.php and allow Docuwiki option in SystemParameters.php 6/8/11 Ricard: SalesInquiry.php fix wording of labels to be more consistent with the rest of webERP This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-08-07 04:37:39
|
Revision: 4652 http://web-erp.svn.sourceforge.net/web-erp/?rev=4652&view=rev Author: daintree Date: 2011-08-07 04:37:32 +0000 (Sun, 07 Aug 2011) Log Message: ----------- M trunk/doc/Change.log M trunk/includes/MiscFunctions.php M trunk/SystemParameters.php M trunk/InventoryQuantities.php M trunk/SalesInquiry.php Modified Paths: -------------- trunk/InventoryQuantities.php trunk/SalesInquiry.php trunk/SystemParameters.php trunk/doc/Change.log trunk/includes/MiscFunctions.php Modified: trunk/InventoryQuantities.php =================================================================== --- trunk/InventoryQuantities.php 2011-08-06 01:53:38 UTC (rev 4651) +++ trunk/InventoryQuantities.php 2011-08-07 04:37:32 UTC (rev 4652) @@ -40,7 +40,7 @@ stockmaster.serialised, stockmaster.controlled FROM locstock INNER JOIN stockmaster - locstock.stockid=stockmaster.stockid + ON locstock.stockid=stockmaster.stockid INNER JOIN locations ON locstock.loccode=locations.loccode WHERE locstock.quantity <> 0 @@ -62,7 +62,7 @@ stockmaster.serialised, stockmaster.controlled FROM locstock INNER JOIN stockmaster - locstock.stockid=stockmaster.stockid + ON locstock.stockid=stockmaster.stockid INNER JOIN locations ON locstock.loccode=locations.loccode WHERE (SELECT count(*) Modified: trunk/SalesInquiry.php =================================================================== --- trunk/SalesInquiry.php 2011-08-06 01:53:38 UTC (rev 4651) +++ trunk/SalesInquiry.php 2011-08-07 04:37:32 UTC (rev 4652) @@ -159,9 +159,9 @@ } // Only used for Invoice Date type where tempstockmoves is the main table - $wheretype = " AND (tempstockmoves.type='10' OR tempstockmoves.type='11')"; + $WhereType = " AND (tempstockmoves.type='10' OR tempstockmoves.type='11')"; if ($_POST['InvoiceType'] != 'All') { - $wheretype = " AND tempstockmoves.type = '" . $_POST['InvoiceType'] . "'"; + $WhereType = " AND tempstockmoves.type = '" . $_POST['InvoiceType'] . "'"; } if ($inputError !=1) { $FromDate = FormatDateForSQL($_POST['FromDate']); @@ -239,7 +239,7 @@ AND tempstockmoves.hidemovt=0 AND salesorders.quotation = '" . $_POST['OrderType'] . "' $WherePart - $wheretype + $WhereType $WhereOrderNo $WhereDebtorNo $WhereDebtorName @@ -498,7 +498,7 @@ AND tempstockmoves.hidemovt=0 AND salesorders.quotation = '" . $_POST['OrderType'] . "' $WherePart - $wheretype + $WhereType $WhereOrderNo $WhereDebtorNo $WhereDebtorName @@ -533,7 +533,7 @@ AND tempstockmoves.hidemovt=0 AND salesorders.quotation = '" . $_POST['OrderType'] . "' $WherePart - $wheretype + $WhereType $WhereOrderNo $WhereDebtorNo $WhereDebtorName @@ -571,7 +571,7 @@ AND tempstockmoves.hidemovt=0 AND salesorders.quotation = '" . $_POST['OrderType'] . "' $WherePart - $wheretype + $WhereType $WhereOrderNo $WhereDebtorNo $WhereDebtorName @@ -605,7 +605,7 @@ AND tempstockmoves.hidemovt=0 AND salesorders.quotation = '" . $_POST['OrderType'] . "' $WherePart - $wheretype + $WhereType $WhereOrderNo $WhereDebtorNo $WhereDebtorName @@ -639,7 +639,7 @@ AND tempstockmoves.hidemovt=0 AND salesorders.quotation = '" . $_POST['OrderType'] . "' $WherePart - $wheretype + $WhereType $WhereOrderNo $WhereDebtorNo $WhereDebtorName @@ -673,7 +673,7 @@ AND tempstockmoves.hidemovt=0 AND salesorders.quotation = '" . $_POST['OrderType'] . "' $WherePart - $wheretype + $WhereType $WhereOrderNo $WhereDebtorNo $WhereDebtorName @@ -707,7 +707,7 @@ AND tempstockmoves.hidemovt=0 AND salesorders.quotation = '" . $_POST['OrderType'] . "' $WherePart - $wheretype + $WhereType $WhereOrderNo $WhereDebtorNo $WhereDebtorName @@ -726,45 +726,45 @@ $result = DB_query($sql,$db,$ErrMsg); $ctr = 0; echo '<pre>'; - $totalqty = 0; - $totalextcost = 0; - $totalextprice = 0; - $totalinvqty = 0; + $TotalQty = 0; + $TotalExtCost = 0; + $TotalExtPrice = 0; + $TotalInvQty = 0; // Create array for summary type to display in header. Access it with $savesummarytype - $summary_array['orderno'] = _('Order Number'); - $summary_array['stkcode'] = _('Part Number'); - $summary_array['extprice'] = _('Extended Price'); - $summary_array['debtorno'] = _('Customer Number'); - $summary_array['name'] = _('Customer Name'); - $summary_array['month'] = _('Month'); - $summary_array['categoryid'] = _('Stock Category'); - $summary_array['salesman'] = _('Salesman'); - $summary_array['area'] = _('Sales Area'); - $summary_array['transno'] = _('Transaction Number'); + $Summary_Array['orderno'] = _('Order Number'); + $Summary_Array['stkcode'] = _('Stock Code'); + $Summary_Array['extprice'] = _('Extended Price'); + $Summary_Array['debtorno'] = _('Customer Number'); + $Summary_Array['name'] = _('Customer Name'); + $Summary_Array['month'] = _('Month'); + $Summary_Array['categoryid'] = _('Stock Category'); + $Summary_Array['salesman'] = _('Salesman'); + $Summary_Array['area'] = _('Sales Area'); + $Summary_Array['transno'] = _('Transaction Number'); // Create array for sort for detail report to display in header - $detail_array['salesorderdetails.orderno'] = _('Order Number'); - $detail_array['salesorderdetails.stkcode'] = _('Part Number'); - $detail_array['debtorsmaster.debtorno,salesorderdetails.orderno'] = _('Customer Number'); - $detail_array['debtorsmaster.name,debtorsmaster.debtorno,salesorderdetails.orderno'] = _('Customer Name'); - $detail_array['tempstockmoves.transno,salesorderdetails.stkcode'] = _('Transaction Number'); + $Detail_Array['salesorderdetails.orderno'] = _('Order Number'); + $Detail_Array['salesorderdetails.stkcode'] = _('Stock Code'); + $Detail_Array['debtorsmaster.debtorno,salesorderdetails.orderno'] = _('Customer Number'); + $Detail_Array['debtorsmaster.name,debtorsmaster.debtorno,salesorderdetails.orderno'] = _('Customer Name'); + $Detail_Array['tempstockmoves.transno,salesorderdetails.stkcode'] = _('Transaction Number'); // Display Header info if ($_POST['ReportType'] == 'Summary') { - $sortby_display = $summary_array[$savesummarytype]; + $SortBy_Display = $Summary_Array[$savesummarytype]; } else { - $sortby_display = $detail_array[$_POST['SortBy']]; + $SortBy_Display = $Detail_Array[$_POST['SortBy']]; } - echo ' ' . _('Sales Inquiry') . ' - ' . $_POST['ReportType'] . " By $sortby_display <br/>"; + echo ' ' . _('Sales Inquiry') . ' - ' . $_POST['ReportType'] . ' ' . _('By') . ' ' . $SortBy_Display . '<br/>'; if ($_POST['OrderType'] == '0') { echo ' ' . _('Order Type - Sales Orders') . '<br/>'; } else { echo ' ' . _('Order Type - Quotations') . '<br/>'; } echo ' ' . _('Date Type') . ' - ' . $_POST['DateType'] . '<br/>'; - echo ' ' . _('Date Range') . ' - ' . $_POST['FromDate'] . _(' To ') . $_POST['ToDate'] . '<br/>'; + echo ' ' . _('Date Range') . ' - ' . $_POST['FromDate'] . ' ' . _('To') . ' ' . $_POST['ToDate'] . '<br/>'; if (mb_strlen(trim($PartNumber)) > 0) { - echo ' ' . _('Part Number') . ' - ' . $_POST['PartNumberOp'] . ' ' . $_POST['PartNumber'] . '<br/>'; + echo ' ' . _('Stock Code') . ' - ' . $_POST['PartNumberOp'] . ' ' . $_POST['PartNumber'] . '<br/>'; } if (mb_strlen(trim($_POST['DebtorNo'])) > 0) { echo ' ' . _('Customer Number') . ' - ' . $_POST['DebtorNoOp'] . ' ' . $_POST['DebtorNo'] . '<br/>'; @@ -790,7 +790,7 @@ if ($_POST['DateType'] == 'Order') { printf('%10s | %-20s | %10s | %-10s | %-30s | %-30s | %12s | %14s | %14s | %14s | %12s | %-10s | %-10s | %-10s | %-40s ', _('Order No'), - _('Part Number'), + _('Stock Code'), _('Order Date'), _('Debtor No'), _('Debtor Name'), @@ -803,13 +803,13 @@ _('Item Due'), _('Salesman'), _('Area'), - _('Part Description')); + _('Item Description')); } else { // Headings for Invoiced Date printf('%10s | %14s | %-20s | %10s | %-10s | %-30s | %-30s | %12s | %14s | %14s | %12s | %-10s | %-10s | %-10s | %-40s ', _('Order No'), _('Trans. No'), - _('Part Number'), + _('Stock Code'), _('Order Date'), _('Debtor No'), _('Debtor Name'), @@ -821,7 +821,7 @@ _('Invoiced'), _('Salesman'), _('Area'), - _('Part Description')); + _('Item Description')); } print '<br/><br/>'; $linectr = 0; @@ -845,7 +845,7 @@ $myrow['area'], $myrow['description']); print '<br/>'; - $totalqty += $myrow['quantity']; + $TotalQty += $myrow['quantity']; } else { // Detail for Invoiced Date printf('%10s | %14s | %-20s | %10s | %-10s | %-30s | %-30s | %12s | %14s | %14s | %12s | %-10s | %-10s | %-10s | %-40s ', @@ -865,12 +865,12 @@ $myrow['area'], $myrow['description']); print '<br/>'; - $totalqty += $myrow['qty']; + $TotalQty += $myrow['qty']; } $lastdecimalplaces = $myrow['decimalplaces']; - $totalextcost += $myrow['extcost']; - $totalextprice += $myrow['extprice']; - $totalinvqty += $myrow['qtyinvoiced']; + $TotalExtCost += $myrow['extcost']; + $TotalExtPrice += $myrow['extprice']; + $TotalInvQty += $myrow['qtyinvoiced']; } //END WHILE LIST LOOP // Print totals if ($_POST['DateType'] == 'Order') { @@ -881,10 +881,10 @@ ' ', ' ', ' ', - number_format($totalqty,2), - number_format($totalextcost,2), - number_format($totalextprice,2), - number_format($totalinvqty,2), + number_format($TotalQty,2), + number_format($TotalExtCost,2), + number_format($TotalExtPrice,2), + number_format($TotalInvQty,2), ' ', ' ', ' '); @@ -898,9 +898,9 @@ ' ', ' ', ' ', - number_format($totalqty,2), - number_format($totalextcost,2), - number_format($totalextprice,2), + number_format($TotalQty,2), + number_format($TotalExtCost,2), + number_format($TotalExtPrice,2), ' ', ' ', ' '); @@ -908,60 +908,60 @@ echo '</pre>'; } else { // Print summary stuff - $summarytype = $_POST['SummaryType']; + $SummaryType = $_POST['SummaryType']; $columnheader7 = ' '; // Set up description based on the Summary Type - if ($summarytype == 'name') { - $summarytype = 'name'; - $description = 'debtorno'; - $summaryheader = _('Customer Name'); - $descriptionheader = _('Customer Number'); + if ($SummaryType == 'name') { + $SummaryType = 'name'; + $Description = 'debtorno'; + $SummaryHeader = _('Customer Name'); + $Descriptionheader = _('Customer Number'); } - if ($summarytype == 'stkcode' || $summarytype == 'extprice') { - $description = 'description'; - $summaryheader = _('Part Number'); - $descriptionheader = _('Part Description'); + if ($SummaryType == 'stkcode' OR $SummaryType == 'extprice') { + $Description = 'description'; + $SummaryHeader = _('Stock Code'); + $Descriptionheader = _('Item Description'); } - if ($summarytype == 'transno') { - $description = 'name'; - $summaryheader = _('Transaction Number'); - $descriptionheader = _('Customer Name'); + if ($SummaryType == 'transno') { + $Description = 'name'; + $SummaryHeader = _('Transaction Number'); + $Descriptionheader = _('Customer Name'); $columnheader7 = _('Order Number'); } - if ($summarytype == 'debtorno') { - $description = 'name'; - $summaryheader = _('Customer Number'); - $descriptionheader = _('Customer Name'); + if ($SummaryType == 'debtorno') { + $Description = 'name'; + $SummaryHeader = _('Customer Number'); + $Descriptionheader = _('Customer Name'); } - if ($summarytype == 'orderno') { - $description = 'debtorno'; - $summaryheader = _('Order Number'); - $descriptionheader = _('Customer Number'); + if ($SummaryType == 'orderno') { + $Description = 'debtorno'; + $SummaryHeader = _('Order Number'); + $Descriptionheader = _('Customer Number'); $columnheader7 = _('Customer Name'); } - if ($summarytype == 'categoryid') { - $description = 'categorydescription'; - $summaryheader = _('Stock Category'); - $descriptionheader = _('Category Description'); + if ($SummaryType == 'categoryid') { + $Description = 'categorydescription'; + $SummaryHeader = _('Stock Category'); + $Descriptionheader = _('Category Description'); } - if ($summarytype == 'salesman') { - $description = 'salesmanname'; - $summaryheader = _('Salesman Code'); - $descriptionheader = _('Salesman Name'); + if ($SummaryType == 'salesman') { + $Description = 'salesmanname'; + $SummaryHeader = _('Salesman Code'); + $Descriptionheader = _('Salesman Name'); } - if ($summarytype == 'area') { - $description = 'areadescription'; - $summaryheader = _('Sales Area'); - $descriptionheader = _('Area Description'); + if ($SummaryType == 'area') { + $Description = 'areadescription'; + $SummaryHeader = _('Sales Area'); + $Descriptionheader = _('Area Description'); } - if ($summarytype == 'month') { - $description = 'monthname'; - $summaryheader = _('Month'); - $descriptionheader = _('Month'); + if ($SummaryType == 'month') { + $Description = 'monthname'; + $SummaryHeader = _('Month'); + $Descriptionheader = _('Month'); } printf(' %-30s | %-40s | %12s | %14s | %14s | %14s | %-15s', - _($summaryheader), - _($descriptionheader), + _($SummaryHeader), + _($Descriptionheader), _('Quantity'), _('Extended Cost'), _('Extended Price'), @@ -973,42 +973,42 @@ $linectr = 0; while ($myrow = DB_fetch_array($result)) { $linectr++; - if ($summarytype == 'orderno') { + if ($SummaryType == 'orderno') { $column7 = $myrow['name']; } - if ($summarytype == 'transno') { + if ($SummaryType == 'transno') { $column7 = $myrow['orderno']; } if ($_POST['DateType'] == 'Order') { // quantity is from salesorderdetails - $displayqty = $myrow['quantity']; + $DisplayQty = $myrow['quantity']; } else { // qty is from stockmoves - $displayqty = $myrow['qty']; + $DisplayQty = $myrow['qty']; } printf(' %-30s | %-40s | %12s | %14s | %14s | %14s | %-40s', - $myrow[$summarytype], - $myrow[$description], - number_format($displayqty,2), + $myrow[$SummaryType], + $myrow[$Description], + number_format($DisplayQty,2), number_format($myrow['extcost'],2), number_format($myrow['extprice'],2), number_format($myrow['qtyinvoiced'],2), $column7); print '<br/>'; - $totalqty += $displayqty; - $totalextcost += $myrow['extcost']; - $totalextprice += $myrow['extprice']; - $totalinvqty += $myrow['qtyinvoiced']; + $TotalQty += $DisplayQty; + $TotalExtCost += $myrow['extcost']; + $TotalExtPrice += $myrow['extprice']; + $TotalInvQty += $myrow['qtyinvoiced']; } //END WHILE LIST LOOP // Print totals printf(' %-30s | %-40s | %12s | %14s | %14s | %14s', _('Totals'), _('Lines - ') . $linectr, - number_format($totalqty,2), - number_format($totalextcost,2), - number_format($totalextprice,2), - number_format($totalinvqty,2), + number_format($TotalQty,2), + number_format($TotalExtCost,2), + number_format($TotalExtPrice,2), + number_format($TotalInvQty,2), ' '); echo '</pre>'; } // End of if ($_POST['ReportType'] @@ -1062,7 +1062,7 @@ <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="ToDate" size=10 maxlength=10 value="' . $_POST['ToDate'] . '"></td> </tr>'; - echo '<tr><td>' . _('Part Number') . ':</td>'; + echo '<tr><td>' . _('Stock Code') . ':</td>'; echo '<td><select name="PartNumberOp">'; echo '<option selected value="Equals">' . _('Equals') . '</option>'; echo '<option value="LIKE">' . _('Begins With') . '</option>'; @@ -1125,7 +1125,7 @@ echo '<tr><td>' . _('Sort By') . ':</td>'; echo '<td><select name="SortBy">'; echo '<option selected value="salesorderdetails.orderno">' . _('Order Number') . '</option>'; - echo '<option value="salesorderdetails.stkcode">' . _('Part Number') . '</option>'; + echo '<option value="salesorderdetails.stkcode">' . _('Stock Code') . '</option>'; echo '<option value="debtorsmaster.debtorno,salesorderdetails.orderno">' . _('Customer Number') . '</option>'; echo '<option value="debtorsmaster.name,debtorsmaster.debtorno,salesorderdetails.orderno">' . _('Customer Name') . '</option>'; echo '<option value="tempstockmoves.transno,salesorderdetails.stkcode">' . _('Transaction Number') . '</option>'; @@ -1140,7 +1140,7 @@ echo '<td><select name="SummaryType">'; echo '<option selected value="orderno">' . _('Order Number') . '</option>'; echo '<option value="transno">' . _('Transaction Number') . '</option>'; - echo '<option value="stkcode">' . _('Part Number') . '</option>'; + echo '<option value="stkcode">' . _('Stock Code') . '</option>'; echo '<option value="extprice">' . _('Extended Price') . '</option>'; echo '<option value="debtorno">' . _('Customer Number') . '</option>'; echo '<option value="name">' . _('Customer Name') . '</option>'; Modified: trunk/SystemParameters.php =================================================================== --- trunk/SystemParameters.php 2011-08-06 01:53:38 UTC (rev 4651) +++ trunk/SystemParameters.php 2011-08-07 04:37:32 UTC (rev 4652) @@ -807,8 +807,9 @@ </tr>'; $WikiApplications = array( _('Disabled'), - _('WackoWiki'), - _('MediaWiki') ); + _('WackoWiki'), + _('MediaWiki'), + _('DokuWiki') ); echo '<tr style="outline: 1px solid"><td>' . _('Wiki application') . ':</td> <td><select name="X_WikiApp">'; Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2011-08-06 01:53:38 UTC (rev 4651) +++ trunk/doc/Change.log 2011-08-07 04:37:32 UTC (rev 4652) @@ -1,5 +1,8 @@ webERP Change Log +7/8/11 Ricard: Corrected INNER JOIN ON clause in sql used in InventoryQuantities.php script +7/8/11 Klaus: Added docuwiki links to WikiLinks function in MiscFunctions.php and allow Docuwiki option in SystemParameters.php +6/8/11 Ricard: SalesInquiry.php fix wording of labels to be more consistent with the rest of webERP 6/8/11 Phil: PO_Items.php now has checkbox to select items that have purchasing data entered for the supplier ordering from - as per Klaus's (opto) suggestion 6/8/11 Exson: Added leadtime to the link from SelectProduct.php so that delivery dates used when creating purchase orders make sense 4/8/11 Phil: Fix GP Percent reported when discounts updated by discount matrix Modified: trunk/includes/MiscFunctions.php =================================================================== --- trunk/includes/MiscFunctions.php 2011-08-06 01:53:38 UTC (rev 4651) +++ trunk/includes/MiscFunctions.php 2011-08-07 04:37:32 UTC (rev 4652) @@ -228,14 +228,17 @@ function wikiLink($type, $id) { if ($_SESSION['WikiApp']==_('WackoWiki')){ - echo '<a target="_blank" href="../' . $_SESSION['WikiPath'] . '/' . $type . $id . '">' . _('Wiki ' . $type . ' Knowlege Base') . '</A><BR>'; + echo '<a target="_blank" href="../' . $_SESSION['WikiPath'] . '/' . $type . $id . '">' . _('Wiki ' . $type . ' Knowlege Base') . '</a><br />'; } elseif ($_SESSION['WikiApp']==_('MediaWiki')){ - echo '<a target="_blank" href="../' . $_SESSION['WikiPath'] . '/index.php/' . $type . '/' . $id . '">' . _('Wiki ' . $type . ' Knowlege Base') . '</A><BR>'; + echo '<a target="_blank" href="../' . $_SESSION['WikiPath'] . '/index.php/' . $type . '/' . $id . '">' . _('Wiki ' . $type . ' Knowlege Base') . '</a><br />'; + } elseif ($_SESSION['WikiApp']==_('DokuWiki')){ + echo ' ../' . $_SESSION['WikiPath'] . '/doku.php?id=' . $type . ':' . $id . ' ' . _('Wiki ' . $type . ' Knowlege Base') . ' <br />'; } }//wikiLink + // Lindsay debug stuff function LogBackTrace( $dest = 0 ) { error_log( "***BEGIN STACK BACKTRACE***", $dest ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-08-07 04:37:38
|
Revision: 4652 http://web-erp.svn.sourceforge.net/web-erp/?rev=4652&view=rev Author: daintree Date: 2011-08-07 04:37:32 +0000 (Sun, 07 Aug 2011) Log Message: ----------- M trunk/doc/Change.log M trunk/includes/MiscFunctions.php M trunk/SystemParameters.php M trunk/InventoryQuantities.php M trunk/SalesInquiry.php Modified Paths: -------------- trunk/InventoryQuantities.php trunk/SalesInquiry.php trunk/SystemParameters.php trunk/doc/Change.log trunk/includes/MiscFunctions.php Modified: trunk/InventoryQuantities.php =================================================================== --- trunk/InventoryQuantities.php 2011-08-06 01:53:38 UTC (rev 4651) +++ trunk/InventoryQuantities.php 2011-08-07 04:37:32 UTC (rev 4652) @@ -40,7 +40,7 @@ stockmaster.serialised, stockmaster.controlled FROM locstock INNER JOIN stockmaster - locstock.stockid=stockmaster.stockid + ON locstock.stockid=stockmaster.stockid INNER JOIN locations ON locstock.loccode=locations.loccode WHERE locstock.quantity <> 0 @@ -62,7 +62,7 @@ stockmaster.serialised, stockmaster.controlled FROM locstock INNER JOIN stockmaster - locstock.stockid=stockmaster.stockid + ON locstock.stockid=stockmaster.stockid INNER JOIN locations ON locstock.loccode=locations.loccode WHERE (SELECT count(*) Modified: trunk/SalesInquiry.php =================================================================== --- trunk/SalesInquiry.php 2011-08-06 01:53:38 UTC (rev 4651) +++ trunk/SalesInquiry.php 2011-08-07 04:37:32 UTC (rev 4652) @@ -159,9 +159,9 @@ } // Only used for Invoice Date type where tempstockmoves is the main table - $wheretype = " AND (tempstockmoves.type='10' OR tempstockmoves.type='11')"; + $WhereType = " AND (tempstockmoves.type='10' OR tempstockmoves.type='11')"; if ($_POST['InvoiceType'] != 'All') { - $wheretype = " AND tempstockmoves.type = '" . $_POST['InvoiceType'] . "'"; + $WhereType = " AND tempstockmoves.type = '" . $_POST['InvoiceType'] . "'"; } if ($inputError !=1) { $FromDate = FormatDateForSQL($_POST['FromDate']); @@ -239,7 +239,7 @@ AND tempstockmoves.hidemovt=0 AND salesorders.quotation = '" . $_POST['OrderType'] . "' $WherePart - $wheretype + $WhereType $WhereOrderNo $WhereDebtorNo $WhereDebtorName @@ -498,7 +498,7 @@ AND tempstockmoves.hidemovt=0 AND salesorders.quotation = '" . $_POST['OrderType'] . "' $WherePart - $wheretype + $WhereType $WhereOrderNo $WhereDebtorNo $WhereDebtorName @@ -533,7 +533,7 @@ AND tempstockmoves.hidemovt=0 AND salesorders.quotation = '" . $_POST['OrderType'] . "' $WherePart - $wheretype + $WhereType $WhereOrderNo $WhereDebtorNo $WhereDebtorName @@ -571,7 +571,7 @@ AND tempstockmoves.hidemovt=0 AND salesorders.quotation = '" . $_POST['OrderType'] . "' $WherePart - $wheretype + $WhereType $WhereOrderNo $WhereDebtorNo $WhereDebtorName @@ -605,7 +605,7 @@ AND tempstockmoves.hidemovt=0 AND salesorders.quotation = '" . $_POST['OrderType'] . "' $WherePart - $wheretype + $WhereType $WhereOrderNo $WhereDebtorNo $WhereDebtorName @@ -639,7 +639,7 @@ AND tempstockmoves.hidemovt=0 AND salesorders.quotation = '" . $_POST['OrderType'] . "' $WherePart - $wheretype + $WhereType $WhereOrderNo $WhereDebtorNo $WhereDebtorName @@ -673,7 +673,7 @@ AND tempstockmoves.hidemovt=0 AND salesorders.quotation = '" . $_POST['OrderType'] . "' $WherePart - $wheretype + $WhereType $WhereOrderNo $WhereDebtorNo $WhereDebtorName @@ -707,7 +707,7 @@ AND tempstockmoves.hidemovt=0 AND salesorders.quotation = '" . $_POST['OrderType'] . "' $WherePart - $wheretype + $WhereType $WhereOrderNo $WhereDebtorNo $WhereDebtorName @@ -726,45 +726,45 @@ $result = DB_query($sql,$db,$ErrMsg); $ctr = 0; echo '<pre>'; - $totalqty = 0; - $totalextcost = 0; - $totalextprice = 0; - $totalinvqty = 0; + $TotalQty = 0; + $TotalExtCost = 0; + $TotalExtPrice = 0; + $TotalInvQty = 0; // Create array for summary type to display in header. Access it with $savesummarytype - $summary_array['orderno'] = _('Order Number'); - $summary_array['stkcode'] = _('Part Number'); - $summary_array['extprice'] = _('Extended Price'); - $summary_array['debtorno'] = _('Customer Number'); - $summary_array['name'] = _('Customer Name'); - $summary_array['month'] = _('Month'); - $summary_array['categoryid'] = _('Stock Category'); - $summary_array['salesman'] = _('Salesman'); - $summary_array['area'] = _('Sales Area'); - $summary_array['transno'] = _('Transaction Number'); + $Summary_Array['orderno'] = _('Order Number'); + $Summary_Array['stkcode'] = _('Stock Code'); + $Summary_Array['extprice'] = _('Extended Price'); + $Summary_Array['debtorno'] = _('Customer Number'); + $Summary_Array['name'] = _('Customer Name'); + $Summary_Array['month'] = _('Month'); + $Summary_Array['categoryid'] = _('Stock Category'); + $Summary_Array['salesman'] = _('Salesman'); + $Summary_Array['area'] = _('Sales Area'); + $Summary_Array['transno'] = _('Transaction Number'); // Create array for sort for detail report to display in header - $detail_array['salesorderdetails.orderno'] = _('Order Number'); - $detail_array['salesorderdetails.stkcode'] = _('Part Number'); - $detail_array['debtorsmaster.debtorno,salesorderdetails.orderno'] = _('Customer Number'); - $detail_array['debtorsmaster.name,debtorsmaster.debtorno,salesorderdetails.orderno'] = _('Customer Name'); - $detail_array['tempstockmoves.transno,salesorderdetails.stkcode'] = _('Transaction Number'); + $Detail_Array['salesorderdetails.orderno'] = _('Order Number'); + $Detail_Array['salesorderdetails.stkcode'] = _('Stock Code'); + $Detail_Array['debtorsmaster.debtorno,salesorderdetails.orderno'] = _('Customer Number'); + $Detail_Array['debtorsmaster.name,debtorsmaster.debtorno,salesorderdetails.orderno'] = _('Customer Name'); + $Detail_Array['tempstockmoves.transno,salesorderdetails.stkcode'] = _('Transaction Number'); // Display Header info if ($_POST['ReportType'] == 'Summary') { - $sortby_display = $summary_array[$savesummarytype]; + $SortBy_Display = $Summary_Array[$savesummarytype]; } else { - $sortby_display = $detail_array[$_POST['SortBy']]; + $SortBy_Display = $Detail_Array[$_POST['SortBy']]; } - echo ' ' . _('Sales Inquiry') . ' - ' . $_POST['ReportType'] . " By $sortby_display <br/>"; + echo ' ' . _('Sales Inquiry') . ' - ' . $_POST['ReportType'] . ' ' . _('By') . ' ' . $SortBy_Display . '<br/>'; if ($_POST['OrderType'] == '0') { echo ' ' . _('Order Type - Sales Orders') . '<br/>'; } else { echo ' ' . _('Order Type - Quotations') . '<br/>'; } echo ' ' . _('Date Type') . ' - ' . $_POST['DateType'] . '<br/>'; - echo ' ' . _('Date Range') . ' - ' . $_POST['FromDate'] . _(' To ') . $_POST['ToDate'] . '<br/>'; + echo ' ' . _('Date Range') . ' - ' . $_POST['FromDate'] . ' ' . _('To') . ' ' . $_POST['ToDate'] . '<br/>'; if (mb_strlen(trim($PartNumber)) > 0) { - echo ' ' . _('Part Number') . ' - ' . $_POST['PartNumberOp'] . ' ' . $_POST['PartNumber'] . '<br/>'; + echo ' ' . _('Stock Code') . ' - ' . $_POST['PartNumberOp'] . ' ' . $_POST['PartNumber'] . '<br/>'; } if (mb_strlen(trim($_POST['DebtorNo'])) > 0) { echo ' ' . _('Customer Number') . ' - ' . $_POST['DebtorNoOp'] . ' ' . $_POST['DebtorNo'] . '<br/>'; @@ -790,7 +790,7 @@ if ($_POST['DateType'] == 'Order') { printf('%10s | %-20s | %10s | %-10s | %-30s | %-30s | %12s | %14s | %14s | %14s | %12s | %-10s | %-10s | %-10s | %-40s ', _('Order No'), - _('Part Number'), + _('Stock Code'), _('Order Date'), _('Debtor No'), _('Debtor Name'), @@ -803,13 +803,13 @@ _('Item Due'), _('Salesman'), _('Area'), - _('Part Description')); + _('Item Description')); } else { // Headings for Invoiced Date printf('%10s | %14s | %-20s | %10s | %-10s | %-30s | %-30s | %12s | %14s | %14s | %12s | %-10s | %-10s | %-10s | %-40s ', _('Order No'), _('Trans. No'), - _('Part Number'), + _('Stock Code'), _('Order Date'), _('Debtor No'), _('Debtor Name'), @@ -821,7 +821,7 @@ _('Invoiced'), _('Salesman'), _('Area'), - _('Part Description')); + _('Item Description')); } print '<br/><br/>'; $linectr = 0; @@ -845,7 +845,7 @@ $myrow['area'], $myrow['description']); print '<br/>'; - $totalqty += $myrow['quantity']; + $TotalQty += $myrow['quantity']; } else { // Detail for Invoiced Date printf('%10s | %14s | %-20s | %10s | %-10s | %-30s | %-30s | %12s | %14s | %14s | %12s | %-10s | %-10s | %-10s | %-40s ', @@ -865,12 +865,12 @@ $myrow['area'], $myrow['description']); print '<br/>'; - $totalqty += $myrow['qty']; + $TotalQty += $myrow['qty']; } $lastdecimalplaces = $myrow['decimalplaces']; - $totalextcost += $myrow['extcost']; - $totalextprice += $myrow['extprice']; - $totalinvqty += $myrow['qtyinvoiced']; + $TotalExtCost += $myrow['extcost']; + $TotalExtPrice += $myrow['extprice']; + $TotalInvQty += $myrow['qtyinvoiced']; } //END WHILE LIST LOOP // Print totals if ($_POST['DateType'] == 'Order') { @@ -881,10 +881,10 @@ ' ', ' ', ' ', - number_format($totalqty,2), - number_format($totalextcost,2), - number_format($totalextprice,2), - number_format($totalinvqty,2), + number_format($TotalQty,2), + number_format($TotalExtCost,2), + number_format($TotalExtPrice,2), + number_format($TotalInvQty,2), ' ', ' ', ' '); @@ -898,9 +898,9 @@ ' ', ' ', ' ', - number_format($totalqty,2), - number_format($totalextcost,2), - number_format($totalextprice,2), + number_format($TotalQty,2), + number_format($TotalExtCost,2), + number_format($TotalExtPrice,2), ' ', ' ', ' '); @@ -908,60 +908,60 @@ echo '</pre>'; } else { // Print summary stuff - $summarytype = $_POST['SummaryType']; + $SummaryType = $_POST['SummaryType']; $columnheader7 = ' '; // Set up description based on the Summary Type - if ($summarytype == 'name') { - $summarytype = 'name'; - $description = 'debtorno'; - $summaryheader = _('Customer Name'); - $descriptionheader = _('Customer Number'); + if ($SummaryType == 'name') { + $SummaryType = 'name'; + $Description = 'debtorno'; + $SummaryHeader = _('Customer Name'); + $Descriptionheader = _('Customer Number'); } - if ($summarytype == 'stkcode' || $summarytype == 'extprice') { - $description = 'description'; - $summaryheader = _('Part Number'); - $descriptionheader = _('Part Description'); + if ($SummaryType == 'stkcode' OR $SummaryType == 'extprice') { + $Description = 'description'; + $SummaryHeader = _('Stock Code'); + $Descriptionheader = _('Item Description'); } - if ($summarytype == 'transno') { - $description = 'name'; - $summaryheader = _('Transaction Number'); - $descriptionheader = _('Customer Name'); + if ($SummaryType == 'transno') { + $Description = 'name'; + $SummaryHeader = _('Transaction Number'); + $Descriptionheader = _('Customer Name'); $columnheader7 = _('Order Number'); } - if ($summarytype == 'debtorno') { - $description = 'name'; - $summaryheader = _('Customer Number'); - $descriptionheader = _('Customer Name'); + if ($SummaryType == 'debtorno') { + $Description = 'name'; + $SummaryHeader = _('Customer Number'); + $Descriptionheader = _('Customer Name'); } - if ($summarytype == 'orderno') { - $description = 'debtorno'; - $summaryheader = _('Order Number'); - $descriptionheader = _('Customer Number'); + if ($SummaryType == 'orderno') { + $Description = 'debtorno'; + $SummaryHeader = _('Order Number'); + $Descriptionheader = _('Customer Number'); $columnheader7 = _('Customer Name'); } - if ($summarytype == 'categoryid') { - $description = 'categorydescription'; - $summaryheader = _('Stock Category'); - $descriptionheader = _('Category Description'); + if ($SummaryType == 'categoryid') { + $Description = 'categorydescription'; + $SummaryHeader = _('Stock Category'); + $Descriptionheader = _('Category Description'); } - if ($summarytype == 'salesman') { - $description = 'salesmanname'; - $summaryheader = _('Salesman Code'); - $descriptionheader = _('Salesman Name'); + if ($SummaryType == 'salesman') { + $Description = 'salesmanname'; + $SummaryHeader = _('Salesman Code'); + $Descriptionheader = _('Salesman Name'); } - if ($summarytype == 'area') { - $description = 'areadescription'; - $summaryheader = _('Sales Area'); - $descriptionheader = _('Area Description'); + if ($SummaryType == 'area') { + $Description = 'areadescription'; + $SummaryHeader = _('Sales Area'); + $Descriptionheader = _('Area Description'); } - if ($summarytype == 'month') { - $description = 'monthname'; - $summaryheader = _('Month'); - $descriptionheader = _('Month'); + if ($SummaryType == 'month') { + $Description = 'monthname'; + $SummaryHeader = _('Month'); + $Descriptionheader = _('Month'); } printf(' %-30s | %-40s | %12s | %14s | %14s | %14s | %-15s', - _($summaryheader), - _($descriptionheader), + _($SummaryHeader), + _($Descriptionheader), _('Quantity'), _('Extended Cost'), _('Extended Price'), @@ -973,42 +973,42 @@ $linectr = 0; while ($myrow = DB_fetch_array($result)) { $linectr++; - if ($summarytype == 'orderno') { + if ($SummaryType == 'orderno') { $column7 = $myrow['name']; } - if ($summarytype == 'transno') { + if ($SummaryType == 'transno') { $column7 = $myrow['orderno']; } if ($_POST['DateType'] == 'Order') { // quantity is from salesorderdetails - $displayqty = $myrow['quantity']; + $DisplayQty = $myrow['quantity']; } else { // qty is from stockmoves - $displayqty = $myrow['qty']; + $DisplayQty = $myrow['qty']; } printf(' %-30s | %-40s | %12s | %14s | %14s | %14s | %-40s', - $myrow[$summarytype], - $myrow[$description], - number_format($displayqty,2), + $myrow[$SummaryType], + $myrow[$Description], + number_format($DisplayQty,2), number_format($myrow['extcost'],2), number_format($myrow['extprice'],2), number_format($myrow['qtyinvoiced'],2), $column7); print '<br/>'; - $totalqty += $displayqty; - $totalextcost += $myrow['extcost']; - $totalextprice += $myrow['extprice']; - $totalinvqty += $myrow['qtyinvoiced']; + $TotalQty += $DisplayQty; + $TotalExtCost += $myrow['extcost']; + $TotalExtPrice += $myrow['extprice']; + $TotalInvQty += $myrow['qtyinvoiced']; } //END WHILE LIST LOOP // Print totals printf(' %-30s | %-40s | %12s | %14s | %14s | %14s', _('Totals'), _('Lines - ') . $linectr, - number_format($totalqty,2), - number_format($totalextcost,2), - number_format($totalextprice,2), - number_format($totalinvqty,2), + number_format($TotalQty,2), + number_format($TotalExtCost,2), + number_format($TotalExtPrice,2), + number_format($TotalInvQty,2), ' '); echo '</pre>'; } // End of if ($_POST['ReportType'] @@ -1062,7 +1062,7 @@ <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="ToDate" size=10 maxlength=10 value="' . $_POST['ToDate'] . '"></td> </tr>'; - echo '<tr><td>' . _('Part Number') . ':</td>'; + echo '<tr><td>' . _('Stock Code') . ':</td>'; echo '<td><select name="PartNumberOp">'; echo '<option selected value="Equals">' . _('Equals') . '</option>'; echo '<option value="LIKE">' . _('Begins With') . '</option>'; @@ -1125,7 +1125,7 @@ echo '<tr><td>' . _('Sort By') . ':</td>'; echo '<td><select name="SortBy">'; echo '<option selected value="salesorderdetails.orderno">' . _('Order Number') . '</option>'; - echo '<option value="salesorderdetails.stkcode">' . _('Part Number') . '</option>'; + echo '<option value="salesorderdetails.stkcode">' . _('Stock Code') . '</option>'; echo '<option value="debtorsmaster.debtorno,salesorderdetails.orderno">' . _('Customer Number') . '</option>'; echo '<option value="debtorsmaster.name,debtorsmaster.debtorno,salesorderdetails.orderno">' . _('Customer Name') . '</option>'; echo '<option value="tempstockmoves.transno,salesorderdetails.stkcode">' . _('Transaction Number') . '</option>'; @@ -1140,7 +1140,7 @@ echo '<td><select name="SummaryType">'; echo '<option selected value="orderno">' . _('Order Number') . '</option>'; echo '<option value="transno">' . _('Transaction Number') . '</option>'; - echo '<option value="stkcode">' . _('Part Number') . '</option>'; + echo '<option value="stkcode">' . _('Stock Code') . '</option>'; echo '<option value="extprice">' . _('Extended Price') . '</option>'; echo '<option value="debtorno">' . _('Customer Number') . '</option>'; echo '<option value="name">' . _('Customer Name') . '</option>'; Modified: trunk/SystemParameters.php =================================================================== --- trunk/SystemParameters.php 2011-08-06 01:53:38 UTC (rev 4651) +++ trunk/SystemParameters.php 2011-08-07 04:37:32 UTC (rev 4652) @@ -807,8 +807,9 @@ </tr>'; $WikiApplications = array( _('Disabled'), - _('WackoWiki'), - _('MediaWiki') ); + _('WackoWiki'), + _('MediaWiki'), + _('DokuWiki') ); echo '<tr style="outline: 1px solid"><td>' . _('Wiki application') . ':</td> <td><select name="X_WikiApp">'; Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2011-08-06 01:53:38 UTC (rev 4651) +++ trunk/doc/Change.log 2011-08-07 04:37:32 UTC (rev 4652) @@ -1,5 +1,8 @@ webERP Change Log +7/8/11 Ricard: Corrected INNER JOIN ON clause in sql used in InventoryQuantities.php script +7/8/11 Klaus: Added docuwiki links to WikiLinks function in MiscFunctions.php and allow Docuwiki option in SystemParameters.php +6/8/11 Ricard: SalesInquiry.php fix wording of labels to be more consistent with the rest of webERP 6/8/11 Phil: PO_Items.php now has checkbox to select items that have purchasing data entered for the supplier ordering from - as per Klaus's (opto) suggestion 6/8/11 Exson: Added leadtime to the link from SelectProduct.php so that delivery dates used when creating purchase orders make sense 4/8/11 Phil: Fix GP Percent reported when discounts updated by discount matrix Modified: trunk/includes/MiscFunctions.php =================================================================== --- trunk/includes/MiscFunctions.php 2011-08-06 01:53:38 UTC (rev 4651) +++ trunk/includes/MiscFunctions.php 2011-08-07 04:37:32 UTC (rev 4652) @@ -228,14 +228,17 @@ function wikiLink($type, $id) { if ($_SESSION['WikiApp']==_('WackoWiki')){ - echo '<a target="_blank" href="../' . $_SESSION['WikiPath'] . '/' . $type . $id . '">' . _('Wiki ' . $type . ' Knowlege Base') . '</A><BR>'; + echo '<a target="_blank" href="../' . $_SESSION['WikiPath'] . '/' . $type . $id . '">' . _('Wiki ' . $type . ' Knowlege Base') . '</a><br />'; } elseif ($_SESSION['WikiApp']==_('MediaWiki')){ - echo '<a target="_blank" href="../' . $_SESSION['WikiPath'] . '/index.php/' . $type . '/' . $id . '">' . _('Wiki ' . $type . ' Knowlege Base') . '</A><BR>'; + echo '<a target="_blank" href="../' . $_SESSION['WikiPath'] . '/index.php/' . $type . '/' . $id . '">' . _('Wiki ' . $type . ' Knowlege Base') . '</a><br />'; + } elseif ($_SESSION['WikiApp']==_('DokuWiki')){ + echo ' ../' . $_SESSION['WikiPath'] . '/doku.php?id=' . $type . ':' . $id . ' ' . _('Wiki ' . $type . ' Knowlege Base') . ' <br />'; } }//wikiLink + // Lindsay debug stuff function LogBackTrace( $dest = 0 ) { error_log( "***BEGIN STACK BACKTRACE***", $dest ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-08-06 01:53:44
|
Revision: 4651 http://web-erp.svn.sourceforge.net/web-erp/?rev=4651&view=rev Author: daintree Date: 2011-08-06 01:53:38 +0000 (Sat, 06 Aug 2011) Log Message: ----------- various Modified Paths: -------------- trunk/sql/mysql/upgrade4.04.4-4.04.5.sql Modified: trunk/sql/mysql/upgrade4.04.4-4.04.5.sql =================================================================== --- trunk/sql/mysql/upgrade4.04.4-4.04.5.sql 2011-08-06 01:48:12 UTC (rev 4650) +++ trunk/sql/mysql/upgrade4.04.4-4.04.5.sql 2011-08-06 01:53:38 UTC (rev 4651) @@ -1,4 +1,4 @@ ALTER TABLE `custcontacts` ADD `email` VARCHAR( 55 ) NOT NULL; INSERT INTO config (confname, confvalue) VALUES ('WorkingDaysWeek','5'); -INSERT INTO `weberpdemo`.`scripts` (`script` ,`pagesecurity` ,`description`) VALUES ('PDFQuotationPortrait.php', '2', 'Quotation printout in portrait'); +INSERT INTO `scripts` (`script` ,`pagesecurity` ,`description`) VALUES ('PDFQuotationPortrait.php', '2', 'Quotation printout in portrait'); UPDATE config SET confvalue='4.04.5' WHERE confname='VersionNumber'; \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-08-06 01:53:44
|
Revision: 4651 http://web-erp.svn.sourceforge.net/web-erp/?rev=4651&view=rev Author: daintree Date: 2011-08-06 01:53:38 +0000 (Sat, 06 Aug 2011) Log Message: ----------- various Modified Paths: -------------- trunk/sql/mysql/upgrade4.04.4-4.04.5.sql Modified: trunk/sql/mysql/upgrade4.04.4-4.04.5.sql =================================================================== --- trunk/sql/mysql/upgrade4.04.4-4.04.5.sql 2011-08-06 01:48:12 UTC (rev 4650) +++ trunk/sql/mysql/upgrade4.04.4-4.04.5.sql 2011-08-06 01:53:38 UTC (rev 4651) @@ -1,4 +1,4 @@ ALTER TABLE `custcontacts` ADD `email` VARCHAR( 55 ) NOT NULL; INSERT INTO config (confname, confvalue) VALUES ('WorkingDaysWeek','5'); -INSERT INTO `weberpdemo`.`scripts` (`script` ,`pagesecurity` ,`description`) VALUES ('PDFQuotationPortrait.php', '2', 'Quotation printout in portrait'); +INSERT INTO `scripts` (`script` ,`pagesecurity` ,`description`) VALUES ('PDFQuotationPortrait.php', '2', 'Quotation printout in portrait'); UPDATE config SET confvalue='4.04.5' WHERE confname='VersionNumber'; \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-08-06 01:48:19
|
Revision: 4650 http://web-erp.svn.sourceforge.net/web-erp/?rev=4650&view=rev Author: daintree Date: 2011-08-06 01:48:12 +0000 (Sat, 06 Aug 2011) Log Message: ----------- various Modified Paths: -------------- trunk/PO_Header.php trunk/PO_Items.php trunk/PO_PDFPurchOrder.php trunk/PaymentTerms.php trunk/SelectProduct.php trunk/doc/Change.log Modified: trunk/PO_Header.php =================================================================== --- trunk/PO_Header.php 2011-08-04 10:18:14 UTC (rev 4649) +++ trunk/PO_Header.php 2011-08-06 01:48:12 UTC (rev 4650) @@ -157,7 +157,9 @@ } /*New order initiated by user clicking on supplier purchasing data from items page */ -if (isset($_GET['NewOrder']) AND isset($_GET['StockID']) AND isset($_GET['SelectedSupplier'])) { +if (isset($_GET['NewOrder']) + AND isset($_GET['StockID']) + AND isset($_GET['SelectedSupplier'])) { /* * initialise a new order */ @@ -173,10 +175,10 @@ /* set the SupplierID we got */ $_SESSION['PO'.$identifier]->SupplierID = $_GET['SelectedSupplier']; $_SESSION['PO'.$identifier]->DeliveryDate = DateAdd(date($_SESSION['DefaultDateFormat']), 'd', $_GET['LeadTime']); + $_SESSION['RequireSupplierSelection'] = 0; $_POST['Select'] = $_GET['SelectedSupplier']; - /* * the item (it's item code) that should be purchased */ @@ -210,7 +212,9 @@ $_SESSION['PO'.$identifier]->ExRate = $_POST['ExRate']; $_SESSION['PO'.$identifier]->Comments = $_POST['Comments']; $_SESSION['PO'.$identifier]->DeliveryBy = $_POST['DeliveryBy']; - $_SESSION['PO'.$identifier]->StatusMessage = $_POST['StatusComments']; + if (isset($_POST['StatusComments'])){ + $_SESSION['PO'.$identifier]->StatusComments = $_POST['StatusComments']; + } $_SESSION['PO'.$identifier]->PaymentTerms = $_POST['PaymentTerms']; $_SESSION['PO'.$identifier]->Contact = $_POST['Contact']; $_SESSION['PO'.$identifier]->Tel = $_POST['Tel']; @@ -519,25 +523,29 @@ _('Purchase Order') . '" alt="">' . ' ' . _('Purchase Order: Select Supplier') . ''; echo '<form action="' . $_SERVER['PHP_SELF'] . '?identifier=' . $identifier . '" method="post" name="choosesupplier">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<input type="hidden" name="SuppliersReturned" value="' . $SuppliersReturned .'" />'; + if (isset($SuppliersReturned)){ + echo '<input type="hidden" name="SuppliersReturned" value="' . $SuppliersReturned .'" />'; + } - echo '<table cellpadding=3 colspan=4 class=selection> + echo '<table cellpadding="3" colspan="4" class="selection"> <tr> <td><font size=1>' . _('Enter text in the supplier name') . ':</font></td> - <td><input type="Text" name="Keywords" size="20" maxlength="25"></td> + <td><input type="text" name="Keywords" size="20" maxlength="25" /></td> <td><font size=3><b>' . _('OR') . '</b></font></td> <td><font size=1>' . _('Enter text extract in the supplier code') . ':</font></td> - <td><input type="text" name="SuppCode" size="15" maxlength="18"></td> + <td><input type="text" name="SuppCode" size="15" maxlength="18" /></td> </tr> - </table><br /><div class="centre"> - <input type="submit" name="SearchSuppliers" value="' . _('Search Now') . '"> - <input type="submit" action="reset" value="' . _('Reset') . '"></div>'; + </table> + <br /> + <div class="centre"> + <input type="submit" name="SearchSuppliers" value="' . _('Search Now') . '" /> + <input type="submit" action="reset" value="' . _('Reset') . '" /></div>'; echo '<script type="text/javascript">defaultControl(document.forms[0].Keywords);</script>'; if (isset($result_SuppSelect)) { - echo '<br /><table cellpadding=3 colspan=7 class=selection>'; + echo '<br /><table cellpadding="3" colspan="7" class="selection">'; $tableheader = '<tr> <th>' . _('Code') . '</th> @@ -606,7 +614,11 @@ /* the link */ echo '<li><a href="'.$rootpath.'/PO_Items.php?NewItem=' . $Purch_Item . '&identifier=' . $identifier . '">' . _('Enter Line Item to this purchase order') . '</a></li>'; - echo '</td></tr></table></div><br />'; + echo '</td> + </tr> + </table> + </div> + <br />'; if (isset($_GET['Quantity'])) { $Qty=$_GET['Quantity']; Modified: trunk/PO_Items.php =================================================================== --- trunk/PO_Items.php 2011-08-04 10:18:14 UTC (rev 4649) +++ trunk/PO_Items.php 2011-08-06 01:48:12 UTC (rev 4650) @@ -93,7 +93,7 @@ $AuthRow=DB_fetch_array($AuthResult); if (DB_num_rows($AuthResult) > 0 AND $AuthRow['authlevel'] > $_SESSION['PO'.$identifier]->Order_Value()) { //user has authority to authrorise as well as create the order - $StatusComment=date($_SESSION['DefaultDateFormat']).' - ' . _('Order Created and Authorised by') . $UserDetails . ' - '.$_SESSION['PO'.$identifier]->StatusMessage.'<br />'; + $StatusComment=date($_SESSION['DefaultDateFormat']).' - ' . _('Order Created and Authorised by') . $UserDetails . '<br />'.$_SESSION['PO'.$identifier]->StatusComments.'<br />'; $_SESSION['PO'.$identifier]->AllowPrintPO=1; $_SESSION['PO'.$identifier]->Status = 'Authorised'; } else { // no authority to authorise this order @@ -110,18 +110,16 @@ _('The order will be created with a status of pending and will require authorisation'), 'warn'); $_SESSION['PO'.$identifier]->AllowPrintPO=0; - $StatusComment=date($_SESSION['DefaultDateFormat']).' - ' . _('Order Created by') . $UserDetails . ' - '.$_SESSION['PO'.$identifier]->StatusMessage.'<br />'; + $StatusComment=date($_SESSION['DefaultDateFormat']).' - ' . _('Order Created by') . $UserDetails . '<br />'.$_SESSION['PO'.$identifier]->StatusComments.'<br />'; $_SESSION['PO'.$identifier]->Status = 'Pending'; } } else { //auto authorise is set to off $_SESSION['PO'.$identifier]->AllowPrintPO=0; - $StatusComment=date($_SESSION['DefaultDateFormat']).' - ' . _('Order Created by') . $UserDetails . ' - '.$_SESSION['PO'.$identifier]->StatusMessage.'<br />'; + $StatusComment=date($_SESSION['DefaultDateFormat']).' - ' . _('Order Created by') . $UserDetails . ' - '.$_SESSION['PO'.$identifier]->StatusComments.'<br />'; $_SESSION['PO'.$identifier]->Status = 'Pending'; } if ($_SESSION['ExistingOrder']==0){ /*its a new order to be inserted */ - -//Do we need to check authorisation to create - no because already trapped when new PO session started /*Get the order number */ $_SESSION['PO'.$identifier]->OrderNo = GetNextTransNo(18, $db); @@ -284,7 +282,10 @@ $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); } } else if ($POLine->PODetailRec=='') { - + /*When the purchase order line is an existing record the auto-increment + * field PODetailRec is given to the session for that POLine + * So it will only be a new POLine if PODetailRec is empty + */ $sql = "INSERT INTO purchorderdetails ( orderno, itemcode, deliverydate, @@ -328,7 +329,7 @@ completed=1, assetid='" . $POLine->AssetID . "', conversionfactor = '" . $POLine->ConversionFactor . "' - WHERE podetailitem='" . $POLine->PODetailRec . "'"; + WHERE podetailitem='" . $POLine->PODetailRec . "'"; } else { $sql = "UPDATE purchorderdetails SET itemcode='" . $POLine->StockID . "', deliverydate ='" . FormatDateForSQL($POLine->ReqDelDate) . "', @@ -354,7 +355,7 @@ prnMsg(_('Purchase Order') . ' ' . $_SESSION['PO'.$identifier]->OrderNo . ' ' . _('has been updated'),'success'); if ($_SESSION['PO'.$identifier]->AllowPrintPO==1 AND ($_SESSION['PO'.$identifier]->Status=='Authorised' - OR $_SESSION['PO'.$identifier]->Status=='Printed')){ + OR $_SESSION['PO'.$identifier]->Status=='Printed')){ echo '<br /><a target="_blank" href="'.$rootpath.'/PO_PDFPurchOrder.php?OrderNo=' . $_SESSION['PO'.$identifier]->OrderNo . '">' . _('Print Purchase Order') . '</a>'; } } /*end of if its a new order or an existing one */ @@ -409,8 +410,8 @@ if ($_SESSION['PO'.$identifier]->GLLink==1){ $sql = "SELECT accountname - FROM chartmaster - WHERE accountcode ='" . (int) $_POST['GLCode'] . "'"; + FROM chartmaster + WHERE accountcode ='" . $_POST['GLCode'] . "'"; $ErrMsg = _('The account details for') . ' ' . $_POST['GLCode'] . ' ' . _('could not be retrieved because'); $DbgMsg = _('The SQL used to retrieve the details of the account, but failed was'); $GLValidResult = DB_query($sql,$db,$ErrMsg,$DbgMsg,false,false); @@ -438,10 +439,10 @@ $ValidAssetResult = DB_query("SELECT assetid, description, costact - FROM fixedassets - INNER JOIN fixedassetcategories - ON fixedassets.assetcategoryid=fixedassetcategories.categoryid - WHERE assetid='" . $_POST['AssetID'] . "'",$db); + FROM fixedassets + INNER JOIN fixedassetcategories + ON fixedassets.assetcategoryid=fixedassetcategories.categoryid + WHERE assetid='" . $_POST['AssetID'] . "'",$db); if (DB_num_rows($ValidAssetResult)==0){ // then the asset id entered doesn't exist $AllowUpdate = false; prnMsg(_('An asset code was entered but it does not yet exist. Only pre-existing asset ids can be entered when ordering a fixed asset'),'error'); @@ -494,9 +495,10 @@ if (isset($_POST['NewItem'])){ /* NewItem is set from the part selection list as the part code selected * take the form entries and enter the data from the form into the PurchOrder class variable - * A series of form variables of the format "Qty" with the ItemCode concatenated are created on the search for adding new - * items for each of these form variables need to parse out the items and look up the details to add them to the purchase - * order $_POST is of course the global array of all posted form variables */ + * A series of form variables of the format "NewQty" with the ItemCode concatenated are created on the search for adding new + * items for each of these form variables need to parse out the item code and look up the details to add them to the purchase + * order $_POST is of course the global array of all posted form variables + */ foreach ($_POST as $FormVariableName => $Quantity) { @@ -632,7 +634,7 @@ echo ' ' . _('Purchase Order') .' '. $_SESSION['PO'.$identifier]->OrderNo ; } echo '<br /><b>'._(' Order Summary') . '</b>'; - echo '<table cellpadding=2 colspan=7 class=selection>'; + echo '<table cellpadding="2" colspan="7" class="selection">'; echo '<tr> <th>' . _('Item Code') . '</th> <th>' . _('Description') . '</th> @@ -688,12 +690,15 @@ } $DisplayTotal = number_format($_SESSION['PO'.$identifier]->Total,$_SESSION['PO'.$identifier]->CurrDecimalPlaces); - echo '<tr><td colspan="10" class=number>' . _('TOTAL') . _(' excluding Tax') . '</td> - <td class=number><b>' . $DisplayTotal . '</b></td> + echo '<tr><td colspan="10" class="number">' . _('TOTAL') . _(' excluding Tax') . '</td> + <td class="number"><b>' . $DisplayTotal . '</b></td> </tr></table>'; - echo '<br /><div class="centre"><input type="submit" name="UpdateLines" value="Update Order Lines">'; + echo '<br /> + <div class="centre"> + <input type="submit" name="UpdateLines" value="Update Order Lines" />'; - echo ' <input type="submit" name="Commit" value="Process Order"></div>'; + echo ' <input type="submit" name="Commit" value="Process Order" /> + </div>'; } /*Only display the order line items if there are any !! */ @@ -716,7 +721,7 @@ } echo '</select></td></tr>'; echo '<tr><td>'._('OR Asset ID'). '</td> - <td><select name="AssetID">'; + <td><select name="AssetID">'; $AssetsResult = DB_query("SELECT assetid, description, datepurchased FROM fixedassets ORDER BY assetid DESC",$db); echo '<option selected value="Not an Asset">' . _('Not an Asset') . '</option>'; while ($AssetRow = DB_fetch_array($AssetsResult)){ @@ -738,7 +743,9 @@ <tr><td>'._('Delivery Date').'</td> <td><input type="text" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" name="ReqDelDate" size=11 value="'.$_SESSION['PO'.$identifier]->DeliveryDate .'"></td></tr>'; echo '</table>'; - echo '<div class=centre><input type=submit name="EnterLine" value="Enter Item"></div>'; + echo '<div class="centre"> + <input type=submit name="EnterLine" value="Enter Item" /> + </div>'; } /* Now show the stock item selection search stuff below */ @@ -752,8 +759,25 @@ $SearchString = '%' . str_replace(' ', '%', $_POST['Keywords']) . '%'; if ($_POST['StockCat']=='All'){ - - $sql = "SELECT stockmaster.stockid, + if ($_POST['SupplierItemsOnly']=='on'){ + $sql = "SELECT stockmaster.stockid, + stockmaster.description, + stockmaster.units + FROM stockmaster INNER JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid + INNER JOIN purchdata + ON stockmaster.stockid=purchdata.stockid + WHERE stockmaster.mbflag<>'D' + AND stockmaster.mbflag<>'K' + AND stockmaster.mbflag<>'G' + AND stockmaster.discontinued<>1 + AND purchdata.supplierno='" . $_SESSION['PO'.$identifier]->SupplierID . "' + AND stockmaster.description " . LIKE . " '" . $SearchString ."' + ORDER BY stockmaster.stockid + LIMIT " .$_SESSION['DefaultDisplayRecordsMax']; + } else { // not just supplier purchdata items + + $sql = "SELECT stockmaster.stockid, stockmaster.description, stockmaster.units FROM stockmaster INNER JOIN stockcategory @@ -765,28 +789,65 @@ AND stockmaster.description " . LIKE . " '" . $SearchString ."' ORDER BY stockmaster.stockid LIMIT " .$_SESSION['DefaultDisplayRecordsMax']; - } else { - $sql = "SELECT stockmaster.stockid, - stockmaster.description, - stockmaster.units - FROM stockmaster INNER JOIN stockcategory - ON stockmaster.categoryid=stockcategory.categoryid - WHERE stockmaster.mbflag<>'D' - AND stockmaster.mbflag<>'K' - AND stockmaster.mbflag<>'G' - AND stockmaster.discontinued<>1 - AND stockmaster.description " . LIKE . " '". $SearchString ."' - AND stockmaster.categoryid='" . $_POST['StockCat'] . "' - ORDER BY stockmaster.stockid - LIMIT ".$_SESSION['DefaultDisplayRecordsMax']; + } + } else { //for a specific stock category + if ($_POST['SupplierItemsOnly']=='on'){ + $sql = "SELECT stockmaster.stockid, + stockmaster.description, + stockmaster.units + FROM stockmaster INNER JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid + INNER JOIN purchdata + ON stockmaster.stockid=purchdata.stockid + WHERE stockmaster.mbflag<>'D' + AND stockmaster.mbflag<>'K' + AND stockmaster.mbflag<>'G' + AND purchdata.supplierno='" . $_SESSION['PO'.$identifier]->SupplierID . "' + AND stockmaster.discontinued<>1 + AND stockmaster.description " . LIKE . " '". $SearchString ."' + AND stockmaster.categoryid='" . $_POST['StockCat'] . "' + ORDER BY stockmaster.stockid + LIMIT ".$_SESSION['DefaultDisplayRecordsMax']; + } else { + $sql = "SELECT stockmaster.stockid, + stockmaster.description, + stockmaster.units + FROM stockmaster INNER JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid + WHERE stockmaster.mbflag<>'D' + AND stockmaster.mbflag<>'K' + AND stockmaster.mbflag<>'G' + AND stockmaster.discontinued<>1 + AND stockmaster.description " . LIKE . " '". $SearchString ."' + AND stockmaster.categoryid='" . $_POST['StockCat'] . "' + ORDER BY stockmaster.stockid + LIMIT ".$_SESSION['DefaultDisplayRecordsMax']; + } } } elseif ($_POST['StockCode']){ $_POST['StockCode'] = '%' . $_POST['StockCode'] . '%'; - + if ($_POST['StockCat']=='All'){ - $sql = "SELECT stockmaster.stockid, + if ($_POST['SupplierItemsOnly']=='on'){ + $sql = "SELECT stockmaster.stockid, + stockmaster.description, + stockmaster.units + FROM stockmaster INNER JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid + INNER JOIN purchdata + ON stockmaster.stockid=purchdata.stockid + WHERE stockmaster.mbflag<>'D' + AND stockmaster.mbflag<>'K' + AND stockmaster.mbflag<>'G' + AND purchdata.supplierno='" . $_SESSION['PO'.$identifier]->SupplierID . "' + AND stockmaster.discontinued<>1 + AND stockmaster.stockid " . LIKE . " '" . $_POST['StockCode'] . "' + ORDER BY stockmaster.stockid + LIMIT ".$_SESSION['DefaultDisplayRecordsMax']; + } else { + $sql = "SELECT stockmaster.stockid, stockmaster.description, stockmaster.units FROM stockmaster INNER JOIN stockcategory @@ -798,8 +859,27 @@ AND stockmaster.stockid " . LIKE . " '" . $_POST['StockCode'] . "' ORDER BY stockmaster.stockid LIMIT ".$_SESSION['DefaultDisplayRecordsMax']; - } else { - $sql = "SELECT stockmaster.stockid, + } + } else { //for a specific stock category and LIKE stock code + if ($_POST['SupplierItemsOnly']=='on'){ + $sql = "SELECT stockmaster.stockid, + stockmaster.description, + stockmaster.units + FROM stockmaster INNER JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid + INNER JOIN purchdata + ON stockmaster.stockid=purchdata.stockid + WHERE stockmaster.mbflag<>'D' + AND stockmaster.mbflag<>'K' + AND stockmaster.mbflag<>'G' + AND purchdata.supplierno='" . $_SESSION['PO'.$identifier]->SupplierID . "' + and stockmaster.discontinued<>1 + AND stockmaster.stockid " . LIKE . " '" . $_POST['StockCode'] . "' + AND stockmaster.categoryid='" . $_POST['StockCat'] . "' + ORDER BY stockmaster.stockid + LIMIT ".$_SESSION['DefaultDisplayRecordsMax']; + } else { + $sql = "SELECT stockmaster.stockid, stockmaster.description, stockmaster.units FROM stockmaster INNER JOIN stockcategory @@ -812,11 +892,28 @@ AND stockmaster.categoryid='" . $_POST['StockCat'] . "' ORDER BY stockmaster.stockid LIMIT ".$_SESSION['DefaultDisplayRecordsMax']; + } } } else { if ($_POST['StockCat']=='All'){ - $sql = "SELECT stockmaster.stockid, + if ($_POST['SupplierItemsOnly']=='on'){ + $sql = "SELECT stockmaster.stockid, + stockmaster.description, + stockmaster.units + FROM stockmaster INNER JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid + INNER JOIN purchdata + ON stockmaster.stockid=purchdata.stockid + WHERE stockmaster.mbflag<>'D' + AND stockmaster.mbflag<>'K' + AND stockmaster.mbflag<>'G' + AND purchdata.supplierno='" . $_SESSION['PO'.$identifier]->SupplierID . "' + AND stockmaster.discontinued<>1 + ORDER BY stockmaster.stockid + LIMIT " . $_SESSION['DefaultDisplayRecordsMax']; + } else { + $sql = "SELECT stockmaster.stockid, stockmaster.description, stockmaster.units FROM stockmaster INNER JOIN stockcategory @@ -827,8 +924,26 @@ AND stockmaster.discontinued<>1 ORDER BY stockmaster.stockid LIMIT " . $_SESSION['DefaultDisplayRecordsMax']; - } else { - $sql = "SELECT stockmaster.stockid, + } + } else { // for a specific stock category + if ($_POST['SupplierItemsOnly']=='on'){ + $sql = "SELECT stockmaster.stockid, + stockmaster.description, + stockmaster.units + FROM stockmaster INNER JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid + INNER JOIN purchdata + ON stockmaster.stockid=purchdata.stockid + WHERE stockmaster.mbflag<>'D' + AND stockmaster.mbflag<>'K' + AND stockmaster.mbflag<>'G' + AND purchdata.supplierno='" . $_SESSION['PO'.$identifier]->SupplierID . "' + AND stockmaster.discontinued<>1 + AND stockmaster.categoryid='" . $_POST['StockCat'] . "' + ORDER BY stockmaster.stockid + LIMIT " . $_SESSION['DefaultDisplayRecordsMax']; + } else { + $sql = "SELECT stockmaster.stockid, stockmaster.description, stockmaster.units FROM stockmaster INNER JOIN stockcategory @@ -840,6 +955,7 @@ AND stockmaster.categoryid='" . $_POST['StockCat'] . "' ORDER BY stockmaster.stockid LIMIT " . $_SESSION['DefaultDisplayRecordsMax']; + } } } @@ -870,13 +986,13 @@ $DbgMsg = _('The SQL used to retrieve the category details but failed was'); $result1 = DB_query($sql,$db,$ErrMsg,$DbgMsg); - echo '<table class=selection> + echo '<table class="selection"> <tr> <th colspan=3><font size=3 color=blue>'. _('Search For Stock Items') . '</th>'; echo ':</font> </tr> - <tr><td><select name="StockCat">'; + <tr><td>' . _('Item Category') . ': <select name="StockCat">'; echo '<option selected value="All">' . _('All') . '</option>'; @@ -902,7 +1018,11 @@ echo '</select></td> <td>' . _('Enter text extracts in the description') . ':</td> <td><input type="text" name="Keywords" size=20 maxlength=25 value="' . $_POST['Keywords'] . '"></td></tr> - <tr><td></td> + <tr><td>' . _('Only items defined as from this Supplier') . ' <input type="checkbox" name="SupplierItemsOnly" '; + if (isset($_POST['SupplierItemsOnly']) AND $_POST['SupplierItemsOnly']=='on'){ + echo 'checked'; + } + echo ' /></td> <td><font size=3><b>' . _('OR') . ' </b></font>' . _('Enter extract of the Stock Code') . ':</td> <td><input type="text" name="StockCode" size=15 maxlength=18 value="' . $_POST['StockCode'] . '"></td> </tr> Modified: trunk/PO_PDFPurchOrder.php =================================================================== --- trunk/PO_PDFPurchOrder.php 2011-08-04 10:18:14 UTC (rev 4649) +++ trunk/PO_PDFPurchOrder.php 2011-08-06 01:48:12 UTC (rev 4650) @@ -225,7 +225,9 @@ $POLine['itemdescription']=str_pad('',50,'x'); $POLine['unitprice']=9999.99; $POLine['units']=str_pad('',4,'x'); - $POLine['quantityord']=999.99; + $POLine['suppliersunit']=str_pad('',4,'x'); + $POLine['quantityord']=9999.99; + $POLine['conversionfactor']=1; $POLine['decimalplaces']=2; } $DisplayQty = number_format($POLine['quantityord']/$POLine['conversionfactor'],$POLine['decimalplaces']); @@ -275,8 +277,7 @@ /* If we are previewing we want to stop showing order * lines after the first one */ if ($OrderNo=='Preview') { -// unlink(sys_get_temp_dir().'/PurchaseOrder.xml'); - unset($OrderNo); + $OrderNo='Preview_PurchaseOrder'; } } //end while there are line items to print out if ($YPos-$line_height <= $Bottom_Margin){ // need to ensure space for totals @@ -308,7 +309,7 @@ $mail->setText( _('Please find herewith our purchase order number').' ' . $OrderNo); $mail->setSubject( _('Purchase Order Number').' ' . $OrderNo); $mail->addAttachment($attachment, $PdfFileName, 'application/pdf'); - $mail->setFrom($_SESSION['CompanyRecord']['coyname'] . "<" . $_SESSION['CompanyRecord']['email'] .">"); + $mail->setFrom($_SESSION['CompanyRecord']['coyname'] . '<' . $_SESSION['CompanyRecord']['email'] .'>'); $Success = $mail->send(array($_POST['EmailTo'])); if ($Success==1){ $title = _('Email a Purchase Order'); @@ -350,14 +351,14 @@ $_POST['PrintOrEmail'] = 'Print'; } if ($ViewingOnly!=0){ - echo '<option selected value="Print">'. _('Print'); + echo '<option selected value="Print">'. _('Print') . '</option>'; } else { if ($_POST['PrintOrEmail']=='Print'){ - echo '<option selected value="Print">'. _('Print'); - echo '<option value="Email">' . _('Email'); + echo '<option selected value="Print">'. _('Print') . '</option>'; + echo '<option value="Email">' . _('Email') . '</option>'; } else { - echo '<option value="Print">'. _('Print'); - echo '<option selected value="Email">'. _('Email'); + echo '<option value="Print">'. _('Print') . '</option>'; + echo '<option selected value="Email">'. _('Email') . '</option>'; } } echo '</select></td></tr>'; @@ -367,11 +368,11 @@ $_POST['ShowAmounts'] = 'Yes'; } if ($_POST['ShowAmounts']=='Yes'){ - echo '<option selected value="Yes">'. _('Yes'); - echo '<option value="No">' . _('No'); + echo '<option selected value="Yes">'. _('Yes') . '</option>'; + echo '<option value="No">' . _('No') . '</option>'; } else { - echo '<option value="Yes">'. _('Yes'); - echo '<option selected value="No">'. _('No'); + echo '<option value="Yes">'. _('Yes') . '</option>'; + echo '<option selected value="No">'. _('No') . '</option>'; } echo '</select></td></tr>'; if ($_POST['PrintOrEmail']=='Email'){ Modified: trunk/PaymentTerms.php =================================================================== --- trunk/PaymentTerms.php 2011-08-04 10:18:14 UTC (rev 4649) +++ trunk/PaymentTerms.php 2011-08-06 01:48:12 UTC (rev 4650) @@ -75,7 +75,7 @@ /*SelectedTerms could also exist if submit had not been clicked this code would not run in this case cos submit is false of course see the delete code below*/ - if (isset($_POST['DaysOrFoll']) and $_POST['DaysOrFoll']=='on') { + if (isset($_POST['DaysOrFoll']) AND $_POST['DaysOrFoll']=='on') { $sql = "UPDATE paymentterms SET terms='" . $_POST['Terms'] . "', dayinfollowingmonth=0, @@ -271,7 +271,7 @@ <tr> <td>'._('Due After A Given No. Of Days').':</td> <td><input type="checkbox" name="DaysOrFoll" '; - if ( isset($DayInFollowingMonth) && !$DayInFollowingMonth) { + if (isset($DayInFollowingMonth) AND !$DayInFollowingMonth) { echo 'checked'; } echo ' ></td> Modified: trunk/SelectProduct.php =================================================================== --- trunk/SelectProduct.php 2011-08-04 10:18:14 UTC (rev 4649) +++ trunk/SelectProduct.php 2011-08-06 01:48:12 UTC (rev 4650) @@ -376,7 +376,7 @@ echo '<td class="select">' . _('No') . '</td>'; } echo '<td class="select"><a href="' . $rootpath . '/PO_Header.php?NewOrder=Yes&SelectedSupplier=' . - $SuppRow['supplierid'] . '&StockID=' . $StockID . '&Quantity='.$SuppRow['minorderqty'].'">' . _('Order') . ' </a></td>'; + $SuppRow['supplierid'] . '&StockID=' . $StockID . '&Quantity='.$SuppRow['minorderqty'].'&LeadTime='.$SuppRow['leadtime'] . '">' . _('Order') . ' </a></td>'; echo '</tr>'; } echo '</table></td>'; Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2011-08-04 10:18:14 UTC (rev 4649) +++ trunk/doc/Change.log 2011-08-06 01:48:12 UTC (rev 4650) @@ -1,5 +1,7 @@ webERP Change Log +6/8/11 Phil: PO_Items.php now has checkbox to select items that have purchasing data entered for the supplier ordering from - as per Klaus's (opto) suggestion +6/8/11 Exson: Added leadtime to the link from SelectProduct.php so that delivery dates used when creating purchase orders make sense 4/8/11 Phil: Fix GP Percent reported when discounts updated by discount matrix 4/8/11 Phil: Make PO_SelectOSPurchOrder.php behave similarly to SelectPurchOrder.php (for inquiries) where the order number is the link that takes you to the order 4/8/11 Ricard: SalesInquiry.php now shows net sales after discounts This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-08-06 01:48:19
|
Revision: 4650 http://web-erp.svn.sourceforge.net/web-erp/?rev=4650&view=rev Author: daintree Date: 2011-08-06 01:48:12 +0000 (Sat, 06 Aug 2011) Log Message: ----------- various Modified Paths: -------------- trunk/PO_Header.php trunk/PO_Items.php trunk/PO_PDFPurchOrder.php trunk/PaymentTerms.php trunk/SelectProduct.php trunk/doc/Change.log Modified: trunk/PO_Header.php =================================================================== --- trunk/PO_Header.php 2011-08-04 10:18:14 UTC (rev 4649) +++ trunk/PO_Header.php 2011-08-06 01:48:12 UTC (rev 4650) @@ -157,7 +157,9 @@ } /*New order initiated by user clicking on supplier purchasing data from items page */ -if (isset($_GET['NewOrder']) AND isset($_GET['StockID']) AND isset($_GET['SelectedSupplier'])) { +if (isset($_GET['NewOrder']) + AND isset($_GET['StockID']) + AND isset($_GET['SelectedSupplier'])) { /* * initialise a new order */ @@ -173,10 +175,10 @@ /* set the SupplierID we got */ $_SESSION['PO'.$identifier]->SupplierID = $_GET['SelectedSupplier']; $_SESSION['PO'.$identifier]->DeliveryDate = DateAdd(date($_SESSION['DefaultDateFormat']), 'd', $_GET['LeadTime']); + $_SESSION['RequireSupplierSelection'] = 0; $_POST['Select'] = $_GET['SelectedSupplier']; - /* * the item (it's item code) that should be purchased */ @@ -210,7 +212,9 @@ $_SESSION['PO'.$identifier]->ExRate = $_POST['ExRate']; $_SESSION['PO'.$identifier]->Comments = $_POST['Comments']; $_SESSION['PO'.$identifier]->DeliveryBy = $_POST['DeliveryBy']; - $_SESSION['PO'.$identifier]->StatusMessage = $_POST['StatusComments']; + if (isset($_POST['StatusComments'])){ + $_SESSION['PO'.$identifier]->StatusComments = $_POST['StatusComments']; + } $_SESSION['PO'.$identifier]->PaymentTerms = $_POST['PaymentTerms']; $_SESSION['PO'.$identifier]->Contact = $_POST['Contact']; $_SESSION['PO'.$identifier]->Tel = $_POST['Tel']; @@ -519,25 +523,29 @@ _('Purchase Order') . '" alt="">' . ' ' . _('Purchase Order: Select Supplier') . ''; echo '<form action="' . $_SERVER['PHP_SELF'] . '?identifier=' . $identifier . '" method="post" name="choosesupplier">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<input type="hidden" name="SuppliersReturned" value="' . $SuppliersReturned .'" />'; + if (isset($SuppliersReturned)){ + echo '<input type="hidden" name="SuppliersReturned" value="' . $SuppliersReturned .'" />'; + } - echo '<table cellpadding=3 colspan=4 class=selection> + echo '<table cellpadding="3" colspan="4" class="selection"> <tr> <td><font size=1>' . _('Enter text in the supplier name') . ':</font></td> - <td><input type="Text" name="Keywords" size="20" maxlength="25"></td> + <td><input type="text" name="Keywords" size="20" maxlength="25" /></td> <td><font size=3><b>' . _('OR') . '</b></font></td> <td><font size=1>' . _('Enter text extract in the supplier code') . ':</font></td> - <td><input type="text" name="SuppCode" size="15" maxlength="18"></td> + <td><input type="text" name="SuppCode" size="15" maxlength="18" /></td> </tr> - </table><br /><div class="centre"> - <input type="submit" name="SearchSuppliers" value="' . _('Search Now') . '"> - <input type="submit" action="reset" value="' . _('Reset') . '"></div>'; + </table> + <br /> + <div class="centre"> + <input type="submit" name="SearchSuppliers" value="' . _('Search Now') . '" /> + <input type="submit" action="reset" value="' . _('Reset') . '" /></div>'; echo '<script type="text/javascript">defaultControl(document.forms[0].Keywords);</script>'; if (isset($result_SuppSelect)) { - echo '<br /><table cellpadding=3 colspan=7 class=selection>'; + echo '<br /><table cellpadding="3" colspan="7" class="selection">'; $tableheader = '<tr> <th>' . _('Code') . '</th> @@ -606,7 +614,11 @@ /* the link */ echo '<li><a href="'.$rootpath.'/PO_Items.php?NewItem=' . $Purch_Item . '&identifier=' . $identifier . '">' . _('Enter Line Item to this purchase order') . '</a></li>'; - echo '</td></tr></table></div><br />'; + echo '</td> + </tr> + </table> + </div> + <br />'; if (isset($_GET['Quantity'])) { $Qty=$_GET['Quantity']; Modified: trunk/PO_Items.php =================================================================== --- trunk/PO_Items.php 2011-08-04 10:18:14 UTC (rev 4649) +++ trunk/PO_Items.php 2011-08-06 01:48:12 UTC (rev 4650) @@ -93,7 +93,7 @@ $AuthRow=DB_fetch_array($AuthResult); if (DB_num_rows($AuthResult) > 0 AND $AuthRow['authlevel'] > $_SESSION['PO'.$identifier]->Order_Value()) { //user has authority to authrorise as well as create the order - $StatusComment=date($_SESSION['DefaultDateFormat']).' - ' . _('Order Created and Authorised by') . $UserDetails . ' - '.$_SESSION['PO'.$identifier]->StatusMessage.'<br />'; + $StatusComment=date($_SESSION['DefaultDateFormat']).' - ' . _('Order Created and Authorised by') . $UserDetails . '<br />'.$_SESSION['PO'.$identifier]->StatusComments.'<br />'; $_SESSION['PO'.$identifier]->AllowPrintPO=1; $_SESSION['PO'.$identifier]->Status = 'Authorised'; } else { // no authority to authorise this order @@ -110,18 +110,16 @@ _('The order will be created with a status of pending and will require authorisation'), 'warn'); $_SESSION['PO'.$identifier]->AllowPrintPO=0; - $StatusComment=date($_SESSION['DefaultDateFormat']).' - ' . _('Order Created by') . $UserDetails . ' - '.$_SESSION['PO'.$identifier]->StatusMessage.'<br />'; + $StatusComment=date($_SESSION['DefaultDateFormat']).' - ' . _('Order Created by') . $UserDetails . '<br />'.$_SESSION['PO'.$identifier]->StatusComments.'<br />'; $_SESSION['PO'.$identifier]->Status = 'Pending'; } } else { //auto authorise is set to off $_SESSION['PO'.$identifier]->AllowPrintPO=0; - $StatusComment=date($_SESSION['DefaultDateFormat']).' - ' . _('Order Created by') . $UserDetails . ' - '.$_SESSION['PO'.$identifier]->StatusMessage.'<br />'; + $StatusComment=date($_SESSION['DefaultDateFormat']).' - ' . _('Order Created by') . $UserDetails . ' - '.$_SESSION['PO'.$identifier]->StatusComments.'<br />'; $_SESSION['PO'.$identifier]->Status = 'Pending'; } if ($_SESSION['ExistingOrder']==0){ /*its a new order to be inserted */ - -//Do we need to check authorisation to create - no because already trapped when new PO session started /*Get the order number */ $_SESSION['PO'.$identifier]->OrderNo = GetNextTransNo(18, $db); @@ -284,7 +282,10 @@ $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); } } else if ($POLine->PODetailRec=='') { - + /*When the purchase order line is an existing record the auto-increment + * field PODetailRec is given to the session for that POLine + * So it will only be a new POLine if PODetailRec is empty + */ $sql = "INSERT INTO purchorderdetails ( orderno, itemcode, deliverydate, @@ -328,7 +329,7 @@ completed=1, assetid='" . $POLine->AssetID . "', conversionfactor = '" . $POLine->ConversionFactor . "' - WHERE podetailitem='" . $POLine->PODetailRec . "'"; + WHERE podetailitem='" . $POLine->PODetailRec . "'"; } else { $sql = "UPDATE purchorderdetails SET itemcode='" . $POLine->StockID . "', deliverydate ='" . FormatDateForSQL($POLine->ReqDelDate) . "', @@ -354,7 +355,7 @@ prnMsg(_('Purchase Order') . ' ' . $_SESSION['PO'.$identifier]->OrderNo . ' ' . _('has been updated'),'success'); if ($_SESSION['PO'.$identifier]->AllowPrintPO==1 AND ($_SESSION['PO'.$identifier]->Status=='Authorised' - OR $_SESSION['PO'.$identifier]->Status=='Printed')){ + OR $_SESSION['PO'.$identifier]->Status=='Printed')){ echo '<br /><a target="_blank" href="'.$rootpath.'/PO_PDFPurchOrder.php?OrderNo=' . $_SESSION['PO'.$identifier]->OrderNo . '">' . _('Print Purchase Order') . '</a>'; } } /*end of if its a new order or an existing one */ @@ -409,8 +410,8 @@ if ($_SESSION['PO'.$identifier]->GLLink==1){ $sql = "SELECT accountname - FROM chartmaster - WHERE accountcode ='" . (int) $_POST['GLCode'] . "'"; + FROM chartmaster + WHERE accountcode ='" . $_POST['GLCode'] . "'"; $ErrMsg = _('The account details for') . ' ' . $_POST['GLCode'] . ' ' . _('could not be retrieved because'); $DbgMsg = _('The SQL used to retrieve the details of the account, but failed was'); $GLValidResult = DB_query($sql,$db,$ErrMsg,$DbgMsg,false,false); @@ -438,10 +439,10 @@ $ValidAssetResult = DB_query("SELECT assetid, description, costact - FROM fixedassets - INNER JOIN fixedassetcategories - ON fixedassets.assetcategoryid=fixedassetcategories.categoryid - WHERE assetid='" . $_POST['AssetID'] . "'",$db); + FROM fixedassets + INNER JOIN fixedassetcategories + ON fixedassets.assetcategoryid=fixedassetcategories.categoryid + WHERE assetid='" . $_POST['AssetID'] . "'",$db); if (DB_num_rows($ValidAssetResult)==0){ // then the asset id entered doesn't exist $AllowUpdate = false; prnMsg(_('An asset code was entered but it does not yet exist. Only pre-existing asset ids can be entered when ordering a fixed asset'),'error'); @@ -494,9 +495,10 @@ if (isset($_POST['NewItem'])){ /* NewItem is set from the part selection list as the part code selected * take the form entries and enter the data from the form into the PurchOrder class variable - * A series of form variables of the format "Qty" with the ItemCode concatenated are created on the search for adding new - * items for each of these form variables need to parse out the items and look up the details to add them to the purchase - * order $_POST is of course the global array of all posted form variables */ + * A series of form variables of the format "NewQty" with the ItemCode concatenated are created on the search for adding new + * items for each of these form variables need to parse out the item code and look up the details to add them to the purchase + * order $_POST is of course the global array of all posted form variables + */ foreach ($_POST as $FormVariableName => $Quantity) { @@ -632,7 +634,7 @@ echo ' ' . _('Purchase Order') .' '. $_SESSION['PO'.$identifier]->OrderNo ; } echo '<br /><b>'._(' Order Summary') . '</b>'; - echo '<table cellpadding=2 colspan=7 class=selection>'; + echo '<table cellpadding="2" colspan="7" class="selection">'; echo '<tr> <th>' . _('Item Code') . '</th> <th>' . _('Description') . '</th> @@ -688,12 +690,15 @@ } $DisplayTotal = number_format($_SESSION['PO'.$identifier]->Total,$_SESSION['PO'.$identifier]->CurrDecimalPlaces); - echo '<tr><td colspan="10" class=number>' . _('TOTAL') . _(' excluding Tax') . '</td> - <td class=number><b>' . $DisplayTotal . '</b></td> + echo '<tr><td colspan="10" class="number">' . _('TOTAL') . _(' excluding Tax') . '</td> + <td class="number"><b>' . $DisplayTotal . '</b></td> </tr></table>'; - echo '<br /><div class="centre"><input type="submit" name="UpdateLines" value="Update Order Lines">'; + echo '<br /> + <div class="centre"> + <input type="submit" name="UpdateLines" value="Update Order Lines" />'; - echo ' <input type="submit" name="Commit" value="Process Order"></div>'; + echo ' <input type="submit" name="Commit" value="Process Order" /> + </div>'; } /*Only display the order line items if there are any !! */ @@ -716,7 +721,7 @@ } echo '</select></td></tr>'; echo '<tr><td>'._('OR Asset ID'). '</td> - <td><select name="AssetID">'; + <td><select name="AssetID">'; $AssetsResult = DB_query("SELECT assetid, description, datepurchased FROM fixedassets ORDER BY assetid DESC",$db); echo '<option selected value="Not an Asset">' . _('Not an Asset') . '</option>'; while ($AssetRow = DB_fetch_array($AssetsResult)){ @@ -738,7 +743,9 @@ <tr><td>'._('Delivery Date').'</td> <td><input type="text" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" name="ReqDelDate" size=11 value="'.$_SESSION['PO'.$identifier]->DeliveryDate .'"></td></tr>'; echo '</table>'; - echo '<div class=centre><input type=submit name="EnterLine" value="Enter Item"></div>'; + echo '<div class="centre"> + <input type=submit name="EnterLine" value="Enter Item" /> + </div>'; } /* Now show the stock item selection search stuff below */ @@ -752,8 +759,25 @@ $SearchString = '%' . str_replace(' ', '%', $_POST['Keywords']) . '%'; if ($_POST['StockCat']=='All'){ - - $sql = "SELECT stockmaster.stockid, + if ($_POST['SupplierItemsOnly']=='on'){ + $sql = "SELECT stockmaster.stockid, + stockmaster.description, + stockmaster.units + FROM stockmaster INNER JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid + INNER JOIN purchdata + ON stockmaster.stockid=purchdata.stockid + WHERE stockmaster.mbflag<>'D' + AND stockmaster.mbflag<>'K' + AND stockmaster.mbflag<>'G' + AND stockmaster.discontinued<>1 + AND purchdata.supplierno='" . $_SESSION['PO'.$identifier]->SupplierID . "' + AND stockmaster.description " . LIKE . " '" . $SearchString ."' + ORDER BY stockmaster.stockid + LIMIT " .$_SESSION['DefaultDisplayRecordsMax']; + } else { // not just supplier purchdata items + + $sql = "SELECT stockmaster.stockid, stockmaster.description, stockmaster.units FROM stockmaster INNER JOIN stockcategory @@ -765,28 +789,65 @@ AND stockmaster.description " . LIKE . " '" . $SearchString ."' ORDER BY stockmaster.stockid LIMIT " .$_SESSION['DefaultDisplayRecordsMax']; - } else { - $sql = "SELECT stockmaster.stockid, - stockmaster.description, - stockmaster.units - FROM stockmaster INNER JOIN stockcategory - ON stockmaster.categoryid=stockcategory.categoryid - WHERE stockmaster.mbflag<>'D' - AND stockmaster.mbflag<>'K' - AND stockmaster.mbflag<>'G' - AND stockmaster.discontinued<>1 - AND stockmaster.description " . LIKE . " '". $SearchString ."' - AND stockmaster.categoryid='" . $_POST['StockCat'] . "' - ORDER BY stockmaster.stockid - LIMIT ".$_SESSION['DefaultDisplayRecordsMax']; + } + } else { //for a specific stock category + if ($_POST['SupplierItemsOnly']=='on'){ + $sql = "SELECT stockmaster.stockid, + stockmaster.description, + stockmaster.units + FROM stockmaster INNER JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid + INNER JOIN purchdata + ON stockmaster.stockid=purchdata.stockid + WHERE stockmaster.mbflag<>'D' + AND stockmaster.mbflag<>'K' + AND stockmaster.mbflag<>'G' + AND purchdata.supplierno='" . $_SESSION['PO'.$identifier]->SupplierID . "' + AND stockmaster.discontinued<>1 + AND stockmaster.description " . LIKE . " '". $SearchString ."' + AND stockmaster.categoryid='" . $_POST['StockCat'] . "' + ORDER BY stockmaster.stockid + LIMIT ".$_SESSION['DefaultDisplayRecordsMax']; + } else { + $sql = "SELECT stockmaster.stockid, + stockmaster.description, + stockmaster.units + FROM stockmaster INNER JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid + WHERE stockmaster.mbflag<>'D' + AND stockmaster.mbflag<>'K' + AND stockmaster.mbflag<>'G' + AND stockmaster.discontinued<>1 + AND stockmaster.description " . LIKE . " '". $SearchString ."' + AND stockmaster.categoryid='" . $_POST['StockCat'] . "' + ORDER BY stockmaster.stockid + LIMIT ".$_SESSION['DefaultDisplayRecordsMax']; + } } } elseif ($_POST['StockCode']){ $_POST['StockCode'] = '%' . $_POST['StockCode'] . '%'; - + if ($_POST['StockCat']=='All'){ - $sql = "SELECT stockmaster.stockid, + if ($_POST['SupplierItemsOnly']=='on'){ + $sql = "SELECT stockmaster.stockid, + stockmaster.description, + stockmaster.units + FROM stockmaster INNER JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid + INNER JOIN purchdata + ON stockmaster.stockid=purchdata.stockid + WHERE stockmaster.mbflag<>'D' + AND stockmaster.mbflag<>'K' + AND stockmaster.mbflag<>'G' + AND purchdata.supplierno='" . $_SESSION['PO'.$identifier]->SupplierID . "' + AND stockmaster.discontinued<>1 + AND stockmaster.stockid " . LIKE . " '" . $_POST['StockCode'] . "' + ORDER BY stockmaster.stockid + LIMIT ".$_SESSION['DefaultDisplayRecordsMax']; + } else { + $sql = "SELECT stockmaster.stockid, stockmaster.description, stockmaster.units FROM stockmaster INNER JOIN stockcategory @@ -798,8 +859,27 @@ AND stockmaster.stockid " . LIKE . " '" . $_POST['StockCode'] . "' ORDER BY stockmaster.stockid LIMIT ".$_SESSION['DefaultDisplayRecordsMax']; - } else { - $sql = "SELECT stockmaster.stockid, + } + } else { //for a specific stock category and LIKE stock code + if ($_POST['SupplierItemsOnly']=='on'){ + $sql = "SELECT stockmaster.stockid, + stockmaster.description, + stockmaster.units + FROM stockmaster INNER JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid + INNER JOIN purchdata + ON stockmaster.stockid=purchdata.stockid + WHERE stockmaster.mbflag<>'D' + AND stockmaster.mbflag<>'K' + AND stockmaster.mbflag<>'G' + AND purchdata.supplierno='" . $_SESSION['PO'.$identifier]->SupplierID . "' + and stockmaster.discontinued<>1 + AND stockmaster.stockid " . LIKE . " '" . $_POST['StockCode'] . "' + AND stockmaster.categoryid='" . $_POST['StockCat'] . "' + ORDER BY stockmaster.stockid + LIMIT ".$_SESSION['DefaultDisplayRecordsMax']; + } else { + $sql = "SELECT stockmaster.stockid, stockmaster.description, stockmaster.units FROM stockmaster INNER JOIN stockcategory @@ -812,11 +892,28 @@ AND stockmaster.categoryid='" . $_POST['StockCat'] . "' ORDER BY stockmaster.stockid LIMIT ".$_SESSION['DefaultDisplayRecordsMax']; + } } } else { if ($_POST['StockCat']=='All'){ - $sql = "SELECT stockmaster.stockid, + if ($_POST['SupplierItemsOnly']=='on'){ + $sql = "SELECT stockmaster.stockid, + stockmaster.description, + stockmaster.units + FROM stockmaster INNER JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid + INNER JOIN purchdata + ON stockmaster.stockid=purchdata.stockid + WHERE stockmaster.mbflag<>'D' + AND stockmaster.mbflag<>'K' + AND stockmaster.mbflag<>'G' + AND purchdata.supplierno='" . $_SESSION['PO'.$identifier]->SupplierID . "' + AND stockmaster.discontinued<>1 + ORDER BY stockmaster.stockid + LIMIT " . $_SESSION['DefaultDisplayRecordsMax']; + } else { + $sql = "SELECT stockmaster.stockid, stockmaster.description, stockmaster.units FROM stockmaster INNER JOIN stockcategory @@ -827,8 +924,26 @@ AND stockmaster.discontinued<>1 ORDER BY stockmaster.stockid LIMIT " . $_SESSION['DefaultDisplayRecordsMax']; - } else { - $sql = "SELECT stockmaster.stockid, + } + } else { // for a specific stock category + if ($_POST['SupplierItemsOnly']=='on'){ + $sql = "SELECT stockmaster.stockid, + stockmaster.description, + stockmaster.units + FROM stockmaster INNER JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid + INNER JOIN purchdata + ON stockmaster.stockid=purchdata.stockid + WHERE stockmaster.mbflag<>'D' + AND stockmaster.mbflag<>'K' + AND stockmaster.mbflag<>'G' + AND purchdata.supplierno='" . $_SESSION['PO'.$identifier]->SupplierID . "' + AND stockmaster.discontinued<>1 + AND stockmaster.categoryid='" . $_POST['StockCat'] . "' + ORDER BY stockmaster.stockid + LIMIT " . $_SESSION['DefaultDisplayRecordsMax']; + } else { + $sql = "SELECT stockmaster.stockid, stockmaster.description, stockmaster.units FROM stockmaster INNER JOIN stockcategory @@ -840,6 +955,7 @@ AND stockmaster.categoryid='" . $_POST['StockCat'] . "' ORDER BY stockmaster.stockid LIMIT " . $_SESSION['DefaultDisplayRecordsMax']; + } } } @@ -870,13 +986,13 @@ $DbgMsg = _('The SQL used to retrieve the category details but failed was'); $result1 = DB_query($sql,$db,$ErrMsg,$DbgMsg); - echo '<table class=selection> + echo '<table class="selection"> <tr> <th colspan=3><font size=3 color=blue>'. _('Search For Stock Items') . '</th>'; echo ':</font> </tr> - <tr><td><select name="StockCat">'; + <tr><td>' . _('Item Category') . ': <select name="StockCat">'; echo '<option selected value="All">' . _('All') . '</option>'; @@ -902,7 +1018,11 @@ echo '</select></td> <td>' . _('Enter text extracts in the description') . ':</td> <td><input type="text" name="Keywords" size=20 maxlength=25 value="' . $_POST['Keywords'] . '"></td></tr> - <tr><td></td> + <tr><td>' . _('Only items defined as from this Supplier') . ' <input type="checkbox" name="SupplierItemsOnly" '; + if (isset($_POST['SupplierItemsOnly']) AND $_POST['SupplierItemsOnly']=='on'){ + echo 'checked'; + } + echo ' /></td> <td><font size=3><b>' . _('OR') . ' </b></font>' . _('Enter extract of the Stock Code') . ':</td> <td><input type="text" name="StockCode" size=15 maxlength=18 value="' . $_POST['StockCode'] . '"></td> </tr> Modified: trunk/PO_PDFPurchOrder.php =================================================================== --- trunk/PO_PDFPurchOrder.php 2011-08-04 10:18:14 UTC (rev 4649) +++ trunk/PO_PDFPurchOrder.php 2011-08-06 01:48:12 UTC (rev 4650) @@ -225,7 +225,9 @@ $POLine['itemdescription']=str_pad('',50,'x'); $POLine['unitprice']=9999.99; $POLine['units']=str_pad('',4,'x'); - $POLine['quantityord']=999.99; + $POLine['suppliersunit']=str_pad('',4,'x'); + $POLine['quantityord']=9999.99; + $POLine['conversionfactor']=1; $POLine['decimalplaces']=2; } $DisplayQty = number_format($POLine['quantityord']/$POLine['conversionfactor'],$POLine['decimalplaces']); @@ -275,8 +277,7 @@ /* If we are previewing we want to stop showing order * lines after the first one */ if ($OrderNo=='Preview') { -// unlink(sys_get_temp_dir().'/PurchaseOrder.xml'); - unset($OrderNo); + $OrderNo='Preview_PurchaseOrder'; } } //end while there are line items to print out if ($YPos-$line_height <= $Bottom_Margin){ // need to ensure space for totals @@ -308,7 +309,7 @@ $mail->setText( _('Please find herewith our purchase order number').' ' . $OrderNo); $mail->setSubject( _('Purchase Order Number').' ' . $OrderNo); $mail->addAttachment($attachment, $PdfFileName, 'application/pdf'); - $mail->setFrom($_SESSION['CompanyRecord']['coyname'] . "<" . $_SESSION['CompanyRecord']['email'] .">"); + $mail->setFrom($_SESSION['CompanyRecord']['coyname'] . '<' . $_SESSION['CompanyRecord']['email'] .'>'); $Success = $mail->send(array($_POST['EmailTo'])); if ($Success==1){ $title = _('Email a Purchase Order'); @@ -350,14 +351,14 @@ $_POST['PrintOrEmail'] = 'Print'; } if ($ViewingOnly!=0){ - echo '<option selected value="Print">'. _('Print'); + echo '<option selected value="Print">'. _('Print') . '</option>'; } else { if ($_POST['PrintOrEmail']=='Print'){ - echo '<option selected value="Print">'. _('Print'); - echo '<option value="Email">' . _('Email'); + echo '<option selected value="Print">'. _('Print') . '</option>'; + echo '<option value="Email">' . _('Email') . '</option>'; } else { - echo '<option value="Print">'. _('Print'); - echo '<option selected value="Email">'. _('Email'); + echo '<option value="Print">'. _('Print') . '</option>'; + echo '<option selected value="Email">'. _('Email') . '</option>'; } } echo '</select></td></tr>'; @@ -367,11 +368,11 @@ $_POST['ShowAmounts'] = 'Yes'; } if ($_POST['ShowAmounts']=='Yes'){ - echo '<option selected value="Yes">'. _('Yes'); - echo '<option value="No">' . _('No'); + echo '<option selected value="Yes">'. _('Yes') . '</option>'; + echo '<option value="No">' . _('No') . '</option>'; } else { - echo '<option value="Yes">'. _('Yes'); - echo '<option selected value="No">'. _('No'); + echo '<option value="Yes">'. _('Yes') . '</option>'; + echo '<option selected value="No">'. _('No') . '</option>'; } echo '</select></td></tr>'; if ($_POST['PrintOrEmail']=='Email'){ Modified: trunk/PaymentTerms.php =================================================================== --- trunk/PaymentTerms.php 2011-08-04 10:18:14 UTC (rev 4649) +++ trunk/PaymentTerms.php 2011-08-06 01:48:12 UTC (rev 4650) @@ -75,7 +75,7 @@ /*SelectedTerms could also exist if submit had not been clicked this code would not run in this case cos submit is false of course see the delete code below*/ - if (isset($_POST['DaysOrFoll']) and $_POST['DaysOrFoll']=='on') { + if (isset($_POST['DaysOrFoll']) AND $_POST['DaysOrFoll']=='on') { $sql = "UPDATE paymentterms SET terms='" . $_POST['Terms'] . "', dayinfollowingmonth=0, @@ -271,7 +271,7 @@ <tr> <td>'._('Due After A Given No. Of Days').':</td> <td><input type="checkbox" name="DaysOrFoll" '; - if ( isset($DayInFollowingMonth) && !$DayInFollowingMonth) { + if (isset($DayInFollowingMonth) AND !$DayInFollowingMonth) { echo 'checked'; } echo ' ></td> Modified: trunk/SelectProduct.php =================================================================== --- trunk/SelectProduct.php 2011-08-04 10:18:14 UTC (rev 4649) +++ trunk/SelectProduct.php 2011-08-06 01:48:12 UTC (rev 4650) @@ -376,7 +376,7 @@ echo '<td class="select">' . _('No') . '</td>'; } echo '<td class="select"><a href="' . $rootpath . '/PO_Header.php?NewOrder=Yes&SelectedSupplier=' . - $SuppRow['supplierid'] . '&StockID=' . $StockID . '&Quantity='.$SuppRow['minorderqty'].'">' . _('Order') . ' </a></td>'; + $SuppRow['supplierid'] . '&StockID=' . $StockID . '&Quantity='.$SuppRow['minorderqty'].'&LeadTime='.$SuppRow['leadtime'] . '">' . _('Order') . ' </a></td>'; echo '</tr>'; } echo '</table></td>'; Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2011-08-04 10:18:14 UTC (rev 4649) +++ trunk/doc/Change.log 2011-08-06 01:48:12 UTC (rev 4650) @@ -1,5 +1,7 @@ webERP Change Log +6/8/11 Phil: PO_Items.php now has checkbox to select items that have purchasing data entered for the supplier ordering from - as per Klaus's (opto) suggestion +6/8/11 Exson: Added leadtime to the link from SelectProduct.php so that delivery dates used when creating purchase orders make sense 4/8/11 Phil: Fix GP Percent reported when discounts updated by discount matrix 4/8/11 Phil: Make PO_SelectOSPurchOrder.php behave similarly to SelectPurchOrder.php (for inquiries) where the order number is the link that takes you to the order 4/8/11 Ricard: SalesInquiry.php now shows net sales after discounts This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |