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

📄 realtyb22a.pas

📁 物业管理系统系统特点 一、 实现集中式管理 系统将集团公司、各分公司、各物业管理处连接到一起
💻 PAS
📖 第 1 页 / 共 3 页
字号:
        end
    else if key=VK_ESCAPE then close;
end;

procedure Tf_RealtyB22A.FormClose(Sender: TObject; var Action: TCloseAction);
begin
    Action := caFree;
end;


procedure Tf_RealtyB22A.ListView1CustomDrawItem(Sender: TCustomListView;
  Item: TListItem; State: TCustomDrawState; var DefaultDraw: Boolean);
begin
    if   Item.Selected = true then
    begin
          Sender.Canvas.Brush.Color   :=   clMenuHighlight;
          (Sender   as   TListView).Canvas.Font.Color   :=  clWhite;
    end;
end;


procedure Tf_RealtyB22A.ListView1MouseDown(Sender: TObject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
    if button=mbRight then
    begin
        if edit1.Text='' then
         begin
             showmessage('请输入客户代码!');
             edit1.SetFocus;
             exit;
         end;
        PopupMenu1.Popup(mouse.CursorPos.X,mouse.CursorPos.Y);
    end;
end;

procedure Tf_RealtyB22A.ListView2MouseDown(Sender: TObject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
    if button=mbRight then
    begin
        if edit1.Text='' then
         begin
             showmessage('请输入客户代码!');
             edit1.SetFocus;
             exit;
         end;
        PopupMenu1.Popup(mouse.CursorPos.X,mouse.CursorPos.Y);
    end;
end;

//新增
procedure Tf_RealtyB22A.N53Click(Sender: TObject);
begin
     if pagecontrol1.ActivePageIndex=0 then
     begin
         bMod:=false;
         f_RealtyB111A:=Tf_RealtyB111A.create(self);
         f_RealtyB111A.showmodal;
     end;
     if pagecontrol1.ActivePageIndex=1 then
     begin
         bMod:=false;
         f_RealtyB112A:=Tf_RealtyB112A.create(self);
         f_RealtyB112A.showmodal;
     end;
end;

//修改
procedure Tf_RealtyB22A.N4Click(Sender: TObject);
begin
    if pagecontrol1.ActivePageIndex=0 then
     begin
        if listview1.SelCount=0 then exit;

         bMod:=true;
         mainform.t2:=edit1.Text;
         mainform.t3:=listview1.Selected.Caption;

         f_RealtyB111A:=Tf_RealtyB111A.create(self);
         f_RealtyB111A.showmodal;
     end;
     if pagecontrol1.ActivePageIndex=1 then
     begin
        if listview2.SelCount=0 then exit;

         bMod:=true;
         mainform.t2:=edit1.Text;
         mainform.t3:=listview2.Selected.SubItems[0];
         f_RealtyB112A:=Tf_RealtyB112A.create(self);
         f_RealtyB112A.showmodal;
     end;
end;

//删除
procedure Tf_RealtyB22A.N6Click(Sender: TObject);
begin
    //
end;



procedure Tf_RealtyB22A.Button1Click(Sender: TObject);
Var
    query:TADOQuery;
    s,s1,s2,s3:string;
    i:integer;
begin 
    if edit1.Text='' then
    begin
        showmessage('客户代码不能为空!');
        edit1.SetFocus;
        exit;
    end;

    if edit2.Text='' then
    begin
        showmessage('客户名称不能为空!');
        edit2.SetFocus;
        exit;
    end;

    if edit18.Text='' then
    begin
         showmessage('请输入管理处!');
         edit18.SetFocus;
         exit;
    end;

    if edit14.Text='' then
    begin
         showmessage('联系人不能为空!');
         edit14.SetFocus;
         exit;
    end;

    if edit3.Text='' then edit3.Text:='-';
    if edit4.Text='' then edit4.Text:='-';
    if edit5.Text='' then edit5.Text:='-';
    if edit6.Text='' then edit6.Text:='-';
    if edit7.Text='' then edit7.Text:='-';
    if edit8.Text='' then edit8.Text:='-';
    if edit9.Text='' then edit9.Text:='-';
    if edit10.Text='' then edit10.Text:='-';
    if edit11.Text='' then edit11.Text:='-';
    if edit12.Text='' then edit12.Text:='-';
    if edit13.Text='' then edit13.Text:='-';

    s1:='-';
    s2:='男';
    s3:='-';
    if combobox1.Text<>'' then s1:=combobox1.Text;
    if combobox2.Text<>'' then s2:=combobox2.Text;
    if combobox3.Text<>'' then s3:=combobox3.Text;

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


    if f_RealtyB22.bMod=false then
    begin
        s:='select * from  客户资料 where 客户代码='''+Edit1.Text;
        s:=s+'''';

        query.sql.clear;
        query.SQL.Add(s);
        query.Open;
        if query.RecordCount>0 then
        begin
            showmessage('客户代码重复, 请重新输入!');
            edit1.SetFocus;
            exit;
        end;


        //-------------------保存主表

        s:='insert into 客户资料 (客户代码,客户名称,客户类型,工作单位,电话,';
        s:=s+'手机号,性别,文化程度,MSN,邮编,';
        s:=s+'出生日期,身份证号码,籍贯,传真,电子邮件,';
        s:=s+'备注,地址,管理处,联系人)';
        s:=s+'values (:s1,:s2,:s3,:s4,:s5,';
        s:=s+':s6,:s7,:s8,:s9,:s10,';
        s:=s+':s11,:s12,:s13,:s14,:s15,';
        s:=s+':s16,:s17,:s18,:s19)';

        query.SQL.Clear;
        query.SQL.Add(s);
        query.Parameters.ParamByName('s1').Value:=edit1.Text;
        query.Parameters.ParamByName('s2').Value:=edit2.Text;
        query.Parameters.ParamByName('s3').Value:=s1;
        query.Parameters.ParamByName('s4').Value:=edit3.Text;
        query.Parameters.ParamByName('s5').Value:=edit4.Text;

        query.Parameters.ParamByName('s6').Value:=edit5.Text;
        query.Parameters.ParamByName('s7').Value:=s2;
        query.Parameters.ParamByName('s8').Value:=s3;
        query.Parameters.ParamByName('s9').Value:=edit6.Text;
        query.Parameters.ParamByName('s10').Value:=edit7.Text;

        query.Parameters.ParamByName('s11').Value:=datetostr(datetimepicker1.Date);
        query.Parameters.ParamByName('s12').Value:=edit8.Text;
        query.Parameters.ParamByName('s13').Value:=edit9.Text;
        query.Parameters.ParamByName('s14').Value:=edit10.Text;
        query.Parameters.ParamByName('s15').Value:=edit11.Text;

        query.Parameters.ParamByName('s16').Value:=edit12.Text;
        query.Parameters.ParamByName('s17').Value:=edit13.Text;
        query.Parameters.ParamByName('s18').Value:=mainform.getNum(Edit18.Text);
        query.Parameters.ParamByName('s19').Value:=edit14.Text;

        DataModuleADO.ADOConnection1.BeginTrans;
        query.ExecSQL;
        DataModuleADO.ADOConnection1.CommitTrans;


        //-----------------保存从表

        for i:=0 to listview1.Items.Count-1 do
        begin
            if listview1.Items.Item[i].Caption='' then listview1.Items.Item[i].Caption:='-';
            if listview1.Items.Item[i].SubItems[0]='' then listview1.Items.Item[i].SubItems[0]:='-';
            if listview1.Items.Item[i].SubItems[1]='' then listview1.Items.Item[i].SubItems[1]:='-';
            if listview1.Items.Item[i].SubItems[2]='' then listview1.Items.Item[i].SubItems[2]:='-';
            if listview1.Items.Item[i].SubItems[3]='' then listview1.Items.Item[i].SubItems[3]:='-';
            if listview1.Items.Item[i].SubItems[4]='' then listview1.Items.Item[i].SubItems[4]:='-';
            if listview1.Items.Item[i].SubItems[5]='' then listview1.Items.Item[i].SubItems[5]:='-';

            s:='insert into 客户资料账号 (客户代码,开户名称,开户银行,银行账号,账号类型,';
            s:=s+'开户银行地址,是否主账号,备注)';
            s:=s+' values (:s1,:s2,:s3,:s4,:s5,';
            s:=s+':s6,:s7,:s8)';

            query.SQL.Clear;
            query.SQL.Add(s);
            query.Parameters.ParamByName('s1').Value:=edit1.Text;
            query.Parameters.ParamByName('s2').Value:=listview1.Items.Item[i].Caption;
            query.Parameters.ParamByName('s3').Value:=listview1.Items.Item[i].SubItems[0];
            query.Parameters.ParamByName('s4').Value:=listview1.Items.Item[i].SubItems[1];
            query.Parameters.ParamByName('s5').Value:=listview1.Items.Item[i].SubItems[2];
            query.Parameters.ParamByName('s6').Value:=listview1.Items.Item[i].SubItems[3];
            query.Parameters.ParamByName('s7').Value:=listview1.Items.Item[i].SubItems[4];
            query.Parameters.ParamByName('s8').Value:=listview1.Items.Item[i].SubItems[5];

            DataModuleADO.ADOConnection1.BeginTrans;
            query.ExecSQL;
            DataModuleADO.ADOConnection1.CommitTrans;

        end;

        for i:=0 to listview2.Items.Count-1 do
        begin
            if listview2.Items.Item[i].Caption='' then listview2.Items.Item[i].Caption:='-';
            if listview2.Items.Item[i].SubItems[0]='' then listview2.Items.Item[i].SubItems[0]:='-';
            if listview2.Items.Item[i].SubItems[1]='' then listview2.Items.Item[i].SubItems[1]:='-';
            if listview2.Items.Item[i].SubItems[2]='' then listview2.Items.Item[i].SubItems[2]:='-';
            if listview2.Items.Item[i].SubItems[3]='' then listview2.Items.Item[i].SubItems[3]:='-';
            if listview2.Items.Item[i].SubItems[4]='' then listview2.Items.Item[i].SubItems[4]:='-';


            s:='insert into 客户资料家庭成员 (客户代码,与客户关系,名称,电话,手机,';
            s:=s+'性别,说明)';
            s:=s+' values (:s1,:s2,:s3,:s4,:s5,';
            s:=s+':s6,:s7)';

            query.SQL.Clear;
            query.SQL.Add(s);
            query.Parameters.ParamByName('s1').Value:=edit1.Text;
            query.Parameters.ParamByName('s2').Value:=listview2.Items.Item[i].Caption;
            query.Parameters.ParamByName('s3').Value:=listview2.Items.Item[i].SubItems[0];
            query.Parameters.ParamByName('s4').Value:=listview2.Items.Item[i].SubItems[1];
            query.Parameters.ParamByName('s5').Value:=listview2.Items.Item[i].SubItems[2];
            query.Parameters.ParamByName('s6').Value:=listview2.Items.Item[i].SubItems[3];
            query.Parameters.ParamByName('s7').Value:=listview2.Items.Item[i].SubItems[4];

            DataModuleADO.ADOConnection1.BeginTrans;
            query.ExecSQL;
            DataModuleADO.ADOConnection1.CommitTrans;

⌨️ 快捷键说明

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