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

📄 sftongji.pas

📁 一个简单的学生费用管理系统
💻 PAS
📖 第 1 页 / 共 2 页
字号:
unit sftongji;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls, StdCtrls, Buttons, DB, ADODB, Grids, DBGrids, jpeg,
  DBCtrls, Menus;

type
  TForm4 = class(TForm)
    RadioGroup1: TRadioGroup;
    BitBtn3: TBitBtn;
    GroupBox1: TGroupBox;
    Label1: TLabel;
    Label2: TLabel;
    Edit1: TEdit;
    Edit2: TEdit;
    GroupBox2: TGroupBox;
    Label3: TLabel;
    Edit3: TEdit;
    Label4: TLabel;
    Edit4: TEdit;
    BitBtn1: TBitBtn;
    DataSource1: TDataSource;
    DBGrid1: TDBGrid;
    DBGrid2: TDBGrid;
    ADOTable2: TADOTable;
    DataSource2: TDataSource;
    ADOQuery1: TADOQuery;
    Button1: TButton;
    CheckBox1: TCheckBox;
    CheckBox2: TCheckBox;
    PopupMenu1: TPopupMenu;
    N1: TMenuItem;
    ADOTable1: TADOTable;
    DataSource3: TDataSource;
    DataSource4: TDataSource;
    ADOQuery2: TADOQuery;
    procedure BitBtn3Click(Sender: TObject);
    procedure RadioGroup1Click(Sender: TObject);
    procedure BitBtn1Click(Sender: TObject);
    procedure DBGrid1KeyPress(Sender: TObject; var Key: Char);
    procedure CheckBox1Click(Sender: TObject);
    procedure CheckBox2Click(Sender: TObject);
    procedure N1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject); 
    procedure Button1Click(Sender: TObject);
    procedure show_all;   //重新显示全部记录
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form4: TForm4;

implementation

uses DM, zfqueren, dyzfdj, Share;

{$R *.dfm}

procedure TForm4.BitBtn3Click(Sender: TObject);
begin
close;
end;

procedure TForm4.RadioGroup1Click(Sender: TObject);
begin
  dbgrid1.Columns[4].ReadOnly:=false;
  dbgrid1.SetFocus;
  case RadioGroup1.ItemIndex of
      0:
         begin
           edit3.text:='';
           edit4.Text:='';
           edit3.SetFocus;   
           edit3.ShowHint:=true;
           edit4.ShowHint:=true;
           groupbox1.ShowHint:=true;
           Label3.Caption:='起始日期';
           label3.FocusControl:=edit3;
           Label4.Caption:='截止日期';
           label4.FocusControl:=edit4;
           tjm:=copy(Label3.Caption,5,4);
         end;
      1:
         begin
           edit3.text:='';
           edit4.Text:='';
           edit3.SetFocus;
           edit3.ShowHint:=false;
           edit4.ShowHint:=false;
           groupbox1.ShowHint:=true;
           Label3.Caption:='起始收费人号';
           label3.FocusControl:=edit3;
           Label4.Caption:='截止收费人号';
           label4.FocusControl:=edit4;
           tjm:=copy(Label3.Caption,5,8);
          end;
      2:
         begin
           edit3.text:='';
           edit4.Text:='';
           edit3.SetFocus;
           edit3.ShowHint:=false;
           edit4.ShowHint:=false;
           groupbox1.ShowHint:=true;
           Label3.Caption:=' 起始单据号';
           label3.FocusControl:=edit3;
           Label4.Caption:=' 截止单据号';
           label4.FocusControl:=edit4;
           tjm:=copy(Label3.Caption,5,6);
         end;
    end;
end;

procedure TForm4.BitBtn1Click(Sender: TObject);
var
  djs,zje:integer;
begin
  djs:=0;
  zje:=0;
  adoquery1.Active:=true;
  adotable2.Active:=true;
  if not CheckBox1.Checked then
    begin
      case RadioGroup1.ItemIndex of
      0:
         begin
           if (edit3.Text='')or (edit4.Text='') then   {如果没有输入统计日期警告退出过程}
             begin
               showmessage('请输入统计日期');
               exit;
             end
           else
             begin
               adoquery1.Close;
               adoquery1.sql.Clear;
               adoquery1.sql.add('select * from dj_b where sfrq>=#'+edit3.text+'#  and sfrq<=#'+edit4.text+'#');
               adoquery1.open;
               adoquery1.first;
               while not adoquery1.Eof  do
                 begin
                   if adoquery1.fieldbyname('zf').value='false' then
                     begin
                       zje:=zje+adoquery1.fieldbyname('ss').value;
                       djs:=djs+1;
                       adoquery1.Next;
                     end
                   else  adoquery1.Next;
                 end;
               edit1.Text:=inttostr(zje);
               edit2.Text:=inttostr(djs);
               label2.Caption:='有效单据数';
             end;
         end;
      1:
         begin
           if (edit3.Text='')or (edit4.Text='') then  {如果没有输入统计的收费人号警告退出过程}
             begin
               showmessage('请输入统计的收费人号');
               exit;
             end
           else
             begin
               adoquery1.Close;
               adoquery1.SQL.Clear;
               adoquery1.SQL.add('select * from dj_b where (sfrh>='+''''+edit3.text+''') and( sfrh<='+''''+edit4.text+''')');
               adoquery1.open;
               adoquery1.first;
               while not adoquery1.Eof  do
                 begin
                   if adoquery1.fieldbyname('zf').value='false' then
                     begin
                       zje:=zje+adoquery1.fieldbyname('ss').value;
                       djs:=djs+1;
                       adoquery1.Next;
                     end
                   else
                     adoquery1.Next;
                 end;
               edit1.Text:=inttostr(zje);
               edit2.Text:=inttostr(djs);
               label2.Caption:='有效单据数';
             end;
         end;
      2:
         begin
           if (edit3.Text='')or (edit4.Text='') then {如果没有输入统计的单据号警告退出过程}
             begin
               showmessage('请输入统计的单据号');
               exit;
             end
           else
             begin
               adoquery1.Close;
               adoquery1.SQL.Clear;
               adoquery1.SQL.add('select * from dj_b where (djh>='+''''+edit3.text+''') and( djh<='+''''+edit4.text+''')');
               adoquery1.open;
               adoquery1.first;

               while not adoquery1.Eof  do
                 begin
                   if adoquery1.fieldbyname('zf').value='false'  then
                     begin
                       zje:=zje+adoquery1.fieldbyname('ss').value;
                       djs:=djs+1;
                       adoquery1.Next;
                     end
                   else
                     adoquery1.Next;
                 end;
               edit1.Text:=inttostr(zje);
               edit2.Text:=inttostr(djs);
               label2.Caption:='有效单据数';
             end;
         end;
      end;
    end
  else
     begin
      case RadioGroup1.ItemIndex of
      0:
         begin
           if (edit3.Text='')or (edit4.Text='') then   {如果没有输入统计日期警告退出过程}
             begin
               showmessage('请输入统计日期');
               exit;
             end
           else
             begin
               adoquery1.Close;
               adoquery1.sql.Clear;
               adoquery1.sql.add('select * from dj_b where sfrq>=#'+edit3.text+'#  and sfrq<=#'+edit4.text+'#');
               adoquery1.open;
               adoquery1.first;
               while not adoquery1.Eof  do
                 begin
                   if adoquery1.fieldbyname('zf').value='true' then
                     begin
                       zje:=zje+adoquery1.fieldbyname('ss').value;
                       djs:=djs+1;
                       adoquery1.Next;
                     end
                   else  adoquery1.Next;
                 end;
               edit1.Text:=inttostr(zje);
               edit2.Text:=inttostr(djs);
               label2.Caption:='作废单据数';
             end;

⌨️ 快捷键说明

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