Skip to content

Commit

Permalink
PaulT: Remove $db parameter from all GetStockGLCode() functions.
Browse files Browse the repository at this point in the history
  • Loading branch information
TurboPT authored and timschofield committed Feb 27, 2018
1 parent 4bca85d commit 7a44c37
Show file tree
Hide file tree
Showing 20 changed files with 25 additions and 24 deletions.
2 changes: 1 addition & 1 deletion ConfirmDispatch_Invoice.php
Expand Up @@ -1427,7 +1427,7 @@
$Result = DB_query($SQL,$ErrMsg,$DbgMsg,true);

/*now the stock entry - this is set to the cost act in the case of a fixed asset disposal */
$StockGLCode = GetStockGLCode($OrderLine->StockID,$db);
$StockGLCode = GetStockGLCode($OrderLine->StockID);

$SQL = "INSERT INTO gltrans (type,
typeno,
Expand Down
2 changes: 1 addition & 1 deletion ContractCosting.php
Expand Up @@ -231,7 +231,7 @@

include('includes/SQL_CommonFunctions.inc');

$GLCodes = GetStockGLCode($_SESSION['Contract'.$identifier]->ContractRef,$db);
$GLCodes = GetStockGLCode($_SESSION['Contract'.$identifier]->ContractRef);
//Compare actual costs to original budgeted contract costs - if actual > budgeted - CR WIP and DR usage variance
$Variance = ($OtherReqtsBudget+$ContractBOMBudget)-($OtherReqtsActual+$ContractBOMActual);

Expand Down
2 changes: 1 addition & 1 deletion CounterReturns.php
Expand Up @@ -1313,7 +1313,7 @@
$Result = DB_query($SQL,$ErrMsg,$DbgMsg,true);

/*now the stock entry*/
$StockGLCode = GetStockGLCode($ReturnItemLine->StockID,$db);
$StockGLCode = GetStockGLCode($ReturnItemLine->StockID);

$SQL = "INSERT INTO gltrans (type,
typeno,
Expand Down
2 changes: 1 addition & 1 deletion CounterSales.php
Expand Up @@ -1766,7 +1766,7 @@
$Result = DB_query($SQL,$ErrMsg,$DbgMsg,true);

/*now the stock entry*/
$StockGLCode = GetStockGLCode($OrderLine->StockID,$db);
$StockGLCode = GetStockGLCode($OrderLine->StockID);

$SQL = "INSERT INTO gltrans (type,
typeno,
Expand Down
2 changes: 1 addition & 1 deletion Credit_Invoice.php
Expand Up @@ -1350,7 +1350,7 @@
'" . $_SESSION['CreditItems' . $identifier]->DebtorNo . " - " . $CreditLine->StockID . " x " . $CreditLine->QtyDispatched . " @ " . $CreditLine->StandardCost . "',
'" . round($CreditLine->StandardCost * $CreditLine->QtyDispatched,$_SESSION['CompanyRecord']['decimalplaces']) . "')";
} else {
$StockGLCode = GetStockGLCode($CreditLine->StockID, $db);
$StockGLCode = GetStockGLCode($CreditLine->StockID);
$SQL = "INSERT INTO gltrans(type,
typeno,
trandate,
Expand Down
2 changes: 1 addition & 1 deletion InternalStockRequestFulfill.php
Expand Up @@ -145,7 +145,7 @@

if ($_SESSION['CompanyRecord']['gllink_stock']==1 AND $StandardCost > 0){

$StockGLCodes = GetStockGLCode($StockID,$db);
$StockGLCodes = GetStockGLCode($StockID);

$SQL = "INSERT INTO gltrans (type,
typeno,
Expand Down
2 changes: 1 addition & 1 deletion PDFStockCheckComparison.php
Expand Up @@ -132,7 +132,7 @@

if ($_SESSION['CompanyRecord']['gllink_stock']==1 AND $myrow['standardcost'] > 0){

$StockGLCodes = GetStockGLCode($myrow['stockid'],$db);
$StockGLCodes = GetStockGLCode($myrow['stockid']);
$ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The general ledger transaction entries could not be added because');
$DbgMsg = _('The following SQL to insert the GL entries was used');

Expand Down
2 changes: 1 addition & 1 deletion SelectCreditItems.php
Expand Up @@ -1838,7 +1838,7 @@
} else {

/*the goods are coming back into stock so debit the stock account*/
$StockGLCode = GetStockGLCode($CreditLine->StockID, $db);
$StockGLCode = GetStockGLCode($CreditLine->StockID);
$SQL = "INSERT INTO gltrans (type,
typeno,
trandate,
Expand Down
2 changes: 1 addition & 1 deletion ShipmentCosting.php
Expand Up @@ -217,7 +217,7 @@


if ($_SESSION['CompanyRecord']['gllink_stock']==1){
$StockGLCodes = GetStockGLCode($myrow['itemcode'],$db);
$StockGLCodes = GetStockGLCode($myrow['itemcode']);
}

/*GL journals depend on the costing method used currently:
Expand Down
2 changes: 1 addition & 1 deletion StockAdjustments.php
Expand Up @@ -319,7 +319,7 @@

if ($_SESSION['CompanyRecord']['gllink_stock']==1 AND $_SESSION['Adjustment' . $identifier]->StandardCost > 0){

$StockGLCodes = GetStockGLCode($_SESSION['Adjustment' . $identifier]->StockID,$db);
$StockGLCodes = GetStockGLCode($_SESSION['Adjustment' . $identifier]->StockID);

$SQL = "INSERT INTO gltrans (type,
typeno,
Expand Down
4 changes: 2 additions & 2 deletions StockLocTransferReceive.php
Expand Up @@ -204,7 +204,7 @@
if($_SESSION['Transfer']->StockLocationFromAccount !='') {
$AccountCode = $_SESSION['Transfer']->StockLocationFromAccount;
} else {
$StockGLCode = GetStockGLCode($TrfLine->StockID, $db);// Get Category's account codes.
$StockGLCode = GetStockGLCode($TrfLine->StockID);// Get Category's account codes.
$AccountCode = $StockGLCode['stockact'];// Select account code for stock.
}
// Get the item cost:
Expand Down Expand Up @@ -357,7 +357,7 @@
if($_SESSION['Transfer']->StockLocationToAccount !='') {
$AccountCode = $_SESSION['Transfer']->StockLocationToAccount;
} else {
$StockGLCode = GetStockGLCode($TrfLine->StockID, $db);// Get Category's account codes.
$StockGLCode = GetStockGLCode($TrfLine->StockID);// Get Category's account codes.
$AccountCode = $StockGLCode['stockact'];// Select account code for stock.
}
// Get the item cost:
Expand Down
4 changes: 2 additions & 2 deletions StockTransfers.php
Expand Up @@ -221,7 +221,7 @@
if($_SESSION['Transfer']->StockLocationToAccount !='') {
$AccountCode = $_SESSION['Transfer']->StockLocationToAccount;
} else {
$StockGLCode = GetStockGLCode($_SESSION['Transfer']->TransferItem[0]->StockID, $db);// Get Category's account codes.
$StockGLCode = GetStockGLCode($_SESSION['Transfer']->TransferItem[0]->StockID);// Get Category's account codes.
$AccountCode = $StockGLCode['stockact'];// Select account code for stock.
}
// Get the item cost:
Expand Down Expand Up @@ -377,7 +377,7 @@
if($_SESSION['Transfer']->StockLocationToAccount !='') {
$AccountCode = $_SESSION['Transfer']->StockLocationToAccount;
} else {
$StockGLCode = GetStockGLCode($_SESSION['Transfer']->TransferItem[0]->StockID, $db);// Get Category's account codes.
$StockGLCode = GetStockGLCode($_SESSION['Transfer']->TransferItem[0]->StockID);// Get Category's account codes.
$AccountCode = $StockGLCode['stockact'];// Select account code for stock.
}
// Get the item cost:
Expand Down
2 changes: 1 addition & 1 deletion SupplierCredit.php
Expand Up @@ -860,7 +860,7 @@
if (mb_strlen($EnteredGRN->ItemCode)>0 OR $EnteredGRN->ItemCode != ''){ /*so it is a stock item */

/*need to get the stock category record for this stock item - this is function in SQL_CommonFunctions.inc */
$StockGLCode = GetStockGLCode($EnteredGRN->ItemCode,$db);
$StockGLCode = GetStockGLCode($EnteredGRN->ItemCode);

/*We have stock item and a purchase price variance need to see whether we are using Standard or WeightedAverageCosting */

Expand Down
2 changes: 1 addition & 1 deletion SupplierInvoice.php
Expand Up @@ -1261,7 +1261,7 @@
if (mb_strlen($EnteredGRN->ItemCode)>0 OR $EnteredGRN->ItemCode != ''){ /*so it is a stock item */

/*need to get the stock category record for this stock item - this is function in SQL_CommonFunctions.inc */
$StockGLCode = GetStockGLCode($EnteredGRN->ItemCode,$db);
$StockGLCode = GetStockGLCode($EnteredGRN->ItemCode);

/*We have stock item and a purchase price variance need to see whether we are using Standard or WeightedAverageCosting */

Expand Down
4 changes: 2 additions & 2 deletions WorkOrderIssue.php
Expand Up @@ -168,7 +168,7 @@

$PeriodNo = GetPeriod(Date($_SESSION['DefaultDateFormat']), $db); //backdate
$SQLIssuedDate = FormatDateForSQL($_POST['IssuedDate']);
$StockGLCode = GetStockGLCode($_POST['IssueItem'],$db);
$StockGLCode = GetStockGLCode($_POST['IssueItem']);


if ($IssueItemRow['mbflag']=='M' OR $IssueItemRow['mbflag']=='B'){
Expand Down Expand Up @@ -491,7 +491,7 @@
$_POST['IssueItem'] = $itm['item'];
$QuantityIssued = $itm['qty'];
$IssueItemRow['mbflag'] = $itm['mbflag'];
$StockGLCode = GetStockGLCode($_POST['IssueItem'],$db);
$StockGLCode = GetStockGLCode($_POST['IssueItem']);
$IssueItemRow['cost'] = $itm['cost'];
if ($IssueItemRow['mbflag']=='M' OR $IssueItemRow['mbflag']=='B'){
/* Need to get the current location quantity will need it later for the stock movement */
Expand Down
2 changes: 1 addition & 1 deletion WorkOrderReceive.php
Expand Up @@ -208,7 +208,7 @@
}

$SQLReceivedDate = FormatDateForSQL($_POST['ReceivedDate']);
$StockGLCode = GetStockGLCode($_POST['StockID'],$db);
$StockGLCode = GetStockGLCode($_POST['StockID']);

//Recalculate the standard for the item if there were no items previously received against the work order
if ($WORow['qtyrecd']==0){
Expand Down
2 changes: 1 addition & 1 deletion api/api_debtortransactions.php
Expand Up @@ -935,7 +935,7 @@ function CreateCreditNote($Header,$LineDetails, $User, $Password) {
$Result = api_DB_query($SQL,'','',true);

/*now the stock entry - this is set to the cost act in the case of a fixed asset disposal */
$StockGLCode = GetStockGLCode($CN_Line['stockid'],$db);
$StockGLCode = GetStockGLCode($CN_Line['stockid']);

$SQL = "INSERT INTO gltrans (type,
typeno,
Expand Down
2 changes: 1 addition & 1 deletion api/api_salesorders.php
Expand Up @@ -1104,7 +1104,7 @@ function InvoiceSalesOrder($OrderNo, $User, $Password) {
$Result = api_DB_query($SQL,'','',true);

/*now the stock entry - this is set to the cost act in the case of a fixed asset disposal */
$StockGLCode = GetStockGLCode($OrderLineRow['stkcode'],$db);
$StockGLCode = GetStockGLCode($OrderLineRow['stkcode']);

$SQL = "INSERT INTO gltrans (type,
typeno,
Expand Down
3 changes: 2 additions & 1 deletion doc/Change.log
@@ -1,6 +1,7 @@
webERP Change Log

9/2/18 PaulT: Remove lingering $k and $j variable left behind from 7944 commit.
10/2/18 PaulT: Remove $db parameter from all GetStockGLCode() functions.
10/2/18 PaulT: Remove variables left behind from 7944 commit.
9/2/18 PaulT: MRPReschedules.php, MRPShortages.php: Use DB_table_exists() from commit 7943 to replace table check query.
9/2/18 PaulT: Remove the last of the remaining URL 'SID' references.
9/2/18 Paul Becker (PaulT commit): StockLocMovements.php, StockMovements.php: Add serial number column to output. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=8088)
Expand Down
4 changes: 2 additions & 2 deletions includes/SQL_CommonFunctions.inc
Expand Up @@ -31,7 +31,7 @@ etc
}


Function GetStockGLCode ($StockID, &$db){
Function GetStockGLCode ($StockID){

/*Gets the GL Codes relevant to the stock item account from the stock category record */
$QuerySQL = "SELECT stockact,
Expand Down Expand Up @@ -158,7 +158,7 @@ function ItemCostUpdateGL($db, $StockID, $NewCost, $OldCost, $QOH) {

$CostUpdateNo = GetNextTransNo(35, $db);
$PeriodNo = GetPeriod(date($_SESSION['DefaultDateFormat']), $db);
$StockGLCode = GetStockGLCode($StockID,$db);
$StockGLCode = GetStockGLCode($StockID);

$ValueOfChange = $QOH * ($NewCost - $OldCost);

Expand Down

0 comments on commit 7a44c37

Please sign in to comment.