<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[FrontAccounting forum — Report branch customers]]></title>
	<link rel="self" href="https://frontaccounting.com/punbb/extern.php?action=feed&amp;tid=8927&amp;type=atom" />
	<updated>2020-08-31T04:59:29Z</updated>
	<generator>PunBB</generator>
	<id>https://frontaccounting.com/punbb/viewtopic.php?id=8927</id>
		<entry>
			<title type="html"><![CDATA[Re: Report branch customers]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=38224#p38224" />
			<content type="html"><![CDATA[<p>If all this needs is just a report request form check box without the need for any db changes or even sys_prefs changes, why not.</p><p>It is best if it is displayed for a specific customer so that totals do not get messed up for those witout multiple branches.</p>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2020-08-31T04:59:29Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=38224#p38224</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Report branch customers]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=38222#p38222" />
			<content type="html"><![CDATA[<p>@apmuthu: Probable demand for this is low/no customer totals/no branch filter</p><p>So best as an extension?</p>]]></content>
			<author>
				<name><![CDATA[poncho1234]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=19944</uri>
			</author>
			<updated>2020-08-30T23:25:31Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=38222#p38222</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Report branch customers]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=38220#p38220" />
			<content type="html"><![CDATA[<p>@joe: want to add in core?</p>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2020-08-30T18:43:37Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=38220#p38220</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Report branch customers]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=38207#p38207" />
			<content type="html"><![CDATA[<p>Differences as follows<br /></p><div class="codebox"><pre><code>File: &lt;unsaved&gt;
01: ---   \reporting\rep115ORIGINAL.php
02: +++\reporting\rep115.php
03: @@ -29,7 +29,7 @@
04:  
05:  print_customer_balances();
06:  
07: -function get_open_balance($debtorno, $to)
08: +function get_open_balance($debtorno, $branchcode, $to)
09:  {
10:      if ($to)
11:          $to = date2sql($to);
12: @@ -43,17 +43,18 @@
13:      $sql .= &quot;SUM(IF(t.type = &quot;.ST_SALESINVOICE.&quot;, 1, -1) *
14:          (abs(t.ov_amount + t.ov_gst + t.ov_freight + t.ov_freight_tax + t.ov_discount) - abs(t.alloc))) AS OutStanding
15:          FROM &quot;.TB_PREF.&quot;debtor_trans t
16: -        WHERE t.debtor_no = &quot;.db_escape($debtorno)
17: +        WHERE t.debtor_no = &quot;.db_escape($debtorno).&quot;
18: +        AND t.branch_code=&quot;.db_escape($branchcode)
19:          .&quot; AND t.type &lt;&gt; &quot;.ST_CUSTDELIVERY;
20:      if ($to)
21:          $sql .= &quot; AND t.tran_date &lt; &#039;$to&#039;&quot;;
22: -    $sql .= &quot; GROUP BY debtor_no&quot;;
23: +    // $sql .= &quot; GROUP BY debtor_no&quot;;
24:  
25:      $result = db_query($sql,&quot;No transactions were returned&quot;);
26:      return db_fetch($result);
27:  }
28:  
29: -function get_transactions($debtorno, $from, $to, $only_rec)
30: +function get_transactions($debtorno, $branchcode, $from, $to, $only_rec)
31:  {
32:      $from = date2sql($from);
33:      $to = date2sql($to);
34: @@ -82,7 +83,8 @@
35:          LEFT JOIN $allocated_to ON alloc_to.trans_type = trans.type AND alloc_to.trans_no = trans.trans_no
36:          WHERE trans.tran_date &gt;= &#039;$from&#039;
37:          AND trans.tran_date &lt;= &#039;$to&#039;
38: -        AND trans.debtor_no = &quot;.db_escape($debtorno);
39: +        AND trans.debtor_no = &quot;.db_escape($debtorno).&quot;
40: +        AND trans.branch_code=&quot;.db_escape($branchcode);
41:      $sql .= &quot; AND trans.type &lt;&gt; &quot;.ST_CUSTDELIVERY;
42:      $sql .= &quot; AND ISNULL(voided.id)
43:          ORDER BY trans.tran_date &quot;;
44: @@ -158,7 +160,7 @@
45:      $cols = array(0, 100, 130, 190, 250, 320, 385, 450, 515);
46:      //$cols = array(0, 70, 140, 180, 230, 270, 350, 445, 495, 555);
47:  
48: -    $headers = array(_(&#039;Name&#039;), &#039;&#039;, &#039;&#039;, _(&#039;Open Balance&#039;), _(&#039;Debit&#039;), _(&#039;Credit&#039;), &#039;&#039;, _(&#039;Balance&#039;));
49: +    $headers = array(_(&#039;Name&#039;), &#039;&#039;, _(&#039;Branch&#039;), _(&#039;Open Balance&#039;), _(&#039;Debit&#039;), _(&#039;Credit&#039;), &#039;&#039;, _(&#039;Balance&#039;));
50:  
51:      $aligns = array(&#039;left&#039;, &#039;left&#039;, &#039;left&#039;, &#039;right&#039;, &#039;right&#039;, &#039;right&#039;, &#039;right&#039;, &#039;right&#039;);
52:  
53: @@ -179,7 +181,7 @@
54:  
55:      $grandtotal = array(0,0,0,0);
56:  
57: -    $sql = &quot;SELECT &quot;.TB_PREF.&quot;debtors_master.debtor_no, name, curr_code FROM &quot;.TB_PREF.&quot;debtors_master
58: +    $sql = &quot;SELECT &quot;.TB_PREF.&quot;debtors_master.debtor_no, name, br_name, branch_code, curr_code FROM &quot;.TB_PREF.&quot;debtors_master
59:          INNER JOIN &quot;.TB_PREF.&quot;cust_branch
60:          ON &quot;.TB_PREF.&quot;debtors_master.debtor_no=&quot;.TB_PREF.&quot;cust_branch.debtor_no
61:          INNER JOIN &quot;.TB_PREF.&quot;areas
62: @@ -204,7 +206,7 @@
63:          $sql .= &quot; WHERE &quot;.TB_PREF.&quot;salesman.salesman_code=&quot;.db_escape($folk);
64:      }
65:  
66: -    $sql .= &quot; GROUP BY &quot;.TB_PREF.&quot;debtors_master.debtor_no ORDER BY name&quot;;
67: +    // $sql .= &quot; GROUP BY &quot;.TB_PREF.&quot;debtors_master.debtor_no ORDER BY name&quot;;
68:  
69:      $result = db_query($sql, &quot;The customers could not be retrieved&quot;);
70:  
71: @@ -215,7 +217,7 @@
72:  
73:          $accumulate = 0;
74:          $rate = $convert ? get_exchange_rate_from_home_currency($myrow[&#039;curr_code&#039;], Today()) : 1;
75: -        $bal = get_open_balance($myrow[&#039;debtor_no&#039;], $from, $convert);
76: +        $bal = get_open_balance($myrow[&#039;debtor_no&#039;], $myrow[&#039;branch_code&#039;], $from, $convert);
77:          $init[0] = $init[1] = 0.0;
78:          $init[0] = round2(abs($bal[&#039;charges&#039;] * $rate), $dec);
79:          $init[1] = round2(Abs($bal[&#039;credits&#039;] * $rate), $dec);
80: @@ -223,7 +225,7 @@
81:          $init[3] = $init[0] - $init[1];
82:          $accumulate += $init[3];
83:  
84: -        $res = get_transactions($myrow[&#039;debtor_no&#039;], $from, $to, false);
85: +        $res = get_transactions($myrow[&#039;debtor_no&#039;], $myrow[&#039;branch_code&#039;], $from, $to, false);
86:  
87:          $total = array(0,0,0,0);
88:          for ($i = 0; $i &lt; 4; $i++)
89: @@ -279,6 +281,7 @@
90:          }
91:          if ($no_zeros &amp;&amp; $total[3] == 0.0 &amp;&amp; $curr_db == 0.0 &amp;&amp; $curr_cr == 0.0) continue;
92:          $rep-&gt;TextCol(0, 2, $myrow[&#039;name&#039;]);
93: +        $rep-&gt;TextCol(2, 3, $myrow[&#039;br_name&#039;]);
94:          $rep-&gt;AmountCol(3, 4, $total[3] + $curr_cr - $curr_db, $dec);
95:          $rep-&gt;AmountCol(4, 5, $curr_db, $dec);
96:          $rep-&gt;AmountCol(5, 6, $curr_cr, $dec);</code></pre></div>]]></content>
			<author>
				<name><![CDATA[poncho1234]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=19944</uri>
			</author>
			<updated>2020-08-29T16:32:00Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=38207#p38207</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Report branch customers]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=38204#p38204" />
			<content type="html"><![CDATA[<p>hello poncho1234</p><p>can you share this code report </p><p>Thanks</p>]]></content>
			<author>
				<name><![CDATA[Mahmoud Ali]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=44917</uri>
			</author>
			<updated>2020-08-29T11:29:03Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=38204#p38204</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Report branch customers]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=38084#p38084" />
			<content type="html"><![CDATA[<p>I&#039;ve modified rep115 a little;<a href="https://imgur.com/8wUHIu5"> this is the result</a></p><p>Its a permanent modification so no option to turn off/on</p><p>If this meets the requirements I&#039;ll publish code changes and if ok will make it into an extension.</p><p>A total for the customer could be confusing as the customer has its own branch too and it can be selected in sales.</p>]]></content>
			<author>
				<name><![CDATA[poncho1234]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=19944</uri>
			</author>
			<updated>2020-08-20T18:03:04Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=38084#p38084</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Report branch customers]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=38065#p38065" />
			<content type="html"><![CDATA[<p>Hello again,</p><p>I have been looking into this, and also thought that this would be an ok task, but it turned out to be a complex task. The current options are many and one more would simple take a lot of work force.<br />For those who would like to give it a go, please create it as a module or own report in client folder.</p><p>/Joe</p>]]></content>
			<author>
				<name><![CDATA[joe]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=3</uri>
			</author>
			<updated>2020-08-18T12:21:14Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=38065#p38065</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Report branch customers]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=38059#p38059" />
			<content type="html"><![CDATA[<p>Yes indeed. It looks a little overwhelming, but let us see. I will have a look.</p><p>/Joe</p>]]></content>
			<author>
				<name><![CDATA[joe]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=3</uri>
			</author>
			<updated>2020-08-17T12:23:48Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=38059#p38059</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Report branch customers]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=38049#p38049" />
			<content type="html"><![CDATA[<p>@joe: nice feature - can implement it - branch-wise split up of sales for each customer. A simple checkbox (boolean flag) for branch-wise reporting should be sufficient in the report request form.</p>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2020-08-17T05:35:30Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=38049#p38049</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Report branch customers]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=38044#p38044" />
			<content type="html"><![CDATA[<p>I need help I need in report customer balance filter by branch customer</p><p>For example customer 1 total is 3500 <br />Branch 1 = 1500<br />Branch 2 =2000<br />I need report for this branch filter in customer balance</p>]]></content>
			<author>
				<name><![CDATA[Mahmoud Ali]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=44917</uri>
			</author>
			<updated>2020-08-16T18:04:04Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=38044#p38044</id>
		</entry>
</feed>
