tc1:=tclientdataset.create(nil);
tc2:=tclientdataset.creat?e(nil);
tc1.data:=hosxp_getdatase?t('select * from patient where hn = "'+hnedit.text+'"');
tc2.data:=hosxp_getdatase?t('select * from person where cid = "'+cid+'" and cid is not null and cid<>""');
tc2.append;
tc2.fieldbyname('person_i?d').asinteger:=getserialnumber('p?erson_id');
tc2.fieldbyname('house_id'?).asinteger:=house_id;
tc2.fieldbyname('cid').as?string:=cid;
tc2.fieldbyname('pname').?asstring:=tc1.fieldbyname('pname'?).asstring;
tc2.fieldbyname('fname').?asstring:=tc1.fieldbyname('fname'?).asstring;
tc2.fieldbyname('lname').?asstring:=tc1.fieldbyname('lname'?).asstring;
tc2.fieldbyname('sex').as?string:=tc1.fieldbyname('sex').as?string;
tc2.fieldbyname('birthdat?e').asdatetime:=tc1.fieldbyname('?birthday').asdatetime;
tc2.fieldbyname('occupati?on').asstring:=tc1.fieldbyname('o?ccupation').asstring;
tc2.fieldbyname('national?ity').asstring:=tc1.fieldbyname('?nationality').asstring;
tc2.fieldbyname('citizens?hip').asstring:=tc1.fieldbyname('?citizenship').asstring;
tc2.fieldbyname('religion'?).asstring:=tc1.fieldbyname('reli?gion').asstring;
tc2.fieldbyname('marrysta?tus').asstring:=tc1.fieldbyname('?marrystatus').asstring;
tc2.fieldbyname('pttype')?.asstring:=tc1.fieldbyname('pttyp?e').asstring;
tc2.post;
hosxp_updatedelta(tc2.del?ta, 'select * from person where cid = "'+cid+'" and cid is not null and cid<>""');
tc2.free;
tc1.free;