Estou com uma tela de Ferias que segue a seguinte logica:
"Pego um funcionario pelo banco de dados, já jogo a data do periodo de aquisição do funcionário, logo após preencho a data de ferias(dtfefun) com a data de aquisição + 365 dias. Continuo fazend alguns calculos, blz. "
Porem eu vim a reparar que não está salvando essa data de ferias em meu banco de dados, tendo tambem uma função de cancelamento de ferias e ela tambem não está retirando a data de ferias no banco de dados do funcionario.
O que faço? Alguem tem uma boa macumba? uma reaza, sei la kkkkkkk
CODIGO:
#include "fivewin.ch"
#include "xbrowse.ch"
#include "ribbon.ch"
#include "DTPICKER.ch"
#Define CLR_AZUL_BRANCO nRGB( 040, 004, 090 )
#Define CLR_SKY nRGB( 202, 228, 255 )
static tmeanfer , tperiodo , tbferfun , tmerefer , tabpefun ,;
tavos , tavoster , tsindfer , tinssfer , omatrfun ,;
onomefun , tnomefun , tsalario , tmes_ass , tdtrefun ,;
tbirffer , tdepifun , tadicfer , tdepsfun , tbfgtfer ,;
nabpefun , tdtfefun , tdtaqfun
Function Consu_Ferias()
local lsave:= .f.
local lcaptura:=.f.
public tmatrfun , tmean
set century off
If Select("mov")=0
use \&tmae\&temp\fmovimen alias mov shared new
if neterr()
MsgInfo("Arquivo Não DisponÃvel no Momento" + CRLF + "fmovimen","Tente Novamente")
close data
return .f.
endif
set index to fmovimen
endif
if fsarqcal()=.f.;return .f. ;endif
select fun
tmatrfun:= Space(len(fun->matrfun))
tnomefun:= Space(len(fun->nomefun))
tdtaqfun:=DATE()
tdtfefun:=DATE()
tdtfffun:=DATE()
tavos :=0
tavoster:=0
tsindfer:=0
tmerefer:=0
tinssfer:=0
if nabpefun= 1
tabpefun:="S"
elseif nabpefun =2
Tabpefun:="N"
endif
/* como a funçao do dos vc faz no fivew
ex : ele so preenche as variveis no clipper qnd abre
no get da matricula
no seu caso
vc ja pode abrir os gets com os valores agora eles vao mudando de acordo com o passar dos valid */
Define Font oFontrb Name "Times New Roman" Size 0,-26
DEFINE DIALOG ODLGFERIASINFO RESOURCE "DLG_FERIAS_INFO"
REDEFINE RBBTN oInfo ID 4003 OF ODLGFERIASINFO PROMPT "Informar Ferias" CENTER ADJUST SAYBUTTON ROUND LINECOLORS CLR_SKY,CLR_AZUL_BRANCO
SET FONT of oInfo to oFontrb
Redefine GET omatrfun var tmatrfun ID 28 OF ODLGFERIASINFO valid Pesq_Funcion() .and. !empty(tmatrfun) Bitmap cbmp+"\lupa2.bmp" Action CONSULT_FUN4()
Redefine GET onomefun var tnomefun ID 29 OF ODLGFERIASINFO
REDEFINE DTPICKER odtaqfun VAR tdtaqfun ID 30 OF ODLGFERIASINFO valid VAL_tdtaqfun()
REDEFINE DTPICKER odtfefun VAR tdtfefun ID 31 OF ODLGFERIASINFO valid VAL_tdtfefun()
REDEFINE RADIO oabpefun VAR nabpefun ID 32,33 OF ODLGFERIASINFO on change ( iif( nabpefun= 1, tabpefun:="S",tabpefun:="N" ))
Redefine GET operiodo var tperiodo ID 34 OF ODLGFERIASINFO pict "99" valid VAL_tperiodo()
Redefine GET omerefer var tmerefer ID 35 OF ODLGFERIASINFO pict "@R 999 999 999.99" valid VAL_tmerefer()
Redefine GET obferfun var tbferfun ID 36 OF ODLGFERIASINFO pict "@R 999 999 999.99" valid VAL_tbferfun()
Redefine GET oavos var tavos ID 37 OF ODLGFERIASINFO pict "99" valid !tavos>12
Redefine GET oavoster var tavoster ID 38 OF ODLGFERIASINFO pict "99" valid !tavoster>12
Redefine GET osindfer var tsindfer ID 39 OF ODLGFERIASINFO pict "@R 999 999 999.99" Valid val_tsindfer()
REDEFINE DTPICKER odtfffun VAR tdtfffun ID 40 OF ODLGFERIASINFO
Redefine GET oinssfer var tinssfer ID 42 OF ODLGFERIASINFO pict "@R 999 999.99"
Redefine GET omeanfer var tmeanfer ID 41 OF ODLGFERIASINFO pict "9999" valid VAL_tmeanfer()
REDEFINE buttonbmp BORDER ROUND ID 11 OF ODLGFERIASINFO ACTION (lsave:=.t. ,ODLGFERIASINFO:end()) Bitmap cBmp+"\Ok32.bmp" PROMPT "Confirmar"
REDEFINE buttonbmp BORDER ROUND ID 12 OF ODLGFERIASINFO ACTION (lsave:=.f. ,ODLGFERIASINFO:end()) Bitmap cBmp+"\Fech.bmp" PROMPT "Cancelar" cancel
ACTIVATE DIALOG ODLGFERIASINFO CENTERED
if lsave
DEFINE BRUSH oBrushVista RESOURCE "VISTADIALOG"
DEFINE FONT oFont04 NAME "LUCIDA CONSOLE" SIZE 0,-14
DEFINE DIALOG oDlgAguarde2 RESOURCE "DLG_AGUARDE_PROCESSAMENTO" BRUSH oBrushVista
REDEFINE IMAGE oImg ID 4003 OF oDlgAguarde2 FILENAME cbmp+"aguarde.bmp" UPDATE ADJUST
vreg01:=space(0)
REDEFINE Say oReg01 Var vReg01 ID 4001 OF oDlgAguarde2 FONT oFont04 Update
ACTIVATE DIALOG oDlgAguarde2 CENTERED NOWAIT
vReg01:="Aguarde, Processando...";oreg01:refresh()
select mov
set order to 1
seek tmatrfun+tmeanfer+"F02"
if eof()
append blank
replace meanmov with tmeanfer
replace funcmov with tmatrfun
replace redemov with "F02"
replace octomov with "01"
replace nuocmov with 1
endif
if travareg()=.f.
return .f.
endif
replace valrmov with tinssfer
*
* Calcula a contribuicao do IRRF sobre ferias.
tpensfer := 0
seek tmatrfun+tmean+"FP"
if !eof() .and. left(redemov,2)="FP"
tpensfer := tpensfer+valrmov
skip
endif
tbirffer := tbirffer - tpensfer
tbindfun := (tbirffer - tdepifun*tmdpirifo - tinssfer)/tminirifo
sele irr
go top
if tbindfun < tetoipr
tirrefer := (tbindfun * aliqipr/100 ) - deduipr * tminirifo
endif
skip
*tirrefer = int(tirrefer)
tirrefer := tirrefer
if tirrefer < 10.00 .and. tirrefer#0
if MsgYesNo("Valor Inferior a R$ 10,00 , Alterar o Valor?","Pergunta")
DEFINE DIALOG ODLGIRF RESOURCE "DLG_FERIAS_INFO2"
Redefine GET oirrefer var tirrefer ID 4003 OF ODLGIRF pict "@E 999,999.99"
REDEFINE buttonbmp BORDER ROUND ID 4004 OF ODLGIRF ACTION (lsave:=.t.,ODLGIRF:end())
REDEFINE buttonbmp BORDER ROUND ID 4005 OF ODLGIRF ACTION (lsave:=.f.,ODLGIRF:end())cancel
ACTIVATE DIALOG ODLGIRF CENTERED
if !lsave
return .f.
endif
/*
JANELA(10,15,12,50,"")
cor("gets")
@ 11,16 say "Valor do Irpf s/Ferias" get tirrefer pict "@E 999,999.99"
*/
ENDIF
endif
*
select mov
if tirrefer # 0
seek tmatrfun+tmeanfer+"F03"
if eof()
append blank
replace meanmov with tmeanfer
replace funcmov with tmatrfun
replace redemov with "F03"
replace octomov with "01"
replace nuocmov with 1
endif
if travareg()=.f.
return .f.
endif
replace valrmov with tirrefer
endif
*
* Atribui adicional de ferias.
seek tmatrfun+tmeanfer+"F04"
if eof()
append blank
replace meanmov with tmeanfer
replace funcmov with tmatrfun
replace redemov with "F04"
replace octomov with "01"
replace nuocmov with 1
endif
if travareg()=.f.
return .f.
endif
replace valrmov with tadicfer
*
* Calcula o salario familia sobre ferias.
tsafafer := 0
if tdepsfun > 0
select saf
go top
if tbinsfer < tetosaf
tsafafer := valrsaf * tdepsfun
endif
skip
endif
tsafafer := round(tsafafer,2)
*
select mov
if tsafafer # 0
seek tmatrfun+tmeanfer+"F06"
if eof()
append blank
replace meanmov with tmeanfer
replace funcmov with tmatrfun
replace redemov with "F06"
replace octomov with "01"
replace nuocmov with 1
endif
if travareg()=.f.
return .f.
endif
replace valrmov with tsafafer
endif
*
select mov
if tsindfer # 0
seek tmatrfun+tmeanfer+"F07"
if eof()
append blank
replace meanmov with tmeanfer
replace funcmov with tmatrfun
replace redemov with "F07"
replace octomov with "01"
replace nuocmov with 1
endif
if travareg()=.f.
return .f.
endif
replace valrmov with tsindfer
endif
*
* Atribui a base de FGTS sobre ferias.
seek tmatrfun+tmeanfer+"FBF"
if eof()
append blank
replace meanmov with tmeanfer
replace funcmov with tmatrfun
replace redemov with "FBF"
replace octomov with "01"
replace nuocmov with 1
endif
if travareg()=.f.
return .f.
endif
replace valrmov with tbfgtfer
*
* Armazena o inicio do periodo de aquisicao das ferias.
seek tmatrfun+tmeanfer+"FIA"
if eof()
append blank
replace meanmov with tmeanfer
replace funcmov with tmatrfun
replace redemov with "FIA"
replace octomov with "01"
replace nuocmov with 1
endif
if travareg()=.f.
return .f.
endif
replace valrmov with val(right(dtos(tdtaqfun),6))
*
* Armazena o inicio do periodo de gozo das ferias.
seek tmatrfun+tmeanfer+"FIG"
if eof()
append blank
replace meanmov with tmeanfer
replace funcmov with tmatrfun
replace redemov with "FIG"
replace octomov with "01"
replace nuocmov with 1
endif
if travareg()=.f.
return .f.
endif
replace valrmov with val(right(dtos(tdtfefun),6))
*
* Armazena o fim do periodo de gozo das ferias.
seek tmatrfun+tmeanfer+"FFG"
if eof()
append blank
replace meanmov with tmeanfer
replace funcmov with tmatrfun
replace redemov with "FFG"
replace octomov with "01"
replace nuocmov with 1
endif
if travareg()=.f.
return .f.
endif
replace valrmov with val(right(dtos(tdtfffun),6))
*
select fun
Set order to 1
Seek tmatrfun
if travareg()=.f.
return .f.
endif
replace dtaqfun with tdtaqfun
replace dtfefun with tdtfefun
if tabpefun = "S"
replace abpefun with .t.
else
replace abpefun with .f.
endif
dbunlock()
dbcommit()
oDlgAguarde2:end()
close data
return .t.
endif
select fun