Histórico da Página
...
Bloco de código | ||||||
---|---|---|---|---|---|---|
| ||||||
#INCLUDE "PROTHEUS.CH"
User Function GFEA0717()
Local cCTEs := ""
Local aOldArea:= GetArea()
Local aRet := {.F.,''} //aRet[Bloqueio,Mensagem bloqueio]
Local _cParFil := GW6->GW6_FILIAL
Local _cEmiFat := GW6->GW6_EMIFAT
Local _cSerFat := GW6->GW6_SERFAT
Local _cNumFat := GW6->GW6_NRFAT
Local _dDtEmis := DTOS(GW6->GW6_DTEMIS)
cAliasGWU := GetNextAlias()
cQuery := " SELECT GWU.GWU_DTENT, GW3.GW3_NRDF, GW1.GW1_NRDC, GV5.GV5_SENTID, GW6.R_E_C_N_O_ AS GW6REG "
cQuery += " FROM " + RetSQLName("GW6") + " GW6, " + RetSQLName("GW3") + " GW3, "
cQuery += RetSQLName("GW4") + " GW4, " + RetSQLName("GW1") + " GW1, "
cQuery += RetSQLName("GWU") + " GWU, " + RetSQLName("GV5") + " GV5 "
cQuery += " WHERE "
cQuery += " GW6.GW6_FILIAL = GW3.GW3_FILFAT AND "
cQuery += " GW6.GW6_EMIFAT = GW3.GW3_EMIFAT AND "
cQuery += " GW6.GW6_SERFAT = GW3.GW3_SERFAT AND "
cQuery += " GW6.GW6_NRFAT = GW3.GW3_NRFAT AND "
cQuery += " GW6.GW6_DTEMIS = GW3.GW3_DTEMFA AND "
cQuery += " GW3.GW3_FILIAL = GW4.GW4_FILIAL AND "
cQuery += " GW3.GW3_EMISDF = GW4.GW4_EMISDF AND "
cQuery += " GW3.GW3_CDESP = GW4.GW4_CDESP AND "
cQuery += " GW3.GW3_SERDF = GW4.GW4_SERDF AND "
cQuery += " GW3.GW3_NRDF = GW4.GW4_NRDF AND "
cQuery += " GW4.GW4_FILIAL = GW1.GW1_FILIAL AND "
cQuery += " GW4.GW4_EMISDC = GW1.GW1_EMISDC AND "
cQuery += " GW4.GW4_SERDC = GW1.GW1_SERDC AND "
cQuery += " GW4.GW4_NRDC = GW1.GW1_NRDC AND "
cQuery += " GW4.GW4_TPDC = GW1.GW1_CDTPDC AND "
cQuery += " GWU.GWU_FILIAL = GW1.GW1_FILIAL AND "
cQuery += " GWU.GWU_CDTPDC = GW1.GW1_CDTPDC AND "
cQuery += " GWU.GWU_EMISDC = GW1.GW1_EMISDC AND "
cQuery += " GWU.GWU_SERDC = GW1.GW1_SERDC AND "
cQuery += " GWU.GWU_NRDC = GW1.GW1_NRDC AND "
cQuery += " GWU.GWU_CDTRP = GW6.GW6_EMIFAT AND "
cQuery += " GV5_CDTPDC = GW1_CDTPDC AND "
cQuery += " GW6.GW6_FILIAL = '" + _cParFil + "' AND "
cQuery += " GW6.GW6_EMIFAT = '" + _cEmiFat + "' AND "
cQuery += " GW6.GW6_SERFAT = '" + _cSerFat + "' AND "
cQuery += " GW6.GW6_NRFAT = '" + _cNumFat + "' AND "
cQuery += " GW6.GW6_DTEMIS = '" + _dDtEmis + "' AND "
cQuery += " (GW3.GW3_TPDF = '1' OR GW3.GW3_TPDF = '4') AND " //Normal e Reentrega
cQuery += " GW6.D_E_L_E_T_ = ' ' AND "
cQuery += " GW3.D_E_L_E_T_ = ' ' AND "
cQuery += " GW4.D_E_L_E_T_ = ' ' AND "
cQuery += " GW1.D_E_L_E_T_ = ' ' AND "
cQuery += " GWU.D_E_L_E_T_ = ' ' AND "
cQuery += " GV5.D_E_L_E_T_ = ' ' "
cQuery := ChangeQuery(cQuery)
cAliasGWU := GetNextAlias()
dbUseArea( .T., "TOPCONN", TCGENQRY(,,cQuery),cAliasGWU, .F., .T.)
dbSelectArea(cAliasGWU)
(cAliasGWU)->( dbGoTop() )
While !(cAliasGWU)->(Eof())
If (cAliasGWU)->GV5_SENTID == '2'
If Empty((cAliasGWU)->GWU_DTENT)
aRet[1] := .T.
If Empty(cCTEs)
cCTEs := AllTrim((cAliasGWU)->GW1_NRDC)
Else
If AT(cCTEs, (cAliasGWU)->GW1_NRDC) == 0 //Se não encontrar o Doc de Carga, adiciona.
cCTEs += ', ' + AllTrim((cAliasGWU)->GW1_NRDC)
EndIf
EndIf
EndIf
EndIf
(cAliasGWU)->(dbSkip())
EndDo
(cAliasGWU)->(dbCloseArea())
If aRet[1]
aRet[2] := "Documento(s) de Carga " + cCTEs + " não possui(em) entrega informada."
MsgInfo("Documento(s) de Carga " + cCTEs + " não possui(em) entrega informada.")
Else
EndIf
RestArea(aOldArea)
Return aRet |
...
Visão Geral
Import HTML Content
Conteúdo das Ferramentas
Tarefas