// was missing this important declaration in the first publication
LOCAL aTotal := {0,0,0,0,0,0,0,0,0,0,0}.....
DEFINE FONT oFont1 NAME "ARIAL NARROW" SIZE 0,-8
DEFINE FONT oFont2 NAME "ARIAL NARROW" SIZE 0,-8 BOLD
DEFINE FONT oFont3 NAME "ARIAL NARROW" SIZE 0,-12 BOLD
DEFINE FONT oFont4 NAME "ARIAL NARROW" SIZE 0,-8 BOLD
DEFINE FONT oFont5 NAME "ARIAL NARROW" SIZE 0,-6
DEFINE PEN pen1 WIDTH 0.3
REPORT oReport;
TITLE "PERIODO: " + SUBSTR( aData[1,5], 4 ) ;
FONT oFont1, oFont2, oFont3, oFont4, oFont5 ;
PEN pen1 ;
HEADER "Nombre o Razón Social: " + cNombre,;
"Número NIT: " + cNit ,;
"Número Sucursal: " + cSucursal ,;
"Dirección: " + cDireccion;
LEFT ;
FOOTER "Página : " + STR (oReport:nPage,3);
PREVIEW ;
CAPTION "LIBRO VENTAS - IVA"
COLUMN TITLE "Fecha" DATA aData[ nAt, 5] SIZE 9 FONT 1 CENTER
COLUMN TITLE "Número" DATA aData[ nAt, 1] SIZE 9 FONT 1
COLUMN TITLE "Nombre o Razón Social" DATA aData[ nAt, 2] SIZE 30 FONT 1
COLUMN TITLE "Número","Factura" DATA aData[ nAt, 3] SIZE 7 FONT 1
COLUMN TITLE "Número","Autorización" DATA aData[ nAt, 4] SIZE 15 FONT 1 CENTER
COLUMN TITLE "Código de","Control" DATA aData[ nAt, 12] SIZE 12 FONT 1 CENTER
COLUMN TITLE "Importe","Facturado" DATA VAL(aData[ nAt, 6]) SIZE 9 FONT 1 RIGHT PICTURE "999,999.99" TOTAL
COLUMN TITLE "ICE" DATA aData[ nAt, 7] SIZE 6 FONT 1 RIGHT PICTURE "@Z 999,999.99"
COLUMN TITLE "Exento" DATA aData[ nAt, 8] SIZE 6 FONT 1 RIGHT PICTURE "@Z 999,999.99"
COLUMN TITLE "Valor","Neto" DATA VAL(aData[ nAt, 9]) SIZE 9 FONT 1 RIGHT PICTURE "999,999.99" TOTAL
COLUMN TITLE "IVA" DATA VAL(aData[ nAt, 10]) SIZE 7 FONT 1 RIGHT PICTURE "999,999.99" TOTAL
END REPORT
oReport:bPreInit := {|| nAt := 1 }
oReport:bSkip := {|| nAt++ }
oReport:lPageTotal := .T.
oReport:lTotal := .T.
oReport:cGrandTotal := 'Total Página'
oReport:cPageTotal := 'Total Página'
AEVAL ( oReport:oHeader:aFont, { |e,i| oReport:oHeader:aFont[i] := {||2} } )
AEVAL ( oReport:oTitle:aFont, { |e,i| oReport:oTitle:aFont[i] := {||3} } )
AEVAL ( oReport:aColumns, { |e| e:bTitleFont := {||4} ,;
e:bTotalFont := {||2} } )
oReport:oDevice:lPrvModal := .T.
ACTIVATE REPORT oReport ;
WHILE nAt <= LEN( aData ) ;
ON POSTPAGE AEVAL( oReport:aColumns, {|c,i| aTotal[i] += c:nTotal, c:nTotal := 0 } ) ;
ON POSTEND ( oReport:cGrandTotal := 'Total General',;
AEVAL( oReport:aColumns, {|c,i| c:nTotal := aTotal[i] } ),;
oReport:PageTotal() )
oFont1:END()
oFont2:end()
oFont3:END()
oFont4:END()
oFont5:END()
pen1:END()