-
Notifications
You must be signed in to change notification settings - Fork 12
/
PUTSX1.prw
142 lines (112 loc) · 3.96 KB
/
PUTSX1.prw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
#Include 'Protheus.ch'
#INCLUDE "AP5MAIL.CH"
#INCLUDE "protheus.ch"
#INCLUDE "dbstruct.ch"
#INCLUDE "APWIZARD.CH"
#INCLUDE "FWMVCDEF.CH"
#INCLUDE "FWADAPTEREAI.CH"
//====================================================================================================================\\
/*/{Protheus.doc}PutSx1
====================================================================================================================
@description
Criação de arquivo de perguntas
@author Thiago Mota
@author <mota.thiago@totvs.com.br>
@author <tgmspawn@gmail.com>
@version 1.0
@since 1 de ago de 2017
@obs Utilizado para poder habilitar a função de criação dos grupos SX1 na versão 12.
/*/
//===================================================================================================================\\
User Function PutSx1(cGrupo,cOrdem,cPergunt,cPerSpa,cPerEng,cVar,;
cTipo ,nTamanho,nDecimal,nPresel,cGSC,cValid,;
cF3, cGrpSxg,cPyme,;
cVar01,cDef01,cDefSpa1,cDefEng1,cCnt01,;
cDef02,cDefSpa2,cDefEng2,;
cDef03,cDefSpa3,cDefEng3,;
cDef04,cDefSpa4,cDefEng4,;
cDef05,cDefSpa5,cDefEng5,;
aHelpPor,aHelpEng,aHelpSpa,cHelp)
LOCAL aArea := GetArea()
Local cKey
Local lPort := .f.
Local lSpa := .f.
Local lIngl := .f.
cKey := "P." + AllTrim( cGrupo ) + AllTrim( cOrdem ) + "."
cPyme := Iif( cPyme == Nil, " ", cPyme )
cF3 := Iif( cF3 == NIl, " ", cF3 )
cGrpSxg := Iif( cGrpSxg == Nil, " ", cGrpSxg )
cCnt01 := Iif( cCnt01 == Nil, "" , cCnt01 )
cHelp := Iif( cHelp == Nil, "" , cHelp )
dbSelectArea( "SX1" )
dbSetOrder( 1 )
// Ajusta o tamanho do grupo. Ajuste emergencial para validação dos fontes.
// RFC - 15/03/2007
cGrupo := PadR( cGrupo , Len( SX1->X1_GRUPO ) , " " )
If !( DbSeek( cGrupo + cOrdem ))
cPergunt:= If(! "?" $ cPergunt .And. ! Empty(cPergunt),Alltrim(cPergunt)+" ?",cPergunt)
cPerSpa := If(! "?" $ cPerSpa .And. ! Empty(cPerSpa) ,Alltrim(cPerSpa) +" ?",cPerSpa)
cPerEng := If(! "?" $ cPerEng .And. ! Empty(cPerEng) ,Alltrim(cPerEng) +" ?",cPerEng)
Reclock( "SX1" , .T. )
Replace X1_GRUPO With cGrupo
Replace X1_ORDEM With cOrdem
Replace X1_PERGUNT With cPergunt
Replace X1_PERSPA With cPerSpa
Replace X1_PERENG With cPerEng
Replace X1_VARIAVL With cVar
Replace X1_TIPO With cTipo
Replace X1_TAMANHO With nTamanho
Replace X1_DECIMAL With nDecimal
Replace X1_PRESEL With nPresel
Replace X1_GSC With cGSC
Replace X1_VALID With cValid
Replace X1_VAR01 With cVar01
Replace X1_F3 With cF3
Replace X1_GRPSXG With cGrpSxg
If Fieldpos("X1_PYME") > 0
If cPyme != Nil
Replace X1_PYME With cPyme
Endif
Endif
Replace X1_CNT01 With cCnt01
If cGSC == "C" // Mult Escolha
Replace X1_DEF01 With cDef01
Replace X1_DEFSPA1 With cDefSpa1
Replace X1_DEFENG1 With cDefEng1
Replace X1_DEF02 With cDef02
Replace X1_DEFSPA2 With cDefSpa2
Replace X1_DEFENG2 With cDefEng2
Replace X1_DEF03 With cDef03
Replace X1_DEFSPA3 With cDefSpa3
Replace X1_DEFENG3 With cDefEng3
Replace X1_DEF04 With cDef04
Replace X1_DEFSPA4 With cDefSpa4
Replace X1_DEFENG4 With cDefEng4
Replace X1_DEF05 With cDef05
Replace X1_DEFSPA5 With cDefSpa5
Replace X1_DEFENG5 With cDefEng5
Endif
Replace X1_HELP With cHelp
PutSX1Help(cKey,aHelpPor,aHelpEng,aHelpSpa)
MsUnlock()
Else
lPort := ! "?" $ X1_PERGUNT .And. ! Empty(SX1->X1_PERGUNT)
lSpa := ! "?" $ X1_PERSPA .And. ! Empty(SX1->X1_PERSPA)
lIngl := ! "?" $ X1_PERENG .And. ! Empty(SX1->X1_PERENG)
If lPort .Or. lSpa .Or. lIngl
RecLock("SX1",.F.)
If lPort
SX1->X1_PERGUNT:= Alltrim(SX1->X1_PERGUNT)+" ?"
EndIf
If lSpa
SX1->X1_PERSPA := Alltrim(SX1->X1_PERSPA) +" ?"
EndIf
If lIngl
SX1->X1_PERENG := Alltrim(SX1->X1_PERENG) +" ?"
EndIf
SX1->(MsUnLock())
EndIf
Endif
RestArea( aArea )
Return// FIM da Funcao PutSx1
//======================================================================================================================