FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour xBrowse sumar columna segun criterio
Posts: 344
Joined: Sat Jul 22, 2006 09:04 PM
xBrowse sumar columna segun criterio
Posted: Wed Jul 24, 2019 09:37 PM
Hola buenas tardes, necesito totalizar una columna siempre que no este anulada, de hecho la dejo visible por cuestiones de auditoria.

Code (fw): Select all Collapse
                *-----------------------------------------------------------
                oCol := ::oBrw:AddCol()
                   oCol:cHeader       := "Importe"
                   oCol:nWidth        := 110
                   oCol:nDataStrAlign := AL_RIGHT
                   oCol:bEditValue    := { || ::oQry:importe }
                   oCol:cEditPicture  := "@Z 9,999.99"
                   oCol:nHeadStrAlign := 2         // 0=Izquierda   1=Derecha   2=Centrado
                   oCol:nFootStrAlign := 1
                   oCol:nTotal        := 0
                   oCol:lTotal        := .T.
                   oCol:nFooterType   := AGGR_TOTAL
                *-----------------------------------------------------------


Quiero que sume la columna importe siempre que no este anulada

SI ::anulado=="A" ENTONCES ESTA ANULADA

Saludos
Marcelo
FWH - Harbour - BCC7 - PellesC
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: xBrowse sumar columna segun criterio
Posted: Wed Jul 24, 2019 10:01 PM
A ver si te vale


Class TXBrwColumn

bSumCondition B Format: { |@value,oCol| lIncludeInTotals }
Used for conditional / calculated totals by MakeTotals(). If specified, the cell value is included in totals only if the block returns .t.. In addition, the block can set the 1st parameter to a different calculated value to be included in totals. Also see method ::SumValue()

Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo

El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
Posts: 344
Joined: Sat Jul 22, 2006 09:04 PM
Re: xBrowse sumar columna segun criterio
Posted: Wed Jul 24, 2019 10:20 PM
Hola Cristobal, lo solucione asi:

Code (fw): Select all Collapse
oCol:bSumCondition := { || ::oQry:anulado<>"A" }


por si alguno le sirve.
Saludos
Marcelo
FWH - Harbour - BCC7 - PellesC

Continue the discussion