/**************************************************/ /* Ident.Regras: VEN 140NEITE01 */ /* Objetivo:Permitir a geração da tag */ /**************************************************/ Definir Numero VSIntCodEmp; Definir Numero VSIntCodFil; Definir Alfa VSIntCodSnf; Definir Numero VSIntNumNfv; Definir Numero VSIntSeqIpv; Definir Numero VSIntCodCli; Definir Alfa aCodPro; Definir Alfa aCodDer; Definir Numero nVlrBru; Definir Numero nQtdVen; Definir Alfa VSIntProUtr; @ infNFe - det - prod - uTrib @ Definir numero VSIntProQtr; @ infNFe - det - prod - qTrib @ Definir numero VSIntProVut; @ infNFe - det - prod - vUnTrib @ Definir Cursor CUR_UTRIB_E085CLI; Definir Cursor CUR_UTRIB_E140IPV; Definir Cursor CUR_UTRIB_E075DER; CUR_UTRIB_E085CLI.Sql "SELECT SigUfs FROM E085CLI \ WHERE CodCli = :VSIntCodCli"; CUR_UTRIB_E085CLI.AbrirCursor(); Se (CUR_UTRIB_E085CLI.Achou) Inicio Se (CUR_UTRIB_E085CLI.SigUfs = "EX") Inicio CUR_UTRIB_E140IPV.Sql "SELECT CodPro, CodDer, VlrBru, QtdVen FROM E140IPV \ WHERE CodEmp = :VSIntCodEmp \ AND CodFil = :VSIntCodFil \ AND CodSnf = :VSIntCodSNf \ AND NumNfv = :VSIntNumNfv \ AND SeqIpv = :VSIntSeqIpv"; CUR_UTRIB_E140IPV.AbrirCursor(); Se (CUR_UTRIB_E140IPV.Achou) Inicio aCodPro = CUR_UTRIB_E140IPV.CodPro; aCodDer = CUR_UTRIB_E140IPV.CodDer; nVlrBru = CUR_UTRIB_E140IPV.VlrBru; nQtdVen = CUR_UTRIB_E140IPV.QtdVen; Fim; CUR_UTRIB_E140IPV.FecharCursor(); CUR_UTRIB_E075DER.Sql "SELECT E075DER.USU_UniFis, E075DER.USU_ValCuf \ FROM E075DER \ WHERE CodEmp = :VSIntCodEmp \ AND CodPro = :aCodPro \ AND CodDer = :aCodDer"; CUR_UTRIB_E075DER.AbrirCursor(); Se (CUR_UTRIB_E075DER.Achou) Inicio VSIntProUtr = CUR_UTRIB_E075DER.USU_UniFis; VSIntProQtr = nQtdVen * CUR_UTRIB_E075DER.USU_ValCuf; VSIntProVut = nVlrBru / VSIntProQtr; Fim; CUR_UTRIB_E075DER.FecharCursor(); CUR_UTRIB_E085CLI.FecharCursor(); Fim; Fim;