Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
GL Balance Sheet Bad Hyperlink - SOLVED?
12-09-2018, 11:26 PM
Post: #11
RE: GL Balance Sheet Bad Hyperlink - SOLVED
Well a balance sheet is a report at a point in time rather than over a period, so there are 3 possibilities:

1 Just the period that the report is for, so a balance sheet up to December 2018 would just default to showing the transactions for December 2018 - Easiest to code, but perhaps least useful from an accountants point of view.

2 All transactions from the beginning of time. The account balance in a balance sheet account is made up of all transactions ever posted to that account, unlike P&L accounts which are just made up of transactions for that period. So if the balance on the account is 123456.78 then perhaps it is most obvious to show all the transactions that make up that balance - Easy enough to code, but could potentially produce a very big inquiry.

3 Just transactions for the financial period that the report period is in. So if it was a balance sheet up to 31/12/2018 and the financial year started on 1/4/2018 then it would just show the transactions for those 9 months - This is trickier to code and get right, and is a sort of compromise between 1 & 2.

It's not immediately obvious which of the above to choose, probably 3 is the best compromise as suggested by Paul. Remember that whatever is chosen here can be overridden on the inquiry screen.

Tim
Visit this user's website Find all posts by this user
Quote this message in a reply
12-09-2018, 11:49 PM (This post was last modified: 12-09-2018 11:51 PM by VortecCPI.)
Post: #12
RE: GL Balance Sheet Bad Hyperlink - SOLVED
I believe with the amount of data many uses may have #3 is likely the best starting place.

Perhaps this is why the hyperlink had no PeriodFrom in the first place?
Also... Thank you all so much for your help and feedback on these topics!

https://www.linkedin.com/in/eclipsepaulbecker
Visit this user's website Find all posts by this user
Quote this message in a reply
12-09-2018, 11:56 PM
Post: #13
RE: GL Balance Sheet Bad Hyperlink - SOLVED
I think option 1 was the original intention which is why there was no need for a FromPeriod (it may have been me that did it, though am not sure).

This is probably not the best, and I am minded towards option 3 as you are, I just put out the alternatives to see if it generated any opinions.

Tim
Visit this user's website Find all posts by this user
Quote this message in a reply
12-10-2018, 02:32 AM
Post: #14
RE: GL Balance Sheet Bad Hyperlink - SOLVED
So... if I'm following correctly, is the consensus here to remove the FromPeriod?
Find all posts by this user
Quote this message in a reply
12-10-2018, 03:00 AM
Post: #15
RE: GL Balance Sheet Bad Hyperlink - SOLVED
No. Option 3, if that is the consensus, requires that FromPeriod is set to the first period number of the financial year for the period of the balance sheet being viewed. It's not that hard but requires a few lines of code to get it as there are a few cases to consider.
Visit this user's website Find all posts by this user
Quote this message in a reply
12-10-2018, 08:28 PM
Post: #16
RE: GL Balance Sheet Bad Hyperlink - SOLVED
I have created the following function in MiscFunctions.php:

PHP Code:
function FYStartPeriod($PeriodNumber) {
    
$SQL "SELECT lastdate_in_period FROM periods WHERE periodno='" $PeriodNumber "'";
    
$Result DB_query($SQL);
    
$MyRow DB_fetch_array($Result);
    
$DateArray explode('-'$MyRow['lastdate_in_period']);
    if (
$DateArray[1] > $_SESSION['YearEnd']) {
        
$DateStart Date($_SESSION['DefaultDateFormat'], Mktime(000$_SESSION['YearEnd'] + 11$DateArray[0]));
    } else {
        
$DateStart Date($_SESSION['DefaultDateFormat'], Mktime(000$_SESSION['YearEnd'] + 11$DateArray[0] - 1));
    }
    
$StartPeriod GetPeriod($DateStart);
    return 
$StartPeriod;


and then the link becomes:

PHP Code:
                $ActEnquiryURL '<a href="'$RootPath '/GLAccountInquiry.php?FromPeriod=' urlencode(FYStartPeriod($_POST['BalancePeriodEnd'])) . '&amp;ToPeriod=' urlencode($_POST['BalancePeriodEnd']) . '&amp;Account=' urlencode($myrow['accountcode']) . '&amp;Show=Yes">' $myrow['accountcode'] . '</a>'

This appears to work OK in my tests.

Paul T: I have submitted a pull request.

Tim
Visit this user's website Find all posts by this user
Quote this message in a reply
12-10-2018, 10:32 PM
Post: #17
RE: GL Balance Sheet Bad Hyperlink - SOLVED?
Beautiful! Thank you so much Tim!

https://www.linkedin.com/in/eclipsepaulbecker
Visit this user's website Find all posts by this user
Quote this message in a reply
12-12-2018, 01:51 PM (This post was last modified: 12-12-2018 02:11 PM by TurboPT.)
Post: #18
RE: GL Balance Sheet Bad Hyperlink - SOLVED?
Thanks, Tim. I'll create a pull on that this week too.

One thing I'll have to change, though, maybe*: Case difference uses of $pdf vs. $PDF.

Yet-another thing to try and align between the repo's, after the release, to have another less matter to deal with.

*...or I might 'clone' the last several lines of $pdf handling at the end of PDFStarter to have a $PDF as well, so that it can work both ways, and then slowly migrate the rest. At least doing this can save the trouble of $PDF case difference(s) for your changes. Smile ... and makes for easier pulls too!
Find all posts by this user
Quote this message in a reply
12-12-2018, 06:08 PM (This post was last modified: 12-12-2018 09:12 PM by falkoner.)
Post: #19
RE: GL Balance Sheet Bad Hyperlink - SOLVED?
Yeah I was going to change that $pdf, leave that to me Paul and I will do it later today.

The problem is that I have some hook scripts that format the code in line with the coding guidelines as it is being committed. I sometimes forget that this will cause issues like this.

Tim
Visit this user's website Find all posts by this user
Quote this message in a reply
12-12-2018, 09:39 PM
Post: #20
RE: GL Balance Sheet Bad Hyperlink - SOLVED?
I have submitted a pull request
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)