<?
if (!$_REQUEST['search_d']&&!$_REQUEST['search_m']&&!$_REQUEST['search_y']) {
$search_d=date('d');
$search_m=date('m');
$search_y=date('Y');
}else {
$search_d=$_REQUEST['search_d'];
$search_m=$_REQUEST['search_m'];
$search_y=$_REQUEST['search_y'];
}
if (!$_REQUEST['order']){ $s_order=""; }else{ $s_order="คำสั่งซื้อ"; }
if (!$_REQUEST['customer']){ $s_customer=""; }else{ $s_customer="ลูกค้า"; }
if (!$_REQUEST['product']){ $s_product=""; }else{ $s_product="สินค้า"; }
if (!$_REQUEST['price']){ $s_price=""; }else{ $s_price="ราคา"; }
if (!$_REQUEST['stock']){ $s_stock=""; }else{ $s_stock="สต็อค"; }
if (!$_REQUEST['mana']){ $s_mana=""; }else{ $s_mana="จัดการ"; }
if (!$_REQUEST['sys']){ $s_sys=""; }else{ $s_sys="ระบบ"; }
if ($search_d!="") { $qyery_d = "AND DAY(log_date)=".$search_d; }
$sql="SELECT * FROM log WHERE MONTH(log_date) = '$search_m' AND YEAR(log_date) = '$search_y' $qyery_d AND log_status LIKE '%$s_order%' AND log_status LIKE '%$s_customer%' AND log_status LIKE '%$s_product%' AND log_status LIKE '%$s_price%' AND log_status LIKE '%$s_stock%' AND log_status LIKE '%$s_mana%' AND log_status LIKE '%$s_sys%' ORDER BY log_date DESC";