× Linguagem de Programação ADVPL

Perguntas Problema relatorio

Mais
11 anos 7 meses atrás #13110 por ratk
Problema relatorio foi criado por ratk
Pessoal estou com um problema em um relatório e não entendo porque ele esta quebrando a pagina incorretamente, alguém pode me dar um help ?

segue o código ... vlw
#INCLUDE "REPORT.CH"
#INCLUDE "PROTHEUS.CH"

/*
ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ
±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
±±ÉÍÍÍÍÍÍÍÍÍÍÑÍÍÍÍÍÍÍÍÍÍËÍÍÍÍÍÍÍÑÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍËÍÍÍÍÍÍÑÍÍÍÍÍÍÍÍÍÍÍÍÍ»±±
±±ºPrograma  ³REST003   ºAutor  ³Microsiga           º Data ³  04/17/13   º±±
±±ÌÍÍÍÍÍÍÍÍÍÍØÍÍÍÍÍÍÍÍÍÍÊÍÍÍÍÍÍÍÏÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÊÍÍÍÍÍÍÏÍÍÍÍÍÍÍÍÍÍÍÍ͹±±
±±ºDesc.     ³                                                            º±±
±±º          ³                                                            º±±
±±ÌÍÍÍÍÍÍÍÍÍÍØÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͹±±
±±ºUso       ³ AP                                                         º±±
±±ÈÍÍÍÍÍÍÍÍÍÍÏÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ±±
±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß
*/
User Function REST003()

Private oReport
Private oSection1
Private cPerg := "REST03"
Private nD1 := 0
Private TMPB7

ValidPerg()

Pergunte(cPerg,.T.)

oReport := TReport():New("REST003","Estoque",cPerg,{|oReport| PrintReport(oReport)},"cDescription")

oReport:SetPortrait()
oReport:SetTotalInLine(.F.)
oReport:ShowHeader()
//oReport:cFontBody := 'Arial'
//oReport:nFontBody := 10
oReport:SetLineHeight(60)

cData1 := DTOS(MV_PAR01)

//Secao Inventario
oSection1 := TRSection():New(oReport,"Inventario",{"SB7"})
oSection1:SetTotalInLine(.F.)

TRCell():new(oSection1, "B7_FILIAL"	, "SB7"  , 'Filial'		,PesqPict('SB7',"B7_FILIAL"),TamSX3("B7_FILIAL")[1]+1,/*lPixel*/,/*{|| code-block de impressao }*/)
TRCell():new(oSection1, "B7_COD"	, "SB7"  , 'Código'		,PesqPict('SB7',"B7_COD")	,TamSX3("B7_COD")[1]+1,/*lPixel*/,/*{|| code-block de impressao }*/)
TRCell():new(oSection1, "B1_DESC"	, ""     , 'Descrição'	,PesqPict('SB1',"B1_DESC")	,TamSX3("B1_DESC")[1]+1,/*lPixel*/,{|| Posicione("SB1",1,xFilial("SB1")+TMPB7->B7_COD ,"B1_DESC") })
TRCell():new(oSection1, "B7_QUANT"	, "SB7"  , 'Quant'  	,PesqPict('SB7',"B7_QUANT")	,TamSX3("B7_QUANT")[1]+1,/*lPixel*/,/*{|| code-block de impressao }*/)
TRCell():new(oSection1, "D1_VUNIT"	, "SD1"  , 'V. Unit'	,PesqPict('SD1',"D1_VUNIT")	,TamSX3("D1_VUNIT")[1]+1,/*lPixel*/,{|| nD1})
TRCell():new(oSection1, "TOTAL"		, ""     , 'Total'		,PesqPict('SD1',"D1_VUNIT")	,TamSX3("D1_VUNIT")[1]+1,/*lPixel*/,{|| TMPB7->B7_QUANT * nD1 })
 
oBreak := TRBreak():New(oSection1,{|| oSection1:Cell("B7_FILIAL") },,.F.)
//oBreak := TRBreak():New(oSection1,{|| (cAlias)->(A1_COD) },"Total:",.F.)
 
TRFunction():New(oSection1:Cell("B7_FILIAL"),"Total Filial","COUNT",oBreak,,"@E 999999",,.F.,.F.)
TRFunction():New(oSection1:Cell("B7_FILIAL"),"Total Registros" ,"COUNT",,,"@E 999999",,.F.,.T.)	

oSection1:Cell("D1_VUNIT"):SetHeaderAlign("RIGHT")
oSection1:Cell("TOTAL"):SetHeaderAlign("RIGHT")

oSection1:SetLineCondition({||nD1 := getD1(TMPB7->B7_COD) })

oReport:PrintDialog()

Return()

/*
ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ
±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
±±ÉÍÍÍÍÍÍÍÍÍÍÑÍÍÍÍÍÍÍÍÍÍËÍÍÍÍÍÍÍÑÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍËÍÍÍÍÍÍÑÍÍÍÍÍÍÍÍÍÍÍÍÍ»±±
±±ºPrograma  ³REST003   ºAutor  ³Microsiga           º Data ³  04/18/13   º±±
±±ÌÍÍÍÍÍÍÍÍÍÍØÍÍÍÍÍÍÍÍÍÍÊÍÍÍÍÍÍÍÏÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÊÍÍÍÍÍÍÏÍÍÍÍÍÍÍÍÍÍÍÍ͹±±
±±ºDesc.     ³                                                            º±±
±±º          ³                                                            º±±
±±ÌÍÍÍÍÍÍÍÍÍÍØÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͹±±
±±ºUso       ³ AP                                                         º±±
±±ÈÍÍÍÍÍÍÍÍÍÍÏÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ±±
±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß
*/
Static Function PrintReport(oReport)
Local cFiltroSB7 := "%"

oReport:SetTitle("Inventario de " + DTOC(MV_PAR01))

//Filtra Emissao da SB7
If !Empty(MV_PAR01)
	cFiltroSB7 += " AND SB7.B7_DATA = '" + cData1 + "'"
EndIf
If !Empty(MV_PAR02) .and. !Empty(MV_PAR03)
	cFiltroSB7 += " AND SB7.B7_COD BETWEEN '" + MV_PAR02 + "' AND '" + MV_PAR03 + "'"
EndIf

cFiltroSB7 += " %"

If Select("TMPB7") > 0
	DbSelectArea("TMPB7")
	DbCloseArea("TMPB7")
EndIf
               
//Define query principal
//BEGIN REPORT QUERY oSection1
oSection1:BeginQuery()
BeginSql alias "TMPB7"       
	SELECT SB7.B7_FILIAL, SB7.B7_COD, SB7.B7_QUANT, SB7.B7_DATA
	FROM %table:SB7% SB7
	WHERE SB7.%notDel%
	AND SB7.B7_QUANT > 0
	%exp:cFiltroSB7%
	ORDER BY SB7.B7_COD
EndSql
oSection1:EndQuery()

oReport:Section(1):Print(.T.)

Return()

/*
ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ
±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
±±ÉÍÍÍÍÍÍÍÍÍÍÑÍÍÍÍÍÍÍÍÍÍËÍÍÍÍÍÍÍÑÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍËÍÍÍÍÍÍÑÍÍÍÍÍÍÍÍÍÍÍÍÍ»±±
±±ºPrograma  ³REST003   ºAutor  ³Microsiga           º Data ³  04/17/13   º±±
±±ÌÍÍÍÍÍÍÍÍÍÍØÍÍÍÍÍÍÍÍÍÍÊÍÍÍÍÍÍÍÏÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÊÍÍÍÍÍÍÏÍÍÍÍÍÍÍÍÍÍÍÍ͹±±
±±ºDesc.     ³                                                            º±±
±±º          ³                                                            º±±
±±ÌÍÍÍÍÍÍÍÍÍÍØÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͹±±
±±ºUso       ³ AP                                                        º±±
±±ÈÍÍÍÍÍÍÍÍÍÍÏÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ±±
±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß
*/
Static Function ValidPerg()   

Local aHelpPor := {}
Local aHelpSpa := {}
Local aHelpEng := {}

//Data Inventario
aHelpPor := {}
Aadd( aHelpPor, 'Informe a data do inventario ')
Aadd( aHelpPor, 'que deseja filtrar.                 ')
PutSx1(cPerg,"01","Data Inventario"," "," ","mv_ch1","D",8,0,0,"G","","","","","mv_par01","","","","","","","","","","","","","","","","",aHelpPor,aHelpEng,aHelpSpa)

//De produto
aHelpPor := {}
Aadd( aHelpPor, 'Informe o codigo inicial do produto')
Aadd( aHelpPor, 'que deseja filtrar.                 ')
PutSx1(cPerg,"02","De Produto"," "," ","mv_ch2","C",6,0,0,"G","","SB1","","","mv_par02","","","","","","","","","","","","","","","","",aHelpPor,aHelpEng,aHelpSpa)

//Ate produto
aHelpPor := {}
Aadd( aHelpPor, 'Informe o codigo final do produto')
Aadd( aHelpPor, 'que deseja filtrar.                 ')
PutSx1(cPerg,"03","Ate Produto"," "," ","mv_ch3","C",6,0,0,"G","","SB1","","","mv_par03","","","","","","","","","","","","","","","","",aHelpPor,aHelpEng,aHelpSpa)

Return()


/*
ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ
±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
±±ÉÍÍÍÍÍÍÍÍÍÍÑÍÍÍÍÍÍÍÍÍÍËÍÍÍÍÍÍÍÑÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍËÍÍÍÍÍÍÑÍÍÍÍÍÍÍÍÍÍÍÍÍ»±±
±±ºPrograma  ³REST003   ºAutor  ³Microsiga           º Data ³  04/17/13   º±±
±±ÌÍÍÍÍÍÍÍÍÍÍØÍÍÍÍÍÍÍÍÍÍÊÍÍÍÍÍÍÍÏÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÊÍÍÍÍÍÍÏÍÍÍÍÍÍÍÍÍÍÍÍ͹±±
±±ºDesc.     ³                                                            º±±
±±º          ³                                                            º±±
±±ÌÍÍÍÍÍÍÍÍÍÍØÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͹±±
±±ºUso       ³ AP                                                        º±±
±±ÈÍÍÍÍÍÍÍÍÍÍÏÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ±±
±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß
*/
Static Function getD1(cCod)   

Local nRet := 0
Local cFiltroSD1 := "% AND SD1.D1_COD = '" + cCod + "' %"

If Select("TRBD1") > 0
	DbSelectArea("TRBD1")
	DbCloseArea("TRBD1")
EndIf

BeginSql alias "TRBD1"       
	SELECT SD1.D1_VUNIT 
	FROM %table:SD1% SD1
	WHERE SD1.D1_FILIAL = %xFilial:SD1% 
	AND SD1.%notDel%
	%exp:cFiltroSD1%
	ORDER BY SD1.R_E_C_N_O_ DESC
EndSql
TRBD1->(DbGoTop())

nRet := TRBD1->D1_VUNIT

Return(nRet)

Por favor Acessar ou Registrar para participar da conversa.

Tempo para a criação da página:0.091 segundos
Joomla templates by a4joomla