= ? and enddate <= ?"; $parameters[] = $_GET["enddate_min"]; $parameters[] = $_GET["enddate_max"]; } if (!empty($_GET["createdate_min"]) && !empty($_GET["createdate_max"])) { $filter_sql .= " and o.createdate >= ? and o.createdate <= ?"; $parameters[] = $_GET["createdate_min"]; $parameters[] = $_GET["createdate_max"]; } if (!empty($_GET["code"])) { $filter_sql .= " and o.id = ?"; $parameters[] = $_GET["code"]; } if (!empty($_GET["customer_code"]) || !empty($_GET["customer_name"]) || !empty($_GET["customer_tel"])) { $filter_sql .= " and customer_id IN (?)"; $ids = array($_GET["customer_code"], $_GET["customer_name"], $_GET["customer_tel"]); $parameters[] = implode(",", array_filter($ids)); } if (!empty($_GET["order_room"])) { $room_ids = array(); $room_list = get_order_by_room_id($_GET["order_room"]); foreach ($room_list as $rl) { $room_ids[] = $rl['order_id']; } $filter_sql .= " and o.id IN (" . implode(",", $room_ids) . ")"; } if (!empty($_GET["status"])) { $filter_sql .= " and status = ?"; $parameters[] = $_GET["status"]; } if (empty($filter_sql)) { $date = new DateTime(); $date->modify("+1 month"); $filter_sql .= " and o.status = ? and enddate <= ? and enddate >= ?"; $parameters = array("NEW", $date->format("Y-m-d"), date("Y-m-d")); } //pagination // how many records should be displayed on a page? $records_per_page = 20; // instantiate the pagination object $pagination = new Zebra_Pagination(); // records per page $pagination->records_per_page($records_per_page); $sql = "select count(*) as count from `order` as o INNER JOIN location l ON o.location_id = l.id where o.deleted = 0 " . $filter_sql . " order by o.enddate ASC"; $order_info = bind_pdo($sql, $parameters, "selectone"); // the number of total records is the number of records in the array $pagination->records($order_info['count']); $sql = "select o.*, CONCAT(l.code, ' ', l.name_tc) AS loc FROM `order` as o INNER JOIN location l ON o.location_id = l.id where o.deleted = 0 " . $filter_sql . " order by o.enddate ASC"; $sql .= ' LIMIT ' . (($pagination->get_page() - 1) * $records_per_page) . ', ' . $records_per_page ; $order_info = bind_pdo($sql, $parameters, "selectall"); foreach ($order_info as $key => $order) { $order_info[$key]["order_code"] = $order["code"]; /*$customer_info = get_customer($order["customer_id"]); $order_info[$key]["customer_code"] = $customer_info["code"]; $order_info[$key]["customer_name"] = $customer_info["customer_name"];*/ $customer_name = get_customer_name(rsa_crypt($order["customer_firstname"], 2), rsa_crypt($order["customer_lastname"], 2)); $order_info[$key]["customer_code"] = $order["customer_code"]; $order_info[$key]["customer_name"] = $customer_name; $order_info[$key]["customer_tel"] = rsa_crypt($order_info[$key]["customer_tel"], 2); // order rooms per orderId $order_room_info = get_order_room($order["id"]); // reset data $order_room_list = NULL; // $order_room_list = ""; $master_room_total_retail_price = ""; $master_room_display_size = NULL; // $master_room_display_size = ""; // each of order room foreach ($order_room_info as $detail) { $room_info = get_room($detail["room_id"]); $order_room_list[] = check_combine_room($room_info["code"]); // $order_room_list .= check_combine_room($room_info["code"]) . ", "; $master_room = get_master_room($room_info["master_room_id"]); $master_room_total_retail_price += (int)$master_room["retail_price"]; $master_room_display_size[] = $master_room["display_size"]; // $master_room_display_size .= $master_room["display_size"] . ", "; } $order_info[$key]["order_room_list"] = implode('
', $order_room_list);; // $order_info[$key]["order_room_list"] = substr_replace($order_room_list, "", -2); $order_info[$key]["master_room_total_retail_price"] = $master_room_total_retail_price; $order_info[$key]["master_room_display_size"] = implode('
', $master_room_display_size); // $order_info[$key]["master_room_display_size"] = substr_replace($master_room_display_size, "", -2); } // $filter_order_code = ""; $filter_customer_code = ""; $filter_customer_name = ""; $filter_customer_tel = ""; $filter_status = ""; $filter_startfrom = ""; $filter_room = ""; $all_order_info = get_order2(); foreach ($all_order_info as $key => $order) { $filter_order_code[$key][0] = $order["id"]; $filter_order_code[$key][1] = $order["code"]; } $all_order_info = get_customer2(); foreach ($all_order_info as $key => $customer) { $filter_customer_code[$key][0] = $customer["id"]; $filter_customer_code[$key][1] = $customer["code"]; $filter_customer_name[$key][0] = $customer["id"]; $filter_customer_name[$key][1] = $customer["customer_name"]; $filter_customer_tel[$key][0] = $customer["id"]; $filter_customer_tel[$key][1] = $customer["tel"]; } $all_room_info = get_room(); foreach ($all_room_info as $key => $room) { $filter_room[$key][0] = $room["id"]; $filter_room[$key][1] = $room["code"]; } $status_info = get_master_type_code("ORDER_STATUS"); foreach ($status_info as $key => $status) { $filter_status[$key][0] = $status["code"]; $filter_status[$key][1] = $status["name_tc"]; } $filter2_info = array(0 => $filter_order_code, 1 => $filter_customer_code, 2 => $filter_customer_name, 3 => "user_input", 4 => $filter_status, 5 => "user_input", 6 => $filter_customer_tel, 7 => $filter_room); if(!empty($_GET["export"])){ $sql = "select o.*, CONCAT(l.code, ' ', l.name_tc) AS loc FROM `order` as o INNER JOIN location l ON o.location_id = l.id where o.deleted = 0 " . $filter_sql . " order by o.enddate ASC"; $export_info = bind_pdo($sql, $parameters, "selectall"); foreach ($export_info as $key => $order) { $export_info[$key]["order_code"] = $order["code"]; $customer_name = get_customer_name(rsa_crypt($order["customer_firstname"], 2), rsa_crypt($order["customer_lastname"], 2)); $export_info[$key]["customer_code"] = $order["customer_code"]; $export_info[$key]["customer_name"] = $customer_name; $export_info[$key]["customer_tel"] = rsa_crypt($export_info[$key]["customer_tel"], 2); $order_room_info = get_order_room($order["id"]); $order_room_list = ""; foreach ($order_room_info as $detail) { $room_info = get_room($detail["room_id"]); $order_room_list .= check_combine_room($room_info["code"]) . ", "; } $export_info[$key]["order_room_list"] = substr_replace($order_room_list, "", -2); } $excel = new PHPExcel(); $sheet = $excel->getActiveSheet(); $sheet->setTitle("Daily sales report"); $header = array('合約編號', '客戶姓名', '聯絡電話', '分店', '租用單位', '面積(平方呎)', '尺寸', '生效日期', '結束日期', '租用期(月)', '備註'); foreach ($header as $k => $h) { $sheet->getCellByColumnAndRow($k, 1)->setValueExplicit($h); } foreach ($export_info as $i => $o) { $r = $i + 2; $sheet->getCellByColumnAndRow(0, $r)->setValueExplicit($o['order_code']); $sheet->getCellByColumnAndRow(1, $r)->setValueExplicit($o['customer_name']); $sheet->getCellByColumnAndRow(2, $r)->setValueExplicit($o['customer_tel']); $sheet->getCellByColumnAndRow(3, $r)->setValueExplicit($o['loc']); $sheet->getCellByColumnAndRow(4, $r)->setValueExplicit($o['order_room_list']); $sheet->getCellByColumnAndRow(5, $r)->setValueExplicit($o['roughly_size']); $sheet->getCellByColumnAndRow(6, $r)->setValueExplicit($o['startdate']); $sheet->getCellByColumnAndRow(7, $r)->setValueExplicit($o['enddate']); $sheet->getCellByColumnAndRow(8, $r)->setValueExplicit($o['rent_month']); } $objWriter = new PHPExcel_Writer_Excel2007($excel); header('Content-Type: application/vnd.ms-excel'); header('Content-Disposition: attachment;filename="contract_alert_data_' . date('Ymd') . '.xlsx"'); header('Cache-Control: max-age=0'); $objWriter->save('php://output'); die(); } if(!empty($_GET["send_alert"]) && !empty($_GET["id"])){ if($_GET["send_alert"] == 1){ //$order_info = get_order((int)$_GET["id"]); contract_alert_email((int)$_GET["id"]); } } ?>
 
  
   快將完結合約
搜尋

完結日期

" style="width: 150px;" /> 至 " style="width: 150px;" />

建立日期

" style="width: 150px;" /> 至 " style="width: 150px;" />


"; print ""; print ""; print ""; /*$customer_type = get_master_type_code("CUSTOMER_TYPE", $order["customer_typeid"]); if($order["customer_typeid"] == "BUSINESS"){ print ""; }else if($order["customer_typeid"] == "PERSONAL"){ print ""; }*/ print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; $order_status = get_master_type_code("ORDER_STATUS", $order["status"]); print ""; // Modify $total_retail_price = (int)$order['master_room_total_retail_price']; /* contract price (superseded) if ($order['location_id'] == "5") { $default_msg = "您好,出入易迷你倉提提您,您的迷你倉" . $order['order_room_list'] . "," . $order['roughly_size'] . "平方呎倉 .,合約將於".$order["enddate"]."到期,請參考以下最新續約價錢:\n\n每月付:$" . (int)$order["total_retail_price"] . "/月\n預付3個月:$" . ceil((int)$order["total_retail_price"]*0.95) . "/月\n預付6個月:$" . ceil((int)$order["total_retail_price"]*0.9) . "/月\n預付12個月:$" . ceil((int)$order["total_retail_price"]*0.88) . "/月\n\n繳款方法:\n1) PPS 繳費靈本公司之商戶號碼:6602\n您的客戶編號: " . substr($order["customer_code"],1) . "\n2) FPS 轉數快\n本公司之商戶號碼:160830451\n3)入票或轉帳至本公司之恆生銀行戶口\n戶口名稱:In N Out International Corporate Limited \n戶口號碼:239-480981-001\n4)親臨城都5樓辦公室以現金/支票/EPS繳費,或以支付寶(+1.5%附加費)/信用卡(+3%附加費)支付\n\n** 本公司有權對以上迷你倉價格及優惠作出任何更改,一切以最後合約及收據為準"; } else { $default_msg = "您好,出入易迷你倉提提您,您的迷你倉" . $order['order_room_list'] . "," . $order['roughly_size'] . "平方呎倉 .,合約將於".$order["enddate"]."到期,請參考以下最新續約價錢:\n\n每月付:$" . (int)$order["total_retail_price"] . "/月\n預付3個月:$" . ceil((int)$order["total_retail_price"]*0.95) . "/月\n預付6-12個月:$" . ceil((int)$order["total_retail_price"]*0.9) . "/月\n\n繳款方法:\n1) PPS 繳費靈本公司之商戶號碼:6602\n您的客戶編號: " . substr($order["customer_code"],1) . "\n2) FPS 轉數快\n本公司之商戶號碼:160830451\n3)入票或轉帳至本公司之恆生銀行戶口\n戶口名稱:In N Out International Corporate Limited \n戶口號碼:239-480981-001\n4)親臨城都5樓辦公室以現金/支票/EPS繳費,或以支付寶(+1.5%附加費)/信用卡(+3%附加費)支付\n\n** 本公司有權對以上迷你倉價格及優惠作出任何更改,一切以最後合約及收據為準"; } */ // master room price if ($order['location_id'] == "5") { $default_msg = "您好,出入易迷你倉提提您,您的迷你倉" . $order['order_room_list'] . "," . $order['roughly_size'] . "平方呎倉 .,合約將於".$order["enddate"]."到期,請參考以下最新續約價錢:\n\n每月付:$" . $total_retail_price . "/月\n預付3個月:$" . ceil($total_retail_price*0.95) . "/月\n預付6個月:$" . ceil($total_retail_price*0.9) . "/月\n預付12個月:$" . ceil($total_retail_price*0.88) . "/月\n\n繳款方法:\n1) PPS 繳費靈本公司之商戶號碼:6602\n您的客戶編號: " . substr($order["customer_code"],1) . "\n2) FPS 轉數快\n本公司之商戶號碼:160830451\n3)入票或轉帳至本公司之恆生銀行戶口\n戶口名稱:In N Out International Corporate Limited \n戶口號碼:239-480981-001\n4)親臨城都5樓辦公室以現金/支票/EPS繳費,或以支付寶(+1.5%附加費)/信用卡(+3%附加費)支付\n\n** 本公司有權對以上迷你倉價格及優惠作出任何更改,一切以最後合約及收據為準"; } else { $default_msg = "您好,出入易迷你倉提提您,您的迷你倉" . $order['order_room_list'] . "," . $order['roughly_size'] . "平方呎倉 .,合約將於".$order["enddate"]."到期,請參考以下最新續約價錢:\n\n每月付:$" . $total_retail_price . "/月\n預付3個月:$" . ceil($total_retail_price*0.95) . "/月\n預付6-12個月:$" . ceil($total_retail_price*0.9) . "/月\n\n繳款方法:\n1) PPS 繳費靈本公司之商戶號碼:6602\n您的客戶編號: " . substr($order["customer_code"],1) . "\n2) FPS 轉數快\n本公司之商戶號碼:160830451\n3)入票或轉帳至本公司之恆生銀行戶口\n戶口名稱:In N Out International Corporate Limited \n戶口號碼:239-480981-001\n4)親臨城都5樓辦公室以現金/支票/EPS繳費,或以支付寶(+1.5%附加費)/信用卡(+3%附加費)支付\n\n** 本公司有權對以上迷你倉價格及優惠作出任何更改,一切以最後合約及收據為準"; } print ""; // print ""; print ""; } ?>
合約編號 門卡號碼 客戶姓名 聯絡電話 分店 租用單位 面積
(平方呎)
尺寸 租用期(月) 生效日期 結束日期 狀態 發出電郵通知 Whataspp
 " . $order['order_code'] . "" . $order['room_key'] . "" . $customer_type["name_tc"] . "
".$order["customer_companyname"]."
" . $customer_type["name_tc"] . "" . $order['customer_name'] . "" . $order['customer_tel'] . "" . $order['loc'] . "" . $order['order_room_list'] . "" . $order['roughly_size'] . "" . $order['master_room_display_size'] . "" . $order['rent_month'] . "" . $order['startdate'] . "" . $order['enddate'] . "" . $order_status["name_tc"] . "

render(); ?>