ผู้เขียน หัวข้อ: รายงานจำนวนผู้ป่วยที่ลงเลขที่บัตรประชาชนผิดแล้ว Error ครับ  (อ่าน 2594 ครั้ง)

0 สมาชิก และ 1 บุคคลทั่วไป กำลังดูหัวข้อนี้

ออฟไลน์ SIWIT

  • Sr. Member
  • ****
  • กระทู้: 359
  • ฉันไม่เคยคิดยอม แต่ขอเวลาหน่อย
  • Respect: 0
    • ดูรายละเอียด
ผมลองเขียนจำนวนผู้ป่วยที่เจ้าหน้าที่ลงเลขที่บัตรประชาชนไม่ถูกต้องนะครับแต่มัน error ว่า Variable14OnCalc
'' is valid integer value ครับ
-----------------------------------------------------------------------------
n:= StrToInt(GetSQLStringData('select count(o.hn) as cnt '+
'from ovst o '+
'where  o.vstdate between "'+ds1+'" and "'+ds2+'" '+
'and o.staff="'+DBPipeline['staff']+'" '));
 ns:=IntToStr(n);
showmessage(ns);
n:=StrToInt(ns);
     amopt:=0;
     
for n:= 1 to n do
  begin
   ns:=IntToStr(n);
pid := GetSQLStringData('select concat(substring(p.cardno,1,1) '+
',substring(p.cardno,3,4),substring(p.cardno,8,5),substring(p.cardno,14,2) '+
',substring(p.cardno,17,1)) as pid '+
'from ovst o left outer join ptcardno p on p.hn=o.hn '+
'where p.cardtype="01" and o.vstdate between "'+ds1+'" and "'+ds2+'" '+
'and o.staff="'+DBPipeline['staff']+'" limit '+ns+',1 ');
    cv := strtoint(copy(pid, 1, 1));
    nValue := cv * 13;
  for i := 2 to 12 do
    begin
      cv := strtoint(copy(pid, i, 1));
      nValue := nValue + (cv * (14 - i));
    end;
    nMod := 11 - (nValue mod 11);
    snmod := inttostr(nmod);
    snmod := copy(snmod, length(snmod), 1);
    sn13 := copy(pid, 13, 1);

    if snmod=sn13 then
      amopt:=amopt+1;

    s:=IntToStr(amopt);
    showmessage(s);
    amopt:=StrToInt(s);
  end;
    value:=s;
Siwit : นวก.คอม รพช.ปักธงชัย
Server : Xeon 2.0 ; Ram: 12Gb: OS: FreeBSD 8.1
Database : mysql 5.1.47
Slave : P4 3.4 Gb; Ram: 2 Gb; OS: FreeBSD 8.0 ; Database: mysql 5.1.47
Client : windows xp sp3 ; Software : Hosxp version 3.53.8.4
ขึ้นระบบวันที่ 1 มีนาคม 2552 ขอบคุณ อ.ทุกๆท่านครับ