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

📄 uscore.pas

📁 针对商品与仓库存储商品等信息的管理及维护的管理软件。它能够辅助仓库管理人员对供应商信息、商品基本信息以及商品入库、出库、库存信息查询等进行控制管理
💻 PAS
📖 第 1 页 / 共 2 页
字号:

procedure TFrmscore.BtnDelClick(Sender: TObject);
begin
if pagecontrol1.ActivePageIndex =1 then exit;
if MaindFrm.CheckPermission(UserID,'mark004')=False then exit;
normalmode;
if messagebox(Application.Handle,'如果您点确定键此条记录将被删除','警告',
mb_ICONWarning+mb_yesno+mb_defbutton2)= mryes then
with MainDFrm do
begin
   normalmode;
//   checkboxnull;
//   Uqutil.DeleteSQL.Clear;
//   Uqutil.DeleteSQL.Add('DELETE FROM CourseMark ');
//   Uqutil.DeleteSQL.Add('WHERE bID ='''+dbbID.Text+'''');
//   Uqutil.DeleteSQL.Add('and cStyle ='''+dbcStyle.Text+'''');
//   Uqutil.DeleteSQL.Add('and Term ='''+dbTerm.Text+'''');
//   Uqutil.DeleteSQL.Add('and ccID ='''+dbccID.Text+'''');

 UQutil.DeleteSQL.Clear;
 UQutil.DeleteSQL.Add('delete from CourseMark');
 UQutil.DeleteSQL.Add('where  bID='''+dbbID.Text+'''');
 UQutil.DeleteSQL.Add('and    cID='''+dbcID.Text+'''');
 UQutil.DeleteSQL.Add('and   ccID='''+dbccID.Text+'''');
// UQutil.DeleteSQL.Add('and   Mark='''+dbmark.Field.Value+'''');
 UQutil.DeleteSQL.add('and   Term='''+dbTerm.Text+'''');
 UQutil.DeleteSQL.Add('and cStyle='''+dbcStyle.Text+'''');

  try
    qutil.Delete;
//    qutil.Post;
    qutil.Database.StartTransaction;
    qutil.ApplyUpdates;
    qutil.CommitUpdates;
    qutil.Database.Commit;
  except
    qutil.Database.Rollback;
    qutil.CancelUpdates;
    ShowMessage('存盘失败!');
  end;
end;
normalmode;
end;

procedure TFrmscore.BtnYesClick(Sender: TObject);
begin
with MainDFrm do
begin
  if formmode = 'ins' then
  begin
   Qgrant.SQL.Clear;
   Qgrant.SQL.Add('select * from CourseMark');
   Qgrant.SQL.Add('WHERE bID ='''+dbbID.Text+'''');
   Qgrant.SQL.Add('and cStyle ='''+dbcStyle.Text+'''');
   Qgrant.SQL.Add('and Term ='''+dbTerm.Text+'''');
   Qgrant.SQL.Add('and ccID ='''+dbccID.Text+'''');
   Qgrant.Close;
   Qgrant.Open;
   if not Qgrant.Eof then
   begin
     showmessage('你已经录入了该学生的成绩!');
     dbMark.SelectAll;
     dbMark.SetFocus;
     exit;
   end;
  end;
  if (StrtoFloat(dbMark.Text)<0) or (StrtoFloat(dbMark.Text)>150) then
  begin
     showmessage('录入成绩无效!');
     dbMark.SelectAll;
     dbMark.SetFocus;
     exit;
   end;
  //  qutil.FieldByName('Mark').AsFloat :=strtofloat(dbMark.Text);
  try
    qutil.Post;
    qutil.Database.StartTransaction;
    qutil.ApplyUpdates;
    qutil.UpdateStatus;
    qutil.Database.Commit;
  except
    qutil.Database.Rollback;
    qutil.CancelUpdates;
    ShowMessage('存盘失败!');
  end;
  qutil.Close;
  Qutil.Open;
end;

normalmode;
end;

procedure TFrmscore.BtnCancelClick(Sender: TObject);
begin
if messagebox(0,'确定不更新本条数据?','提示',
mb_ICONInformation+mb_yesno+mb_defbutton2)= mryes then
begin
 MainDFrm.qutil.Cancel;
 normalmode;
end;
end;

procedure TFrmscore.BtnCloseClick(Sender: TObject);
begin
close;
end;

procedure TFrmscore.ListBox1Click(Sender: TObject);
var
 tmpID:string ;
 i:integer;
begin
 if listbox1.ItemIndex<0 then exit;
 tmpID := listbox1.Items.Strings[listbox1.ItemIndex];
     i := pos('|',tmpID);
 tmpID := copy(tmpID,1,i-1);
 with MainDFrm do
 begin
 Qgrant.SQL.Clear;
 Qgrant.SQL.Add('select bID,bName from Arcinfo');
 Qgrant.SQL.Add('where cID='''+tmpID+'''');
 Qgrant.SQL.Add('order by bID');
 Qgrant.Close;
 Qgrant.Open;
 Qgrant.First;
 listbox3.Clear;
 while not Qgrant.Eof do
 begin
 tmpID := Qgrant.fields.fields[0].asstring +'| '
         + Qgrant.fields.fields[1].asstring ;
 listbox3.Items.Add(tmpID);
 Qgrant.next;
 end;
end;

end;

Function TFrmscore.checkboxnull:boolean;
begin
Result := true;
 if listbox1.ItemIndex<0 then
 begin
   showmessage('请选择班级!');
   ReSult := False;
 end;
 if listbox2.ItemIndex<0 then
 begin
   showmessage('请选择课程!');
   Result := False;
 end;
 if trim(boxStyle.Text)='' then
 begin
   showmessage('请选择考试类型!');
   Result := False;
 end;
 if trim(boxTerm.Text)='' then
 begin
   showmessage('请选择学年!');
   Result := False;
 end;

end;

procedure TFrmscore.btnw1Click(Sender: TObject);
begin
Application.Terminate;
end;

procedure TFrmscore.dbmarkKeyPress(Sender: TObject; var Key: Char);
begin
if key=#13 then btnYes.Click;
end;

procedure TFrmscore.DBGrid1ColumnMoved(Sender: TObject; FromIndex,
  ToIndex: Integer);
begin
showmessage('moved to'+inttostr(DBGrid1.SelectedIndex));

end;

procedure TFrmscore.btnqueryClick(Sender: TObject);
var
tmpID:string;
i :integer;
begin
if checkboxnull= false then exit;
with MainDFrm do
begin
  Qutil.SQL.Clear;
  Qutil.SQL.Add('select * from subject');

     tmpID := listbox1.Items[listbox1.itemindex];
        i  := pos('|',tmpID);
     tmpID := copy(tmpID,1,i-1);
  Qutil.SQL.Add('where cID='''+tmpID+'''');
     tmpID := listbox2.Items[listbox2.itemindex];
        i  := pos('|',tmpID);
     tmpID := copy(tmpID,1,i-1);
  Qutil.SQL.Add('and ccID='''+tmpID+'''');
  Qutil.SQL.Add('and Term='''+boxTerm.Items[boxTerm.itemindex]+'''');
  Qutil.SQL.Add('and cStyle='''+boxStyle.Items[boxStyle.itemindex]+'''');
  Qutil.SQL.Add('order by Mark desc');
  Qutil.Close;
  Qutil.Open;
Caption := '成绩管理--'+dbcClass.Text;
  end;
end;

procedure TFrmscore.SpeedButton2Click(Sender: TObject);
var
tmpcID,tmpccID,str:string;
i :integer;
begin
str := '';
if trim(boxterm.Text) <> '' then
str := str+'and Term='''+boxterm.text+'''';
if trim(boxstyle.Text)<>'' then
str := str+ 'and cStyle='''+boxStyle.Text+'''';

  if listbox1.ItemIndex >= 0 then
  begin
  tmpcID := listbox1.Items[listbox1.itemindex];
      i  := pos('|',tmpcID);
  tmpcID := copy(tmpcID,1,i-1);
  str := str + 'and cID='''+tmpcID+'''';
  end;
  if listbox2.ItemIndex >=0 then
  begin
   tmpccID := listbox2.Items[listbox2.itemindex];
        i  := pos('|',tmpccID);
   tmpccID := copy(tmpccID,1,i-1);
   str := str + 'and ccID='''+tmpccID+'''';
  end;
  delete(str,1,3);
  if str = '' then
  begin
   showmessage('必须选择班级、课程、学年、类型中的一项以上!');
   exit;
  end;
 with MainDFrm do
begin
  Qgrant.SQL.Clear;
  Qgrant.SQL.Add('select count(Mark) from subject');
  Qgrant.SQL.Add('where '+str);
  Qgrant.SQL.Add(' and Mark>=90');
  Qgrant.Close;
  Qgrant.Open;
  edit1.Text := Qgrant.Fields.Fields[0].AsString;

  Qgrant.SQL.Clear;
  Qgrant.SQL.Add('select count(Mark) from subject');
  Qgrant.SQL.Add('where '+str);
  Qgrant.SQL.Add('and Mark>=80 and Mark<90' );
  Qgrant.Close;
  Qgrant.Open;
  edit2.Text := Qgrant.Fields.Fields[0].AsString;

  Qgrant.SQL.Clear;
  Qgrant.SQL.Add('select count(Mark) from subject');
  Qgrant.SQL.Add('where '+str);
  Qgrant.SQL.Add('and Mark>=70 and Mark<80' );
  Qgrant.Close;
  Qgrant.Open;
  edit3.Text := Qgrant.Fields.Fields[0].AsString;

  Qgrant.SQL.Clear;
  Qgrant.SQL.Add('select count(Mark) from subject');
  Qgrant.SQL.Add('where '+str);
  Qgrant.SQL.Add('and Mark>=60 and Mark<70' );
  Qgrant.Close;
  Qgrant.Open;
  edit4.Text := Qgrant.Fields.Fields[0].AsString;

  Qgrant.SQL.Clear;
  Qgrant.SQL.Add('select count(Mark) from subject');
  Qgrant.SQL.Add('where '+str);
  Qgrant.SQL.Add('and  Mark<60' );
  Qgrant.Close;
  Qgrant.Open;
  edit5.Text := Qgrant.Fields.Fields[0].AsString;

  Qgrant.SQL.Clear;
  Qgrant.SQL.Add('select max(Mark),min(Mark),avg(Mark) from subject');
  Qgrant.SQL.Add('where '+str);
  Qgrant.Close;
  Qgrant.Open;
  edit6.Text := Qgrant.Fields.Fields[0].AsString;
  edit7.Text := Qgrant.Fields.Fields[1].AsString;
  edit8.Text := Qgrant.Fields.Fields[2].AsString;

  Qutil.SQL.Clear;
  Qutil.SQL.Add('select * from subject');
  Qutil.SQL.Add('where '+str);
  Qutil.SQL.add('order by cID,bID,mark');
//  Qutil.SQL.Add('compute sum(mark) by cID');
  Qutil.Close;
  Qutil.Open;

  end;
  if listbox1.ItemIndex >= 0 then
  tmpcID := listbox1.Items[listbox1.itemindex];
      i  := pos('|',tmpcID);
  delete(tmpcID,1,i);
  if listbox2.ItemIndex >= 0 then
 tmpccID := listbox2.Items[listbox2.itemindex];
      i  := pos('|',tmpccID);
 delete(tmpccID,1,i);
  edit9.Text :=tmpcID+'-'+tmpccID+boxTerm.Text
  +'|' + boxStyle.Text +'-成绩汇总表';
end;

procedure TFrmscore.BtnSetClick(Sender: TObject);
var
  repmark: Trepmark;
begin
if MaindFrm.CheckPermission(UserID,'mark005')=False then exit;
  repmark := Trepmark.Create(Application);
  try
    repmark.ShowModal;
  finally
    repmark.Free;
  end;
end;

procedure TFrmscore.BtnPreviewClick(Sender: TObject);
var
  repmark: Trepmark;
begin
if MaindFrm.CheckPermission(UserID,'mark006')=False then exit;
  repmark := Trepmark.Create(Application);
  try

  finally
    repmark.Free;
  end;

end;

procedure TFrmscore.BtnPrintClick(Sender: TObject);
var
  repmark: Trepmark;
begin
if MaindFrm.CheckPermission(UserID,'mark005')=False then exit;
  repmark := Trepmark.Create(Application);
  try

  finally
    repmark.Free;
  end;
end;

procedure TFrmscore.PageControl1Change(Sender: TObject);
begin
if Pagecontrol1.ActivePageIndex = 1 then
begin
 listbox1.ItemIndex := -1;
 listbox2.ItemIndex := -1;
// listbox3.ItemIndex := -1;
end;
end;

end.

⌨️ 快捷键说明

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