diff --git a/.gitignore b/.gitignore
index 74665935..c01e362a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -21,3 +21,4 @@ wms/excel/gary_test.xlsx
wms/excel/wipwholeintall.xlsx
wms/excel/estimated_shipping_date_report.xlsx
*.docx
+wms/mkt/WriteOffRepair.xlsx
\ No newline at end of file
diff --git a/wms/contract/api/getFacilityNo.php b/wms/contract/api/getFacilityNo.php
index 3c92c600..10b1081d 100644
--- a/wms/contract/api/getFacilityNo.php
+++ b/wms/contract/api/getFacilityNo.php
@@ -60,8 +60,8 @@ class CreateFacilityNo
/**
* 取得下一個新的作番
* @param string $facility_type : M:新梯 T:汰改 B:保養
- * @param string $sale_type : M:内銷 E:外銷 T:他社维保 J:汰改 X:特殊部品
- * @param string $make_type : X:小機房 W:無機房 H:家用梯 Z:雜物梯 F:扶梯 B:部品 Q:品保對策 T:研究開發 N:設備 W:出貨現場要求購買 J:營業問題對策 Y:已出貨作番營業進行規格訂正
+ * @param array $sale_type : M:内銷 E:外銷 T:他社维保 J:汰改 X:特殊部品
+ * @param array $make_type : X:小機房 W:無機房 H:家用梯 Z:雜物梯 F:扶梯 B:部品 Q:品保對策 T:研究開發 N:設備 W:出貨現場要求購買 J:營業問題對策 Y:已出貨作番營業進行規格訂正
* @param int $num : 號機
* @return array $new_facility_arr
*/
@@ -95,7 +95,7 @@ class CreateFacilityNo
$next_seq = $this->getNextFacilitySeq("bf_vol_no");
$new_facility_arr = [];
for ($start_num = 1; $start_num <= $num; $start_num++) {
- $facility_no_tmp = $Y . $sale_type . $make_type
+ $facility_no_tmp = $Y . $sale_type[$start_num - 1] . $make_type[$start_num - 1]
. str_pad($next_seq + 1, 3, "0", STR_PAD_LEFT)
. str_pad($start_num, 2, "0", STR_PAD_LEFT);
array_push($new_facility_arr, $facility_no_tmp);
@@ -109,8 +109,8 @@ class CreateFacilityNo
/**
* 建立新的作番
* @param string $facility_type : M:新梯 T:汰改 B:保養
- * @param string $sale_type : M:内銷 E:外銷 T:他社维保 J:汰改 X:特殊部品
- * @param string $make_type : X:小機房 W:無機房 H:家用梯 Z:雜物梯 F:扶梯 B:部品 Q:品保對策 T:研究開發 N:設備 W:出貨現場要求購買 J:營業問題對策 Y:已出貨作番營業進行規格訂正
+ * @param array $sale_type : M:内銷 E:外銷 T:他社维保 J:汰改 X:特殊部品
+ * @param array $make_type : X:小機房 W:無機房 H:家用梯 Z:雜物梯 F:扶梯 B:部品 Q:品保對策 T:研究開發 N:設備 W:出貨現場要求購買 J:營業問題對策 Y:已出貨作番營業進行規格訂正
* @param string $num : 號機 (非必填)
* @return string $new_facility_no
*/
@@ -214,7 +214,7 @@ class CreateFacilityNo
$new_facility_no_arr = [];
for ($i = 1; $i <= $num; $i++) {
- $new_facility_no = $Y . $sale_type . $make_type
+ $new_facility_no = $Y . $sale_type[$i - 1] . $make_type[$i - 1]
. str_pad($next_seq + 1, 3, "0", STR_PAD_LEFT)
. str_pad($i, 2, "0", STR_PAD_LEFT);
array_push($new_facility_no_arr, $new_facility_no);
@@ -407,26 +407,28 @@ class CreateFacilityNo
/**
* 檢查 $sale_type 是否有存在規則之中
- * @param string $sale_type : M:内銷 E:外銷 T:他社维保 J:汰改 X:特殊部品
+ * @param array $sale_type : M:内銷 E:外銷 T:他社维保 J:汰改 X:特殊部品
* @return boolean $status : true:合法代碼 false:非法代碼
*/
function checkSaleTypeStatus($sale_type)
{
- if (in_array($sale_type, ['M', 'E', 'T', 'J', 'X']))
- return true;
- return false;
+ foreach ($sale_type as $row)
+ if (!in_array($row, ['M', 'E', 'T', 'J', 'X']))
+ return false;
+ return true;
}
/**
* 檢查 $sale_type 是否有存在規則之中
- * @param string $make_type : X:小機房 W:無機房 H:家用梯 Z:雜物梯 F:扶梯 B:部品 Q:品保對策 T:研究開發 N:設備 W:出貨現場要求購買 J:營業問題對策 Y:已出貨作番營業進行規格訂正
+ * @param array $make_type : X:小機房 W:無機房 H:家用梯 Z:雜物梯 F:扶梯 B:部品 Q:品保對策 T:研究開發 N:設備 W:出貨現場要求購買 J:營業問題對策 Y:已出貨作番營業進行規格訂正
* @return boolean $status : true:合法代碼 false:非法代碼
*/
function checkMakeTypeStatus($make_type)
{
- if (in_array($make_type, ['X', 'W', 'H', 'Z', 'F', 'B', 'Q', 'T', 'N', 'W', 'J', 'Y']))
- return true;
- return false;
+ foreach ($make_type as $row)
+ if (!in_array($row, ['X', 'W', 'H', 'Z', 'F', 'B', 'Q', 'T', 'N', 'W', 'J', 'Y']))
+ return false;
+ return true;
}
/**
@@ -481,13 +483,17 @@ class CreateFacilityNo
/**
* 建立新的保養作番
- * @param string $sale_type : M:内銷 E:外銷 T:他社维保 J:汰改 X:特殊部品
- * @param string $make_type : X:小機房 W:無機房 H:家用梯 Z:雜物梯 F:扶梯 B:部品 Q:品保對策 T:研究開發 N:設備 W:出貨現場要求購買 J:營業問題對策 Y:已出貨作番營業進行規格訂正
+ * @param array $sale_type : M:内銷 E:外銷 T:他社维保 J:汰改 X:特殊部品
+ * @param array $make_type : X:小機房 W:無機房 H:家用梯 Z:雜物梯 F:扶梯 B:部品 Q:品保對策 T:研究開發 N:設備 W:出貨現場要求購買 J:營業問題對策 Y:已出貨作番營業進行規格訂正
* @param int $seq_name : 幾個案場 0-99
* @return array $new_facilityno : 作番號
*/
function makeBFacilityNo($sale_type, $make_type, $num)
{
+ if (count($sale_type) !== $num)
+ return "陣列數量不一致!";
+ if (count($make_type) !== $num)
+ return "陣列數量不一致!";
$new_facility_no = $this->getNextFacilityNo("B", $sale_type, $make_type, $num);
if ($this->checkFacilityRepeatStatus($new_facility_no) == false) {
// 如果作番號重複 使用此函數修正
@@ -498,7 +504,7 @@ class CreateFacilityNo
}
-// $cfn = new CreateFacilityNo;
+$cfn = new CreateFacilityNo;
// // 建立作番號 - 新梯
// print_r($cfn->makeMFacilityNo("M", "X", 5));
// echo "
";
@@ -506,5 +512,5 @@ class CreateFacilityNo
// print_r($cfn->makeTFacilityNo("M", "X", 1));
// echo "
";
// // 建立作番號 - 保養
-// print_r($cfn->makeBFacilityNo("M", "X", 1));
+// print_r($cfn->makeBFacilityNo(["M", "E"], ["X", "W"], 2));
// echo "
";
diff --git a/wms/mkt/assets/img/image001.png b/wms/mkt/assets/img/image001.png
new file mode 100644
index 00000000..3cee3340
Binary files /dev/null and b/wms/mkt/assets/img/image001.png differ
diff --git a/wms/mkt/assets/img/stamp.png b/wms/mkt/assets/img/stamp.png
new file mode 100644
index 00000000..c108a496
Binary files /dev/null and b/wms/mkt/assets/img/stamp.png differ
diff --git a/wms/mkt/pricereview_contractno-api.php b/wms/mkt/pricereview_contractno-api.php
new file mode 100644
index 00000000..2c33004b
--- /dev/null
+++ b/wms/mkt/pricereview_contractno-api.php
@@ -0,0 +1,63 @@
+ "ok", "err" => "");
+
+try {
+ if (empty($_POST) || empty($_POST["pa"])) throw new \Exception("parameter empty");
+
+ foreach ($_POST as $k => $v) {
+ $$k = htmlspecialchars(stripslashes(trim($v)));
+ }
+
+ // 基本資料
+ $db_query = "select a.address, a.repairerid, c.contractno, c.company, c.taxid from account a, contract c ";
+ $db_query .= "where a.accountid = c.customerid and c.contractno = '$pa'";
+ $res = mysqli_query($link, $db_query);
+ if ($row = mysqli_fetch_row($res)) {
+ $rarr["address"] = $row[0];
+ $rarr["repairerid"] = $row[1];
+ $rarr["contractno"] = $row[2];
+ $rarr["company"] = $row[3];
+ $rarr["taxid"] = $row[4];
+ }
+ mysqli_free_result($res);
+
+ // 電梯編號
+ $db_query = "select facilityno from facility where contractno = '$pa' order by facilityno";
+ $res = mysqli_query($link, $db_query);
+ while ($row = mysqli_fetch_row($res)) {
+ $rarr["faci"][] = $row[0];
+ }
+ mysqli_free_result($res);
+
+ if (!isset($rarr["contractno"])) {
+ $rarr["st"] = "err";
+ $rarr["err"] = "無資料!";
+ }
+}catch(\Exception $e) {
+ $rarr["st"] = "err";
+ $rarr["err"] = $e->getMessage();
+}
+//print_r($rarr);exit;
+echo json_encode($rarr, JSON_UNESCAPED_UNICODE);
+exit;
+?>
\ No newline at end of file
diff --git a/wms/mkt/pricereview_mi-api.php b/wms/mkt/pricereview_mi-api.php
index 098064f7..931f22e4 100644
--- a/wms/mkt/pricereview_mi-api.php
+++ b/wms/mkt/pricereview_mi-api.php
@@ -71,6 +71,7 @@ try {
$elev_arr[$row[5]]["floors"] = $floors;
$elev_arr[$row[5]]["speed"] = $speed;
$elev_arr[$row[5]]["option"] = [];
+ $elev_arr[$row[5]]["mn"] = [];
$elev_qty_all += $row[1];
}
mysqli_free_result($res);
@@ -108,20 +109,22 @@ try {
mysqli_free_result($res);
$opt_nosel_id_arr = array_diff(array_keys($opt_elev_arr), $opt_sel_id_arr);
- // 保固延長<->電梯項次
- $mn_arr = [];
- $sql = "select id, item_spec, item_qty, option_relate_spec from pricereview_item where mid = '$id' and item_group = 'D'";
+ // 電梯所屬保固延長
+ $mn_elev_arr = $mn_sel_id_arr = [];
+ $sql = "select id, item_spec, item_price_bp, option_relate_spec from pricereview_item where mid = '$id' and item_group = 'D'";
$res = mysqli_query($link, $sql);
while ($row = mysqli_fetch_row($res)) {
- $mn_arr[$row[0]]["item_spec"] = $row[1];
- $mn_arr[$row[0]]["item_qty"] = $row[2];
+ $mn_elev_arr[$row[0]]["item_spec"] = $row[1];
+ $mn_elev_arr[$row[0]]["item_price_bp"] = $row[2];
$tmp_arr = explode(",", $row[3]);
- $mn_arr[$row[0]]["elev_no"] = $tmp_arr;
+ $mn_elev_arr[$row[0]]["elev_no"] = $tmp_arr;
foreach ($tmp_arr as $v) {
$elev_arr[$v]["mn"][] = $row[0];
+ $mn_sel_id_arr[] = $row[0];
}
}
mysqli_free_result($res);
+ $mn_nosel_id_arr = array_diff(array_keys($mn_elev_arr), $mn_sel_id_arr);
// 除外項目平均分到每台電梯
$exarr = [];
@@ -160,7 +163,7 @@ try {
//print_r($elev_arr);
//print_r($opt_elev_arr);
//print_r($opt_nosel_id_arr);
- //print_r($mn_arr);
+ //print_r($mn_elev_arr);
//print_r($ex_arr);exit;
foreach ($elev_arr as $item_no => $v) {
@@ -243,8 +246,10 @@ try {
if (empty($todo_opt_arr)) $todo_opt_arr = $opt_nosel_id_arr;
if (!empty($todo_opt_arr)) {
foreach ($todo_opt_arr as $val) {
- $sql4 = "select o.base_floor, o.base_floor_plus, o.price, r.equipment from option_mi o, elevator_quotation_rule r ";
- $sql4 .= "where o.quotation_no = r.quotation_no and o.option_price_id = ".$opt_elev_arr[$val]["price_id"]." ";
+ $sql4 = "select o.base_floor, o.base_floor_plus, o.price, r.equipment, p.price 'OP' ";
+ $sql4 .= "from option_mi o, elevator_quotation_rule r, option_price p ";
+ $sql4 .= "where o.quotation_no = r.quotation_no and o.option_price_id = p.id ";
+ $sql4 .= "and o.option_price_id = ".$opt_elev_arr[$val]["price_id"]." ";
$sql4 .= "and ($v[item_weight] between o.min_weight and o.max_weight) and o.open_kind = '".$v["item_op"]."'";
$res_om = mysqli_query($link, $sql4);
if ($row_om = mysqli_fetch_assoc($res_om)) {
@@ -252,6 +257,7 @@ try {
// 特例
if ($opt_elev_arr[$val]["price_id"] == "256" && ($v["floors"] < $row_om["base_floor"])) $row_om["price"] = 9815;
if ($opt_elev_arr[$val]["price_id"] == "266" && $v["floors"] >= 20) $plus += 44.8; // 15层,14.6元/层(19层内,跳20层再追加44.8元)
+ if ($row_om["price"] == 0) $row_om["price"] = $row_om["OP"]*0.6; // 實體且沒成本的:抓牌價6成
// 含此option的電梯總台數
$myelev_qty = 0;
foreach ($opt_elev_arr[$val]["elev_no"] as $pval) {
@@ -273,10 +279,18 @@ try {
// 保固延長
$mnarr = [];
$mn_fee = $j = 0;
- if (!empty($v["mn"][0])) {
- foreach ($v["mn"] as $val) {
+ $todo_mn_arr = $v["mn"];
+ if (!empty($todo_mn_arr[0])) {
+ foreach ($todo_mn_arr as $val) {
$mn_amt = 0;
- $mnarr[$j][0] = $mn_arr[$val]["item_spec"]."保養費";
+ // 含此保延的電梯總台數
+ $myelev_qty = 0;
+ foreach ($mn_elev_arr[$val]["elev_no"] as $pval) {
+ $myelev_qty += $elev_arr[$pval]["item_qty"];
+ }
+ // 分配:延保總價除以電梯總台數
+ $mn_amt += round(0+($mn_elev_arr[$val]["item_price_bp"]/$myelev_qty), 0);
+ $mnarr[$j][0] = $mn_elev_arr[$val]["item_spec"]."保養費";
$mnarr[$j][1] = $mn_amt;
$mn_fee += $mn_amt;
$j++;
diff --git a/wms/mkt/pricereview_repair-check.php b/wms/mkt/pricereview_repair-check.php
new file mode 100644
index 00000000..011a6869
--- /dev/null
+++ b/wms/mkt/pricereview_repair-check.php
@@ -0,0 +1,268 @@
+";
+ echo "alert('請勿重覆簽核!!');";
+ echo "window.close();";
+ echo "";
+ exit;
+ }
+}
+
+$assign_status = '';
+
+$data = [];
+$db_query = "select * from pricereview_repair_main where id = '$id'";
+$data = mysqli_query($link, $db_query);
+
+foreach($data as $data) :
+ // 公司站點
+ $sql = "select content from code where field_name = 'masada_addr' and code_name = '".$data["masada_addr"]."'";
+ $res = mysqli_query($link, $sql);
+ if ($row = mysqli_fetch_row($res)) {
+ $data["maddr"] = $row[0];
+ }
+ mysqli_free_result($res);
+
+ // 保養人員
+ $repairer_arr = [];
+ $sql = "select name from account where accounttype = 'B' and accountid = '".$data["repairerid"]."'";
+ $res = mysqli_query($link, $sql);
+ if ($row = mysqli_fetch_row($res)) {
+ $data["repair"] = $row[0];
+ }
+ mysqli_free_result($res);
+
+ // 價審明細
+ $item_arr = [];
+ $sql = "select * from pricereview_repair_item where rid = '$id' order by item_no";
+ $res = mysqli_query($link, $sql);
+ while ($row = mysqli_fetch_assoc($res)) {
+ $item_arr[$row["item_no"]]["title"] = $row["title"];
+ $item_arr[$row["item_no"]]["item_unit_price"] = $row["item_unit_price"];
+ $item_arr[$row["item_no"]]["item_qty"] = $row["item_qty"];
+ $item_arr[$row["item_no"]]["item_price_bp"] = $row["item_price_bp"];
+ $item_arr[$row["item_no"]]["memo"] = $row["memo"];
+ }
+ mysqli_free_result($res);
+
+ // get form_key
+ $sql = "select max(form_key) from assign where assign_opinion = '".$data["repair_no"]."'";
+ $res = mysqli_query($link, $sql);
+ $row = mysqli_fetch_row($res);
+ $form_key = $row[0];
+ mysqli_free_result($res);
+?>
+
+
+
+
Record has added successfully
"; + } +} +*/ +?> + +您有待簽核案件,請至客戶管理 > 價格審查_新梯,點擊「待簽核」進行作業,謝謝!
"; + $sendmail->sendx($title, $content, $mail_list); + } + */ + } + + mysqli_close($link); + if ($affected > 0) { + echo ""; + } else { + echo ""; + } +} +?> \ No newline at end of file diff --git a/wms/mkt/pricereview_repair-index.php b/wms/mkt/pricereview_repair-index.php new file mode 100644 index 00000000..e9908255 --- /dev/null +++ b/wms/mkt/pricereview_repair-index.php @@ -0,0 +1,272 @@ + "簽核中", "B1" => "已同意", "B2" => "已完工", "X" => "不同意"]; + +// 設置一個空陣列來放資料 +$data = array(); +// sql語法存在變數中 +$sql_cmd = sql_myself($user_id, "repairerid"); +$is_manager = 0; +// 宜:M0054-陳志文 +$repman_arr[0] = ["M0177"]; +// 北:M0137-劉永德 +$repman_arr[1] = ["M0059","M0083","M0084","M0090","M0064","M0106","M0092","M0120","M0147","M0139","M0194","M0210"]; +// 桃:M0026-張莉凱 +$repman_arr[2] = ["M0018", "M0045","M0089","M0104","M0111"]; +// 中:M0086-李烘銘 +$repman_arr[3] = ["M0148","M0114","M0161"]; +// 南:M0033-吳育宗 +$repman_arr[4] = ["M0196","M0195","M0190","M0094","M0123","M0124"]; +if ($user_id == "M0054") { $is_manager = 1; $sql_cmd = "where repairerid in ('".implode("','", $repman_arr[0])."')"; } +elseif ($user_id == "M0137") { $is_manager = 1; $sql_cmd = "where repairerid in ('".implode("','", $repman_arr[1])."')"; } +elseif ($user_id == "M0026") { $is_manager = 1; $sql_cmd = "where repairerid in ('".implode("','", $repman_arr[2])."')"; } +elseif ($user_id == "M0086") { $is_manager = 1; $sql_cmd = "where repairerid in ('".implode("','", $repman_arr[3])."')"; } +elseif ($user_id == "M0033") { $is_manager = 1; $sql_cmd = "where repairerid in ('".implode("','", $repman_arr[4])."')"; } +elseif ($user_id == "M0012") $sql_cmd = ""; +$sql = "select * from pricereview_repair_main $sql_cmd order by id"; +$data = mysqli_query($link,$sql); +$para = "function_name=pricereview_repair&".$token_link; +?> + + + + ++ + + +
+ + + + + +項次 | +報價單編號 | +卷號 | +客戶名稱 | +電梯編號 | +總價 | +簽訂日 | +完工日 | +申請人 | +簽核主管 | +狀態 | +簽核時間 | +建立時間 | +操作 | +
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
+ | + | + | + | + |
+ 0) echo number_format($data['final_price'])." (".number_format($data['total_price']).")"; + else echo number_format($data['total_price']); + ?> + |
+ + | + | + | + | + | + | + |
+ 簽核";
+ } else $str .= "&view=1\" class=\"btn btn-warning btn-sm\">檢視";
+ //if ($data['pstatus'][0] == 'B') $str .= " 列印"; + if ($data['pstatus'][0] == 'B') $str .= " 下載"; + if (($user_id=="M0012" || $user_id=="M0105") && $data['pstatus'] == 'B1') $str .= " 結案"; + echo $str; + ?> + |
+