<% crlf=chr(13)+chr(10) =Sys(3101,1256) record_number=orequest.form("record_number") if isnull(record_number) record_number=orequest.querystring("rref") endif record_fileref=orequest.form("file_reference") if isnull(record_fileref) record_fileref=orequest.querystring("fref") endif erase (ADDBS(oprop.appstartpath)+'temp\ptn.json') record_fileref=allt(transform(record_fileref)) tfilename=dbclocation+[fileref] tcmd=[select * from (']+tfilename+[') where allt(reffid)==']+record_fileref+[' into cursor 'fcursor'] &tcmd if type([poa_no])="U" poa_no=allt(visaid) endif if type([poa_dt])="U" poa_dt=allt(visadt) endif if type([sendmail])="U" sendmail=allt(xcompany.email) endif if type([sponweb])="U" sponweb=allt(xcompany.web) endif *employer[email] *employer[email] putstring=[] tfilename=addbs(oprop.appstartpath)+[COUNTRIES] tcmd=[Select OEPNUM From (']+tfilename+[') Where Code=fcursor.COUNTRY Into Cursor XTEMP] &tcmd If Not Empty(OEPNUM) putid('employer[country_id]',XTEMP.OEPNUM) &&Employer Country * Endif select [fcursor] putid('demand_ltr_no',visaid) set date british set century on set mark to [/] txttochange=[-./'"{}] txtchangewith=SPACE(LEN(txttochange)) thesponname=iif(empty(sponname),sponnamea,sponname) thesponname=chrtran(thesponname,'-',' ') thesponname=CHRTRAN(thesponname,txttochange,txtchangewith) txttochange=")({\],;:[" txtchangewith=SPACE(LEN(txttochange)) thesponname=CHRTRAN(thesponname,txttochange,txtchangewith) putstring=putstring+[,"poa_date":"]+transform(poa_dt)+["] putstring=putstring+[,"poa_no":"]+transform(poa_no)+["] putstring=putstring+[,"demand_ltr_date":"]+transform(date)+["] putid('demand_type',0) putid('rule_no',2) putid('employer[employer_type_id]',1) putid('employer[employer_name]',thesponname) putid('employer[national_id]',sponid) putid('employer[contact_name]',sendname) putid('employer[email]',sendmail) putid('employer[website]',sponweb) putid('employer[address]',iif(empty(sponadd1),sponadd1a,sponadd1)) putid('employer[city]',destinatio) putid('employer[phone_no]',iif(empty(sponphone),sendphone,sponphone)) putid('employer[fax_no]',iif(empty(sponfax),contphone,sponfax)) putid('details[0][benefits][0][e_benefit_value]',Iif(ACCOMODATI,'1','0')) putid('details[0][benefits][1][e_benefit_value]',Iif(food,'1','0')) putid('details[0][benefits][2][e_benefit_value]',Iif(ticket,'1','0')) putid('details[0][benefits][3][e_benefit_value]',Iif(medical,'1','0')) putid('details[0][benefits][4][e_benefit_value]',Iif(hinsurance,'1','0')) putid('details[0][benefits][5][e_benefit_value]','0') ***Now to put CATEGORIES tfilename=dbclocation+[category] tcmd=[select * from (']+tfilename+[') where allt(reffid)==']+record_fileref+[' into cursor 'ccursor'] &tcmd *putid('e',sponid) CATEGORIESTOPUT=0 Scan putid('recordto'+allt(transform(CATEGORIESTOPUT)),categoriestoput) CTSCR=Alltrim(Transform(CATEGORIESTOPUT)) THECATEGORY=Alltrim(Upper(ccursor.category)) TRADECATEGORY=Icase([DRIVER] $ THECATEGORY,[Driver],[LABOUR] $ THECATEGORY,[Labour / Helper],[LABOR] $ THECATEGORY,[Labour / Helper],[HELPER] $ THECATEGORY,[Labour / Helper],[Gen. Worker]) putid('details['+CTSCR+'][e_trade_id]',TRADECATEGORY) &&Trade Category * putId('details['+CTSCR+'][job_title]',THECATEGORY) &&job Title * putId('details['+CTSCR+'][job_desc]',THECATEGORY) &&job description * putId('details['+CTSCR+'][no_of_persons]',Alltrim(Transform(ccursor.QTY))) &&Persons Required * putId('details['+CTSCR+'][place_of_duty]',fcursor.destinatio) &&Place of duty * PutId('details['+CTSCR+'][salary_min]',Alltrim(Transform(ccursor.SALARY))) &&Min Salary (/month) * putId('details['+CTSCR+'][salary_max]',Alltrim(Transform(ccursor.SALARY))) &&Max Salary (/month) * SELECTEDCOUNTRY=XTEMP.OEPNUM putid('details['+CTSCR+'][currency_id]',SELECTEDCOUNTRY) putId('details['+CTSCR+'][contract_period_y]',Alltrim(Transform(ccursor.Year))) &&Contract Period (yrs) * putId('details['+CTSCR+'][contract_period_m]',Alltrim(Transform(ccursor.Month))) &&Contract Period (mth) * putId('details['+CTSCR+'][working_hours]','8') &&Working Hours/day * putId('details['+CTSCR+'][working_days]','6') &&Working Days/week * putId('details['+CTSCR+'][overtime]','1') &&Overtime * putId('details['+CTSCR+'][experience]','2 YEARS') &&Experiance * putId('details['+CTSCR+'][other_qualifications]','NOT SPECIFIED') &&other_qualifications * *details[0][experience] *details[0][other_qualifications] CATEGORIESTOPUT=CATEGORIESTOPUT+1 Endscan putstring=[{]+SUBSTR(putstring,2)+[}] STRTOFILE(putstring,ADDBS(oprop.appstartpath)+'temp\ptn.json') oResponse.ContentType = "text/json;" oResponse.Write(putstring) oresponse.flush %>