Ponto de Entrada
Descrição: | Este Ponto de Entrada permite que o usuário customize a tela "Alterar Dados do Veículo" localizada na rotina Agendamento (OFIOM350). |
Localização: | Atualizações / Mov Oficina / Agendamento |
Eventos: | Function FGX_ALTVEI(cTipo) Local nOk := 0 Private aAltCampos:= {"","","","","","","","","","","",""} Private aSlvCampos:= {"","","","","","","","","","","",""} Private aMemos := {{"VV1_OBSMEM","VV1_OBSERV"}} Private aCampos := {} Private aCampoVV1 := {} Private cCadastro := (STR0029+" - "+IIf(cTipo=="I",STR0045,IIf(cTipo=="A",STR0046,""))) //Cadastro de Veiculos # Incluir # Alterar Private aRotina := StaticCall(VEIXA010,MENUDEF) DbSelectArea("SX3") DbSetOrder(1) DbSeek("VV1") While !EOF() .And. (X3_ARQUIVO == "VV1") If X3USO(x3_usado) .and. cNivel>=x3_nivel .and. !x3_campo $ "VV1_NUMTRA/VV1_TRACPA" AADD(aCampoVV1,x3_campo) wVar := "M->"+x3_campo If x3_campo <> "VV1_CHAINT" &wVar:= CriaVar(x3_campo) Else &wVar:= Space(TamSx3("VV1_CHAINT")[1]) EndIf EndIf DbSkip() EndDo DbSelectArea("VV1") If cTipo == "I" If MsgYesNo(STR0047,STR0014) // Veiculo nao encontrado! Deseja cadastrar o veiculo? / Atencao AxInclui("VV1",0,3,aCampoVV1,,,"VEIVA600()") EndIf ElseIf cTipo == "A"
if ExistBlock("PEALTVEI") // Ponto de entrada para que o usuario possa customizar tela de alteração dos dados do veiculo. ExecBlock("PEALTVEI",.f.,.f.) Else aAltCampos[01] := VV1->VV1_PLAVEI aAltCampos[02] := VV1->VV1_PROATU aAltCampos[03] := VV1->VV1_LJPATU FS_VALTVEI("0") // carregar dados do cliente DEFINE MSDIALOG oFGXAltVei TITLE STR0048 From 00,00 to 17,50 of oMainWnd // Alterar Dados do Veiculo // @ 006,006 TO 113,192 LABEL "" OF oFGXAltVei PIXEL // @ 116,160 BUTTON oSair PROMPT STR0012 OF oFGXAltVei SIZE 32,10 PIXEL ACTION (oFGXAltVei:End()) // SAIR // @ 011,011 SAY STR0049 SIZE 80,08 OF oFGXAltVei PIXEL COLOR CLR_BLUE // Veiculo: @ 010,043 MSGET oModVei VAR (Alltrim(VV1->VV1_CODMAR)+" "+Alltrim(VV1->VV1_MODVEI)+" - "+Posicione("VV2",1,xFilial("VV2")+VV1->VV1_CODMAR+VV1->VV1_MODVEI,"VV2_DESMOD")) PICTURE "@!" SIZE 145,08 OF oFGXAltVei PIXEL COLOR CLR_BLACK WHEN .f. @ 022,011 SAY STR0050 SIZE 80,08 OF oFGXAltVei PIXEL COLOR CLR_BLUE // Cor: @ 021,043 MSGET oCorVei VAR (Alltrim(VV1->VV1_CORVEI)+" - "+Posicione("VVC",1,xFilial("VVC")+VV1->VV1_CODMAR+VV1->VV1_CORVEI,"VVC_DESCRI")) PICTURE "@!" SIZE 145,08 OF oFGXAltVei PIXEL COLOR CLR_BLACK WHEN .f. @ 033,011 SAY STR0015 SIZE 80,08 OF oFGXAltVei PIXEL COLOR CLR_BLUE // Chassi: @ 032,043 MSGET oChaVei VAR VV1->VV1_CHASSI PICTURE "@!" SIZE 145,08 OF oFGXAltVei PIXEL COLOR CLR_BLACK WHEN .f. @ 044,011 SAY STR0051 SIZE 80,08 OF oFGXAltVei PIXEL COLOR CLR_BLUE // Placa: @ 043,043 MSGET oPlaVei VAR aAltCampos[01] PICTURE VV1->(x3Picture("VV1_PLAVEI")) SIZE 40,08 OF oFGXAltVei PIXEL COLOR CLR_BLACK // @ 055,011 SAY STR0052 SIZE 80,08 OF oFGXAltVei PIXEL COLOR CLR_BLUE // Proprietario: @ 054,043 MSGET oCodCli VAR aAltCampos[02] PICTURE "@!" SIZE 33,08 F3 "SA1" VALID FS_VALTVEI("1") OF oFGXAltVei PIXEL COLOR CLR_BLACK @ 054,076 MSGET oLojCli VAR aAltCampos[03] PICTURE "@!" SIZE 15,08 VALID FS_VALTVEI("2") OF oFGXAltVei PIXEL COLOR CLR_BLACK @ 054,091 MSGET oNomCli VAR aAltCampos[04] PICTURE "@!" SIZE 97,08 OF oFGXAltVei PIXEL COLOR CLR_BLACK WHEN .f. @ 066,011 SAY STR0053 SIZE 80,08 OF oFGXAltVei PIXEL COLOR CLR_BLUE // Endereco: @ 065,043 MSGET oEndCli VAR aAltCampos[05] PICTURE "@!" SIZE 120,08 OF oFGXAltVei PIXEL COLOR CLR_BLACK WHEN .f. @ 065,163 MSGET oNroCli VAR aAltCampos[06] PICTURE "@!" SIZE 25,08 OF oFGXAltVei PIXEL COLOR CLR_BLACK WHEN .f. @ 076,043 MSGET oBaiCli VAR aAltCampos[07] PICTURE "@!" SIZE 108,08 OF oFGXAltVei PIXEL COLOR CLR_BLACK WHEN .f. @ 076,151 MSGET oCEPCli VAR aAltCampos[08] PICTURE SA1->(x3Picture("A1_CEP")) SIZE 35,08 OF oFGXAltVei PIXEL COLOR CLR_BLACK WHEN .f. @ 087,043 MSGET oMunCli VAR aAltCampos[09] PICTURE "@!" SIZE 120,08 OF oFGXAltVei PIXEL COLOR CLR_BLACK WHEN .f. @ 087,163 MSGET oEstCli VAR aAltCampos[10] PICTURE "@!" SIZE 25,08 OF oFGXAltVei PIXEL COLOR CLR_BLACK WHEN .f. // @ 099,011 SAY STR0054 SIZE 80,08 OF oFGXAltVei PIXEL COLOR CLR_BLUE // Telefone: @ 098,043 MSGET oDDDCli VAR aAltCampos[11] PICTURE "@!" SIZE 30,08 OF oFGXAltVei PIXEL COLOR CLR_BLACK @ 098,073 MSGET oTelCli VAR aAltCampos[12] PICTURE SA1->(x3Picture("A1_TEL")) SIZE 50,08 OF oFGXAltVei PIXEL COLOR CLR_BLACK // @ 116,007 BUTTON oSalvar PROMPT STR0056 OF oFGXAltVei SIZE 62,10 PIXEL ACTION IIf(FS_VALTVEI("3"),(nOk:=1,oFGXAltVei:End()),.t.) // Salvar Alteracoes @ 116,074 BUTTON oCadVei PROMPT STR0055 OF oFGXAltVei SIZE 81,10 PIXEL ACTION (nOk:=2,oFGXAltVei:End()) // Cad. Completo do Veiculo // ACTIVATE MSDIALOG oFGXAltVei CENTER If nOk == 1 // Salvar Alteracoes VV1->(RecLock("VV1",.f.)) VV1->VV1_PLAVEI := aAltCampos[1] VV1->VV1_PROATU := aAltCampos[2] VV1->VV1_LJPATU := aAltCampos[3] If ( aSlvCampos2[2]+aSlvCampos2[3] ) <> ( aAltCampos[2]+aAltCampos[3] ) // Mudou Cod.Cliente + LojaCliente If VV1->(FieldPos("VV1_BLQPRO")) > 0 VV1->VV1_BLQPRO := "0" // 0 = Veiculo NAO bloqueado para prospeccao EndIf EndIf MsUnLock() SA1->(DbSetOrder(1)) If SA1->(DbSeek(xFilial("SA1")+aAltCampos[2]+aAltCampos[3])) SA1->(RecLock("SA1",.f.)) SA1->A1_DDD := aAltCampos[11] // DDD SA1->A1_TEL := aAltCampos[12] // Telefone MsUnLock() EndIf ElseIf nOk == 2 // Cad. Completo do Veiculo AxAltera("VV1",VV1->(RecNo()),4,aCampoVV1,,,,"VEIVA600()") EndIf Endif EndIf If FindFunction("FM_VEIGAR") FM_VEIGAR() // Verifica se o Veiculo esta em garantia - 04/05/2009 - Andre Luis Almeida EndIf Return(.t.) |
Programa Fonte: | VEIXFUNA.PRW |
Função: | FGX_ALTVEI |
Retorno: | N/A |
Exemplo:
#INCLUDE "PROTHEUS.CH"
User Function PEALTVEI()
Local nOk := 0
Private aAltCampos := {"","","","","","","","","","","",""}
aAltCampos[01] := VV1->VV1_PLAVEI
aAltCampos[02] := VV1->VV1_PROATU
aAltCampos[03] := VV1->VV1_LJPATU
FS_VALTVEI("0") // carregar dados do cliente
DEFINE MSDIALOG oFGXAltVei TITLE "Alterar Dados do Veiculo" From 00,00 to 17,50 of oMainWnd
//
@ 006,006 TO 113,192 LABEL "" OF oFGXAltVei PIXEL
//
@ 116,160 BUTTON oSair PROMPT "SAIR" OF oFGXAltVei SIZE 32,10 PIXEL ACTION (oFGXAltVei:End())
//
@ 011,011 SAY "Veiculo:" SIZE 80,08 OF oFGXAltVei PIXEL COLOR CLR_BLUE
@ 010,043 MSGET oModVei VAR (Alltrim(VV1->VV1_CODMAR)+" "+Alltrim(VV1->VV1_MODVEI)+" - "+Posicione("VV2",1,xFilial("VV2")+VV1->VV1_CODMAR+VV1->VV1_MODVEI,"VV2_DESMOD")) PICTURE "@!" SIZE 145,08 OF oFGXAltVei PIXEL COLOR CLR_BLACK WHEN .f.
@ 022,011 SAY "Cor:" SIZE 80,08 OF oFGXAltVei PIXEL COLOR CLR_BLUE
@ 021,043 MSGET oCorVei VAR (Alltrim(VV1->VV1_CORVEI)+" - "+Posicione("VVC",1,xFilial("VVC")+VV1->VV1_CODMAR+VV1->VV1_CORVEI,"VVC_DESCRI")) PICTURE "@!" SIZE 145,08 OF oFGXAltVei PIXEL COLOR CLR_BLACK WHEN .f.
@ 033,011 SAY "Chassi:" SIZE 80,08 OF oFGXAltVei PIXEL COLOR CLR_BLUE
@ 032,043 MSGET oChaVei VAR VV1->VV1_CHASSI PICTURE "@!" SIZE 145,08 OF oFGXAltVei PIXEL COLOR CLR_BLACK WHEN .f.
@ 044,011 SAY "Placa:" SIZE 80,08 OF oFGXAltVei PIXEL COLOR CLR_BLUE
@ 043,043 MSGET oPlaVei VAR aAltCampos[01] PICTURE VV1->(x3Picture("VV1_PLAVEI")) SIZE 40,08 OF oFGXAltVei PIXEL COLOR CLR_BLACK
//
@ 055,011 SAY "Proprietário:" SIZE 80,08 OF oFGXAltVei PIXEL COLOR CLR_BLUE
@ 054,043 MSGET oCodCli VAR aAltCampos[02] PICTURE "@!" SIZE 33,08 F3 "SA1" VALID FS_VALTVEI("1") OF oFGXAltVei PIXEL COLOR CLR_BLACK
@ 054,076 MSGET oLojCli VAR aAltCampos[03] PICTURE "@!" SIZE 15,08 VALID FS_VALTVEI("2") OF oFGXAltVei PIXEL COLOR CLR_BLACK
@ 054,091 MSGET oNomCli VAR aAltCampos[04] PICTURE "@!" SIZE 97,08 OF oFGXAltVei PIXEL COLOR CLR_BLACK WHEN .f.
@ 066,011 SAY "Endereço:" SIZE 80,08 OF oFGXAltVei PIXEL COLOR CLR_BLUE
@ 065,043 MSGET oEndCli VAR aAltCampos[05] PICTURE "@!" SIZE 120,08 OF oFGXAltVei PIXEL COLOR CLR_BLACK WHEN .f.
@ 065,163 MSGET oNroCli VAR aAltCampos[06] PICTURE "@!" SIZE 25,08 OF oFGXAltVei PIXEL COLOR CLR_BLACK WHEN .f.
@ 076,043 MSGET oBaiCli VAR aAltCampos[07] PICTURE "@!" SIZE 108,08 OF oFGXAltVei PIXEL COLOR CLR_BLACK WHEN .f.
@ 076,151 MSGET oCEPCli VAR aAltCampos[08] PICTURE SA1->(x3Picture("A1_CEP")) SIZE 35,08 OF oFGXAltVei PIXEL COLOR CLR_BLACK WHEN .f.
@ 087,043 MSGET oMunCli VAR aAltCampos[09] PICTURE "@!" SIZE 120,08 OF oFGXAltVei PIXEL COLOR CLR_BLACK WHEN .f.
@ 087,163 MSGET oEstCli VAR aAltCampos[10] PICTURE "@!" SIZE 25,08 OF oFGXAltVei PIXEL COLOR CLR_BLACK WHEN .f.
//
@ 099,011 SAY "Telefone:" SIZE 80,08 OF oFGXAltVei PIXEL COLOR CLR_BLUE
@ 098,043 MSGET oDDDCli VAR aAltCampos[11] PICTURE "@!" SIZE 30,08 OF oFGXAltVei PIXEL COLOR CLR_BLACK
@ 098,073 MSGET oTelCli VAR aAltCampos[12] PICTURE SA1->(x3Picture("A1_TEL")) SIZE 50,08 OF oFGXAltVei PIXEL COLOR CLR_BLACK
//
@ 116,007 BUTTON oSalvar PROMPT "Salvar Alterações" OF oFGXAltVei SIZE 62,10 PIXEL ACTION IIf(FS_VALTVEI("3"),(nOk:=1,oFGXAltVei:End()),.t.)
@ 116,074 BUTTON oCadVei PROMPT "Cad. Completo do Veiculo" OF oFGXAltVei SIZE 81,10 PIXEL ACTION (nOk:=2,oFGXAltVei:End())
//
ACTIVATE MSDIALOG oFGXAltVei CENTER
If nOk == 1 // Salvar Alteracoes
VV1->(RecLock("VV1",.f.))
VV1->VV1_PLAVEI := aAltCampos[1]
VV1->VV1_PROATU := aAltCampos[2]
VV1->VV1_LJPATU := aAltCampos[3]
If ( aSlvCampos2[2]+aSlvCampos2[3] ) <> ( aAltCampos[2]+aAltCampos[3] ) // Mudou Cod.Cliente + LojaCliente
If VV1->(FieldPos("VV1_BLQPRO")) > 0
VV1->VV1_BLQPRO := "0" // 0 = Veiculo NAO bloqueado para prospeccao
EndIf
EndIf
MsUnLock()
SA1->(DbSetOrder(1))
If SA1->(DbSeek(xFilial("SA1")+aAltCampos[2]+aAltCampos[3]))
SA1->(RecLock("SA1",.f.))
SA1->A1_DDD := aAltCampos[11] // DDD
SA1->A1_TEL := aAltCampos[12] // Telefone
MsUnLock()
EndIf
ElseIf nOk == 2 // Cad. Completo do Veiculo
AxAltera("VV1",VV1->(RecNo()),4,aCampoVV1,,,,"VEIVA600()")
EndIf
Return
Static Function FS_VALTVEI(cTp)
Local lRet := .f.
Local cMsg := ""
If cTp $ "0/1/2"
SA1->(DbSetOrder(1))
If SA1->(DbSeek(xFilial("SA1")+aAltCampos[2]+Alltrim(aAltCampos[3])))
lRet := .t.
aAltCampos[3] := SA1->A1_LOJA
EndIf
If lRet // Cliente encontrado
aAltCampos[04] := SA1->A1_NOME
aAltCampos[05] := SA1->A1_END
If SA1->(FieldPos("A1_NUMERO")) > 0
aAltCampos[06] := SA1->A1_NUMERO
EndIf
aAltCampos[07] := SA1->A1_BAIRRO
aAltCampos[08] := SA1->A1_CEP
aAltCampos[09] := SA1->A1_MUN
aAltCampos[10] := SA1->A1_EST
aAltCampos[11] := SA1->A1_DDD
aAltCampos[12] := SA1->A1_TEL
Else // Limpar campos do Cliente
aAltCampos[04] := space(TamSx3("A1_NOME")[1])
aAltCampos[05] := space(TamSx3("A1_END")[1])
If SA1->(FieldPos("A1_NUMERO")) > 0
aAltCampos[06] := space(TamSx3("A1_NUMERO")[1])
EndIf
aAltCampos[07] := space(TamSx3("A1_BAIRRO")[1])
aAltCampos[08] := space(TamSx3("A1_CEP")[1])
aAltCampos[09] := space(TamSx3("A1_MUN")[1])
aAltCampos[10] := space(TamSx3("A1_EST")[1])
aAltCampos[11] := space(TamSx3("A1_DDD")[1])
aAltCampos[12] := space(TamSx3("A1_TEL")[1])
EndIf
If cTp == "0" // carregar dados do cliente ( inicial )
aSlvCampos := aClone(aAltCampos)
Else // cTp == "1" .or. cTp == "2" // validacoes ( codigo e loja do cliente )
oLojCli:Refresh()
oNomCli:Refresh()
oEndCli:Refresh()
oNroCli:Refresh()
oBaiCli:Refresh()
oCEPCli:Refresh()
oMunCli:Refresh()
oEstCli:Refresh()
oDDDCli:Refresh()
oTelCli:Refresh()
EndIf
Else // If cTp == "3" // Confirma Alteracoes?
If aAltCampos[01] <> aSlvCampos[01]
cMsg += CHR(13)+CHR(10)+" - "+"Placa do Veiculo"
EndIf
If aAltCampos[02] <> aSlvCampos[02]
cMsg += CHR(13)+CHR(10)+" - "+"Código do Proprietário"
EndIf
If aAltCampos[03] <> aSlvCampos[03]
cMsg += CHR(13)+CHR(10)+" - "+"Loja do Proprietário"
EndIf
If aAltCampos[11] <> aSlvCampos[11]
cMsg += CHR(13)+CHR(10)+" - "+"DDD do Telefone do Proprietário"
EndIf
If aAltCampos[12] <> aSlvCampos[12]
cMsg += CHR(13)+CHR(10)+" - "+"Telefone do Proprietário"
EndIf
If !Empty(cMsg)
If MsgYesNo("Confirma Alterações?"+cMsg,"Atenção")
lRet := .t.
EndIf
EndIf
EndIf
Return(lRet)