Need more, need help now?
- - - - - - - - - - - - - - - - - - pay-as-you-go support - no contract - tenth of an hour billing - expert help - fast service - no call queues
Need integration?
- - - - - - - - - - - - - - - - - - with your shipping system - website - invoicing system - crm - cms - manufacturing - order import - back to back orders..
Need a report?
- - - - - - - - - - - - - - - - - - Excel reporting that pulls data from Sage - custom layouts - layouts that change adapt to your brands and/or for drop shipping.
Want web hosting?
- - - - - - - - - - - - - - - - - - Your own domain name - email - a shop - wordpress - woo commerce - ticket systems - help desks - forums - portals

Conditional formatting based on sum() totals

Report design issues and solutions.
Post Reply
mpfj
User
User
Posts: 8
Joined: 16 Sep 2010, 08:58
Sage Version: v2015 21 UK/Europe/Africa

Conditional formatting based on sum() totals

Post by mpfj » 29 Aug 2012, 14:37

I'm trying to hide / show a "Discount" header text box when a sales total discount is zero / non-zero.

I have a text box showing "Discount" and the conditional expression:-

if sum(Rounddp(SOP_ITEM.FOREIGN_FULL_NET_AMOUNT, 2) - Rounddp(SOP_ITEM.FOREIGN_NET_AMOUNT, 2) + Rounddp(SALES_ORDER.NET_VALUE_DISCOUNT_NET, 2)) = 0 then
begin
Visible := False;
end

This is based on the "Total_Discount" expression in the footer of the default layout.

Here's the problem ... this all seems to work fine provided the *first* item (and/or any other item) in the sale has a discount value.

If I only apply a discount to the (say) final item, my conditional expression always hides the header.

Am I doing something wrong ?

Thanks for any help you can provide.

User avatar
brucedenney
Site Admin
Site Admin
Posts: 4619
Joined: 28 Feb 2006, 09:56
Sage Version: v28 UK/Europe/Africa

Re: Conditional formatting based on sum() totals

Post by brucedenney » 31 Aug 2012, 09:58

You say "header text box" not fully sure what you mean.

The header is printed before the items, so the sum of the items is the sum of the first item at that point. Until all the items on the invoice have been printed "we" can not know the total of the items and if there is a discount amount. This is why totals have to be in footers.

Assuming you do not mean a header section, but are referring to a Discount header in a footer section then it should work, however you could simplify it to

if Total_Discount = 0 then
begin
Visible := False;
end

If you still have problems, please attach the report/layout to your post
For just about anything Sage :- Discount subscriptions, pay-as-you-go support, application integration, reports, layouts, linked excel spreadsheets, analysis or any other help making life with sage easier/less time consuming Contact me.

Post Reply

Who is online

Users browsing this forum: No registered users and 22 guests