$where .= " AND o.goods_sn={$goods_sn} "; $condition .= "&goods_sn={$goods_sn}"; } if ($goods_name != '') { $where .= " AND o.goods_name LIKE '%{$goods_name}%' "; $condition .= "&goods_name={$goods_name}"; } if ($add_time != '') { $start_time = strtotime($add_time . ' 00:00:00'); $end_time = strtotime($add_time . ' 23:59:59'); $where .= " AND o.add_time>={$start_time} AND o.add_time<={$end_time} "; $condition .= "&add_time={$add_time}"; } $sql_one = 'SELECT COUNT(*) FROM ' . $GLOBALS['ecs']->table('order_sheet') . ' o ' . $where; $sql_select = 'SELECT o.order_sheet_id,o.goods_sn,o.goods_name,o.add_time,o.production_day,o.manufacturer,u.unit_name,o.quantity,o.status,a.user_name FROM ' . $GLOBALS['ecs']->table('order_sheet') . ' AS o LEFT JOIN' . $GLOBALS['ecs']->table('goods_unit') . ' AS u ON o.unit_id=u.unit_id LEFT JOIN ' . $GLOBALS['ecs']->table('admin_user') . ' AS a ON o.add_admin=a.user_id' . $where . ' ORDER BY add_time ASC'; $result = filter_page($sql_one, $sql_select, 'sch_order_sheet'); $filter = $result['filter']; $filter['source'] = 'storage.php'; $order_sheet_list = $result['result']; foreach ($filter as $key => $val) { $smarty->assign($key, $val); } foreach ($order_sheet_list as &$val) { $val['add_time'] = date('Y-m-d', $val['add_time']); $val['production_day'] = date('Y-m-d', $val['production_day']); } $res['response_action'] = 'search_service'; $smarty->assign('order_sheet_list', $order_sheet_list); //$smarty->assign('filter',$filter); //$smarty->assign('foot_page',$smarty->fetch('foot_page.htm')); $smarty->assign('foot_page', $smarty->fetch('page_fragment.htm'));
function ask_customer($table, $filter) { if (!$filter['role_id']) { $sqlstrs['count'] = 'SELECT count(*) AS count FROM ' . $GLOBALS['ecs']->table($table); $sqlstrs['select'] = 'SELECT * FROM ' . $GLOBALS['ecs']->table($table); } else { $sqlstrs['count'] = 'SELECT count(*) AS count FROM ' . $GLOBALS['ecs']->table($table) . ' WHERE role_id=' . $filter['role_id']; $sqlstrs['select'] = 'SELECT * FROM ' . $GLOBALS['ecs']->table($table) . ' WHERE role_id=' . $filter['role_id']; } $result = filter_page($filter, $sqlstrs); foreach ($result['result'] as &$val) { $val['add_time'] = date('Y-m-d H:i', $val['add_time']); if ($val['service_time']) { $val['service_time'] = date('Y-m-d H:i', $val['servcie_time']); } } return $result; }
function get_tasks_list($where = '') { if ($where == '') { $where = ' WHERE status=1'; } $sql_select = 'SELECT t.task_id,t.task_name,t.purpose_value,t.mod_time,t.period_id,t.deadline,r.role_name AS platform,t.group_id FROM ' . $GLOBALS['ecs']->table('tasks') . ' t LEFT JOIN ' . $GLOBALS['ecs']->table('role') . ' r ON t.platform=r.role_id' . " {$where} ORDER BY t.mod_time DESC "; $sql_one = 'SELECT COUNT(*) FROM ' . $GLOBALS['ecs']->table('tasks') . $where; $result = filter_page($sql_one, $sql_select, 'tasks_site'); return $result; }