Skip to content

Commit

Permalink
Remove unused $db parameter
Browse files Browse the repository at this point in the history
Functions: GetPeriod, GetNextTransNo
  • Loading branch information
TurboPT committed Mar 16, 2018
1 parent c297f79 commit ff9c410
Show file tree
Hide file tree
Showing 77 changed files with 163 additions and 163 deletions.
2 changes: 1 addition & 1 deletion AnalysisHorizontalPosition.php
Expand Up @@ -40,7 +40,7 @@ function RelativeChange($selected_period, $previous_period) {
<td><select required="required" name="BalancePeriodEnd">';
/* <td><select required="required" name="ToPeriod">';*/

$periodno=GetPeriod(Date($_SESSION['DefaultDateFormat']), $db);
$periodno=GetPeriod(Date($_SESSION['DefaultDateFormat']));
$sql = "SELECT lastdate_in_period FROM periods WHERE periodno='".$periodno . "'";
$result = DB_query($sql);
$myrow=DB_fetch_array($result);
Expand Down
6 changes: 3 additions & 3 deletions BankReconciliation.php
Expand Up @@ -48,10 +48,10 @@
$ExchangeDifference = ($CalculatedBalance - filter_number_format($_POST['BankStatementBalance']))/$CurrencyRow['rate'];

include ('includes/SQL_CommonFunctions.inc');
$ExDiffTransNo = GetNextTransNo(36,$db);
$ExDiffTransNo = GetNextTransNo(36);
/*Post the exchange difference to the last day of the month prior to current date*/
$PostingDate = Date($_SESSION['DefaultDateFormat'],mktime(0,0,0, Date('m'), 0,Date('Y')));
$PeriodNo = GetPeriod($PostingDate,$db);
$PeriodNo = GetPeriod($PostingDate);
$result = DB_Txn_Begin();

//yet to code the journal
Expand Down Expand Up @@ -148,7 +148,7 @@

/*Get the balance of the bank account concerned */

$PeriodNo = GetPeriod(date($_SESSION['DefaultDateFormat']), $db);
$PeriodNo = GetPeriod(date($_SESSION['DefaultDateFormat']));

$SQL = "SELECT bfwd+actual AS balance
FROM chartdetails
Expand Down
4 changes: 2 additions & 2 deletions ConfirmDispatch_Invoice.php
Expand Up @@ -807,8 +807,8 @@

/*Now Get the next invoice number - function in SQL_CommonFunctions*/

$InvoiceNo = GetNextTransNo(10, $db);
$PeriodNo = GetPeriod($DefaultDispatchDate, $db);
$InvoiceNo = GetNextTransNo(10);
$PeriodNo = GetPeriod($DefaultDispatchDate);

/*Start an SQL transaction */

Expand Down
6 changes: 3 additions & 3 deletions ContractCosting.php
Expand Up @@ -234,8 +234,8 @@
//Compare actual costs to original budgeted contract costs - if actual > budgeted - CR WIP and DR usage variance
$Variance = ($OtherReqtsBudget+$ContractBOMBudget)-($OtherReqtsActual+$ContractBOMActual);

$ContractCloseNo = GetNextTransNo( 32 ,$db);
$PeriodNo = GetPeriod(Date($_SESSION['DefaultDateFormat']), $db);
$ContractCloseNo = GetNextTransNo( 32 );
$PeriodNo = GetPeriod(Date($_SESSION['DefaultDateFormat']));

DB_Txn_Begin();

Expand Down Expand Up @@ -311,7 +311,7 @@
$myrow=DB_fetch_row($result);
if ($myrow[0]==0){ //then the contract wo has not been received (it will only ever be for 1 item)

$WOReceiptNo = GetNextTransNo(26, $db);
$WOReceiptNo = GetNextTransNo(26);

/* Need to get the current location quantity will need it later for the stock movement */
$SQL = "SELECT locstock.quantity
Expand Down
2 changes: 1 addition & 1 deletion Contracts.php
Expand Up @@ -536,7 +536,7 @@

//start a DB transaction
$Result = DB_Txn_Begin();
$OrderNo = GetNextTransNo(30, $db);
$OrderNo = GetNextTransNo(30);
$HeaderSQL = "INSERT INTO salesorders ( orderno,
debtorno,
branchcode,
Expand Down
8 changes: 4 additions & 4 deletions CounterReturns.php
Expand Up @@ -895,8 +895,8 @@
/*Now Get the next invoice number - GetNextTransNo() function in SQL_CommonFunctions
* GetPeriod() in includes/DateFunctions.inc */

$CreditNoteNo = GetNextTransNo(11, $db);
$PeriodNo = GetPeriod(Date($_SESSION['DefaultDateFormat']), $db);
$CreditNoteNo = GetNextTransNo(11);
$PeriodNo = GetPeriod(Date($_SESSION['DefaultDateFormat']));

$ReturnDate = Date('Y-m-d');

Expand Down Expand Up @@ -1436,7 +1436,7 @@
/*Need to figure out the cross rate between customer currency and bank account currency */

if ($_POST['AmountPaid']!=0){
$PaymentNumber = GetNextTransNo(12,$db);
$PaymentNumber = GetNextTransNo(12);
$SQL="INSERT INTO gltrans (type,
typeno,
trandate,
Expand Down Expand Up @@ -1481,7 +1481,7 @@

if ($_POST['AmountPaid']!=0){
if (!isset($PaymentNumber)){
$PaymentNumber = GetNextTransNo(12,$db);
$PaymentNumber = GetNextTransNo(12);
}
//Now need to add the receipt banktrans record
//First get the account currency that it has been banked into
Expand Down
12 changes: 6 additions & 6 deletions CounterSales.php
Expand Up @@ -1072,9 +1072,9 @@
// *************************************************************************
$result = DB_Txn_Begin();
/*First add the order to the database - it only exists in the session currently! */
$OrderNo = GetNextTransNo(30, $db);
$InvoiceNo = GetNextTransNo(10, $db);
$PeriodNo = GetPeriod(Date($_SESSION['DefaultDateFormat']), $db);
$OrderNo = GetNextTransNo(30);
$InvoiceNo = GetNextTransNo(10);
$PeriodNo = GetPeriod(Date($_SESSION['DefaultDateFormat']));

$HeaderSQL = "INSERT INTO salesorders ( orderno,
debtorno,
Expand Down Expand Up @@ -1200,7 +1200,7 @@
$WOQuantity = $StockItem->EOQ;
}

$WONo = GetNextTransNo(40,$db);
$WONo = GetNextTransNo(40);
$ErrMsg = _('Unable to insert a new work order for the sales order item');
$InsWOResult = DB_query("INSERT INTO workorders (wo,
loccode,
Expand Down Expand Up @@ -1889,7 +1889,7 @@
/*Need to figure out the cross rate between customer currency and bank account currency */

if ($_POST['AmountPaid']!=0){
$ReceiptNumber = GetNextTransNo(12,$db);
$ReceiptNumber = GetNextTransNo(12);
$SQL="INSERT INTO gltrans (type,
typeno,
trandate,
Expand Down Expand Up @@ -1933,7 +1933,7 @@
} /*end of if Sales and GL integrated */
if ($_POST['AmountPaid']!=0){
if (!isset($ReceiptNumber)){
$ReceiptNumber = GetNextTransNo(12,$db);
$ReceiptNumber = GetNextTransNo(12);
}
//Now need to add the receipt banktrans record
//First get the account currency that it has been banked into
Expand Down
4 changes: 2 additions & 2 deletions Credit_Invoice.php
Expand Up @@ -548,8 +548,8 @@

/*Now Get the next credit note number - function in SQL_CommonFunctions*/

$CreditNo = GetNextTransNo(11, $db);
$PeriodNo = GetPeriod($DefaultDispatchDate, $db);
$CreditNo = GetNextTransNo(11);
$PeriodNo = GetPeriod($DefaultDispatchDate);

/*Start an SQL transaction */

Expand Down
4 changes: 2 additions & 2 deletions Currencies.php
Expand Up @@ -135,7 +135,7 @@
$msg = _('The currency definition record has been added');
}
//run the SQL from either of the above possibilites
$ExDiffTransNo = GetNextTransNo(36,$db);
$ExDiffTransNo = GetNextTransNo(36);
$resultTx = DB_Txn_Begin();

$result = DB_query($sql);
Expand All @@ -154,7 +154,7 @@
if (isset($SelectedCurrency) AND $InputError !=1) {
/*Get the current period */
$PostingDate = Date($_SESSION['DefaultDateFormat']);
$PeriodNo = GetPeriod($PostingDate,$db);
$PeriodNo = GetPeriod($PostingDate);

/* get all the bank accounts denominated on the selected currency */
$SQLBankAccounts = "SELECT bankaccountname,
Expand Down
2 changes: 1 addition & 1 deletion CustomerAllocations.php
Expand Up @@ -143,7 +143,7 @@

if ($MovtInDiffOnExch !=0) {
if ($_SESSION['CompanyRecord']['gllink_debtors'] == 1) {
$PeriodNo = GetPeriod($_SESSION['Alloc']->TransDate, $db);
$PeriodNo = GetPeriod($_SESSION['Alloc']->TransDate);
$_SESSION['Alloc']->TransDate = FormatDateForSQL($_SESSION['Alloc']->TransDate);

$SQL = "INSERT INTO gltrans (
Expand Down
6 changes: 3 additions & 3 deletions CustomerReceipt.php
Expand Up @@ -252,7 +252,7 @@
and add up the non-GL ones for posting to debtors later,
also add the total discount total receipts*/

$PeriodNo = GetPeriod($_SESSION['ReceiptBatch' . $identifier]->DateBanked,$db);
$PeriodNo = GetPeriod($_SESSION['ReceiptBatch' . $identifier]->DateBanked);

if ($_SESSION['CompanyRecord']==0){
prnMsg(_('The company has not yet been set up properly') . ' - ' . _('this information is needed to process the batch') . '. ' . _('Processing has been cancelled'),'error');
Expand All @@ -272,7 +272,7 @@

/*Start a transaction to do the whole lot inside */
$result = DB_Txn_Begin();
$_SESSION['ReceiptBatch' . $identifier]->BatchNo = GetNextTransNo(12,$db);
$_SESSION['ReceiptBatch' . $identifier]->BatchNo = GetNextTransNo(12);


$BatchReceiptsTotal = 0; //in functional currency
Expand Down Expand Up @@ -393,7 +393,7 @@ functionalexrate = (1NZD = EUR 0.52)
*/

$PaymentTransNo = GetNextTransNo( 1, $db);
$PaymentTransNo = GetNextTransNo( 1 );
$SQL="INSERT INTO banktrans (transno,
type,
bankact,
Expand Down
2 changes: 1 addition & 1 deletion Customers.php
Expand Up @@ -210,7 +210,7 @@
if ($_SESSION['AutoDebtorNo'] > 0) {
/* system assigned, sequential, numeric */
if ($_SESSION['AutoDebtorNo']== 1) {
$_POST['DebtorNo'] = GetNextTransNo(500, $db);
$_POST['DebtorNo'] = GetNextTransNo(500);
}
}

Expand Down
2 changes: 1 addition & 1 deletion DailySalesInquiry.php
Expand Up @@ -14,7 +14,7 @@
echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />';

if (!isset($_POST['MonthToShow'])){
$_POST['MonthToShow'] = GetPeriod(Date($_SESSION['DefaultDateFormat']),$db);
$_POST['MonthToShow'] = GetPeriod(Date($_SESSION['DefaultDateFormat']));
$Result = DB_query("SELECT lastdate_in_period FROM periods WHERE periodno='" . $_POST['MonthToShow'] . "'");
$myrow = DB_fetch_array($Result);
$EndDateSQL = $myrow['lastdate_in_period'];
Expand Down
4 changes: 2 additions & 2 deletions Dashboard.php
Expand Up @@ -428,8 +428,8 @@
</thead>
<tbody>';

$FirstPeriodSelected = GetPeriod(date($_SESSION['DefaultDateFormat']), $db);
$LastPeriodSelected = GetPeriod(date($_SESSION['DefaultDateFormat']), $db);
$FirstPeriodSelected = GetPeriod(date($_SESSION['DefaultDateFormat']));
$LastPeriodSelected = GetPeriod(date($_SESSION['DefaultDateFormat']));
$SelectedPeriod=$LastPeriodSelected;

$Sql = "SELECT bankaccounts.accountcode,
Expand Down
6 changes: 3 additions & 3 deletions DeliveryDetails.php
Expand Up @@ -336,7 +336,7 @@

$Result = DB_Txn_Begin();

$OrderNo = GetNextTransNo(30, $db);
$OrderNo = GetNextTransNo(30);

$HeaderSQL = "INSERT INTO salesorders (
orderno,
Expand Down Expand Up @@ -494,7 +494,7 @@
$WOQuantity = $StockItem->EOQ;
}

$WONo = GetNextTransNo(40,$db);
$WONo = GetNextTransNo(40);
$ErrMsg = _('Unable to insert a new work order for the sales order item');
$InsWOResult = DB_query("INSERT INTO workorders (wo,
loccode,
Expand Down Expand Up @@ -664,7 +664,7 @@
AND status=1");
if(DB_num_rows($ContractResult)==1) {//then it is a contract quotation being changed to an order
$ContractRow = DB_fetch_array($ContractResult);
$WONo = GetNextTransNo(40,$db);
$WONo = GetNextTransNo(40);
$ErrMsg = _('Could not update the contract status');
$DbgMsg = _('The SQL that failed to update the contract status was');
$UpdContractResult=DB_query("UPDATE contracts SET status=2,
Expand Down
2 changes: 1 addition & 1 deletion EDISendInvoices.php
Expand Up @@ -118,7 +118,7 @@
}
DB_data_seek($MessageLinesResult,0);

$EDITransNo = GetNextTransNo(99,$db);
$EDITransNo = GetNextTransNo(99);
$fp = fopen( $_SESSION['EDI_MsgPending'] . '/EDI_INV_' . $EDITransNo , 'w');

while ($LineDetails = DB_fetch_array($MessageLinesResult)){
Expand Down
2 changes: 1 addition & 1 deletion EDISendInvoices_Reece.php
Expand Up @@ -198,7 +198,7 @@
}
DB_data_seek($MessageLinesResult,0);

$EDITransNo = GetNextTransNo(99,$db);
$EDITransNo = GetNextTransNo(99);
$fp = fopen('EDI_INV_' . $TransNo . '.txt', 'w');

while ($LineDetails = DB_fetch_array($MessageLinesResult)){
Expand Down
4 changes: 2 additions & 2 deletions FixedAssetDepreciation.php
Expand Up @@ -80,8 +80,8 @@
}
if (isset($_POST['CommitDepreciation']) AND $InputError==false){
$result = DB_Txn_Begin();
$TransNo = GetNextTransNo(44, $db);
$PeriodNo = GetPeriod($_POST['ProcessDate'],$db);
$TransNo = GetNextTransNo(44);
$PeriodNo = GetPeriod($_POST['ProcessDate']);
}

echo '<br /><table>';
Expand Down
6 changes: 3 additions & 3 deletions FixedAssetItems.php
Expand Up @@ -153,7 +153,7 @@
WHERE categoryid='" . $_POST['AssetCategoryID'] . "'");
$NewAccounts = DB_fetch_array($result);

$TransNo = GetNextTransNo( 42, $db); /* transaction type is asset category change */
$TransNo = GetNextTransNo( 42 ); /* transaction type is asset category change */

//credit cost for the old category
$SQL = "INSERT INTO gltrans (type,
Expand Down Expand Up @@ -322,8 +322,8 @@
$result = DB_Txn_Begin();

/*Need to remove cost and accumulate depreciation from cost and accumdepn accounts */
$PeriodNo = GetPeriod(Date($_SESSION['DefaultDateFormat']),$db);
$TransNo = GetNextTransNo( 43, $db); /* transaction type is asset deletion - (and remove cost/acc5umdepn from GL) */
$PeriodNo = GetPeriod(Date($_SESSION['DefaultDateFormat']));
$TransNo = GetNextTransNo( 43 ); /* transaction type is asset deletion - (and remove cost/acc5umdepn from GL) */
if ($AssetRow['cost'] > 0){
//credit cost for the asset deleted
$SQL = "INSERT INTO gltrans (type,
Expand Down
4 changes: 2 additions & 2 deletions GLAccountInquiry.php
Expand Up @@ -34,8 +34,8 @@
$FirstPeriodSelected = $_GET['FromPeriod'];
$LastPeriodSelected = $_GET['ToPeriod'];
} else { // Otherwise just highlight the current period
$FirstPeriodSelected = GetPeriod(date($_SESSION['DefaultDateFormat']), $db);
$LastPeriodSelected = GetPeriod(date($_SESSION['DefaultDateFormat']), $db);
$FirstPeriodSelected = GetPeriod(date($_SESSION['DefaultDateFormat']));
$LastPeriodSelected = GetPeriod(date($_SESSION['DefaultDateFormat']));
}

echo '<div class="page_help_text noprint">' . _('Use the keyboard Shift key to select multiple periods') . '</div><br />';
Expand Down
2 changes: 1 addition & 1 deletion GLBalanceSheet.php
Expand Up @@ -35,7 +35,7 @@
<td>' . _('Select the balance date').':</td>
<td><select required="required" name="BalancePeriodEnd">';

$periodno=GetPeriod(Date($_SESSION['DefaultDateFormat']), $db);
$periodno=GetPeriod(Date($_SESSION['DefaultDateFormat']));
$sql = "SELECT lastdate_in_period FROM periods WHERE periodno='".$periodno . "'";
$result = DB_query($sql);
$myrow=DB_fetch_array($result);
Expand Down
4 changes: 2 additions & 2 deletions GLBudgets.php
Expand Up @@ -90,7 +90,7 @@

if (isset($SelectedAccount) and $SelectedAccount != '') {

$CurrentYearEndPeriod = GetPeriod(Date($_SESSION['DefaultDateFormat'],YearEndDate($_SESSION['YearEnd'],0)),$db);
$CurrentYearEndPeriod = GetPeriod(Date($_SESSION['DefaultDateFormat'],YearEndDate($_SESSION['YearEnd'],0)));

// If the update button has been hit, then update chartdetails with the budget figures
// for this year and next.
Expand Down Expand Up @@ -119,7 +119,7 @@
/* If the periods dont exist then create them */
for ($i=1; $i <=36; $i++) {
$MonthEnd=mktime(0,0,0,$_SESSION['YearEnd']+1+$i,0,$YearEndYear-2);
$period=GetPeriod(Date($_SESSION['DefaultDateFormat'],$MonthEnd),$db, false);
$period=GetPeriod(Date($_SESSION['DefaultDateFormat'],$MonthEnd), false);
$PeriodEnd[$period]=Date('M Y',$MonthEnd);
}
include('includes/GLPostings.inc'); //creates chartdetails with correct values
Expand Down
4 changes: 2 additions & 2 deletions GLCashFlowsIndirect.php
Expand Up @@ -756,7 +756,7 @@ function colDebitCredit($Amount) {
} else {// It is a month in the previous year.
$BeginDate = mktime(0, 0, 0, $BeginMonth, 1, date('Y')-1);
}
$_POST['PeriodFrom'] = GetPeriod(date($_SESSION['DefaultDateFormat'], $BeginDate), $db);
$_POST['PeriodFrom'] = GetPeriod(date($_SESSION['DefaultDateFormat'], $BeginDate));
}
while($MyRow = DB_fetch_array($Periods)) {
echo '<option',($MyRow['periodno'] == $_POST['PeriodFrom'] ? ' selected="selected"' : '' ), ' value="', $MyRow['periodno'], '">', MonthAndYearFromSQLDate($MyRow['lastdate_in_period']), '</option>';
Expand All @@ -770,7 +770,7 @@ function colDebitCredit($Amount) {
'<td><label for="PeriodTo">', _('Select period to'), '</label></td>
<td><select id="PeriodTo" name="PeriodTo" required="required">';
if(!isset($_POST['PeriodTo'])) {
$_POST['PeriodTo'] = GetPeriod(date($_SESSION['DefaultDateFormat']), $db);
$_POST['PeriodTo'] = GetPeriod(date($_SESSION['DefaultDateFormat']));
}
DB_data_seek($Periods,0);
while($MyRow = DB_fetch_array($Periods)) {
Expand Down
4 changes: 2 additions & 2 deletions GLJournal.php
Expand Up @@ -57,12 +57,12 @@
A GL entry is created for each GL entry
*/

$PeriodNo = GetPeriod($_SESSION['JournalDetail']->JnlDate,$db);
$PeriodNo = GetPeriod($_SESSION['JournalDetail']->JnlDate);

/*Start a transaction to do the whole lot inside */
$result = DB_Txn_Begin();

$TransNo = GetNextTransNo( 0, $db);
$TransNo = GetNextTransNo( 0 );

foreach ($_SESSION['JournalDetail']->GLEntries as $JournalItem) {
$SQL = "INSERT INTO gltrans (type,
Expand Down
2 changes: 1 addition & 1 deletion GLProfit_Loss.php
Expand Up @@ -43,7 +43,7 @@
$DefaultFromDate = Date ('Y-m-d', Mktime(0,0,0,$_SESSION['YearEnd'] + 2,0,Date('Y')-1));
$FromDate = Date($_SESSION['DefaultDateFormat'], Mktime(0,0,0,$_SESSION['YearEnd'] + 2,0,Date('Y')-1));
}
$period=GetPeriod($FromDate, $db);
$period=GetPeriod($FromDate);

/*Show a form to allow input of criteria for profit and loss to show */
echo '<br /><table class="selection">
Expand Down
2 changes: 1 addition & 1 deletion GLTagProfit_Loss.php
Expand Up @@ -32,7 +32,7 @@
$DefaultFromDate = Date ('Y-m-d', Mktime(0,0,0,$_SESSION['YearEnd'] + 2,0,Date('Y')-1));
$FromDate = Date($_SESSION['DefaultDateFormat'], Mktime(0,0,0,$_SESSION['YearEnd'] + 2,0,Date('Y')-1));
}
$period=GetPeriod($FromDate, $db);
$period=GetPeriod($FromDate);

/*Show a form to allow input of criteria for profit and loss to show */
echo '<table class="selection">
Expand Down

0 comments on commit ff9c410

Please sign in to comment.