// $this->orderby=" ORDER BY pn_payment_date DESC, pn.pn_sn ASC ";
$this->orderby=" ORDER BY CASE pn.pn_send WHEN 'sendfail' THEN 1 ELSE 2 END ,pn.pn_sn DESC ";
return $this->get_list();
@ -77,10 +78,10 @@ class Note_model extends CI_Model {
public function search_date($date) {
$this->init();
$search_sql = " AND (pn.pn_datetime BETWEEN '$date 00:00:00' AND '$date 23:59:59' OR isnull(pn_send,'') in ('sendfail','unsend','')) ";
$search_sql = " AND (pn.pn_datetime BETWEEN '$date 00:00:00' AND '$date 23:59:59' OR isnull(pn_send,'') in ('sendfail','unsend','')) AND pn_memo NOT LIKE '{\"id\":\"WH-%' "; // {"id":"WH-
$this->search = $search_sql;
// $this->orderby=" ORDER BY CASE pn.pn_send WHEN 'sendfail' THEN 1 ELSE 2 END ,pn.pn_sn DESC ";
$this->orderby=" ORDER BY CASE WHEN pn.pn_send='sendfail' AND pn.pn_payment_status='Completed' THEN 1 ELSE 9 END ,pn.pn_sn DESC ";
$this->orderby=" ORDER BY CASE WHEN pn.pn_send='sendfail' AND pn.pn_payment_status='Completed' THEN 1 WHEN pn.pn_send = 'sendfail' THEN 2 ELSE 9 END ,pn.pn_sn DESC ";