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

📄 statistics.pas

📁 有需要的同仁载回去慢慢研究
💻 PAS
字号:
unit Statistics;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls, ComCtrls, Grids, DBGrids, DB, DBTables,
  Buttons,PublicUnit;

type
  TStatisticsForm = class(TForm)
    Panel4: TPanel;
    Label1: TLabel;
    Panel2: TPanel;
    RadioGroup1: TRadioGroup;
    RadioButton1: TRadioButton;
    RadioButton2: TRadioButton;
    RadioButton3: TRadioButton;
    RadioButton4: TRadioButton;
    DBGrid1: TDBGrid;
    Title: TLabel;
    DataSource1: TDataSource;
    SQLQuery: TQuery;
    BitBtn1: TBitBtn;
    BitBtn2: TBitBtn;
    procedure BitBtn1Click(Sender: TObject);
    procedure BitBtn2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  StatisticsForm: TStatisticsForm;

implementation

uses DataModule;

{$R *.dfm}

procedure TStatisticsForm.BitBtn1Click(Sender: TObject);
var
  today,year,month:string;
begin
  today:=CalTodayDate;
  year:=today[1]+today[2]+today[3]+today[4];
  month:=today[5]+today[6];

  if radiobutton1.checked=true then
  begin
    with  SQLQuery do
    begin
      Title.Caption:=year+'年'+month+'月租金统计';
      DatabaseName := ExtractFilePath (Application.ExeName);
      Close;
      SQL.Clear;
      SQL.Add('select 合同号,应收日期,应收金额,实收金额,发票号');
      SQL.Add('from Rent.dbf');
      SQL.Add('where  应收日期 like :ToDate');
      ParamByName('ToDate').AsString:=year+month;
      Prepare;
      Open;
    end;
  end;

  if radiobutton2.checked=true then
  begin
    with SQLQuery do
    begin
      Title.Caption:=year+'年'+month+'月已到期合同统计';
      DatabaseName := ExtractFilePath (Application.ExeName);
      Close;
      SQL.Clear;
      SQL.Add('select 合同号,租期,起租日期,到期日期,付款期限,履约金,乙方单位,联系人,月租金,电话,手机,BB,租金总额');
      SQL.Add('from Contract.dbf');
      SQL.Add('where  (到期日期< :ToDate) and (标志 = "")');
      ParamByName('ToDate').Asstring:=today;
      Prepare;
      Open;
    end;
  end;

  if radiobutton3.checked=true then
  begin
    with SQLQuery do
    begin
      Title.Caption:=year+'年'+month+'月履约金统计';
      DatabaseName := ExtractFilePath (Application.ExeName);
      Close;
      SQL.Clear;
      SQL.Add('select 合同号,租期,起租日期,到期日期,乙方单位,联系人,电话,手机,BB,履约金');
      SQL.Add('from Contract.dbf');
      SQL.Add('where (履约金<>"") and (标志 = "")');
      prepare;
      Open;
    end;
  end;

  if radiobutton4.checked=true then
  begin
    with SQLQuery do
    begin
      Title.Caption:=year+'年'+month+'月空闲房屋统计';
      DatabaseName := ExtractFilePath (Application.ExeName);
      Close;
      SQL.Clear;
      SQL.Add('select 房屋号,座落,面积');
      SQL.Add('from House.dbf');
      SQL.Add('where 状态 = ""');
      prepare;
      Open;
    end;
  end;
end;

procedure TStatisticsForm.BitBtn2Click(Sender: TObject);
begin
  Close;
end;

end.

⌨️ 快捷键说明

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