<% '-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# ' Loja Exemplo Locaweb ' Versão: 6.4 ' Data: 12/09/06 ' Arquivo: funcoes_endereco.asp ' Versão do arquivo: 0.0 ' Data da ultima atualização: 06/05/08 ' '----------------------------------------------------------------------------- ' Licença Código Livre: http://comercio.locaweb.com.br/gpl/gpl.txt '-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# '########################################################################################################## 'SUB Mostra_Endereco ' - Mostra os campos do endereço para preenchimento. Entrega e cobrança '########################################################################################################## Sub Mostra_Endereco(tipo_endereco) ' Resgata o tipo de login do usuario If Session("tipo_login") <> "" Then tipo_login = Session("tipo_login") Else tipo_login = Request.form("tipo_login") End If ' Resgata o tipo de endereco que será exibido If tipo_endereco = "cobranca" then cod_coluna = "_cobranca" Else cod_coluna = "_entrega" End If ' Resgata o pais do cadastro para ativar os campos obrigatórios If Session("pais" & cod_coluna) <> "BR" And Session("pais" & cod_coluna) <> "" Then bold = "" Else bold = "*" End If 'Formata os campos necessários Call PreparaDado(Session("cpf" & cod_coluna),"CPF",cpf_b1,cpf_b2,cpf_b3,cpf_b4,vazio) Call PreparaDado(Session("cnpj" & cod_coluna),"CNPJ",cnpj_b1,cnpj_b2,cnpj_b3,cnpj_b4,cnpj_b5) Call PreparaDado(Session("data_nascimento" & cod_coluna),"DATA_NASCIMENTO",data_nascimento_b1,data_nascimento_b2,data_nascimento_b3,vazio,vazio) Call PreparaDado(Session("cep" & cod_coluna),"CEP",cep_b1,cep_b2,vazio,vazio,vazio) %>
<% If cod_coluna = "_cobranca" And readonly = "" Then %> <% End If %> <%If cod_coluna = "_cobranca" Then %> <% End If If cod_coluna = "_cobranca" Then If Session("autorizo_newsletter") <> 0 OR readonly <> "readonly" Then %> <% End If End If %>
"" Or Session("razaosocial_cobranca") = "" And page = "conta_usuario_cadastrado" Then%>checked <%End If%>><%=Application("FenderTxtPessoaFisica")%> "" Then%>checked<%End If%>><%=Application("FenderTxtPessoaJuridica")%>
*<%=Application("FenderTxtNome")%>: <%= bold & Application("FenderTxtCpf")%>:
" class="FORMbox" <%=readonly%>> onKeyUp='this.value=this.value.replace(/[^\d]*/gi,""); return autoTab(this, 3, event);'> .  onKeyUp='this.value=this.value.replace(/[^\d]*/gi,""); return autoTab(this, 3, event);'> .  onKeyUp='this.value=this.value.replace(/[^\d]*/gi,""); return autoTab(this, 3, event);'> -  onKeyUp='this.value=this.value.replace(/[^\d]*/gi,"");'>">
<%= bold & Application("FenderTxtRg")%>: <%=Application("FenderTxtDataNasc")%>:
" class="FORMbox" <%=readonly%> onKeyUp='this.value=this.value.replace(/[^\dA-Z]*/gi,"");'> onKeyUp='this.value=this.value.replace(/[^\d]*/gi,""); return autoTab(this, 2, event);'> /  onKeyUp='this.value=this.value.replace(/[^\d]*/gi,""); return autoTab(this, 2, event);'> /  onKeyUp='this.value=this.value.replace(/[^\d]*/gi,"");'>">
*<%=Application("FenderTxtRazaoSocial")%>: <%= bold & Application("FenderTxtCNPJ")%>:
" class="FORMbox" <%=readonly%>> onKeyUp='this.value=this.value.replace(/[^\d]*/gi,""); return autoTab(this, 2, event);'> .  onKeyUp='this.value=this.value.replace(/[^\d]*/gi,""); return autoTab(this, 3, event);'> .  onKeyUp='this.value=this.value.replace(/[^\d]*/gi,""); return autoTab(this, 3, event);'> /  onKeyUp='this.value=this.value.replace(/[^\d]*/gi,""); return autoTab(this, 4, event);'> -  onKeyUp='this.value=this.value.replace(/[^\d]*/gi,"");'>">
<%= Application("FenderTxtInscricaoEstadual")%>:
" class="FORMbox" <%=readonly%>>
*<%=Application("FenderTxtEndereco")%>: *<%=Application("FenderTxtNumero")%>:
" class="FORMbox" <%=readonly%>> " class="FORMbox" <%=readonly%>>
<%=Application("FenderTxtComplemento")%>: *<%=Application("FenderTxtBairro")%>:
" class="FORMbox" <%=readonly%>> " class="FORMbox" <%=readonly%>>
<%= bold & Application("FenderTxtCEP")%>: *<%=Application("FenderTxtCidade")%>:
<%If readonly <> "" Then%> <%If Session("pais" & cod_coluna) <> "BR" Then %> " size="15" <%=readonly%> class="FORMbox" maxlength="50"> <%Else%> onKeyUp='this.value=this.value.replace(/[^\d]*/gi,""); return autoTab(this, 5, event);'> -  onKeyUp='this.value=this.value.replace(/[^\d]*/gi,"");'> <%End If%> <%Else%>
onKeyUp='this.value=this.value.replace(/[^\d]*/gi,""); return autoTab(this, 5, event);'> -  onKeyUp='this.value=this.value.replace(/[^\d]*/gi,"");'>
" size="15" <%=readonly%> class="FORMbox" maxlength="50">
<%End If%> ">
" class="FORMbox" <%=readonly%>>
*<%=Application("FenderTxtEstado")%>: *<%=Application("FenderTxtPais")%>:
<%If readonly <> "" Then%> "BR" Then %>size="10"<%Else%>size="3"<%End If%> maxlength="2" name="estado<%=cod_coluna%>" value="<%= Session("estado" & cod_coluna) %>" class="FORMbox" <%=readonly%>> <%Else%>
<% Call Lista_Estado(Session("estado" & cod_coluna), cod_coluna) %>
" class="FORMbox" <%=readonly%>>
<%End If%>
<%If readonly <> "" Then%> " class="FORMbox" <%=readonly%>> <%Else Call Cria_Combo_Paises(Session("pais" & cod_coluna),"pais"&cod_coluna,"onchange=""ajustaEstadoCadastro(document.Endereco,'"&cod_coluna&"'); ajustaCepCadastro(document.Endereco,'"&cod_coluna&"')""") End If%>
*<%=Application("FenderTxtTelefone")%>: <%If cod_coluna = "_entrega" Then%> *<%=Application("FenderTxtEmail")%>: <%End If%>
" class="FORMbox" <%=readonly%> onKeyUp='this.value=this.value.replace(/[^\d]*/gi,""); return autoTab(this, 2, event);'> - " class="FORMbox" <%=readonly%> onKeyUp='this.value=this.value.replace(/[^\d]*/gi,"");'> <%=Application("FenderTxtAvisoTelefone")%> <%If cod_coluna = "_entrega" Then%> " class="FORMbox" <%=readonly%>> <%End If%>
<%=Application("FenderTxtObs")%>:  
 
><%=Application("FenderTxtSelReceberNews")%>
 (*) <%=Application("FenderTxtAvisoImportante")%>
<% If readonly = "" Then %> <% End If %> <% End Sub '######################################################################################################## '--> FIM SUB Mostra_Endereco '######################################################################################################## '======================================================================================================== '######################################################################################################## 'FUNCTION Encontra_Endereco ' - Funcão para localização od endereço a partir do CEP '########################################################################################################## Function Encontra_Endereco(CEP_str,cod_coluna) If IsNumeric(CEP_str) Then Set CEP_obj = CreateObject("Correios.CEP") CEP_obj.EncontraCEP(CEP_str) If CEP_obj.Erro = 0 Then Session("logradouro" & cod_coluna) = CEP_obj.Endereco Session("bairro" & cod_coluna) = CEP_obj.Bairro Session("cidade" & cod_coluna) = CEP_obj.Cidade Session("estado" & cod_coluna) = CEP_obj.Estado Session("cep" & cod_coluna) = cep_str Session("pais" & cod_coluna) = Session("pais_frete") Encontra_Endereco = True Else Session("logradouro" & cod_coluna) = "" Session("bairro" & cod_coluna) = "" Session("cidade" & cod_coluna) = "" Session("estado" & cod_coluna) = "" If Session("cep_frete") <> "" Then Session("cep" & cod_coluna) = Session("cep_frete") Else Session("cep" & cod_coluna) = "" End if If Session("pais_frete") <> "" Then Session("pais" & cod_coluna) = Session("pais_frete") Else Session("pais" & cod_coluna) = "" End if Encontra_Endereco = False End If Set CEP_obj = Nothing Else Session("cep" & cod_coluna) = cep_str Session("pais" & cod_coluna) = Session("pais_frete") End If End Function '######################################################################################################## '--> FIM FUNCTION Encontra_Endereco '######################################################################################################## %>