From: <dai...@us...> - 2011-06-18 22:27:50
|
Revision: 4601 http://web-erp.svn.sourceforge.net/web-erp/?rev=4601&view=rev Author: daintree Date: 2011-06-18 22:27:44 +0000 (Sat, 18 Jun 2011) Log Message: ----------- ricards earliest dispatch mods Modified Paths: -------------- trunk/SystemParameters.php trunk/includes/DateFunctions.inc trunk/sql/mysql/upgrade4.04.4-4.04.5.sql Modified: trunk/SystemParameters.php =================================================================== --- trunk/SystemParameters.php 2011-06-18 07:05:12 UTC (rev 4600) +++ trunk/SystemParameters.php 2011-06-18 22:27:44 UTC (rev 4601) @@ -117,6 +117,9 @@ if ($_SESSION['QuickEntries'] != $_POST['X_QuickEntries'] ) { $sql[] = "UPDATE config SET confvalue = '".$_POST['X_QuickEntries']."' WHERE confname = 'QuickEntries'"; } + if ($_SESSION['WorkingDaysWeek'] != $_POST['X_WorkingDaysWeek'] ) { + $sql[] = "UPDATE config SET confvalue = '".$_POST['X_WorkingDaysWeek']."' WHERE confname = 'WorkingDaysWeek'"; + } if ($_SESSION['DispatchCutOffTime'] != $_POST['X_DispatchCutOffTime'] ) { $sql[] = "UPDATE config SET confvalue = '".$_POST['X_DispatchCutOffTime']."' WHERE confname = 'DispatchCutOffTime'"; } @@ -458,6 +461,16 @@ <td>' . _('Customer branches can be set by default not to print packing slips with the company logo and address. This is useful for companies that ship to customers customers and to show the source of the shipment would be inappropriate. There is an option on the setup of customer branches to ship blind, this setting is the default applied to all new customer branches') . '</td> </tr>'; +// Working days on a week +echo '<tr style="outline: 1px solid"><td>' . _('Working Days on a Week') . ':</td> + <td><select Name="X_WorkingDaysWeek"> + <option '.($_SESSION['WorkingDaysWeek']=='7'?'selected ':'').'value="7">7 '._('working days').'</option> + <option '.($_SESSION['WorkingDaysWeek']=='6'?'selected ':'').'value="6">6 '._('working days').'</option> + <option '.($_SESSION['WorkingDaysWeek']=='5'?'selected ':'').'value="5">5 '._('working days').'</option> + </select></td> + <td>' . _('Number of working days on a week') . '</td> + </tr>'; + // DispatchCutOffTime echo '<tr style="outline: 1px solid"><td>' . _('Dispatch Cut-Off Time') . ':</td> <td><select Name="X_DispatchCutOffTime">'; Modified: trunk/includes/DateFunctions.inc =================================================================== --- trunk/includes/DateFunctions.inc 2011-06-18 07:05:12 UTC (rev 4600) +++ trunk/includes/DateFunctions.inc 2011-06-18 22:27:44 UTC (rev 4601) @@ -777,19 +777,21 @@ function CalcEarliestDispatchDate (){ -/*This function will need to be modified depending on the business - many businesses run 24x7 -The default assumes no delivery on Sat and Sun*/ +/*There is a system parameter that allows the number of working days to be defined $_SESSION['WorkingDaysWeek'] if this is set to 5 then the assumption is no delivery on Sat and Sun + * if the number of working days is 6 then it is assumed that there is no delivery on Sunday + * if the number of working days is 7 then there are deliveries every day + * */ $EarliestDispatch = time(); - if (Date('w',$EarliestDispatch)==0 ){ + if ((Date('w',$EarliestDispatch)==0) AND ($_SESSION['WorkingDaysWeek'] != '7')){ -/*if today is a sunday the dispatch date must be tomorrow (Monday) or after */ +/*if today is a sunday AND the company does NOT work 7 days a week, the dispatch date must be tomorrow (Monday) or after */ $EarliestDispatch = Mktime(0,0,0,Date('m',$EarliestDispatch),Date('d',$EarliestDispatch)+1,Date('y',$EarliestDispatch)); - } elseif (Date('w',$EarliestDispatch)==6){ + } elseif ((Date('w',$EarliestDispatch)==6) AND ($_SESSION['WorkingDaysWeek'] != '6') AND ($_SESSION['WorkingDaysWeek'] != '7')){ -/*if today is a saturday the dispatch date must be Monday or after */ +/*if today is a saturday AND the company does NOT work at least 6 days a week, the dispatch date must be Monday or after */ $EarliestDispatch = Mktime(0,0,0,Date('m',$EarliestDispatch),Date('d',$EarliestDispatch)+2,Date('y',$EarliestDispatch)); Modified: trunk/sql/mysql/upgrade4.04.4-4.04.5.sql =================================================================== --- trunk/sql/mysql/upgrade4.04.4-4.04.5.sql 2011-06-18 07:05:12 UTC (rev 4600) +++ trunk/sql/mysql/upgrade4.04.4-4.04.5.sql 2011-06-18 22:27:44 UTC (rev 4601) @@ -1,2 +1,3 @@ ALTER TABLE `custcontacts` ADD `email` VARCHAR( 55 ) NOT NULL; +INSERT INTO config (confname, confvalue) VALUES ('WorkingDaysWeek','5'); UPDATE config SET confvalue='4.04.5' WHERE confname='VersionNumber'; \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |