Histórico da Página
...
Bloco de código | ||||||
---|---|---|---|---|---|---|
| ||||||
#Include 'Protheus.ch' User Function GFEXFB13() local; local nValorComp := 0,; local nValorTaxa := 0,; cNrReg,; aAreaAnt local cNrReg local aAreaAnt := getArea() GFEXFB_1AREA(lTabTemp,cTRBTCF, @aTRBTCF1) //dbSelectArea(cTRBTCF) GFEXFB_2TOP(lTabTemp, cTRBTCF, @aTRBTCF1, 5) //dbGoTop() // Posiciona na 1a rota para selecao GFEXFB_BORDER(lTabTemp,cTRBTCF,01,5) //dbSetOrder(1) While !GFEXFB_3EOF(lTabTemp, cTRBTCF, @aTRBTCF1, 5) //percorre os componentes do calculo de frete relacionada nValorComp := 0 nValorTaxa := 0 GFEXFB_1AREA(lTabTemp,cTRBCCF, @aTRBCCF1) //dbSelectArea(cTRBCCF) GFEXFB_BORDER(lTabTemp,cTRBCCF,01,9) //dbSetOrder(01) GFEXFB_CSEEK(lTabTemp, cTRBCCF, @aTRBCCF1, 9,{GFEXFB_5CMP(lTabTemp, cTRBTCF, @aTRBTCF1, 5,"NRCALC")}) //dbSeek(,.T.) While !GFEXFB_3EOF(lTabTemp, cTRBCCF, @aTRBCCF1, 9) .AND. ; GFEXFB_5CMP(lTabTemp, cTRBCCF, @aTRBCCF1, 9,"NRCALC") == GFEXFB_5CMP(lTabTemp, cTRBTCF, @aTRBTCF1, 5,"NRCALC") if alltrim(GFEXFB_5CMP(lTabTemp, cTRBCCF, @aTRBCCF1, 9,"CDCOMP")) <> 'TAXA DE ENTREGA' .And. ; alltrim(GFEXFB_5CMP(lTabTemp, cTRBCCF, @aTRBCCF1, 9,"CDCOMP")) <> 'PEDÁGIO' nValorComp += GFEXFB_5CMP(lTabTemp, cTRBCCF, @aTRBCCF1, 9,"VALOR") EndIf EndIf GFEXFB_1AREA(lTabTemp,cTRBCCF, @aTRBCCF1) //dbSelectArea(cTRBCCF) GFEXFB_8SKIP(lTabTemp, cTRBCCF, 9) //dbSkip() EndDo EndDo dbSelectArea("GV8") if GV8->(dbSetOrder(1)) if GV8->(dbSeek(xFilial("GV8") + GFEXFB_5CMP(lTabTemp, cTRBTCF, @aTRBTCF1, 5,"CDTRP") + ; GFEXFB_5CMP(lTabTemp, cTRBTCF, @aTRBTCF1, 5,"NRTAB") + ; GFEXFB_5CMP(lTabTemp, cTRBTCF, @aTRBTCF1, 5,"NRNEG") + ; GFEXFB_5CMP(lTabTemp, cTRBTCF, @aTRBTCF1, 5,"NRROTA") )) cNrReg := "" If GV8->GV8_TPORIG != "2" If GV8->GV8_TPDEST == "3" // Busca tabela com região destino cNrReg := GV8->GV8_NRREDS dbSelectArea("GU9") dbSetOrder(1) GV9->(dbSetOrder(1)) if GU9->(dbSeek(xFilial("GU9") + cNrReg)) // Se a classif. Frete do documento igual a classif. da região if alltrim(GFEXFB_5CMP(lTabTemp, cTRBTCF, @aTRBTCF1, 5,"CDCLFR")) == alltrim(GU9->GU9_XCLFR) nValorTaxa := (nValorComp * (GU9->GU9_PENT / 100)) endif endif endif EndIf endif endif endif endif EndIf endif //Busca o componente Taxa de Entrega e gravo na, tabela temporária, o valor da taxa calculado anteriormente If nValorTaxa > 0 GFEXFB_1AREA(lTabTemp,cTRBCCF, @aTRBCCF1) //dbSelectArea(cTRBCCF) GFEXFB_BORDER(lTabTemp,cTRBCCF,01,9) //dbSetOrder(01) GFEXFB_CSEEK(lTabTemp, cTRBCCF, @aTRBCCF1, 9,{GFEXFB_5CMP(lTabTemp, cTRBTCF, @aTRBTCF1, 5,"NRCALC")}) //dbSeek(,.T.) While !GFEXFB_3EOF(lTabTemp, cTRBCCF, @aTRBCCF1, 9) .AND. ; GFEXFB_5CMP(lTabTemp, cTRBCCF, @aTRBCCF1, 9,"NRCALC") == GFEXFB_5CMP(lTabTemp, cTRBTCF, @aTRBTCF1, 5,"NRCALC") if alltrim(GFEXFB_5CMP(lTabTemp, cTRBCCF, @aTRBCCF1, 9,"CDCOMP")) == 'TAXA DE ENTREGA' GFEXFB_DRECLOCK(lTabTemp,cTRBCCF,.F.) //RecLock(cTRBTRE,.F.) GFEXFB_5CMP(lTabTemp, cTRBCCF, @aTRBCCF1, 9,"VALOR",nValorTaxa) GFEXFB_EMSUNLOCK(lTabTemp,cTRBCCF) //(cTRBTRE)->(MsUnLock()) EndIf EndIf GFEXFB_1AREA(lTabTemp,cTRBCCF, @aTRBCCF1) //dbSelectArea(cTRBCCF) GFEXFB_8SKIP(lTabTemp, cTRBCCF, 9) //dbSkip() EndDo EndIf EndDo EndIf GFEXFB_8SKIP(lTabTemp, cTRBTCF, 5) //dbSkip() enddo enddo restArea(aAreaAnt) Return |
Visão Geral
Import HTML Content
Conteúdo das Ferramentas
Tarefas