*** Source Code อยู่ที่ P:\Pos\Prog\Ho\_Newdata.Prg
cFoxMessColor="RGB(128,0,128)" && ม่วง
Do Fox_Mess With 'เรียกโปรแกรมผิด '
? 'Do NewData In _NewData'
Return 


**** Do Fpw262HOData In P:\Pos\Prog\Ho\_NewData  PipopU-01
Procedure Fpw262HOData  &&  สำหรับระบบโรงแรม เวอร์ชั่นเก่า
***** DATA
Rem Fpw26Data.Bat
if not exist "\UyodTeam\_Fpw26Data"  Md \UyodTeam\_Fpw26Data
if not exist "\UyodTeam\_InitData"  Md \UyodTeam\_InitData
if not exist "rar.exe" Copy D:\bdPosVFP\rar.exe .
Pause 

Cd\BdPos\Data
rar u \UyodTeam\_Fpw26Data\DATA Tourist.* Tourcost.* RoomType.* EmPloyee.*
rar u \UyodTeam\_Fpw26Data\DATA Position.* EmType.* Floor.* Product.* RmSub.* Vatcode.* 
rar u \UyodTeam\_Fpw26Data\DATA Hopromo.* Ho2Promo.* HORANGE.* Sku4Room.* Nation.* 
rar u \UyodTeam\_Fpw26Data\DATA Mbtype.* Pay4Am.* Remark.* 
Pause 

Cd\BdPos\Transac
rar u \UyodTeam\_Fpw26Data\TRANSAC HoDocno.* HoCode.* RoomCode.* Room.* Room2.* RoomHead.* RoomHD2.* RoomTran.*
rar u \UyodTeam\_Fpw26Data\TRANSAC RmAddser.* RmAddMN.*

rar u \UyodTeam\_Fpw26Data\TRANSAC SysPara.* RmDepart.* BookProd.* Guest.* 
rar u \UyodTeam\_Fpw26Data\TRANSAC RoomIn.* LockRoom.*  TourBook.* Sku2Room.*
rar u \UyodTeam\_Fpw26Data\TRANSAC DebtRoom.* Ho_Util.*  HoBook.* RoomMove.* Bookname.*
rar u \UyodTeam\_Fpw26Data\TRANSAC RmProm.* TourRun.* ChgPrice.* Maid4Sku.* Guesttrn.* RoomOpen.* DoorOpen.*
rar u \UyodTeam\_Fpw26Data\TRANSAC DoorUse.* LoginUse.* RmAddFrt.* RmEmpty.* RmHisTor.* KeyTran.*
Pause 

Cd\BdPos\Transac\Rooms
rar u \UyodTeam\_Fpw26Data\TRANSACROOMS *.dbf *.cdx
Pause 

Cd\BdPos\DATA2SC
rar u \UyodTeam\_Fpw26Data\DATA2SC RoomUser.* 
Pause 

Cd\BdPos\DBFRUN
rar u \UyodTeam\_Fpw26Data\DBFRUN RmShow.*
Pause 

Cd\UyodTeam\_Fpw26Data
Dir *.rar

Cd\


Rem UnFpw26Data.Bat
if not exist "unrar.exe" Copy D:\bdPosVFP\unrar.exe .
Cd\UyodTeam\_Fpw26Data
unrar x -o+ DATA.rar 
Pause 
unrar x -o+ TRANSAC.rar 
Pause 
unrar x -o+ TRANSACROOMS.rar 
Pause 
unrar x -o+ DATA2SC.rar 
Pause 
unrar x -o+ DBFRUN.rar 
Pause 
Del *.rar 
Pause 
Dir *.dbf /w
Pause 

** Tourist.* OR Tourcost.* OR RoomType.* OR EmPloyee.*
** Position.* OR EmType.* OR Floor.* OR Product.* OR RmSub.* OR Vatcode.* 
** Hopromo.* OR Ho2Promo.* OR HORANGE.* OR Sku4Room.* OR Nation.* 
** Mbtype.* OR Pay4Am.* OR Remark.* 
***** TRANSAC
** RoomCode.* OR SysPara.* OR RmDepart.* OR BookProd.* OR Guest.*  OR LockRoom.*
**   OR TourBook.* OR Sku2Room.*
** DebtRoom.* OR RmAddser.* OR Ho_Util.*  OR HoBook.* OR HoCode.* OR Bookname.*
** RmProm.* OR TourRun.* OR ChgPrice.* OR Maid4Sku.* OR Guesttrn.* OR RoomOpen.* OR DoorOpen.*
** DoorUse.* OR LoginUse.* OR RmAddFrt.* OR RmEmpty.* OR RmHisTor.*  OR KeyTran.*
**** 
*Room.* OR Room2.* OR RoomIn.* OR RoomTran.* OR RoomHead.* OR RoomHD2.* OR RoomMove.*
*HoDocno.* OR RmAddMN.*
***** ROOMS
***** DBFRUN
***** DATA2SC
Return 


**** 09/09/2024 จะทำใหม่ใน D:\BdPosVFP\
**** Do NewData With 1 In _NewData  && ลบข้อมูลด้วย
**** Do NewData With 2 In _NewData  && ไม่ลบข้อมูลด้วย

**** สำหรับทำงานที่เครื่อง PipopU-02
**** Do NewData With 1 In P:\Pos\Prog\Ho\_Newdata  && ลบข้อมูลด้วย
**** Do NewData With 2 In P:\Pos\Prog\Ho\_Newdata  && ไม่ลบข้อมูลด้วย
ProceDure NewData
Parameter nForDel  && 1=ลบข้อมูลเก่าด้วย 2,0=ไม่ต้องลบ 
Do CrSetupData  && สร้างโพลเดอร์ 
****Return  && ทำงานจริงต้องเอาออก   PipopU-03
*****
*****
_Screen.FontName="Leelawadee"
_Screen.Fontsize=12
Clear 
Set Path To D:\BdPosVFP\Data;D:\BdPosVFP\Transac;D:\BdPosVFP\Dbfrun;D:\BdPosVFP\Data2SC;D:\BdPosVFP\Transac\Rooms
If Type('nForDel')<>'N'
	_Screen.Fontsize=25
	? "ไม่พบ Parameter nForDel"
	? "...หยุดการทำงาน"	
	Return 
Else 
	If !Between(nForDel,1,2)
		_Screen.Fontsize=25
		? "ต้องระบุ Parameter nForDel เป็น 1,2"
		? "...หยุดการทำงาน"	
		Return 
	Endif 
Endif 
*** PipopU-04
*** ให้ Copy ของเก่าจาก Data,Transac ไว้ที่  \_?Data\ 
*** ส่วน Transac\Rooms ไว้ที่ \_?Data\ เหมือนกัน   
Do Case 
Case nForDel=1  
	dForOlddata='\UyodTeam\_Fpw26Data\'  && สำหรับข้อมูลเวอร์ชั่นเก่า 
Case nForDel=2
	dForOlddata='\UyodTeam\_InitData\'  && สำหรับข้อมูลตั้งต้น 
OtherWise 
	_Screen.Fontsize=25
	? "nForDel = "+Alltrim(Str(nForDel))+' ระบุผิด'
	? "...หยุดการทำงาน"	
	Return 
EndCase
If !Directory(dForOlddata)
	_Screen.Fontsize=25
	? "ไม่พบโพลเดอร์ "+dForOlddata
	? "...กำลังสร้าง และเข้าใหม่อีกครั้ง"	
	Do CreateFolder With dForOlddata In \Pos\Security\Prog\UtilAll2
	Return 
Endif 
If nForDel=2 .and. File(dForOlddata+'_Data.OK')  &&  ป้องกันการดึงข้อมูลตั้งต้นซ้ำ 
	_Screen.Fontsize=25
	? "พบไฟล์ "+dForOlddata+'_Data.OK แปลว่า แค่ดึงแล้ว' 
	? "ถ้าจะดึงใหม่ ให้ลบไฟล์ข้างต้น"
	? "...หยุดการทำงาน"	
	Return 
Endif 
SET SAFETY  OFF
SET SYSMENU OFF
SET DELETE ON
SET SAFETY  OFF
SET SYSMENU TO
SET TALK OFF
SET EXCLUSIVE OFF
SET STATUS BAR ON
SET DATE TO BRIT
Set Century On
Set Near On 
Set Hour To 24
SET COLLATE TO "THAI"
? 'START : '

***** เริ่มเตรียมข้อมูลใหม่ 
Do CrNewDBFFL With 1,'SELEMENU'

*** ส่วน DATA\
Do CrNewDBFFL With 1,'ACBIGGRP'               
Do CrNewDBFFL With 1,'ACCDEPT'                
Do CrNewDBFFL With 1,'ACCGRP'                 
Do CrNewDBFFL With 1,'ACCLINE'                
Do CrNewDBFFL With 1,'AGE4PROG'               
Do CrNewDBFFL With 1,'AGENT'                  
Do CrNewDBFFL With 1,'ANIMAL'                 
Do CrNewDBFFL With 1,'APPAYSET'               
Do CrNewDBFFL With 1,'BAHT2BAH'               
Do CrNewDBFFL With 1,'BANK'                   
Do CrNewDBFFL With 1,'BANKBR'                 
Do CrNewDBFFL With 1,'BANKMAS'                
Do CrNewDBFFL With 1,'BDREPO'                 
Do CrNewDBFFL With 1,'BOOKBANK'               
Do CrNewDBFFL With 1,'BRANCH'                 
Do CrNewDBFFL With 1,'CABSIZE'                
Do CrNewDBFFL With 1,'CALLCOST'               
Do CrNewDBFFL With 1,'CASHTYPE'               
Do CrNewDBFFL With 1,'CHEQUE'                 
Do CrNewDBFFL With 1,'CLASS'                  
Do CrNewDBFFL With 1,'CLMESS'                 
Do CrNewDBFFL With 1,'COMPANY'                
Do CrNewDBFFL With 1,'COMPCODE'               
Do CrNewDBFFL With 1,'COUNTRY'                
Do CrNewDBFFL With 1,'COUPON'                 
Do CrNewDBFFL With 1,'CRETDIT'                
Do CrNewDBFFL With 1,'DEPART'                 
Do CrNewDBFFL With 1,'DK4PROM'                
Do CrNewDBFFL With 1,'EASYUPDT'               
Do CrNewDBFFL With 1,'EMPLOY2'                
Do CrNewDBFFL With 1,'EMPLOY3'                
Do CrNewDBFFL With 1,'EMPLOYEE'               
Do CrNewDBFFL With 1,'EMTYPE'                 
Do CrNewDBFFL With 1,'FDTABLE'                
Do CrNewDBFFL With 1,'FLOOR'                  
Do CrNewDBFFL With 1,'FOODTYPE'               
Do CrNewDBFFL With 1,'FORMAIL'                
Do CrNewDBFFL With 1,'GIRLRATE'               
Do CrNewDBFFL With 1,'GL2FORM'                
Do CrNewDBFFL With 1,'GLFORM'                 
Do CrNewDBFFL With 1,'HO2PROMO'               
Do CrNewDBFFL With 1,'HOPROMO'                
Do CrNewDBFFL With 1,'HORANGE'                
Do CrNewDBFFL With 1,'IVSCASH'                
Do CrNewDBFFL With 1,'IVSCUST'                
Do CrNewDBFFL With 1,'IVSMEM'                 
Do CrNewDBFFL With 1,'IVSMEM1'                
Do CrNewDBFFL With 1,'IVSOTHER'               
Do CrNewDBFFL With 1,'IVSSALE'                
Do CrNewDBFFL With 1,'IVSSTEM'                
Do CrNewDBFFL With 1,'IVSSUP'                 
Do CrNewDBFFL With 1,'IVSWHS'                 
Do CrNewDBFFL With 1,'IV_BRAN'                
Do CrNewDBFFL With 1,'IV_COMPO'               
Do CrNewDBFFL With 1,'IV_DETAI'               
Do CrNewDBFFL With 1,'IV_MAS'                 
Do CrNewDBFFL With 1,'IV_PIC'                 
Do CrNewDBFFL With 1,'IV_STYPE'               
Do CrNewDBFFL With 1,'IV_SUPP'                
Do CrNewDBFFL With 1,'IV_SYS'                 
Do CrNewDBFFL With 1,'IV_UNIT'                
Do CrNewDBFFL With 1,'LINE'                   
Do CrNewDBFFL With 1,'MACC'                   
Do CrNewDBFFL With 1,'MA_CHEER'               
Do CrNewDBFFL With 1,'MA_MAS'                 
Do CrNewDBFFL With 1,'MBSYS'                  
Do CrNewDBFFL With 1,'MBTYPE'                 
Do CrNewDBFFL With 1,'MDEPART'                
Do CrNewDBFFL With 1,'MDIVI'                  
Do CrNewDBFFL With 1,'MLTERM'                 
Do CrNewDBFFL With 1,'MPERIOD'                
Do CrNewDBFFL With 1,'MPROJECT'               
Do CrNewDBFFL With 1,'NATION'                 
Do CrNewDBFFL With 1,'NOTICE2'                
Do CrNewDBFFL With 1,'NOTICE4'                
Do CrNewDBFFL With 1,'PAY4AM'                 
Do CrNewDBFFL With 1,'PLU'                    
Do CrNewDBFFL With 1,'PLUGFIV'                
Do CrNewDBFFL With 1,'PLUGIFT'                
Do CrNewDBFFL With 1,'PLUPROMO'               
Do CrNewDBFFL With 1,'PLUREM'                 
Do CrNewDBFFL With 1,'PLUTKPLU'               
Do CrNewDBFFL With 1,'PLU_PROM'               
Do CrNewDBFFL With 1,'PLU_SUPP'               
Do CrNewDBFFL With 1,'POSITION'               
Do CrNewDBFFL With 1,'POSPAY'                 
Do CrNewDBFFL With 1,'POSWHSNM'               
Do CrNewDBFFL With 1,'PRESUBNM'               
Do CrNewDBFFL With 1,'PRODUCT'                
Do CrNewDBFFL With 1,'PROMFREE'               
Do CrNewDBFFL With 1,'PROMO'                  
Do CrNewDBFFL With 1,'PROMOTIO'               
Do CrNewDBFFL With 1,'PR_UNIT'                
Do CrNewDBFFL With 1,'RECVSTAT'               
Do CrNewDBFFL With 1,'REMARK'                 
Do CrNewDBFFL With 1,'RETNSTAT'               
Do CrNewDBFFL With 1,'RMSUB'                  
Do CrNewDBFFL With 1,'ROOMTYPE'               
Do CrNewDBFFL With 1,'SC4MENU'                
Do CrNewDBFFL With 1,'SH2KEY'                 
Do CrNewDBFFL With 1,'SH_KEY'                 
Do CrNewDBFFL With 1,'SKU4ROOM'               
Do CrNewDBFFL With 1,'SUBDEPT'                
Do CrNewDBFFL With 1,'TITLE'                  
Do CrNewDBFFL With 1,'TOURCOST'               
Do CrNewDBFFL With 1,'TOURIST'                
Do CrNewDBFFL With 1,'TRDRCRN'                
Do CrNewDBFFL With 1,'TR_MAS'                 
Do CrNewDBFFL With 1,'TR_RCRN'                
Do CrNewDBFFL With 1,'USER4LAN'               
Do CrNewDBFFL With 1,'VATCODE'                
Do CrNewDBFFL With 1,'VATTABLE'               
Do CrNewDBFFL With 1,'WARRANTY'               
***** ส่วน TRANSAC\
Do CrNewDBFFL With 2,'ACC2REP'             
Do CrNewDBFFL With 2,'ACCREP'              
Do CrNewDBFFL With 2,'ACCRUN'              
Do CrNewDBFFL With 2,'ACCSYS'              
Do CrNewDBFFL With 2,'AGL_NO'              
Do CrNewDBFFL With 2,'AGL_TRAN'            
Do CrNewDBFFL With 2,'AIRTRAN'             
Do CrNewDBFFL With 2,'AIRTRAN2'            
Do CrNewDBFFL With 2,'AP2GL'               
Do CrNewDBFFL With 2,'APCLEAR'             
Do CrNewDBFFL With 2,'APSET'               
Do CrNewDBFFL With 2,'APTRAN'              
Do CrNewDBFFL With 2,'AP_SYS'              
Do CrNewDBFFL With 2,'AP_TRAN'             
Do CrNewDBFFL With 2,'AP_UTIL'             
Do CrNewDBFFL With 2,'AR2GL'               
Do CrNewDBFFL With 2,'ARCLEAR'             
Do CrNewDBFFL With 2,'ARFIRST'             
Do CrNewDBFFL With 2,'ARRECENO'            
Do CrNewDBFFL With 2,'ARSET'               
Do CrNewDBFFL With 2,'ARTRAN'              
Do CrNewDBFFL With 2,'AR_FIRST'            
Do CrNewDBFFL With 2,'AR_SYS'              
Do CrNewDBFFL With 2,'AR_TRAN'             
Do CrNewDBFFL With 2,'AR_UTIL'             
Do CrNewDBFFL With 2,'BANKSTAT'            
Do CrNewDBFFL With 2,'BANKTRAN'            
Do CrNewDBFFL With 2,'BDREMARK'            
Do CrNewDBFFL With 2,'BOOKNAME'            
Do CrNewDBFFL With 2,'BOOKPROD'            
Do CrNewDBFFL With 2,'BOOKSYS'             
Do CrNewDBFFL With 2,'BOOKTRAN'            
Do CrNewDBFFL With 2,'CANOFBIL'            
Do CrNewDBFFL With 2,'CASHHEAD'            
Do CrNewDBFFL With 2,'CASHITRN'            
Do CrNewDBFFL With 2,'CASHRUN'             
Do CrNewDBFFL With 2,'CASHSYS'             
Do CrNewDBFFL With 2,'CASHTRAN'            
Do CrNewDBFFL With 2,'CASHTRN'             
Do CrNewDBFFL With 2,'CA_AGENT'            
Do CrNewDBFFL With 2,'CA_MAS'              
Do CrNewDBFFL With 2,'CHEQRETN'            
Do CrNewDBFFL With 2,'CHEQTRN'             
Do CrNewDBFFL With 2,'CHGPRICE'            
Do CrNewDBFFL With 2,'CHKTIME'             
Do CrNewDBFFL With 2,'CLASSTRN'            
Do CrNewDBFFL With 2,'CLLetter'            
Do CrNewDBFFL With 2,'CLMESS'              
Do CrNewDBFFL With 2,'CLSYS'               
Do CrNewDBFFL With 2,'CL_BOOK'             
Do CrNewDBFFL With 2,'CL_TRAN'             
Do CrNewDBFFL With 2,'CMECHAI'             
Do CrNewDBFFL With 2,'CNTSTOCK'            
Do CrNewDBFFL With 2,'CONSIGN'             
Do CrNewDBFFL With 2,'COUPTRN'             
Do CrNewDBFFL With 2,'CQ2SM'               
Do CrNewDBFFL With 2,'CQ_UTIL'             
Do CrNewDBFFL With 2,'CRETTRN'             
Do CrNewDBFFL With 2,'CUSNO1'              
Do CrNewDBFFL With 2,'CUSNO2'              
Do CrNewDBFFL With 2,'CUSTRN'              
Do CrNewDBFFL With 2,'CUS_TRN'             
Do CrNewDBFFL With 2,'CUS_TRN2'            
Do CrNewDBFFL With 2,'DATEMECH'            
Do CrNewDBFFL With 2,'DEBTROOM'            
Do CrNewDBFFL With 2,'DEBTTRAN'            
Do CrNewDBFFL With 2,'DEPTTRN'             
Do CrNewDBFFL With 2,'DKTRAN'              
Do CrNewDBFFL With 2,'DOCSETUP'            
Do CrNewDBFFL With 2,'DOOROPEN'            
Do CrNewDBFFL With 2,'DOORUSE'             
Do CrNewDBFFL With 2,'FOODBOOK'            
Do CrNewDBFFL With 2,'FOODFIX'             
Do CrNewDBFFL With 2,'FOODHEAD'            
Do CrNewDBFFL With 2,'FOODREPO'            
Do CrNewDBFFL With 2,'FOODTRAN'            
Do CrNewDBFFL With 2,'FULLTRN'             
Do CrNewDBFFL With 2,'GDRAWDT'             
Do CrNewDBFFL With 2,'GDRAWHD'             
Do CrNewDBFFL With 2,'GIRL'                
Do CrNewDBFFL With 2,'GIRLBOOK'            
Do CrNewDBFFL With 2,'GIRLDOC'             
Do CrNewDBFFL With 2,'GIRLHEAD'            
Do CrNewDBFFL With 2,'GIRLROOM'            
Do CrNewDBFFL With 2,'GIRLSYS'             
Do CrNewDBFFL With 2,'GIRLTAIL'            
Do CrNewDBFFL With 2,'GIRLTRAN'            
Do CrNewDBFFL With 2,'GLDOC'               
Do CrNewDBFFL With 2,'GLSYS'               
Do CrNewDBFFL With 2,'GLTARGET'            
Do CrNewDBFFL With 2,'GL_UTIL'             
Do CrNewDBFFL With 2,'GSUMTERM'            
Do CrNewDBFFL With 2,'GUEST'               
Do CrNewDBFFL With 2,'GUESTTRN'            
Do CrNewDBFFL With 2,'HOBOOK'              
Do CrNewDBFFL With 2,'HOCODE'              
Do CrNewDBFFL With 2,'HODEPTNO'            
Do CrNewDBFFL With 2,'HODOCNO'             
Do CrNewDBFFL With 2,'HOLIDAY'             
Do CrNewDBFFL With 2,'HO_UTIL'             
Do CrNewDBFFL With 2,'IV2FOOD'             
Do CrNewDBFFL With 2,'IVCCOUNT'            
Do CrNewDBFFL With 2,'IVSERIAL'            
Do CrNewDBFFL With 2,'IVSSYS'              
Do CrNewDBFFL With 2,'IVTOTAL'             
Do CrNewDBFFL With 2,'IVTRAN'              
Do CrNewDBFFL With 2,'IVTRN'               
Do CrNewDBFFL With 2,'IV_BRAN'             
Do CrNewDBFFL With 2,'IV_COUNT'            
Do CrNewDBFFL With 2,'IV_EOM'              
Do CrNewDBFFL With 2,'IV_LOT'              
Do CrNewDBFFL With 2,'IV_MAS2'             
Do CrNewDBFFL With 2,'IV_MASTR'            
Do CrNewDBFFL With 2,'IV_MONEY'            
Do CrNewDBFFL With 2,'IV_RECEI'            
Do CrNewDBFFL With 2,'IV_SUPPL'            
Do CrNewDBFFL With 2,'IV_SYS'              
Do CrNewDBFFL With 2,'IV_TOTAL'            
Do CrNewDBFFL With 2,'IV_TRAN'             
Do CrNewDBFFL With 2,'IV_UTIL'             
Do CrNewDBFFL With 2,'IV_WHSIV'            
Do CrNewDBFFL With 2,'IV_WSUNT'            
Do CrNewDBFFL With 2,'KEYTRAN'             
Do CrNewDBFFL With 2,'LINETRN'             
Do CrNewDBFFL With 2,'LOCKROOM'            
Do CrNewDBFFL With 2,'LOGINUSE'            
Do CrNewDBFFL With 2,'MACHTRN'             
Do CrNewDBFFL With 2,'MAID4SKU'            
Do CrNewDBFFL With 2,'MA_CANC'             
Do CrNewDBFFL With 2,'MA_FCASH'            
Do CrNewDBFFL With 2,'MA_SERV'             
Do CrNewDBFFL With 2,'MBOOK'               
Do CrNewDBFFL With 2,'MBTRN'               
Do CrNewDBFFL With 2,'MECH2SAL'            
Do CrNewDBFFL With 2,'MECHAI'              
Do CrNewDBFFL With 2,'MECHAI91'            
Do CrNewDBFFL With 2,'MECHAI_S'            
Do CrNewDBFFL With 2,'MECHLINK'            
Do CrNewDBFFL With 2,'MECHPAY'             
Do CrNewDBFFL With 2,'MECHSAL1'            
Do CrNewDBFFL With 2,'MECHSAL2'            
Do CrNewDBFFL With 2,'MLSYS'               
Do CrNewDBFFL With 2,'ML_TRAN'             
Do CrNewDBFFL With 2,'PAYTRN'              
Do CrNewDBFFL With 2,'PLU2QTY'             
Do CrNewDBFFL With 2,'PLUCTRN'             
Do CrNewDBFFL With 2,'PLUSRIAL'            
Do CrNewDBFFL With 2,'PLU_SYS'             
Do CrNewDBFFL With 2,'POSDOCNO'            
Do CrNewDBFFL With 2,'POSRUN'              
Do CrNewDBFFL With 2,'POTORDER'            
Do CrNewDBFFL With 2,'POTRAN'              
Do CrNewDBFFL With 2,'PO_TRAN'             
Do CrNewDBFFL With 2,'PO_UTIL'             
Do CrNewDBFFL With 2,'PROMISE'             
Do CrNewDBFFL With 2,'PRTRAN'              
Do CrNewDBFFL With 2,'PR_SYS'              
Do CrNewDBFFL With 2,'PSHBL'               
Do CrNewDBFFL With 2,'PSHFIX'              
Do CrNewDBFFL With 2,'PSHPO'               
Do CrNewDBFFL With 2,'PSHRECV'             
Do CrNewDBFFL With 2,'PSTBL'               
Do CrNewDBFFL With 2,'PSTFIX'              
Do CrNewDBFFL With 2,'PSTPO'               
Do CrNewDBFFL With 2,'PSTRECV'             
Do CrNewDBFFL With 2,'PWHSTRAN'            
Do CrNewDBFFL With 2,'QMECHAI'             
Do CrNewDBFFL With 2,'RECVADD'             
Do CrNewDBFFL With 2,'RECVTAIL'            
Do CrNewDBFFL With 2,'RECVTRN'             
Do CrNewDBFFL With 2,'RECVUNIT'            
Do CrNewDBFFL With 2,'RMADDFRT'            
Do CrNewDBFFL With 2,'RMADDMN'             
Do CrNewDBFFL With 2,'RMADDSER'            
Do CrNewDBFFL With 2,'RMDEPART'            
Do CrNewDBFFL With 2,'RMEMPTY'             
Do CrNewDBFFL With 2,'RMHISTOR'            
Do CrNewDBFFL With 2,'RMPROM'              
Do CrNewDBFFL With 2,'ROOM'                
Do CrNewDBFFL With 2,'ROOM2'               
Do CrNewDBFFL With 2,'ROOMCODE'            
Do CrNewDBFFL With 2,'ROOMHD2'             
Do CrNewDBFFL With 2,'ROOMHEAD'            
Do CrNewDBFFL With 2,'ROOMIN'              
Do CrNewDBFFL With 2,'ROOMMOVE'            
Do CrNewDBFFL With 2,'ROOMOPEN'            
Do CrNewDBFFL With 2,'ROOMTRAN'            
Do CrNewDBFFL With 2,'SALE2AP'             
Do CrNewDBFFL With 2,'SALE2AR'             
Do CrNewDBFFL With 2,'SALETRN'             
Do CrNewDBFFL With 2,'SKU2ROOM'            
Do CrNewDBFFL With 2,'SNMECHAI'            
Do CrNewDBFFL With 2,'SUBDTRN'             
Do CrNewDBFFL With 2,'SYSPARA'             
Do CrNewDBFFL With 2,'TAXLOT'              
Do CrNewDBFFL With 2,'TEMP'                
Do CrNewDBFFL With 2,'TMECHAI'             
Do CrNewDBFFL With 2,'TMECHAIS'            
Do CrNewDBFFL With 2,'TM_SYS'              
Do CrNewDBFFL With 2,'TOURBOOK'            
Do CrNewDBFFL With 2,'TOURRUN'             
Do CrNewDBFFL With 2,'TRMESS'              
Do CrNewDBFFL With 2,'TR_DOC'              
Do CrNewDBFFL With 2,'TR_MESS'             
Do CrNewDBFFL With 2,'TR_TRAN'             
Do CrNewDBFFL With 2,'TR_UTIL'             


**** ระบบรักษาความปลอดภัย 
Do CrNewDBFFL With 4,'KEYLOCK'             
Do CrNewDBFFL With 4,'LEVEL'             
Do CrNewDBFFL With 4,'ROOMLEV'             
Do CrNewDBFFL With 4,'ROOMUSER'             


**** ส่วน DBFRUN
Do CrNewDBFFL With 3,'COP2CLOU'           
Do CrNewDBFFL With 3,'EASYDATA'           
Do CrNewDBFFL With 3,'HO2DBF'             
Do CrNewDBFFL With 3,'HO2MACH'            
Do CrNewDBFFL With 3,'HOBACKUP'           
Do CrNewDBFFL With 3,'HODATA'             
Do CrNewDBFFL With 3,'HODIR'              
Do CrNewDBFFL With 3,'HOEOD'              
Do CrNewDBFFL With 3,'HOFORNET'           
Do CrNewDBFFL With 3,'HOINDEX'            
Do CrNewDBFFL With 3,'HOMEOD'             
Do CrNewDBFFL With 3,'HOPASS'             
Do CrNewDBFFL With 3,'HOPRN'              
Do CrNewDBFFL With 3,'HOUPREPO'           
Do CrNewDBFFL With 3,'HRPOFDT'            
Do CrNewDBFFL With 3,'PRNREGIN'           
Do CrNewDBFFL With 3,'PROMISE1'           
Do CrNewDBFFL With 3,'PROMISS1'           
Do CrNewDBFFL With 3,'PRSCN'              
Do CrNewDBFFL With 3,'PSERIAL'            
Do CrNewDBFFL With 3,'RANALY'             
Do CrNewDBFFL With 3,'RBOOK'              
Do CrNewDBFFL With 3,'RCHK'               
Do CrNewDBFFL With 3,'RDAILY'             
Do CrNewDBFFL With 3,'RDPAY'              
Do CrNewDBFFL With 3,'REPOWAY'            
Do CrNewDBFFL With 3,'RHOPROF'            
Do CrNewDBFFL With 3,'RHORECV'            
Do CrNewDBFFL With 3,'RMAID'              
Do CrNewDBFFL With 3,'RMINIT'             
Do CrNewDBFFL With 3,'RMONTH'             
Do CrNewDBFFL With 3,'RMSHOW'             
Do CrNewDBFFL With 3,'RMTRAN'             
Do CrNewDBFFL With 3,'RNIGHT'             
Do CrNewDBFFL With 3,'RPAY'               
Do CrNewDBFFL With 3,'RSTATUS'            
Do CrNewDBFFL With 3,'RSUM'               
Do CrNewDBFFL With 3,'RSUMM'              
Do CrNewDBFFL With 3,'SEND2RUN'           
Do CrNewDBFFL With 3,'SPSCREEN'           
Do CrNewDBFFL With 3,'TEMPROOM'           
Do CrNewDBFFL With 3,'TXT2HO'             
Do CrNewDBFFL With 3,'TXT2HO1'            


Do CrTranRoom && สร้างไฟล์ห้อง 
**** รอบสุดท้าย 
local array MyFiles[1,1]
nFilesFound=ADIR(MyFiles,dForOlddata+'R*.dbf')
For i = 1 to nFilesFound
	? Alltrim(MyFiles[i,1])
	cRoom=Alltrim(MyFiles[i,1])
	cRoom=Left(cRoom,Len(cRoom)-4)
	Do CrNewDBFFL With 3,cRoom
Endfor
Release MyFiles
If nForDel=2 .and. !File(dForOlddata+'_Data.OK')  &&  ป้องกันการดึงข้อมูลตั้งต้นซ้ำ 
	Save To (dForOlddata+'_Data.OK')
	? 'สร้างไฟล์ '+dForOlddata+'_Data.OK'
Endif 
? '==FINNISH == '
Set SysMenu To Defa
Return




Procedure CrNewDBFFL
Parameter nNewDBFFL,cNewDBFFL
Close Data
cNewDBFFL=Alltrim(cNewDBFFL)
cOldData=dForOlddata+cNewDBFFL+'.Dbf'
cOldCdx=dForOlddata+cNewDBFFL+'.Cdx'
cDataWork=cNewDBFFL+'.Dbf'
If File(cOldData) .and. File(cDataWork)
	Use (cDataWork) In 0 Exclu Alias cDataWork
	Select cDataWork
	Count To nRec 
	If nRec=1  && มีรายการเดียว 
		Use (cOldData) In 0 Share NoUpdate Alias cOldData
		Select cOldData 
		Go Top In cOldData
		Scatter Memvar 
		Select cDataWork
		Go Top In cDataWork 
		Gather Memvar 
	Else 
		? Dbf()+' <=== ADD '
		Zap
		Append From &cOldData
	Endif 
	Close Data
	If nForDel=1 && ลบไฟล์ด้วย 
		Delete File &cOldData
		Delete File &cOldCdx
	Endif 
Endif 
Close Data
Return 



*** Do CrTranRoom In D:\BdPosVFP\_NewData.Prg 
Procedure CrTranRoom
Close Data
cfTranRoom='D:\BdPosVFP\Transac\Rooms\' && สำหรับห้องในระบบโรงแรม 
***
If !Directory(cfTranRoom)
	cFoxMessColor="RGB(128,0,128)" && ม่วง
	Do Fox_Mess With 'ไม่พบโพลเดอร์  '+cfTranRoom
	Return 
Endif 
If !File(cfTranRoom+'000.Dbf')
	cFoxMessColor="RGB(128,0,128)" && ม่วง
	Do Fox_Mess With 'ไม่พบไฟล์ '+cfTranRoom+'000.Dbf'
	Return 
Endif 
If Type('dForOlddata')='U'
	cFoxMessColor="RGB(128,0,128)" && ม่วง
	Do Fox_Mess With 'ไม่พบไฟล์ ตัวแปร'
	Return 
Endif 
Use RoomCode In 0 Share Noupdate Alias RoomCode OrDer RmNo
USe (cfTranRoom+'000.Dbf') In 0 Share Noupdate Alias Fle000
Select RoomCode
Scan 
	cRmService=cfTranRoom+'R'+Alltrim(RoomCode.Rmno)
	cRmNew=dForOlddata+'R'+Alltrim(RoomCode.Rmno)
	If File(cRmService+'.dbf')
		*** ? 'พบ ไฟล์ '+cRmService
	Else 
		Select Fle000
		Copy Stru To (cRmService) With CDX
		? 'ไม่พบไฟล์ '+cRmService+' สร้างแล้ว'
	Endif 
	Select RoomCode
EndScan 
Close Data
Return 



Procedure CrSetupData
cTempD='\UyodTeam\_Fpw26Data'  && สำหรับข้อมูลเวอร์ชั่นเก่า 
If !Directory(cTempD)
	Do CreateFolder With cTempD In \Pos\Security\Prog\UtilAll2
Endif 
cTempD='\UyodTeam\_InitData'  && สำหรับข้อมูลตั้งต้น 
If !Directory(cTempD)
	Do CreateFolder With cTempD In \Pos\Security\Prog\UtilAll2
Endif 
Return 


