<% crlf=chr(13)+chr(10) msg=[starting ]+crlf msg=msg+TRANSFORM(LINENO()-4)+crlf *STRTOFILE(msg,ADDBS(oprop.appstartpath)+[temp\actions.txt]) set date ymd set century on set mark to [/] my_ratification_date=date() my_ratification_number=[] iserror=.F. msg=[starting ]+crlf msg=msg+TRANSFORM(LINENO()-4)+crlf *strtOFILE(msg,ADDBS(oprop.appstartpath)+[temp\actions.txt]) =usesafe([category]) =Sys(3101,1256) *=SYS(3101,65001) file_reference=orequest.Form('file_reference') *strtOFILE(msg,ADDBS(oprop.appstartpath)+[temp\actions.txt]) M_VISANUMBER=orequest.Form('visa_issue_number') M_VISADATE=orequest.Form('visa_date') M_SPONNAME=orequest.Form('sponsor_full_name') M_SPONADD=orequest.Form('sponsor_address') if [ ] $ M_SPONADD do while [ ] $ M_SPONADD M_SPONADD=strtran(M_SPONADD,[ ],[ ]) enddo endif M_SPONID=orequest.Form('sponsor_id_number') m_embassy=orequest.Form('embassy_location') delegation_list=orequest.Form('delegation_list') deletation_in_embassy=orequest.Form('delegation_of_embassies') jobs_list=orequest.form('jobs_list') errmsg=transform(LINENO()) msg=msg+TRANSFORM(LINENO()-4)+crlf *strtoFILE(msg,ADDBS(oprop.appstartpath)+[temp\actions.txt]) iserror=.f. If Isnull(M_VISANUMBER) Return '{"status":"error","message":" first '+file_reference+'"}' Endif errmsg=transform(LINENO()) msg=msg+TRANSFORM(LINENO()-4)+crlf tfilename=dbclocation+[works\visainfo.dbf] errmsg=transform(LINENO()) if File(tfilename) try Use (tfilename) In Select('visainfo') if type([visainfo.coder])="U" use in select('visainfo') alter table (tfilename) add column coder c(15) endif if type([visainfo.ratdate])<>"D" use in select('visainfo') alter table (tfilename) alter column ratdate d(8) endif if type([visainfo.CHOOSETEXT])<>"C" use in select('visainfo') alter table (tfilename) alter column CHOOSETEXT c(10) endif CATCH try erase (tfilename) Catch errmsg=[File visainfo.dbf could not be deleted. Line ]+transform(lineno()) iserror=.t. endtry ENDTRY endif If iserror Return '{"status":"error","message":"'+errmsg+'"}' Endif If Not File(tfilename) tcmd=[Create Table (']+tfilename+[') Free (entdate d(8), listType c(20),Code C(15),CodeR C(15),ratdate d(8), SR N(4,0), QTY N(4,0), PROF C(40),embassy C(4),] tcmd=tcmd+[ratified C(80), Comp C(80), Year N(2,0),Month N(2,0), SALARY N(8,0),CATEGORY C(40), SKILL N(1,0), REFFID C(9),] tcmd=tcmd+[SPONID C(15), SPONNAME C(80), SPONADR C(80), VISAID C(15), VISADT C(10),Curr C(5), CHOOSE L(1),CHOOSETEXT c(10),CID N(8),PID N(8),ownlic C(1))] try &tcmd Catch errmsg=[File visainfo.dbf could not be created. Line ]+transform(lineno()) iserror=.t. endtry ENDIF If iserror Return '{"status":"error","message":"'+errmsg+'"}' Endif tcmd=[Use (']+tfilename+[') In Select('visainfo')] &tcmd select 'visainfo' delete all for allt(reffid)==file_reference or entdate