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

📄 checkmoney.pas

📁 1. 直接安装并运行案例程序   运行“安装程序”文件夹中的setup.exe文件
💻 PAS
字号:
unit checkMoney;

interface

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

type
  TfrmCheckMoney = class(TForm)
    DBGrid1: TDBGrid;
    GroupBox2: TGroupBox;
    Label1: TLabel;
    Label2: TLabel;
    GroupBox1: TGroupBox;
    DataSource1: TDataSource;
    Label3: TLabel;
    DBNavigator1: TDBNavigator;
    dt1: TDateTimePicker;
    dt2: TDateTimePicker;
    Button1: TButton;
    Button2: TButton;
    Table1: TTable;
    Table2: TTable;
    Table3: TTable;
    Query1: TQuery;
    procedure FormCreate(Sender: TObject);
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  frmCheckMoney: TfrmCheckMoney;

implementation

{$R *.dfm}

procedure TfrmCheckMoney.FormCreate(Sender: TObject);
var
   s:string;
begin
   {初始化日期}
   dt2.Date:=now;
   dt1.Date:=strToDate('1950-1-1');
   {删除资金盘点表中所有记录}
   with table3 do
   begin
      open;
      while not eof do
      begin
         delete;
      end;
      close;
   end;
   {根据资金下拨表和资金入帐表重新填写盘点表}
   table1.open;
   table3.Open;
   while not table1.eof do
   begin
      table3.Insert;
      table3.fieldValues['流动日期']:=table1.fieldByName('拨款日期').AsString;
      table3.fieldValues['资金流向']:='下拨';
      table3.fieldValues['流动金额']:=table1.fieldByName('资金数额').AsString;
      table3.fieldValues['来源/用途']:=table1.fieldByName('用途').AsString;
      table3.post;
      table1.next;
   end;
   table1.close;
   table3.Close;
   table2.Open;
   table3.Open;
   while not table2.Eof do
   begin
      table3.Insert;
      table3.fieldValues['流动日期']:=table2.fieldByName('入帐日期').AsString;
      table3.fieldValues['资金流向']:='入帐';
      table3.fieldValues['流动金额']:=table2.fieldByName('资金数额').AsString;
      table3.fieldValues['来源/用途']:=table2.fieldByName('资金来源').AsString;
      table3.Post;
      table2.Next;
   end;
   table2.Close;
   table3.Close;
   {更新dbgrid控件的显示}
   with query1 do
   begin
      close;
      sql.Clear;
      sql.Add('select * from chkMoney');
      open;
   end;
end;

procedure TfrmCheckMoney.Button1Click(Sender: TObject);
var
   s:string;
begin
   s:='select * from chkMoney where 流动日期>=''';
   s:=s+formatDateTime('mm''/''dd''/''yyyy',dt1.Date);
   s:=s+''' and 流动日期<=''';
   s:=s+formatDateTime('mm''/''dd''/''yyyy',dt2.Date);
   s:=s+'''';
   with query1 do
   begin
      close;
      sql.Clear;
      sql.Add(s);
      open;
   end;
end;

end.

⌨️ 快捷键说明

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