123456789101112131415161718192021222324252627282930313233343536373839 |
- //-----------------------------------------
- // Função ORCA1034. Buscar % de Frete. SZ3
- // Solicitante: Comercial.
- // Autor: Fonseca.
- // Data: 03-09-2014.
- //-----------------------------------------
- #include 'protheus.ch'
- #include 'rwmake.ch'
- #include 'totvs.ch'
- #include "Topconn.ch"
- User Function ORCA1034()
- Local aArea := GetArea()
-
- If Funname() = "RPC" //Portal SMS
- Return
- Endif
-
- If Select("QRY") > 0
- dbSelectArea("QRY")
- QRY->(dbCloseArea())
- Endif
- cQuery := "SELECT * FROM " + RetSQLName("SZ3") + " WHERE D_E_L_E_T_ = ' ' AND "
- // cQuery += "Z3_FILIAL = '" + xFilial("SZ3") + "' AND D_E_L_E_T_ = ' ' AND "
- cQuery += "Z3_UF = '" + Substr(CJ_UFEnt,1,2) + "' ORDER BY Z3_MUNICIP"
- TcQuery cQuery New Alias "QRY"
-
- CJ_PERCFRT := QRY->Z3_PERFRAD
-
- While QRY->(!EOF())
- If Trim(QRY->Z3_MUNICIP) == Substr(CJ_UFEnt,3,5)
- CJ_PERCFRT := QRY->Z3_PERFRAD
- EndIf
- QRY->(DbSkip())
- EndDo
-
- RestArea(aArea)
- Return(CJ_PERCFRT)
|