#INCLUDE "Protheus.ch"
User Function AF060CAC()
Local cLogErro := ""
Local cQuery := ""
Local oTable
cQuery := "SELECT "
cQuery += " N1_CBASE, N1_ITEM, N1_QUANTD "
cQuery += "FROM "
cQuery += " " + "FNR-GRUPO CLIENTE" + " FNR "
cQuery += "INNER JOIN "
cQuery += " " + "SN1-GRUPOCLIENTE "+ "SN1 "
cQuery += "ON "
cQuery += " FNR_CBAORI = N1_CBASE "
cQuery += " AND FNR_ITEORI = N1_ITEM "
cQuery += " AND SN1.D_E_L_E_T_ = '' "
cQuery += "WHERE "
cQuery += " FNR.D_E_L_E_T_ = '' "
cQuery += " AND FNR_IDMOV = '12S" + ParamIxb[1] + "' "
oTable := ATFTempTable(cQuery,"TMP")
If ( (oTable:GetAlias())->(!Eof()) )
Begin Transaction
RecLock(oTable:GetAlias(),.F.)
(oTable:GetAlias())->N1_CBASE := "01TESTE"
(oTable:GetAlias())->(MsUnlock())
End Transaction
Else
cLogErro := "Neste Ponto de Entrada - AF060CAC - não foi localizado o bem. Reveja a codificação do PE."
EndIf
oTable:Delete()
Return (cLogErro) |