You are on page 1of 2

#INCLUDE "Topconn.

ch"
#INCLUDE "Protheus.ch"
/*

Programa RCOMR01 Autor Vincius Moreira Data 12/11/2013

Desc.
Impresso de cadastro de produtos em TReport simples.

Uso
AcademiaERP

*/
User Function RCOMR01()
//
//Declaracao de variaveis

//
Private oReport := Nil
Private oSecCab := Nil
Private cPerg
:= PadR ("RCOMR01", Len (SX1->X1_GRUPO))
//
//Criacao e apresentacao das perguntas

//
PutSx1(cPerg,"01","Matricula de?" ,'','',"mv_ch1","C",TamSx3 ("RA_MAT")[1] ,0,,
"G","","SRA","","","mv_par01","","","","","","","","","","","","","","","","")
PutSx1(cPerg,"02","Matricula ate?" ,'','',"mv_ch2","C",TamSx3 ("RA_MAT")[1] ,0,,
"G","","SRA","","","mv_par02","","","","","","","","","","","","","","","","")
//
//Definicoes/preparacao para impressao

//
ReportDef()
oReport:PrintDialog()
Return Nil
/*

Programa ReportDef Autor Vincius Moreira Data 12/11/2013

Desc.
Definio da estrutura do relatrio.

Uso

*/
Static Function ReportDef()
oReport := TReport():New("RCOMR01","Cadastro de Funcionarios",cPerg,{|oReport| P
rintReport(oReport)},"Impresso de cadastro de produtos em TReport simples.")
oReport:SetLandscape(.T.)
oSecCab := TRSection():New( oReport , "Funcionarios", {"QRY"} )
TRCell():New( oSecCab, "RA_FILIAL"
, "QRY")

TRCell():New( oSecCab, "RA_MAT"


TRCell():New( oSecCab, "RA_NOME"
TRCell():New( oSecCab, "RA_CIC"

, "QRY")
, "QRY")
, "QRY")

//TRFunction():New(/*Cell*/
,/*cId*/,/*Function*/,/*oBreak*/,/*cTitl
e*/,/*cPicture*/,/*uFormula*/,/*lEndSection*/,/*lEndReport*/,/*lEndPage*/,/*Sect
ion*/)
TRFunction():New(oSecCab:Cell("RA_FILIAL"),/*cId*/,"COUNT"
,/*oBreak*/,/*cTi
tle*/,/*cPicture*/,/*uFormula*/,.F.
,.T.
,.F.
,oSecCa
b)
Return Nil
/*

Programa RCOMR01 Autor Vincius Moreira Data 12/11/2013

Desc.

Uso

*/
Static Function PrintReport(oReport)
Local cQuery

:= ""

Pergunte(cPerg,.F.)
cQuery +=
cQuery +=
cQuery +=
cQuery +=
cQuery +=
cQuery +=
cQuery +=
cQuery +=
" + CRLF
cQuery +=
cQuery :=

"
"
"
"
"
"
"
"

SELECT " + CRLF


SRA.RA_FILIAL " + CRLF
,SRA.RA_MAT " + CRLF
,SRA.RA_NOME " + CRLF
,SRA.RA_CIC " + CRLF
FROM " + RetSqlName("SRA") + " SRA " + CRLF
WHERE SRA.RA_FILIAL = '" + xFilial ("SRA") + "' " + CRLF
AND SRA.RA_MAT
BETWEEN '" + mv_par01 + "' AND '" + mv_par02 + "'

" AND SRA.D_E_L_E_T_ = ' ' " + CRLF


ChangeQuery(cQuery)

If Select("QRY") > 0
Dbselectarea("QRY")
QRY->(DbClosearea())
EndIf
TcQuery cQuery New Alias "QRY"
oSecCab:BeginQuery()
oSecCab:EndQuery({{"QRY"},cQuery})
oSecCab:Print()
Return Nil

You might also like