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

📄 ucjgl.pas

📁 完善的学生管理系统源码 适用于毕业设计和各种小的设计
💻 PAS
📖 第 1 页 / 共 3 页
字号:
unit Ucjgl;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ComCtrls, ExtCtrls, StdCtrls, ActnList, ToolWin, XPMenu, ImgList,
  Buttons, ADODB, DB, Mask, Spin, Grids, DBGrids, Report_Public;

type
  TFmcjgl = class(TForm)
    PageControl1: TPageControl;
    TabSheet1: TTabSheet;
    TabSheet2: TTabSheet;
    ActionList1: TActionList;
    Panel1: TPanel;
    XPMenu1: TXPMenu;
    ImageList1: TImageList;
    Actigetxslb: TAction;
    Actgetkclb: TAction;
    Panel2: TPanel;
    ADOQuery1: TADOQuery;
    GroupBox1: TGroupBox;
    Label7: TLabel;
    Edit5: TEdit;
    Label1: TLabel;
    Label2: TLabel;
    Edit1: TEdit;
    Label3: TLabel;
    Edit2: TEdit;
    Label4: TLabel;
    Label5: TLabel;
    Edit4: TEdit;
    Label6: TLabel;
    Edit3: TEdit;
    BitBtn1: TBitBtn;
    BitBtn2: TBitBtn;
    Splitter3: TSplitter;
    GroupBox2: TGroupBox;
    Memo1: TMemo;
    SpeedButton1: TSpeedButton;
    SpeedButton2: TSpeedButton;
    SpeedButton3: TSpeedButton;
    OpenDialog1: TOpenDialog;
    SaveDialog1: TSaveDialog;
    BitBtn3: TBitBtn;
    Actgetno: TAction;
    Actgetname: TAction;
    Splitter2: TSplitter;
    ToolBar1: TToolBar;
    ToolButton7: TToolButton;
    ToolButton1: TToolButton;
    ToolButton8: TToolButton;
    ToolButton2: TToolButton;
    ToolButton9: TToolButton;
    ToolButton3: TToolButton;
    ToolButton10: TToolButton;
    ToolButton4: TToolButton;
    ToolButton11: TToolButton;
    LV1: TListView;
    ListBox2: TListBox;
    Splitter1: TSplitter;
    Splitter4: TSplitter;
    GroupBox3: TGroupBox;
    Splitter5: TSplitter;
    ComboBox1: TComboBox;
    ComboBox2: TComboBox;
    Panel3: TPanel;
    GroupBox6: TGroupBox;
    stb: TStatusBar;
    Panel4: TPanel;
    GroupBox5: TGroupBox;
    Label8: TLabel;
    Label12: TLabel;
    Label9: TLabel;
    Label10: TLabel;
    Label11: TLabel;
    Label13: TLabel;
    Label14: TLabel;
    CBOtjy: TComboBox;
    CBOtje: TComboBox;
    CBOfwy: TComboBox;
    Edgjzy: TEdit;
    Edgjze: TEdit;
    cbogxy: TComboBox;
    CBOfwe: TComboBox;
    BitBtn4: TBitBtn;
    GroupBox4: TGroupBox;
    Label15: TLabel;
    Label16: TLabel;
    Label17: TLabel;
    Label18: TLabel;
    ComboBox3: TComboBox;
    ComboBox4: TComboBox;
    ComboBox5: TComboBox;
    Label19: TLabel;
    Edit6: TEdit;
    Label20: TLabel;
    BitBtn5: TBitBtn;
    BitBtn6: TBitBtn;
    BitBtn7: TBitBtn;
    ADOTable1: TADOTable;
    DBGrid1: TDBGrid;
    DataSource1: TDataSource;
    Edit7: TEdit;
    Edit8: TEdit;
    Splitter6: TSplitter;
    ADOQuery2: TADOQuery;
    DataSource2: TDataSource;
    ADOQuery9: TADOQuery;
    Panel5: TPanel;
    Splitter7: TSplitter;
    Panel6: TPanel;
    Panel8: TPanel;
    Label21: TLabel;
    ComboBox8: TComboBox;
    ComboBox7: TComboBox;
    Edit9: TEdit;
    ComboBox6: TComboBox;
    Panel9: TPanel;
    Memo2: TMemo;
    CheckBox1: TCheckBox;
    BitBtn9: TBitBtn;
    BitBtn8: TBitBtn;
    Panel7: TPanel;
    DBGrid2: TDBGrid;
    ListView1: TListView;
    BitBtn10: TBitBtn;
    ADOQuery3: TADOQuery;
    SReport1: TSReport;
    BitBtn11: TBitBtn;
    BitBtn12: TBitBtn;
    procedure ComboBox1Change(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure ActigetxslbExecute(Sender: TObject);
    procedure LV1SelectItem(Sender: TObject; Item: TListItem;
      Selected: Boolean);
    procedure SpeedButton1Click(Sender: TObject);
    procedure LV1Editing(Sender: TObject; Item: TListItem;
      var AllowEdit: Boolean);
    procedure ActgetkclbExecute(Sender: TObject);
    procedure BitBtn1Click(Sender: TObject);
    procedure BitBtn2Click(Sender: TObject);
    procedure ListBox2Click(Sender: TObject);
    procedure SpeedButton3Click(Sender: TObject);
    procedure SpeedButton2Click(Sender: TObject);
    procedure BitBtn3Click(Sender: TObject);
    procedure ActgetnoExecute(Sender: TObject);
    procedure ActgetnameExecute(Sender: TObject);
    procedure BitBtn4Click(Sender: TObject);
    procedure BitBtn6Click(Sender: TObject);
    procedure DataSource1DataChange(Sender: TObject; Field: TField);
    procedure BitBtn7Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure ComboBox3Change(Sender: TObject);
    procedure ComboBox4Change(Sender: TObject);
    procedure BitBtn5Click(Sender: TObject);
    procedure CheckBox1Click(Sender: TObject);
    procedure ComboBox6Change(Sender: TObject);
    procedure BitBtn9Click(Sender: TObject);
    procedure DBGrid2EndDock(Sender, Target: TObject; X, Y: Integer);
    procedure Panel7DockDrop(Sender: TObject; Source: TDragDockObject; X,
      Y: Integer);
    procedure DBGrid2StartDock(Sender: TObject;
      var DragObject: TDragDockObject);
    procedure Panel7DblClick(Sender: TObject);
    procedure BitBtn8Click(Sender: TObject);
    procedure ListView1Editing(Sender: TObject; Item: TListItem;
      var AllowEdit: Boolean);
    procedure BitBtn10Click(Sender: TObject);
    procedure BitBtn11Click(Sender: TObject);
    procedure BitBtn12Click(Sender: TObject);
  private
    { Private declarations }
  public
  function writeCjToDb():boolean;
  procedure getXiBieLista();
  function gettj():string;
  procedure getKM();
  function getgod(xj,sj:string):string ;
  procedure beginBt(he:boolean);
  procedure beginBtkm();
   procedure beginBtbj();
   procedure Bttj();
    { Public declarations }
  end;

var
  Fmcjgl: TFmcjgl;
  isxuan:boolean;
implementation

uses Udata;

{$R *.dfm}
procedure TFMcjgl.Bttj();
var
strsql:string;
strbj,strxq,strkc,strgn:string;
strgn2:string;
begin
strbj:=trim(combobox6.Text);
 strxq:=trim(edit9.Text) ;
 strkc:=trim(combobox7.Text);
 case combobox8.ItemIndex of
 1:begin
 strgn:='avg';
 strgn2:='班平均分';
 end;
 2:begin
 strgn:='sum';
 strgn2:='班级总分';
 end;
 3:begin
 strgn:='max';
 strgn2:='班最高分'
 end;
 4:begin
 strgn:='min';
 strgn2:='班最低分'
 end;
 end;
 if strxq<>''  then  begin
   if combobox7.ItemIndex =0 then begin
   case combobox8.ItemIndex of
   1,2:
   strsql:='select cbjb_bjm as 班级,ccjb_xq as 学期,'+strgn+
     '(ccjb_cj) as '+strgn2+' from tbjb,tcjb where cbjb_bjm='''+strbj+''''+
        ' and ccjb_xq='''+strxq+''' and ccjb_xh in('+
        'select cxsb_xh from txsb where cxsb_bj ='''+strbj+''') group by ccjb_xq,cbjb_bjm' ;
   3,4:
    strsql:='select cxsb_bj as 班级,cxsb_xh as 学号,cxsb_xm as 姓名,ccjb_xq as 学期,ccjb_kc as '+strkc+','+strgn+
     '(ccjb_cj) as '+strgn2+' from tcjb,txsb where cxsb_bj='''+strbj+'''and ccjb_xq='''+strxq+
        ''' and ccjb_xh in('+'select cxsb_xh from txsb where cxsb_bj ='''+
        strbj+''') group by ccjb_xq,ccjb_kc,cxsb_bj,cxsb_xh,cxsb_xm';
   end;
   end
   else begin
   case combobox8.ItemIndex of
   1,2:
    strsql:='select cbjb_bjm as 班级,ccjb_xq as 学期,ccjb_kc as '+strkc+','+strgn+
     '(ccjb_cj) as '+strgn2+' from tbjb,tcjb where cbjb_bjm='''+strbj+'''and ccjb_kc='''+strkc+
        ''' and ccjb_xq='''+strxq+''' and ccjb_xh in('+
        'select cxsb_xh from txsb where cxsb_bj ='''+strbj+''') group by ccjb_xq,ccjb_kc,cbjb_bjm' ;
   3,4:
     strsql:='select cxsb_bj as 班级,cxsb_xh as 学号,cxsb_xm as 姓名,ccjb_xq as 学期,ccjb_kc as '+strkc+','+strgn+
     '(ccjb_cj) as '+strgn2+' from tcjb,txsb where cxsb_bj='''+strbj+'''and ccjb_xq='''+strxq+
        ''' and ccjb_kc='''+strkc+''' and ccjb_xh in('+'select cxsb_xh from txsb where cxsb_bj ='''+
        strbj+''') group by ccjb_xq,ccjb_kc,cxsb_bj,cxsb_xh,cxsb_xm';
   end;
   end;
   end
   else begin
   if combobox7.ItemIndex =0 then begin
   case combobox8.ItemIndex of
   1,2:
   strsql:='select cbjb_bjm as 班级,ccjb_xq as 学期,'+strgn+
     '(ccjb_cj) as '+strgn2+' from tbjb,tcjb where cbjb_bjm='''+strbj+''''+
        ' and ccjb_xh in('+
        'select cxsb_xh from txsb where cxsb_bj ='''+strbj+''') group by ccjb_xq,cbjb_bjm' ;
   3,4:
     strsql:='select cxsb_bj as 班级,cxsb_xh as 学号,cxsb_xm as 姓名,ccjb_xq as 学期,'+strgn+
     '(ccjb_cj) as '+strgn2+' from tcjb,txsb where cxsb_bj='''+strbj+''''+
        ' and ccjb_xh in('+'select cxsb_xh from txsb where cxsb_bj ='''+
        strbj+''') group by ccjb_xq,cxsb_bj,cxsb_xh,cxsb_xm';
   end;
   end
   else begin
   case combobox8.ItemIndex of
   1,2:
    strsql:='select cbjb_bjm as 班级,ccjb_xq as 学期,'+strgn+
     '(ccjb_cj) as '+strgn2+' from tbjb,tcjb where cbjb_bjm='''+strbj+'''and ccjb_kc='''+strkc+
        ' and ccjb_xq='''+strxq+''' and ccjb_xh in('+
        'select cxsb_xh from txsb where cxsb_bj ='''+strbj+''') group by ccjb_xq,ccjb_kc,cbjb_bjm' ;
   3,4:
     strsql:='select cxsb_bj as 班级,cxsb_xh as 学号,cxsb_xm as 姓名,ccjb_xq as 学期,ccjb_kc as '+strkc+','+strgn+
     '(ccjb_cj) as '+strgn2+' from tcjb,txsb where cxsb_bj='''+strbj+''''+
        ' and ccjb_xh in('+'select cxsb_xh from txsb where cxsb_bj ='''+
        strbj+''') group by ccjb_xq,ccjb_kc,cxsb_bj';
   end;
   end;
   end;
showmessage(strsql);
try
  adoquery2.Close;
  adoquery2.SQL.Clear;
  adoquery2.SQL.Add(strsql);
  adoquery2.Open;

except
//adoquery1.Close;
 end;


end;
procedure TFMcjgl.beginBtbj();
 var
 strsql:string;
begin
strsql:='select cbjb_bjm from tbjb';
 try
// showmessage(strsql);
  adoquery1.Close;
  adoquery1.SQL.Clear;
  adoquery1.SQL.Add(strsql);
  adoquery1.Open;
  ComboBox6.Clear;
  combobox6.Items.Add('选择班级');
   while not adoquery1.Eof do
  begin
    ComboBox6.Items.Add(adoquery1.FieldValues['cbjb_bjm']);
  adoquery1.Next;
  combobox6.ItemIndex := 0;
  end;
  except
  end;
  end;
procedure TFMcjgl.beginBtkm();
 var
 strsql:string;
begin
if combobox6.ItemIndex <1 then
strsql:='select ckcb_kc from tkcb'
else
  strsql:='select ckcb_kc from tkcb where ckcb_kc in('+
          'select ckcb2_kc from tkcb2 where ckcb2_bj='''+trimright(combobox6.Text)+''')';
 try
// showmessage(strsql);
  adoquery1.Close;
  adoquery1.SQL.Clear;
  adoquery1.SQL.Add(strsql);
  adoquery1.Open;
  ComboBox7.Clear;
  combobox7.Items.Add('选择课程');
   while not adoquery1.Eof do
  begin
    ComboBox7.Items.Add(adoquery1.FieldValues['ckcb_kc']);
  adoquery1.Next;
  combobox7.ItemIndex := 0;
  end;
finally
adoquery1.Close;
 end;
end;
procedure TFMcjgl.beginBt(he:boolean);
begin
combobox6.Enabled:=he;
combobox7.Enabled:=he;
combobox8.Enabled:=he;
edit9.Enabled:=he;
bitbtn8.Enabled :=he;
bitbtn9.Enabled :=he;
memo2.Enabled:=he;
dbgrid2.Enabled:=he;
listview1.Enabled:=he;
end;
function TFmcjgl.getgod(xj,sj:string):string ;
var
intX,intB,intK,intQ:integer;
strsql,bet:string;
strxq,strxb,strbj,strkc:string;
begin
bet:=' ccjb_cj between '+xj+' and '+sj;
strxb:=trimright(combobox3.Text);
strbj:=trimright(combobox4.Text);
strkc:=trimright(combobox5.Text) ;
strxq:=edit6.Text ;

if combobox3.ItemIndex <1 then intx:=0
else intx:=1;
if combobox4.ItemIndex <1 then intb:=0
else intb:=1;
if combobox5.ItemIndex <1 then intk:=0
else intk:=1;
if trim(edit6.Text)='' then intQ:=0
else intq:=1;
//showmessage(inttostr(int
 if (intx=0) and (intb=0) and (intk=0) and (intq=0) then   //1
 strsql:='select * from tcjb where'+bet;
 if (intx=0) and (intb=0) and (intk=0) and (intq=1) then    //2
 strsql:='select * from tcjb where ccjb_xq='''+strxq+''' and'+bet;
 if (intx=0) and (intb=0) and (intk=1) and (intq=0) then     //3
 strsql:='select * from tcjb where ccjb_kc='''+strkc+''' and'+bet;
 if (intx=0) and (intb=1) and (intk=0) and (intq=0) then    //4
 strsql:='select * from tcjb where ccjb_xh in('+
         'select cxsb_xh from txsb  where cxsb_bj = '''+strbj+''') and'+bet;
 if (intx=0) and (intb=0) and (intk=1) and (intq=1) then     //5
 strsql:='select * from tcjb where ccjb_kc='''+strkc+
         ''' and ccjb_xq='''+strxq+''' and '+bet;
 if (intx=0) and (intb=1) and (intk=0) and (intq=1) then     //6
 strsql:='select * from tcjb where ccjb_xh  in('+
         'select cxsb_xh from txsb  where cxsb_bj = '''+strbj+''') and ccjb_xq='''+strxq+''' and'+bet;
 if (intx=0) and (intb=1) and (intk=1) and (intq=0) then     //7
 strsql:='select * from tcjb where ccjb_xh  in('+
         'select cxsb_xh from txsb  where cxsb_bj = '''+strbj+''') and ccjb_kc='''+strkc+''' and'+bet;
 if (intx=0) and (intb=1) and (intk=1) and (intq=1) then     //8
 strsql:='select * from tcjb where ccjb_xh  in('+

⌨️ 快捷键说明

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