Skip to content

Add_SubTotal - cWinReport2

Adds the value of nData to the subtotal for the passed iCounter

Type: Procedure

Parameters

Parameter Type Description
iCounter Integer A developer defined subtotal index
nData Number The value to be added to the subtotal

Syntax

Procedure Add_SubTotal Integer iCounter Number nData

Call Example

Send Add_SubTotal iCounter nData

Description

The Add_subtotal procedure adds the value of nData to the subtotal for the passed iCounter. The value for iCounter should be assigned by the developer. In a complex report, you may choose to name the iCounter values you wish to use with mnemonics that identify the columns or fields being subtotalled.

Procedure Body // order detail body

    DFFont "Arial"
    DFFontSize 8

    DFWritePos    Invt.ITEM_ID                0.1     (FONT_DEFAULT)            -1 2.24
    DFWritePos    Invt.DESCRIPTION            2.36    (FONT_DEFAULT)            -1 4.77
    DFWritePos    Orderdtl.QTY_ORDERED        9.5     (FONT_DEFAULT+FONT_RIGHT)  0 1.87
    DFWritePos    Orderdtl.PRICE              11.22   (FONT_DEFAULT+FONT_RIGHT)  2 1.22
    DFWritePos    Orderdtl.EXTENDED_PRICE     14.1    (FONT_DEFAULT+FONT_RIGHT)  2 2.38
    DFWriteln

    Send Add_SubTotal 1 (Orderdtl.EXTENDED_PRICE) // sub-total1 is order total

End_Procedure

Procedure SubTotal1 // order total
    Number nAmount

    Get SubTotal 1 to nAmount
    Send Add_SubTotal 2 nAmount // subtotal 2 is customer total

    DFFont "Arial"
    DFFontSize 8
    DFBeginHeader DFSubTotal 1
        DFHEADERPOS HDR_LEFT
        DFHEADERFRAME HDR_Margins 0.01 rgb_dGrey rgb_Grey
        DFWritePos   "Order Total:"  12.00  (FONT_BOLD+RGB_DBLUE+FONT_RIGHT)
        DFWritelnPos nAmount         14.1   (FONT_RIGHT) 2
    DFEndHeader

End_Procedure

See Also

SubTotal | | Sum_SubTotal | Clr_SubTotal | Clr_AllSubtotals