<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[FrontAccounting forum — Print a large number of invoices at once]]></title>
	<link rel="self" href="https://frontaccounting.com/punbb/extern.php?action=feed&amp;tid=5530&amp;type=atom" />
	<updated>2015-02-14T03:36:36Z</updated>
	<generator>PunBB</generator>
	<id>https://frontaccounting.com/punbb/viewtopic.php?id=5530</id>
		<entry>
			<title type="html"><![CDATA[Re: Print a large number of invoices at once]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=22526#p22526" />
			<content type="html"><![CDATA[<p>This means that this error pre-existed in FA. In FA v2.4, we must make sure that $customer has some value (even if blank) before arriving at rep107.php since the very same construct &quot;if (!exists_customer_trans(.....&quot; precedes the current commit lines of rep107.php in rep110.php and rep113.php and the equivalent &quot;if($myrow[&#039;debtor_no&#039;] != $customer) {&quot; instead of the current commit lines will always be sufficient even if not coded so.</p><p>@joe: thanks for spotting and correcting it forthwith. I had tested in Windoze that was probably more forgiving of absent variables!</p>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2015-02-14T03:36:36Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=22526#p22526</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Print a large number of invoices at once]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=22522#p22522" />
			<content type="html"><![CDATA[<p>A new update of the file rep107.php has been done. please make a reload of the file from HG repository.</p><p>/Joe</p>]]></content>
			<author>
				<name><![CDATA[joe]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=3</uri>
			</author>
			<updated>2015-02-13T21:55:44Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=22522#p22522</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Print a large number of invoices at once]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=22519#p22519" />
			<content type="html"><![CDATA[<p>Have you tried to clear all the cache and close all instances of your browser before trying it?</p><p>Take a dump of all variables available while entering rep107.php from each menu link instance and report the difference. It may have something to do with the $currency variable not being defined or defined wrongly - under what set of values I cannot ascertain as it works correctly for me.</p>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2015-02-13T16:34:51Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=22519#p22519</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Print a large number of invoices at once]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=22518#p22518" />
			<content type="html"><![CDATA[<p>Strange thing happened. </p><p>With the new rep107.php file, the function under &#039;Customer and Sales Reports&#039; --&gt; &#039;Print Invoices&#039; works well. <br />However, if I go to &#039;Sales&#039; --&gt; &#039;Customer Transaction Inquiry&#039; and then print individual invoice there, I get blank page.</p><p>I replaced with the old rep107.php file and then printing in &#039;Customer Transaction Inquiry&#039; returns normal. </p><p>With the new rep113.php file, printing credit note in&nbsp; &#039;Customer Transaction Inquiry&#039; has no issue.</p>]]></content>
			<author>
				<name><![CDATA[sirka]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=19866</uri>
			</author>
			<updated>2015-02-13T16:24:58Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=22518#p22518</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Print a large number of invoices at once]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=22517#p22517" />
			<content type="html"><![CDATA[<p>Thanks both for your help! I have replaced rep107, 108, 109, 111, 112, 113 in my system and now the currency filter works perfectly! Very helpful. Thank you.</p>]]></content>
			<author>
				<name><![CDATA[sirka]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=19866</uri>
			</author>
			<updated>2015-02-13T16:08:17Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=22517#p22517</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Print a large number of invoices at once]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=22516#p22516" />
			<content type="html"><![CDATA[<p>All reports affected by the <a href="http://devel.frontaccounting.com/git/?p=fa-stable.git;a=commit;h=3c73d05998cf50fed7fa5c0a568a1a911e7023e2">currency filter commit</a> other than <strong>rep108.php</strong> get their results from other functions. In FA 2.4, we can consider filtering them in the WHERE clause in the source function&#039;s SQL tself.</p><p>In <strong>rep108.php</strong>, the sql is executed inline and can hence be filtered in the WHERE clause itself instead of in the php loop after the fact. The patch below achieves it:<br /></p><div class="codebox"><pre><code>--- reporting/rep108.php    Fri Feb 13 20:23:10 2015
+++ reporting/rep108.php    Fri Feb 13 20:19:18 2015
@@ -86,18 +86,17 @@
    if ($orientation == &#039;L&#039;)
         recalculate_cols($cols);
  
-    $sql = &quot;SELECT debtor_no, name AS DebtorName, address, tax_id, curr_code, curdate() AS tran_date FROM &quot;.TB_PREF.&quot;debtors_master&quot;;
+    $sql = &quot;SELECT debtor_no, name AS DebtorName, address, tax_id, curr_code, curdate() AS tran_date FROM &quot;.TB_PREF.&quot;debtors_master WHERE 1 &quot;;
     if ($customer != ALL_TEXT)
-        $sql .= &quot; WHERE debtor_no = &quot;.db_escape($customer);
-    else
+        $sql .= &quot; AND debtor_no = &quot;.db_escape($customer);
+    if ($currency != ALL_TEXT)
+        $sql .= &quot; AND curr_code = &quot;.db_escape($currency);
+
         $sql .= &quot; ORDER by name&quot;;
     $result = db_query($sql, &quot;The customers could not be retrieved&quot;);
 
     while ($myrow=db_fetch($result))
     {
-        if ($currency != ALL_TEXT &amp;&amp; $myrow[&#039;curr_code&#039;] != $currency) {
-            continue;
-        }    
         $date = date(&#039;Y-m-d&#039;);
 
         $myrow[&#039;order_&#039;] = &quot;&quot;;</code></pre></div>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2015-02-13T15:03:47Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=22516#p22516</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Print a large number of invoices at once]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=22509#p22509" />
			<content type="html"><![CDATA[<p>@joe: Thanks. That was fast and elegant.</p><p><span class="bbu">For the record:</span><br /><strong>ALL_TEXT</strong>, the blank string constant, is defined in <strong>include/types.inc</strong> and is included in <strong>includes/main.inc</strong> which in turn is included in <strong>includes/session.inc</strong> which is included in all report files.<br />Hence it may be safely used in all reports.</p>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2015-02-13T05:54:43Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=22509#p22509</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Print a large number of invoices at once]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=22507#p22507" />
			<content type="html"><![CDATA[<p>The currency filter didn&#039;t work for most documents, so these have been fixed and the 2.3 HG repo has been updated.</p><p>The fixed Invoice Document kan be downloaded <a href="http://https:/sourceforge.net/p/frontaccounting/mercurial/ci/default/tree/reporting/rep107.php">here</a>.</p><p>/Joe</p>]]></content>
			<author>
				<name><![CDATA[joe]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=3</uri>
			</author>
			<updated>2015-02-12T20:58:45Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=22507#p22507</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Print a large number of invoices at once]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=22504#p22504" />
			<content type="html"><![CDATA[<p>The currency filter do not work in rep107.php. This will be fixed for 2.3 later this evening.</p><p>The Sales Group filter will require more work elsewhere, so this will have to wait and be included during 2.4.</p><p>Joe</p>]]></content>
			<author>
				<name><![CDATA[joe]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=3</uri>
			</author>
			<updated>2015-02-12T16:44:30Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=22504#p22504</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Print a large number of invoices at once]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=22503#p22503" />
			<content type="html"><![CDATA[<p>@joe: Whilst incorporating the Currency filter in the appropriate report request forms, plesse try to include Sales Group filter as well. The latter will help manage exceptions easily with the help of temporary groups. </p><p>In FA 2.4, we can allow customer branches be part of multiple Sales Groups and possibly include a fallback Sales Group in the Customer record (debtor_master) as well.</p>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2015-02-12T16:36:59Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=22503#p22503</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Print a large number of invoices at once]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=22502#p22502" />
			<content type="html"><![CDATA[<p>I wil have a look into this.</p><p>Joe</p>]]></content>
			<author>
				<name><![CDATA[joe]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=3</uri>
			</author>
			<updated>2015-02-12T16:16:00Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=22502#p22502</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Print a large number of invoices at once]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=22501#p22501" />
			<content type="html"><![CDATA[<p>I just looked deeper into the code in rep107 and it seems that currency is actually not considered in the filters<br />Those &#039;if&#039; functions only cover invoices, debtor_no and email (I hope I am reading the code directly...)<br />Can this be fixed so to include currency filter? Many thanks.</p><br /><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (!exists_customer_trans(ST_SALESINVOICE, $i))<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; continue;<br />........<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if($customer &amp;&amp; $myrow[&#039;debtor_no&#039;] != $customer) {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; continue;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />.......</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if ($email == 1)</p>]]></content>
			<author>
				<name><![CDATA[sirka]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=19866</uri>
			</author>
			<updated>2015-02-12T15:41:42Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=22501#p22501</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Print a large number of invoices at once]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=22500#p22500" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>apmuthu wrote:</cite><blockquote><p>Hope you have set the Customer Currency correctly. Otherwise, company&#039;s currency will be used and it will not be filterable. <strong>Currency</strong> is used in the payment link generation in <strong>pdf_report.inc</strong> in it&#039;s <strong>End()</strong> method. I have not been able to ascertain where else the &quot;currency variable taken from the report request form&quot; is used in report generation.</p></blockquote></div><p>I think I set up the Customer Currency correctly because there is nowhere else I can set currency. I found this code in rep107 </p><p>$cur = get_company_Pref(&#039;curr_default&#039;);</p><p>It seems the currency filter is not taking the Customer Currency but just the &#039;Home Currency&#039; under Company Set Up.</p><p>What should I do so that the Currency Filter will work as per the Customer Currency?</p><p>Thank you.</p>]]></content>
			<author>
				<name><![CDATA[sirka]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=19866</uri>
			</author>
			<updated>2015-02-12T15:23:40Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=22500#p22500</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Print a large number of invoices at once]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=22494#p22494" />
			<content type="html"><![CDATA[<p>@joe: The following info will be useful in getting Sales Groups into all pertinent reports:</p><p>functions in <strong>includes/ui/ui_lists.inc</strong>:</p><p>sales_groups_list($name, $selected_id=null, $special_option=false)<br />&nbsp; &nbsp; used in function sales_groups_list_cells<br />sales_groups_list_cells($label, $name, $selected_id=null, $special_option=false)<br />&nbsp; &nbsp; used in sales_groups_list_row<br />sales_groups_list_row($label, $name, $selected_id=null, $special_option=false)<br />&nbsp; &nbsp; used in sales/manage/customer_branches.php (data entry and updation)<br />&nbsp; &nbsp; used in sales/manage/recurrent_invoices.php (selection for recurrent invoice generation)</p><br /><p>functions in <strong>sales/includes/db/sales_groups_db.inc</strong>:</p><p>The following 5 functions are used only once in sales/manage/sales_groups.php<br />add_sales_group($description)<br />update_sales_group($selected_id, $description)<br />delete_sales_group($selected_id)<br />get_sales_groups($show_inactive)<br />get_sales_group($selected_id)</p><br /><p>get_sales_group_name($group_no)<br />&nbsp; &nbsp; used in sales/manage/recurrent_invoices.php<br />&nbsp; &nbsp; used in sales/create_recurrent_invoices.php</p>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2015-02-11T18:13:43Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=22494#p22494</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Print a large number of invoices at once]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=22493#p22493" />
			<content type="html"><![CDATA[<p>Hope you have set the Customer Currency correctly. Otherwise, company&#039;s currency will be used and it will not be filterable. <strong>Currency</strong> is used in the payment link generation in <strong>pdf_report.inc</strong> in it&#039;s <strong>End()</strong> method. I have not been able to ascertain where else the &quot;currency variable taken from the report request form&quot; is used in report generation.</p>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2015-02-11T18:11:36Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=22493#p22493</id>
		</entry>
</feed>
