$stquery = " select *,".
" convert(varchar, job_assign_dat, 103) as jobAssign,".
" convert(varchar, job_cre_dat, 103) as jobCreDat,".
" (select u.user_name from sc_user u where u.user_code = job_cre) as jobCre,".
" convert(varchar, job_assigned_dat, 103) as jobAssigned,".
" isnull( job_penalty,0) as jobCarPenalty,".
" isnull(job_track,0)as Track,".
" convert(varchar, job_pay_last_dat , 103) as lastDat,".
" CONVERT(VARCHAR,CONVERT(MONEY,job_car_finance),1) as jobCarFinance,".
"CONVERT(VARCHAR,CONVERT(MONEY,job_car_period_amt),1) as jobCarPeriodAmt,".
" CONVERT(VARCHAR,CONVERT(MONEY,job_price_hold),1) as jobPriceHold,".
" (select l.cust_name + c.cust_name".
" FROM ms_customer c left join ms_customer l on c.cust_parent = l.cust_code where c.cust_code = job_branch) as jobBranch, ".
"(select case_addr_l1 ".
" from cvs_case c1,cvs_job c2 ".
" where case_cust_id = ? ".
" and c1.case_no = c2.job_id ".
" and c1.case_ref_l2 like 0 ".
" and c1.case_place_type like ".'O'." ) as l1 ".
" from cvs_case c1,cvs_job c2".
" where case_id = ?".
"and c1.case_no = c2.job_id";
function caseInq(){
$caseID = $this->input->get_post('caseID', TRUE);
$caseNo = $this->input->get_post('caseNo', TRUE);
$custId = $this->input->get_post('custId', TRUE);
$userId = $this->session->userdata('userId');
$team = $this->session->userdata('team');
$stquery = ' select *,'.
' convert(varchar, job_assign_dat, 103) as jobAssign,'.
' convert(varchar, job_cre_dat, 103) as jobCreDat,'.
' (select u.user_name from sc_user u where u.user_code = job_cre) as jobCre,'.
' convert(varchar, job_assigned_dat, 103) as jobAssigned,'.
' isnull( job_penalty,0) as jobCarPenalty,'.
' isnull(job_track,0)as Track,'.
' convert(varchar, job_pay_last_dat , 103) as lastDat,'.
' CONVERT(VARCHAR,CONVERT(MONEY,job_car_finance),1) as jobCarFinance,'.
' CONVERT(VARCHAR,CONVERT(MONEY,job_car_period_amt),1) as jobCarPeriodAmt,'.
' CONVERT(VARCHAR,CONVERT(MONEY,job_price_hold),1) as jobPriceHold,'.
' (select l.cust_name +" - "+ c.cust_name'.
' FROM ms_customer c left join ms_customer l on c.cust_parent = l.cust_code where c.cust_code = job_branch) as jobBranch,'.
'(select case_addr_l1 '.
' from cvs_case c1,cvs_job c2 '.
' where c1.case_cust_id like "1747123"'.
' and c1.case_no = c2.job_id '.
' and c1.case_ref_l2 like 0 '.
' and c1.case_place_type like "O" ) as l1, '.
' case c2.job_sign_contract '.
' when "1" then "หมายเก็บ" '.
' else "หมายยึด" '.
' end as jobSignContract '.
' and c1.case_ref_12 like \'0\' '.
' and c1.case_place_type like \'HD\' ) as l1 '.
หรือ
" and c1.case_ref_12 like '0' ".
" and c1.case_place_type like 'HD' ) as l1 ".
20.' (select concat( l.cust_name , " - " , c.cust_name) '.
21.' FROM ms_customer c left join ms_customer l on c.cust_parent = l.cust_code where c.cust_code = job_branch) as jobBranch,'.
22.'(select case_addr_l1 '.
23.' from cvs_case c1,cvs_job c2 '.
24.' where c1.case_cust_id like "$custId" '.
function caseInq(){
$caseID = $this->input->get_post('caseID', TRUE);
$caseNo = $this->input->get_post('caseNo', TRUE);
$custId = $this->input->get_post('custId', TRUE);
$userId = $this->session->userdata('userId');
$team = $this->session->userdata('team');
$stquery = ' select *,'.
' convert(varchar, job_assign_dat, 103) as jobAssign,'.
' convert(varchar, job_cre_dat, 103) as jobCreDat,'.
' (select u.user_name from sc_user u where u.user_code = job_cre) as jobCre,'.
' convert(varchar, job_assigned_dat, 103) as jobAssigned,'.
' isnull( job_penalty,0) as jobCarPenalty,'.
' isnull(job_track,0)as Track,'.
' convert(varchar, job_pay_last_dat , 103) as lastDat,'.
' CONVERT(VARCHAR,CONVERT(MONEY,job_car_finance),1) as jobCarFinance,'.
' CONVERT(VARCHAR,CONVERT(MONEY,job_car_period_amt),1) as jobCarPeriodAmt,'.
' CONVERT(VARCHAR,CONVERT(MONEY,job_price_hold),1) as jobPriceHold,'.
' (select l.cust_name +" - "+ c.cust_name'.
' FROM ms_customer c left join ms_customer l on c.cust_parent = l.cust_code where c.cust_code = job_branch) as jobBranch,'.
'(select case_addr_l1 '.
' from cvs_case c1,cvs_job c2 '.
' where c1.case_cust_id = "$custId" '.
' and c1.case_no = c2.job_id '.
' and c1.case_ref_l2 like \'0\' '.
' and c1.case_place_type like \'O\') as l1, '.
' case c2.job_sign_contract '.
' when "1" then "หมายเก็บ" '.
' else "หมายยึด" '.
' end as jobSignContract '.
" from cvs_case c1,cvs_job c2".
" where case_id = ?".
"and c1.case_no = c2.job_id";
0 FROM ms_customer c left join ms_customer l on c.cust_parent = l.cust_code where c.cust_code = job_branch) as jobBranch,(select case_addr_l1 \tfrom cvs_case c1,cvs_job c2 \twhere c1.case_cust_id like \\'1747123\\' \tand c1.case_no = c2.job_id \tand c1.case_ref_l2 like \\'0\\' \tand c1.case_place_type like \\'O\\') as l1, case c2.job_sign_contract when '1' then '\u0e2b\u0e21\u0e32\u0e22\u0e40\u0e01\u0e47\u0e1a' else '\u0e2b\u0e21\u0e32\u0e22\u0e22\u0e36\u0e14' end as jobSignContract from cvs_case c1,cvs_job c2 where case_id = 'KN1203003261'and c1.case_no = c2.job_id<\/p>"}
Code (PHP)
function caseInq(){
$caseID = $this->input->get_post('caseID', TRUE);
$caseNo = $this->input->get_post('caseNo', TRUE);
$custId = $this->input->get_post('custId', TRUE);
$userId = $this->session->userdata('userId');
$team = $this->session->userdata('team');
$stquery = " select *,".
" convert(varchar, job_assign_dat, 103) as jobAssign,".
" convert(varchar, job_cre_dat, 103) as jobCreDat,".
" (select u.user_name from sc_user u where u.user_code = job_cre) as jobCre,".
" convert(varchar, job_assigned_dat, 103) as jobAssigned,".
" isnull( job_penalty,0) as jobCarPenalty,".
" isnull(job_track,0)as Track,".
" convert(varchar, job_pay_last_dat , 103) as lastDat,".
" CONVERT(VARCHAR,CONVERT(MONEY,job_car_finance),1) as jobCarFinance,".
" CONVERT(VARCHAR,CONVERT(MONEY,job_car_period_amt),1) as jobCarPeriodAmt,".
" CONVERT(VARCHAR,CONVERT(MONEY,job_price_hold),1) as jobPriceHold,".
" (select l.cust_name +" - "+ c.cust_name".
" FROM ms_customer c left join ms_customer l on c.cust_parent = l.cust_code where c.cust_code = job_branch) as jobBranch,".
"(select case_addr_l1 ".
" from cvs_case c1,cvs_job c2 ".
" where c1.case_cust_id like \'$custId\' ".
" and c1.case_no = c2.job_id ".
" and c1.case_ref_l2 like \'0\' ".
" and c1.case_place_type like \'O\') as l1, ".
" case c2.job_sign_contract ".
" when '1' then 'หมายเก็บ' ".
" else 'หมายยึด' ".
" end as jobSignContract ".
" from cvs_case c1,cvs_job c2".
" where case_id = ?".
"and c1.case_no = c2.job_id";