From: <dai...@us...> - 2013-06-21 22:48:15
|
Revision: 6031 http://sourceforge.net/p/web-erp/reponame/6031 Author: daintree Date: 2013-06-21 22:48:11 +0000 (Fri, 21 Jun 2013) Log Message: ----------- 21/6/13 Phil: ContractCosting.php fix references to contract issues object which should just have been an array. 18/6/13 Phil: Reworked the display of stock category properties on the SelectProduct.php inquiry 18/6/13 Tim: Z_ImportGLTransactions.php new script for importing GL payments, receipts or journals from a CSV file 17/6/13 Paul Harness: Fix sql query of goods received when a serial number is already present. GoodsReceived.php Modified Paths: -------------- trunk/ContractCosting.php trunk/Contracts.php trunk/SelectProduct.php trunk/Z_poRebuildDefault.php trunk/doc/Change.log trunk/includes/MainMenuLinksArray.php trunk/sql/mysql/upgrade4.10-4.11.sql Modified: trunk/ContractCosting.php =================================================================== --- trunk/ContractCosting.php 2013-06-18 07:17:20 UTC (rev 6030) +++ trunk/ContractCosting.php 2013-06-21 22:48:11 UTC (rev 6031) @@ -44,13 +44,13 @@ $InventoryIssuesResult = DB_query($sql,$db,$ErrMsg); $InventoryIssues = array(); while ($InventoryIssuesRow = DB_fetch_array($InventoryIssuesResult)){ - $InventoryIssues[$InventoryIssuesRow['stockid']]->StockID = $InventoryIssuesRow['stockid']; - $InventoryIssues[$InventoryIssuesRow['stockid']]->Description = $InventoryIssuesRow['description']; - $InventoryIssues[$InventoryIssuesRow['stockid']]->Quantity = $InventoryIssuesRow['quantity']; - $InventoryIssues[$InventoryIssuesRow['stockid']]->TotalCost = $InventoryIssuesRow['totalcost']; - $InventoryIssues[$InventoryIssuesRow['stockid']]->Units = $InventoryIssuesRow['units']; - $InventoryIssues[$InventoryIssuesRow['stockid']]->DecimalPlaces = $InventoryIssuesRow['decimalplaces']; - $InventoryIssues[$InventoryIssuesRow['stockid']]->Matched = 0; + $InventoryIssues[$InventoryIssuesRow['stockid']]['StockID'] = $InventoryIssuesRow['stockid']; + $InventoryIssues[$InventoryIssuesRow['stockid']]['Description'] = $InventoryIssuesRow['description']; + $InventoryIssues[$InventoryIssuesRow['stockid']]['Quantity'] = $InventoryIssuesRow['quantity']; + $InventoryIssues[$InventoryIssuesRow['stockid']]['TotalCost'] = $InventoryIssuesRow['totalcost']; + $InventoryIssues[$InventoryIssuesRow['stockid']]['Units'] = $InventoryIssuesRow['units']; + $InventoryIssues[$InventoryIssuesRow['stockid']]['DecimalPlaces'] = $InventoryIssuesRow['decimalplaces']; + $InventoryIssues[$InventoryIssuesRow['stockid']]['Matched'] = 0; } @@ -104,12 +104,12 @@ $ContractBOMBudget += ($Component->ItemCost * $Component->Quantity); if (isset($InventoryIssues[$Component->StockID])){ - $InventoryIssues[$Component->StockID]->Matched=1; + $InventoryIssues[$Component->StockID]['Matched']=1; echo '<td colspan="2" align="center">' . _('Actual usage') . '</td> - <td class="number">' . locale_number_format(-$InventoryIssues[$Component->StockID]->Quantity,$Component->DecimalPlaces) . '</td> - <td>' . $InventoryIssues[$Component->StockID]->Units . '</td> - <td class="number">' . locale_number_format($InventoryIssues[$Component->StockID]->TotalCost/$InventoryIssues[$Component->StockID]->Quantity,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> - <td>' . locale_number_format(-$InventoryIssues[$Component->StockID]->TotalCost,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_number_format(-$InventoryIssues[$Component->StockID]['Quantity'],$Component->DecimalPlaces) . '</td> + <td>' . $InventoryIssues[$Component->StockID]['Units'] . '</td> + <td class="number">' . locale_number_format($InventoryIssues[$Component->StockID]['TotalCost']/$InventoryIssues[$Component->StockID]['Quantity'],$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td>' . locale_number_format(-$InventoryIssues[$Component->StockID]['TotalCost'],$_SESSION['CompanyRecord']['decimalplaces']) . '</td> </tr>'; } else { echo '<td colspan="6"></td> @@ -118,18 +118,18 @@ } foreach ($InventoryIssues as $Component) { //actual inventory components used - $ContractBOMActual -=$Component->TotalCost; - if ($Component->Matched == 0) { //then its a component that wasn't budget for + $ContractBOMActual -=$Component['TotalCost']; + if ($Component['Matched'] == 0) { //then its a component that wasn't budget for echo '<tr> <td colspan="6"></td> - <td>' . $Component->StockID . '</td> - <td>' . $Component->Description . '</td> - <td class="number">' . locale_number_format(-$Component->Quantity,$Component->DecimalPlaces) . '</td> - <td>' . $Component->Units . '</td> - <td class="number">' . locale_number_format($Component->TotalCost/$Component->Quantity,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> - <td class="number">' . locale_number_format(-$Component->TotalCost,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td>' . $Component['StockID'] . '</td> + <td>' . $Component['Description'] . '</td> + <td class="number">' . locale_number_format(-$Component['Quantity'],$Component['DecimalPlaces']) . '</td> + <td>' . $Component['Units'] . '</td> + <td class="number">' . locale_number_format($Component['TotalCost']/$Component['Quantity'],$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_number_format(-$Component['TotalCost'],$_SESSION['CompanyRecord']['decimalplaces']) . '</td> </tr>'; - } //end if its a component not originally budget for + } //end if its a component not originally budgeted for } echo '<tr> @@ -162,13 +162,17 @@ </tr>'; $OtherReqtsBudget += ($Requirement->CostPerUnit * $Requirement->Quantity); } -echo '<tr><th colspan="3" align="right"><b>' . _('Budgeted Other Costs') . '</b></th><th class="number"><b>' . locale_number_format($OtherReqtsBudget,$_SESSION['CompanyRecord']['decimalplaces']) . '</b></th></tr> +echo '<tr> + <th colspan="3" align="right"><b>' . _('Budgeted Other Costs') . '</b></th> + <th class="number"><b>' . locale_number_format($OtherReqtsBudget,$_SESSION['CompanyRecord']['decimalplaces']) . '</b></th> + </tr> </table></td>'; //Now other requirements actual in a sub table echo '<td colspan="6"> <table class="selection"> - <tr><th>' . _('Supplier') . '</th> + <tr> + <th>' . _('Supplier') . '</th> <th>' . _('Reference') . '</th> <th>' . _('Date') . '</th> <th>' . _('Requirement') . '</th> @@ -197,25 +201,31 @@ } else { $Anticipated = _('Yes'); } - echo '<tr><td>' . $OtherChargesRow['supplierno'] . '</td> + echo '<tr> + <td>' . $OtherChargesRow['supplierno'] . '</td> <td>' . $OtherChargesRow['suppreference'] . '</td> <td>' .ConvertSQLDate($OtherChargesRow['trandate']) . '</td> <td>' . $OtherChargesRow['narrative'] . '</td> <td class="number">' . locale_number_format($OtherChargesRow['amount'],$_SESSION['CompanyRecord']['decimalplaces']) . '</td> <td>' . $Anticipated . '</td> - </tr>'; + </tr>'; $OtherReqtsActual +=$OtherChargesRow['amount']; } -echo '<tr><th colspan="4" align="right"><b>' . _('Actual Other Costs') . '</b></th><th class="number"><b>' . locale_number_format($OtherReqtsActual,$_SESSION['CompanyRecord']['decimalplaces']) . '</b></th></tr> - </table></td></tr>'; -echo '<tr><td colspan="5"><b>' . _('Total Budget Contract Cost') . '</b></td> - <td class="number"><b>' . locale_number_format($OtherReqtsBudget+$ContractBOMBudget,$_SESSION['CompanyRecord']['decimalplaces']) . '</b></td> - <td colspan="5"><b>' . _('Total Actual Contract Cost') . '</b></td> - <td class="number"><b>' . locale_number_format($OtherReqtsActual+$ContractBOMActual,$_SESSION['CompanyRecord']['decimalplaces']) . '</b></td></tr>'; +echo '<tr> + <th colspan="4" align="right"><b>' . _('Actual Other Costs') . '</b></th> + <th class="number"><b>' . locale_number_format($OtherReqtsActual,$_SESSION['CompanyRecord']['decimalplaces']) . '</b></th> + </tr> + </table></td> + </tr> + <tr> + <td colspan="5"><b>' . _('Total Budget Contract Cost') . '</b></td> + <td class="number"><b>' . locale_number_format($OtherReqtsBudget+$ContractBOMBudget,$_SESSION['CompanyRecord']['decimalplaces']) . '</b></td> + <td colspan="5"><b>' . _('Total Actual Contract Cost') . '</b></td> + <td class="number"><b>' . locale_number_format($OtherReqtsActual+$ContractBOMActual,$_SESSION['CompanyRecord']['decimalplaces']) . '</b></td> + </tr> + </table>'; -echo '</table>'; - //Do the processing here after the variances are all calculated above if (isset($_POST['CloseContract']) AND $_SESSION['Contract'.$identifier]->Status==2){ Modified: trunk/Contracts.php =================================================================== --- trunk/Contracts.php 2013-06-18 07:17:20 UTC (rev 6030) +++ trunk/Contracts.php 2013-06-21 22:48:11 UTC (rev 6031) @@ -793,16 +793,16 @@ $k=1; } if ($LastCustomer != $myrow['name']) { - echo '<td>'.htmlentities($myrow['name'], ENT_QUOTES,'UTF-8').'</td>'; + echo '<td>'. $myrow['name'] .'</td>'; } else { echo '<td></td>'; } - echo '<td><input type="submit" name="Submit'.$j.'" value="'.htmlentities($myrow['brname'], ENT_QUOTES,'UTF-8').'" /></td> - <input type="hidden" name="SelectedCustomer'.$j.'" value="'.$myrow['debtorno'].'" /> - <input type="hidden" name="SelectedBranch'.$j.'" value="'.$myrow['branchcode'].'" /> - <td>'.htmlentities($myrow['contactname'], ENT_QUOTES,'UTF-8').'</td> - <td>'.$myrow['phoneno'].'</td> - <td>'.$myrow['faxno'].'</td> + echo '<td><input type="submit" name="Submit'.$j.'" value="' . $myrow['brname'] . '" /></td> + <input type="hidden" name="SelectedCustomer'.$j.'" value="'. $myrow['debtorno'] . '" /> + <input type="hidden" name="SelectedBranch'.$j.'" value="' . $myrow['branchcode'] . '" /> + <td>' . $myrow['contactname'] .'</td> + <td>' . $myrow['phoneno'] . '</td> + <td>' . $myrow['faxno'] . '</td> </tr>'; $LastCustomer=$myrow['name']; $j++; Modified: trunk/SelectProduct.php =================================================================== --- trunk/SelectProduct.php 2013-06-18 07:17:20 UTC (rev 6030) +++ trunk/SelectProduct.php 2013-06-21 22:48:11 UTC (rev 6031) @@ -67,7 +67,8 @@ stockmaster.eoq, stockmaster.volume, stockmaster.kgs, - stockcategory.categorydescription + stockcategory.categorydescription, + stockmaster.categoryid FROM stockmaster INNER JOIN stockcategory ON stockmaster.categoryid=stockcategory.categoryid WHERE stockid='" . $StockID . "'", $db); @@ -173,22 +174,8 @@ } else { $GP = _('N/A'); } - echo $GP . '%' . '</td></tr>'; - while ($PriceRow = DB_fetch_row($PriceResult)) { - $Price = $PriceRow[1]; - echo '<tr><td></td> - <th>' . $PriceRow[0] . '</th> - <td class="select">' . locale_number_format($Price, $_SESSION['CompanyRecord']['decimalplaces']) . '</td> - <th class="number">' . _('Gross Profit') . '</th> - <td class="select">'; - if ($Price > 0) { - $GP = locale_number_format(($Price - $Cost) * 100 / $Price, 1); - } else { - $GP = _('N/A'); - } - echo $GP . '%' . '</td></tr>'; - echo '</td></tr>'; - } + echo $GP . '%' . '</td> + </tr>'; } if ($myrow['mbflag'] == 'K' OR $myrow['mbflag'] == 'A') { $CostResult = DB_query("SELECT SUM(bom.quantity * (stockmaster.materialcost+stockmaster.labourcost+stockmaster.overheadcost)) AS cost @@ -203,23 +190,21 @@ } else { $Cost = $myrow['cost']; } - echo '<tr><th class="number">' . _('Cost') . '</th> - <td class="select">' . locale_number_format($Cost, $_SESSION['StandardCostDecimalPlaces']) . '</td></tr>'; + echo '<tr> + <th class="number">' . _('Cost') . '</th> + <td class="select">' . locale_number_format($Cost, $_SESSION['StandardCostDecimalPlaces']) . '</td> + </tr>'; } //end of if PricesSecuirty allows viewing of prices echo '</table>'; //end of first nested table // Item Category Property mod: display the item properties echo '<table>'; - $CatValResult = DB_query("SELECT categoryid - FROM stockmaster - WHERE stockid='" . $StockID . "'", $db); - $CatValRow = DB_fetch_row($CatValResult); - $CatValue = $CatValRow[0]; + $sql = "SELECT stkcatpropid, label, controltype, defaultvalue FROM stockcatproperties - WHERE categoryid ='" . $CatValue . "' + WHERE categoryid ='" . $myrow['categoryid'] . "' AND reqatsalesorder =0 ORDER BY stkcatpropid"; $PropertiesResult = DB_query($sql, $db); @@ -231,34 +216,31 @@ WHERE stockid='" . $StockID . "' AND stkcatpropid ='" . $PropertyRow['stkcatpropid']."'", $db); $PropValRow = DB_fetch_row($PropValResult); - $PropertyValue = $PropValRow[0]; - echo '<tr><th align="right">' . $PropertyRow['label'] . ':</th>'; + if (DB_num_rows($PropValResult)==0){ + $PropertyValue = _('Not Set'); + } else { + $PropertyValue = $PropValRow[0]; + } + echo '<tr> + <th align="right">' . $PropertyRow['label'] . ':</th>'; switch ($PropertyRow['controltype']) { - case 0; //textbox - echo '<td class="select" style="width:60px"><input type="text" name="PropValue' . $PropertyCounter . '" value="' . $PropertyValue . '" />'; - break; - case 1; //select box - $OptionValues = explode(',', $PropertyRow['defaultvalue']); - echo '<td align="left" style="width:60px"><select name="PropValue' . $PropertyCounter . '">'; - foreach($OptionValues as $PropertyOptionValue) { - if ($PropertyOptionValue == $PropertyValue) { - echo '<option selected="selected" value="' . $PropertyOptionValue . '">' . $PropertyOptionValue . '</option>'; - } else { - echo '<option value="' . $PropertyOptionValue . '">' . $PropertyOptionValue . '</option>'; - } - } - echo '</select>'; - break; - case 2; //checkbox - echo '<td align="left" style="width:60px"><input type="checkbox" name="PropValue' . $PropertyCounter . '"'; - if ($PropertyValue == 1) { - echo ' checked'; - } - echo ' />'; -break; -} //end switch -echo '</td></tr>'; -$PropertyCounter++; + case 0: + case 1: + echo '<td class="select" style="width:60px">' . $PropertyValue; + break; + case 2; //checkbox + echo '<td class="select" style="width:60px">'; + if ($PropertyValue == _('Not Set')){ + echo _('Not Set'); + } elseif ($PropertyValue == 1){ + echo _('Yes'); + } else { + echo _('No'); + } + break; + } //end switch + echo '</td></tr>'; + $PropertyCounter++; } //end loop round properties for the item category echo '</table></td>'; //end of Item Category Property mod echo '<td style="width:15%; vertical-align:top"> Modified: trunk/Z_poRebuildDefault.php =================================================================== --- trunk/Z_poRebuildDefault.php 2013-06-18 07:17:20 UTC (rev 6030) +++ trunk/Z_poRebuildDefault.php 2013-06-21 22:48:11 UTC (rev 6031) @@ -16,7 +16,7 @@ $PathToDefault = './locale/en_GB.utf8/LC_MESSAGES/messages.po'; $FilesToInclude = '*.php includes/*.inc includes/*.php api/*.php reportwriter/languages/en_US/reports.php'; -$xgettextCmd = 'xgettext --no-wrap -L php -o ' . $PathToDefault . ' ' . $FilesToInclude; +$xgettextCmd = 'xgettext --no-wrap --from-code=utf-8 -L php -o ' . $PathToDefault . ' ' . $FilesToInclude; echo "<br /> <a href='" . $RootPath . "/Z_poAdmin.php'>" . _('Back to the translation menu') . "</a>"; echo '<br /><br /> ' . _('Utility page to rebuild the system default language file'); Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2013-06-18 07:17:20 UTC (rev 6030) +++ trunk/doc/Change.log 2013-06-21 22:48:11 UTC (rev 6031) @@ -1,5 +1,8 @@ OwebERP Change Log +21/6/13 Phil: ContractCosting.php fix references to contract issues object which should just have been an array. +18/6/13 Phil: Reworked the display of stock category properties on the SelectProduct.php inquiry +18/6/13 Tim: Z_ImportGLTransactions.php new script for importing GL payments, receipts or journals from a CSV file 17/6/13 Paul Harness: Fix sql query of goods received when a serial number is already present. GoodsReceived.php 12/6/13 tomglare: SelectSupplier - improve handling if single supplier selected 25/5/13 Phil: CountriesArray.php now uses the index as the ISO 2 character code for the country. Modified: trunk/includes/MainMenuLinksArray.php =================================================================== --- trunk/includes/MainMenuLinksArray.php 2013-06-18 07:17:20 UTC (rev 6030) +++ trunk/includes/MainMenuLinksArray.php 2013-06-21 22:48:11 UTC (rev 6031) @@ -497,27 +497,29 @@ '/Departments.php', '/InternalStockCategoriesByRole.php' ); -$MenuItems['Utilities']['Transactions']['Caption'] = array (_('Change A Customer Code'), - _('Change A Customer Branch Code'), - _('Change A Supplier Code'), - _('Change An Inventory Item Code'), - _('Change A GL Account Code'), - _('Change A Location Code'), - _('Update costs for all BOM items, from the bottom up'), - _('Re-apply costs to Sales Analysis'), - _('Delete sales transactions'), - _('Reverse all supplier payments on a specified date')); +$MenuItems['Utilities']['Transactions']['Caption'] = array (_('Import GL Payments Receipts Or Journals From CSV'), + _('Change A Customer Code'), + _('Change A Customer Branch Code'), + _('Change A Supplier Code'), + _('Change An Inventory Item Code'), + _('Change A GL Account Code'), + _('Change A Location Code'), + _('Update costs for all BOM items, from the bottom up'), + _('Re-apply costs to Sales Analysis'), + _('Delete sales transactions'), + _('Reverse all supplier payments on a specified date')); -$MenuItems['Utilities']['Transactions']['URL'] = array ( '/Z_ChangeCustomerCode.php', - '/Z_ChangeBranchCode.php', - '/Z_ChangeSupplierCode.php', - '/Z_ChangeStockCode.php', - '/Z_ChangeGLAccountCode.php', - '/Z_ChangeLocationCode.php', - '/Z_BottomUpCosts.php', - '/Z_ReApplyCostToSA.php', - '/Z_DeleteSalesTransActions.php', - '/Z_ReverseSuppPaymentRun.php'); +$MenuItems['Utilities']['Transactions']['URL'] = array ('/Z_ImportGLTransactions.php', + '/Z_ChangeCustomerCode.php', + '/Z_ChangeBranchCode.php', + '/Z_ChangeSupplierCode.php', + '/Z_ChangeStockCode.php', + '/Z_ChangeGLAccountCode.php', + '/Z_ChangeLocationCode.php', + '/Z_BottomUpCosts.php', + '/Z_ReApplyCostToSA.php', + '/Z_DeleteSalesTransActions.php', + '/Z_ReverseSuppPaymentRun.php'); $MenuItems['Utilities']['Reports']['Caption'] = array (_('Show Local Currency Total Debtor Balances'), _('Show Local Currency Total Suppliers Balances'), Modified: trunk/sql/mysql/upgrade4.10-4.11.sql =================================================================== --- trunk/sql/mysql/upgrade4.10-4.11.sql 2013-06-18 07:17:20 UTC (rev 6030) +++ trunk/sql/mysql/upgrade4.10-4.11.sql 2013-06-21 22:48:11 UTC (rev 6031) @@ -57,5 +57,6 @@ INSERT INTO mailgroups VALUES(4,'InventoryValuationRecipients'); ALTER TABLE stockrequestitems DROP PRIMARY KEY; ALTER TABLE stockrequestitems ADD PRIMARY KEY (`dispatchitemsid`,`dispatchid`); +INSERT INTO scripts VALUES('Z_ImportGLTransactions.php', 15, 'Import General Ledger Transactions'); |