From: <ex...@us...> - 2016-08-24 09:03:11
|
Revision: 7600 http://sourceforge.net/p/web-erp/reponame/7600 Author: exsonqu Date: 2016-08-24 09:03:08 +0000 (Wed, 24 Aug 2016) Log Message: ----------- 24/9/16 Exson: Fixed the bug that days of payment terms in the following month over 31 days can not be handled correctly in DateFunctions.inc. Modified Paths: -------------- trunk/includes/DateFunctions.inc Modified: trunk/includes/DateFunctions.inc =================================================================== --- trunk/includes/DateFunctions.inc 2016-08-21 03:11:43 UTC (rev 7599) +++ trunk/includes/DateFunctions.inc 2016-08-24 09:03:08 UTC (rev 7600) @@ -752,8 +752,11 @@ $YearDue = $Date_Array[2]; } elseif($DayInFollowingMonth>=29) { //take the last day of month - - $DayDue = 0; + if ($DayInFollowingMonth <= 31) { + $DayDue = 0; + } else { + $DayDue = $DayInFollowingMonth-31; + } $MonthDue = $Date_Array[1]+2; $YearDue = $Date_Array[2]; } else { @@ -769,8 +772,11 @@ $YearDue = $Date_Array[2]; } elseif($DayInFollowingMonth>=29) { //take the last day of month - - $DayDue = 0; + if ($DayInFollowingMonth <= 31) { + $DayDue = 0; + } else { + $DayDue = $DayInFollowingMonth-31; + } $MonthDue = $Date_Array[0]+2; $YearDue = $Date_Array[2]; } else { @@ -786,7 +792,11 @@ } elseif($DayInFollowingMonth>=29) { //take the last day of month - $DayDue = 0; + if ($DayInFollowingMonth <= 31) { + $DayDue = 0; + } else { + $DayDue = $DayInFollowingMonth-31; + } $MonthDue = $Date_Array[1]+2; $YearDue = $Date_Array[0]; } else { @@ -1104,4 +1114,4 @@ return $myrow[0]; } -?> \ No newline at end of file +?> |