BMS-HOSxP Community

HOSxP => แจ้งปัญหา / ขอความช่วยเหลือ => ข้อความที่เริ่มโดย: vios1909 ที่ กันยายน 14, 2017, 16:25:57 PM

หัวข้อ: วันที่ใน Variable
เริ่มหัวข้อโดย: vios1909 ที่ กันยายน 14, 2017, 16:25:57 PM
คำสั่งใน Variable เป็นแบบนี้

Value := GetListFromQuery( 'select concat(date_format(lh.report_date,''(%e-%c-%Y)'')) from lab_order lo left outer join lab_head lh on lh.lab_order_number=lo.lab_order_number  where lh.hn='''+ DBPipeline['hn'] + '''and lo.lab_items_code=76 order by report_date desc,report_time desc limit 0,1');

แสดงผลเป็น  (13-9-2017) อยากให้มันขึ้นเป็น ปี พ.ศ. (13-9-2560) ต้องทำไงครับ ช่วยชี้แนะด้วยครับ
หัวข้อ: Re: วันที่ใน Variable
เริ่มหัวข้อโดย: chitvichai ที่ กันยายน 18, 2017, 22:27:32 PM
คำสั่งใน Variable เป็นแบบนี้

Value := GetListFromQuery( 'select concat(date_format(lh.report_date,''(%e-%c-%Y)'')) from lab_order lo left outer join lab_head lh on lh.lab_order_number=lo.lab_order_number  where lh.hn='''+ DBPipeline['hn'] + '''and lo.lab_items_code=76 order by report_date desc,report_time desc limit 0,1');

แสดงผลเป็น  (13-9-2017) อยากให้มันขึ้นเป็น ปี พ.ศ. (13-9-2560) ต้องทำไงครับ ช่วยชี้แนะด้วยครับ
โค๊ด: [Select]
ถ้าใช้ คำสั่ง mysql ต้องเปลี่ยน
concat(date_format(lh.report_date,"(%e-%c-%Y)"))
เป็น
concat(date_format(lh.report_date,"%d-%m"),"-",date_format(lh.report_date,"%y")+543)
แนะนำให้ใช้
function FormatThaiDate ใน report disigner
เป็น
Value := FormatThaiDate('d-m-yyyy',
GetSQLDateData( 'select lh.report_date
from lab_order lo
left outer join lab_head lh on lh.lab_order_number=lo.lab_order_number 
where lh.hn='''+ DBPipeline['hn'] + ''' and lo.lab_items_code=76
order by report_date desc,report_time desc limit 0,1'));
:) :)
หัวข้อ: Re: วันที่ใน Variable
เริ่มหัวข้อโดย: vios1909 ที่ ตุลาคม 04, 2017, 09:59:10 AM
ขอบคุณมากครับ