Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Calculating Freight Charges
Message
De
02/07/2013 10:42:17
 
 
À
01/07/2013 15:34:26
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Versions des environnements
SQL Server:
SQL Server 2008
Application:
Desktop
Divers
Thread ID:
01577553
Message ID:
01577641
Vues:
44
Thanks Craig,

that's what I do for the processing part of my application but this is for a report and that sounds like overkill if a query can pull the data out as I need it (especially as at the moment I can only do reports against stored procedures, I have not worked out how to use my Business Objects to populate the data in the reports yet).

>I wouldn't do it that way as it puts business rules into the database. Create a CalculateShipping class. Pull back all the rates you may need and then loop through as needed locally.
>
>>Hi,
>>
>>I need some help on how to calculate the freight charge on a package.
>>
>>I have a table like this :
>>
>>
ID, WeightLimit, FreightRate, FuelRate
>>1,     1,         12,          1.2
>>2,      50,        1,         0.1
>>3,     99999,    0.5,         0.05
>>
>>If I have a package weighing 2 kgs, then the total freight is calculated as:
>>
>>1st kg = 12
>>2nd kg = 1
>>Total = 13
>>
>>or if I had a package weighing 52 kgs:
>>1st kg = 12
>>next 49 kgs = 49 * 1 = 49
>>next 2kgs = 2 * 0.5 = 1
>>Total = 62
>>
>>Is there a way to achieve this in SQL?
Frank.

Frank Cazabon
Samaan Systems Ltd.
www.samaansystems.com
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform