| Verificação de PIS |
|
|
|
| Dicas - String | ||||
|
function vpis(Dado: String):boolean; var i,wsoma,wm11,wdv,wdigito: integer; begin if Trim(Dado) '' then begin wdv := StrToInt(copy(Dado,11,1)); wsoma := 0; wm11 := 2; for i := 1 to 10 do begin wsoma := wsoma + (wm11 * StrToInt(Copy(Dado,11 -i, 1))); if wm11 < 9 then wm11 := wm11+1 else wm11 := 2; end; wdigito := 11 - (wsoma mod 11); if wdigito > 9 then wdigito := 0; if wdv = wdigito then begin Application.MessageBox('Valor válido!','Aviso !', mb_IconStop+mb_ok); vpis := True; end else begin Application.MessageBox('Valor informado não é válido!', 'Atenção!', mb_IconStop+mb_ok); vpis := false; end; end; end;
|
||||



