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

📄 pas_sz.pas

📁 比较详细的功能
💻 PAS
📖 第 1 页 / 共 2 页
字号:
     close;
     sql.Clear;
     s:='select ho_contractno from house_histry where ho_no like ''%'+trim(cb_houseno.Text)+'%'' ';
     sql.Add(s);
     open;
     cb_cno.Items.Clear;
     while not dm.AQ1.Eof do
     begin
      cb_cno.Items.Add(fields.Fields[0].asstring);
      next;
    end;
   end;
  except 
  end;
end;

procedure Tform_sz.selectConClick(Sender: TObject);
var
  s1:string;
  s:string;
  i:integer;
begin
   if (cb_houseno.Text='') then
  begin
     showmessage('房子不能为空,请重输入!');
     exit;
  end;
    try
     with dm2.Query_sz1 do
     begin
       close;
       sql.clear;
       sql.Text:='select ho_contractno 合同编号,ho_client 客户编号,ho_landlord 房东,ho_starttime 合同开始时间,ho_leavetime 合同结束时间,ho_rent 合同租金,'+
               ' ho_rentunit 租金单位,ho_remarks 备注,ho_no 房子编号 from house_histry where ho_no like ''%'+
       trim(cb_houseno.Text)+'%'' order by ho_contractno';
       open;
       if dm2.query_sz1.RecordCount=0 then
       begin
         showmessage('没有合同');
         exit;
       end;
 ////////////////////////////

     s1:= ' where    hi_cno = '''+dbgrid_con.Fields[0].AsString+''' ';
     with dm2.Query_sz2 do
     begin
     close;
     sql.Clear;
     s1:='select hi_cno 合同编号,hi_times 付款次数,p_paymoney 付款金额,hi_fktime 付款时间,'+
        ' hi_fkorno 付款没有,hi_days 提前天数,P_remarks 备注 from hint left OUTER JOIN pay on hi_cno=p_cno and p_paytimes=hi_times ' +s1;
     sql.Add(s1);
     open;
     end;



 ////////////////////////////

     s:= ' where h_no=hp_no and hp_cno = '''+dbgrid_con.Fields[0].AsString+''' ';
      with pas_dm2.DM2.query_SZ do
     begin
        close;
        sql.Clear;
        sql.Add(' select hp_cno as 合同编号,'+
          ' h_landlord as 房东姓名 ,'+
          ' hp_cost as 花费,'+
          ' hp_occurtime as 发生时间,'+
          ' hp_thing as 事情,'+
          ' hp_remarks as 备注,'+
          ' h_no 房子'+
          '   from house,housepay '+s);
          open;
     end;

     i:=0;
     pas_dm2.DM2.query_SZ.First;
     while not pas_dm2.DM2.query_SZ.Eof do
     begin
      i:=i+pas_dm2.DM2.query_SZ.Fields.Fields[2].asinteger;
      pas_dm2.DM2.query_SZ.Next;
      end;
      label18.Caption:=inttostr(i);


 ////////////////////////////
     end;
   except
     showmessage('查询失败');
   end;

end;

procedure Tform_sz.rb_yjClick(Sender: TObject);
begin
   modify.Hide;
   del.Hide;
   edit_thing.Text:='押金';

   edit_thing.Color:=clLime;
end;

procedure Tform_sz.rb_khfzClick(Sender: TObject);
begin
   modify.Hide;
   del.Hide;
   edit_thing.Text:='房租';

   edit_thing.Color:=clLime;
end;

procedure Tform_sz.rb_fdfzClick(Sender: TObject);
begin
   edit_thing.Text:='房租';

   edit_thing.Color:=clLime;
   modify.Hide;
   del.Hide;
end;

procedure Tform_sz.rb_zcClick(Sender: TObject);
begin
   modify.Show;
   del.Show;
   edit_thing.Text:='';

   edit_thing.Color:=clWindow;
end;

procedure Tform_sz.rb_srClick(Sender: TObject);
begin
   modify.Show;
   del.Show;
   edit_thing.Text:='';

   edit_thing.Color:=clWindow;
end;

procedure Tform_sz.sp_htjfClick(Sender: TObject);
var
  s:string;
begin
   if (cb_cno.Text='') then
    begin
      showmessage('合同号不能为空');
      exit;
    end;
     s:= ' where    hi_cno = '''+trim(cb_cno.Text)+''' ';
     with dm2.Query_sz2 do
     begin
     close;
     sql.Clear;
     s:='select hi_cno 合同编号,hi_times 付款次数,p_paymoney 付款金额,hi_fktime 付款时间,'+
        ' hi_fkorno 付款没有,hi_days 提前天数,P_remarks 备注 from hint left OUTER JOIN pay on hi_cno=p_cno and p_paytimes=hi_times ' +s;
     sql.Add(s);
     open;

     end;
end;
procedure Tform_sz.DBGridCellClick(Column: TColumn);
begin
 with pas_dm2.dm2.query_SZ do
   begin
   if dbgrid.FieldCount=0 then
   begin
    showmessage('没有打开数据库');
    exit;
   end;
    if dbgrid.Fields[0].AsString='' then
    begin
    showmessage('数据库没有数据');
    exit;
    end;
       cb_houseno.Text:=fields.Fields[6].AsString;
       edit_cost.Text:=fields.Fields[2].AsString;
      dtp_occurtime.Time:=fields.Fields[3].AsDateTime;
        edit_thing.Text:=fields.Fields[4].AsString;
       edit_remarks.Text:=fields.Fields[5].AsString;
       cb_cno.Text:=fields.Fields[0].AsString;
  end;
end;

procedure Tform_sz.DBGridDblClick(Sender: TObject);
var
  s:string;
begin
   if dbgrid.FieldCount=7 then
   begin
   try
   begin
    s:='房子编号:'+dbgrid.Fields[6].AsString+#13+
       '合同编号:'+dbgrid.Fields[0].AsString+#13+
       '房东编号:'+dbgrid.Fields[1].AsString+#13+
       '花    费:'  +dbgrid.Fields[2].AsString+#13+
       '发生时间:'+dbgrid.Fields[3].AsString+#13+
       '事    情: '  +dbgrid.Fields[4].AsString+#13+
       '备    注: '  +dbgrid.Fields[5].AsString+#13;
       showmessage(s);
    end
    except
    end;
    exit;
    end;

    
end;

procedure Tform_sz.Edit_thingDropDown(Sender: TObject);
var
  s:string;
begin
 try
   with dm.AQ1 do
   begin
     close;
     sql.Clear;
     s:='select distinct(hp_thing) from housepay ';
     sql.Add(s);
     open;
     edit_thing.Items.Clear;
     while not dm.AQ1.Eof do
     begin
      edit_thing.Items.Add(fields.Fields[0].asstring);
      next;
    end;
   end;
  except 
  end;
end;


procedure Tform_sz.cb_housenoKeyPress(Sender: TObject; var Key: Char);
begin
    cb_cno.Text:='';
end;

procedure Tform_sz.DBGrid_CONCellClick(Column: TColumn);
var
  s:string;
  i:integer;
begin
   with pas_dm2.dm2.query_SZ1 do
   begin
   if dbgrid_con.FieldCount=0 then
   begin
    showmessage('没有打开数据库');
    exit;
   end;
    if dbgrid_con.Fields[0].AsString='' then
    begin
    showmessage('数据库没有数据');
    exit;
    end;
       cb_cno.Text:=fields.Fields[0].AsString;
  end;
  select.Click;

  if (cb_cno.Text='') then
    begin
      showmessage('合同号不能为空');
      exit;
    end;



     s:= ' where    hi_cno = '''+trim(cb_cno.Text)+''' ';
     with dm2.Query_sz2 do
     begin
     close;
     sql.Clear;
     sql.Text:='select ho_validorno from house_histry where ho_contractno='''+trim(cb_cno.Text)+'''';
     open();
     i:=dm2.query_sz2.Fields.Fields[0].AsInteger;

     if(i=1)then
     begin
     close;
     sql.Clear;
     s:='select hi_cno 合同编号,hi_times 付款次数,p_paymoney 付款金额,hi_fktime 付款时间,'+
        ' hi_fkorno 付款没有,hi_days 提前天数,P_remarks 备注 from hint left OUTER JOIN pay on hi_cno=p_cno and p_paytimes=hi_times ' +s;
     sql.Add(s);
     open;
      end
      else
      showmessage('注意,此合同无效')
     end;
end;

procedure Tform_sz.DBGrid_CONDblClick(Sender: TObject);
var
  s:string;
  i:integer;
begin
    if (cb_cno.Text='') then
    begin
      showmessage('合同号不能为空');
      exit;
    end;
     s:= ' where h_no=hp_no and hp_cno = '''+trim(cb_cno.Text)+''' ';
      with pas_dm2.DM2.query_SZ do
     begin
        close;
        sql.Clear;
        sql.Add(' select hp_cno as 合同编号,'+
          ' h_landlord as 房东姓名 ,'+
          ' hp_cost as 花费,'+
          ' hp_occurtime as 发生时间,'+
          ' hp_thing as 事情,'+
          ' hp_remarks as 备注,'+
          ' h_no 房子'+
          '   from house,housepay '+s);
          open;
     end;

     i:=0;
     pas_dm2.DM2.query_SZ.First;
     while not pas_dm2.DM2.query_SZ.Eof do
     begin
      i:=i+pas_dm2.DM2.query_SZ.Fields.Fields[2].asinteger;
      pas_dm2.DM2.query_SZ.Next;
      end;
      label18.Caption:=inttostr(i);

   
end;

procedure Tform_sz.FormKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  if   Key   =   VK_F4   then   
      begin
          add.Click;
          Key   :=   0;
          exit;
      end;

    if   Key   =   VK_F1   then
      begin
          selectcon.Click;
          Key   :=   0;
          exit;
      end;
end;

end.

⌨️ 快捷键说明

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