From: <dai...@us...> - 2014-09-17 08:32:47
|
Revision: 6893 http://sourceforge.net/p/web-erp/reponame/6893 Author: daintree Date: 2014-09-17 08:32:43 +0000 (Wed, 17 Sep 2014) Log Message: ----------- Import GIFTS format bank transactions Modified Paths: -------------- trunk/BankAccounts.php trunk/ImportBankTrans.php trunk/doc/Change.log trunk/includes/session.inc Added Paths: ----------- trunk/includes/ImportBankTrans_GIFTS.php Modified: trunk/BankAccounts.php =================================================================== --- trunk/BankAccounts.php 2014-09-16 07:27:40 UTC (rev 6892) +++ trunk/BankAccounts.php 2014-09-17 08:32:43 UTC (rev 6893) @@ -367,6 +367,7 @@ <option ' . ($_POST['ImportFormat']=='' ? 'selected="selected"' : '') . ' value="">' . _('N/A') . '</option> <option ' . ($_POST['ImportFormat']=='MT940-SCB' ? 'selected="selected"' : '') . ' value="MT940-SCB">' . _('MT940 - Siam Comercial Bank Thailand') . '</option> <option ' . ($_POST['ImportFormat']=='MT940-ING' ? 'selected="selected"' : '') . ' value="MT940-ING">' . _('MT940 - ING Bank Netherlands') . '</option> + <option ' . ($_POST['ImportFormat']=='GIFTS' ? 'selected="selected"' : '') . ' value="GIFTS">' . _('GIFTS - Bank of New Zealand') . '</option> </select> </td> </tr> Modified: trunk/ImportBankTrans.php =================================================================== --- trunk/ImportBankTrans.php 2014-09-16 07:27:40 UTC (rev 6892) +++ trunk/ImportBankTrans.php 2014-09-17 08:32:43 UTC (rev 6893) @@ -89,10 +89,17 @@ break; case 'MT940-ING': //for ING Bank Netherlands include('includes/ImportBankTrans_MT940_ING.php'); + break; + case 'GIFTS': //GIFTS for Bank of New Zealand + include('includes/ImportBankTrans_GIFTS.php'); + break; } } /*end while get next line of message */ + if (!isset($_SESSION['Statement']->CurrCode)){ + $_SESSION['Statement']->CurrCode = $_SESSION['CompanyRecord']['currencydefault']; + } /* Look to match up the account for which transactions are being imported with a bank account in webERP */ $sql = "SELECT accountcode, bankaccountname, @@ -473,6 +480,9 @@ if (isset($_SESSION['Statement'])){ + //print_r($_SESSION['Statement']); + + echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post" >'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; if (!isset($_SESSION['Statement']->BankGLAccount)){ Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2014-09-16 07:27:40 UTC (rev 6892) +++ trunk/doc/Change.log 2014-09-17 08:32:43 UTC (rev 6893) @@ -1,5 +1,9 @@ webERP Change Log -15/09/14 Exson: fixed the date format errors in WorkOrderEntry.php. + + +17/9/14 Phil: Moved the audit log purge to occur if DB_Maintenance is set to run +16/9/14 Phil: Added BNZ GIFTS format for bank account transaction imports +15/09/14 Exson: fixed the date format errors in WorkOrderEntry.php. 13/9/14 Phil: Added new MT940 - SCB - Siam Comercial Bank Thailand style - a bit different to ING's style. Modifications to BankAccounts.php to allow the transaction file format for imports. ImportBankTrans.php must now select the bank account to determine the file import format to use. It now uses an include for the file parsing so other formats can easily be accomodated with a new include. 11/09/14 RChacon: Adds gettext() to line 402 of CustomerAllocations.php. Reported by Harald. 11/09/14 Exson: Code tidy up to make it meet coding guidance in CustomerInquiry.php. Added: trunk/includes/ImportBankTrans_GIFTS.php =================================================================== --- trunk/includes/ImportBankTrans_GIFTS.php (rev 0) +++ trunk/includes/ImportBankTrans_GIFTS.php 2014-09-17 08:32:43 UTC (rev 6893) @@ -0,0 +1,22 @@ +<?php +/* GIFTS format Bank of New Zealand */ +$LineText = mb_substr($LineText,0,-1); +$LineArray = explode(',',$LineText); +if ($LineArray[0] == 5) { //Opening balance + $_SESSION['Statement']->AccountNumber = trim($LineArray[2],'"'); + $_SESSION['Statement']->OpeningBalance = doubleval($LineArray[3]); + $_SESSION['Statement']->OpeningDate = trim($LineArray[10],'"'); + $_SESSION['Statement']->AccountName = trim($LineArray[9],'"'); +} +if ($LineArray[0] == 6) { //Closing balance + $_SESSION['Statement']->AccountNumber = trim($LineArray[2],'"'); + $_SESSION['Statement']->ClosingBalance = doubleval($LineArray[3]); + $_SESSION['Statement']->ClosingDate = trim($LineArray[10],'"'); +} +if ($LineArray[0] == 3) {//A Transaction Line + $i++; + $_SESSION['Trans'][$i] = new BankTrans(trim($LineArray[10],'"'),doubleval(-$LineArray[3])) ; + $_SESSION['Trans'][$i]->Description = trim($LineArray[12],'"') . '-' . trim($LineArray[6],'"') . ' ' . trim($LineArray[7],'"') . ' ' . trim($LineArray[8],'"') . ' ' . trim($LineArray[9],'"') . ' ' . trim($LineArray[11],'"') . ' ' . trim($LineArray[14],'"'); +} + +?> \ No newline at end of file Modified: trunk/includes/session.inc =================================================================== --- trunk/includes/session.inc 2014-09-16 07:27:40 UTC (rev 6892) +++ trunk/includes/session.inc 2014-09-17 08:32:43 UTC (rev 6893) @@ -140,6 +140,7 @@ if (strcmp($Version,$_SESSION['VersionNumber'])>0 AND (basename($_SERVER['SCRIPT_NAME'])!='UpgradeDatabase.php')) { header('Location: UpgradeDatabase.php'); } + if(isset($_SESSION['DB_Maintenance'])){ if ($_SESSION['DB_Maintenance']>0) { //run the DB maintenance script if (DateDiff(Date($_SESSION['DefaultDateFormat']), @@ -149,19 +150,22 @@ /*Do the DB maintenance routing for the DB_type selected */ DB_Maintenance($db); $_SESSION['DB_Maintenance_LastRun'] = Date('Y-m-d'); + + /* Audit trail purge only runs if DB_Maintenance is enabled */ + if (isset($_SESSION['MonthsAuditTrail'])){ + $sql = "DELETE FROM audittrail + WHERE transactiondate <= '" . Date('Y-m-d', mktime(0,0,0, Date('m')-$_SESSION['MonthsAuditTrail'])) . "'"; + $ErrMsg = _('There was a problem deleting expired audit-trail history'); + $result = DB_query($sql,$db); + } } } } -//purge the audit trail if necessary -if (isset($_SESSION['MonthsAuditTrail'])){ - $sql = "DELETE FROM audittrail - WHERE transactiondate <= '" . Date('Y-m-d', mktime(0,0,0, Date('m')-$_SESSION['MonthsAuditTrail'])) . "'"; - $ErrMsg = _('There was a problem deleting expired audit-trail history'); - $result = DB_query($sql,$db); -} + /*Check to see if currency rates need to be updated */ if (isset($_SESSION['UpdateCurrencyRatesDaily'])){ if ($_SESSION['UpdateCurrencyRatesDaily']!=0) { + /* Only run the update to currency rates if today is after the last update i.e. only runs once a day */ if (DateDiff(Date($_SESSION['DefaultDateFormat']), ConvertSQLDate($_SESSION['UpdateCurrencyRatesDaily']),'d')> 0){ |