ใช้สำหรับนำเข้ารายการทันตกรรมจากตาราง nondrugitems เข้าไปตาราง dttm รายการที่นำเข้าได้แก่
code ,name,icode,opd_price1,ipd_price1  เท่านั้นครับ ส่วนรายละเอียดที่เหลืออื่น เช่น icd9,icd10 การจัดหมวดงานคงต้องตามไปแก้แบบ manual ผ่านเมนูรายการหัตถการทันตกรรม ครับ...เด้อ......พี่น้อง
จั๋งซี้มันต้องถอน  
  
  
  
  
  
 
ชื่อ 
Import Data To DTTM TableFun For Fun  
  
  
  
  
  
  คำเตือน Script นี้จะทำการลบข้อมูลในตาราง dttm ก่อนแล้วจึงนำเข้า ดังนั้นขอแนะนำให้สำรองข้อมูลก่อนนำไปใช้
คำเตือน Script นี้จะทำการลบข้อมูลในตาราง dttm ก่อนแล้วจึงนำเข้า ดังนั้นขอแนะนำให้สำรองข้อมูลก่อนนำไปใช้ - unit Unit18; 
-   
- interface 
-   
- uses 
-   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, 
-   Dialogs, StdCtrls, ComCtrls; 
-   
- type 
-   TForm18 = class(TForm) 
-     Button1: TButton; 
-     pg: TProgressBar; 
-     procedure Button1Click(Sender: TObject); 
-   private 
-     { Private declarations } 
-   public 
-     { Public declarations } 
-   end; 
-   
- var 
-   Form18: TForm18; 
-   
- implementation 
-   
- {$R *.dfm} 
- function addzero(s: string; i: integer): string; 
- begin 
-   //result:=s; 
-   while length(s) < i do 
-   begin 
-     s := '0' + s; 
-   end; 
-   result := s; 
- end; 
-   
- procedure TForm18.Button1Click(Sender: TObject); 
- var tc:tclientdataset; 
- a:interger; 
- s:string; 
-   
- begin 
-   //tc:=tclientdataset.create(nil); 
-   //tc.data:=hosxp_getdataset('show tables'); 
-  pg.min:=0; 
-  pg.position:=0; 
-  a:=0; 
-  fcds2.close; 
-  fcds2.datarequest('select * from nondrugitems where income="16" and istatus="Y" order by name'); 
-  fcds2.open; 
-  pg.max:=fcds2.recordcount; 
-  fcds2.first; 
-  fcds.datarequest('EXEC delete from dttm'); 
-  fcds.datarequest('select * from dttm'); 
-  fcds.open; 
-  while not fcds2.eof do 
-  begin 
-  a:=a+1; 
-  s:=inttostr(a); 
-   pg.position:= pg.position+1; 
-   fcds.insert; 
-   fcds['icode']:=fcds2['icode']; 
-   fcds['name']:=fcds2['name']; 
-   fcds['opd_price1']:=fcds2['price']; 
-   fcds['ipd_price1']:=fcds2['ipd_price']; 
-   fcds['code']:=addzero(s,6); 
-   fcds.post; 
-   fcds2.next; 
-  end; 
-  applyupdate_fcds(-1); 
-  fcds2.close; 
-  fcds.close; 
-  showmessage('¨Ó¹Ç¹ record ·Õè¹Óà¢éÒ·Ñé§ËÁ´   '+inttostr(pg.max) +' Records'); 
-  Showmessage('Process Done'); 
-  end; 
- end. 
-   
-