From: <ex...@us...> - 2016-02-01 13:28:09
|
Revision: 7454 http://sourceforge.net/p/web-erp/reponame/7454 Author: exsonqu Date: 2016-02-01 13:28:07 +0000 (Mon, 01 Feb 2016) Log Message: ----------- 1/2/15 Exson: Make GL Posting really transaction in GLPostings.inc. Modified Paths: -------------- trunk/includes/GLPostings.inc Modified: trunk/includes/GLPostings.inc =================================================================== --- trunk/includes/GLPostings.inc 2016-02-01 13:18:28 UTC (rev 7453) +++ trunk/includes/GLPostings.inc 2016-02-01 13:28:07 UTC (rev 7454) @@ -93,12 +93,14 @@ $sql = "UPDATE chartdetails SET actual = actual + " . $TotalAmount . " WHERE accountcode = '" . $CurrentAccount . "' AND period= '" . $CurrPeriod . "'"; - $PostPrd = DB_query($sql); + $ErrMsg = _('Failed to update actual amount in chartdetails table'); + $PostPrd = DB_query($sql,$ErrMsg,'',true); /*Update the BFwd for all following ChartDetail records */ $sql = "UPDATE chartdetails SET bfwd = bfwd + " . $TotalAmount . " WHERE accountcode = '" . $CurrentAccount . "' AND period > '" . $CurrPeriod . "'"; - $PostBFwds = DB_query($sql); + $ErrMsg = _('Failed to update bfwd amount in chartdetails table'); + $PostBFwds = DB_query($sql,$ErrMsg,'',true); $TotalAmount = 0; } $CurrentAccount = $UnpostedTrans['account']; @@ -109,18 +111,21 @@ $sql = "UPDATE chartdetails SET actual = actual + " . $TotalAmount . " WHERE accountcode = '" . $CurrentAccount . "' AND period= '" . $CurrPeriod . "'"; - $PostPrd = DB_query($sql); + $ErrMsg = _('Failed to update actual amount in chartdetails table'); + $PostPrd = DB_query($sql,$ErrMsg,'',true); /*Update the BFwd for all following ChartDetail records */ $sql = "UPDATE chartdetails SET bfwd = bfwd + " . $TotalAmount . " WHERE accountcode = '" . $CurrentAccount . "' AND period > '" . $CurrPeriod . "'"; - $PostBFwds = DB_query($sql); + $ErrMsg = _('Failed to update actual amount in chartdetails table'); + $PostBFwds = DB_query($sql,$ErrMsg,'',true); } $sql = "UPDATE gltrans SET posted = 1 WHERE periodno = '" . $CurrPeriod . "' AND posted=0"; - $Posted = DB_query($sql); + $ErrMsg = _('Failed to update gltrans table'); + $Posted = DB_query($sql,$ErrMsg,'',true); $TransCommit = DB_Txn_Commit(); } -?> \ No newline at end of file +?> |
From: <ex...@us...> - 2016-02-01 19:17:59
|
Revision: 7456 http://sourceforge.net/p/web-erp/reponame/7456 Author: exsonqu Date: 2016-02-01 19:17:56 +0000 (Mon, 01 Feb 2016) Log Message: ----------- 02/02/16 Exson?\239?\188?\154Fixed the bug of chartdetails bfwd amount wrong in GLPostings.inc. Modified Paths: -------------- trunk/includes/GLPostings.inc Modified: trunk/includes/GLPostings.inc =================================================================== --- trunk/includes/GLPostings.inc 2016-02-01 13:28:43 UTC (rev 7455) +++ trunk/includes/GLPostings.inc 2016-02-01 19:17:56 UTC (rev 7456) @@ -67,9 +67,23 @@ $ErrMsg = _('Inserting new chart details records required failed because'); $InsChartDetailsRecords = DB_query($sql,$ErrMsg); } +//now lets update those new created period with the bfwd amount +$sql = "SELECT max(period),accountcode + FROM chartdetails + WHERE bfwd!=0 + GROUP BY accountcode"; +$ErrMsg = _('Failed to retrieve new period data'); +$NewAccountsResult = DB_query($sql,$ErrMsg); +if (DB_num_rows($NewAccountsResult)>0) { + while ($NewAccountsRow = DB_fetch_row($NewAccountsResult)) { + $sql = "UPDATE chartdetails AS c INNER JOIN chartdetails AS s ON c.accountcode=s.accountcode AND c.period=s.period + SET c.bfwd= (SELECT bfwd FROM (SELECT bfwd FROM chartdetails WHERE period='" . $NewAccountsRow[0]. "' AND accountcode='" . $NewAccountsRow[1] . "') AS temple) + WHERE c.accountcode='" . $NewAccountsRow[1] . "' AND c.period>'" . $NewAccountsRow[0] . "'"; + $ErrMsg = _('Failed to update chartdetails bfwd data'); + $result = DB_query($sql,$ErrMsg); + } +} - - /*All the ChartDetail records should have been created now and be available to accept postings */ for ( $CurrPeriod = $CreateFrom; $CurrPeriod <= $CreateTo; $CurrPeriod++ ) { @@ -107,7 +121,7 @@ $TotalAmount += $UnpostedTrans['amount']; } // There will be one account still to post after the loop - if($CurrentAccount != 0) { + if($CurrentAccount != '0') { $sql = "UPDATE chartdetails SET actual = actual + " . $TotalAmount . " WHERE accountcode = '" . $CurrentAccount . "' AND period= '" . $CurrPeriod . "'"; |
From: <ex...@us...> - 2016-02-24 01:12:32
|
Revision: 7463 http://sourceforge.net/p/web-erp/reponame/7463 Author: exsonqu Date: 2016-02-24 01:12:29 +0000 (Wed, 24 Feb 2016) Log Message: ----------- 24/02/16: Richard, Exson Fix the GLPosting initiating error in GLPostings.inc. Modified Paths: -------------- trunk/includes/GLPostings.inc Modified: trunk/includes/GLPostings.inc =================================================================== --- trunk/includes/GLPostings.inc 2016-02-20 08:27:29 UTC (rev 7462) +++ trunk/includes/GLPostings.inc 2016-02-24 01:12:29 UTC (rev 7463) @@ -54,7 +54,22 @@ $ChartDetailsNotSetUpResult = DB_query($sql,_('Could not test to see that all chart detail records properly initiated')); if(DB_num_rows($ChartDetailsNotSetUpResult)>0){ - + //first lets retrieve those new added accountcode and period; + $sql = "SELECT chartmaster.accountcode,periods.periodno + FROM (chartmaster CROSS JOIN periods) + LEFT JOIN chartdetails ON chartmaster.accountcode=chartdetails.accountcode + AND periods.periodno=chartdetails.period + WHERE (periods.periodno BETWEEN '" . $CreateFrom . "' AND '" . $CreateTo . "') + AND chartdetails.account code IS NULL ORDER BY accountcode,periodno"; + $ErrMsg = _('Failed to retrieve new account code and periods'); + $NewPeriodResult = DB_query($sql,$ErrMsg); + if (DB_num_rows($result)>0){ + $NewPeriods = array(); + while ($NewPeriodsRow = DB_fetch_array($NewPeriodResult)) { + if (!isset($NewPeriods[$NewPeriodsRow['accountcode']])) { + $NewPeriods[$NewPeriodsRow['accountcode']] = $NewPeriodsRow['period']; + } + } /*Now insert the chartdetails records that do not already exist */ $sql = "INSERT INTO chartdetails (accountcode, period) SELECT chartmaster.accountcode, periods.periodno @@ -66,21 +81,17 @@ $ErrMsg = _('Inserting new chart details records required failed because'); $InsChartDetailsRecords = DB_query($sql,$ErrMsg); + } } + //now lets update those new created period with the bfwd amount -$sql = "SELECT max(period),accountcode - FROM chartdetails - WHERE bfwd!=0 - GROUP BY accountcode"; -$ErrMsg = _('Failed to retrieve new period data'); -$NewAccountsResult = DB_query($sql,$ErrMsg); -if (DB_num_rows($NewAccountsResult)>0) { - while ($NewAccountsRow = DB_fetch_row($NewAccountsResult)) { - $sql = "UPDATE chartdetails AS c INNER JOIN chartdetails AS s ON c.accountcode=s.accountcode AND c.period=s.period - SET c.bfwd= (SELECT bfwd FROM (SELECT bfwd FROM chartdetails WHERE period='" . $NewAccountsRow[0]. "' AND accountcode='" . $NewAccountsRow[1] . "') AS temple) - WHERE c.accountcode='" . $NewAccountsRow[1] . "' AND c.period>'" . $NewAccountsRow[0] . "'"; - $ErrMsg = _('Failed to update chartdetails bfwd data'); - $result = DB_query($sql,$ErrMsg); +if (isset($NewPeriods)) { + foreach ($NewPeriods as $Account=>$Period) { + if ($Period>$CreateFrom) { + $sql = "UPDATE chartdetails SET bfwd=(SELECT bfwd+actual FROM chartdetails WHERE accountcode='" . $Account . "' AND period='" . $Period - 1 . "') WHERE accountcode='" . $Account . "' AND period>= " . $Period; + $ErrMsg = _('Failed to update the bfwd amount'); + $BfwdResult = DB_query($sql,$ErrMsg); + } } } |
From: <ex...@us...> - 2016-03-09 01:54:39
|
Revision: 7466 http://sourceforge.net/p/web-erp/reponame/7466 Author: exsonqu Date: 2016-03-09 01:54:37 +0000 (Wed, 09 Mar 2016) Log Message: ----------- 03/09/16 Exson: Fixed the typo which make sql query failed in GLPostings.inc. Modified Paths: -------------- trunk/includes/GLPostings.inc Modified: trunk/includes/GLPostings.inc =================================================================== --- trunk/includes/GLPostings.inc 2016-03-02 23:23:45 UTC (rev 7465) +++ trunk/includes/GLPostings.inc 2016-03-09 01:54:37 UTC (rev 7466) @@ -60,7 +60,7 @@ LEFT JOIN chartdetails ON chartmaster.accountcode=chartdetails.accountcode AND periods.periodno=chartdetails.period WHERE (periods.periodno BETWEEN '" . $CreateFrom . "' AND '" . $CreateTo . "') - AND chartdetails.account code IS NULL ORDER BY accountcode,periodno"; + AND chartdetails.accountcode IS NULL ORDER BY accountcode,periodno"; $ErrMsg = _('Failed to retrieve new account code and periods'); $NewPeriodResult = DB_query($sql,$ErrMsg); if (DB_num_rows($result)>0){ |
From: <ex...@us...> - 2017-06-18 10:04:54
|
Revision: 7773 http://sourceforge.net/p/web-erp/reponame/7773 Author: exsonqu Date: 2017-06-18 10:04:51 +0000 (Sun, 18 Jun 2017) Log Message: ----------- 18/06/17 Exson: Fixed a typo in GLPostings.inc. Modified Paths: -------------- trunk/includes/GLPostings.inc Modified: trunk/includes/GLPostings.inc =================================================================== --- trunk/includes/GLPostings.inc 2017-06-18 09:30:06 UTC (rev 7772) +++ trunk/includes/GLPostings.inc 2017-06-18 10:04:51 UTC (rev 7773) @@ -63,11 +63,11 @@ AND chartdetails.accountcode IS NULL ORDER BY accountcode,periodno"; $ErrMsg = _('Failed to retrieve new account code and periods'); $NewPeriodResult = DB_query($sql,$ErrMsg); - if (DB_num_rows($result)>0){ + if (DB_num_rows($NewPeriodResult)>0){ $NewPeriods = array(); while ($NewPeriodsRow = DB_fetch_array($NewPeriodResult)) { if (!isset($NewPeriods[$NewPeriodsRow['accountcode']])) { - $NewPeriods[$NewPeriodsRow['accountcode']] = $NewPeriodsRow['period']; + $NewPeriods[$NewPeriodsRow['accountcode']] = $NewPeriodsRow['periods']; } } /*Now insert the chartdetails records that do not already exist */ |