Please visit support.cavallo.com

Start a conversation

Calculating Freight

Overview

The Calculate Freight function automatically calculates the shipping charge for an order.

Setup

Administrator access to the SQL server is required to set up the freight values. SalesPad ships with the sppGetSalesDocumentFreight stored procedure but will need to have an additional stored procedure created to store the freight calculation rules and values. An example stored procedure, cp_CalculateFreight, containing freight rules and values is shown below. To create a new stored procedure on the SQL server:

  1. Name it cp_CalculateFreight
  2. Copy and paste the code below
  3. Edit the section below CASE to be the desired freight rules and values
  4. Save the changes
cp_CalculateFreight Stored Procedure (copy and paste)

SET ANSI_NULLS ON GO
SET QUOTED_IDENTIFIER ON USE [TWO]
GO
SET ANSI_NULLS ON GO
SET QUOTED_IDENTIFIER ON
ALTER procedure [dbo].[cp_CalculateFreight]
@freight_amt money output,
@ship_method varchar(40),
@Subtotal money,
@returnRecordSet as bit = 0
AS
set @freight_amt =
'CASE
WHEN (@Subtotal < 25) THEN 11.95
WHEN (@Subtotal < 50) THEN 15.95
WHEN (@Subtotal < 100) THEN 16.95
WHEN (@Subtotal >= 100) THEN 55.99
ELSE 0
END'

Finally, edit the sppGetSalesDocumentFreight stored procedure:

  1. Select sppGetSalesDocumentFreight from the stored procedures list
  2. Right-click and select Modify
  3. The text shown below in red must have the same name as the new stored procedure created with the freight rules and values.
sppGetSalesDocumentFreight Stored Procedure

SET ANSI_NULLS ON GO
SET QUOTED_IDENTIFIER ON GO
ALTER procedure [dbo].[sppGetSalesDocumentFreight]
@Shipping_Method as varchar(50) = '',
@Subtotal as numeric(19,5) = 0,
@Weight as numeric(19,5) = 0,
@Freight as numeric(19,5) = 0,
@Message as varchar(500) = ''
as
if (object_id('cp_CalculateFreight') is not null ) begin
exec cp_CalculateFreight @Freight output, @Shipping_Method,
@Subtotal end
select Shipping_Method=@Shipping_Method, Subtotal=@Subtotal, Weight=@Weight,
Freight = cast(@Freight as numeric (19,5)), Message = ''

Usage

Select any order and open it. There will now be an ellipsis in the Freight box. Clicking on the ellipsis (...) will automatically calculate freight based on the defined freight rules and values:

Settings

Calculate Freight Enabled - Enables the Calculate freight button link in a Sales Document

Choose files or drag and drop files
Was this article helpful?
Yes
No
  1. SalesPad Support

  2. Posted
  3. Updated

Comments