⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 unit5.~pas

📁 学校短信息系统 采用华域科技的SzgmtSms 通讯模块
💻 ~PAS
📖 第 1 页 / 共 2 页
字号:
cd[i]:=0;
cd_student[i]:='';
     while not adoquery1.Eof do
     begin
         cd[i]:=cd[i]+1;
         cd_student[i]:=cd_student[i]+adoquery1.fieldbyname('name').AsString+'('+adoquery1.fieldbyname('class').AsString+'),';
       adoquery1.Next;
     end;
i:=i+1;
end;
//--------------------------------- compute wd-----------------------
i:=1;
while i<=grade_num do
begin
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Text:='select name,class from student_info where grade=:grade_name and card_id not in(select card_id from daily where time>=:t1 and time<:t2)';
adoquery1.Parameters.ParamByName('grade_name').Value:=quotedstr(grade[i]);
adoquery1.Parameters.ParamByName('t1').Value:=datetostr(date)+' 0:00:01';
adoquery1.Parameters.ParamByName('t2').Value:=datetostr(date)+' '+timetostr(zc_out);
adoquery1.Open;
wd[i]:=0;
wd_student[i]:='';
     while not adoquery1.Eof do
     begin
         wd[i]:=cd[i]+1;
         wd_student[i]:=cd_student[i]+adoquery1.fieldbyname('name').AsString+'('+adoquery1.fieldbyname('class').AsString+'),';
      adoquery1.Next;
     end;
i:=i+1;
end;
end
else if t1_name='am' then
begin
//------------------------compute sd-------------------------
showmessage('---compute am.sd---');
i:=1;
while i<=grade_num do
begin
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Text:='select count(*)as num from student_info where grade=:grade_name and card_id in(select card_id from daily where time>=:t1 and time<:t2)';
adoquery1.Parameters.ParamByName('grade_name').Value:=quotedstr(grade[i]);
adoquery1.Parameters.ParamByName('t1').Value:=datetostr(date)+' '+timetostr(zc_out);
adoquery1.Parameters.ParamByName('t2').Value:=datetostr(date)+' '+timetostr(am_in);
adoquery1.Open;
showmessage('open');
sd[i]:=adoquery1.fieldbyname('num').AsInteger;
i:=i+1;
end;
//------------------------------compute cd-------------------------
showmessage('---compute am.cd---');
i:=1;
while i<=grade_num do
begin
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Text:='select name,class from student_info where grade=:grade_name and card_id in(select card_id from daily where time>=:t1 and time<:t2)';
adoquery1.Parameters.ParamByName('grade_name').Value:=quotedstr(grade[i]);
adoquery1.Parameters.ParamByName('t1').Value:=datetostr(date)+' '+timetostr(am_in);
adoquery1.Parameters.ParamByName('t2').Value:=datetostr(date)+' '+timetostr(am_out);
adoquery1.Open;
cd[i]:=0;
cd_student[i]:='';
     while not adoquery1.Eof do
     begin
         cd[i]:=cd[i]+1;
         cd_student[i]:=cd_student[i]+adoquery1.fieldbyname('name').AsString+'('+adoquery1.fieldbyname('class').AsString+'),';
       adoquery1.Next;
     end;
i:=i+1;
end;
//--------------------------------- compute wd-----------------------
i:=1;
while i<=grade_num do
begin
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Text:='select name,class from student_info where grade=:grade_name and card_id not in(select card_id from daily where time>=:t1 and time<:t2)';
adoquery1.Parameters.ParamByName('grade_name').Value:=quotedstr(grade[i]);
adoquery1.Parameters.ParamByName('t1').Value:=datetostr(date)+' '+timetostr(zc_out);
adoquery1.Parameters.ParamByName('t2').Value:=datetostr(date)+' '+timetostr(am_out);
adoquery1.Open;
wd[i]:=0;
wd_student[i]:='';
     while not adoquery1.Eof do
     begin
         wd[i]:=cd[i]+1;
         wd_student[i]:=cd_student[i]+adoquery1.fieldbyname('name').AsString+'('+adoquery1.fieldbyname('class').AsString+'),';
      adoquery1.Next;
     end;
i:=i+1;
end;
end
else if t1_name='pm' then
begin
//------------------------compute sd-------------------------
showmessage('---compute pm.sd---');
i:=1;
while i<=grade_num do
begin
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Text:='select count(*)as num from student_info where grade=:grade_name and card_id in(select card_id from daily where time>=:t1 and time<:t2)';
adoquery1.Parameters.ParamByName('grade_name').Value:=quotedstr(grade[i]);
adoquery1.Parameters.ParamByName('t1').Value:=datetostr(date)+' '+timetostr(am_out);
adoquery1.Parameters.ParamByName('t2').Value:=datetostr(date)+' '+timetostr(pm_in);
adoquery1.Open;
showmessage('open');
sd[i]:=adoquery1.fieldbyname('num').AsInteger;
i:=i+1;
end;
//------------------------------compute cd-------------------------
showmessage('---compute pm.cd---');
i:=1;
while i<=grade_num do
begin
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Text:='select name,class from student_info where grade=:grade_name and card_id in(select card_id from daily where time>=:t1 and time<:t2)';
adoquery1.Parameters.ParamByName('grade_name').Value:=quotedstr(grade[i]);
adoquery1.Parameters.ParamByName('t1').Value:=datetostr(date)+' '+timetostr(pm_in);
adoquery1.Parameters.ParamByName('t2').Value:=datetostr(date)+' '+timetostr(pm_out);
adoquery1.Open;
cd[i]:=0;
cd_student[i]:='';
     while not adoquery1.Eof do
     begin
         cd[i]:=cd[i]+1;
         cd_student[i]:=cd_student[i]+adoquery1.fieldbyname('name').AsString+'('+adoquery1.fieldbyname('class').AsString+'),';
       adoquery1.Next;
     end;
i:=i+1;
end;
//--------------------------------- compute wd-----------------------
i:=1;
while i<=grade_num do
begin
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Text:='select name,class from student_info where grade=:grade_name and card_id not in(select card_id from daily where time>=:t1 and time<:t2)';
adoquery1.Parameters.ParamByName('grade_name').Value:=quotedstr(grade[i]);
adoquery1.Parameters.ParamByName('t1').Value:=datetostr(date)+' '+timetostr(am_out);
adoquery1.Parameters.ParamByName('t2').Value:=datetostr(date)+' '+timetostr(pm_out);
adoquery1.Open;
wd[i]:=0;
wd_student[i]:='';
     while not adoquery1.Eof do
     begin
         wd[i]:=cd[i]+1;
         wd_student[i]:=cd_student[i]+adoquery1.fieldbyname('name').AsString+'('+adoquery1.fieldbyname('class').AsString+'),';
      adoquery1.Next;
     end;
i:=i+1;
end;
end
else if t1_name='ws' then
begin
//------------------------compute sd-------------------------
showmessage('---compute ws.sd---');
i:=1;
while i<=grade_num do
begin
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Text:='select count(*)as num from student_info where grade=:grade_name and card_id in(select card_id from daily where time>=:t1 and time<:t2)';
adoquery1.Parameters.ParamByName('grade_name').Value:=quotedstr(grade[i]);
adoquery1.Parameters.ParamByName('t1').Value:=datetostr(date)+' '+timetostr(pm_out);
adoquery1.Parameters.ParamByName('t2').Value:=datetostr(date)+' '+timetostr(ws_in);
adoquery1.Open;
showmessage('open');
sd[i]:=adoquery1.fieldbyname('num').AsInteger;
i:=i+1;
end;
//------------------------------compute cd-------------------------
showmessage('---compute ws.cd---');
i:=1;
while i<=grade_num do
begin
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Text:='select name,class from student_info where grade=:grade_name and card_id in(select card_id from daily where time>=:t1 and time<:t2)';
adoquery1.Parameters.ParamByName('grade_name').Value:=quotedstr(grade[i]);
adoquery1.Parameters.ParamByName('t1').Value:=datetostr(date)+' '+timetostr(ws_in);
adoquery1.Parameters.ParamByName('t2').Value:=datetostr(date)+' '+timetostr(ws_out);
adoquery1.Open;
cd[i]:=0;
cd_student[i]:='';
     while not adoquery1.Eof do
     begin
         cd[i]:=cd[i]+1;
         cd_student[i]:=cd_student[i]+adoquery1.fieldbyname('name').AsString+'('+adoquery1.fieldbyname('class').AsString+'),';
       adoquery1.Next;
     end;
i:=i+1;
end;
//--------------------------------- compute wd-----------------------
i:=1;
while i<=grade_num do
begin
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Text:='select name,class from student_info where grade=:grade_name and card_id not in(select card_id from daily where time>=:t1 and time<:t2)';
adoquery1.Parameters.ParamByName('grade_name').Value:=quotedstr(grade[i]);
adoquery1.Parameters.ParamByName('t1').Value:=datetostr(date)+' '+timetostr(pm_out);
adoquery1.Parameters.ParamByName('t2').Value:=datetostr(date)+' '+timetostr(ws_out);
adoquery1.Open;
wd[i]:=0;
wd_student[i]:='';
     while not adoquery1.Eof do
     begin
         wd[i]:=cd[i]+1;
         wd_student[i]:=cd_student[i]+adoquery1.fieldbyname('name').AsString+'('+adoquery1.fieldbyname('class').AsString+'),';
      adoquery1.Next;
     end;
i:=i+1;
end;
end;
i:=1;
school_yd:=0;
school_sd:=0;
school_cd:=0;
school_wd:=0;
while  i<=grade_num do
begin
    school_yd:=school_yd+yd[i];
    school_sd:=school_sd+sd[i];
    school_cd:=school_cd+cd[i];
    school_wd:=school_wd+wd[i];
    i:=i+1;
end;
i:=1;
html:='';
html:=html+'<html><head><script language=javascript>window.print();</script></head><body>';
html:=html+'<font size=5 color=#3333ff>学生出勤表</font><br>';
html:=html+'<table width=80% border=1 cellspacing=0 cellpadding=0 bordercolor=green>';
html:=html+'<tr><td width=15%>&nbsp;</td><td width=15%>应到</td><td width=15%>实到</td><td width=20%>迟到</td><td width=20%>未到</td></tr>';
html:=html+'<tr><td width=15%>全校</td><td width=15%>'+inttostr(school_yd)+'</td><td width=15%>'+inttostr(school_sd)+'</td><td width=20%>'+inttostr(school_cd)+'</td><td width=20%>'+inttostr(school_wd)+'</td></tr>';
while i<=grade_num do
begin
html:=html+'<tr><td width=15%>'+grade[i]+'</td><td width=15%>'+inttostr(yd[i])+'</td><td width=15%>'+inttostr(sd[i])+'</td><td width=20%><font color=red>共'+inttostr(cd[i])+'人</font><br>'+cd_student[i]+'</td><td width=20%><font color=red>共'+inttostr(wd[i])+'人</font><br>'+wd_student[i]+'</td></tr>';
i:=i+1;
end;
html:=html+'</table></body></html>';
memo2.lines.Add(html);
dt:=datetimetostr(time);
//file_path:='D:/DownLoads/家校通/test/test007/';
file_path:=StrAlloc(255);
//GetTempPath(255,file_path);
windows.GetCurrentDirectory(255,file_path);
showmessage(file_path+'\'+dt+'.html');
assignfile(htmlfile,'001.html');
showmessage('file io');
rewrite(htmlfile);
showmessage('writeln');
writeln(htmlfile,html);
closefile(htmlfile);
(*if(filecreate(file_path+'\'+dt+'.html')=-1)then showmessage('filecreate error!');
rewrite(f1);
if(fileopen(dt+'.html',$0001)=-1)then showmessage('file open error!');
if(filewrite(1,html,2048)=-1) then showmessage('write file error!');
fileclose(1); *)
ShellExecute(Handle, 'open', PChar('iexplore.exe'), PChar(file_path+'\001.html'), nil, SW_SHOW);

end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -