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

📄 realtyc321.pas

📁 物业管理系统系统特点 一、 实现集中式管理 系统将集团公司、各分公司、各物业管理处连接到一起
💻 PAS
📖 第 1 页 / 共 2 页
字号:
unit RealtyC321;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, dbcgrids, Grids, DBGrids, DB, ADODB, StdCtrls, Buttons, ExtCtrls,
  StrUtils, ExtDlgs, ComCtrls, math, ToolWin, ImgList, Menus;

type
    Tf_RealtyC321 = class(TForm)
    Label1: TLabel;
    Edit1: TEdit;
    Label2: TLabel;
    Edit2: TEdit;
    Label3: TLabel;
    Edit3: TEdit;
    Label4: TLabel;
    Edit4: TEdit;
    Label5: TLabel;
    Label7: TLabel;
    Label8: TLabel;
    Label9: TLabel;
    Edit5: TEdit;
    Edit6: TEdit;
    DateTimePicker1: TDateTimePicker;
    Label6: TLabel;
    Label14: TLabel;
    ComboBox2: TComboBox;
    ComboBox3: TComboBox;
    Label10: TLabel;
    Button5: TButton;
    Button7: TButton;
    Edit8: TEdit;
    Button1: TButton;
    Label11: TLabel;
    ComboBox4: TComboBox;
    Button2: TButton;
    Button3: TButton;
    ComboBox1: TComboBox;
    L1: TLabel;
    ComboBox5: TComboBox;
    procedure FormKeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure NN6Click(Sender: TObject);
    procedure ToolButton10Click(Sender: TObject);
    procedure GetID;
    procedure FormCreate(Sender: TObject);
    procedure Button7Click(Sender: TObject);
    procedure Button5Click(Sender: TObject);
    procedure ComboBox3Select(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure ComboBox2Select(Sender: TObject);

    procedure Button2Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure ComboBox5Select(Sender: TObject);


  private
    { Private declarations }
  public
    { Public declarations }
     bMod:bool;
     sTable:string;
     cols:integer;
     bOK:bool;
  end;


var
  f_RealtyC321: Tf_RealtyC321;
implementation
uses data, main,RealtyC32,Car4s931,realtyA11,realtyC322,realtyC31;
{$R *.dfm}
//Initial******************************
procedure Tf_RealtyC321.FormCreate(Sender: TObject);
Var
    query,query1:TADOQuery;
    stemp:string;
begin
    datetimepicker1.Date:=date;
    query:=TADOQuery.Create(nil);
    query.Connection:=DataModuleADO.ADOConnection1;
    query1:=TADOQuery.Create(nil);
    query1.Connection:=DataModuleADO.ADOConnection1;

    query.SQL.Clear;
    query.SQL.Add('select * from 收费项目 where 费用项目类型='''+'抄表收费项目'+'''');
    query.Open;
    while not query.Eof do
    begin
        combobox5.Items.Add(query.fieldbyname('编号').Value+'--'+query.fieldbyname('名称').Value);

        query.Next;
    end;


    combobox3.Items.Add('新增分摊表');

    query.SQL.clear;
    query.sql.add('select * from 辅助资料 where 类别='''+'分摊表'+'''');
    query.Open;
    while not query.eof do
    begin
        combobox3.Items.Add(query.fieldbyname('名称').Value);
        query.Next;
    end;

    combobox2.Items.Add('总表');
    combobox2.Items.add('楼宇分摊表');
    combobox2.Items.add('房间分摊表');

    combobox4.Items.Add('平均分摊');
    combobox4.Items.Add('按用量分摊');
    combobox4.Items.Add('按建筑面积分摊');
    
    if f_RealtyC32.bMod=false then
    begin
        GetID;
    end;

    if f_RealtyC32.bMod then
    begin
        query.SQL.Clear;
        query.SQL.Add('select * from 公摊仪表 where 编号='''+f_RealtyC32.ListView1.Selected.caption+'''');
        query.Open;
        if query.RecordCount>0 then
        begin
            if query.fieldbyname('审核').Value='Y' then button7.Enabled:=false;

            query1.sql.Clear;
            query1.SQL.add('select * from 管理区 where 编号='''+query.fieldbyname('管理区').Value+'''');
            query1.Open;
            if query1.RecordCount>0 then  stemp:=query1.fieldbyname('编号').Value+'--'+query1.fieldbyname('名称').Value;

            edit1.Text:=query.fieldbyname('编号').Value;


            combobox2.ItemIndex:=combobox2.Items.IndexOf(query.fieldbyname('公摊仪表类型').Value);
            combobox3.ItemIndex:=combobox3.Items.IndexOf(query.fieldbyname('总表').Value);
            edit8.text:=stemp;
            edit2.Text:=query.fieldbyname('损耗率').Value;
            edit3.Text:=query.fieldbyname('倍率').Value;
            edit4.Text:=query.fieldbyname('回程').Value;
            datetimepicker1.Date:=strtodate(query.fieldbyname('读数日期').Value);
            edit5.Text:=query.fieldbyname('当前读数').Value;
            edit6.Text:=query.fieldbyname('备注').Value;
            combobox4.ItemIndex:=combobox4.Items.IndexOf(query.fieldbyname('分摊方式').Value);


            combobox5.ItemIndex:=combobox5.Items.IndexOf(query.fieldbyname('收费项目').Value+'--'+mainform.getName('收费项目',query.fieldbyname('收费项目').Value));

            combobox1.Items.Add(query.fieldbyname('收费标准').Value+'--'+mainform.getName('收费标准',query.fieldbyname('收费标准').Value));
            combobox1.ItemIndex:=combobox1.Items.IndexOf(query.fieldbyname('收费标准').Value+'--'+mainform.getName('收费标准',query.fieldbyname('收费标准').Value));
        end;
    end;

    query1.Close;
    query1.free;
    query.Close;
    query.free;
end;

procedure Tf_RealtyC321.GetID;
Var
    query:TADOQuery;
    s:string;
    i:integer;
begin
    query:=TADOQuery.Create(nil);
    query.Connection:=DataModuleADO.ADOConnection1;

    s := 'select top 1 * from 公摊仪表 ORDER BY  编号 DESC';

    Query.SQL.Add(s);
    Query.Open ;
    if query.recordcount > 0 then
    begin
        s:= Query.Fieldbyname('编号').AsString;
        s:= Copy(S, 1, 7);
        i:= strtoint(s)+1;
        if i<10 then edit1.text := '000000'+inttostr(i)
        else if (i > 9) and (i<100) then edit1.text := '00000'+inttostr(i)
        else if (i > 99) and (i<1000) then edit1.text := '0000'+inttostr(i)
        else if (i > 999) and (i<10000) then edit1.text := '000'+inttostr(i)
        else if (i > 9999) and (i<100000) then edit1.text := '00'+inttostr(i)
        else if (i > 99999) and (i<1000000) then edit1.text := '0'+inttostr(i)
        else if i>999999 then edit1.text := inttostr(i);
    end
    else  edit1.text := '0000001';

    query.Close;
    query.free;
end;


//Tab****************************************
procedure Tf_RealtyC321.FormKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
    if key=13 then
        Begin
            key:=0;
            perform(WM_NEXTDLGCTL,0,0);
        end
    else if key=VK_ESCAPE then close;
end;

//FreeForm**********************************
procedure Tf_RealtyC321.FormClose(Sender: TObject; var Action: TCloseAction);
begin
    Action := caFree;
end;

//Close*************************************
procedure Tf_RealtyC321.NN6Click(Sender: TObject);
begin
    close;
end;

procedure Tf_RealtyC321.ToolButton10Click(Sender: TObject);
begin
    NN6Click(Sender);
end;

procedure Tf_RealtyC321.Button7Click(Sender: TObject);
Var
    query,query1:TADOQuery;
    s,stemp,r1,s1:string;
    i,j:integer;
begin
    if edit1.Text='' then
    begin
        showmessage('编号不能为空!');
        edit1.SetFocus;
        exit;
    end;



    if Edit8.Text='' then
    begin
        showmessage('管理区不能为空!');
        edit8.SetFocus;
        exit;
    end;

    if edit3.Text='' then
    begin
        showmessage('倍率不能为空!');
        edit3.SetFocus;
        exit;
    end;

    if edit4.Text='' then
    begin
        showmessage('回程不能为空!');
        edit4.SetFocus;
        exit;
    end;

    if combobox4.Text='' then
    begin
        showmessage('分摊方式不能为空!');
        combobox4.SetFocus;
        exit;
    end;

    if combobox1.Text='' then
    begin
        showmessage('收费标准不能为空!');
        combobox1.SetFocus;
        exit;
    end;

    if combobox5.Text='' then
    begin
        showmessage('收费项目不能为空!');
        combobox5.SetFocus;
        exit;
    end;

    if Edit8.text='' then Edit8.Text:='-';

    if combobox2.Text='' then combobox2.Text:='-';
    edit2.Text:=mainform.StdDou2(edit2.Text);
    edit3.Text:=mainform.StdDou2(edit3.Text);
    edit4.Text:=mainform.StdDou2(edit4.Text);
    edit5.Text:=mainform.StdDou2(edit5.Text);
    if combobox3.Text='' then combobox3.Text:='-';
    if edit6.Text='' then edit6.Text:='-';

    query:=TADOQuery.Create(nil);
    query.Connection:=DataModuleADO.ADOConnection1;
    query1:=TADOQuery.Create(nil);
    query1.Connection:=DataModuleADO.ADOConnection1;


    if f_RealtyC32.bMod=true then
    begin
        if edit1.Text<>f_RealtyC32.ListView1.Selected.caption then
        begin
            query1.sql.clear;
            query1.SQL.add('select * from 公摊仪表 where 编号='''+Edit1.Text+'''');

⌨️ 快捷键说明

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