<% '-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# ' Loja Exemplo Locaweb ' Versão: 6.5 ' Data: 12/09/06 ' Arquivo: lista_pedidos.asp ' Versão do arquivo: 0.0 ' Data da ultima atualização: 03/02/2009 ' '----------------------------------------------------------------------------- ' Licença Código Livre: http://comercio.Locaweb.com.br/gpl/gpl.txt '-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#- Function FormataValorUs(total_valor) total_str = FormatNumber(total_valor,2,-1,0,0) total_str = cstr(total_valor) total = replace(total_str, ",", ".") FormataValorUs = total End Function If permissao = "write" Then estilo = "itensPedido_write" ElseIf permissao = "read" Then estilo = "itensPedido_read" End if Set RS_Cambios = CreateObject("ADODB.Recordset") Set RS_Cambios.ActiveConnection = Conexao RS_Cambios.CursorLocation = 3 RS_Cambios.CursorType = 0 RS_Cambios.LockType = 1 RS_Cambios.Open "SELECT valor_moeda, simbolo_moeda FROM IdiomaseCambios WHERE sigla_idioma='"&varLang&"'", Conexao varValor_Cambio = RS_Cambios("valor_moeda") VarSimboloMoeda = RS_Cambios("simbolo_moeda") RS_Cambios.Close Set RS_Cambios = Nothing 'Atualiza a forma de pagamento no XML do pedido If Request("id_transacao") <> "" And Request("tipo") <> "" Then If Request("id_transacao") <> "" Then session("id_transacao") = Request("id_transacao") End if set docxml=server.createobject("microsoft.xmldom") existe_pedidoTemp = docxml.load(Application("DiretorioPedidos")&session("id_transacao")&".xml") If existe_pedidoTemp=true then docxml.load(Application("DiretorioPedidos")&session("id_transacao")&".xml") set pedido=docxml.documentElement Set dados_pedido = pedido.SelectSingleNode("dados_pedido") Set objAtualizaPedido = pedido.selectSingleNode("dados_pedido[@id_transacao="&session("id_transacao")&"]") dados_pedido.SetAttribute "forma_pagamento",request("tipo") If request("tipo") = "Boleto" Then dados_pedido.SetAttribute "BoletoTipo",request("BoletoTipo") End if docxml.save(Application("DiretorioPedidos")&session("id_transacao")&".xml") Else Response.redirect "default.asp?lang="&varLang End if set docxml = Nothing End If 'Ajusta a URL da loja para uso If Session("URLloja") <> "" Then varURLloja = Session("URLloja") & "/" End If %> "> "> <% if (navegacaocompra = "fim" AND page = "recibo" AND passo=4) then cidade = "" estado = "" pais = "" Set RS_Usuarios = Server.CreateObject("ADODB.Recordset") Set RS_Usuarios.ActiveConnection = Conexao RS_Usuarios.CursorLocation = 3 RS_Usuarios.CursorType = 0 RS_Usuarios.LockType = 1 RS_Usuarios.Open "SELECT cidade_cobranca, estado_cobranca, pais_cobranca FROM Usuarios WHERE user_id ='" & session("user_id") & "'", Conexao ' Encontramos usuario ? If Not RS_Usuarios.Eof Then cidade = RS_Usuarios("cidade_cobranca") estado = RS_Usuarios("estado_cobranca") pais = RS_Usuarios("pais_cobranca") End If RS_Usuarios.Close Set RS_Usuarios = Nothing javascriptTrans = " pageTracker._addTrans("""&session("id_transacao")&""", ""Para Empresas"", """&FormataValorUs(raiz_dados_pedido.getAttribute("valor_subtotal"))&""", """&FormataValorUs(varTaxaAdicional)&""", """&FormataValorUs(raiz_dados_pedido.getAttribute("valor_frete"))&""", """&cidade&""", """&estado&""", """&pais&""" ); " & javascriptTrans End If If raiz_dados_pedido.getAttribute("forma_pagamento") <> "0" Then %> <% End if %> <%If navegacaocompra = "fim" and request("tipo_acesso") = "" AND (page = "autentica" Or page = "check_usuario" Or page = "confirmacao") Then%> <% End If %>
<%=Application("middleTxtTitItensPedidos")%>
<%If VerificaExistenciaDado("codigo_cor","Cores",VAZIO,VAZIO) Then%> <%End if%> <%If VerificaExistenciaDado("codigo_tamanho","Tamanhos",VAZIO,VAZIO) Then%> <%End if%> <%If permissao = "write" Then%> <%End if%> <% Call abre_xmlpedido(session("id_transacao"), objXML, objRoot) Set raiz_dados_pedido = objRoot.selectSingleNode("dados_pedido[@id_transacao="&session("id_transacao")&"]") Set states = objXML.getElementsByTagName("dados_pedido[@id_transacao="&session("id_transacao")&"]/produto") n_states = states.length javascriptTrans = "" for i = 0 to (n_states - 1) Set pagto = states.item(i) ArrCodigo_produto = ArrCodigo_produto & pagto.getAttribute("codigo_produto") & "," ArrQuantidade_produtoVazio = ArrQuantidade_produtoVazio & "0" & "," vSplitCodPed = Split(pagto.getAttribute("codigo_produto"),"_") %> <%If VerificaExistenciaDado("codigo_cor","Cores",VAZIO,VAZIO) Then %> <%End if%> <%If VerificaExistenciaDado("codigo_tamanho","Tamanhos",VAZIO,VAZIO) Then %> <%End if%> <%If permissao = "write" Then If pegaValorAtrib(Application("XMLArquivoConfiguracao"),"dados/configuracao_dados","Estoque") = "sim" Then %> ">"> <%End if%> <%End if%> <% if (navegacaocompra = "fim" AND page = "recibo" AND passo=4) then javascriptTrans = javascriptTrans & " pageTracker._addItem("""&session("id_transacao")&""",""brinde_"&vSplitCodPed(0)&""","""&pagto.getAttribute("nome_produto")&""",""Brindes para empresas"","""&FormataValorUs(pagto.getAttribute("preco_unitario")/10)&""","""&(10*pagto.getAttribute("quantidade_produto"))&"""); " End If %> <% Set pagto = Nothing next Set states = Nothing Session("pais_frete") = raiz_dados_pedido.getAttribute("pais_frete") Session("cep_frete") = raiz_dados_pedido.getAttribute("cep_frete") Session("opcao_frete") = raiz_dados_pedido.getAttribute("opcao_frete") Session("valor_frete") = raiz_dados_pedido.getAttribute("valor_frete") Session("volumecub_total") = raiz_dados_pedido.getAttribute("volumecub_total") Session("peso_total") = raiz_dados_pedido.getAttribute("peso_total") ' Verifica se é uma ação inicial de pedido If Usuario_Valido = "2" And Request.form("user_id") <> "" And Session("novoPedido") <> "yes" Then raiz_dados_pedido.SetAttribute "logado",1 raiz_dados_pedido.SetAttribute "user_id",Request.form("user_id") session("user_id") = Request.form("user_id") session("logado") = "yes" objXML.save (Application("DiretorioPedidos")&session("id_transacao")&".xml") ' Verifica se é uma nova tentativa de um pedido ElseIf Usuario_Valido = "2" And Session("novoPedido") = "yes" Then raiz_dados_pedido.SetAttribute "logado",1 raiz_dados_pedido.SetAttribute "user_id",Session("user_id") session("logado") = "yes" objXML.save (Application("DiretorioPedidos")&session("id_transacao")&".xml") End If If raiz_dados_pedido.getAttribute("forma_pagamento") <> "0" Then Session("forma_pagamento") = raiz_dados_pedido.getAttribute("forma_pagamento") End If '------------------------------------ If request("tipo") <> "" And page <> "autentica" Then If Request("id_transacao") <> "" Then session("id_transacao") = Request("id_transacao") End if set docxml=server.createobject("microsoft.xmldom") existe_pedidoTemp = docxml.load(Application("DiretorioPedidos")&session("id_transacao")&".xml") If existe_pedidoTemp=true then docxml.load(Application("DiretorioPedidos")&session("id_transacao")&".xml") set pedido=docxml.documentElement Set dados_pedido = pedido.SelectSingleNode("dados_pedido") Set objAtualizaPedido = pedido.selectSingleNode("dados_pedido[@id_transacao="&session("id_transacao")&"]") dados_pedido.SetAttribute "forma_pagamento",request("tipo") docxml.save(Application("DiretorioPedidos")&session("id_transacao")&".xml") Else Response.redirect "default.asp?lang="&varLang End if set docxml = Nothing End if '------------------------------------ volumecubfrete = raiz_dados_pedido.getAttribute("volumecub_total") pesofrete = raiz_dados_pedido.getAttribute("peso_total") Call fecha_xmlpedido(session("id_transacao")) If raiz_dados_pedido.getAttribute("valor_subtotal") = "0,00" Or raiz_dados_pedido.getAttribute("valor_subtotal") = "0" Then Response.redirect "carrinho_vazio.asp?lang="& varLang End If 'Exibe o botão de excluir todos os produdos do carrinho de compras. If permissao = "write" Then 'Será utilizado no controle de estoque ativo, estamos finalizando a integração. ArrCodigo_produto = Mid(ArrCodigo_produto,1,Len(ArrCodigo_produto)-1) ArrQuantidade_produtoVazio = Mid(ArrQuantidade_produtoVazio,1,Len(ArrQuantidade_produtoVazio)-1) 'Define o número de agrupamento de celulas (td) conforme a existência de CORES e TAMANHOS cadastrados ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' 'Verifica se existe cores cadastrados varColspan = 4 If Pega_Cor(vazio) = Empty Then TemCor = 0 Else TemCor = 1 End If 'Verifica se existe tamanhos cadastrados If Pega_tamanho(vazio) = Empty Then TemTamanho = 0 Else TemTamanho = 1 End If TemFinal = TemCor + TemTamanho Select Case TemFinal Case 0 varColspan = "4" Case 1 varColspan = "5" Case 2 varColspan = "6" End Select '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' 'Fim da definição %> <%End if%>
<%=Application("middleTxtTitCodigo")%><%=Application("MiddleTxtTitCor")%><%=Application("MiddleTxtTitTamanho")%><%=Application("middleTxtTitNomeProduto")%> <%=Application("middleTxtTitVlrUnitario")%> <%=Application("middleTxtTitQuantidade")%><%=Application("middleTxtTitExcluir")%><%=Application("middleTxtTitTotal")%>
"><%=vSplitCodPed(0)%><%If pagto.getAttribute("codigo_cor") <> "0" Then%><%=Pega_Cor(pagto.getAttribute("codigo_cor"))%><%End if%><%If pagto.getAttribute("codigo_tamanho") <> "" Then%><%=Pega_Tamanho(pagto.getAttribute("codigo_tamanho"))%><%End if%><%=pagto.getAttribute("nome_produto")%> <%=VarSimboloMoeda%> <%=FormatNumber(pagto.getAttribute("preco_unitario")*FatorCambio(varValor_Cambio))%> <%If permissao = "write" Then%>" SIZE="5" CLASS="FORMbox" onKeyUp='this.value=this.value.replace(/[^\d]*/gi,"");'><%Else%><%=pagto.getAttribute("quantidade_produto")%><%End if%>&quantidade_produto=<%=pagto.getAttribute("quantidade_produto")%>"><%=VarSimboloMoeda%> <%=FormatNumber(pagto.getAttribute("total_parcial")*FatorCambio(varValor_Cambio))%>
<%= Application("MiddleTxtExcluirProd")%> >> <%If pegaValorAtrib(Application("XMLArquivoConfiguracao"),"dados/configuracao_dados","Estoque") = "sim" Then%><%Else%><%End if%>Exluir todos os produtos  
<%If permissao = "write" Then%> <%End if%>
  <%If pegaValorAtrib(Application("XMLArquivoConfiguracao"),"dados/configuracao_dados","Estoque") = "sim" Then%><%Else%><%End If%> <% ' Resgata os dados da taxa adicional taxa_adicional = raiz_dados_pedido.getAttribute("taxa_adicional") tipo_taxa_adicional = raiz_dados_pedido.getAttribute("tipo_taxa_adicional") ' Verifica se há taxa adicional If taxa_adicional <> "" And taxa_adicional <> 0 Then ' Monta o total parcial varTotalParcial = FormatNumber(CDbl(raiz_dados_pedido.getAttribute("valor_subtotal")) + CDbl(raiz_dados_pedido.getAttribute("valor_frete"))) varTotalPedido = raiz_dados_pedido.getAttribute("valor_total") ' Verifica o tipo de taxa If tipo_taxa_adicional = "Desconto" Then ' Desconto varTipoTaxaAdicional = Application("MiddleTxtDesconto") varTaxaAdicional = (varTotalParcial - varTotalPedido) ElseIf tipo_taxa_adicional = "Com juros" Then ' Juros Lojista varTipoTaxaAdicional = Application("MiddleTxtAcrescimo") varTaxaAdicional = (varTotalPedido - varTotalParcial) End If ' Verifica se foi montado a exibição da taxa adicional If varTipoTaxaAdicional <> "" And varTaxaAdicional <> "" Then %> <% End If End If %> <% ' Verifica se há taxa adicional no pedido If raiz_dados_pedido.getAttribute("tipo_taxa_adicional") <> "" Then ' Verifica o tipo de taxa adicionado If raiz_dados_pedido.getAttribute("tipo_taxa_adicional") = "Desconto" Then ' Desconto sAdicionalInformativo = "* " & Application("MiddleTxtDescDe") & " " & raiz_dados_pedido.getAttribute("taxa_adicional") & "%" ElseIf raiz_dados_pedido.getAttribute("tipo_taxa_adicional") = "Com juros" Then ' Juros sAdicionalInformativo = "* " & Application("MiddleTxtJurosDe") & " " & raiz_dados_pedido.getAttribute("taxa_adicional") & "%" End If ' verifica se houve montagem do texto adicional informativo If sAdicionalInformativo <> "" Then %> <% End If End If %>
<%=Application("middleTxtSubtotal")%>: <%=VarSimboloMoeda%> <%=FormatNumber(raiz_dados_pedido.getAttribute("valor_subtotal")*FatorCambio(varValor_Cambio))%>
<%=Application("middleTxtTaxaEnvio")%>: <%=VarSimboloMoeda%> <%=FormatNumber(raiz_dados_pedido.getAttribute("valor_frete")*FatorCambio(varValor_Cambio))%>
<%= varTipoTaxaAdicional%>*: <%=VarSimboloMoeda%> <%= FormatNumber(varTaxaAdicional*FatorCambio(varValor_Cambio))%>
<%=Application("middleTxtTotal")%>: <%=VarSimboloMoeda%> <%=FormatNumber(raiz_dados_pedido.getAttribute("valor_total")*FatorCambio(varValor_Cambio))%>
<%=sAdicionalInformativo%>
<%=Application("middleTxtOpcaoPagtoSel")%>: <%= retorna_NomeVisPagamento(raiz_dados_pedido.getAttribute("forma_pagamento"))%>
<% If page = "confirmacao" Then Call exibe_dados_pagamento(raiz_dados_pedido.getAttribute("forma_pagamento"),FormatNumber(raiz_dados_pedido.getAttribute("valor_total")),varValor_Cambio) End If %>
<% If permissao <> "write" Then If page <> "recibo" And page <> "iniciatransacao" Or compra = "negada" Then If readonly = "readonly" And page <> "recibo" Then %> <% End If End If End If %> " onclick="window.location='<%= Application("URLloja")%>/carrinho.asp'" /> " onclick="window.location='<%= Application("URLloja")%>/carrinho_vazio.asp'" />
<% If permissao <> "write" Then If page <> "recibo" And page <> "iniciatransacao" Or compra = "negada" Then If readonly = "readonly" And page <> "recibo" Then If raiz_dados_pedido.getAttribute("forma_pagamento") <> "Bradesco" Then %>

<%If page = "confirmacao" Then %> " onMouseOver="MM_swapImage('img_finalizar-compra','','images/finalizar-compra-over.gif',0)" onMouseOut="MM_swapImgRestore()"><%=Application(" align="right" id="img_finalizar-compra" style="margin:15px 0;" /> <%Else%> " onMouseOver="MM_swapImage('img_proximo-passo','','images/proximo-passo-over.gif',0)" onMouseOut="MM_swapImgRestore()"><%=Application(" align="right" id="img_proximo-passo" style="margin:15px 0;" /> <%End If%>
<% End If End If End If End If Set raiz_dados_pedido = Nothing %>