[Weberp-svn] SF.net SVN: weberp:[5301] trunk
Brought to you by:
sotandeka,
tim_schofield
From: <tim...@us...> - 2011-05-13 19:40:36
|
Revision: 5301 http://weberp.svn.sourceforge.net/weberp/?rev=5301&view=rev Author: tim_schofield Date: 2011-05-13 19:40:29 +0000 (Fri, 13 May 2011) Log Message: ----------- Improvements to Bank reconciliation and bank matching Modified Paths: -------------- trunk/BankMatching.php trunk/BankReconciliation.php Modified: trunk/BankMatching.php =================================================================== --- trunk/BankMatching.php 2011-05-13 19:39:21 UTC (rev 5300) +++ trunk/BankMatching.php 2011-05-13 19:40:29 UTC (rev 5301) @@ -1,10 +1,8 @@ <?php -/* $Revision: 1.23 $ */ + /* $Id$*/ -//$PageSecurity = 7; - -include("includes/session.inc"); +include('includes/session.inc'); $title = _('Bank Account Matching'); include('includes/header.inc'); @@ -29,9 +27,16 @@ exit; } +if (isset($_GET['Account'])) { + $_POST['BankAccount']=$_GET['Account']; + $_POST['ShowTransactions']=true; + $_POST['Ostg_or_All']='Ostg'; + $_POST['First20_or_All']='All'; +} + if (isset($_POST['Update']) AND $_POST['RowCounter']>1){ for ($Counter=1;$Counter <= $_POST['RowCounter']; $Counter++){ - if (isset($_POST["Clear_" . $Counter]) and $_POST["Clear_" . $Counter]==True){ + if (isset($_POST['Clear_' . $Counter]) and $_POST['Clear_' . $Counter]==True){ /*Get amount to be cleared */ $sql = "SELECT amount, exrate @@ -83,9 +88,9 @@ $resultBankActs = DB_query($sql,$db); while ($myrow=DB_fetch_array($resultBankActs)){ if (isset($_POST['BankAccount']) and $myrow['accountcode']==$_POST['BankAccount']){ - echo "<option selected Value='" . $myrow['accountcode'] . "'>" . $myrow['bankaccountname']; + echo '<option selected Value="' . $myrow['accountcode'] . '">' . $myrow['bankaccountname'] . '</option>'; } else { - echo "<option Value='" . $myrow['accountcode'] . "'>" . $myrow['bankaccountname']; + echo '<option Value="' . $myrow['accountcode'] . '">' . $myrow['bankaccountname'] . '</option>'; } } @@ -108,30 +113,34 @@ <td><select tabindex="4" name="Ostg_or_All">'; if ($_POST['Ostg_or_All']=='All'){ - echo '<option selected Value="All">' . _('Show all') . ' ' . $TypeName . ' ' . _('in the date range'); - echo '<option Value="Ostdg">' . _('Show unmatched') . ' ' . $TypeName . ' ' . _('only'); + echo '<option selected Value="All">' . _('Show all') . ' ' . $TypeName . ' ' . _('in the date range') . '</option>'; + echo '<option Value="Ostdg">' . _('Show unmatched') . ' ' . $TypeName . ' ' . _('only') . '</option>'; } else { echo '<option Value="All">' . _('Show all') . ' ' . $TypeName . ' ' . _('in the date range'); - echo '<option selected Value="Ostdg">' . _('Show unmatched') . ' ' . $TypeName . ' ' . _('only'); + echo '<option selected Value="Ostdg">' . _('Show unmatched') . ' ' . $TypeName . ' ' . _('only') . '</option>'; } echo '</select></td></tr>'; echo '<tr><td colspan=3>' . _('Choose to display only the first 20 matching') . ' ' . $TypeName . ' ' . _('or all') . ' ' . $TypeName . ' ' . _('meeting the criteria') . ':</td><td><select tabindex="5" name="First20_or_All">'; if ($_POST['First20_or_All']=='All'){ - echo '<option selected Value="All">' . _('Show all') . ' ' . $TypeName . ' ' . _('in the date range'); - echo '<option Value="First20">' . _('Show only the first 20') . ' ' . $TypeName; + echo '<option selected Value="All">' . _('Show all') . ' ' . $TypeName . ' ' . _('in the date range') . '</option>'; + echo '<option Value="First20">' . _('Show only the first 20') . ' ' . $TypeName . '</option>'; } else { - echo '<option Value="All">' . _('Show all') . ' ' . $TypeName . ' ' . _('in the date range'); - echo '<option selected Value="First20">' . _('Show only the first 20') . ' ' . $TypeName; + echo '<option Value="All">' . _('Show all') . ' ' . $TypeName . ' ' . _('in the date range') . '</option>'; + echo '<option selected Value="First20">' . _('Show only the first 20') . ' ' . $TypeName . '</option>'; } echo '</select></td></tr>'; echo '</table><br><div class="centre"><input tabindex="6" type=submit name="ShowTransactions" VALUE="' . _('Show selected') . ' ' . $TypeName . '">'; -echo "<p><a href='$rootpath/BankReconciliation.php?" . SID . "'>" . _('Show reconciliation') . '</a></div>'; -echo '<hr>'; +if (isset($_POST['BankAccount'])) { + echo '<p><a href="'.$rootpath.'/BankReconciliation.php?Account='.$_POST['BankAccount'].'">' . _('Show reconciliation') . '</a></div>'; +} else { + echo '<p><a href="'.$rootpath.'/BankReconciliation.php">' . _('Show reconciliation') . '</a></div>'; +} + $InputError=0; if (!Is_Date($_POST['BeforeDate'])){ $InputError =1; @@ -151,10 +160,11 @@ $SQLBeforeDate = FormatDateForSQL($_POST['BeforeDate']); $SQLAfterDate = FormatDateForSQL($_POST['AfterDate']); - if ($_POST["Ostg_or_All"]=='All'){ + if ($_POST['Ostg_or_All']=='All'){ if ($Type=='Payments'){ $sql = "SELECT banktransid, ref, + chequeno, amountcleared, transdate, amount/exrate as amt, @@ -169,6 +179,7 @@ } else { /* Type must == Receipts */ $sql = "SELECT banktransid, ref, + chequeno, amountcleared, transdate, amount/exrate as amt, @@ -184,6 +195,7 @@ if ($Type=='Payments'){ $sql = "SELECT banktransid, ref, + chequeno, amountcleared, transdate, amount/exrate as amt, @@ -198,6 +210,7 @@ } else { /* Type must == Receipts */ $sql = "SELECT banktransid, ref, + chequeno, amountcleared, transdate, amount/exrate as amt, @@ -211,14 +224,15 @@ ORDER BY transdate"; } } - if ($_POST["First20_or_All"]!='All'){ + if ($_POST['First20_or_All']!='All'){ $sql = $sql . " LIMIT 20"; } $ErrMsg = _('The payments with the selected criteria could not be retrieved because'); $PaymentsResult = DB_query($sql, $db, $ErrMsg); - $TableHeader = '<tr><th>'. _('Ref'). '</th> + $TableHeader = '<tr><th>'. _('Cheque No') . '</th> + <th>' . _('Ref') . '</th> <th>' . $TypeName . '</th> <th>' . _('Date') . '</th> <th>' . _('Amount') . '</th> @@ -238,15 +252,17 @@ $Outstanding = $myrow['amt']- $myrow['amountcleared']; if (ABS($Outstanding)<0.009){ /*the payment is cleared dont show the check box*/ - printf("<tr bgcolor='#CCCEEE'> + printf('<tr bgcolor="#CCCEEE"> <td>%s</td> <td>%s</td> <td>%s</td> + <td>%s</td> <td class=number>%s</td> <td class=number>%s</td> <td colspan=2>%s</td> - <td><input type='checkbox' name='Unclear_%s'><input type=hidden name='BankTrans_%s' VALUE=%s></td> - </tr>", + <td><input type="checkbox" name="Unclear_%s"><input type=hidden name="BankTrans_%s" VALUE=%s></td> + </tr>', + $myrow['chequeno'], $myrow['ref'], $myrow['banktranstype'], $DisplayTranDate, @@ -266,14 +282,16 @@ $k=1; } - printf("<td>%s</td> + printf('<td>%s</td> <td>%s</td> <td>%s</td> + <td>%s</td> <td class=number>%s</td> <td class=number>%s</td> - <td><input type='checkbox' name='Clear_%s'><input type=hidden name='BankTrans_%s' VALUE=%s></td> - <td colspan=2><input type='text' maxlength=15 size=15 class=number name='AmtClear_%s'></td> - </tr>", + <td><input type="checkbox" name="Clear_%s"><input type=hidden name="BankTrans_%s" VALUE=%s></td> + <td colspan=2><input type="text" maxlength=15 size=15 class=number name="AmtClear_%s"></td> + </tr>', + $myrow['chequeno'], $myrow['ref'], $myrow['banktranstype'], $DisplayTranDate, @@ -302,4 +320,4 @@ echo '</form>'; include('includes/footer.inc'); -?> +?> \ No newline at end of file Modified: trunk/BankReconciliation.php =================================================================== --- trunk/BankReconciliation.php 2011-05-13 19:39:21 UTC (rev 5300) +++ trunk/BankReconciliation.php 2011-05-13 19:40:29 UTC (rev 5301) @@ -1,10 +1,7 @@ <?php -/* $Revision: 1.15 $ */ /* $Id$*/ -//$PageSecurity = 7; - include ('includes/session.inc'); $title = _('Bank Reconciliation'); @@ -13,12 +10,18 @@ echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '?' . SID . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; +echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/money_add.png" title="' . _('Search') . '" alt="" />' . ' ' . $title.'</p><br />'; +if (isset($_GET['Account'])) { + $_POST['BankAccount']=$_GET['Account']; + $_POST['ShowRec']=true; +} + if (isset($_POST['PostExchangeDifference']) and is_numeric($_POST['DoExchangeDifference'])){ - if (!is_numeric($_POST['BankStatmentBalance'])){ + if (!is_numeric($_POST['BankStatementBalance'])){ prnMsg(_('The entry in the bank statement balance is not numeric. The balance on the bank statement should be entered. The exchange difference has not been calculated and no general ledger journal has been created'),'warn'); - echo '<p>' . $_POST['BankStatmentBalance']; + echo '<p>' . $_POST['BankStatementBalance']; } else { /* Now need to get the currency of the account and the current table ex rate */ $SQL = "SELECT rate, bankaccountname @@ -33,7 +36,7 @@ $BankAccountName = $CurrencyRow[1]; $CalculatedBalance = $_POST['DoExchangeDifference']; - $ExchangeDifference = ($CalculatedBalance - $_POST['BankStatmentBalance'])/$ExRate; + $ExchangeDifference = ($CalculatedBalance - $_POST['BankStatementBalance'])/$ExRate; include ('includes/SQL_CommonFunctions.inc'); $ExDiffTransNo = GetNextTransNo(36,$db); @@ -86,7 +89,7 @@ -echo '<table>'; +echo '<table class="selection">'; $SQL = "SELECT bankaccountname, accountcode FROM bankaccounts"; @@ -97,7 +100,8 @@ echo '<tr><td>' . _('Bank Account') . ':</td><td><select tabindex="1" name="BankAccount">'; if (DB_num_rows($AccountsResults)==0){ - echo '</select></td></tr></table><p>' . _('Bank Accounts have not yet been defined') . '. ' . _('You must first') . "<a href='" . $rootpath . "/BankAccounts.php'>" . _('define the bank accounts') . '</a>' . ' ' . _('and general ledger accounts to be affected') . '.'; + echo '</select></td></tr></table><p>' . _('Bank Accounts have not yet been defined') . '. ' . _('You must first') . + '<a href="' . $rootpath . '/BankAccounts.php">' . _('define the bank accounts') . '</a>' . ' ' . _('and general ledger accounts to be affected') . '.'; include('includes/footer.inc'); exit; } else { @@ -163,6 +167,7 @@ amountcleared, (amount/exrate)-amountcleared as outstanding, ref, + chequeno, transdate, systypes.typename, transno @@ -185,6 +190,7 @@ <th>' . _('Type') . '</th> <th>' . _('Number') . '</th> <th>' . _('Reference') . '</th> + <th>' . _('Cheque No') . '</th> <th>' . _('Orig Amount') . '</th> <th>' . _('Outstanding') . '</th> </tr>'; @@ -208,6 +214,7 @@ <td>%s</td> <td>%s</td> <td>%s</td> + <td>%s</td> <td class=number>%01.2f</td> <td class=number>%01.2f</td> </tr>', @@ -215,6 +222,7 @@ $myrow['typename'], $myrow['transno'], $myrow['ref'], + $myrow['chequeno'], $myrow['amt'], $myrow['outstanding']); @@ -234,6 +242,7 @@ amountcleared, (amount/exrate)-amountcleared as outstanding, ref, + chequeno, transdate, systypes.typename, transno @@ -257,6 +266,7 @@ <th>' . _('Type') . '</th> <th>' . _('Number') . '</th> <th>' . _('Reference') . '</th> + <th>' . _('Cheque No') . '</th> <th>' . _('Orig Amount') . '</th> <th>' . _('Outstanding') . '</th> </tr>'; @@ -280,6 +290,7 @@ <td>%s</td> <td>%s</td> <td>%s</td> + <td>%s</td> <td class=number>%01.2f</td> <td class=number>%01.2f</td> </tr>', @@ -287,6 +298,7 @@ $myrow['typename'], $myrow['transno'], $myrow['ref'], + $myrow['chequeno'], $myrow['amt'], $myrow['outstanding'] ); @@ -307,7 +319,7 @@ if (isset($_POST['DoExchangeDifference'])){ echo '<input type="hidden" name="DoExchangeDifference" value=' . $FXStatementBalance . '>'; echo '<tr><td colspan=6>' . _('Enter the actual bank statement balance') . ' (' . $BankCurrCode . ')</b></td> - <td class=number><input type="text" name="BankStatmentBalance" maxlength=15 size=15 value=' . $_POST['BankStatmentBalance'] . '><td></tr>'; + <td class=number><input type="text" name="BankStatementBalance" maxlength=15 size=15 value=' . $_POST['BankStatementBalance'] . '><td></tr>'; echo '<tr><td colspan=7 align="center"><input type="submit" name="PostExchangeDifference" value="' . _('Calculate and Post Exchange Difference') . '" onclick="return confirm(\'' . _('This will create a general ledger journal to write off the exchange difference in the current balance of the account. It is important that the exchange rate above reflects the current value of the bank account currency') . ' - ' . _('Are You Sure?') . '\');"></td></tr>'; } @@ -323,8 +335,13 @@ echo '</table>'; } -echo '<p><div class="centre"><a tabindex="4" href="' . $rootpath . '/BankMatching.php?' . SID . '&Type=Payments">' . _('Match off cleared payments') . '</a>'; -echo '<br><a tabindex="5" href="' . $rootpath . '/BankMatching.php?' . SID . '&Type=Receipts">' . _('Match off cleared deposits') . '</a></div>'; +if (isset($_POST['BankAccount'])) { + echo '<p><div class="centre"><a tabindex="4" href="' . $rootpath . '/BankMatching.php?Type=Payments&Account='.$_POST['BankAccount'].'">' . _('Match off cleared payments') . '</a>'; + echo '<br><a tabindex="5" href="' . $rootpath . '/BankMatching.php?Type=Receipts&Account='.$_POST['BankAccount'].'">' . _('Match off cleared deposits') . '</a></div>'; +} else { + echo '<p><div class="centre"><a tabindex="4" href="' . $rootpath . '/BankMatching.php?Type=Payments">' . _('Match off cleared payments') . '</a>'; + echo '<br><a tabindex="5" href="' . $rootpath . '/BankMatching.php?Type=Receipts">' . _('Match off cleared deposits') . '</a></div>'; +} echo '</form>'; include('includes/footer.inc'); -?> +?> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |