Quantcast
Channel: Últimos conteúdos
Viewing all articles
Browse latest Browse all 14190

Transformar em java script

$
0
0

Galera preciso de uma ajuda para uma situação. Estou com uma função do banco de dados Oracle para a validação de documentos.

 

Eu preciso implantar esta validação na web, será que poderiam me dar uma força de como transformar a função abaixo em javascript? A linguagem que vou utilizar no site é em PHP.

create or replace function fun_Cal_Dig_mod11(p_numero in varchar2,
                                             p_doc    in varchar2,
                                             p_tp_doc in varchar2 default null)return VARCHAR2 is
  wretorna number:= p_numero;
  ws       varchar2(2);
  waux     number(3);
begin
  
  if p_doc = 'DAENTR' then
    ws:= '2';
  elsif p_doc = 'DINACI' then
    ws:= '2';
  end if;
  
  wretorna:= ws||wretorna;
  waux:= mod((to_number(SUBSTR(wretorna,1,1))*3 +
              to_number(SUBSTR(wretorna,2,1))*2 +
              to_number(SUBSTR(wretorna,3,1))*9 +
              to_number(SUBSTR(wretorna,4,1))*8 +
              to_number(SUBSTR(wretorna,5,1))*7 +
              to_number(SUBSTR(wretorna,6,1))*6 +
              to_number(SUBSTR(wretorna,7,1))*5 +
              to_number(SUBSTR(wretorna,8,1))*4 +
              to_number(SUBSTR(wretorna,9,1))*3 +
              to_number(SUBSTR(wretorna,10,1))*2)*10,11);
  
  if waux >= '10' then
    return 0; 
  else
    return nvl(waux,0);
  end if;
  
end;

Viewing all articles
Browse latest Browse all 14190

Trending Articles