To have the program automatically include freight charges in the unit price of items on sales documents, activate the delivered pricing function.
Steps
In the search box, enter Sales & Receivables Setup, and then choose the related link.
On the General FastTab, in the Delivered Pricing Calc. Method field, specify the level at which delivered pricing will be calculated.
In the Del. Pricing Calc. Codeunit ID field, assign the codeunit developed to calculate freight costs.