Page 1 of 1

Margins on Visual Builder Report

Posted: Thu Dec 22, 2005 3:18 pm
by Susan Jones
How can I calculate a margin on a visual builder report like the ones standard CAPITAL reports have?

Posted: Thu Dec 22, 2005 3:20 pm
by COBS Tech Support
Try this script:

Declare nTotSales Type Number
Declare nTotCosts Type Number
Declare nTotTax Type Number

IF .Not. IsEmpty(Invoice->Taxno)
nTotTax := 0
Else
nTotTax := Invoice->Invtax
Endif

nTotSales := Invoice->Invtot - nTotTax
nTotCosts := Invoice->Tcost - nTotTax

IF nTotsales == 0
RETURN 0
ENDIF

RETURN (nTotsales - nTotcosts) / nTotsales * 100