<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[FrontAccounting forum — Whats happened with Recurrent invoices?]]></title>
	<link rel="self" href="https://frontaccounting.com/punbb/extern.php?action=feed&amp;tid=7169&amp;type=atom" />
	<updated>2017-12-16T02:40:50Z</updated>
	<generator>PunBB</generator>
	<id>https://frontaccounting.com/punbb/viewtopic.php?id=7169</id>
		<entry>
			<title type="html"><![CDATA[Re: Whats happened with Recurrent invoices?]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=30035#p30035" />
			<content type="html"><![CDATA[<p>When days = -1 and the day of the last sent date is 29, 30 and 31 which are part of valid dates after computation of $next if they become the last day of that month, this is what is desirable. If however, those $next dates are not valid, then they should be pushed to the last day of that month. The <a href="https://en.wikipedia.org/wiki/Karnaugh_map">Karnaugh</a> map of this logic on reduction just means irrespective of the day part of the last sent date, just push it to the last day of the computed $next date. he question is that how is the computation of the $next date to be undertaken for edge conditions. The &quot;-1&quot; according to the wiki is just a token to indicate the last date of the previous month as the $next date - so what is the logic needed to code it that way so that it will not have to rely on hindsight.</p>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2017-12-16T02:40:50Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=30035#p30035</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Whats happened with Recurrent invoices?]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=30028#p30028" />
			<content type="html"><![CDATA[<p>Yes, that sounds good.</p><p>Comment: Are 29, 30 &amp; 31 &#039;edge&#039; cases?</p>]]></content>
			<author>
				<name><![CDATA[poncho1234]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=19944</uri>
			</author>
			<updated>2017-12-15T17:51:22Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=30028#p30028</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Whats happened with Recurrent invoices?]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=29998#p29998" />
			<content type="html"><![CDATA[<p>Also we can make sure that if the Invoice Date becomes 29 to 31 we need to push it to the end of the month if it is invalid (like 31st Feb). That way, can we do away with the &quot;-1&quot; days by always choosing 31st of some valid / invalid month?</p>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2017-12-15T05:35:04Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=29998#p29998</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Whats happened with Recurrent invoices?]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=29996#p29996" />
			<content type="html"><![CDATA[<p>For me the expected results would be as follows:-</p><p>Test 3&nbsp; &nbsp; 0&nbsp; &nbsp; 1&nbsp; &nbsp; 05-12-16&nbsp; &nbsp; &nbsp; &nbsp; 1&nbsp; &nbsp; 05-01-17&nbsp; &nbsp; 05/12/2016 - 04/01/2017.<br />Test 3&nbsp; &nbsp; 0&nbsp; &nbsp; 1&nbsp; &nbsp; 05-12-16&nbsp; &nbsp; &nbsp; &nbsp; 2&nbsp; &nbsp; 05-02-17&nbsp; &nbsp; 05/01/2017 - 04/02/2017.<br />Test 3&nbsp; &nbsp; 0&nbsp; &nbsp; 1&nbsp; &nbsp; 05-12-16&nbsp; &nbsp; &nbsp; &nbsp; 3&nbsp; &nbsp; 05-03-17&nbsp; &nbsp; 05/02/2017 - 04/03/2017.<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />Test 4&nbsp; &nbsp; 0&nbsp; &nbsp; 1&nbsp; &nbsp; 29-12-16&nbsp; &nbsp; &nbsp; &nbsp; 1&nbsp; &nbsp; 29-01-17&nbsp; &nbsp; 29/12/2016 - 28/01/2017.<br />Test 4&nbsp; &nbsp; 0&nbsp; &nbsp; 1&nbsp; &nbsp; 29-12-16&nbsp; &nbsp; &nbsp; &nbsp; 2&nbsp; &nbsp; 28-02-17&nbsp; &nbsp; 29/01/2017 - 27/02/2017.<br />Test 4&nbsp; &nbsp; 0&nbsp; &nbsp; 1&nbsp; &nbsp; 29-12-16&nbsp; &nbsp; &nbsp; &nbsp; 3&nbsp; &nbsp; 29-03-17&nbsp; &nbsp; 28/02/2017 - 28/03/2017.<br />Test 4&nbsp; &nbsp; 0&nbsp; &nbsp; 1&nbsp; &nbsp; 29-12-16&nbsp; &nbsp; &nbsp; &nbsp; 4&nbsp; &nbsp; 29-04-17&nbsp; &nbsp; 29/03/2017 - 28/04/2017.</p><p>Test 4&nbsp; &nbsp; 0&nbsp; &nbsp; 1&nbsp; &nbsp; 30-12-16&nbsp; &nbsp; &nbsp; &nbsp; 1&nbsp; &nbsp; 30-01-17&nbsp; &nbsp; 30/12/2016 - 29/01/2017.<br />Test 4&nbsp; &nbsp; 0&nbsp; &nbsp; 1&nbsp; &nbsp; 30-12-16&nbsp; &nbsp; &nbsp; &nbsp; 2&nbsp; &nbsp; 28-02-17&nbsp; &nbsp; 30/01/2017 - 27/02/2017.<br />Test 4&nbsp; &nbsp; 0&nbsp; &nbsp; 1&nbsp; &nbsp; 30-12-16&nbsp; &nbsp; &nbsp; &nbsp; 3&nbsp; &nbsp; 30-03-17&nbsp; &nbsp; 28/02/2017 - 29/03/2017.<br />Test 4&nbsp; &nbsp; 0&nbsp; &nbsp; 1&nbsp; &nbsp; 30-12-16&nbsp; &nbsp; &nbsp; &nbsp; 4&nbsp; &nbsp; 30-04-17&nbsp; &nbsp; 30/03/2017 - 29/04/2017.</p><p>Test 4&nbsp; &nbsp; 0&nbsp; &nbsp; 1&nbsp; &nbsp; 31-12-16&nbsp; &nbsp; &nbsp; &nbsp; 1&nbsp; &nbsp; 31-01-17&nbsp; &nbsp; 31/12/2016 - 30/01/2017.<br />Test 4&nbsp; &nbsp; 0&nbsp; &nbsp; 1&nbsp; &nbsp; 31-12-16&nbsp; &nbsp; &nbsp; &nbsp; 2&nbsp; &nbsp; 28-02-17&nbsp; &nbsp; 31/01/2017 - 27/02/2017.<br />Test 4&nbsp; &nbsp; 0&nbsp; &nbsp; 1&nbsp; &nbsp; 31-12-16&nbsp; &nbsp; &nbsp; &nbsp; 3&nbsp; &nbsp; 31-03-17&nbsp; &nbsp; 28/02/2017 - 30/03/2017.<br />Test 4&nbsp; &nbsp; 0&nbsp; &nbsp; 1&nbsp; &nbsp; 31-12-16&nbsp; &nbsp; &nbsp; &nbsp; 4&nbsp; &nbsp; 30-04-17&nbsp; &nbsp; 31/03/2017 - 29/04/2017.<br />Test 4&nbsp; &nbsp; 0&nbsp; &nbsp; 1&nbsp; &nbsp; 31-12-16&nbsp; &nbsp; &nbsp; &nbsp; 5&nbsp; &nbsp; 31-05-17&nbsp; &nbsp; 30/04/2017 - 30/05/2017.</p><p>I think I have that right please check</p><p>As I said earlier We can state in the wiki that only start dates to the 28th of the month are permitted</p>]]></content>
			<author>
				<name><![CDATA[poncho1234]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=19944</uri>
			</author>
			<updated>2017-12-14T18:32:00Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=29996#p29996</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Whats happened with Recurrent invoices?]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=29995#p29995" />
			<content type="html"><![CDATA[<p>The method of date calculation for add_months() has been hardcoded for<br />1 leap day each 4 years, <br />1 more leap day each 100 years and <br />1 less leap day every 400 years.<br />The number of days each month are looked up in an array in this manner.</p><p>This translates into the famous &quot;What day would Christmas be in the year ####&quot; as absolute day of Christmas for a known year + no. of years to required year from known year * 1.2496.</p><p>That is why I wanted the Gregorian year php function to be used. Even then I doubt this issue would get solved fully.</p><p>Let us first determine what we want for each of the 29 (non leap years), 30, 31 dates.</p>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2017-12-14T17:39:25Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=29995#p29995</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Whats happened with Recurrent invoices?]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=29987#p29987" />
			<content type="html"><![CDATA[<p>We may be getting a little confused with the objective,</p><p>The original code (before the above mods) functioned&nbsp; if 0 for days and 1 or more entered in months, the start date would then be the billing date going forward. So for dates from the 1st - 28th of the month this works fine, but what happens if you want the 29th, 30th or 31st? It all goes wrong in February (unless its a leap year for the 29th), and stays wrong in march onwards.</p><p>We can state in the wiki that only start dates to the 28th of the month are permitted, but...?</p>]]></content>
			<author>
				<name><![CDATA[poncho1234]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=19944</uri>
			</author>
			<updated>2017-12-14T15:03:22Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=29987#p29987</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Whats happened with Recurrent invoices?]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=29973#p29973" />
			<content type="html"><![CDATA[<p>Shall we code so that:<br /></p><div class="codebox"><pre><code>Test expected    -1    1    31-12-2016        1    31-01-2017    31-12-2016 - 30-01-2017.</code></pre></div><p>The last sent will then become 31-01-2017 ?</p>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2017-12-14T04:15:32Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=29973#p29973</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Whats happened with Recurrent invoices?]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=29972#p29972" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>//new function calculate_next
function calculate_next($myrow)
{
    if ($myrow[&quot;last_sent&quot;] == &#039;0000-00-00&#039;)
        $next = sql2date($myrow[&quot;begin&quot;]);
    else
        $next = sql2date($myrow[&quot;last_sent&quot;]);
    if ($myrow[&#039;days&#039;] == -1 &amp;&amp; $myrow[&#039;monthly&#039;] &gt; 0) {
        // ignore months when days = -1
            $next = begin_month($next); // to later become last day of previous month
            $myrow[&#039;days&#039;]=0;
    }
    $next = add_months($next, $myrow[&#039;monthly&#039;]);
    $next = add_days($next, $myrow[&#039;days&#039;]);
    return add_days($next,-1);
}</code></pre></div><p>is giving the same result</p><p>Test 9e&nbsp; &nbsp; -1&nbsp; &nbsp; 1&nbsp; &nbsp; 31-12-16&nbsp; &nbsp; &nbsp; &nbsp; 1&nbsp; &nbsp; 30-01-17&nbsp; &nbsp; 31/12/2016 - 29/01/2017.<br />Test 9e&nbsp; &nbsp; -1&nbsp; &nbsp; 1&nbsp; &nbsp; 31-12-16&nbsp; &nbsp; &nbsp; &nbsp; 2&nbsp; &nbsp; 27-02-17&nbsp; &nbsp; 30/01/2017 - 26/02/2017.<br />Test 9e&nbsp; &nbsp; -1&nbsp; &nbsp; 1&nbsp; &nbsp; 31-12-16&nbsp; &nbsp; &nbsp; &nbsp; 3&nbsp; &nbsp; 26-03-17&nbsp; &nbsp; 27/02/2017 - 25/03/2017.</p>]]></content>
			<author>
				<name><![CDATA[poncho1234]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=19944</uri>
			</author>
			<updated>2017-12-13T21:33:08Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=29972#p29972</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Whats happened with Recurrent invoices?]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=29940#p29940" />
			<content type="html"><![CDATA[<p>Try this now:<br /></p><div class="codebox"><pre><code>function calculate_next($myrow)
{
    if ($myrow[&quot;last_sent&quot;] == &#039;0000-00-00&#039;)
        $next = sql2date($myrow[&quot;begin&quot;]);
    else
        $next = sql2date($myrow[&quot;last_sent&quot;]);
    if ($myrow[&#039;days&#039;] == -1 &amp;&amp; $myrow[&#039;monthly&#039;] &gt; 0) {
        // ignore months when days = -1
            $next = begin_month($next); // to later become last day of previous month
            $myrow[&#039;days&#039;]=0;
    }
    $next = add_months($next, $myrow[&#039;monthly&#039;]);
    $next = add_days($next, $myrow[&#039;days&#039;]);
    return add_days($next,-1);
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2017-12-11T23:32:18Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=29940#p29940</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Whats happened with Recurrent invoices?]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=29936#p29936" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>function calculate_next($myrow)
{
    if ($myrow[&quot;last_sent&quot;] == &#039;0000-00-00&#039;)
        $next = sql2date($myrow[&quot;begin&quot;]);
    else
        $next = sql2date($myrow[&quot;last_sent&quot;]);
    if ($myrow[&#039;days&#039;] == -1 &amp;&amp; $myrow[&#039;monthly&#039;] &gt; 0) {
        // ignore months when days = -1
            $next = add_days(begin_month($next), -1); // last day of previous month
            $myrow[&#039;days&#039;]=0;
    }
    $next = add_months($next, $myrow[&#039;monthly&#039;]);
    $next = add_days($next, $myrow[&#039;days&#039;]);
    return add_days($next,-1);
}</code></pre></div><p>gives</p><p>Test 9d&nbsp; &nbsp; -1&nbsp; &nbsp; 1&nbsp; &nbsp; 31-12-16&nbsp; &nbsp; &nbsp; &nbsp; 1&nbsp; &nbsp; 30-01-17&nbsp; &nbsp; 31/12/2016 - 29/01/2017.<br />Test 9d&nbsp; &nbsp; -1&nbsp; &nbsp; 1&nbsp; &nbsp; 31-12-16&nbsp; &nbsp; &nbsp; &nbsp; 2&nbsp; &nbsp; 27-02-17&nbsp; &nbsp; 30/01/2017 - 26/02/2017.<br />Test 9d&nbsp; &nbsp; -1&nbsp; &nbsp; 1&nbsp; &nbsp; 31-12-16&nbsp; &nbsp; &nbsp; &nbsp; 3&nbsp; &nbsp; 26-03-17&nbsp; &nbsp; 27/02/2017 - 25/03/2017.</p>]]></content>
			<author>
				<name><![CDATA[poncho1234]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=19944</uri>
			</author>
			<updated>2017-12-11T17:27:46Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=29936#p29936</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Whats happened with Recurrent invoices?]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=29932#p29932" />
			<content type="html"><![CDATA[<p>From the wiki:<br /></p><div class="quotebox"><blockquote><p>A days value of -1 together with a month value would be the last day in the previous month.</p></blockquote></div><p>Hence we need a month value as well to get the period.</p><p>The function that can now be tried is:<br /></p><div class="codebox"><pre><code>function calculate_next($myrow)
{
    if ($myrow[&quot;last_sent&quot;] == &#039;0000-00-00&#039;)
        $next = sql2date($myrow[&quot;begin&quot;]);
    else
        $next = sql2date($myrow[&quot;last_sent&quot;]);
    if ($myrow[&#039;days&#039;] == -1 &amp;&amp; $myrow[&#039;monthly&#039;] &gt; 0) {
        // ignore months when days = -1
        $next = add_days(begin_month($next), -1); // last day of previous month
        $myrow[&#039;days&#039;]=0;
    }
    $next = add_months($next, $myrow[&#039;monthly&#039;]);
    $next = add_days($next, $myrow[&#039;days&#039;]);
    return add_days($next,-1);
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2017-12-11T15:28:53Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=29932#p29932</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Whats happened with Recurrent invoices?]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=29930#p29930" />
			<content type="html"><![CDATA[<p>With:-</p><div class="codebox"><pre><code>function calculate_next($myrow)
{
    if ($myrow[&quot;last_sent&quot;] == &#039;0000-00-00&#039;)
        $next = sql2date($myrow[&quot;begin&quot;]);
    else
        $next = sql2date($myrow[&quot;last_sent&quot;]);
    if ($myrow[&#039;days&#039;] == -1) {
        // ignore months when days = -1
            $next = add_days($next, 2); // &lt;-- changed line
            $next = end_month($next);
            return $next;
    } else {
        $next = add_months($next, $myrow[&#039;monthly&#039;]);
        $next = add_days($next, $myrow[&#039;days&#039;]);
        return add_days($next,-1);
    }
}</code></pre></div><p>I&#039;m getting the following:-<br />Input to recurrent invoices&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Create and Print Recurrent Invoices&nbsp; &nbsp; <br />Name&nbsp; &nbsp; Days&nbsp; &nbsp; Monthly&nbsp; &nbsp; Begin&nbsp; &nbsp; &nbsp; &nbsp; Invoice #&nbsp; &nbsp; Invoice date&nbsp; &nbsp; Recurrent Invoice covers period <br />Test 1c&nbsp; &nbsp; 7&nbsp; &nbsp; 0&nbsp; &nbsp; 01-12-16&nbsp; &nbsp; &nbsp; &nbsp; 1&nbsp; &nbsp; 08-12-16&nbsp; &nbsp; 01/12/2016 - 07/12/2016.<br />Test 1c&nbsp; &nbsp; 7&nbsp; &nbsp; 0&nbsp; &nbsp; 01-12-16&nbsp; &nbsp; &nbsp; &nbsp; 2&nbsp; &nbsp; 15-12-16&nbsp; &nbsp; 08/12/2016 - 14/12/2016.<br />&nbsp; &nbsp; &nbsp; &nbsp;&quot;&nbsp; &nbsp; &quot;&nbsp; &nbsp; &quot;&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &quot;&nbsp; &nbsp; &nbsp; &nbsp; &quot;&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &quot;&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;<br />Test 1c&nbsp; &nbsp; 7&nbsp; &nbsp; 0&nbsp; &nbsp; 01-12-16&nbsp; &nbsp; &nbsp; &nbsp; <s>12?</s>&nbsp; &nbsp; 23-02-17&nbsp; &nbsp; 16/02/2017 - 22/02/2017.<br />Test 1c&nbsp; &nbsp; 7&nbsp; &nbsp; 0&nbsp; &nbsp; 01-12-16&nbsp; &nbsp; &nbsp; &nbsp; <s>13?</s>&nbsp; &nbsp; 02-03-17&nbsp; &nbsp; 23/02/2017 - 01/03/2017.<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />Test 2c&nbsp; &nbsp; 0&nbsp; &nbsp; 1&nbsp; &nbsp; 01-12-16&nbsp; &nbsp; &nbsp; &nbsp; 1&nbsp; &nbsp; 01-01-17&nbsp; &nbsp; 01/12/2016 - 31/12/2016.<br />Test 2c&nbsp; &nbsp; 0&nbsp; &nbsp; 1&nbsp; &nbsp; 01-12-16&nbsp; &nbsp; &nbsp; &nbsp; 2&nbsp; &nbsp; 01-02-17&nbsp; &nbsp; 01/01/2017 - 31/01/2017.<br />Test 2c&nbsp; &nbsp; 0&nbsp; &nbsp; 1&nbsp; &nbsp; 01-12-16&nbsp; &nbsp; &nbsp; &nbsp; 3&nbsp; &nbsp; 01-03-17&nbsp; &nbsp; 01/02/2017 - 28/02/2017.<br />Test 2c&nbsp; &nbsp; 0&nbsp; &nbsp; 1&nbsp; &nbsp; 01-12-16&nbsp; &nbsp; &nbsp; &nbsp; 4&nbsp; &nbsp; 01-04-17&nbsp; &nbsp; 01/03/2017 - 31/03/2017.<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />Test 5c&nbsp; &nbsp; 0&nbsp; &nbsp; 1&nbsp; &nbsp; 31-12-16&nbsp; &nbsp; &nbsp; &nbsp; 1&nbsp; &nbsp; 31-01-17&nbsp; &nbsp; 31/12/2016 - 30/01/2017.<br />Test 5c&nbsp; &nbsp; 0&nbsp; &nbsp; 1&nbsp; &nbsp; 31-12-16&nbsp; &nbsp; &nbsp; &nbsp; 2&nbsp; &nbsp; 28-02-17&nbsp; &nbsp; 31/01/2017 - 27/02/2017.<br />Test 5c&nbsp; &nbsp; 0&nbsp; &nbsp; 1&nbsp; &nbsp; 31-12-16&nbsp; &nbsp; &nbsp; &nbsp; 3&nbsp; &nbsp; 28-03-17&nbsp; &nbsp; 28/02/2017 - 27/03/2017.<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />Test 9&nbsp; &nbsp; -1&nbsp; &nbsp; 0&nbsp; &nbsp; 31-12-16&nbsp; &nbsp; &nbsp; &nbsp; 1&nbsp; &nbsp; 30-12-16&nbsp; &nbsp; 31/12/2016 - 29/12/2016.<br />Test 9&nbsp; &nbsp; -1&nbsp; &nbsp; 0&nbsp; &nbsp; 31-12-16&nbsp; &nbsp; &nbsp; &nbsp; 2&nbsp; &nbsp; 29-12-16&nbsp; &nbsp; 30/12/2016 - 28/12/2016.<br />Test 9&nbsp; &nbsp; -1&nbsp; &nbsp; 0&nbsp; &nbsp; 31-12-16&nbsp; &nbsp; &nbsp; &nbsp; 3&nbsp; &nbsp; 28-12-16&nbsp; &nbsp; 29/12/2016 - 27/12/2016.</p>]]></content>
			<author>
				<name><![CDATA[poncho1234]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=19944</uri>
			</author>
			<updated>2017-12-11T15:01:57Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=29930#p29930</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Whats happened with Recurrent invoices?]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=29920#p29920" />
			<content type="html"><![CDATA[<p>Ah... !<br />Ok, will retest with updated function, maybe today, probably tomorrow.</p>]]></content>
			<author>
				<name><![CDATA[poncho1234]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=19944</uri>
			</author>
			<updated>2017-12-10T20:21:51Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=29920#p29920</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Whats happened with Recurrent invoices?]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=29918#p29918" />
			<content type="html"><![CDATA[<p>For 30 days it appears okay so we do not need to change that portion.</p><p>For -1, the invoice needs to be raised on the last day of the month for the period from the last day of the previous month to the day before the last day of the current month.</p><p>The new function replacement should be:<br /></p><div class="codebox"><pre><code>function calculate_next($myrow)
{
    if ($myrow[&quot;last_sent&quot;] == &#039;0000-00-00&#039;)
        $next = sql2date($myrow[&quot;begin&quot;]);
    else
        $next = sql2date($myrow[&quot;last_sent&quot;]);
    if ($myrow[&#039;days&#039;] == -1) {
        // ignore months when days = -1
            $next = add_days($next, 2); // &lt;-- changed line
            $next = end_month($next);
            return $next;
    } else {
        $next = add_months($next, $myrow[&#039;monthly&#039;]);
        $next = add_days($next, $myrow[&#039;days&#039;]);
        return add_days($next,-1);
    }
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2017-12-10T19:01:53Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=29918#p29918</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Whats happened with Recurrent invoices?]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=29917#p29917" />
			<content type="html"><![CDATA[<p>so with </p><div class="codebox"><pre><code>//new function calculate_next
function calculate_next($myrow)
{
    if ($myrow[&#039;days&#039;] == -1) {
// ignore months when days = -1
    $next = add_days($next, 1);
    $next = end_month($next);
    return $next;
} else {
    $next = add_months($next, $myrow[&#039;monthly&#039;]);
    $next = add_days($next, $myrow[&#039;days&#039;]);
    return add_days($next,-1);
}
}</code></pre></div><p>I&#039;m getting:-</p><p>Test 7&nbsp; &nbsp; 30&nbsp; &nbsp; 0&nbsp; &nbsp; 01-12-16&nbsp; &nbsp; &nbsp; &nbsp; 1&nbsp; &nbsp; 31-12-16&nbsp; &nbsp; 01/12/2016 - 30/12/2016.<br />Test 7&nbsp; &nbsp; 30&nbsp; &nbsp; 0&nbsp; &nbsp; 01-12-16&nbsp; &nbsp; &nbsp; &nbsp; 2&nbsp; &nbsp; 30-01-17&nbsp; &nbsp; 31/12/2016 - 29/01/2017.<br />Test 7&nbsp; &nbsp; 30&nbsp; &nbsp; 0&nbsp; &nbsp; 01-12-16&nbsp; &nbsp; &nbsp; &nbsp; 3&nbsp; &nbsp; 01-03-17&nbsp; &nbsp; 30/01/2017 - 28/02/2017.<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />Test 8&nbsp; &nbsp; 30&nbsp; &nbsp; 0&nbsp; &nbsp; 31-12-16&nbsp; &nbsp; &nbsp; &nbsp; 1&nbsp; &nbsp; 30-01-17&nbsp; &nbsp; 31/12/2016 - 29/01/2017.<br />Test 8&nbsp; &nbsp; 30&nbsp; &nbsp; 0&nbsp; &nbsp; 31-12-16&nbsp; &nbsp; &nbsp; &nbsp; 2&nbsp; &nbsp; 01-03-17&nbsp; &nbsp; 30/01/2017 - 28/02/2017.<br />Test 8&nbsp; &nbsp; 30&nbsp; &nbsp; 0&nbsp; &nbsp; 31-12-16&nbsp; &nbsp; &nbsp; &nbsp; 3&nbsp; &nbsp; 31-03-17&nbsp; &nbsp; 01/03/2017 - 30/03/2017.</p>]]></content>
			<author>
				<name><![CDATA[poncho1234]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=19944</uri>
			</author>
			<updated>2017-12-10T18:00:48Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=29917#p29917</id>
		</entry>
</feed>
