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

📄 frm_hjgl.pas

📁 用Delphi 开发的一个 户籍管理系统
💻 PAS
📖 第 1 页 / 共 3 页
字号:
  if RDB.dst_tmp.Active then
    RDB.dst_tmp.Active := False;
  RDB.dst_tmp.CommandText := 'select id from  Sys_attribute where type=''' +
    TypeName + '''';
  RDB.dst_tmp.Open;
  if RDB.dst_tmp.RecordCount <= 0 then
    Result := False;
end;

procedure TFm_hjgl.act_findExecute(Sender: TObject);
var
  tab, ID: string;
begin
  tab := ds_FieldShow.DataSet.FieldByName('field').AsString;
  if not isAttribute(tab) then
  begin
    RDB.dst_people.Locate(tab, Trim(cbb_conditiontext.Text), [loCaseInsensitive,
      loPartialKey]);
    Exit;
  end;
  if RDB.dst_tmp.Active then
    RDB.dst_tmp.Active := False;
  RDB.dst_tmp.CommandText := 'select id from  Sys_attribute where type=''' +
    tab + ''' and Name=''' + Trim(cbb_conditiontext.Text) + '''';
  RDB.dst_tmp.Open;
  if RDB.dst_tmp.RecordCount <= 0 then
    Exit;
  RDB.dst_tmp.First;
  ID := RDB.dst_tmp.FieldByName('ID').AsString;
  RDB.dst_people.Locate(tab, id, [loCaseInsensitive, loPartialKey]);
end;

procedure TFm_hjgl.act_searchExecute(Sender: TObject);
var
  Sql, tab, ID, condition, Text: string;
begin
  if Pos('日期',cbb_field.Text)>0 then
  begin

  end;
  Text := cbb_conditiontext.Text;
  condition := ' = ';
  case cbb_condition.ItemIndex of
    0:
      begin
        condition := ' like ';
        Text := ' %' + text + '% ';
      end;
    1:
      begin
        condition := ' not like ';
        Text := ' %' + text + '% ';
      end;
    2: condition := ' like ';
    3: condition := ' > ';
    4: condition := ' < ';
    5: condition := ' <> ';
    6: condition := ' <= ';
    7: condition := ' >= ';
  end;
  tab := ds_FieldShow.DataSet.FieldByName('field').AsString;
  if not isAttribute(tab) then
  begin
    try
      Sql := 'select * from info_people where ' + tab + condition + '''' +
        Trim(Text) + '''';
      rdb.dst_people.Active := False;
      RDB.dst_people.CommandText := Sql;
      rdb.dst_people.Open;
    except
      Sql := 'select * from info_people where ' + tab + condition +
        Trim(Text) + '';
      rdb.dst_people.Active := False;
      RDB.dst_people.CommandText := Sql;
      rdb.dst_people.Open;
    end;
    Exit;
  end;
  if RDB.dst_tmp.Active then
    RDB.dst_tmp.Active := False;
  sql := 'select id from  Sys_attribute where type=''' +
    tab + ''' and Name ' + condition + '''' + Trim(Text) + '''';
  RDB.dst_tmp.CommandText := Sql;
  RDB.dst_tmp.Open;
  if RDB.dst_tmp.RecordCount <= 0 then
    exit;
  RDB.dst_tmp.First;
  ID := RDB.dst_tmp.FieldByName('ID').AsString;
  Sql := 'select * from info_people where ' + tab + ' = ' + ID + '';
  rdb.dst_people.Active := False;
  RDB.dst_people.CommandText := Sql;
  rdb.dst_people.Open;
end;

procedure TFm_hjgl.act_showallExecute(Sender: TObject);
var
  tab: string;
begin
  tab := 'select * from info_people';
  RDB.dst_people.Active := False;
  RDB.dst_people.CommandText := tab;
  RDB.dst_people.Active := true;
end;

procedure TFm_hjgl.tab_infocaculateChange(Sender: TObject);
begin
  case tab_infocaculate.ActivePage.PageIndex of
    0: ds_edit := ds_info_Conciliation;
    1: ds_edit := ds_info_handicapped;
    2: ds_edit := ds_info_jobless;
    3: ds_edit := ds_info_prisonPeople;
    4: ds_edit := ds_info_LowEnsure;
    5: ds_edit := ds_info_oldpeople;
  end;
  ds_edit.DataSet.Active := true;
end;

procedure TFm_hjgl.act_insert_tsryExecute(Sender: TObject);
begin
  if fm_sel_person = nil then
    fm_sel_person := Tfm_sel_person.Create(Application);
  if fm_sel_person.ShowModal = mrCancel then
    Exit;
  fm_sel_person.dst_person.Active := False;
  fm_sel_person.dst_person.CommandText :=
    'select * from info_people where isbmp=true';
  fm_sel_person.dst_person.Open;
  fm_sel_person.dst_person.First;
  while not fm_sel_person.dst_person.Eof do
  begin
    ds_edit.DataSet.Insert;
    ds_edit.DataSet.FieldByName('id').AsInteger :=
      fm_sel_person.dst_person.FieldByName('id').AsInteger;
    ds_edit.DataSet.FieldByName('code').AsString :=
      fm_sel_person.dst_person.FieldByName('code').AsString;
    ds_edit.DataSet.FieldByName('name').AsString :=
      fm_sel_person.dst_person.FieldByName('name').AsString;
    ds_edit.DataSet.FieldByName('doornumber').AsString :=
      fm_sel_person.dst_person.FieldByName('doornumber').AsString;
    ds_edit.DataSet.Post;
    fm_sel_person.dst_person.Next;
  end;
end;

procedure TFm_hjgl.act_edit_tsryExecute(Sender: TObject);
begin
  ds_edit.DataSet.Edit;
end;

procedure TFm_hjgl.act_delete_tsryExecute(Sender: TObject);
begin
  ds_edit.DataSet.Delete;
end;

procedure TFm_hjgl.act_post_tsryExecute(Sender: TObject);
begin
  ds_edit.DataSet.Post;
end;

procedure TFm_hjgl.act_cancel_tsryExecute(Sender: TObject);
begin
  ds_edit.DataSet.Cancel;
end;

procedure TFm_hjgl.act_first_tsryExecute(Sender: TObject);
begin
  ds_edit.DataSet.First;
end;

procedure TFm_hjgl.act_prior_tsryExecute(Sender: TObject);
begin
  ds_edit.DataSet.Prior;
end;

procedure TFm_hjgl.act_next_tsryExecute(Sender: TObject);
begin
  ds_edit.DataSet.Next;
end;

procedure TFm_hjgl.act_last_tsryExecute(Sender: TObject);
begin
  ds_edit.DataSet.Last;
end;

procedure TFm_hjgl.ds_info_prisonPeopleStateChange(Sender: TObject);
begin
  act_insert_tsry.Enabled := not (ds_info_prisonPeople.DataSet.State in
    [dsEdit, dsinsert]);
  act_edit_tsry.Enabled := not (ds_info_prisonPeople.DataSet.State in
    [dsEdit, dsinsert]);
  act_delete_tsry.Enabled := not (ds_info_prisonPeople.DataSet.State in
    [dsEdit, dsinsert]);
  act_post_tsry.Enabled := (ds_info_prisonPeople.DataSet.State in
    [dsEdit, dsinsert]);
  act_cancel_tsry.Enabled := (ds_info_prisonPeople.DataSet.State in
    [dsEdit, dsinsert]);
  pnl_info_prisonPeople.Enabled := (ds_info_prisonPeople.DataSet.State in
    [dsEdit, dsinsert]);
end;

procedure TFm_hjgl.ds_info_LowEnsureStateChange(Sender: TObject);
begin
  act_insert_tsry.Enabled := not (ds_info_LowEnsure.DataSet.State in
    [dsEdit, dsinsert]);
  act_edit_tsry.Enabled := not (ds_info_LowEnsure.DataSet.State in
    [dsEdit, dsinsert]);
  act_delete_tsry.Enabled := not (ds_info_LowEnsure.DataSet.State in
    [dsEdit, dsinsert]);
  act_post_tsry.Enabled := (ds_info_LowEnsure.DataSet.State in
    [dsEdit, dsinsert]);
  act_cancel_tsry.Enabled := (ds_info_LowEnsure.DataSet.State in
    [dsEdit, dsinsert]);
  pnl_info_LowEnsure.Enabled := (ds_info_LowEnsure.DataSet.State in
    [dsEdit, dsinsert]);
end;

procedure TFm_hjgl.ds_info_oldpeopleStateChange(Sender: TObject);
begin
  act_insert_tsry.Enabled := not (ds_info_oldpeople.DataSet.State in
    [dsEdit, dsinsert]);
  act_edit_tsry.Enabled := not (ds_info_oldpeople.DataSet.State in
    [dsEdit, dsinsert]);
  act_delete_tsry.Enabled := not (ds_info_oldpeople.DataSet.State in
    [dsEdit, dsinsert]);
  act_post_tsry.Enabled := (ds_info_oldpeople.DataSet.State in
    [dsEdit, dsinsert]);
  act_cancel_tsry.Enabled := (ds_info_oldpeople.DataSet.State in
    [dsEdit, dsinsert]);
  pnl_info_oldpeople.Enabled := (ds_info_oldpeople.DataSet.State in
    [dsEdit, dsinsert]);
end;

procedure TFm_hjgl.ds_info_joblessStateChange(Sender: TObject);
begin
  act_insert_tsry.Enabled := not (ds_info_jobless.DataSet.State in
    [dsEdit, dsinsert]);
  act_edit_tsry.Enabled := not (ds_info_jobless.DataSet.State in
    [dsEdit, dsinsert]);
  act_delete_tsry.Enabled := not (ds_info_jobless.DataSet.State in
    [dsEdit, dsinsert]);
  act_post_tsry.Enabled := (ds_info_jobless.DataSet.State in
    [dsEdit, dsinsert]);
  act_cancel_tsry.Enabled := (ds_info_jobless.DataSet.State in
    [dsEdit, dsinsert]);
  pnl_info_jobless.Enabled := (ds_info_jobless.DataSet.State in
    [dsEdit, dsinsert]);
end;

procedure TFm_hjgl.ds_info_ConciliationStateChange(Sender: TObject);
begin
  act_insert_tsry.Enabled := not (ds_info_Conciliation.DataSet.State in
    [dsEdit, dsinsert]);
  act_edit_tsry.Enabled := not (ds_info_Conciliation.DataSet.State in
    [dsEdit, dsinsert]);
  act_delete_tsry.Enabled := not (ds_info_Conciliation.DataSet.State in
    [dsEdit, dsinsert]);
  act_post_tsry.Enabled := (ds_info_Conciliation.DataSet.State in
    [dsEdit, dsinsert]);
  act_cancel_tsry.Enabled := (ds_info_Conciliation.DataSet.State in
    [dsEdit, dsinsert]);
  pnl_info_Conciliation.Enabled := (ds_info_Conciliation.DataSet.State in
    [dsEdit, dsinsert]);
end;

procedure TFm_hjgl.ds_info_handicappedStateChange(Sender: TObject);
begin
  act_insert_tsry.Enabled := not (ds_info_handicapped.DataSet.State in
    [dsEdit, dsinsert]);
  act_edit_tsry.Enabled := not (ds_info_handicapped.DataSet.State in
    [dsEdit, dsinsert]);
  act_delete_tsry.Enabled := not (ds_info_handicapped.DataSet.State in
    [dsEdit, dsinsert]);
  act_post_tsry.Enabled := (ds_info_handicapped.DataSet.State in
    [dsEdit, dsinsert]);
  act_cancel_tsry.Enabled := (ds_info_handicapped.DataSet.State in
    [dsEdit, dsinsert]);
  pnl_info_handicapped.Enabled := (ds_info_handicapped.DataSet.State in
    [dsEdit, dsinsert]);
end;

procedure TFm_hjgl.ds_info_prisonPeopleDataChange(Sender: TObject;
  Field: TField);
begin
  act_first_tsry.Enabled := not ds_info_prisonPeople.DataSet.Bof;
  act_prior_tsry.Enabled := not ds_info_prisonPeople.DataSet.Bof;
  act_next_tsry.Enabled := not ds_info_prisonPeople.DataSet.Eof;
  act_last_tsry.Enabled := not ds_info_prisonPeople.DataSet.Eof;
end;

procedure TFm_hjgl.ds_info_LowEnsureDataChange(Sender: TObject;
  Field: TField);
begin
  act_first_tsry.Enabled := not ds_info_LowEnsure.DataSet.Bof;
  act_prior_tsry.Enabled := not ds_info_LowEnsure.DataSet.Bof;
  act_next_tsry.Enabled := not ds_info_LowEnsure.DataSet.Eof;
  act_last_tsry.Enabled := not ds_info_LowEnsure.DataSet.Eof;
end;

procedure TFm_hjgl.ds_info_oldpeopleDataChange(Sender: TObject;
  Field: TField);
begin
  act_first_tsry.Enabled := not ds_info_oldpeople.DataSet.Bof;
  act_prior_tsry.Enabled := not ds_info_oldpeople.DataSet.Bof;
  act_next_tsry.Enabled := not ds_info_oldpeople.DataSet.Eof;
  act_last_tsry.Enabled := not ds_info_oldpeople.DataSet.Eof;
end;

procedure TFm_hjgl.ds_info_joblessDataChange(Sender: TObject;
  Field: TField);
begin
  act_first_tsry.Enabled := not ds_info_jobless.DataSet.Bof;
  act_prior_tsry.Enabled := not ds_info_jobless.DataSet.Bof;
  act_next_tsry.Enabled := not ds_info_jobless.DataSet.Eof;
  act_last_tsry.Enabled := not ds_info_jobless.DataSet.Eof;
end;

procedure TFm_hjgl.ds_info_ConciliationDataChange(Sender: TObject;
  Field: TField);
begin
  act_first_tsry.Enabled := not ds_info_Conciliation.DataSet.Bof;
  act_prior_tsry.Enabled := not ds_info_Conciliation.DataSet.Bof;
  act_next_tsry.Enabled := not ds_info_Conciliation.DataSet.Eof;
  act_last_tsry.Enabled := not ds_info_Conciliation.DataSet.Eof;
end;

procedure TFm_hjgl.ds_info_handicappedDataChange(Sender: TObject;
  Field: TField);
begin
  act_first_tsry.Enabled := not ds_info_handicapped.DataSet.Bof;
  act_prior_tsry.Enabled := not ds_info_handicapped.DataSet.Bof;
  act_next_tsry.Enabled := not ds_info_handicapped.DataSet.Eof;
  act_last_tsry.Enabled := not ds_info_handicapped.DataSet.Eof;
end;

procedure TFm_hjgl.cbb_fieldClick(Sender: TObject);
var
  tab, sql, Name: string;
begin
  cbb_conditiontext.Items.Clear;
  tab := ds_FieldShow.DataSet.FieldByName('field').AsString;
  if not isAttribute(tab) then
  begin
    if RDB.dst_tmp.Active then
      RDB.dst_tmp.Active := False;
    sql := 'select distinct ' + tab + ' from info_people';
    RDB.dst_tmp.CommandText := Sql;
    RDB.dst_tmp.Open;
    if RDB.dst_tmp.RecordCount <= 0 then
      exit;
    RDB.dst_tmp.First;
    while not RDB.dst_tmp.Eof do
    begin
      Name := RDB.dst_tmp.FieldByName(tab).AsString;
      cbb_conditiontext.Items.Add(Name);
      rdb.dst_tmp.Next;
    end;
    Exit;
  end;
  if RDB.dst_tmp.Active then
    RDB.dst_tmp.Active := False;
  sql := 'select Name from Sys_attribute where type=''' + tab + '''';
  RDB.dst_tmp.CommandText := Sql;
  RDB.dst_tmp.Open;
  if RDB.dst_tmp.RecordCount <= 0 then
    exit;
  RDB.dst_tmp.First;
  while not RDB.dst_tmp.Eof do
  begin
    Name := RDB.dst_tmp.FieldByName('Name').AsString;
    cbb_conditiontext.Items.Add(Name);
    rdb.dst_tmp.Next;
  end;

end;

end.

⌨️ 快捷键说明

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