<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[FrontAccounting forum — Journal Inquiry Dates]]></title>
	<link rel="self" href="https://frontaccounting.com/punbb/extern.php?action=feed&amp;tid=8280&amp;type=atom" />
	<updated>2020-09-07T07:14:38Z</updated>
	<generator>PunBB</generator>
	<id>https://frontaccounting.com/punbb/viewtopic.php?id=8280</id>
		<entry>
			<title type="html"><![CDATA[Re: Journal Inquiry Dates]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=38295#p38295" />
			<content type="html"><![CDATA[<p>/gl/view/gl_payment_view.php?trans_no=3</p><p>Field Pay To is empty</p><p>Also in Bank statement Person/Item not showing</p><p>Is it happening for everyone?</p>]]></content>
			<author>
				<name><![CDATA[cedricktshiyoyo]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=45118</uri>
			</author>
			<updated>2020-09-07T07:14:38Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=38295#p38295</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Journal Inquiry Dates]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=37900#p37900" />
			<content type="html"><![CDATA[<p>Sure. Fixed and committed to core.</p><p>The fixed file can be downloaded <a href="https://sourceforge.net/p/frontaccounting/git/ci/master/tree/gl/includes/db/gl_db_trans.inc">here</a>.</p><p>Joe</p>]]></content>
			<author>
				<name><![CDATA[joe]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=3</uri>
			</author>
			<updated>2020-08-01T23:09:24Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=37900#p37900</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Journal Inquiry Dates]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=37897#p37897" />
			<content type="html"><![CDATA[<p>@joe<br />Can this be included in core if it does not cause any conflicts?<br />Thanks.</p>]]></content>
			<author>
				<name><![CDATA[rafat]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=41964</uri>
			</author>
			<updated>2020-08-01T16:30:55Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=37897#p37897</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Journal Inquiry Dates]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=37896#p37896" />
			<content type="html"><![CDATA[<p>It worked bro!!</p>]]></content>
			<author>
				<name><![CDATA[boxygen]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=20175</uri>
			</author>
			<updated>2020-08-01T14:56:43Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=37896#p37896</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Journal Inquiry Dates]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=37894#p37894" />
			<content type="html"><![CDATA[<p>Thanks Braath.. It seems OK with your change.</p><p>Sales Invoice and Supplier Invoices samples attached...</p>]]></content>
			<author>
				<name><![CDATA[rafat]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=41964</uri>
			</author>
			<updated>2020-08-01T13:03:53Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=37894#p37894</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Journal Inquiry Dates]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=37887#p37887" />
			<content type="html"><![CDATA[<p>Extracting persons out of the gl file is tricky because FA nulls these fields out, leading to very obscure SQL.&nbsp; &nbsp;Try:<br /></p><div class="codebox"><pre><code>--- a/core/gl/includes/db/gl_db_trans.inc
+++ b/core/gl/includes/db/gl_db_trans.inc
@@ -619,13 +619,13 @@ function get_sql_for_journal_inquiry($filter, $from, $to, $ref=&#039;&#039;, $memo=&#039;&#039;, $al
         gl.tran_date,
         gl.type as trans_type,
         gl.type_no as trans_no,
-        IFNULL(gl.person_id, IFNULL(st.supplier_id, IFNULL(grn.supplier_id, IFNULL(dt.debtor_no, bt.person_id)))) as person_id,
+        IF(MAX(gl.person_id), MAX(gl.person_id), IFNULL(st.supplier_id, IFNULL(grn.supplier_id, IFNULL(dt.debtor_no, bt.person_id)))) as person_id,
         IF(ISNULL(st.supp_reference), &#039;&#039;, st.supp_reference) AS supp_reference,
         refs.reference,
         IF(gl.type=&quot;.ST_BANKTRANSFER.&quot;,MAX(gl.amount),SUM(IF(gl.amount&gt;0, gl.amount,0))) as amount,
         com.memo_,
         IF(ISNULL(u.user_id),&#039;&#039;,u.user_id) as user_id,
-        IF(gl.person_id, gl.person_type_id, IF(!ISNULL(st.supplier_id) OR !ISNULL(grn.supplier_id),&quot;.  PT_SUPPLIER . &quot;,&quot; .  &quot;IF(dt.debtor_no,&quot; . PT_CUSTOMER . &quot;,&quot; .
+        IF(MAX(gl.person_id), MAX(gl.person_type_id), IF(!ISNULL(st.supplier_id) OR !ISNULL(grn.supplier_id),&quot;.  PT_SUPPLIER . &quot;,&quot; .  &quot;IF(dt.debtor_no,&quot; . PT_CUSTOMER . &quot;,&quot; .
         &quot;IF(bt.person_id != &#039;&#039; AND !ISNULL(bt.person_id), bt.person_type_id, -1)))) as person_type_id
         FROM &quot;.TB_PREF.&quot;gl_trans as gl
          LEFT JOIN &quot;.TB_PREF.&quot;audit_trail as a ON</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Braath Waate]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=41493</uri>
			</author>
			<updated>2020-07-31T19:31:52Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=37887#p37887</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Journal Inquiry Dates]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=37881#p37881" />
			<content type="html"><![CDATA[<p>Hello, Today I was just checking and found that in Journal Inquiry 2.4.8 the Counter Party column is not showing the Customer Name for Sales Invoices.</p><p>Here is the Screen Shot</p><br /><p><a href="https://prnt.sc/trl5mj">https://prnt.sc/trl5mj</a></p><p>Similarly for Supplier Invoices it is showing for some invoices and not for all. What could be the reason.</p><p><a href="https://prnt.sc/trl9yi">https://prnt.sc/trl9yi</a></p>]]></content>
			<author>
				<name><![CDATA[boxygen]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=20175</uri>
			</author>
			<updated>2020-07-31T06:27:01Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=37881#p37881</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Journal Inquiry Dates]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=35638#p35638" />
			<content type="html"><![CDATA[<p>Hi All,</p><p>Its working fine.</p><p>Many Thanks..</p>]]></content>
			<author>
				<name><![CDATA[rafat]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=41964</uri>
			</author>
			<updated>2019-08-06T06:13:28Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=35638#p35638</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Journal Inquiry Dates]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=35633#p35633" />
			<content type="html"><![CDATA[<p>Thanks @Braath Waate</p><p>I will download and test and come back to you.</p>]]></content>
			<author>
				<name><![CDATA[rafat]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=41964</uri>
			</author>
			<updated>2019-08-05T16:00:20Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=35633#p35633</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Journal Inquiry Dates]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=35632#p35632" />
			<content type="html"><![CDATA[<p>@rafat</p><p>I forget to mention that you still need the new gl/inquiry/journal_inquiry.php file as well.&nbsp; Download that and you should be good.</p>]]></content>
			<author>
				<name><![CDATA[Braath Waate]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=41493</uri>
			</author>
			<updated>2019-08-05T15:27:25Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=35632#p35632</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Journal Inquiry Dates]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=35627#p35627" />
			<content type="html"><![CDATA[<p>Hi Guys,</p><p>Downloaded the above file and replaced it on my 247 installation the following is observed.:</p><p>1. Customer / Supplier names are not showing.. Just numbers 1, 2 ..etc<br />2. QE names not showing but numbers as well.<br />3. Misc entries are shown properly.<br />4. The Funds Transfer is showing correctly.</p>]]></content>
			<author>
				<name><![CDATA[rafat]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=41964</uri>
			</author>
			<updated>2019-08-05T12:22:33Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=35627#p35627</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Journal Inquiry Dates]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=35625#p35625" />
			<content type="html"><![CDATA[<p>@Braath Waate and @boxygen</p><p>The last change by @Brath Waate has been committed to 2.4.7 stable. Thank you both for testing and fixing this.</p><p>A new file can be downloaded <a href="https://sourceforge.net/p/frontaccounting/git/ci/master/tree/gl/includes/db/gl_db_trans.inc">here</a>.</p><p>/Joe</p>]]></content>
			<author>
				<name><![CDATA[joe]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=3</uri>
			</author>
			<updated>2019-08-05T07:35:19Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=35625#p35625</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Journal Inquiry Dates]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=35604#p35604" />
			<content type="html"><![CDATA[<p>@boxygen</p><p>Thanks for testing.</p><p>This next version should fix those problems, remove unused code, and re-add support for names on PO Deliveries.</p><div class="codebox"><pre><code>function get_sql_for_journal_inquiry($filter, $from, $to, $ref=&#039;&#039;, $memo=&#039;&#039;, $alsoclosed=false,
         $user_id=null)
{
    $sql = &quot;SELECT  IFNULL(a.gl_seq,0) as gl_seq,
        gl.tran_date,
        gl.type as trans_type,
        gl.type_no as trans_no,
        IFNULL(gl.person_id, IFNULL(st.supplier_id, IFNULL(grn.supplier_id, IFNULL(dt.debtor_no, bt.person_id)))) as person_id,
        IF(ISNULL(st.supp_reference), &#039;&#039;, st.supp_reference) AS supp_reference,
        refs.reference,
        IF(gl.type=&quot;.ST_BANKTRANSFER.&quot;,MAX(gl.amount),SUM(IF(gl.amount&gt;0, gl.amount,0))) as amount,
        com.memo_,
        IF(ISNULL(u.user_id),&#039;&#039;,u.user_id) as user_id,
        IF(gl.person_id, gl.person_type_id, IF(!ISNULL(st.supplier_id) OR !ISNULL(grn.supplier_id),&quot;.  PT_SUPPLIER . &quot;,&quot; .  &quot;IF(dt.debtor_no,&quot; . PT_CUSTOMER . &quot;,&quot; .
        &quot;IF(bt.person_id != &#039;&#039; AND !ISNULL(bt.person_id), bt.person_type_id, -1)))) as person_type_id
        FROM &quot;.TB_PREF.&quot;gl_trans as gl
         LEFT JOIN &quot;.TB_PREF.&quot;audit_trail as a ON
            (gl.type=a.type AND gl.type_no=a.trans_no)
         LEFT JOIN &quot;.TB_PREF.&quot;comments as com ON
            (gl.type=com.type AND gl.type_no=com.id)
         LEFT JOIN &quot;.TB_PREF.&quot;refs as refs ON
            (gl.type=refs.type AND gl.type_no=refs.id)
         LEFT JOIN &quot;.TB_PREF.&quot;users as u ON
            a.user=u.id
         LEFT JOIN &quot;.TB_PREF.&quot;grn_batch grn ON grn.id=gl.type_no AND gl.type=&quot;.ST_SUPPRECEIVE.&quot;
         LEFT JOIN &quot;.TB_PREF.&quot;bank_trans bt ON bt.type=gl.type AND bt.trans_no=gl.type_no AND bt.amount!=0
                 AND (bt.person_id != &#039;&#039; AND !ISNULL(bt.person_id))
         LEFT JOIN &quot;.TB_PREF.&quot;debtor_trans dt ON dt.type=gl.type AND gl.type_no=dt.trans_no
         LEFT JOIN &quot;.TB_PREF.&quot;supp_trans st ON st.type=gl.type AND gl.type_no=st.trans_no
         WHERE gl.tran_date &gt;= &#039;&quot; . date2sql($from) . &quot;&#039;
        AND gl.tran_date &lt;= &#039;&quot; . date2sql($to) . &quot;&#039;
        AND gl.amount!=0&quot;;
    if ($ref) {
        $sql .= &quot; AND refs.reference LIKE &quot;. db_escape(&quot;%$ref%&quot;);
    }
    if ($memo) {
        $sql .= &quot; AND com.memo_ LIKE &quot;. db_escape(&quot;%$memo%&quot;);
    }
    if ($filter != -1) {
        $sql .= &quot; AND gl.type=&quot;.db_escape($filter);
    }
    if (!$alsoclosed) {
        $sql .= &quot; AND gl_seq=0&quot;;
    }
    else
        $sql .= &quot; AND NOT ISNULL(a.gl_seq)&quot;;

    if ($user_id != null)
        $sql .= &quot; AND user_id = &quot;.db_escape($user_id);

    $sql .= &quot; GROUP BY gl.tran_date, a.gl_seq, gl.type, gl.type_no&quot;;
    return $sql;
}</code></pre></div><br /><p>diff<br /></p><div class="codebox"><pre><code>-- a/core/gl/includes/db/gl_db_trans.inc
+++ b/core/gl/includes/db/gl_db_trans.inc
@@ -606,25 +606,21 @@ function clear_gl_trans($type, $trans_id, $nested=false)
 }
 
 function get_sql_for_journal_inquiry($filter, $from, $to, $ref=&#039;&#039;, $memo=&#039;&#039;, $alsoclosed=false,
-                $user_id=null, $contractor_id=null, $dimension=null)
+                $user_id=null)
 {
-
        $sql = &quot;SELECT  IFNULL(a.gl_seq,0) as gl_seq,
                gl.tran_date,
                gl.type as trans_type,
                gl.type_no as trans_no,
-               IFNULL(MAX(supp.supp_name), MAX(cust.name)) as name,
+        IFNULL(gl.person_id, IFNULL(st.supplier_id, IFNULL(grn.supplier_id, IFNULL(dt.debtor_no, bt.person_id)))) as person_id,
                IF(ISNULL(st.supp_reference), &#039;&#039;, st.supp_reference) AS supp_reference,
-               refs.reference,&quot;
-               .($dimension ? &quot; -SUM(IF(dim.dimension in(gl.dimension_id,gl.dimension2_id), gl.amount, 0)) as amount,&quot;:&quot; SUM(IF(gl.amount&gt;0, gl.amount,0)) as amount,&quot;)
-               .&quot;com.memo_,
-               IF(ISNULL(u.user_id),&#039;&#039;,u.user_id) as user_id&quot;;
-
-       if ($contractor_id &gt; 0) {
-       $sql.= &quot; FROM &quot;.TB_PREF.&quot;gl_trans as gl
+               refs.reference,
+               IF(gl.type=&quot;.ST_BANKTRANSFER.&quot;,MAX(gl.amount),SUM(IF(gl.amount&gt;0, gl.amount,0))) as amount,
+               com.memo_,
+               IF(ISNULL(u.user_id),&#039;&#039;,u.user_id) as user_id,
+        IF(gl.person_id, gl.person_type_id, IF(!ISNULL(st.supplier_id) OR !ISNULL(grn.supplier_id),&quot;.  PT_SUPPLIER . &quot;,&quot; .  &quot;IF(dt.debtor_no,&quot; . PT_CUSTOMER . &quot;,&quot; . 
+        &quot;IF(bt.person_id != &#039;&#039; AND !ISNULL(bt.person_id), bt.person_type_id, -1)))) as person_type_id
+           FROM &quot;.TB_PREF.&quot;gl_trans as gl
                 LEFT JOIN &quot;.TB_PREF.&quot;audit_trail as a ON
                        (gl.type=a.type AND gl.type_no=a.trans_no)
                 LEFT JOIN &quot;.TB_PREF.&quot;comments as com ON
@@ -633,14 +629,12 @@ function get_sql_for_journal_inquiry($filter, $from, $to, $ref=&#039;&#039;, $memo=&#039;&#039;, $al
                        (gl.type=refs.type AND gl.type_no=refs.id)
                 LEFT JOIN &quot;.TB_PREF.&quot;users as u ON
                        a.user=u.id
+         LEFT JOIN &quot;.TB_PREF.&quot;grn_batch grn ON grn.id=gl.type_no AND gl.type=&quot;.ST_SUPPRECEIVE.&quot;
+         LEFT JOIN &quot;.TB_PREF.&quot;bank_trans bt ON bt.type=gl.type AND bt.trans_no=gl.type_no AND bt.amount!=0
+                 AND (bt.person_id != &#039;&#039; AND !ISNULL(bt.person_id))
                 LEFT JOIN &quot;.TB_PREF.&quot;debtor_trans dt ON dt.type=gl.type AND gl.type_no=dt.trans_no
-                LEFT JOIN &quot;.TB_PREF.&quot;debtors_master cust ON gl.person_type_id=2 AND gl.person_id=cust.debtor_no
                 LEFT JOIN &quot;.TB_PREF.&quot;supp_trans st ON st.type=gl.type AND gl.type_no=st.trans_no
-                LEFT JOIN &quot;.TB_PREF.&quot;suppliers supp ON gl.person_type_id=3 AND gl.person_id=supp.supplier_id&quot;
-                .($dimension ? 
-                &quot; LEFT JOIN (SELECT type, type_no, MAX(IFNULL(dimension_id, dimension2_id)) dimension FROM &quot;.TB_PREF.&quot;gl_trans GROUP BY type, type_no) dim 
-                               ON gl.type=dim.type AND gl.type_no=dim.type_no&quot; : &#039;&#039;)
-               .&quot; WHERE gl.tran_date &gt;= &#039;&quot; . date2sql($from) . &quot;&#039;
+                WHERE gl.tran_date &gt;= &#039;&quot; . date2sql($from) . &quot;&#039;
                AND gl.tran_date &lt;= &#039;&quot; . date2sql($to) . &quot;&#039;
                AND gl.amount!=0&quot;;
        if ($ref) {
@@ -661,14 +655,6 @@ function get_sql_for_journal_inquiry($filter, $from, $to, $ref=&#039;&#039;, $memo=&#039;&#039;, $al
        if ($user_id != null)
                $sql .= &quot; AND user_id = &quot;.db_escape($user_id);
 
-       if ($contractor_id &gt; 0) {
-               $sql.= &quot; AND (dt.debtor_no =&quot;.$contractor_id;
-               $sql.= &quot; OR st.supplier_id =&quot;.$contractor_id.&quot;) &quot;;
-       }       
-
-       if ($dimension != null)
-               $sql .= &quot; AND dim.dimension = &quot;.db_escape($dimension);
-
        $sql .= &quot; GROUP BY gl.tran_date, a.gl_seq, gl.type, gl.type_no&quot;;
 
        return $sql;</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Braath Waate]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=41493</uri>
			</author>
			<updated>2019-08-02T22:58:55Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=35604#p35604</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Journal Inquiry Dates]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=35600#p35600" />
			<content type="html"><![CDATA[<p>Another Bug is that if in Bank Payment or Deposit nothing is defined in Miscellaneous Box then it shows like Customer [000] as shown in image below</p><p><a href="http://prnt.sc/onfghz">http://prnt.sc/onfghz</a></p>]]></content>
			<author>
				<name><![CDATA[boxygen]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=20175</uri>
			</author>
			<updated>2019-08-02T11:25:39Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=35600#p35600</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Journal Inquiry Dates]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=35599#p35599" />
			<content type="html"><![CDATA[<p>One Bug found after this update.</p><p>The Amount for Bank Transfers is showing double. See in this image <a href="http://prnt.sc/onf5v9">http://prnt.sc/onf5v9</a></p>]]></content>
			<author>
				<name><![CDATA[boxygen]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=20175</uri>
			</author>
			<updated>2019-08-02T11:12:02Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=35599#p35599</id>
		</entry>
</feed>
