'Nome       : RelFerNat.std
'Tipo       : LST
'Data       : 2015/03/05
'Versao     : 2.4
'Descricao  : Relacao de ferias e natal

'------------------------------------------------------------------------------
'#VER - Historia de modificacoes
'------------------------------------------------------------------------------
'- Versao : 1.0  2012/01/05 ---------------------------------------------------
'Versao base 



'-----------------------------------------------------------------------------
' Definicao global do documento
'-----------------------------------------------------------------------------
#DEF
Caracteres invalidos             [CarInv]=#
Subtotalizadores                 [SbtNiv]=2
##


'-----------------------------------------------------------------------------
' Campos especificos
'-----------------------------------------------------------------------------
#ESP
Opcoes para impressora WIN   [PrWinOpc]=[ORI=L]
##


'-----------------------------------------------------------------------------
#DOC
'-----------------------------------------------------------------------------
Tipo                       [DocTip]=ERD2
Nome                       [DocNom]=ERD_CMVC_G,Analise Configuravel

'formato
Saida/Impressora           [DocPrt]=PAG_W
Linhas por pagina          [DocLpg]=80
Colunas por linha          [DocCol]=132
Formato do papel           [DocPap]=72L
Ajustar pagina             [DocApg]=1
Codigos de movimento a     [DocEsp]=LimCmv=170,175
Listar quantidade          [DocEsp]=LstQu=1
Listar valores             [DocEsp]=LstVl=1
lista sobre movimentos     [DocEsp]=ERDMOV=1
sem subtotais              [DocEsp]=STOTNAO=1




'funcoes de listagem
Listar cabecalho            [FxCAB]=Lst_Cab
Listar linhas               [FxLIN]=Lst_; Trb ; Lin ; St ;Sec
Listar fim                  [FxFIM]=Lst_Fim
##


'-----------------------------------------------------------------------------
' Variaveis
'-----------------------------------------------------------------------------
#VAR
DatDia     = FrmDt$("EXT",Sig_DtHoje)
Pag        = Doc_CntPag

'cabecalho
EmpNome    = Emp_Inf_Nome$
CodEmp     = Gpe_Mst_Trb$
Nome       = Gpe_Mst_Nome$
Morada     = Gpe_Mst_Morada$
Local      = Gpe_Mst_Local$

DatNasc    = FrmVal$(Gpe_Mst_DtNasc,44,0)
DatAdmi    = FrmVal$(Gpe_Mst_DtAdmi,44,0)
DatFimCt   = FrmVal$(Gpe_Mst_DtFimCt,44,0)
DatProm    = FrmVal$(Gpe_Mst_DtProm,44,0)

EstCiv     = GpeFrmCodSit$("EST_C",Gpe_Mst_EstCiv)
Ndep       = Gpe_Mst_Depen
NdepDef    = Gpe_Mst_DefD
TpRend     = Gpe_Mst_TipRnd$
Titular    = GpeFrmCodSit$("TITL",Gpe_Mst_TitR)
CodDom     = Gpe_Mst_CodDom
Cat        = GpeTabCon$("CAT",Gpe_Mst_Categ,"DESC")
Sec        = GpeTabCon$("SEC",Gpe_Mst_Sec$,"DESC")

VencMes    = GpeFrmMoe$("",12,Gpe_Mst_Vbase)
VencDia    = GpeFrmMoe$("",12,GpeVenc("D",Gpe_Mst_Horas,Gpe_Mst_Vbase))
VencHor    = GpeFrmMoe$("",12,GpeVenc("H",Gpe_Mst_Horas,Gpe_Mst_Vbase))

Cont       = Gpe_Mst_Ctrb$
Crss       = GpeTabCon$("CSS",Gpe_Mst_Crss,"NOME")
NumCrss    = Gpe_Mst_CrssNb$
Sind       = GpeTabCon$("SND",Gpe_Mst_Sind,"NOME")
NumSind    = Gpe_Mst_SindSoc
Banc       = GpeTabCon$("BNC",Gpe_Mst_Banco$,"NOME")
NumBanc    = Gpe_Mst_BcNib$


TrbLin     = Gpe_Mst_Trb$+"  "+Gpe_Mst_Nome$
CodLin     = Gpe_Cmv_Cod$+" "+left$(Gpe_Cmv_Descr$,18)
CodLinx    = Gpe_Cmv_Cod$+" "+Gpe_Cmv_Descr$
Sec        = GpeCodFrm$("SEC",Gpe_Mst_Sec$)+"  "+GpeTabCon$("SEC",Gpe_Mst_Sec$,"DESC")


'linha
Cd         = Gpe_Cmv_Cod$
Descr      = left$(Gpe_Cmv_Descr$,12)
Descrx     = Gpe_Cmv_Descr$
Jan        = GpeFrmMoe$("",10,MemNum(71))
fev        = GpeFrmMoe$("",10,MemNum(72))
Mar        = GpeFrmMoe$("",10,MemNum(73))
Abr        = GpeFrmMoe$("",10,MemNum(74))
Mai        = GpeFrmMoe$("",10,MemNum(75))
Jun        = GpeFrmMoe$("",10,MemNum(76))
Jul        = GpeFrmMoe$("",10,MemNum(77))
Ago        = GpeFrmMoe$("",10,MemNum(78))
Set        = GpeFrmMoe$("",10,MemNum(79))
Out        = GpeFrmMoe$("",10,MemNum(80))
Nov        = GpeFrmMoe$("",10,MemNum(81))
Dez        = GpeFrmMoe$("",10,MemNum(82))
TLinm      = GpeFrmMoe$("",10,MemNum(0))
TLin       = GpeFrmMoe$("",10,MemNum(10))
TLin1      = GpeFrmMoe$("",10,MemNum(10))

Jan2       = GpeFrmT$("?",3.2,MemNum(91))
fev2       = GpeFrmT$("?",3.2,MemNum(92))
Mar2       = GpeFrmT$("?",3.2,MemNum(93))
Abr2       = GpeFrmT$("?",3.2,MemNum(94))
Mai2       = GpeFrmT$("?",3.2,MemNum(95))
Jun2       = GpeFrmT$("?",3.2,MemNum(96))
Jul2       = GpeFrmT$("?",3.2,MemNum(97))
Ago2       = GpeFrmT$("?",3.2,MemNum(98))
Set2       = GpeFrmT$("?",3.2,MemNum(99))
Out2       = GpeFrmT$("?",3.2,MemNum(100))
Nov2       = GpeFrmT$("?",3.2,MemNum(101))
Dez2       = GpeFrmT$("?",3.2,MemNum(102))
TLin2      = GpeFrmT$("?",4.2,MemNum(20))

'totais de seccao - valor
TotJan     = GpeFrmMoe$("",9,MemNum(31))
TotFev     = GpeFrmMoe$("",9,MemNum(32))
TotMar     = GpeFrmMoe$("",9,MemNum(33))
TotAbr     = GpeFrmMoe$("",9,MemNum(34))
TotMai     = GpeFrmMoe$("",9,MemNum(35))
TotJun     = GpeFrmMoe$("",9,MemNum(36))
TotJul     = GpeFrmMoe$("",9,MemNum(37))
TotAgo     = GpeFrmMoe$("",9,MemNum(38))
TotSet     = GpeFrmMoe$("",9,MemNum(39))
TotOut     = GpeFrmMoe$("",9,MemNum(40))
TotNov     = GpeFrmMoe$("",9,MemNum(41))
TotDez     = GpeFrmMoe$("",9,MemNum(42))
TotVl      = GpeFrmMoe$("",9,MemNum(43))

'totais de coluna - valor de abonos
TotAJan    = GpeFrmMoe$("",11,MemNum(11))
TotAFev    = GpeFrmMoe$("",11,MemNum(12))
TotAMar    = GpeFrmMoe$("",11,MemNum(13))
TotAAbr    = GpeFrmMoe$("",11,MemNum(14))
TotAMai    = GpeFrmMoe$("",11,MemNum(15))
TotAJun    = GpeFrmMoe$("",11,MemNum(16))
TotAJul    = GpeFrmMoe$("",11,MemNum(17))
TotAAgo    = GpeFrmMoe$("",11,MemNum(18))
TotASet    = GpeFrmMoe$("",11,MemNum(19))
TotAOut    = GpeFrmMoe$("",11,MemNum(20))
TotANov    = GpeFrmMoe$("",11,MemNum(21))
TotADez    = GpeFrmMoe$("",11,MemNum(22))

'totais de coluna - valor de faltas
TotFJan    = GpeFrmMoe$("",11,MemNum(31))
TotFFev    = GpeFrmMoe$("",11,MemNum(32))
TotFMar    = GpeFrmMoe$("",11,MemNum(33))
TotFAbr    = GpeFrmMoe$("",11,MemNum(34))
TotFMai    = GpeFrmMoe$("",11,MemNum(35))
TotFJun    = GpeFrmMoe$("",11,MemNum(36))
TotFJul    = GpeFrmMoe$("",11,MemNum(37))
TotFAgo    = GpeFrmMoe$("",11,MemNum(38))
TotFSet    = GpeFrmMoe$("",11,MemNum(39))
TotFOut    = GpeFrmMoe$("",11,MemNum(40))
TotFNov    = GpeFrmMoe$("",11,MemNum(41))
TotFDez    = GpeFrmMoe$("",11,MemNum(42))

'totais de coluna - valor de descontos
TotDJan    = GpeFrmMoe$("",11,MemNum(51))
TotDFev    = GpeFrmMoe$("",11,MemNum(52))
TotDMar    = GpeFrmMoe$("",11,MemNum(53))
TotDAbr    = GpeFrmMoe$("",11,MemNum(54))
TotDMai    = GpeFrmMoe$("",11,MemNum(55))
TotDJun    = GpeFrmMoe$("",11,MemNum(56))
TotDJul    = GpeFrmMoe$("",11,MemNum(57))
TotDAgo    = GpeFrmMoe$("",11,MemNum(58))
TotDSet    = GpeFrmMoe$("",11,MemNum(59))
TotDOut    = GpeFrmMoe$("",11,MemNum(60))
TotDNov    = GpeFrmMoe$("",11,MemNum(61))
TotDDez    = GpeFrmMoe$("",11,MemNum(62))

'totais de coluna - valor liquido
TotLJan   = GpeFrmMoe$("",11,MemNum(121))
TotLFev   = GpeFrmMoe$("",11,MemNum(122))
TotLMar   = GpeFrmMoe$("",11,MemNum(123))
TotLAbr   = GpeFrmMoe$("",11,MemNum(124))
TotLMai   = GpeFrmMoe$("",11,MemNum(125))
TotLJun   = GpeFrmMoe$("",11,MemNum(126))
TotLJul   = GpeFrmMoe$("",11,MemNum(127))
TotLAgo   = GpeFrmMoe$("",11,MemNum(128))
TotLSet   = GpeFrmMoe$("",11,MemNum(129))
TotLOut   = GpeFrmMoe$("",11,MemNum(130))
TotLNov   = GpeFrmMoe$("",11,MemNum(131))
TotLDez   = GpeFrmMoe$("",11,MemNum(132))

'totais de gerais (por tipo: Abono/Falta/Desconto)
TotLGer   = GpeFrmMoe$("",11,MemNum(120))
TotAGer   = GpeFrmMoe$("",11,MemNum(10))
TotFGer   = GpeFrmMoe$("",11,MemNum(30))
TotDGer   = GpeFrmMoe$("",11,MemNum(50))

'totais de seccao - quantidade (HORAS)
TJanh  = GpeFrmT$("H",4.2,MemNum(51))
TFevh  = GpeFrmT$("H",4.2,MemNum(52))
TMarh  = GpeFrmT$("H",4.2,MemNum(53))
TAbrh  = GpeFrmT$("H",4.2,MemNum(54))
TMaih  = GpeFrmT$("H",4.2,MemNum(55))
TJunh  = GpeFrmT$("H",4.2,MemNum(56))
TJulh  = GpeFrmT$("H",4.2,MemNum(57))
TAgoh  = GpeFrmT$("H",4.2,MemNum(58))
TSeth  = GpeFrmT$("H",4.2,MemNum(59))
TOuth  = GpeFrmT$("H",4.2,MemNum(60))
TNovh  = GpeFrmT$("H",4.2,MemNum(61))
TDezh  = GpeFrmT$("H",4.2,MemNum(62))
Toth   = GpeFrmT$("H",4.2,MemNum(63))

'totais de seccao - quantidade (DIAS)
TJanD  = GpeFrmT$("D",3.2,MemNum(51))
TFevD  = GpeFrmT$("D",3.2,MemNum(52))
TMarD  = GpeFrmT$("D",3.2,MemNum(53))
TAbrD  = GpeFrmT$("D",3.2,MemNum(54))
TMaiD  = GpeFrmT$("D",3.2,MemNum(55))
TJunD  = GpeFrmT$("D",3.2,MemNum(56))
TJulD  = GpeFrmT$("D",3.2,MemNum(57))
TAgoD  = GpeFrmT$("D",3.2,MemNum(58))
TSetD  = GpeFrmT$("D",3.2,MemNum(59))
TOutD  = GpeFrmT$("D",3.2,MemNum(60))
TNovD  = GpeFrmT$("D",3.2,MemNum(61))
TDezD  = GpeFrmT$("D",3.2,MemNum(62))
Totd   = GpeFrmT$("D",3.2,MemNum(63))

##

#INC
Variaveis  comuns                 =[SIG_Dir.Div],LsComVar.std
##



'-----------------------------------------------------------------------------
' Formato do documento
'-----------------------------------------------------------------------------
#PGM



SUB FxIni 'funcao de inicializacao
Call SigLstIni
fx=PrtOri("L")
End sub

  

Sub Lst_Cab

SigCabNorOpcTit=2
titulo$=" Relação de subsídio de Férias e Natal"

Margem=6
Call SigLstCab


call Lst_CabGen
end sub



'------------------------------------------------------------------------------
Sub Lst_CabGen   'Analise configuravel
'------------------------------------------------------------------------------


'posicao de valores
Esp=12
Col1=0
Col2=5

ini=36
Col3=Ini
Col4=Ini+(esp*1)
Col5=Ini+(esp*2)
Col6=Ini+(esp*3)
Col7=Ini+(esp*4)
Col8=Ini+(esp*5)
Col9=Ini+(esp*6)
Col10=Ini+(esp*7)
Col11=Ini+(esp*8)
Col12=Ini+(esp*9)
Col13=Ini+(esp*10)
Col14=Ini+(esp*11)
Col15=Ini+(esp*12)
Col16=Ini+(esp*13)
cmax=Col16



PrWIN AJT_B,  Margem, 25                    	'posicao base
PrWIN COR_T,CorTraco                            'cor de linhas
PrWIN GR_LI, 0, 0, cmax, 0               	'linha
PrWIN GR_LI, 0, 7, cmax, 7               	'linha


PrWIN COR_T,  CorTitLst                        'cor de titulo
PrWIN FON  ,   6,   1                        	'activar fonte
Lin=2

PrWIN TX_CTR,  Col1,Lin,Col3,Lin,"Descrição"
PrWIN TX_CTR,  Col3,Lin,Col4,Lin,"Janeiro"
PrWIN TX_CTR,  Col4,Lin,Col5,Lin,"Fevereiro"
PrWIN TX_CTR,  Col5,Lin,Col6,Lin,"Março"
PrWIN TX_CTR,  Col6,Lin,Col7,Lin,"Abril"
PrWIN TX_CTR,  Col7,Lin,Col8,Lin,"Maio"
PrWIN TX_CTR,  Col8,Lin,Col9,Lin,"Junho"
PrWIN TX_CTR,  Col9,Lin,Col10,Lin,"Julho"
PrWIN TX_CTR,  Col10,Lin,Col11,Lin,"Agosto"
PrWIN TX_CTR,  Col11,Lin,Col12,Lin,"Setembro"
PrWIN TX_CTR,  Col12,Lin,Col13,Lin,"Outubro"
PrWIN TX_CTR,  Col13,Lin,Col14,Lin,"Novembro"
PrWIN TX_CTR,  Col14,Lin,Col15,Lin,"Dezembro"
PrWIN TX_CTR,  Col15,Lin,Col16,Lin,"Total"
PrWin COR_T ,  CorLin
InicioEscrita=30
AlturaLinha=3
End Sub


'-----------------------------------------------------------------------------
Sub Lst_Lin
'-----------------------------------------------------------------------------
PrWIN AJT_B,  Margem, InicioEscrita+Doc_CntLin*AlturaLinha*1          	'posicao base
Lin=0
if MemNum(5)>0 then
  PrWIN TX_N,   Col1,Lin,"(V)"
  PrWIN TX_DMX, Col2,Lin,Col3-Col2,@CodLin
  PrWIN TX_NP,  Col3,Lin,"N",@Jan
  PrWIN TX_NP,  Col4,Lin,"N",@Fev
  PrWIN TX_NP,  Col5,Lin,"N",@Mar
  PrWIN TX_NP,  Col6,Lin,"N",@Abr
  PrWIN TX_NP,  Col7,Lin,"N",@Mai
  PrWIN TX_NP,  Col8,Lin,"N",@Jun
  PrWIN TX_NP,  Col9,Lin,"N",@Jul
  PrWIN TX_NP,  Col10,Lin,"N",@Ago
  PrWIN TX_NP,  Col11,Lin,"N",@Set
  PrWIN TX_NP,  Col12,Lin,"N",@Out
  PrWIN TX_NP,  Col13,Lin,"N",@Nov
  PrWIN TX_NP,  Col14,Lin,"N",@Dez
  PrWIN TX_NP,  Col15,Lin,"N",@Tlin1
  Lin=AlturaLinha
end if
IF MemNum(6)>0 then
  ajt=2
'  PrWIN TX_N,   Col1,Lin,"(Q)"
  PrWIN TX_DMX, Col2,Lin,Col3-Col2,@CodLin
  PrWIN TX_NP,  Col3+ajt,Lin,"N",@Jan2
  PrWIN TX_NP,  Col4+ajt,Lin,"N",@Fev2
  PrWIN TX_NP,  Col5+ajt,Lin,"N",@Mar2
  PrWIN TX_NP,  Col6+ajt,Lin,"N",@Abr2
  PrWIN TX_NP,  Col7+ajt,Lin,"N",@Mai2
  PrWIN TX_NP,  Col8+ajt,Lin,"N",@Jun2
  PrWIN TX_NP,  Col9+ajt,Lin,"N",@Jul2
  PrWIN TX_NP,  Col10+ajt,Lin,"N",@Ago2
  PrWIN TX_NP,  Col11+ajt,Lin,"N",@Set2
  PrWIN TX_NP,  Col12+ajt,Lin,"N",@Out2
  PrWIN TX_NP,  Col13+ajt,Lin,"N",@Nov2
  PrWIN TX_NP,  Col14+ajt,Lin,"N",@Dez2
  PrWIN TX_NP,  Col15+ajt,Lin,"N",@Tlin2
end if

if MemNum(5)=MemNum(6) then      'listou ambas as linhas
 tmp=CntLin("INC",1)             'contar linha extra
end if
End Sub


'-----------------------------------------------------------------------------
Sub Lst_Trb
'-----------------------------------------------------------------------------
PrWIN AJT_B,  Margem, InicioEscrita+Doc_CntLin*AlturaLinha*1          	'posicao base
PrWIN TX_N,  Col1,0,@TrbLin
End sub


'-----------------------------------------------------------------------------
Sub Lst_Sec
'-----------------------------------------------------------------------------
PrWIN AJT_B,  Margem, InicioEscrita+Doc_CntLin*AlturaLinha*1          	'posicao base
PrWIN COR_T,  CorTitLst                        'cor de titulo
PrWIN TX_N,  Col1   ,0,"Seccao"
PrWIN TX_N,  Col1+20,0,@Sec
PrWIN COR_T,  CorLin                        'cor de LINHA
end sub


'-----------------------------------------------------------------------------
Sub Lst_St
'-----------------------------------------------------------------------------
PrWIN COR_T,  CorTraco                        'cor 
PrWIN AJT_B,  Margem+3, InicioEscrita+Doc_CntLin*AlturaLinha*1          	'posicao base
PrWIN GR_LI, 0,0,Cmax,0                  'linha
Lin=0
if MemNum(5)>0 then
  PrWIN TX_N,    Col2,Lin,"Valores"
  PrWIN TX_NP,   Col3,Lin,"N",@TotJan
  PrWIN TX_NP,   Col4,Lin,"N",@TotFev
  PrWIN TX_NP,   Col5,Lin,"N",@TotMar
  PrWIN TX_NP,   Col6,Lin,"N",@TotAbr
  PrWIN TX_NP,   Col7,Lin,"N",@TotMai
  PrWIN TX_NP,   Col8,Lin,"N",@TotJun
  PrWIN TX_NP,   Col9,Lin,"N",@TotJul
  PrWIN TX_NP,  Col10,Lin,"N",@TotAgo
  PrWIN TX_NP,  Col11,Lin,"N",@TotSet
  PrWIN TX_NP,  Col12,Lin,"N",@TotOut
  PrWIN TX_NP,  Col13,Lin,"N",@TotNov
  PrWIN TX_NP,  Col14,Lin,"N",@TotDez
  PrWIN TX_NP,  Col15,Lin,"N",@TotVl
  Lin=AlturaLinha
end if

if MemNum(6)>0 then
  PrWIN TX_N,    Col2,Lin,"Dias"
  PrWIN TX_NP,   Col3,Lin,"N",@TJand
  PrWIN TX_NP,   Col4,Lin,"N",@TFevd
  PrWIN TX_NP,   Col5,Lin,"N",@TMard
  PrWIN TX_NP,   Col6,Lin,"N",@TAbrd
  PrWIN TX_NP,   Col7,Lin,"N",@TMaid
  PrWIN TX_NP,   Col8,Lin,"N",@TJund
  PrWIN TX_NP,   Col9,Lin,"N",@TJuld
  PrWIN TX_NP,  Col10,Lin,"N",@TAgod
  PrWIN TX_NP,  Col11,Lin,"N",@TSetd
  PrWIN TX_NP,  Col12,Lin,"N",@TOutd
  PrWIN TX_NP,  Col13,Lin,"N",@TNovd
  PrWIN TX_NP,  Col14,Lin,"N",@TDezd
  PrWIN TX_NP,  Col15,Lin,"N",@Totd

  Lin=Lin+AlturaLinha
  PrWIN TX_N,    Col2,Lin,"Horas"
  PrWIN TX_NP,   Col3,Lin,"N",@TJanh
  PrWIN TX_NP,   Col4,Lin,"N",@TFevh
  PrWIN TX_NP,   Col5,Lin,"N",@TMarh
  PrWIN TX_NP,   Col6,Lin,"N",@TAbrh
  PrWIN TX_NP,   Col7,Lin,"N",@TMaih
  PrWIN TX_NP,   Col8,Lin,"N",@TJunh
  PrWIN TX_NP,   Col9,Lin,"N",@TJulh
  PrWIN TX_NP,  Col10,Lin,"N",@TAgoh
  PrWIN TX_NP,  Col11,Lin,"N",@TSeth
  PrWIN TX_NP,  Col12,Lin,"N",@TOuth
  PrWIN TX_NP,  Col13,Lin,"N",@TNovh
  PrWIN TX_NP,  Col14,Lin,"N",@TDezh
  PrWIN TX_NP,  Col15,Lin,"N",@Toth
  tmp=CntLin("INC",1)             'contar linha extra
end if
x=totlpz(1)
'PrWIN GR_LI, 0, Lin2, cmax, Lin2              	'linha

if MemNum(5)=MemNum(6) then      'listou ambas as linhas
  tmp=CntLin("INC",1)             'contar linha extra
end if
end sub


'-----------------------------------------------------------------------------
Sub Lst_Fim
'-----------------------------------------------------------------------------
PrWIN AJT_B,  Margem, LinPer        'posicao base
PrWIN COR_T,CorTraco                      'cor de linhas
PrWIN GR_LI, 0, 0, cmax, 0                'linha
Call SigLstFim
PrWin FP                                  'fim de pagina
x=TotLpz(0)                               'limpar totalizadores
End Sub



##

#INC
Funcoes comuns                    =[SIG_Dir.Div],LsComPgm.std
##

