|
From: <dai...@us...> - 2014-09-13 04:12:59
|
Revision: 6883
http://sourceforge.net/p/web-erp/reponame/6883
Author: daintree
Date: 2014-09-13 04:12:51 +0000 (Sat, 13 Sep 2014)
Log Message:
-----------
Use global decimal point and thousands separator
Modified Paths:
--------------
trunk/ImportBankTrans.php
trunk/SalesGraph.php
trunk/sql/mysql/upgrade4.11-4.12.sql
Modified: trunk/ImportBankTrans.php
===================================================================
--- trunk/ImportBankTrans.php 2014-09-13 03:12:46 UTC (rev 6882)
+++ trunk/ImportBankTrans.php 2014-09-13 04:12:51 UTC (rev 6883)
@@ -34,6 +34,9 @@
//But check for the worst
if ($_FILES['ImportFile']['size'] > (1024*1024)) { //File Size Check
prnMsg(_('The file size is over the maximum allowed. The maximum size allowed is 1 megabyte'),'warn');
+ prnMsg(_('The MT940 bank statement file cannot be imported and processed'),'error');
+ include('includes/footer.inc');
+ exit;
$ReadTheFile ='No';
}
@@ -42,11 +45,6 @@
$ReadTheFile ='No';
} */
- if ($ReadTheFile=='No'){
- prnMsg(_('The MT940 bank statement file cannot be imported and processed'),'error');
- include('includes/footer.inc');
- exit;
- }
$fp = fopen($_FILES['ImportFile']['tmp_name'], 'r');
$TransactionLine = false;
@@ -57,91 +55,9 @@
$_SESSION['Statement']->FileName = $_FILES['ImportFile']['tmp_name'];
while ($LineText = fgets($fp)){ /* get each line of the order file */
- /*
- * This block of code could be in an include and different includes included depending on which type of transaction file is being imported
- * */
+ include('includes/ImportBankTrans_MT940_SCB.php'); //for Siam Commercial Bank Thailand
+ //for ING Bank Netherlands include('includes/ImportBankTrans_MT940_ING.php');
- if (substr($LineText,0,4)==':20:'){ //Timestamp of report MT940 generation
- $_SESSION['Statement']->ReportCreated = substr($LineText,4); //in format DDDHHMM where DDD is the number of day in year and HHMM is the time
- $TransactionLine = false;
- }
- if (substr($LineText,0,4)==':25:'){//The account number in IBAN format
- $_SESSION['Statement']->AccountNumber = trim(substr($LineText,4));
- $TransactionLine = false;
- }
- if (substr($LineText,0,5)==':28C:'){//The statement number
- $_SESSION['Statement']->StatementNumber = trim(substr($LineText,5));
- $TransactionLine = false;
- }
- if (substr($LineText,0,6)==':NS:22'){//The account owner name
- $_SESSION['Statement']->AccountOwner = trim(substr($LineText,6));
- $TransactionLine = false;
- }
- if (substr($LineText,0,6)==':NS:23'){//The account name
- $_SESSION['Statement']->AccountName = trim(substr($LineText,6));
- $TransactionLine = false;
- }
- if (substr($LineText,0,5)==':60F:'){//The account opening balance
- $DebitOrCredit = substr($LineText,5,1); //D or C
- $_SESSION['Statement']->OpeningDate = ConvertSQLDate('20' . substr($LineText,6,2) . '-' . substr($LineText,8,2) . '-' . substr($LineText,10,2));
- $_SESSION['Statement']->CurrCode = substr($LineText,12,3);
- if ($DebitOrCredit =='D'){
- $_SESSION['Statement']->OpeningBalance = doubleval(str_replace(',','.',substr($LineText,15)));
- } else {
- $_SESSION['Statement']->OpeningBalance = doubleval('-' . str_replace(',','.',substr($LineText,15)));
- }
- $TransactionLine = false;
- }
- if (substr($LineText,0,4)==':61:'){//It's a transaction line
- $TransactionLine = true;
- $TransDate = ConvertSQLDate('20' . substr($LineText,4,2) . '-' . substr($LineText,6,2) . '-' . substr($LineText,8,2));
- $DebitOrCredit = substr($LineText,10,1); //D or C or R
- if ($DebitOrCredit =='R'){ //then it is a 2 character reversal
- if (substr($LineText,10,2)=='RC'){
- $DebitOrCredit ='D';
- } else {
- $DebitOrCredit ='C';
- }
- if ($DebitOrCredit =='D'){
- $TransAmount = doubleval(str_replace(',','.',substr($LineText,12,-10)));
- } else {
- $TransAmount = doubleval('-' . str_replace(',','.',substr($LineText,12,-10)));
- }
- } else { // it will be either D or C
- if ($DebitOrCredit =='D'){
- $TransAmount = doubleval(str_replace(',','.',substr($LineText,11,-10)));
- } else {
- $TransAmount = doubleval('-' . str_replace(',','.',substr($LineText,11,-10)));
- }
- }
- $i++;
- $_SESSION['Trans'][$i] = new BankTrans($TransDate,$TransAmount) ;
- }
- if (substr($LineText,0,4)==':86:'){
- if ($TransactionLine) {
- $_SESSION['Trans'][$i]->Code = substr($LineText,4,3);
- $_SESSION['Trans'][$i]->Description = substr($LineText,7);
- }
- }
-
- if (substr($LineText,0,1)!=':' AND $TransactionLine){
- //then it is the continuation of an :86: line
- $_SESSION['Trans'][$i]->Description .= $LineText;
- }
-
- if (substr($LineText,0,5)==':62F:'){
- $DebitOrCredit = substr($LineText,5,1); //D or C
- $_SESSION['Statement']->ClosingDate = ConvertSQLDate('20' . substr($LineText,6,2) . '-' . substr($LineText,8,2) . '-' . substr($LineText,10,2));
- $CurrCode = substr($LineText,12,3);
- if ($DebitOrCredit =='D'){
- $_SESSION['Statement']->ClosingBalance = doubleval(str_replace(',','.',substr($LineText,15)));
- } else {
- $_SESSION['Statement']->ClosingBalance = doubleval('-' . str_replace(',','.',substr($LineText,15)));
- }
- $TransactionLine = false;
- }
- /* end of MT940 specific import code - that could be in an include if we get other file formats
- * */
} /*end while get next line of message */
/* Look to match up the account for which transactions are being imported with a bank account in webERP */
Modified: trunk/SalesGraph.php
===================================================================
--- trunk/SalesGraph.php 2014-09-13 03:12:46 UTC (rev 6882)
+++ trunk/SalesGraph.php 2014-09-13 04:12:51 UTC (rev 6883)
@@ -161,19 +161,21 @@
<td>' . $_POST['SalesmanCode'] . '</td>
</tr>';
- echo '<tr><td>' . _('Graph Type') . '</td>';
- echo '<td><select name="GraphType">';
- echo '<option value="bars">' . _('Bar Graph') . '</option>';
- echo '<option value="stackedbars">' . _('Stacked Bar Graph') . '</option>';
- echo '<option value="lines">' . _('Line Graph') . '</option>';
- echo '<option value="linepoints">' . _('Line Point Graph') . '</option>';
- echo '<option value="area">' . _('Area Graph') . '</option>';
- echo '<option value="points">' . _('Points Graph') . '</option>';
- echo '<option value="pie">' . _('Pie Graph') . '</option>';
- echo '<option value="thinbarline">' . _('Thin Bar Line Graph') . '</option>';
- echo '<option value="squared">' . _('Squared Graph') . '</option>';
- echo '<option value="stackedarea">' . _('Stacked Area Graph') . '</option>';
- echo '</select></td></tr>';
+ echo '<tr>
+ <td>' . _('Graph Type') . '</td
+ <td><select name="GraphType">
+ <option value="bars">' . _('Bar Graph') . '</option>
+ <option value="stackedbars">' . _('Stacked Bar Graph') . '</option>
+ <option value="lines">' . _('Line Graph') . '</option>
+ <option value="linepoints">' . _('Line Point Graph') . '</option>
+ <option value="area">' . _('Area Graph') . '</option>
+ <option value="points">' . _('Points Graph') . '</option>
+ <option value="pie">' . _('Pie Graph') . '</option>
+ <option value="thinbarline">' . _('Thin Bar Line Graph') . '</option>
+ <option value="squared">' . _('Squared Graph') . '</option>
+ <option value="stackedarea">' . _('Stacked Area Graph') . '</option>
+ </select></td>
+ </tr>';
if (!isset($_POST['ValueFrom'])){
$_POST['ValueFrom']='';
@@ -188,16 +190,17 @@
echo '<tr><td>' . _('From:') . ' <input type="text" name="ValueFrom" value="' . $_POST['ValueFrom'] . '" /></td>
<td>' . _('To:') . ' <input type="text" name="ValueTo" value="' . $_POST['ValueTo'] . '" /></td></tr>';
- echo '<tr><td>' . _('Graph Value:') . '</td><td>
- <input type="radio" name="GraphValue" value="Net" checked="checked" />' . _('Net Sales Value') . '<br />
- <input type="radio" name="GraphValue" value="GP" />' . _('Gross Profit') . '<br />
- <input type="radio" name="GraphValue" value="Quantity" />' . _('Quantity') . '</td></tr>';
-
- echo '</table>';
-
- echo '<br /><div class="centre"><input type="submit" name="ShowGraph" value="' . _('Show Sales Graph') .'" /></div>';
- echo '</div>
- </form>';
+ echo '<tr>
+ <td>' . _('Graph Value:') . '</td>
+ <td><input type="radio" name="GraphValue" value="Net" checked="checked" />' . _('Net Sales Value') . '<br />
+ <input type="radio" name="GraphValue" value="GP" />' . _('Gross Profit') . '<br />
+ <input type="radio" name="GraphValue" value="Quantity" />' . _('Quantity') . '</td>
+ </tr>
+ </table>
+ <br />
+ <div class="centre"><input type="submit" name="ShowGraph" value="' . _('Show Sales Graph') .'" /></div>
+ </div>
+ </form>';
include('includes/footer.inc');
} else {
@@ -286,7 +289,7 @@
$graph->SetShading(5);
$graph->SetDrawYGrid(TRUE);
$graph->SetDataType('text-data');
- $graph->SetNumberFormat('.', ',');
+ $graph->SetNumberFormat($DecimalPoint, $ThousandsSeparator);
$graph->SetPrecisionY($_SESSION['CompanyRecord']['decimalplaces']);
$SalesResult = DB_query($SQL, $db);
@@ -319,11 +322,10 @@
//Draw it
$graph->DrawGraph();
echo '<table class="selection">
- <tr><td>';
- echo '<p><img src="companies/' .$_SESSION['DatabaseName'] . '/reports/salesgraph.png" alt="Sales Report Graph"></img></p>';
- echo '</td>
- </tr>
- </table>';
+ <tr>
+ <td><p><img src="companies/' .$_SESSION['DatabaseName'] . '/reports/salesgraph.png" alt="Sales Report Graph"></img></p></td>
+ </tr>
+ </table>';
include('includes/footer.inc');
}
?>
\ No newline at end of file
Modified: trunk/sql/mysql/upgrade4.11-4.12.sql
===================================================================
--- trunk/sql/mysql/upgrade4.11-4.12.sql 2014-09-13 03:12:46 UTC (rev 6882)
+++ trunk/sql/mysql/upgrade4.11-4.12.sql 2014-09-13 04:12:51 UTC (rev 6883)
@@ -74,7 +74,7 @@
ON www_users.userid = locationusers.userid
AND locations.loccode = locationusers.loccode
WHERE locationusers.userid IS NULL;
-
+
ALTER TABLE `mrpparameters` ADD `userldemands` VARCHAR( 5 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'use RL requirements or not' AFTER `usemrpdemands`;
INSERT INTO `scripts` ( `script` , `pagesecurity` , `description` ) VALUES ('WOCanBeProducedNow.php', '4', 'List of WO items that can be produced with available stock in location');
|