At 01:27 PM 7/2/2008, Dan Goldberg wrote:
Looks interesting. I have one question, how does it calculate fuel cost??
Dan,
Totally customized and automated! Would you expect any less?
The actual trip cost is based on the following parameters, defined as
lookup TripCost table for total automation.
Table: TripCost
Columns:
DrivingCostUnit, DrivingCost, DrivingCostUnitDesc
Values:
0, $nn.nn, Fixed Cost Per Mile
1, $nn.nn, Per Liter
2, $nn.nn, Per U.S. Gallon
3, $nn.nn, Per U.K. Gallon
So, before creating a route, you need to identify the driving cost.
A Very Simple Example:
-- Start here
IF (CVAL('DATABASE')) <> 'RMTrips' OR (CVAL('DATABASE')) IS NULL THEN
CONNECT RMTrips IDENTIFIED BY NONE
ENDIF
CLEAR VARIABLES vOrigAddress,vOrigCSZ,vOrigin,vDestAddress,vDestCSZ, +
vDestination,vRoundTrip,vDrivingCostUnit,vDrivingCost,vShowMap,vTripCost
SET VAR vOrigAddress TEXT = NULL
SET VAR vOrigCSZ TEXT = NULL
SET VAR vOrigin TEXT = NULL
SET VAR vDestAddress TEXT = NULL
SET VAR vDestCSZ TEXT = NULL
SET VAR vDestination TEXT = NULL
SET VAR vRoundTrip TEXT = NULL
SET VAR vDrivingCostUnit TEXT = NULL
SET VAR vDrivingCost CURRENCY = NULL
SET VAR vShowMap TEXT = NULL
SET VAR vTripCost CURRENCY = NULL
SELECT OrigAddress,OrigCSZ,DestAddress,DestCSZ,RoundTrip,DrivingCostUnit +
INTO +
vOrigAddress INDIC vOrigAddress, +
vOrigCSZ INDIC ivOrigCSZ, +
vDestAddress INDIC ivDestAddress, +
vDestCSZ INDIC ivDestCSZ, +
vRoundTrip INDIC ivRoundTrip, +
vDrivingCostUnit INDIC ivDrivingCostUnit +
FROM ScheduledTrip WHERE COUNT = 1
SET VARIABLE vOrigin TEXT = (.vOrigAddress+','+.vOrigCSZ)
SET VARIABLE vDestination TEXT = (.vDestAddress+','+.vDestCSZ)
SELECT DrivingCost INTO vDrivingCost INDIC ivDrivingCost +
FROM TripCost WHERE DrivingCostUnit = .vDrivingCostUnit
-- Using R:Magellan 8.0
IF vRoundTrip = 'N' OR vRoundTrip IS NULL THEN
SET VARIABLE vShowMap TEXT = +
('PLUGIN RMagellan80.RBL vResult' + +
'|DRIVING_COST_UNITS'&.vDrivingCostUnit + +
'|DRIVING_COST'&(CTXT(.vDrivingCost)) + +
'|SHOW_MAP ON|'+.vOrigin+'|'+.vDestination)
ENDIF
IF vRoundTrip = 'Y' THEN
SET VARIABLE vShowMap TEXT = +
('PLUGIN RMagellan80.RBL vResult' + +
'|DRIVING_COST_UNITS'&.vDrivingCostUnit + +
'|DRIVING_COST'&(CTXT(.vDrivingCost)) + +
'|SHOW_MAP ON|'+.vOrigin+'|'+.vDestination+'|'+.vOrigin)
ENDIF
&vShowMap
RETURN
-- End here ...
In this particular example, the following details are revealed
at the end of each calculated trip:
. Driving Distance
. Driving Time (Days, Hours, Minutes)
. Trip Duration (Days, Hours, Minutes)
. Latitude/Longitude (Origin)
. Latitude/Longitude (Destination)
. Trip Cost based on Driving Cost Unit
Imagine the possibilities!
For complete details and Help Manuals, please refer to:
http://www.RMagellan.com
Very Best R:egards,
Razzak.