<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[FrontAccounting forum — User configurable 'days past' setting for inquiry screens: here's how]]></title>
		<link>https://frontaccounting.com/punbb/viewtopic.php?id=2974</link>
		<atom:link href="https://frontaccounting.com/punbb/extern.php?action=feed&amp;tid=2974&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in User configurable 'days past' setting for inquiry screens: here's how.]]></description>
		<lastBuildDate>Sat, 23 Nov 2013 23:35:29 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: User configurable 'days past' setting for inquiry screens: here's how]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=18541#p18541</link>
			<description><![CDATA[<p>When making this change, please also make the end date for inquiries configurable. I find it useful to set the end date for bank inquiries to 30 days in the future instead of today, because I enter scheduled payments in advance, and it helps to manage cash flow. <br />Thanks</p>]]></description>
			<author><![CDATA[null@example.com (AlastairR)]]></author>
			<pubDate>Sat, 23 Nov 2013 23:35:29 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=18541#p18541</guid>
		</item>
		<item>
			<title><![CDATA[Re: User configurable 'days past' setting for inquiry screens: here's how]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=18530#p18530</link>
			<description><![CDATA[<p>thank you for this Pete, this is exactly what I need; I was getting frustrated by the 30 search</p>]]></description>
			<author><![CDATA[null@example.com (cristiart)]]></author>
			<pubDate>Fri, 22 Nov 2013 20:02:24 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=18530#p18530</guid>
		</item>
		<item>
			<title><![CDATA[Re: User configurable 'days past' setting for inquiry screens: here's how]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=12207#p12207</link>
			<description><![CDATA[<p>This is a great suggestion. Will be included in release 2.4.</p><p>/Joe</p>]]></description>
			<author><![CDATA[null@example.com (joe)]]></author>
			<pubDate>Mon, 09 Apr 2012 08:46:37 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=12207#p12207</guid>
		</item>
		<item>
			<title><![CDATA[User configurable 'days past' setting for inquiry screens: here's how]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=12202#p12202</link>
			<description><![CDATA[<p>FA currently uses a default hard-coded &#039;30&#039; days in the past setting for all inquiry screens.I have created some instructions for changing this to a user setting (transaction_days) so you can set this up for each user. This is useful if your company transactions are low-volume and you want to see more than 30 days in the past in your inquiry screens.</p><p><em>Note to Joe/Itronics: I put this as a suggested update on the Wiki for you to consider in the next version. Let me know if I&#039;ve got the design of this wrong (I&#039;ve tried to keep the design of the mod consistent with the architecture of FA), but it&#039;s a fairly simple change to make.</em></p><div class="codebox"><pre><code>New User Configurable Transaction days setting by Pete p2409.
-------------------------------------------------------------

Currently, FA uses a hard-coded default 30 days in the past setting for transaction display screens
eg. ifyou do a GL inquiry, the default is to display dates from today to 30 days ago.
With a new user-configurable &#039;transaction_days&#039; setting, you can now set this to a default number 
you choose eg. 365 to always display the last year&#039;s instead of month&#039;s transactions.
With this change, the default &#039;From&#039; date on inquiry screens will be the setting you made
eg. -365 days from now.

To achieve this, we add a new global setting &#039;transaction_days&#039; and look up this setting in
all inquiry screens that previously had a hardcoded 30 days.

(Note the setting is a positive number, made negative to go back in the past in the inquiry screens
with a minus sign).

CHANGES TO CODE/TABLE
---------------------

1) Create new &#039;Transaction days&#039; setting in preferences screen:

In ./admin/display_prefs.php

Around line 37

FROM:
        set_user_prefs(get_post( 
            array(&#039;prices_dec&#039;, &#039;qty_dec&#039;, &#039;rates_dec&#039;, &#039;percent_dec&#039;,
            &#039;date_format&#039;, &#039;date_sep&#039;, &#039;tho_sep&#039;, &#039;dec_sep&#039;, &#039;print_profile&#039;, 
            &#039;theme&#039;, &#039;page_size&#039;, &#039;language&#039;, &#039;startup_tab&#039;,
            &#039;show_gl&#039; =&gt; 0, &#039;show_codes&#039;=&gt; 0, &#039;show_hints&#039; =&gt; 0,
            &#039;rep_popup&#039; =&gt; 0, &#039;graphic_links&#039; =&gt; 0, &#039;sticky_doc_date&#039; =&gt; 0,
            &#039;query_size&#039; =&gt; 10.0)));

TO:
// Add transaction days configurable.            
        set_user_prefs(get_post( 
            array(&#039;prices_dec&#039;, &#039;qty_dec&#039;, &#039;rates_dec&#039;, &#039;percent_dec&#039;,
            &#039;date_format&#039;, &#039;date_sep&#039;, &#039;tho_sep&#039;, &#039;dec_sep&#039;, &#039;print_profile&#039;, 
            &#039;theme&#039;, &#039;page_size&#039;, &#039;language&#039;, &#039;startup_tab&#039;,
            &#039;show_gl&#039; =&gt; 0, &#039;show_codes&#039;=&gt; 0, &#039;show_hints&#039; =&gt; 0,
            &#039;rep_popup&#039; =&gt; 0, &#039;graphic_links&#039; =&gt; 0, &#039;sticky_doc_date&#039; =&gt; 0,
            &#039;query_size&#039; =&gt; 10.0, &#039;transaction_days&#039; =&gt; 30)));
            
Around line 142 after:

check_row(_(&quot;Remember last document date:&quot;), &#039;sticky_doc_date&#039;, sticky_doc_date(),
    false, _(&#039;If set document date is remembered on subsequent documents, otherwise default is current date&#039;));

ADD:

text_row_ex(_(&quot;Transaction days:&quot;), &#039;transaction_days&#039;, 5, 5, &#039;&#039;, user_transaction_days());


2) Update user preferences to add new transaction_days global variable.

In ./includes/prefs/userprefs.inc

Around line 38:
ADD:
    var $transaction_days;

Around line 54 after:
            $this-&gt;theme = &#039;default&#039;;
ADD:
            $this-&gt;transaction_days = -30;
Around line 91 (in the else block)
AFTER:
            else
            {
                $this-&gt;sticky_date = 0;
                $this-&gt;startup_tab = &quot;orders&quot;;
            }

ADD:
            $this-&gt;transaction_days = $user[&#039;transaction_days&#039;];

Around line 127:
ADD:
    function transaction_days() {
        return $this-&gt;transaction_days;
    }

3) Update current user settings with new user_transaction_days function:

Around line 312
ADD:
function user_transaction_days()
{
    return $_SESSION[&quot;wa_current_user&quot;]-&gt;prefs-&gt;transaction_days();
}


4) Modify all inquiry screens to use new &#039;Transaction Days&#039; setting:

In all inquiry screens (do a global search on &#039;30&#039; to find them all):
./gl/inquiry/bank_inquiry.php
./gl/inquiry/gl_account_inquiry.php
./gl/inquiry/gl_trial_balance.php
./gl/inquiry/profit_loss.php
./gl/inquiry/tax_inquiry.php
./gl/view/accrual_trans.php
./inventory/inquiry/stock_movements.php
./purchasing/includes/ui/invoice_ui.inc
./purchasing/inquiry/po_search.php
./purchasing/inquiry/po_search_completed.php
./purchasing/inquiry/supplier_allocation_inquiry.php
./purchasing/inquiry/supplier_inquiry.php
./sales/inquiry/customer_allocation_inquiry.php
./sales/inquiry/customer_inquiry.php
./sales/inquiry/sales_deliveries_view.php
./sales/inquiry/sales_orders_view.php

Example for bank inquiry: ./gl/inquiry/bank_inquiry.php

Around line 50:

CHANGE:
date_cells(_(&quot;From:&quot;), &#039;TransAfterDate&#039;, &#039;&#039;, null, -30);

TO:
date_cells(_(&quot;From:&quot;), &#039;TransAfterDate&#039;, &#039;&#039;, null, -$_SESSION[&quot;wa_current_user&quot;]-&gt;prefs-&gt;transaction_days());

Do this for each inquiry screen file


5) SQL update x_users table with new &#039;transaction_days&#039; column:

ALTER TABLE `0_users` ADD `transaction_days` INT( 6 ) NOT NULL COMMENT &#039;Transaction days&#039;

(Note: use your company number eg. 0_, 1_ etc to update for each company).</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (p2409)]]></author>
			<pubDate>Mon, 09 Apr 2012 04:11:31 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=12202#p12202</guid>
		</item>
	</channel>
</rss>
