unit Import2Clinicmember;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ComCtrls, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
ProgressBar1: TProgressBar;
Memo: TMemo;
Button2: TButton;
procedure Button2Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var a:integer;
begin
a:=0;
fcds2.close;
fcds2.datarequest('Select Distinct hn from ovstdiag where icd10 like "E11%" and hn > 0');
fcds2.open;
ProgressBar1.max:=fcds2.recordcount;
showmessage('OVSTDIAG’ '+inttostr(ProgressBar1.max)+' Records');
Memo.lines.add('Found '+inttostr(ProgressBar1.max)+' Records');
Memo.lines.add('Start Import DaTa............');
ProgressBar1.position:=0;
fcds2.first;
fcds.close;
//fcds.datarequest('EXEC delete from clinicmember');
fcds.datarequest('select * from clinicmember');
fcds.open;
while not fcds2.eof do
begin
ProgressBar1.position:=ProgressBar1.position+1;
a:=a+1;
if getsqldata('select count(*) as cc from clinicmember where hn="'+fcds2['hn']+'"') = 0 then
begin
fcds.insert;
fcds['clinic']:='001';
fcds['hn']:=fcds2['hn'];
fcds['number']:=getsqldata('select get_serialnumber(''' + 'clinic-member-number-001' + ''') as cc');
fcds['regdate']:='11/6/2552';
fcds.post;
memo.lines.add('Import No.'+inttostr(ProgressBar1.position)+' Clinic '+fcds['clinic']+' , HN '+fcds['hn']);
end;
fcds2.next;
end;
applyupdate_fcds(-1);
fcds2.close;
fcds.close;
memo.lines.add('-------------------------------------------------');
memo.lines.add('Yindee Process Done ('+inttostr(ProgressBar1.position)+' Records)');
showmessage('Done');
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
self.Close;
end;
end.
สี่แดงคือที่ต้องมีการเปลียนแปลงในแต่ละ คลินิก