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

📄 mainform.pas

📁 本图书管理系统一sql server为数据库开发平台
💻 PAS
📖 第 1 页 / 共 5 页
字号:
        exit;
      end ;    //if  record  e

      lenddate:=fieldbyname('lenddate').AsDateTime;
      Edit15.Text:=fieldbyname('bookname').AsString;
      Edit11.Text:=datetostr(fieldbyname('Lenddate').AsDateTime);
      Memo3.Text:='无';
      close;
      sql.Clear;
      sql.Add('select lendbooklong from lendbookoption');
      open;
      if dateadd(lenddate,fieldbyname('lendbooklong').AsInteger)>date then
        showmessage('该书籍已经超出借阅期限!应扣滞纳金!');
      if label7.Caption='' then
      begin     //is null
        repeat       //create temp table
          label7.Caption:=codecreate(data.PublicQuery,'HY','returnRecord');
          close;
          sql.Clear;
          sql.Add('select * from sysobjects where name=:name');
          parameters.ParamByName('name').Value:=label7.Caption;
          open;
        until (recordcount<1);
        close;
        sql.Clear;
        sql.Add('create table '+label7.Caption);
        sql.Add(' ([Bookbarcode] [varchar] (20),');
        sql.Add('[BookName] [varchar] (30),[LendCard] [varchar] (30),[LendDate] [Datetime],');
        sql.Add('[hasBreakage] [smallint],[latefee] [numeric](8,2),[Memo] [varchar] (255))');
        execsql;  //create temp table
      end;    //is null
      close;           // insert backtemp book
      sql.Clear;
      sql.Add('insert into '+label7.Caption+' values(:barcode,:Bookname,:lendcard,:LendDate,:hasbreakage,:latefee,:memo)');
      parameters.ParamByName('Barcode').Value:=edit13.Text;
      parameters.ParamByName('Bookname').Value:=edit15.Text;
      parameters.ParamByName('lendcard').value:=edit14.Text;
      parameters.ParamByName('lenddate').value:=strtodate(edit11.Text);
      if checkbox1.Checked then
        parameters.ParamByName('hasbreakage').value:=1
      else  parameters.ParamByName('hasbreakage').value:=0;
      parameters.ParamByName('latefee').value:=strtofloat(edit12.Text);
      parameters.ParamByName('memo').value:='无';
      execsql;
          // inhert backtemp
      tableopen(data.backquery,label7.Caption);
    end; //with e
    clearedit;
  end;//#13
end;

procedure TMain.Edit12KeyPress(Sender: TObject; var Key: Char);
begin
  if not (key in ['0'..'9',char(VK_Back),'.',#13]) then
  key:=#0;
  if (key=#13) and (trim(edit13.text)<>'')and (trim(edit12.text)<>'') and (label7.Caption<>'')then
  begin     // if b
    with data.LendQuery do
    begin  // with lend
      close;
      sql.Clear;
      sql.Add('update '+label7.Caption+' set latefee=:latefee where bookbarcode=:barcode');
      parameters.ParamByName('barcode').Value:=edit13.Text;
      parameters.ParamByName('latefee').Value:=strtofloat(edit12.Text);
      execsql;
    end;   //with lend end;
    tableopen(data.backquery,label7.Caption);
    memo3.SetFocus;
  end; // end b
end;

procedure TMain.Memo2KeyPress(Sender: TObject; var Key: Char);
begin
  if (key=#13) and (trim(edit8.text)<>'') and (label9.Caption<>'')then
  begin     // if b
    with data.LendQuery do
    begin  // with lend
      close;
      sql.Clear;
      sql.Add('update '+label9.Caption+' set memo=:memo where barcode=:barcode');
      parameters.ParamByName('barcode').Value:=edit2.Text;
      parameters.ParamByName('memo').Value:=memo2.Text;
      execsql;
    end;   //with lend end;
    tableopen(data.lendquery,label9.Caption);
    edit13.Clear;
    edit15.Clear;
    edit11.Clear;
    edit12.Text:='0.0';
    checkbox1.Checked:=false;
    memo3.Clear;
  end; // end b
end;

procedure TMain.Memo3KeyPress(Sender: TObject; var Key: Char);
begin
  if (key=#13) and (trim(edit13.text)<>'') and (label7.Caption<>'')then
  begin     // if b
    with data.LendQuery do
    begin  // with lend
      close;
      sql.Clear;
      sql.Add('update '+label7.Caption+' set memo=:memo where bookbarcode=:barcode');
      parameters.ParamByName('barcode').Value:=edit13.Text;
      parameters.ParamByName('memo').Value:=memo3.Text;
      execsql;
    end;   //with lend end;
    tableopen(data.backquery,label7.Caption);
    edit13.Clear;
    edit15.Clear;
    edit11.Clear;
    edit12.Text:='0.0';
    checkbox1.Checked:=false;
    memo3.Clear;
    edit13.SetFocus;
  end; // end b
end;

procedure TMain.StaticText26Click(Sender: TObject);
begin
  if data.backQuery.Active then
  begin
    dropbacktemptable;
    edit14.Clear;
    edit13.Clear;
    edit15.Clear;
    edit11.Clear;
    edit12.Text:='0.0';
    checkbox1.Checked:=false;
    memo3.Clear;
    label7.Caption:='';
  end;
end;

procedure TMain.DBGrid3CellClick(Column: TColumn);
begin
  if data.backQuery.Active then
  begin
    with data.backQuery do
    begin
      edit14.Text:=fieldbyname('Lendcard').AsString;
      edit13.Text:=fieldbyname('bookBarcode').AsString;
      edit15.Text:=fieldbyname('Bookname').AsString;
      edit12.Text:=floattostr(fieldbyname('latefee').AsFloat);
      edit11.Text:=datetostr(fieldbyname('Lenddate').AsDateTime);
      memo3.Text:=fieldbyname('memo').AsString;
      if fieldbyname('hasbreakage').AsInteger=1 then
        checkbox1.Checked:=true;
    end;
    edit12.SetFocus;
  end;
end;

procedure TMain.CheckBox1Click(Sender: TObject);
begin
  if (trim(edit13.text)<>'') and (label7.Caption<>'')then
  begin     // if b
    with data.LendQuery do
    begin  // with lend
      close;
      sql.Clear;
      sql.Add('update '+label7.Caption+' set hasbreakage=:hasb where bookbarcode=:barcode');
      parameters.ParamByName('barcode').Value:=edit13.Text;
      if checkbox1.Checked then
      parameters.ParamByName('hasb').Value:=1
      else parameters.ParamByName('hasb').Value:=0;
      execsql;
    end;   //with lend end;
    tableopen(data.backquery,label7.Caption);
    memo2.SetFocus;
  end; // end b

end;

procedure TMain.StaticText27Click(Sender: TObject);
begin
/////  还阅
  if data.backQuery.Active then
  begin         //if active
    try
      with data.PublicQuery do
      begin                   //with publicquery
        while not data.backQuery.eof do
        begin                          // while b
          Close;
          sql.Clear;
          sql.Add('insert into ReturnRecord (RecordID,Bookbarcode,BookName,lendcard,ReturnDate,HasBreakage,latefee,Memo,worker)');
          sql.Add('values(:RecordID,:Bookbarcode,:BookName,:lendcard,:ReturnDate,:HasBreakage,:latefee,:Memo,:worker)');
          parameters.ParamByName('recordID').Value:=label7.Caption;
          parameters.ParamByName('bookbarcode').Value:=data.backQuery.fieldbyname('bookbarcode').AsString;
          parameters.ParamByName('BookName').Value:=data.backQuery.fieldbyname('bookname').AsString;
          parameters.ParamByName('returndate').Value:=date;
          parameters.ParamByName('lendcard').Value:=data.backQuery.fieldbyname('lendcard').AsString;
          parameters.ParamByName('hasbreakage').Value:=data.backQuery.fieldbyname('hasbreakage').Asinteger;
          parameters.ParamByName('worker').Value:=userPurview.username;
          parameters.ParamByName('latefee').Value:=data.backQuery.fieldbyname('hasbreakage').AsFloat;
          parameters.ParamByName('Memo').Value:=data.backQuery.fieldbyname('Memo').AsString;
          execsql;
          close;
          sql.Clear;
          sql.Add('update lendrecord set YNback=1 where lendcard=:lendcard and lenddate=:lenddate and bookbarcode=:barcode');
          parameters.ParamByName('lendcard').Value:=data.backQuery.fieldbyname('lendcard').AsString;
          parameters.ParamByName('lenddate').Value:=data.backQuery.fieldbyname('lenddate').AsDateTime;
          parameters.ParamByName('barcode').Value:=data.backQuery.fieldbyname('bookbarcode').AsString;
          execsql;
          data.backQuery.next;
        end;                                    //while e
      end;              //with publicquery
    myshowmessage(#13+'还阅结束,谢谢!');
    Finally
      dropbacktemptable;
    end;
  end;   // if active
  data.backQuery.Close;
  data.PublicQuery.Close;
  label7.Caption:='';
  edit14.Clear;
  edit13.Clear;
  edit15.Clear;
  edit11.Clear;
  edit12.Text:='0.0';
  checkbox1.Checked:=false;
  memo3.Clear;
end;

procedure TMain.StaticText22Click(Sender: TObject);
begin
  if (sender as Tstatictext).Parent.Height= 25 then
    (sender as Tstatictext).Parent.Height:=150
  else
    (sender as Tstatictext).Parent.Height:=25;
end;

procedure TMain.Edit16Change(Sender: TObject);
begin
  RadioButton4MouseUp(radiobutton4,mbLeft,[ssLeft],0,0);
end;

procedure TMain.Edit17Change(Sender: TObject);
begin
  RadioButton2MouseUp(radiobutton2,mbLeft,[ssLeft],0,0);
end;

procedure TMain.ComboBox1KeyPress(Sender: TObject; var Key: Char);
begin
  key:=#0;
end;

procedure TMain.ComboBox1Change(Sender: TObject);
begin
  RadioButton5MouseUp(radiobutton5,mbLeft,[ssLeft],0,0);
end;

procedure TMain.Edit18Change(Sender: TObject);
begin
  RadioButton5MouseUp(radiobutton5,mbLeft,[ssLeft],0,0);
end;

procedure TMain.Edit19Change(Sender: TObject);
begin
  RadioButton6MouseUp(radiobutton6,mbleft,[ssleft],0,0);
end;

procedure TMain.CheckBox2Click(Sender: TObject);
begin
                  //销售查询 按区间
  if (sender as Tcheckbox).Checked then
  begin
    if RadioButton8.Checked then
      RadioButton8MouseUp(radiobutton8,mbleft,[ssleft],0,0)
    else
      if RadioButton3.Checked then
        RadioButton3MouseUp(radiobutton3,mbleft,[ssleft],0,0)
      else
        if RadioButton6.Checked then
        RadioButton6MouseUp(radiobutton6,mbleft,[ssleft],0,0);
  end;

{  if (sender as Tcheckbox).Checked and (not(radiobutton3.Checked)) and (trim(edit19.Text)='') and (trim(edit20.Text)='')  then
  begin   //if check
    with data.Query do
    begin
      close;
      sql.Clear;
      sql.Add('select SellDate 销售日期,RecordID 记录号,bookname 书名,Bookbarcode  条码,PriceSum 总额,sellcount 数量,Rebate 折价,worker 操作员,Memo 备注 from sellrecord ');
      sql.Add(' where selldate between :date1 and :date2 order by recordID');
      parameters.ParamByName('date1').Value:=datetimepicker1.Date;
      parameters.ParamByName('date2').Value:=datetimepicker2.Date;
      open;
    end;
  end;    //if check }
end;

procedure TMain.Edit20Change(Sender: TObject);
begin
  RadioButton8MouseUp(radiobutton8,mbleft,[ssleft],0,0);
end;

procedure TMain.DateTimePicker1Change(Sender: TObject);
begin
  if radiobutton3.Checked then
  begin
    RadioButton3MouseUp(radiobutton3,mbleft,[ssleft],0,0);
  end;
  if radiobutton6.Checked then
  begin
    RadioButton6MouseUp(radiobutton6,mbleft,[ssleft],0,0);
  end;
  if radiobutton8.Checked then
  begin
    RadioButton8MouseUp(radiobutton8,mbleft,[ssleft],0,0);
  end;
  if checkbox2.checked then
  begin
    RadioButton2MouseUp(radiobutton2,mbleft,[ssleft],0,0);
  end;
end;

procedure TMain.CheckBox3Click(Sender: TObject);
begin
  //借阅查询 按区间
  if (sender as Tcheckbox).Checked and (not(radiobutton10.Checked)) and (trim(edit21.Text)='') and (trim(edit22.Text)='')  then
  begin   //if check
    with data.Query do
    begin
      close;
      sql.Clear;
      sql.Add('select RecordID 记录号,bookname 书名,LendCard 借书卡号,Bookbarcode  条码,LendDate 借阅日期,ynback 还否,worker 操作员,Memo 备注 from Lendrecord ');
      sql.Add(' where lenddate between :date1 and :date2 order by recordID');
      parameters.ParamByName('date1').Value:=datetimepicker3.Date;
      parameters.ParamByName('date2').Value:=datetimepicker4.Date;
      open;
    end;
  end;    //if check
end;

procedure TMain.Edit22Change(Sender: TObject);
begin
  RadioButton13MouseUp(radiobutton13,mbleft,[ssleft],0,0);
end;

procedure TMain.Edit21Change(Sender: TObject);
begin
  RadioButton11MouseUp(radiobutton11,mbleft,[ssleft],0,0);
end;

procedure TMain.DateTimePicker3Change(Sender: TObject);
begin
  if radiobutton10.Checked then
  begin
    RadioButton10MouseUp(radiobutton10,mbleft,[ssleft],0,0);
  end
  else
    if radiobutton11.Checked then
    begin
      RadioButton11MouseUp(radiobutton11,mbleft,[ssleft],0,0);
    end
    else
      if radiobutton13.Checked then
      begin
        RadioButton13MouseUp(radiobutton13,mbleft,[ssleft],0,0);
      end
      else
        if checkbox3.checked then
        begin
          RadioButton3MouseUp(radiobutton3,mbleft,[ssleft],0,0);
        end;
end;

procedure TMain.CheckBox4Click(Sender: TObject);
begin
//超期未还查询 按区间
  if (sender as Tcheckbox).Checked and (not(radiobutton7.Checked)) and (trim(edit23.Text)='') and (trim(edit24.Text)='')  and (trim(edit25.Text)='') then
  begin   //if check
    with data.Query do
    begin
      close;
      sql.Clear;
      sql.Add('select RecordID 记录号,bookname 书名,LendCard 借书卡号,Bookbarcode  条码,LendDate 借阅日期,ynback 还否,worker 操作员,Memo 备注 from Lendrecord ');
      sql.Add(' where ynback=0 and lenddate between (:date2)-1 and (:date1) orde

⌨️ 快捷键说明

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