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

📄 untsqk.~pas

📁 资料室图书借阅管理系统
💻 ~PAS
📖 第 1 页 / 共 4 页
字号:
unit untsqk;

interface

uses
  Classes, SysUtils, IWAppForm, IWApplication, IWTypes, IWGrids, IWDBGrids,
  IWCompButton, IWCompListbox, IWCompEdit, Controls, IWVCLBaseControl,
  IWBaseControl, IWControl, IWCompLabel, DB, ADODB, Forms, untframe,
  IWHTMLControls, IWExtCtrls, IWBaseHTMLControl;

type
  Tfrmsqk = class(TIWAppForm)
    IWLabel1: TIWLabel;
    IWLabel3: TIWLabel;
    IWEdit1: TIWEdit;
    IWButton1: TIWButton;
    IWHRule1: TIWHRule;
    ADOQuery1: TADOQuery;
    DataSource1: TDataSource;
    IWLabel4: TIWLabel;
    IWComboBox2: TIWComboBox;
    IWEdit2: TIWEdit;
    IWEdit3: TIWEdit;
    IWEdit4: TIWEdit;
    IWEdit5: TIWEdit;
    IWLabel2: TIWLabel;
    IWLabel5: TIWLabel;
    IWLabel6: TIWLabel;
    IWLabel7: TIWLabel;
    IWLabel8: TIWLabel;
    IWButton2: TIWButton;
    IWLabel9: TIWLabel;
    IWLabel10: TIWLabel;
    IWFrame11: TIWFrame1;
    IWButton3: TIWButton;
    IWDBGrid1: TIWDBGrid;
    IWButton4: TIWButton;
    IWButton5: TIWButton;
    IWButton6: TIWButton;
    IWButton7: TIWButton;
    procedure IWButton1Click(Sender: TObject);
    procedure IWComboBox2Change(Sender: TObject);
    procedure IWAppFormCreate(Sender: TObject);
    procedure IWButton2Click(Sender: TObject);
    procedure IWButton3Click(Sender: TObject);
    procedure IWButton4Click(Sender: TObject);
    procedure IWButton5Click(Sender: TObject);
    procedure IWButton6Click(Sender: TObject);
    procedure IWButton7Click(Sender: TObject);

  private
  procedure Move(AFormClass: TIWAppFormClass);


  end;

type

    tmyint1=set of 13..99;
    tmyint2=set of 0..0;



implementation
 uses untlog,untguest,servercontroller, tempuntmain, U_guestMain;
{$R *.dfm}
procedure Tfrmsqk.Move(AFormClass: TIWAppFormClass);
begin
  // Release the current form



  // tiwappform(webapplication.ActiveForm).Release;
  // Create the next form

end;

procedure Tfrmsqk.IWButton1Click(Sender: TObject);
var
  tempstr:string;
  str2,str3,str4,str5,t0,t1,t2,t3,t4,t5,t6,q1,q2,q3,q4:string;
  i1:integer;
//----i1为闰年翻断数----------------///
  tempint1,tempint2:integer;
  tmy1:tmyint1;
  tmy2:tmyint2;
  n1,n2:integer;
begin
  tmy1:=[13..99];
  tmy2:=[0..0];
  if iwedit1.Text='' then
  begin
    webapplication.ShowMessage('检索词不能为空');
    exit;
  end;
   tempstr:=trim(iwedit1.Text);
   str2:=trim(iwedit2.Text);
   str3:=trim(iwedit3.Text);

   str4:=trim(iwedit4.Text);
   str5:=trim(iwedit5.Text);

   t1:=str2+'-'+str3+'-1';    //默认查询上限
////---------------------------------- 判断月份范围是否正确------------------------------///////
   trystrtoint(str3,tempint1);
   if ((str2<>'') and (str3<>''))and (tempint1  in tmy1) then
   begin
   webapplication.ShowMessage('请输入正确的月份!');
   iwedit3.SetFocus;
   exit;
   end;
  trystrtoint(str3,tempint2);
    if ((str2<>'') and (str3<>''))and(tempint2  in tmy2) then
   begin
   webapplication.ShowMessage('请输入正确的月份!');
   iwedit3.SetFocus;
   exit;
   end;
    trystrtoint(str5,tempint1);
     if ((str4<>'') and (str5<>'')) and (tempint1 in tmy1) then
   begin
   webapplication.ShowMessage('请输入正确的月份!');
    iwedit5.SetFocus;
   exit;
   end;
  trystrtoint(str5,tempint2);
    if ((str4<>'') and (str5<>'')) and  (tempint2  in tmy2) then
   begin
   webapplication.ShowMessage('请输入正确的月份!');
   iwedit5.SetFocus;
   exit;
   end;
   /////----------------------------------------判断年份格式是否正确------------------------//////
 if (str2<>'') and (length(str2)<4) then
   begin
   webapplication.ShowMessage('日期格式不正确,请重新输入!');
       //iwedit2.Clear;
      iwedit2.SetFocus;
      exit;
   end;

 if (trystrtoint(str2,n1)=false) and (str2<>'') then
 begin
   webapplication.ShowMessage('日期格式不正确,请重新输入!');
      //iwedit2.Clear;
      iwedit2.SetFocus;
      exit;
   end;
 if (str4<>'') and (length(str4)<4) then
   begin
   webapplication.ShowMessage('日期格式不正确,请重新输入!');
       //iwedit4.Clear;
      iwedit4.SetFocus;
      exit;
   end;

   if (trystrtoint(str4,n2)=false) and (str4<>'') then
    begin
   webapplication.ShowMessage('日期格式不正确,请重新输入!');
       //iwedit4.Clear;
      iwedit4.SetFocus;
      exit;
   end;
   ////--------------------------------------------------开始查询---------------------------------------////////

   iwbutton4.Visible:=true;
   iwbutton5.Visible:=true;
   iwbutton6.Visible:=true;
   iwbutton7.Visible:=true;

   if (str2<>'')and(str4<>'')and(str3<>'')and(str5<>'')then
   begin
    i1:=strtoint(str4);

if ((str5='02') or (str5='2')) and (i1 mod 4 = 0) then
   begin
   q1:=str4+'-'+str5+'-29';
 case iwcombobox2.ItemIndex   of
     0:begin
        adoquery1.Close;
        adoquery1.SQL.Clear;
        adoquery1.SQL.Add(format('select ID as 期刊号, JournalBasicID as 期刊名, zqs as 总期数 , qs as 期数,Price as 价格,buydate as 购入日期 , pubdate as 出版日期, ISBN , zhuti as 主题词 , fenleihao as 分类号, Memo as 附注  FROM JournalDetail WHERE JournalDetail.JournalBasicID = '+quotedstr(tempstr)+' and pubdate between #%s# and #%s# order by pubdate',[t1,q1]));
        adoquery1.Open;
        if adoquery1.RecordCount=0 then
        begin
        webapplication.ShowMessage('没有找到相关记录。请检查查询条件重新检索!');
        end;
        end;
     1:begin
        adoquery1.Close;
        adoquery1.SQL.Clear;
        adoquery1.SQL.Add(format('select ID as 期刊号, JournalBasicID as 期刊名, zqs as 总期数 , qs as 期数,Price as 价格,buydate as 购入日期 , pubdate as 出版日期, ISBN , zhuti as 主题词 , fenleihao as 分类号, Memo as 附注  FROM JournalDetail WHERE JournalDetail.zhuti like '+quotedstr(tempstr)+' and pubdate between #%s# and #%s# order by pubdate',[t1,q1]));
        adoquery1.Open;
         if adoquery1.RecordCount=0 then
        begin
        webapplication.ShowMessage('没有找到相关记录。请检查查询条件重新检索!');
        end;
        end;
     2:begin
        adoquery1.Close;
        adoquery1.SQL.Clear;
        adoquery1.SQL.Add(format('select ID as 期刊号, JournalBasicID as 期刊名, zqs as 总期数 , qs as 期数,Price as 价格,buydate as 购入日期 , pubdate as 出版日期, ISBN , zhuti as 主题词 , fenleihao as 分类号, Memo as 附注  FROM JournalDetail WHERE JournalDetail.isbn = '+quotedstr(tempstr)+' and pubdate between #%s# and #%s# order by pubdate',[t1,q1]));
        adoquery1.Open;
         if adoquery1.RecordCount=0 then
        begin
        webapplication.ShowMessage('没有找到相关记录。请检查查询条件重新检索!');
        end;
        end;
     3:begin
        adoquery1.Close;
        adoquery1.SQL.Clear;
        adoquery1.SQL.Add(format('select ID as 期刊号, JournalBasicID as 期刊名, zqs as 总期数 , qs as 期数,Price as 价格,buydate as 购入日期 , pubdate as 出版日期, ISBN , zhuti as 主题词 , fenleihao as 分类号, Memo as 附注  FROM JournalDetail WHERE JournalDetail.fenleihao = '+quotedstr(tempstr)+' and pubdate between #%s# and #%s# order by pubdate',[t1,q1]));
        adoquery1.Open;
         if adoquery1.RecordCount=0 then
        begin
        webapplication.ShowMessage('没有找到相关记录。请检查查询条件重新检索!');
        end;
        end;
    end
end
   else
begin
     i1:=strtoint(str4);
if (i1 mod 4<>0) and((str5='02') or (str5='2')) then
    begin
    q2:=str4+'-'+str5+'-28';
 case iwcombobox2.ItemIndex   of
     0:begin
        adoquery1.Close;
        adoquery1.SQL.Clear;
        adoquery1.SQL.Add(format('select ID as 期刊号, JournalBasicID as 期刊名, zqs as 总期数 , qs as 期数,Price as 价格,buydate as 购入日期 , pubdate as 出版日期, ISBN , zhuti as 主题词 , fenleihao as 分类号, Memo as 附注  FROM JournalDetail WHERE JournalDetail.JournalBasicID = '+quotedstr(tempstr)+' and pubdate between #%s# and #%s# order by pubdate',[t1,q2]));
        adoquery1.Open;
         if adoquery1.RecordCount=0 then
        begin
        webapplication.ShowMessage('没有找到相关记录。请检查查询条件重新检索!');
        end;
        end;
     1:begin
        adoquery1.Close;
        adoquery1.SQL.Clear;
        adoquery1.SQL.Add(format('select ID as 期刊号, JournalBasicID as 期刊名, zqs as 总期数 , qs as 期数,Price as 价格,buydate as 购入日期 , pubdate as 出版日期, ISBN , zhuti as 主题词 , fenleihao as 分类号, Memo as 附注  FROM JournalDetail WHERE JournalDetail.zhuti like '+quotedstr(tempstr)+' and pubdate between #%s# and #%s# order by pubdate',[t1,q2]));
        adoquery1.Open;
         if adoquery1.RecordCount=0 then
        begin
        webapplication.ShowMessage('没有找到相关记录。请检查查询条件重新检索!');
        end;
        end;
     2:begin
        adoquery1.Close;
        adoquery1.SQL.Clear;
        adoquery1.SQL.Add(format('select ID as 期刊号, JournalBasicID as 期刊名, zqs as 总期数 , qs as 期数,Price as 价格,buydate as 购入日期 , pubdate as 出版日期, ISBN , zhuti as 主题词 , fenleihao as 分类号, Memo as 附注  FROM JournalDetail WHERE JournalDetail.isbn = '+quotedstr(tempstr)+' and pubdate between #%s# and #%s# order by pubdate',[t1,q2]));
        adoquery1.Open;
         if adoquery1.RecordCount=0 then
        begin
        webapplication.ShowMessage('没有找到相关记录。请检查查询条件重新检索!');
        end;
        end;
     3:begin
        adoquery1.Close;
        adoquery1.SQL.Clear;
        adoquery1.SQL.Add(format('select ID as 期刊号, JournalBasicID as 期刊名, zqs as 总期数 , qs as 期数,Price as 价格,buydate as 购入日期 , pubdate as 出版日期, ISBN , zhuti as 主题词 , fenleihao as 分类号, Memo as 附注  FROM JournalDetail WHERE JournalDetail.fenleihao = '+quotedstr(tempstr)+' and pubdate between #%s# and #%s# order by pubdate',[t1,q2]));
        adoquery1.Open;
         if adoquery1.RecordCount=0 then
        begin
        webapplication.ShowMessage('没有找到相关记录。请检查查询条件重新检索!');
        end;
        end;
    end
end
    else
begin
if (str5='1')or (str5='3')or(str5='5')or(str5='7')or(str5='8')or(str5='10')or(str5='12') then
    begin
    q3:=str4+'-'+str5+'-31';
 case iwcombobox2.ItemIndex   of
     0:begin
        adoquery1.Close;
        adoquery1.SQL.Clear;
        adoquery1.SQL.Add(format('select ID as 期刊号, JournalBasicID as 期刊名, zqs as 总期数 , qs as 期数,Price as 价格,buydate as 购入日期 , pubdate as 出版日期, ISBN , zhuti as 主题词 , fenleihao as 分类号, Memo as 附注  FROM JournalDetail WHERE JournalDetail.JournalBasicID = '+quotedstr(tempstr)+' and pubdate between #%s# and #%s# order by pubdate',[t1,q3]));
        adoquery1.Open;
         if adoquery1.RecordCount=0 then
        begin
        webapplication.ShowMessage('没有找到相关记录。请检查查询条件重新检索!');
        end;
        end;
     1:begin
        adoquery1.Close;

⌨️ 快捷键说明

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