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

📄 frm_tjcx.pas

📁 用于家庭养殖的财务进出
💻 PAS
📖 第 1 页 / 共 3 页
字号:
  for i:=0 to listbox1.count-1 do
  begin
    if listbox1.Selected[count] then
    begin
      listbox2.AddItem(listbox1.Items[count],listbox2);
      listbox4.AddItem(listbox3.Items[count],listbox4);
      listbox1.DeleteSelected;
      listbox3.ItemIndex:=count;
      listbox3.DeleteSelected;
    end
    else
      count:=count+1;
  end;
end;

procedure Tfrm_cx.Button4Click(Sender: TObject);
var
  i,count:integer;
begin
  count:=0;
  for i:=0 to listbox2.count-1 do
  begin
    if listbox2.Selected[count] then
    begin
      listbox1.AddItem(listbox2.Items[count],listbox1);
      listbox3.AddItem(listbox4.Items[count],listbox4);
      listbox2.DeleteSelected;
      listbox4.ItemIndex:=count;
      listbox4.DeleteSelected;
    end
    else
      count:=count+1;
  end;
end;

procedure Tfrm_cx.Button6Click(Sender: TObject);
var
  i:integer;
begin
  for i:=0 to listbox2.Count-1 do
  begin
    listbox1.AddItem(listbox2.Items[i],listbox1);
    listbox3.AddItem(listbox4.Items[i],listbox3);
  end;
  listbox2.Items.Clear;
  listbox4.Items.Clear;
end;

procedure Tfrm_cx.Button7Click(Sender: TObject);
var
  i:integer;
begin
  for i:=0 to listbox1.Count-1 do
  begin
    listbox2.AddItem(listbox1.Items[i],listbox2);
    listbox4.AddItem(listbox3.Items[i],listbox4);
  end;
  listbox1.Items.Clear;
  listbox3.Items.Clear;
end;

procedure Tfrm_cx.CheckBox1Click(Sender: TObject);
var
  i,count:integer;
  postion:integer;
  table_name:string;
begin
  if checkbox1.Checked then
  begin
    with dm.ADOQuery1 do
    begin
      close;
      sql.Clear;
      sql.Add('select lab_name,field,table_name from field_info where table_name=''a03'' and cx_field');
      open;
      first;
      while not eof do
      begin
        listbox1.AddItem(fieldbyname('lab_name').AsString,listbox1);
        listbox3.AddItem(fieldbyname('field').AsString+','+fieldbyname('table_name').AsString,listbox3);
        next;
      end;
    end;
  end
  else   //去掉该表的所有字段
  begin
    count:=0;
    for i:=0 to listbox1.Count-1 do
    begin
      postion:=pos(',',listbox3.Items[count]);
      table_name:=copy(listbox3.Items[count],postion+1,length(listbox3.Items[count]));
      if table_name='A03' then
      begin
        listbox1.ItemIndex:=count;
        listbox1.DeleteSelected;
        listbox3.ItemIndex:=count;
        listbox3.DeleteSelected;
      end
      else
        count:=count+1;
    end;
    listbox1.ItemIndex:=0;
  end;
end;

procedure Tfrm_cx.CheckBox2Click(Sender: TObject);
var
  i,count:integer;
  postion:integer;
  table_name:string;
begin
  if checkbox2.Checked then
  begin
    with dm.ADOQuery1 do
    begin
      close;
      sql.Clear;
      sql.Add('select lab_name,field,table_name from field_info where table_name=''a05'' and cx_field');
      open;
      first;
      while not eof do
      begin
        listbox1.AddItem(fieldbyname('lab_name').AsString,listbox1);
        listbox3.AddItem(fieldbyname('field').AsString+','+fieldbyname('table_name').AsString,listbox3);
        next;
      end;
    end;
  end
  else   //去掉该表的所有字段
  begin
    count:=0;
    for i:=0 to listbox1.Count-1 do
    begin
      postion:=pos(',',listbox3.Items[count]);
      table_name:=copy(listbox3.Items[count],postion+1,length(listbox3.Items[count]));
      if table_name='A05' then
      begin
        listbox1.ItemIndex:=count;
        listbox1.DeleteSelected;
        listbox3.ItemIndex:=count;
        listbox3.DeleteSelected;
      end
      else
        count:=count+1;
    end;
    listbox1.ItemIndex:=0;
  end;
end;

procedure Tfrm_cx.CheckBox3Click(Sender: TObject);
var
  i,count:integer;
  postion:integer;
  table_name:string;
begin
  if checkbox3.Checked then
  begin
    with dm.ADOQuery1 do
    begin
      close;
      sql.Clear;
      sql.Add('select lab_name,field,table_name from field_info where table_name=''a07'' and cx_field');
      open;
      first;
      while not eof do
      begin
        listbox1.AddItem(fieldbyname('lab_name').AsString,listbox1);
        listbox3.AddItem(fieldbyname('field').AsString+','+fieldbyname('table_name').AsString,listbox3);
        next;
      end;
    end;
  end
  else   //去掉该表的所有字段
  begin
    count:=0;
    for i:=0 to listbox1.Count-1 do
    begin
      postion:=pos(',',listbox3.Items[count]);
      table_name:=copy(listbox3.Items[count],postion+1,length(listbox3.Items[count]));
      if table_name='A07' then
      begin
        listbox1.ItemIndex:=count;
        listbox1.DeleteSelected;
        listbox3.ItemIndex:=count;
        listbox3.DeleteSelected;
      end
      else
        count:=count+1;
    end;
    listbox1.ItemIndex:=0;
  end;
end;

procedure Tfrm_cx.CheckBox4Click(Sender: TObject);  //其他信息表选项
var
  i,count:integer;
  postion:integer;
  table_name:string;
begin
  if checkbox4.Checked then
  begin
    with dm.ADOQuery1 do
    begin
      close;
      sql.Clear;
      sql.Add('select lab_name,field,table_name from field_info where table_name=''a08'' and cx_field');
      open;
      first;
      while not eof do
      begin
        listbox1.AddItem(fieldbyname('lab_name').AsString,listbox1);
        listbox3.AddItem(fieldbyname('field').AsString+','+fieldbyname('table_name').AsString,listbox3);
        next;
      end;
    end;
  end
  else   //去掉该表的所有字段
  begin
    count:=0;
    for i:=0 to listbox1.Count-1 do
    begin
      postion:=pos(',',listbox3.Items[count]);
      table_name:=copy(listbox3.Items[count],postion+1,length(listbox3.Items[count]));
      if table_name='A08' then
      begin
        listbox1.ItemIndex:=count;
        listbox1.DeleteSelected;
        listbox3.ItemIndex:=count;
        listbox3.DeleteSelected;
      end
      else
        count:=count+1;
    end;
    listbox1.ItemIndex:=0;
  end;
end;

procedure Tfrm_cx.DBGrid1CellClick(Column: TColumn);
var
  index:integer;
begin
  dbgrid2.Visible:=false;
  groupbox11.Visible:=false;
  radiobutton1.Enabled:=true;
  radiobutton2.Enabled:=true;
  radiobutton3.Enabled:=true;
  //index:=dbgrid1.SelectedIndex;
  //index:=dbgrid1.s;
  code:=dbgrid1.SelectedField.DisplayText;
  //code:=combobox6.Items[index-1];
  //showmessage(code);
  //获得序列号
end;

procedure Tfrm_cx.RadioButton1Click(Sender: TObject);
var
  table_name:string;
  sqlstr:string;
begin
  if radiobutton1.Checked then
  begin
    table_name:='a02';
    groupbox11.Caption:='职务信息';
  end
  else if radiobutton2.Checked then
  begin
    table_name:='a04';
    groupbox11.Caption:='家庭成员信息';
  end
  else if radiobutton3.Checked then
  begin
    table_name:='a06';
    groupbox11.Caption:='重大事项信息';
  end;
  groupbox11.Visible:=true;
  dbgrid2.Visible:=true;
  sqlstr:='select * from '+table_name+' where prescode='+quotedstr(code);
  with dm.ADOQuery5 do
    begin
      close;
      sql.clear;
      sql.Add(sqlstr);
      open;
    end;
end;

procedure Tfrm_cx.RadioButton2Click(Sender: TObject);
var
  table_name:string;
  sqlstr:string;
begin
  if radiobutton1.Checked then
  begin
    table_name:='a02';
    groupbox11.Caption:='职务信息';
  end
  else if radiobutton2.Checked then
  begin
    table_name:='a04';
    groupbox11.Caption:='家庭成员信息';
  end
  else if radiobutton3.Checked then
  begin
    table_name:='a06';
    groupbox11.Caption:='重大事项信息';
  end;
  groupbox11.Visible:=true;
  dbgrid2.Visible:=true;
  sqlstr:='select * from '+table_name+' where prescode='+quotedstr(code);
  with dm.ADOQuery5 do
    begin
      close;
      sql.clear;
      sql.Add(sqlstr);
      open;
    end;
end;

procedure Tfrm_cx.RadioButton3Click(Sender: TObject);
var
  table_name:string;
  sqlstr:string;
begin
  if radiobutton1.Checked then
  begin
    table_name:='a02';
    groupbox11.Caption:='职务信息';
  end
  else if radiobutton2.Checked then
  begin
    table_name:='a04';
    groupbox11.Caption:='家庭成员信息';
  end
  else if radiobutton3.Checked then
  begin
    table_name:='a06';
    groupbox11.Caption:='重大事项信息';
  end;
  groupbox11.Visible:=true;
  dbgrid2.Visible:=true;
  sqlstr:='select * from '+table_name+' where prescode='+quotedstr(code);
  with dm.ADOQuery5 do
    begin
      close;
      sql.clear;
      sql.Add(sqlstr);
      open;
    end;
end;

procedure Tfrm_cx.B_CancelClick(Sender: TObject);
begin
  selstr:='';
  whestr:='';
  fromstr:='';
  combobox1.Items.Clear; //将控件恢复到最初状态;
  combobox2.Items.Clear;
  combobox3.Items.Clear;
  formcreate(sender);
  combobox1.Text:='';
  combobox2.Text:='';
  combobox3.Text:='';
  edit1.Text:='';
  rb1.Checked:=false;
  rb2.Checked:=false;
end;

procedure Tfrm_cx.B_TJClick(Sender: TObject);
begin
  frm_tj.Show;
end;

{procedure tform11.addcolume(field:tfield;caption:string);
begin
  dbgrid1.Columns.Add;
  dbgrid1.Columns[count].Field:=field;
  dbgrid1.Columns[count].Title.Caption:=caption;
  dbgrid1.Columns[count].Width:=50;
end; }

procedure Tfrm_cx.B_exportClick(Sender: TObject);
begin
  if savedialog1.Execute then
    if DataToExcel(savedialog1.FileName ) then
      messagebox(self.Handle,'导出成功','完成',MB_ICONINFORMATION);
end;

end.

⌨️ 快捷键说明

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