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

📄 u_settuition.pas

📁 一个简单的学籍管理软件
💻 PAS
字号:
unit U_SetTuition;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  HGrids, HDBGrids, TB97Tlbr, TB97Ctls, TB97, DBTables, Db, Menus;

type
  TFm_SetTuition = class(TForm)
    DDS: TDataSource;
    Dock: TDock97;
    Tb97_Func: TToolbar97;
    TbBtn_Help: TToolbarButton97;
    TbBtn_Exit: TToolbarButton97;
    TbBtn_Power: TToolbarButton97;
    TbSep02: TToolbarSep97;
    MGrid: THDBGrid;
    DQuery: TQuery;
    DUpSQL: TUpdateSQL;
    PPM: TPopupMenu;
    M_Copy: TMenuItem;
    M_Help: TMenuItem;
    M_Exit: TMenuItem;
    M_Z02: TMenuItem;
    DQueryS_XQHAO: TStringField;
    DQuerySI_NJI: TSmallintField;
    DQueryN_SFEI: TFloatField;
    DQueryN_XFEI: TFloatField;
    DQueryN_ZFEI: TFloatField;
    DQueryN_QTA: TFloatField;
    DQueryN_HJI: TFloatField;
    DQueryS_BZHU: TStringField;
    UpQuery: TQuery;
    TbBtn_Print: TToolbarButton97;
    TbSp01: TToolbarSep97;
    PM_Print: TMenuItem;
    PM_Z02: TMenuItem;
    procedure TbBtn_ExitClick(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure DQueryBeforePost(DataSet: TDataSet);
    procedure DQueryAfterPost(DataSet: TDataSet);
    procedure TbBtn_PrintClick(Sender: TObject);
  private
    //procedure RefreshQuery;
  public
  end;

var
  Fm_SetTuition: TFm_SetTuition;

procedure Show_SetTuition;

implementation

uses U_Main, U_GlobalProc, U_GlobalVar, U_DM, U_Print;

{$R *.DFM}

procedure Show_SetTuition;
var
  i: integer;
begin
  for i := Fm_Main.MDIChildCount - 1 downto 0 do
  begin
    if (Fm_Main.MDIChildren[i].Name <> 'Fm_Wizard') and
      (Fm_Main.MDIChildren[i].Name <> 'Fm_SetTuition') then
      Fm_Main.MDIChildren[i].Close;
  end;
  if not Assigned(Fm_SetTuition) then
  begin
    Fm_SetTuition := TFm_SetTuition.Create(Application);
    with Fm_SetTuition do
    begin
      DQuery.ParamByName('ps_xqhao').AsString := S_CurTermCode;
      DQuery.Open;
      if DQuery.IsEmpty then
        MGrid.Options := MGrid.Options - [tgEditing];
    end;
    RefreshGridStyle(Fm_SetTuition.MGrid);
  end;
  with Fm_SetTuition do
  begin
    if WindowState <> wsMaximized then
      WindowState := wsMaximized;
    Show;
    SetFocus;
  end;
end;

{procedure TFm_SetTuition.RefreshQuery;
begin
  with DQuery do
  try
    DisableControls;
    Close;
    Open;
  finally
    EnableControls;
  end;
end;}

procedure TFm_SetTuition.TbBtn_ExitClick(Sender: TObject);
begin
  if DQuery.State = dsEdit then
    DQuery.Post;
  Close;
end;

procedure TFm_SetTuition.FormClose(Sender: TObject;
  var Action: TCloseAction);
begin
  DQuery.Close;
  Action := caFree;
  Fm_SetTuition := nil;
end;

procedure TFm_SetTuition.DQueryBeforePost(DataSet: TDataSet);
begin
  with DQuery do
  begin
    FieldByName('n_hji').AsFloat := FieldByName('n_sfei').AsFloat +
      FieldByName('n_xfei').AsFloat + FieldByName('n_zfei').AsFloat +
      FieldByName('n_qta').AsFloat; 
  end;
end;

procedure TFm_SetTuition.DQueryAfterPost(DataSet: TDataSet);
begin
  DQuery.ApplyUpdates;
  with DQuery do
  begin
    UpQuery.ParamByName('pn_sfei').AsFloat  := FieldByName('n_sfei').AsFloat;
    UpQuery.ParamByName('pn_xfei').AsFloat  := FieldByName('n_xfei').AsFloat;
    UpQuery.ParamByName('pn_zfei').AsFloat  := FieldByName('n_zfei').AsFloat;
    UpQuery.ParamByName('pn_qta').AsFloat   := FieldByName('n_qta').AsFloat;
    UpQuery.ParamByName('pn_hji').AsFloat   := FieldByName('n_hji').AsFloat;
    UpQuery.ParamByName('ps_xqhao').AsString:= FieldByName('s_xqhao').AsString;
    UpQuery.ParamByName('psi_nji').AsString := FieldByName('si_nji').AsString;
    UpQuery.ExecSQL;
  end;
end;

procedure TFm_SetTuition.TbBtn_PrintClick(Sender: TObject);
begin
  Show_Print(MGrid);
end;

end.

⌨️ 快捷键说明

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