Escolar Documentos
Profissional Documentos
Cultura Documentos
MPReport()
Sintaxe:
MPReport(p1,p2,p3,p4,p5)
ReportDef()
A função estática ReportDef deverá ser criada para todos relatórios que
poderão ser agendados pelo usuário.
Sintaxe:
ReportDef()
PrintDialog ()
Sintaxe:
PrintDialog()
TReport()
Sintaxe:
TReport():New(p1,p2,p3,p4,p5)
TRSection()
Sintaxe:
TRSection():New(p1,p2,p3,p4,p5)
TRCell()
Sintaxe:
TRCell():New(p1,p2,p3,p4,p5,p6,p7,p8)
Sintaxe:
:SetQuery(p1,p2)
p1 => Alias da query
p2 => Query
TRPosition()
Sintaxe:
TRPosition():New(p1,p2,p3,p4,p5)
SetFilter() - Método
Sintaxe:
:SetFilter(p1,p2)
p1 => Expressão de filtro
p2 => chave do índice (opcional)
MakeSqlExpr()
Sintaxe:
MakeSqlExpr(p1)
p1 => nome da pergunte
BeginQuery () - Método
Sintaxe:
:BeginQuery()
EndQuery () - Método
Sintaxe:
:EndQuery(p1)
MakeAdvplExpr ()
Sintaxe:
MakeAdvplExpr(p1)
Print() - Método
Sintaxe:
:Print()
Exemplos de Programação
#include "MATR020.CH"
#Include "PROTHEUS.CH"
MPReport("MATR020","SA1",STR0001,STR0002+STR0003+STR0004,;
{STR0008,STR0009,STR0015+RTrim(RetTitle("A1_CGC"))})
Return
Impressão com 1 Seção e Embedded SQL– MATR530
#include "MATR530.CH"
#Include "PROTHEUS.CH"
oReport := TReport():New("MATR530",OemToAnsi(STR0001),"MTR530",;
{|oReport| MATR530Imp(oReport)},OemToAnsi(STR0002)+OemToAnsi(STR0003))
oSection := TRSection():New(oReport,OemToAnsi(STR0001),{"SA1","SA3"})
TRCell():New(oSection,"A1_VEND","SA1")
TRCell():New(oSection,"A3_NOME","SA3")
TRCell():New(oSection,"A1_COD","SA1")
TRCell():New(oSection,"A1_LOJA","SA1")
TRCell():New(oSection,"A1_NOME","SA1")
TRCell():New(oSection,"A1_ULTVIS","SA1")
TRCell():New(oSection,"A1_TEMVIS","SA1")
TRCell():New(oSection,"A1_CONTATO","SA1")
TRCell():New(oSection,"A1_TEL","SA1")
Return oReport
pergunte("MTR530",.F.)
oReport := ReportDef()
oReport:PrintDialog()
Return
Static Function MATR530Imp(lEnd,WnRel,cString)
LOCAL cFiltro := ""
LOCAL cQuery := ""
#IFDEF TOP
MakeSqlExpr("MTR530")
oReport:Section(1):BeginQuery()
If ( mv_par03 == 1 )
BeginSql alias "QRYSA1"
SELECT A1_COD,A1_LOJA,A1_NOME,A1_VEND,A1_ULTVIS,A1_TEMVIS,A1_TEL,
A1_CONTATO FROM %table:SA1% SA1,%table:SA3% SA3
WHERE A1_VEND = A3_COD AND A1_FILIAL = %xfilial:SA1% AND
A1_TEMVIS > 0 AND SA1.%notDel% AND
(%exp:dDataBase% -A1_ULTVIS) > A1_TEMVIS
ORDER BY A1_VEND
EndSql
Else
BeginSql alias "QRYSA1"
SELECT A1_COD,A1_LOJA,A1_NOME,A1_VEND,A1_ULTVIS,A1_TEMVIS,A1_TEL,
A1_CONTATO FROM %table:SA1% SA1,%table:SA3% SA3
WHERE A1_VEND = A3_COD AND A1_FILIAL = %xfilial:SA1% AND
A1_TEMVIS > 0 AND SA1.%notDel%
ORDER BY A1_VEND
EndSql
EndIf
oReport:Section(1):EndQuery(mv_par04)
TRPosition():New(oReport:Section(1),"SA3",1,"xFilial() + QRYSA1->A1_VEND")
#ELSE
MakeAdvplExpr("MTR530")
cFiltro :='´A1_VEND>="'+ mv_par01 +'".AND. A1_VEND<="' + mv_par02 + '" .AND.;
A1_TEMVIS > 0 .AND. '
If ( mv_par03 == 1 )
cFiltro += ' .AND. ('+DtoC(dDataBase)+'-A1_ULTVIS) > A1_TEMVIS'
EndIf
oReport:Section(1):SetFilter(cFiltro,"A1_VEND")
TRPosition():New(oReport:Section(1),"SA3",1,"xFilial() + SA1->A1_VEND")
#ENDIF
oReport:Section(1):Print()
Return