123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235 |
- User Function ViewPed()
- Local cHtml
- Local cItem := ""
- Local nLin := 0
- Local nPosFrete:= 0
- Local lMoeda := .F.
- Local lNumber := .F.
- Local aTpFrete := {}
- Private cDirPortal := ""
- Private cEndServ := ""
- Private cPVCabec := ""
- Private cPVItens := ""
- Private cNFSerie := ""
- Private cBotoes := ""
- Private cTpFrete := ""
- Private cValFre := ""
- Private cTransp := ""
- Private cCliente := ""
- Private cEntrega := ""
- Private cBtnItens := ""
- Private cObsNota := ""
- Private cChaveNF := ""
- Private cEmissao := ""
- Private nTVlrUnit := 0
- Private nTTotal := 0
- Private nTImpostos := 0
- Private nTFrete := 0
- Private nItens := 0
-
- Private cSite := "u_PortalLogin.apw"
- Private cPagina := "Pedido"
- Private cMenus := ""
- Private cFooter := ""
- Private cTitle := ""
- Private cAnexos := ""
- Private aItens := {}
- Private cCodLogin := ""
- Private cLoginGet := ""
-
- Web Extended Init cHtml Start U_inSite(empty(cLoginGet))
-
- cVendLogin := u_GetUsrPR()
- cCodLogin := U_SetParPR(cVendLogin)
- If Empty(HttpSession->CodVend)
- cHtml:= '<META HTTP-EQUIV="Refresh" CONTENT="0 ; URL='+cSite+'">'
- Return cHtml
- Else
- If !Empty(HttpSession->Superv) .and. HttpSession->Superv <> HttpSession->CodVend
- HttpSession->CodVend:= HttpSession->Superv
- Endif
- Endif
-
-
- cTitle := SuperGetMV("PS_TITLE", .T., "Portal SMS")
-
-
- cSite := "u_SMSPortal.apw?PR="+cCodLogin
-
-
- cHeader := U_PSHeader(cTitle, cSite)
-
-
- cMenus := U_GetMenus(AllTrim(Upper(Procname())), cLoginGet)
-
-
-
-
-
- cEndServ := GetMv('MV_WFBRWSR')
- cItem := StrZero(1,TamSX3("C6_ITEM")[1])
- nRecSC5 := val(HttpGet->rec)
-
-
-
- If !Empty(nRecSC5)
- dbSelectArea("SC5")
- SC5->(dbGoTo(nRecSC5))
-
-
- u_PTChgFil(SC5->C5_FILIAL)
-
- dbSelectArea("SC5")
- SC5->(dbGoTo(nRecSC5))
-
- dbSelectArea("SC6")
- SC6->(dbSeek(xFilial("SC6")+SC5->C5_NUM))
- Endif
-
- cPVSerie:= SC5->C5_NUM
-
- cEmissao:= dtoc(SC5->C5_EMISSAO)
-
-
- cObsNota:= SC5->C5_MENNOTA
-
-
-
- aItens := { {"Produto","C6_PRODUTO","500px","left","C",.F.,.T.,.F.,"Selecione..."},;
- {"UM","C6_UM","*","right","C",.F.,.F.,.F.,""},;
- {"Quantidade","C6_QTDVEN","*","right","N",.F.,.T.,.F.,"0"},;
- {"Previsão Entrega","C6_ENTREG","*","left","C",.F.,.F.,.F.,""},;
- {"V.Unitário","C6_PRCVEN","*","","N",.F.,.F.,.T.,"0,00000"},;
- {"Total","C6_VALOR","*","right","N",.F.,.F.,.T.,"0,00"}}
-
-
-
- For nLin := 1 to Len(aItens)
- cPVCabec += '<th'+Iif(aItens[nLin,2] == "C6_PRODUTO",' width="'+aItens[nLin,3]+'"','')+'>'+aItens[nLin][1]+'</th>'
- Next
-
-
- aTpFrete:= {{"S","Sem Frete"},{"C","CIF"},{"F","FOB"}}
- cTpFrete:='<select class="form-control mb-md" name="C5_TPFRETE" id="C5_TPFRETE" value="'+SC5->C5_TPFRETE+'" disabled>'
- nPosFrete:= aScan(aTpFrete,{|x|x[1]==SC5->C5_TPFRETE})
- If nPosFrete = 0
- nPosFrete:= 1
- Endif
- cTpFrete+=' <option value="'+SC5->C5_TPFRETE+'">'+aTpFrete[nPosFrete,2]+'</option>'
-
- cTpFrete+='</select>'
-
- cValFre:= Transform(SC5->C5_FRETE,"@E 999,999,999.99")
-
-
-
- cTransp:= SC5->C5_TRANSP+' - '+Alltrim(Posicione("SA4",1,xFilial("SA4")+SC5->C5_TRANSP,"A4_NREDUZ"))
-
-
- cCondPag:='<select class="form-control mb-md" name="C5_COND" id="C5_COND" required="" aria-required="true" disabled>'
- cCondPag+=' <option value="'+SC5->C5_CONDPAG+'">'+SC5->C5_CONDPAG+" - "+Posicione("SE4",1,xFilial("SE4")+SC5->C5_CONDPAG,"E4_DESCRI")+'</option>'
- cCondPag+='</select>'
-
-
- cCliente:='<select data-plugin-selectTwo class="form-control populate placeholder" data-plugin-options='+"'"
- cCliente+='{ "placeholder": "Selecione um Cliente", "allowClear": false }'+"'"+' name="C5_CLIENTE" id="C5_CLIENTE" '
- cCliente+=' disabled >'
- cCliente+=' <option value='+SC5->C5_CLIENTE+SC5->C5_LOJACLI+'>'+SC5->C5_CLIENTE+'/'+SC5->C5_LOJACLI+' - '+Alltrim(Posicione("SA1",1,xFilial("SA1")+SC5->C5_CLIENTE+SC5->C5_LOJACLI,"A1_NOME"))+'</option>'
- cCliente+='</select>'
-
-
-
-
- nTFrete:= SC5->C5_FRETE
- nTTotal:= SC5->C5_FRETE
- dbSelectArea("SC6")
- SC6->(dbSetOrder(1))
- SC6->(dbSeek(xFilial("SC6")+SC5->C5_NUM))
- While SC6->(!Eof()) .and. SC6->C6_NUM = SC5->C5_NUM .AND. SC6->C6_SERIE = SC5->C5_SERIE
- nItens++
- Posicione("SB1",1,xFilial("SB1")+SC6->C6_PRODUTO,"B1_DESC")
- cPVItens += '<tr class="odd" id="linha'+StrZero(nItens,2)+'">'
-
-
- nTVlrUnit += SC6->C6_QTDVEN * SC6->C6_PRCVEN
- nTTotal+= SC6->C6_VALOR
- For nLin := 1 to Len(aItens)
-
- cPVItens += '<td'+Iif(!Empty(aItens[nLin][4]),' align="'+aItens[nLin][4]+'"',"")+'>'
-
- lMoeda:= aItens[nLin,8]
- lNumber:= aItens[nLin,5] = "N"
- xValue:= ""
- Do Case
- Case aItens[nLin][5] == 'C'
- If aItens[nLin,2] == "C6_PRODUTO"
- xValue := AllTrim(SC6->&(aItens[nLin][2]))+" - "+Alltrim(SB1->B1_DESC)
- Elseif aItens[nLin,2] == "C6_ENTREG"
- xValue := dtoc(SC6->&(aItens[nLin][2]))
- Else
- xValue := AllTrim(SC6->&(aItens[nLin][2]))
- Endif
- Case aItens[nLin][5] == 'N'
- If aItens[nLin,2] == "C6_QTDVEN"
- xValue := Alltrim(PadR(TransForm(SC6->&(aItens[nLin][2]),"@E 999,999,999"),14))
- Else
- xValue := Alltrim(PadR(TransForm(SC6->&(aItens[nLin][2]),"@E 999,999,999.99"),14))
- Endif
- EndCase
-
- cPVItens += '<input id="'+aItens[nLin][2]+cItem+'" data-prop="'+aItens[nLin][2]+'" name="'+aItens[nLin][2]+cItem+'" class="form-control input-block" type="text" disabled width="" '
- cPVItens += 'value="'+Alltrim(xValue)+'" title="'+Alltrim(xValue)+'">'
- cPVItens += '</td>'
- Next
-
- cPVItens += '</tr>'
- SC6->(dbSkip())
- End
-
-
- cBotoes+='<input class="btn btn-primary" type="button" id="btVoltar" name="btVoltar" value="Voltar" onclick="javascript: location.href='+"'"+'u_pedidos.apw?PR='+cCodLogin+"';"+'"/>'+chr(13)+chr(10)
-
-
- cHtml := H_ViewPed()
-
- Web Extended End
- Return (cHTML)
|