|
From: <te...@us...> - 2013-07-07 09:43:03
|
Revision: 6056
http://sourceforge.net/p/web-erp/reponame/6056
Author: tehonu
Date: 2013-07-07 09:43:00 +0000 (Sun, 07 Jul 2013)
Log Message:
-----------
Added Destination Country to freight costs
Modified Paths:
--------------
trunk/FreightCosts.php
trunk/sql/mysql/upgrade4.10-4.11.sql
Modified: trunk/FreightCosts.php
===================================================================
--- trunk/FreightCosts.php 2013-07-06 22:11:54 UTC (rev 6055)
+++ trunk/FreightCosts.php 2013-07-07 09:43:00 UTC (rev 6056)
@@ -3,8 +3,9 @@
/* $Id$*/
include('includes/session.inc');
-$Title = _('Freight Costs Set Up');
+$Title = _('Freight Costs Maintenance');
include('includes/header.inc');
+include('includes/CountriesArray.php');
if (isset($_GET['LocationFrom'])){
$LocationFrom = $_GET['LocationFrom'];
@@ -22,8 +23,8 @@
$SelectedFreightCost = $_POST['SelectedFreightCost'];
}
- echo '<div class="centre"><p class="page_title_text"><img src="'.$RootPath.'/css/'.$Theme.'/images/supplier.png" title="' .
- _('Freight Costs') . '" alt="" />' . ' ' . $Title . '</p></div>';
+echo '<div class="centre"><p class="page_title_text"><img src="'.$RootPath.'/css/'.$Theme.'/images/supplier.png" title="' .
+ _('Freight Costs') . '" alt="" />' . ' ' . $Title . '</p></div>';
if (!isset($LocationFrom) OR !isset($ShipperID)) {
@@ -86,7 +87,9 @@
prnMsg(_('The entry for the destination must be at least two characters long') . '. ' . _('These entries are matched against the town names entered for customer delivery addresses'),'warn');
}
-
+ if (trim($_POST['DestinationCountry']) == '' ) {
+ $_POST['DestinationCountry'] = $CountriesArray[$_SESSION['CountryOfOperation']];
+ }
if (trim($_POST['CubRate']) == '' ) {
$_POST['CubRate'] = 0;
}
@@ -117,6 +120,7 @@
$sql = "UPDATE freightcosts
SET locationfrom='".$LocationFrom."',
+ destinationcountry='" . $_POST['DestinationCountry'] . "',
destination='" . $_POST['Destination'] . "',
shipperid='" . $ShipperID . "',
cubrate='" . $_POST['CubRate'] . "',
@@ -134,6 +138,7 @@
/*Selected freight cost is null cos no item selected on first time round so must be adding a record must be submitting new entries */
$sql = "INSERT INTO freightcosts (locationfrom,
+ destinationcountry,
destination,
shipperid,
cubrate,
@@ -144,6 +149,7 @@
minimumchg)
VALUES (
'".$LocationFrom."',
+ '" . $_POST['DestinationCountry'] . "',
'" . $_POST['Destination'] . "',
'" . $ShipperID . "',
'" . $_POST['CubRate'] . "',
@@ -166,6 +172,7 @@
prnMsg($msg,'success');
unset($SelectedFreightCost);
+ unset($_POST['DestinationCountry']);
unset($_POST['CubRate']);
unset($_POST['KGRate']);
unset($_POST['MAXKGs']);
@@ -186,6 +193,7 @@
$sql = "SELECT shipcostfromid,
+ destinationcountry,
destination,
cubrate,
kgrate,
@@ -196,12 +204,16 @@
FROM freightcosts
WHERE freightcosts.locationfrom = '".$LocationFrom. "'
AND freightcosts.shipperid = '" . $ShipperID . "'
- ORDER BY destination";
+ ORDER BY destinationcountry,
+ destination,
+ maxkgs,
+ maxcub";
$result = DB_query($sql,$db);
echo '<br /><table class="selection">';
$TableHeader = '<tr>
+ <th>' . _('Country') . '</th>
<th>' . _('Destination') . '</th>
<th>' . _('Cubic Rate') . '</th>
<th>' . _('KG Rate') . '</th>
@@ -228,11 +240,12 @@
$k=0;
} else {
echo '<tr class="OddTableRows">';
- $k++;
+ $k=1;
}
printf('<td>%s</td>
+ <td>%s</td>
<td class="number">%s</td>
<td class="number">%s</td>
<td class="number">%s</td>
@@ -240,14 +253,16 @@
<td class="number">%s</td>
<td class="number">%s</td>
<td><a href="%s&SelectedFreightCost=%s&LocationFrom=%s&ShipperID=%s">' . _('Edit') . '</a></td>
- <td><a href="%s&SelectedFreightCost=%s&LocationFrom=%s&ShipperID=%s&delete=yes" onclick="return confirm(\'' . _('Are you sure you wish to delete this freight cost') . '\');">' . _('Delete') . '</a></td></tr>',
- $myrow[1],
- $myrow[2],
- $myrow[3],
- $myrow[4],
- $myrow[5],
- $myrow[6],
- $myrow[7],
+ <td><a href="%s&SelectedFreightCost=%s&LocationFrom=%s&ShipperID=%s&delete=yes" onclick="return confirm(\'' . _('Are you sure you wish to delete this freight cost') . '\');">' . _('Delete') . '</a></td>
+ </tr>',
+ $myrow['destinationcountry'],
+ $myrow['destination'],
+ $myrow['cubrate'],
+ $myrow['kgrate'],
+ $myrow['maxkgs'],
+ $myrow['maxcub'],
+ $myrow['fixedprice'],
+ $myrow['minimumchg'],
htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?',
$myrow[0],
$LocationFrom,
@@ -279,6 +294,7 @@
//editing an existing freight cost item
$sql = "SELECT locationfrom,
+ destinationcountry,
destination,
shipperid,
cubrate,
@@ -294,6 +310,7 @@
$myrow = DB_fetch_array($result);
$LocationFrom = $myrow['locationfrom'];
+ $_POST['DestinationCountry'] = $myrow['destinationcountry'];
$_POST['Destination'] = $myrow['destination'];
$ShipperID = $myrow['shipperid'];
$_POST['CubRate'] = $myrow['cubrate'];
@@ -308,11 +325,12 @@
} else {
$_POST['FixedPrice'] = 0;
$_POST['MinimumChg'] = 0;
+ }
- }
echo '<input type="hidden" name="LocationFrom" value="' . $LocationFrom . '" />';
echo '<input type="hidden" name="ShipperID" value="' . $ShipperID . '" />';
+ if (!isset($_POST['DestinationCountry'])) {$_POST['DestinationCountry']=$CountriesArray[$_SESSION['CountryOfOperation']];}
if (!isset($_POST['Destination'])) {$_POST['Destination']='';}
if (!isset($_POST['CubRate'])) {$_POST['CubRate']='';}
if (!isset($_POST['KGRate'])) {$_POST['KGRate']='';}
@@ -322,7 +340,21 @@
echo '<br /><table class="selection">';
echo '<tr><th colspan="2">' . _('For Deliveries From') . ' ' . $LocationName . ' ' . _('using') . ' ' .
$ShipperName . '</th></tr>';
- echo'<tr><td>' . _('Destination') . ':</td>
+
+ echo '<tr>
+ <td>' . _('Destination Country') . ':</td>
+ <td><select name="DestinationCountry">';
+ foreach ($CountriesArray as $CountryEntry => $CountryName){
+ if (isset($_POST['DestinationCountry']) AND (strtoupper($_POST['DestinationCountry']) == strtoupper($CountryName))){
+ echo '<option selected="selected" value="' . $CountryName . '">' . $CountryName .'</option>';
+ } else {
+ echo '<option value="' . $CountryName . '">' . $CountryName .'</option>';
+ }
+ }
+ echo '</select></td>
+ </tr>';
+
+ echo'<tr><td>' . _('Destination Zone') . ':</td>
<td><input type="text" maxlength="20" size="20" name="Destination" value="' . $_POST['Destination'] . '" /></td></tr>';
echo '<tr><td>' . _('Rate per Cubic Metre') . ':</td>
<td><input type="text" name="CubRate" class="number" size="6" maxlength="5" value="' . $_POST['CubRate'] . '" /></td></tr>';
@@ -333,9 +365,9 @@
echo '<tr><td>' . _('Maximum Volume Per Package (cubic metres)') . ':</td>
<td><input type="text" name="MAXCub" class="number" size="8" maxlength="7" value="' . $_POST['MAXCub'] . '" /></td></tr>';
echo '<tr><td>' . _('Fixed Price (zero if rate per KG or Cubic)') . ':</td>
- <td><input type="text" name="FixedPrice" class="number" size="6" maxlength="5" value="' . $_POST['FixedPrice'] . '" /></td></tr>';
+ <td><input type="text" name="FixedPrice" class="number" size="11" maxlength="10" value="' . $_POST['FixedPrice'] . '" /></td></tr>';
echo '<tr><td>' . _('Minimum Charge (0 is N/A)') . ':</td>
- <td><input type="text" name="MinimumChg" class="number" size="6" maxlength="5" value="' . $_POST['MinimumChg'] . '" /></td></tr>';
+ <td><input type="text" name="MinimumChg" class="number" size="11" maxlength="10" value="' . $_POST['MinimumChg'] . '" /></td></tr>';
echo '</table><br />';
Modified: trunk/sql/mysql/upgrade4.10-4.11.sql
===================================================================
--- trunk/sql/mysql/upgrade4.10-4.11.sql 2013-07-06 22:11:54 UTC (rev 6055)
+++ trunk/sql/mysql/upgrade4.10-4.11.sql 2013-07-07 09:43:00 UTC (rev 6056)
@@ -166,5 +166,7 @@
INSERT INTO config VALUES ('ShopStockLocations','');
INSERT INTO config VALUES ('ShopShowLeftCategoryMenu','1');
+ALTER TABLE `freightcosts` ADD `destinationcountry` VARCHAR( 40 ) NOT NULL AFTER `locationfrom`;
+
UPDATE config SET confvalue='4.11.0' WHERE confname='VersionNumber';
|