diff --git a/wms/T8_Authorization_from_bpm.php b/wms/T8_Authorization_from_bpm.php index 7c206023..b862a81d 100644 --- a/wms/T8_Authorization_from_bpm.php +++ b/wms/T8_Authorization_from_bpm.php @@ -3,10 +3,7 @@ // $user_id = "M0000"; // $user_password = "M012290493119"; -$user_id = "M0117"; -$user_password = "90493119"; - -echo $validation = get_Auth($user_id, $user_password); +// echo $validation = get_Auth($user_id, $user_password); function get_Auth($user_id = "M0000", $user_password = "M012290493119") { @@ -16,8 +13,9 @@ function get_Auth($user_id = "M0000", $user_password = "M012290493119") // $now = gmdate("YmdHis"); $now = gmdate("YmdHis", strtotime("-2 minutes")); $data = "$user_id." . $now; - $sign = hash_hmac('SHA256', $data, 'B2D6395D2883E26C', false); + $sign = hash_hmac('SHA256', $data, 'A21181F1EE4966D3', false); + // echo $sign; // $apiurl = 'https://erp.masada.com.tw:780/twWebAPI/GetAuth'; $apiurl = 'http://60.244.87.101:880//twWebAPI/GetAuth'; @@ -30,7 +28,7 @@ function get_Auth($user_id = "M0000", $user_password = "M012290493119") "Pwd: $user_password", "TimestampUTC: $now", "Sign: $sign", - "GroupId: TEST" + "GroupId:TEST" ]; $ch = curl_init(); @@ -53,4 +51,4 @@ function get_Auth($user_id = "M0000", $user_password = "M012290493119") curl_close($ch); } // $data = []; -get_Auth(); +// get_Auth(); diff --git a/wms/account-receivable-contract.xlsx b/wms/account-receivable-contract.xlsx new file mode 100644 index 00000000..cb3cc542 Binary files /dev/null and b/wms/account-receivable-contract.xlsx differ diff --git a/wms/account-receivable-excel.php b/wms/account-receivable-excel.php index db546b37..64fab766 100644 --- a/wms/account-receivable-excel.php +++ b/wms/account-receivable-excel.php @@ -12,19 +12,54 @@ $array_data = array(); $Bill = json_decode(file_get_contents("php://input"), true); $spreadsheet = new Spreadsheet(); $sheet = $spreadsheet->getActiveSheet(); -// file_put_contents('account-receivable.txt', json_encode($Bill)); -if ($type == 'facility') { + +if ($type == 'newContract') { + $colomnHeader = [ + '合約號', '客戶名稱', '營業員', '合約金額', '台數', '作番狀態', '催收金額', '催收次數', '訂金催收金額', '訂金催收次數', '二次款催收金額', '二次款催收次數', + '貨抵工地款催收金額', '貨抵工地款催收次數', + '安裝款催收金額', '安裝款催收次數', + '試車款催收金額', '試車款催收次數', + '官檢驗收催收金額', '官檢驗收催收次數', + '交車款催收金額', '交車款催收次數', + '尾款催收金額', '尾款催收次數' + ]; + + file_put_contents('account-receivable.txt', json_encode($Bill, JSON_UNESCAPED_UNICODE)); + $sheet->fromArray($colomnHeader, NULL, 'A1'); + $rowIndex = 2; + foreach ($Bill as $key => $value) { + + $sheet->fromArray($value, NULL, 'A' . $rowIndex); + $column = [ + 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y' + ]; + foreach ($column as $col) { + if ($col == 'F') { + $sheet->getColumnDimension('F')->setWidth(35); + $sheet->getStyle('F')->getAlignment()->setWrapText(true); + } else { + // $sheet->getColumnDimension($col)->setAutoSize(true); + $sheet->getColumnDimension($col)->setWidth(10); + $sheet->getStyle($col)->getAlignment()->setWrapText(true); + } + } + $rowIndex++; + } + $writer = new Xlsx($spreadsheet); + $excelFileName = 'account-receivable-contract.xlsx'; + $writer->save($excelFileName); +} elseif ($type == 'facility') { $colomnHeader = [ - 'T8單據日期','作番號', '合約號', '部門', '經理', '營業員', '客戶名稱', '統一編號', '聯絡地址', '抬頭', - '訂金名稱', '訂金合約金額', '訂金應收日期', '訂金目前應收金額','訂金已開金額','訂金未開金額', '訂金已收金額', '訂金催收金額', '訂金催收次數', - '二次款名稱', '二次款合約金額', '二次款應收日期', '二次款目前應收金額','二次款已開金額','二次款未開金額', '二次款已收金額', '二次款催收金額', '二次款催收次數', - '貨抵工地款名稱', '貨抵工地款合約金額', '貨抵工地款應收日期', '貨抵工地款目前應收金額','貨抵工地款已開金額','貨抵工地款未開金額', '貨抵工地款已收金額', '貨抵工地款催收金額', '貨抵工地款催收次數', - '安裝款名稱', '安裝款合約金額', '安裝款應收日期', '安裝款目前應收金額','安裝款已開金額','安裝款未開金額', '安裝款已收金額', '安裝款催收金額', '安裝款催收次數', - '試車款名稱', '試車款合約金額', '試車款應收日期', '試車款目前應收金額','試車款已開金額','試車款未開金額', '試車款已收金額', '試車款催收金額', '試車款催收次數', - '官檢款名稱', '官檢款合約金額', '官檢款應收日期', '官檢款目前應收金額','官檢款已開金額','官檢款未開金額', '官檢款已收金額', '官檢款催收金額', '官檢款催收次數', - '交車款名稱', '交車款合約金額', '交車款應收日期', '交車款目前應收金額','交車款已開金額','交車款未開金額', '交車款已收金額', '交車款催收金額', '交車款催收次數', - '尾款名稱', '尾款金額', '尾款應收日期', '尾款應收金額','尾款已開金額','尾款未開金額', '尾款已收金額', '尾款催收金額', '尾款催收次數', - '作番狀態', '合約-設備金額','合約-安裝金額','作番合約總金額', '作番總應收金額' + 'T8單據日期', '作番號', '合約號', '部門', '經理', '營業員', '客戶名稱', '統一編號', '聯絡地址', '抬頭', + '訂金名稱', '訂金合約金額', '訂金應收日期', '訂金目前應收金額', '訂金已開金額', '訂金未開金額', '訂金已收金額', '訂金催收金額', '訂金催收次數', + '二次款名稱', '二次款合約金額', '二次款應收日期', '二次款目前應收金額', '二次款已開金額', '二次款未開金額', '二次款已收金額', '二次款催收金額', '二次款催收次數', + '貨抵工地款名稱', '貨抵工地款合約金額', '貨抵工地款應收日期', '貨抵工地款目前應收金額', '貨抵工地款已開金額', '貨抵工地款未開金額', '貨抵工地款已收金額', '貨抵工地款催收金額', '貨抵工地款催收次數', + '安裝款名稱', '安裝款合約金額', '安裝款應收日期', '安裝款目前應收金額', '安裝款已開金額', '安裝款未開金額', '安裝款已收金額', '安裝款催收金額', '安裝款催收次數', + '試車款名稱', '試車款合約金額', '試車款應收日期', '試車款目前應收金額', '試車款已開金額', '試車款未開金額', '試車款已收金額', '試車款催收金額', '試車款催收次數', + '官檢款名稱', '官檢款合約金額', '官檢款應收日期', '官檢款目前應收金額', '官檢款已開金額', '官檢款未開金額', '官檢款已收金額', '官檢款催收金額', '官檢款催收次數', + '交車款名稱', '交車款合約金額', '交車款應收日期', '交車款目前應收金額', '交車款已開金額', '交車款未開金額', '交車款已收金額', '交車款催收金額', '交車款催收次數', + '尾款名稱', '尾款金額', '尾款應收日期', '尾款應收金額', '尾款已開金額', '尾款未開金額', '尾款已收金額', '尾款催收金額', '尾款催收次數', + '作番狀態', '合約-設備金額', '合約-安裝金額', '作番合約總金額', '作番總應收金額' ]; $sheet->fromArray($colomnHeader, NULL, 'A1'); $rowIndex = 2; @@ -34,7 +69,7 @@ if ($type == 'facility') { $column = [ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'AA', 'AB', 'AC', 'AD', 'AE', 'AF', 'AG', 'AH', 'AI', 'AJ', 'AK', 'AL', 'AM', 'AN', 'AO', 'AP', 'AQ', 'AR', 'AS', 'AT', 'AU', 'AV', 'AW', 'AX', 'AY', 'AZ', - 'BA', 'BB', 'BC', 'BD', 'BE', 'BF', 'BG', 'BH', 'BI', 'BJ', 'BK', 'BL', 'BM', 'BN', 'BO', 'BP','BQ','BR','BK' + 'BA', 'BB', 'BC', 'BD', 'BE', 'BF', 'BG', 'BH', 'BI', 'BJ', 'BK', 'BL', 'BM', 'BN', 'BO', 'BP', 'BQ', 'BR', 'BK' ]; foreach ($column as $col) { $sheet->getColumnDimension($col)->setAutoSize(true); @@ -47,16 +82,16 @@ if ($type == 'facility') { $writer->save($excelFileName); } else { $colomnHeader = [ - 'T8單據日期','合約號', '部門', '經理', '營業員', '客戶名稱', '統一編號', '聯絡地址', '抬頭', - '訂金', '訂金目前應收', '訂金已開票金額','訂金未開票金額', '訂金已收金額', '訂金催收金額', '訂金最大催收次數', '訂金最小催收次數', - '二次款', '二次款目前應收', '二次款已開票金額','二次款未開票金額', '二次款已收金額', '二次款催收金額', '二次款最大催收次數', '二次款最小催收次數', - '貨抵工地款', '貨抵工地款目前應收', '貨抵工地款已開票金額','貨抵工地款未開票金額', '貨抵工地款已收金額', '貨抵工地款催收金額', '貨抵工地款最大催收次數', '貨抵工地款最小催收次數', - '安裝款', '安裝款目前應收', '安裝款已開票金額','安裝款未開票金額', '安裝款已收金額', '安裝款催收金額', '安裝款最大催收次數', '安裝款最小催收次數', - '試車款', '試車款目前應收', '試車款已開票金額','試車款未開票金額', '試車款已收金額', '試車款催收金額', '試車款最大催收次數', '試車款最小催收次數', - '官檢款', '官檢款目前應收', '官檢款已開票金額','官檢款未開票金額', '官檢款已收金額', '官檢款催收金額', '官檢款最大催收次數', '官檢款最小催收次數', - '交車款', '交車款目前應收', '交車款已開票金額','交車款未開票金額', '交車款已收金額', '交車款催收金額', '交車款最大催收次數', '交車款最小催收次數', - '尾款', '尾款目前應收', '尾款已開票金額','尾款未開票金額', '尾款已收金額', '尾款催收金額', '尾款最大催收次數', '尾款最小催收次數', - '合約設備金額','合約安裝金額','合約總金額', '目前應收', '已開發票金額', '已收金額', '作番總數', '作番狀態' + 'T8單據日期', '合約號', '部門', '經理', '營業員', '客戶名稱', '統一編號', '聯絡地址', '抬頭', + '訂金', '訂金目前應收', '訂金已開票金額', '訂金未開票金額', '訂金已收金額', '訂金催收金額', '訂金最大催收次數', '訂金最小催收次數', + '二次款', '二次款目前應收', '二次款已開票金額', '二次款未開票金額', '二次款已收金額', '二次款催收金額', '二次款最大催收次數', '二次款最小催收次數', + '貨抵工地款', '貨抵工地款目前應收', '貨抵工地款已開票金額', '貨抵工地款未開票金額', '貨抵工地款已收金額', '貨抵工地款催收金額', '貨抵工地款最大催收次數', '貨抵工地款最小催收次數', + '安裝款', '安裝款目前應收', '安裝款已開票金額', '安裝款未開票金額', '安裝款已收金額', '安裝款催收金額', '安裝款最大催收次數', '安裝款最小催收次數', + '試車款', '試車款目前應收', '試車款已開票金額', '試車款未開票金額', '試車款已收金額', '試車款催收金額', '試車款最大催收次數', '試車款最小催收次數', + '官檢款', '官檢款目前應收', '官檢款已開票金額', '官檢款未開票金額', '官檢款已收金額', '官檢款催收金額', '官檢款最大催收次數', '官檢款最小催收次數', + '交車款', '交車款目前應收', '交車款已開票金額', '交車款未開票金額', '交車款已收金額', '交車款催收金額', '交車款最大催收次數', '交車款最小催收次數', + '尾款', '尾款目前應收', '尾款已開票金額', '尾款未開票金額', '尾款已收金額', '尾款催收金額', '尾款最大催收次數', '尾款最小催收次數', + '合約設備金額', '合約安裝金額', '合約總金額', '目前應收', '已開發票金額', '已收金額', '作番總數', '作番狀態' ]; $sheet->fromArray($colomnHeader, NULL, 'A1'); @@ -67,7 +102,7 @@ if ($type == 'facility') { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'AA', 'AB', 'AC', 'AD', 'AE', 'AF', 'AG', 'AH', 'AI', 'AJ', 'AK', 'AL', 'AM', 'AN', 'AO', 'AP', 'AQ', 'AR', 'AS', 'AT', 'AU', 'AV', 'AW', 'AX', 'AY', 'AZ', 'BA', 'BB', 'BC', 'BD', 'BE', 'BF', 'BG', 'BH', 'BI', 'BJ', 'BK', 'BL', 'BM', 'BN', 'BO', 'BP', 'BQ', 'BR', 'BS', 'BT', 'BU', 'BV', 'BW', 'BX', 'BY', 'BZ', - 'CA','CB','CC','CD' + 'CA', 'CB', 'CC', 'CD' ]; foreach ($column as $col) { if ($col == 'CC') { diff --git a/wms/account-receivable-facility.xlsx b/wms/account-receivable-facility.xlsx index 9c5fbaa6..24109745 100644 Binary files a/wms/account-receivable-facility.xlsx and b/wms/account-receivable-facility.xlsx differ diff --git a/wms/account-receivable-new-index.php b/wms/account-receivable-new-index.php index e4cd3eb7..59fc1f88 100644 --- a/wms/account-receivable-new-index.php +++ b/wms/account-receivable-new-index.php @@ -7,11 +7,12 @@ $sum_contract = 0; $sum_A40001 = 0; $sum_A40008 = 0; $sum_total_budget = 0; -$average_budget = 0; +$average_facility_budget = 0; $average_A40001 = 0; $average_A40008 = 0; $sum_invoice_budget = 0; $sum_received_budget = 0; +$sum_receivable_budget = 0; $sum_collect_budget = 0; // 主要array @@ -122,6 +123,7 @@ if ((in_array($user_id, array('M0060', 'M0175'))) || (in_array(accountidToDepart $sql_all_contract .= ")"; }; } +$sql_all_contract .= " ORDER BY MainAll.PersonId ASC "; $str_numbers = ""; $query_all_contract = $conn->query($sql_all_contract); if (is_iterable($query_all_contract)) { @@ -147,11 +149,13 @@ if (is_iterable($query_all_contract)) { $arrayData[$contract_numbers['BillNo']]['collect_budget'] = 0; $arrayData[$contract_numbers['BillNo']]['A40001'] = 0; $arrayData[$contract_numbers['BillNo']]['A40008'] = 0; + $arrayData[$contract_numbers['BillNo']]['collect_month'] = 0; $arrayData[$contract_numbers['BillNo']]['facility_status'] = ""; $arrayData[$contract_numbers['BillNo']]['facility'] = array(); + $arrayData[$contract_numbers['BillNo']]['facility_num'] = 0; $arrayData[$contract_numbers['BillNo']]['total_budget'] = $contract_numbers['OAmountWithTax']; $sum_total_budget += $contract_numbers['OAmountWithTax']; - $sum_contract +=1; + $sum_contract += 1; } } $str_numbers .= "('" . implode("','", $contractNumbers) . "')"; @@ -176,18 +180,17 @@ foreach ($query_contract_budget as $contract_budget) { $arrayData[$contract_budget['BillNo']]['facility'][$contract_budget['CU_MaterialId']]['total_budget'] = $contract_budget['OAmountWithTax']; $arrayData[$contract_budget['BillNo']]['facility'][$contract_budget['CU_MaterialId']][$contract_budget['MaterialId']] = $contract_budget['OAmountWithTax']; $arrayData[$contract_budget['BillNo']]['facility'][$contract_budget['CU_MaterialId']]['status'] = ""; - $sum_facility +=1; + $sum_facility += 1; + $arrayData[$contract_budget['BillNo']]['facility_num'] += 1; } - switch($contract_budget['CU_MaterialId']){ + switch ($contract_budget['MaterialId']) { case "A40001": $sum_A40001 += $contract_budget['OAmountWithTax']; break; case "A40008": $sum_A40008 += $contract_budget['OAmountWithTax']; break; - } - } } @@ -215,6 +218,7 @@ foreach ($query_PayStage as $PayStage) { $arrayData[$PayStage['BillNo']]['PayStage'][$PayStage['RowNo']]['PayStage'] = $PayStage['PayStage']; $arrayData[$PayStage['BillNo']]['PayStage'][$PayStage['RowNo']]['PlanPayAmt'] = $PayStage['PlanPayAmt']; $arrayData[$PayStage['BillNo']]['PayStage'][$PayStage['RowNo']]['PlanPayDate'] = $PayStage['PlanPayDate']; + $arrayData[$PayStage['BillNo']]['PayStage'][$PayStage['RowNo']]['stage'] = ''; if (isset($arrayData[$PayStage['BillNo']]['facility']) && is_iterable($arrayData[$PayStage['BillNo']]['facility'])) { foreach ($arrayData[$PayStage['BillNo']]['facility'] as $key => &$value) { $tmpkey = $key . $PayStage['RowNo']; @@ -323,11 +327,11 @@ foreach ($PayStage_array as $key => &$value) { case '寶佳出貨前30天': $payvalue['stage'] = '訂金'; if ($wip_array[$payvalue['facilityno']]['real_arrival_date'] !== null && strtotime($wip_array[$payvalue['facilityno']]['real_arrival_date']) > 975686400 && !empty($wip_array[$payvalue['facilityno']]['real_arrival_date'])) { - $estimate_time = strtotime($wip['real_arrival_date']); + $estimate_time = strtotime($wip_array[$payvalue['facilityno']]['real_arrival_date']); $signtime = $estimate_time - (30 * 86400); $payvalue['PlanPayDate'] = date('Y-m-d', $signtime); } elseif ($wip_array[$payvalue['facilityno']]['real_contract_arrival_date'] !== null && strtotime($wip_array[$payvalue['facilityno']]['real_contract_arrival_date']) > 975686400 && !empty($wip_array[$payvalue['facilityno']]['real_contract_arrival_date'])) { - $estimate_time = strtotime($wip['real_contract_arrival_date']); + $estimate_time = strtotime($wip_array[$payvalue['facilityno']]['real_contract_arrival_date']); $signtime = $estimate_time - (30 * 86400); $payvalue['PlanPayDate'] = date('Y-m-d', $signtime); } else { @@ -337,7 +341,7 @@ foreach ($PayStage_array as $key => &$value) { case '寶佳出貨後10天': $payvalue['stage'] = '二次款'; if ($wip_array[$payvalue['facilityno']]['real_arrival_date'] !== null && strtotime($wip_array[$payvalue['facilityno']]['real_arrival_date']) > 975686400 && !empty($wip_array[$payvalue['facilityno']]['real_arrival_date'])) { - $estimate_time = strtotime($wip['real_arrival_date']); + $estimate_time = strtotime($wip_array[$payvalue['facilityno']]['real_arrival_date']); $signtime = $estimate_time + (10 * 86400); $payvalue['PlanPayDate'] = date('Y-m-d', $signtime); } else { @@ -347,7 +351,7 @@ foreach ($PayStage_array as $key => &$value) { case '貨抵工地後90天': $payvalue['stage'] = '貨抵工地款'; if ($wip_array[$payvalue['facilityno']]['real_arrival_date'] !== null && strtotime($wip_array[$payvalue['facilityno']]['real_arrival_date']) > 975686400 && !empty($wip_array[$payvalue['facilityno']]['real_arrival_date'])) { - $estimate_time = strtotime($wip['real_arrival_date']); + $estimate_time = strtotime($wip_array[$payvalue['facilityno']]['real_arrival_date']); $signtime = $estimate_time + (90 * 86400); $payvalue['PlanPayDate'] = date('Y-m-d', $signtime); } else { @@ -357,7 +361,7 @@ foreach ($PayStage_array as $key => &$value) { case '安裝試車後90天': $payvalue['stage'] = '試車款'; if ($wip_array[$payvalue['facilityno']]['tryrun_end_date'] !== null && strtotime($wip_array[$payvalue['facilityno']]['tryrun_end_date']) > 975686400 && !empty($wip_array[$payvalue['facilityno']]['tryrun_end_date'])) { - $estimate_time = strtotime($wip['tryrun_end_date']); + $estimate_time = strtotime($wip_array[$payvalue['facilityno']]['tryrun_end_date']); $signtime = $estimate_time + (90 * 86400); $payvalue['PlanPayDate'] = date('Y-m-d', $signtime); } else { @@ -367,43 +371,53 @@ foreach ($PayStage_array as $key => &$value) { case '交車後270天': $payvalue['stage'] = '尾款'; if ($wip_array[$payvalue['facilityno']]['delivery_date'] !== null && strtotime($wip_array[$payvalue['facilityno']]['delivery_date']) > 975686400 && !empty($wip_array[$payvalue['facilityno']]['delivery_date'])) { - $estimate_time = strtotime($wip['delivery_date']); + $estimate_time = strtotime($wip_array[$payvalue['facilityno']]['delivery_date']); $signtime = $estimate_time + (270 * 86400); $payvalue['PlanPayDate'] = date('Y-m-d', $signtime); } else { $payvalue['PlanPayDate'] = NULL; } break; + case '交車後180天': + $payvalue['stage'] = '尾款'; + if ($wip_array[$payvalue['facilityno']]['delivery_date'] !== null && strtotime($wip_array[$payvalue['facilityno']]['delivery_date']) > 975686400 && !empty($wip_array[$payvalue['facilityno']]['delivery_date'])) { + $estimate_time = strtotime($wip_array[$payvalue['facilityno']]['delivery_date']); + $signtime = $estimate_time + (180 * 86400); + $payvalue['PlanPayDate'] = date('Y-m-d', $signtime); + } else { + $payvalue['PlanPayDate'] = NULL; + } + break; case (in_array($payvalue['PayStage'], $arrival)): $payvalue['stage'] = '貨抵工地款'; if ($wip_array[$payvalue['facilityno']]['real_arrival_date'] !== null && strtotime($wip_array[$payvalue['facilityno']]['real_arrival_date']) > 975686400 && !empty($wip_array[$payvalue['facilityno']]['real_arrival_date'])) { - $estimate_time = strtotime($wip['real_arrival_date']); - $signtime = $estimate_time + (10 * 86400); + $estimate_time = strtotime($wip_array[$payvalue['facilityno']]['real_arrival_date']); + $signtime = $estimate_time; $payvalue['PlanPayDate'] = date('Y-m-d', $signtime); } else { - $payvalue['PlanPayDate'] = NULL; + $payvalue['PlanPayDate'] = 'NULL'; } break; case '二次款': $payvalue['stage'] = '二次款'; if ($wip_array[$payvalue['facilityno']]['real_arrival_date'] !== null && strtotime($wip_array[$payvalue['facilityno']]['real_arrival_date']) > 975686400 && !empty($wip_array[$payvalue['facilityno']]['real_arrival_date'])) { - $estimate_time = strtotime($wip['real_arrival_date']); + $estimate_time = strtotime($wip_array[$payvalue['facilityno']]['real_arrival_date']); $payvalue['PlanPayDate'] = date('Y-m-d', $estimate_time); } elseif ($wip_array[$payvalue['facilityno']]['real_contract_arrival_date'] !== null && strtotime($wip_array[$payvalue['facilityno']]['real_contract_arrival_date']) > 975686400 && !empty($wip_array[$payvalue['facilityno']]['real_contract_arrival_date'])) { - $estimate_time = strtotime($wip['real_contract_arrival_date']); + $estimate_time = strtotime($wip_array[$payvalue['facilityno']]['real_contract_arrival_date']); $payvalue['PlanPayDate'] = date('Y-m-d', $estimate_time); } else { $payvalue['PlanPayDate'] = NULL; } break; - case (stristr($payvalue['PayStage'], '出貨前30') || stristr($payvalue['PayStage'], '簽約(出貨前30天)') ||stristr($payvalue['PayStage'], '建照核發時')): + case (stristr($payvalue['PayStage'], '出貨前30') || stristr($payvalue['PayStage'], '簽約(出貨前30天)') || stristr($payvalue['PayStage'], '建照核發時')): $payvalue['stage'] = '二次款'; if ($wip_array[$payvalue['facilityno']]['real_arrival_date'] !== null && strtotime($wip_array[$payvalue['facilityno']]['real_arrival_date']) > 975686400 && !empty($wip_array[$payvalue['facilityno']]['real_arrival_date'])) { - $estimate_time = strtotime($wip['real_arrival_date']); + $estimate_time = strtotime($wip_array[$payvalue['facilityno']]['real_arrival_date']); $signtime = $estimate_time - (30 * 86400); $payvalue['PlanPayDate'] = date('Y-m-d', $signtime); } elseif ($wip_array[$payvalue['facilityno']]['real_contract_arrival_date'] !== null && strtotime($wip_array[$payvalue['facilityno']]['real_contract_arrival_date']) > 975686400 && !empty($wip_array[$payvalue['facilityno']]['real_contract_arrival_date'])) { - $estimate_time = strtotime($wip['real_contract_arrival_date']); + $estimate_time = strtotime($wip_array[$payvalue['facilityno']]['real_contract_arrival_date']); $signtime = $estimate_time - (30 * 86400); $payvalue['PlanPayDate'] = date('Y-m-d', $signtime); } else { @@ -413,11 +427,11 @@ foreach ($PayStage_array as $key => &$value) { case (stristr($payvalue['PayStage'], '出貨前60')): $payvalue['stage'] = '二次款'; if ($wip_array[$payvalue['facilityno']]['real_arrival_date'] !== null && strtotime($wip_array[$payvalue['facilityno']]['real_arrival_date']) > 975686400 && !empty($wip_array[$payvalue['facilityno']]['real_arrival_date'])) { - $estimate_time = strtotime($wip['real_arrival_date']); + $estimate_time = strtotime($wip_array[$payvalue['facilityno']]['real_arrival_date']); $signtime = $estimate_time - (60 * 86400); $payvalue['PlanPayDate'] = date('Y-m-d', $signtime); } elseif ($wip_array[$payvalue['facilityno']]['real_contract_arrival_date'] !== null && strtotime($wip_array[$payvalue['facilityno']]['real_contract_arrival_date']) > 975686400 && !empty($wip_array[$payvalue['facilityno']]['real_contract_arrival_date'])) { - $estimate_time = strtotime($wip['real_contract_arrival_date']); + $estimate_time = strtotime($wip_array[$payvalue['facilityno']]['real_contract_arrival_date']); $signtime = $estimate_time - (60 * 86400); $payvalue['PlanPayDate'] = date('Y-m-d', $signtime); } else { @@ -427,11 +441,11 @@ foreach ($PayStage_array as $key => &$value) { case (stristr($payvalue['PayStage'], '出貨前90')): $payvalue['stage'] = '二次款'; if ($wip_array[$payvalue['facilityno']]['real_arrival_date'] !== null && strtotime($wip_array[$payvalue['facilityno']]['real_arrival_date']) > 975686400 && !empty($wip_array[$payvalue['facilityno']]['real_arrival_date'])) { - $estimate_time = strtotime($wip['real_arrival_date']); + $estimate_time = strtotime($wip_array[$payvalue['facilityno']]['real_arrival_date']); $signtime = $estimate_time - (90 * 86400); $payvalue['PlanPayDate'] = date('Y-m-d', $signtime); } elseif ($wip_array[$payvalue['facilityno']]['real_contract_arrival_date'] !== null && strtotime($wip_array[$payvalue['facilityno']]['real_contract_arrival_date']) > 975686400 && !empty($wip_array[$payvalue['facilityno']]['real_contract_arrival_date'])) { - $estimate_time = strtotime($wip['real_contract_arrival_date']); + $estimate_time = strtotime($wip_array[$payvalue['facilityno']]['real_contract_arrival_date']); $signtime = $estimate_time - (90 * 86400); $payvalue['PlanPayDate'] = date('Y-m-d', $signtime); } else { @@ -441,11 +455,11 @@ foreach ($PayStage_array as $key => &$value) { case (stristr($payvalue['PayStage'], '出貨前120')): $payvalue['stage'] = '二次款'; if ($wip_array[$payvalue['facilityno']]['real_arrival_date'] !== null && strtotime($wip_array[$payvalue['facilityno']]['real_arrival_date']) > 975686400 && !empty($wip_array[$payvalue['facilityno']]['real_arrival_date'])) { - $estimate_time = strtotime($wip['real_arrival_date']); + $estimate_time = strtotime($wip_array[$payvalue['facilityno']]['real_arrival_date']); $signtime = $estimate_time - (120 * 86400); $payvalue['PlanPayDate'] = date('Y-m-d', $signtime); } elseif ($wip_array[$payvalue['facilityno']]['real_contract_arrival_date'] !== null && strtotime($wip_array[$payvalue['facilityno']]['real_contract_arrival_date']) > 975686400 && !empty($wip_array[$payvalue['facilityno']]['real_contract_arrival_date'])) { - $estimate_time = strtotime($wip['real_contract_arrival_date']); + $estimate_time = strtotime($wip_array[$payvalue['facilityno']]['real_contract_arrival_date']); $signtime = $estimate_time - (120 * 86400); $payvalue['PlanPayDate'] = date('Y-m-d', $signtime); } else { @@ -490,7 +504,7 @@ foreach ($PayStage_array as $key => &$value) { case (stristr($payvalue['PayStage'], '試車')): $payvalue['stage'] = '試車款'; if ($wip_array[$payvalue['facilityno']]['tryrun_end_date'] !== null && strtotime($wip_array[$payvalue['facilityno']]['tryrun_end_date']) > 975686400 && !empty($wip_array[$payvalue['facilityno']]['tryrun_end_date'])) { - $estimate_time = strtotime($wip['tryrun_end_date']); + $estimate_time = strtotime($wip_array[$payvalue['facilityno']]['tryrun_end_date']); $payvalue['PlanPayDate'] = date('Y-m-d', $estimate_time); } else { $payvalue['PlanPayDate'] = NULL; @@ -499,7 +513,7 @@ foreach ($PayStage_array as $key => &$value) { case (stristr($payvalue['PayStage'], '安裝') || stristr($payvalue['PayStage'], '貨抵工地且完工')): $payvalue['stage'] = '安裝款'; if ($wip_array[$payvalue['facilityno']]['install_end_date'] !== null && strtotime($wip_array[$payvalue['facilityno']]['install_end_date']) > 975686400 && !empty($wip_array[$payvalue['facilityno']]['install_end_date'])) { - $estimate_time = strtotime($wip['install_end_date']); + $estimate_time = strtotime($wip_array[$payvalue['facilityno']]['install_end_date']); $payvalue['PlanPayDate'] = date('Y-m-d', $estimate_time); } else { $payvalue['PlanPayDate'] = NULL; @@ -508,7 +522,7 @@ foreach ($PayStage_array as $key => &$value) { case (in_array($payvalue['PayStage'], $final6)): $payvalue['stage'] = '尾款'; if ($wip_array[$payvalue['facilityno']]['delivery_date'] !== null && strtotime($wip_array[$payvalue['facilityno']]['delivery_date']) > 975686400 && !empty($wip_array[$payvalue['facilityno']]['delivery_date'])) { - $estimate_time = strtotime($wip['delivery_date']); + $estimate_time = strtotime($wip_array[$payvalue['facilityno']]['delivery_date']); $estimate_time = $estimate_time + (180 * 86400); $payvalue['PlanPayDate'] = date('Y-m-d', $estimate_time); } else { @@ -518,7 +532,7 @@ foreach ($PayStage_array as $key => &$value) { case (stristr($payvalue['PayStage'], '合格') || stristr($payvalue['PayStage'], '驗收') || stristr($payvalue['PayStage'], '驗收')): $payvalue['stage'] = '官檢驗收款'; if ($wip_array[$payvalue['facilityno']]['official_check_date'] !== null && strtotime($wip_array[$payvalue['facilityno']]['official_check_date']) > 975686400 && !empty($wip_array[$payvalue['facilityno']]['official_check_date'])) { - $estimate_time = strtotime($wip['official_check_date']); + $estimate_time = strtotime($wip_array[$payvalue['facilityno']]['official_check_date']); $payvalue['PlanPayDate'] = date('Y-m-d', $estimate_time); } else { $payvalue['PlanPayDate'] = NULL; @@ -527,7 +541,7 @@ foreach ($PayStage_array as $key => &$value) { case (stristr($payvalue['PayStage'], '交車') || stristr($payvalue['PayStage'], '移交') || stristr($payvalue['PayStage'], '完工') || stristr($payvalue['PayStage'], '許可') || stristr($payvalue['PayStage'], '核可')): $payvalue['stage'] = '交車款'; if ($wip_array[$payvalue['facilityno']]['delivery_date'] !== null && strtotime($wip_array[$payvalue['facilityno']]['delivery_date']) > 975686400 && !empty($wip_array[$payvalue['facilityno']]['delivery_date'])) { - $estimate_time = strtotime($wip['delivery_date']); + $estimate_time = strtotime($wip_array[$payvalue['facilityno']]['delivery_date']); $payvalue['PlanPayDate'] = date('Y-m-d', $estimate_time); } else { $payvalue['PlanPayDate'] = NULL; @@ -596,6 +610,18 @@ foreach ($query_invoice as $invoice) { } } +//未在T8的收款資料 +$sql_wms = "SELECT * FROM account_received WHERE type='M' AND BillNo IN $str_numbers"; +$query_wms = mysqli_query($link, $sql_wms); +foreach ($query_wms as $wms) { + if (isset($arrayData[$wms['BillNo']]) && isset($arrayData[$wms['BillNo']]['invoice_budget'])) { + $arrayData[$wms['BillNo']]['invoice_budget'] += $wms['invoice_budget']; + } + if (isset($arrayData[$wms['BillNo']]) && isset($arrayData[$wms['BillNo']]['received_budget'])) { + $arrayData[$wms['BillNo']]['received_budget'] += $wms['received_budget']; + } +} + // 核銷資訊 $sql_received = "SELECT CheckDetail.OrderBillNo, @@ -636,7 +662,6 @@ foreach ($final_paystage as $key => &$value) { $collect_month = collect_month(strtotime($value[$sequenceNumber]['PlanPayDate'])); if ($today > strtotime($value[$sequenceNumber]['PlanPayDate'])) { $value[$sequenceNumber]['hadtopay'] = 'V'; - $arrayData[$key]['receivable_budget'] += $value[$sequenceNumber]['PlanPayAmt']; } else { $value[$sequenceNumber]['hadtopay'] = '--'; } @@ -644,9 +669,9 @@ foreach ($final_paystage as $key => &$value) { $collect_month = 0; $value[$sequenceNumber]['hadtopay'] = '--'; } - if ($tmpinvoice >= $value[$sequenceNumber]['PlanPayAmt']) { + if ($tmpinvoice > $value[$sequenceNumber]['PlanPayAmt']) { $value[$sequenceNumber]['invoice_budget'] = $value[$sequenceNumber]['PlanPayAmt']; - $tmpinvoice -= $value[$sequenceNumber]['invoice_budget']; + $tmpinvoice = $tmpinvoice - $value[$sequenceNumber]['invoice_budget']; } elseif ($tmpinvoice > 0) { $value[$sequenceNumber]['invoice_budget'] = $tmpinvoice; $tmpinvoice = 0; @@ -655,7 +680,7 @@ foreach ($final_paystage as $key => &$value) { } if ($tmpreceived > $value[$sequenceNumber]['PlanPayAmt']) { $value[$sequenceNumber]['received_budget'] = $value[$sequenceNumber]['PlanPayAmt']; - $tmpinvoice -= $value[$sequenceNumber]['received_budget']; + $tmpreceived -= $value[$sequenceNumber]['received_budget']; } elseif ($tmpreceived > 0) { $value[$sequenceNumber]['received_budget'] = $tmpreceived; $tmpreceived = 0; @@ -670,17 +695,9 @@ foreach ($final_paystage as $key => &$value) { } } -// foreach($final_paystage as $key => $value) { -// echo $key."
"; -// echo "---------------------
"; -// foreach($value as $key2 => $value2) { -// echo $key2."
"; -// print_r($value2); -// echo "
"; -// } -// echo "
==================
"; -// } -// exit(); + + +//合約資料填回arrayData foreach ($final_paystage as $key => $value) { for ($sequence = 1; $sequence <= count($value); $sequence++) { if (isset($arrayData[$key]) && isset($arrayData[$key]['facility']) && isset($arrayData[$key]['facility'][$value[$sequence]['facilityno']]) && isset($arrayData[$key]['facility'][$value[$sequence]['facilityno']]['PayStage'])) { @@ -688,18 +705,37 @@ foreach ($final_paystage as $key => $value) { foreach ($arrayData[$key]['PayStage'] as $arkey => &$arvalue) { if ($arvalue['PayStage'] == $value[$sequence]['PayStage']) { if (isset($arvalue['receivable_budget']) && isset($arvalue['received_budget']) && isset($arvalue['invoice_budget'])) { - $arvalue['receivable_budget'] += $value[$sequence]['PlanPayAmt']; $arvalue['received_budget'] += $value[$sequence]['received_budget']; $arvalue['invoice_budget'] += $value[$sequence]['invoice_budget']; + if ($value[$sequence]['hadtopay'] == 'V') { + $arvalue['receivable_budget'] += $value[$sequence]['PlanPayAmt']; + $arrayData[$key]['receivable_budget'] += $value[$sequence]['PlanPayAmt']; + } else { + $arvalue['receivable_budget'] = 0; + } if ($arvalue['collect_month'] < $value[$sequence]['collect_month']) { $arvalue['collect_month'] = $value[$sequence]['collect_month']; } + $sum_receivable_budget += $value[$sequence]['PlanPayAmt']; + $sum_received_budget += $value[$sequence]['received_budget']; + $sum_invoice_budget += $value[$sequence]['invoice_budget']; } else { $arvalue['stage'] = $value[$sequence]['stage']; - $arvalue['receivable_budget'] = $value[$sequence]['PlanPayAmt']; + if ($value[$sequence]['hadtopay'] == 'V') { + $arvalue['receivable_budget'] = $value[$sequence]['PlanPayAmt']; + $arrayData[$key]['receivable_budget'] += $value[$sequence]['PlanPayAmt']; + } else { + $arvalue['receivable_budget'] = 0; + } $arvalue['received_budget'] = $value[$sequence]['received_budget']; $arvalue['invoice_budget'] = $value[$sequence]['invoice_budget']; $arvalue['collect_month'] = $value[$sequence]['collect_month']; + $sum_receivable_budget += $value[$sequence]['PlanPayAmt']; + $sum_received_budget += $value[$sequence]['received_budget']; + $sum_invoice_budget += $value[$sequence]['invoice_budget']; + } + if ($value[$sequence]['collect_month'] > $arrayData[$key]['collect_month']) { + $arrayData[$key]['collect_month'] = $value[$sequence]['collect_month']; } } } @@ -707,15 +743,620 @@ foreach ($final_paystage as $key => $value) { } } -// 存進excel_array -$excel_array = array(); +$average_A40001 = $sum_A40001 / $sum_facility; +$average_A40008 = $sum_A40008 / $sum_facility; +$average_facility_budget = $sum_total_budget / $sum_facility; +$average_contract_budget = $sum_total_budget / $sum_contract; +$average_contract_facility = $sum_facility / $sum_contract; + + +// excel 結果 +// 0 合約號; 1 單據日期; 2 客戶編號; 3 客戶名稱; 4 客戶地址; 5 部門ID; 6 部門名稱; 7 營業員工號; 8 營業員名稱; 9 部門主管工號; 10 部門主管名稱; +// 11 合約總金額; 12 A40001總金額; 13 A40008總金額; 14 目前應收金額; 15 已開發票金額; 16 已收金額; 17 催收金額; 18 催收次數; 19 作番總數; 20 作番狀態 +// 21 訂金名稱; 22 訂金金額; 23 應收金額; 24 已開發票金額; 25 已收金額; 26 催收金額; 27 催收次數; +// 28 二次款名稱; 29 二次款金額; 30 應收金額; 31 已開發票金額; 32 已收金額; 33 催收金額; 34 催收次數; +$excel_contract_array = array(); +$excel_contract_all_array = array(); +$excel_contract_boga_array = array(); +$excel_contract_noboga_array = array(); + +$excel_facility_array = array(); foreach ($arrayData as $key => $value) { - echo $key . "
********************
"; - print_r($value); - // foreach($value['facility'] as $key2 => $value2) { - // echo $key2."
"; - // print_r($value2['PayStage']); - // echo "
"; - // } - echo "
-------------------------------
"; + + $excel_contract_array[$key] = array_fill(0, 76, ''); + $excel_contract_array[$key][0] = (isset($value['BillNo']) && !is_null($value['BillNo'])) ? $value['BillNo'] : ''; + $excel_contract_array[$key][1] = (isset($value['BillDate']) && !is_null($value['BillDate'])) ? $value['BillDate'] : ''; + $excel_contract_array[$key][2] = (isset($value['CustomerId']) && !is_null($value['CustomerId'])) ? $value['CustomerId'] : ''; + $excel_contract_array[$key][3] = (isset($value['CustomerName']) && !is_null($value['CustomerName'])) ? $value['CustomerName'] : ''; + $excel_contract_array[$key][4] = (isset($value['CustomerAddress']) && !is_null($value['CustomerAddress'])) ? $value['CustomerAddress'] : ''; + $excel_contract_array[$key][5] = (isset($value['DeptId']) && !is_null($value['DeptId'])) ? $value['DeptId'] : ''; + $excel_contract_array[$key][6] = (isset($value['DeptName']) && !is_null($value['DeptName'])) ? $value['DeptName'] : ''; + $excel_contract_array[$key][7] = (isset($value['PersonId']) && !is_null($value['PersonId'])) ? $value['PersonId'] : ''; + $excel_contract_array[$key][8] = (isset($value['PersonName']) && !is_null($value['PersonName'])) ? $value['PersonName'] : ''; + $excel_contract_array[$key][9] = (isset($value['ManagerId']) && !is_null($value['ManagerId'])) ? $value['ManagerId'] : ''; + $excel_contract_array[$key][10] = (isset($value['ManagerName']) && !is_null($value['ManagerName'])) ? $value['ManagerName'] : ''; + $excel_contract_array[$key][11] = (isset($value['OAmountWithTax']) && !is_null($value['OAmountWithTax'])) ? number_format(round($value['OAmountWithTax'])) : '0'; + $excel_contract_array[$key][12] = (isset($value['A40001']) && !is_null($value['A40001'])) ? number_format(round($value['A40001'])) : '0'; + $excel_contract_array[$key][13] = (isset($value['A40008']) && !is_null($value['A40008'])) ? number_format(round($value['A40008'])) : '0'; + $excel_contract_array[$key][14] = (isset($value['receivable_budget']) && !is_null($value['receivable_budget'])) ? $value['receivable_budget'] : 0; + $excel_contract_array[$key][15] = (isset($value['invoice_budget']) && !is_null($value['invoice_budget'])) ? number_format(round($value['invoice_budget'])) : '0'; + $excel_contract_array[$key][16] = (isset($value['received_budget']) && !is_null($value['received_budget'])) ? $value['received_budget'] : 0; + $excel_contract_array[$key][17] = number_format(round($excel_contract_array[$key][14] - $excel_contract_array[$key][16])); + $excel_contract_array[$key][18] = (isset($value['collect_month']) && !is_null($value['collect_month'])) ? number_format(round($value['collect_month'])) : '0'; + $excel_contract_array[$key][19] = (isset($value['facility_num']) && !is_null($value['facility_num'])) ? number_format(round($value['facility_num'])) : '0'; + $excel_contract_array[$key][20] = (isset($value['facility_status']) && !is_null($value['facility_status'])) ? $value['facility_status'] : '--'; + $excel_contract_array[$key][14] = number_format(round($excel_contract_array[$key][14])); + $excel_contract_array[$key][16] = number_format(round($excel_contract_array[$key][16])); + if ($excel_contract_array[$key][17] > 1 && isset($value['PayStage']) && is_iterable($value['PayStage'])) { + $excel_contract_all_array[$key] = array_fill(0, 24, 0); + $excel_contract_all_array[$key][0] = $excel_contract_array[$key][0]; + $excel_contract_all_array[$key][1] = $excel_contract_array[$key][3]; + $excel_contract_all_array[$key][2] = $excel_contract_array[$key][8]; + $excel_contract_all_array[$key][3] = $excel_contract_array[$key][11]; + $excel_contract_all_array[$key][4] = $excel_contract_array[$key][19]; + $excel_contract_all_array[$key][5] = $excel_contract_array[$key][20]; + $excel_contract_all_array[$key][6] = $excel_contract_array[$key][17]; + $excel_contract_all_array[$key][7] = $excel_contract_array[$key][18]; + $isBoga = 0; + if (stristr($value['PayStage'][1]['PayStage'], '寶佳')) { + $isBoga = 1; + $excel_contract_boga_array[$key] = array_fill(0, 24, ''); + $excel_contract_boga_array[$key][0] = $excel_contract_array[$key][0]; + $excel_contract_boga_array[$key][1] = $excel_contract_array[$key][3]; + $excel_contract_boga_array[$key][2] = $excel_contract_array[$key][8]; + $excel_contract_boga_array[$key][3] = $excel_contract_array[$key][11]; + $excel_contract_boga_array[$key][4] = $excel_contract_array[$key][19]; + $excel_contract_boga_array[$key][5] = $excel_contract_array[$key][20]; + $excel_contract_boga_array[$key][6] = $excel_contract_array[$key][17]; + $excel_contract_boga_array[$key][7] = $excel_contract_array[$key][18]; + } else { + $excel_contract_noboga_array[$key] = array_fill(0, 24, ''); + $excel_contract_noboga_array[$key][0] = $excel_contract_array[$key][0]; + $excel_contract_noboga_array[$key][1] = $excel_contract_array[$key][3]; + $excel_contract_noboga_array[$key][2] = $excel_contract_array[$key][8]; + $excel_contract_noboga_array[$key][3] = $excel_contract_array[$key][11]; + $excel_contract_noboga_array[$key][4] = $excel_contract_array[$key][19]; + $excel_contract_noboga_array[$key][5] = $excel_contract_array[$key][20]; + $excel_contract_noboga_array[$key][6] = $excel_contract_array[$key][17]; + $excel_contract_noboga_array[$key][7] = $excel_contract_array[$key][18]; + } + foreach ($value['PayStage'] as $paykey => $payvalue) { + switch ($payvalue['stage']) { + case "訂金": + $excel_contract_array[$key][21] = (isset($payvalue['PayStage']) && !is_null($payvalue['PayStage'])) ? $payvalue['PayStage'] : '--'; + $excel_contract_array[$key][22] = (isset($payvalue['PlanPayAmt']) && !is_null($payvalue['PlanPayAmt'])) ? number_format(round($payvalue['PlanPayAmt'])) : '0'; + $excel_contract_array[$key][23] = (isset($payvalue['receivable_budget']) && !is_null($payvalue['receivable_budget'])) ? $payvalue['receivable_budget'] : 0; + $excel_contract_array[$key][24] = (isset($payvalue['invoice_budget']) && !is_null($payvalue['invoice_budget'])) ? number_format(round($payvalue['invoice_budget'])) : '0'; + $excel_contract_array[$key][25] = (isset($payvalue['received_budget']) && !is_null($payvalue['received_budget'])) ? $payvalue['received_budget'] : 0; + $excel_contract_array[$key][26] = number_format(round($excel_contract_array[$key][23] - $excel_contract_array[$key][25])); + $excel_contract_array[$key][27] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? number_format(round($payvalue['collect_month'])) : '0'; + if (isset($excel_contract_all_array[$key])) { + $excel_contract_all_array[$key][8] = number_format(round($excel_contract_array[$key][23] - $excel_contract_array[$key][25])); + $excel_contract_all_array[$key][9] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? number_format(round($payvalue['collect_month'])) : '0'; + if ($isBoga == 1) { + $excel_contract_boga_array[$key][8] = $excel_contract_all_array[$key][8]; + $excel_contract_boga_array[$key][9] = $excel_contract_all_array[$key][9]; + } else { + $excel_contract_noboga_array[$key][8] = $excel_contract_all_array[$key][8]; + $excel_contract_noboga_array[$key][9] = $excel_contract_all_array[$key][9]; + } + } + $excel_contract_array[$key][23] = number_format(round($excel_contract_array[$key][23])); + $excel_contract_array[$key][25] = number_format(round($excel_contract_array[$key][25])); + + + break; + case "二次款": + $excel_contract_array[$key][28] = (isset($payvalue['PayStage']) && !is_null($payvalue['PayStage'])) ? $payvalue['PayStage'] : '--'; + $excel_contract_array[$key][29] = (isset($payvalue['PlanPayAmt']) && !is_null($payvalue['PlanPayAmt'])) ? number_format(round($payvalue['PlanPayAmt'])) : '0'; + $excel_contract_array[$key][30] = (isset($payvalue['receivable_budget']) && !is_null($payvalue['receivable_budget'])) ? $payvalue['receivable_budget'] : 0; + $excel_contract_array[$key][31] = (isset($payvalue['invoice_budget']) && !is_null($payvalue['invoice_budget'])) ? number_format(round($payvalue['invoice_budget'])) : '0'; + $excel_contract_array[$key][32] = (isset($payvalue['received_budget']) && !is_null($payvalue['received_budget'])) ? $payvalue['received_budget'] : 0; + $excel_contract_array[$key][33] = number_format(round($excel_contract_array[$key][30] - $excel_contract_array[$key][32])); + $excel_contract_array[$key][34] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? number_format(round($payvalue['collect_month'])) : '0'; + if (isset($excel_contract_all_array[$key])) { + $excel_contract_all_array[$key][10] = number_format(round($excel_contract_array[$key][30] - $excel_contract_array[$key][32])); + $excel_contract_all_array[$key][11] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? number_format(round($payvalue['collect_month'])) : '0'; + if ($isBoga == 1) { + $excel_contract_boga_array[$key][10] = $excel_contract_all_array[$key][10]; + $excel_contract_boga_array[$key][11] = $excel_contract_all_array[$key][11]; + } else { + $excel_contract_noboga_array[$key][10] = $excel_contract_all_array[$key][10]; + $excel_contract_noboga_array[$key][11] = $excel_contract_all_array[$key][11]; + } + } + + $excel_contract_array[$key][30] = number_format(round($excel_contract_array[$key][30])); + $excel_contract_array[$key][32] = number_format(round($excel_contract_array[$key][32])); + + + break; + case "貨抵工地款": + $excel_contract_array[$key][35] = (isset($payvalue['PayStage']) && !is_null($payvalue['PayStage'])) ? $payvalue['PayStage'] : '--'; + $excel_contract_array[$key][36] = (isset($payvalue['PlanPayAmt']) && !is_null($payvalue['PlanPayAmt'])) ? number_format(round($payvalue['PlanPayAmt'])) : '0'; + $excel_contract_array[$key][37] = (isset($payvalue['receivable_budget']) && !is_null($payvalue['receivable_budget'])) ? $payvalue['receivable_budget'] : 0; + $excel_contract_array[$key][38] = (isset($payvalue['invoice_budget']) && !is_null($payvalue['invoice_budget'])) ? number_format(round($payvalue['invoice_budget'])) : '0'; + $excel_contract_array[$key][39] = (isset($payvalue['received_budget']) && !is_null($payvalue['received_budget'])) ? $payvalue['received_budget'] : 0; + $excel_contract_array[$key][40] = number_format(round($excel_contract_array[$key][37] - $excel_contract_array[$key][39])); + $excel_contract_array[$key][41] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? number_format(round($payvalue['collect_month'])) : '0'; + if (isset($excel_contract_all_array[$key])) { + $excel_contract_all_array[$key][12] = number_format(round($excel_contract_array[$key][37] - $excel_contract_array[$key][39])); + $excel_contract_all_array[$key][13] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? number_format(round($payvalue['collect_month'])) : '0'; + if ($isBoga == 1) { + $excel_contract_boga_array[$key][12] = $excel_contract_all_array[$key][12]; + $excel_contract_boga_array[$key][13] = $excel_contract_all_array[$key][13]; + } else { + $excel_contract_noboga_array[$key][12] = $excel_contract_all_array[$key][12]; + $excel_contract_noboga_array[$key][13] = $excel_contract_all_array[$key][13]; + } + } + $excel_contract_array[$key][37] = number_format(round($excel_contract_array[$key][37])); + $excel_contract_array[$key][39] = number_format(round($excel_contract_array[$key][39])); + + break; + case "安裝款": + $excel_contract_array[$key][42] = (isset($payvalue['PayStage']) && !is_null($payvalue['PayStage'])) ? $payvalue['PayStage'] : '--'; + $excel_contract_array[$key][43] = (isset($payvalue['PlanPayAmt']) && !is_null($payvalue['PlanPayAmt'])) ? number_format(round($payvalue['PlanPayAmt'])) : '0'; + $excel_contract_array[$key][44] = (isset($payvalue['receivable_budget']) && !is_null($payvalue['receivable_budget'])) ? $payvalue['receivable_budget'] : 0; + $excel_contract_array[$key][45] = (isset($payvalue['invoice_budget']) && !is_null($payvalue['invoice_budget'])) ? number_format(round($payvalue['invoice_budget'])) : '0'; + $excel_contract_array[$key][46] = (isset($payvalue['received_budget']) && !is_null($payvalue['received_budget'])) ? $payvalue['received_budget'] : 0; + $excel_contract_array[$key][47] = number_format(round($excel_contract_array[$key][44] - $excel_contract_array[$key][46])); + $excel_contract_array[$key][48] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? number_format(round($payvalue['collect_month'])) : '0'; + if (isset($excel_contract_all_array[$key])) { + $excel_contract_all_array[$key][14] = number_format(round($excel_contract_array[$key][44] - $excel_contract_array[$key][46])); + $excel_contract_all_array[$key][15] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? number_format(round($payvalue['collect_month'])) : '0'; + $excel_contract_noboga_array[$key][14] = $excel_contract_all_array[$key][14]; + $excel_contract_noboga_array[$key][15] = $excel_contract_all_array[$key][15]; + } + $excel_contract_array[$key][44] = number_format(round($excel_contract_array[$key][44])); + $excel_contract_array[$key][46] = number_format(round($excel_contract_array[$key][46])); + break; + case "試車款": + $excel_contract_array[$key][49] = (isset($payvalue['PayStage']) && !is_null($payvalue['PayStage'])) ? $payvalue['PayStage'] : '--'; + $excel_contract_array[$key][50] = (isset($payvalue['PlanPayAmt']) && !is_null($payvalue['PlanPayAmt'])) ? number_format(round($payvalue['PlanPayAmt'])) : '0'; + $excel_contract_array[$key][51] = (isset($payvalue['receivable_budget']) && !is_null($payvalue['receivable_budget'])) ? $payvalue['receivable_budget'] : 0; + $excel_contract_array[$key][52] = (isset($payvalue['invoice_budget']) && !is_null($payvalue['invoice_budget'])) ? number_format(round($payvalue['invoice_budget'])) : '0'; + $excel_contract_array[$key][53] = (isset($payvalue['received_budget']) && !is_null($payvalue['received_budget'])) ? $payvalue['received_budget'] : 0; + $excel_contract_array[$key][54] = number_format(round($excel_contract_array[$key][51] - $excel_contract_array[$key][53])); + $excel_contract_array[$key][55] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? number_format(round($payvalue['collect_month'])) : '0'; + if (isset($excel_contract_all_array[$key])) { + $excel_contract_all_array[$key][16] = number_format(round($excel_contract_array[$key][51] - $excel_contract_array[$key][53])); + $excel_contract_all_array[$key][17] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? number_format(round($payvalue['collect_month'])) : '0'; + if ($isBoga == 1) { + $excel_contract_boga_array[$key][16] = $excel_contract_all_array[$key][16]; + $excel_contract_boga_array[$key][17] = $excel_contract_all_array[$key][17]; + } else { + $excel_contract_noboga_array[$key][16] = $excel_contract_all_array[$key][16]; + $excel_contract_noboga_array[$key][17] = $excel_contract_all_array[$key][17]; + } + } + $excel_contract_array[$key][51] = number_format(round($excel_contract_array[$key][51])); + $excel_contract_array[$key][53] = number_format(round($excel_contract_array[$key][53])); + + break; + case "官檢驗收款": + $excel_contract_array[$key][56] = (isset($payvalue['PayStage']) && !is_null($payvalue['PayStage'])) ? $payvalue['PayStage'] : '--'; + $excel_contract_array[$key][57] = (isset($payvalue['PlanPayAmt']) && !is_null($payvalue['PlanPayAmt'])) ? number_format(round($payvalue['PlanPayAmt'])) : '0'; + $excel_contract_array[$key][58] = (isset($payvalue['receivable_budget']) && !is_null($payvalue['receivable_budget'])) ? $payvalue['receivable_budget'] : 0; + $excel_contract_array[$key][59] = (isset($payvalue['invoice_budget']) && !is_null($payvalue['invoice_budget'])) ? number_format(round($payvalue['invoice_budget'])) : '0'; + $excel_contract_array[$key][60] = (isset($payvalue['received_budget']) && !is_null($payvalue['received_budget'])) ? $payvalue['received_budget'] : 0; + $excel_contract_array[$key][61] = number_format(round($excel_contract_array[$key][58] - $excel_contract_array[$key][60])); + $excel_contract_array[$key][62] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? number_format(round($payvalue['collect_month'])) : '0'; + if (isset($excel_contract_all_array[$key])) { + $excel_contract_all_array[$key][18] = number_format(round($excel_contract_array[$key][58] - $excel_contract_array[$key][60])); + $excel_contract_all_array[$key][19] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? number_format(round($payvalue['collect_month'])) : '0'; + + $excel_contract_noboga_array[$key][18] = $excel_contract_all_array[$key][18]; + $excel_contract_noboga_array[$key][19] = $excel_contract_all_array[$key][19]; + } + $excel_contract_array[$key][58] = number_format(round($excel_contract_array[$key][58])); + $excel_contract_array[$key][60] = number_format(round($excel_contract_array[$key][60])); + + break; + case "交車款": + $excel_contract_array[$key][63] = (isset($payvalue['PayStage']) && !is_null($payvalue['PayStage'])) ? $payvalue['PayStage'] : '--'; + $excel_contract_array[$key][64] = (isset($payvalue['PlanPayAmt']) && !is_null($payvalue['PlanPayAmt'])) ? number_format(round($payvalue['PlanPayAmt'])) : '0'; + $excel_contract_array[$key][65] = (isset($payvalue['receivable_budget']) && !is_null($payvalue['receivable_budget'])) ? $payvalue['receivable_budget'] : 0; + $excel_contract_array[$key][66] = (isset($payvalue['invoice_budget']) && !is_null($payvalue['invoice_budget'])) ? number_format(round($payvalue['invoice_budget'])) : '0'; + $excel_contract_array[$key][67] = (isset($payvalue['received_budget']) && !is_null($payvalue['received_budget'])) ? $payvalue['received_budget'] : 0; + $excel_contract_array[$key][68] = number_format(round($excel_contract_array[$key][65] - $excel_contract_array[$key][67])); + $excel_contract_array[$key][69] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? number_format(round($payvalue['collect_month'])) : '0'; + if (isset($excel_contract_all_array[$key])) { + $excel_contract_all_array[$key][20] = number_format(round($excel_contract_array[$key][65] - $excel_contract_array[$key][67])); + $excel_contract_all_array[$key][21] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? number_format(round($payvalue['collect_month'])) : '0'; + $excel_contract_noboga_array[$key][20] = $excel_contract_all_array[$key][20]; + $excel_contract_noboga_array[$key][21] = $excel_contract_all_array[$key][21]; + } + $excel_contract_array[$key][65] = number_format(round($excel_contract_array[$key][65])); + $excel_contract_array[$key][67] = number_format(round($excel_contract_array[$key][67])); + + break; + case "尾款": + $excel_contract_array[$key][70] = (isset($payvalue['PayStage']) && !is_null($payvalue['PayStage'])) ? $payvalue['PayStage'] : '--'; + $excel_contract_array[$key][71] = (isset($payvalue['PlanPayAmt']) && !is_null($payvalue['PlanPayAmt'])) ? number_format(round($payvalue['PlanPayAmt'])) : '0'; + $excel_contract_array[$key][72] = (isset($payvalue['receivable_budget']) && !is_null($payvalue['receivable_budget'])) ? $payvalue['receivable_budget'] : 0; + $excel_contract_array[$key][73] = (isset($payvalue['invoice_budget']) && !is_null($payvalue['invoice_budget'])) ? number_format(round($payvalue['invoice_budget'])) : '0'; + $excel_contract_array[$key][74] = (isset($payvalue['received_budget']) && !is_null($payvalue['received_budget'])) ? $payvalue['received_budget'] : 0; + $excel_contract_array[$key][75] = number_format(round($excel_contract_array[$key][72] - $excel_contract_array[$key][74])); + $excel_contract_array[$key][76] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? number_format(round($payvalue['collect_month'])) : '0'; + if (isset($excel_contract_all_array[$key])) { + $excel_contract_all_array[$key][22] = number_format(round($excel_contract_array[$key][72] - $excel_contract_array[$key][74])); + $excel_contract_all_array[$key][23] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? number_format(round($payvalue['collect_month'])) : '0'; + if ($isBoga == 1) { + $excel_contract_boga_array[$key][22] = $excel_contract_all_array[$key][22]; + $excel_contract_boga_array[$key][23] = $excel_contract_all_array[$key][23]; + } else { + $excel_contract_noboga_array[$key][22] = $excel_contract_all_array[$key][22]; + $excel_contract_noboga_array[$key][23] = $excel_contract_all_array[$key][23]; + } + } + $excel_contract_array[$key][72] = number_format(round($excel_contract_array[$key][72])); + $excel_contract_array[$key][74] = number_format(round($excel_contract_array[$key][74])); + + break; + } + } + } + // 0 作番號; 1 合約號; 2 合約單據日期; 3 客戶編號; 4 客戶名稱; 5 客戶地址; 6 部門ID; 7 部門名稱; 8 營業員工號; 9 營業員名稱; 10 部門主管工號; 11 部門主管名稱; + // 12 作番總金額; 13 A40001 金額; 14 A40008 金額; 15 目前應收金額; 16 已開發票金額; 17 已收金額; 18 催收金額; 19 催收次數; 20 作番狀態 + if (isset($value['facility']) && is_iterable($value['facility'])) { + foreach ($value['facility'] as $fkey => $fvalue) { + $excel_facility_array[$fkey] = [$fkey, $key, $value['BillDate']]; + $excel_facility_array[$key][2] = (isset($value['CustomerId']) && !is_null($value['CustomerId'])) ? $value['CustomerId'] : ''; + $excel_facility_array[$key][3] = (isset($value['CustomerName']) && !is_null($value['CustomerName'])) ? $value['CustomerName'] : ''; + $excel_facility_array[$key][4] = (isset($value['CustomerAddress']) && !is_null($value['CustomerAddress'])) ? $value['CustomerAddress'] : ''; + $excel_facility_array[$key][5] = (isset($value['DeptId']) && !is_null($value['DeptId'])) ? $value['DeptId'] : ''; + $excel_facility_array[$key][6] = (isset($value['DeptName']) && !is_null($value['DeptName'])) ? $value['DeptName'] : ''; + $excel_facility_array[$key][7] = (isset($value['PersonId']) && !is_null($value['PersonId'])) ? $value['PersonId'] : ''; + $excel_facility_array[$key][8] = (isset($value['PersonName']) && !is_null($value['PersonName'])) ? $value['PersonName'] : ''; + $excel_facility_array[$key][9] = (isset($value['ManagerId']) && !is_null($value['ManagerId'])) ? $value['ManagerId'] : ''; + } + } } + +$total_data = json_encode($excel_contract_all_array); +$boga_data = json_encode($excel_contract_boga_array); +$noboga_data = json_encode($excel_contract_noboga_array); +?> + + +
+
+ + + +
+
+ +
+
+

合約 (新梯)統整資訊

+
+
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+
+
+ + + + + + + + + + + + +
合約日期 + + ~ + + +
合約催收次數 + + ≤ 催收次數 ≤ + + +
+
+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + $value) { + ?> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
合約號部門主管營業員客戶作番狀態合約-設備金額合約-安裝金額合約總金額合約目前應收已開發票金額已收金額金額催收金額金額催收次數作番數量訂金
名稱
訂金
合約金額
訂金
應收金額
訂金
已開金額
訂金
已收金額
訂金
催收金額
訂金
催收次數
二次款
名稱
二次款
合約金額
二次款
應收金額
二次款
已開金額
二次款
已收金額
二次款
催收金額
二次款
催收次數
貨抵工地款
名稱
貨抵工地款
合約金額
貨抵工地款
應收金額
貨抵工地款
已開金額
貨抵工地款
已收金額
貨抵工地款
催收金額
貨抵工地款
催收次數
安裝款
名稱
安裝款
合約金額
安裝款
應收金額
安裝款
已開金額
安裝款
已收金額
安裝款
催收金額
安裝款
催收次數
試車款
名稱
試車款
合約金額
試車款
應收金額
試車款
已開金額
試車款
已收金額
試車款
催收金額
試車款
催收次數
官檢驗收款
名稱
官檢驗收款
合約金額
官檢驗收款
應收金額
官檢驗收款
已開金額
官檢驗收款
已收金額
官檢驗收款
催收金額
官檢驗收款
催收次數
交車款
名稱
交車款
合約金額
交車款
應收金額
交車款
已開金額
交車款
已收金額
交車款
催收金額
交車款
催收次數
尾款
名稱
尾款
合約金額
尾款
應收金額
尾款
已開金額
尾款
已收金額
尾款
催收金額
尾款
催收次數
" . $value['DeptName'] ?>" . $value['ManagerName'] ?>" . $value['PersonName'] ?>" . $value['CustomerName'] ?>
+
+ + + \ No newline at end of file diff --git a/wms/account-receivable-renovate-index.php b/wms/account-receivable-renovate-index.php index 49093379..1b3df449 100644 --- a/wms/account-receivable-renovate-index.php +++ b/wms/account-receivable-renovate-index.php @@ -9,11 +9,14 @@ $sum_A40002 = 0; $sum_A40009 = 0; // 安裝 $sum_A40010 = 0; +// M4 +$sum_A40019 = 0; $sum_total_budget = 0; $average_budget = 0; $average_A40002 = 0; $average_A40009 = 0; $average_A40010 = 0; +$average_A40019 = 0; $start_date = empty($_POST['date_start']) ? null : $_POST['date_start']; $end_date = empty($_POST['date_end']) ? null : $_POST['date_end']; @@ -116,11 +119,6 @@ FROM arWriteOffBillDetail WHERE CheckDetail.ModeId = 'T'"; -// 期初收款資訊 -$sql_opening = " -SELECT * FROM account_received "; - - $contractNumbers = array(); $query_contract_number = $conn->query($sql_contractNumber); foreach ($query_contract_number as $contract_numbers) { @@ -258,7 +256,7 @@ foreach ($contract as $cont) { $arrayData[$BillNo]['invoice'] = array(); $arrayData[$BillNo]['received_budget'] = 0; $arrayData[$BillNo]['invoice_budget'] = 0; - $arrayData[$BillNo]['A40002'] = $arrayData[$BillNo]['A40009'] = $arrayData[$BillNo]['A40010'] = 0; + $arrayData[$BillNo]['A40002'] = $arrayData[$BillNo]['A40009'] = $arrayData[$BillNo]['A40010'] = $arrayData[$BillNo]['A40019'] = 0; $arrayData[$BillNo]['total_facility_num'] = 0; } $arrayData[$BillNo]['PayStage'][$RowNo]['type'] = 0; @@ -280,7 +278,6 @@ foreach ($contract as $cont) { } } $received_array = $conn->query($sql_received); -$opening_data = mysqli_query($link, $sql_opening); $invoice_data = $conn->query($sql_invoice); $contract_budget_data = $conn->query($sql_contract_budget); @@ -312,7 +309,7 @@ foreach ($contract_budget_data as $cont) { } else { $arrayData[$BillNo]['total_facility_num'] += 1; $arrayData[$BillNo]['facility'][$cont['CU_MaterialId']]['total_budget'] = $cont['OAmountWithTax']; - $arrayData[$BillNo]['facility'][$cont['CU_MaterialId']]['A40002'] = $arrayData[$BillNo]['facility'][$cont['CU_MaterialId']]['A40009'] = $arrayData[$BillNo]['facility'][$cont['CU_MaterialId']]['A40010'] = 0; + $arrayData[$BillNo]['facility'][$cont['CU_MaterialId']]['A40002'] = $arrayData[$BillNo]['facility'][$cont['CU_MaterialId']]['A40009'] = $arrayData[$BillNo]['facility'][$cont['CU_MaterialId']]['A40010'] = $arrayData[$BillNo]['facility'][$cont['CU_MaterialId']]['A40019'] = 0; $arrayData[$BillNo]['facility'][$cont['CU_MaterialId']][$cont['MaterialId']] = $cont['OAmountWithTax']; } } @@ -335,6 +332,7 @@ foreach ($contract_budget_data as $cont) { $contract_budget[$cont['BillNo']]['facility'][$cont['CU_MaterialId']]['A40002'] = 0; $contract_budget[$cont['BillNo']]['facility'][$cont['CU_MaterialId']]['A40009'] = 0; $contract_budget[$cont['BillNo']]['facility'][$cont['CU_MaterialId']]['A40010'] = 0; + $contract_budget[$cont['BillNo']]['facility'][$cont['CU_MaterialId']]['A40019'] = 0; $contract_budget[$cont['BillNo']]['facility'][$cont['CU_MaterialId']][$cont['MaterialId']] = $cont['OAmountWithTax']; }; } @@ -428,6 +426,7 @@ foreach ($wipwhole_array as $wip) { $arrayData[$billno]['facility'][$wip['facilityno']]['A40002'] = (isset($contract_budget[$billno][$wip['facilityno']]['A40002']) && !is_null($contract_budget[$billno][$wip['facilityno']]['A40002'])) ? $contract_budget[$billno][$wip['facilityno']]['A40002'] : 0; $arrayData[$billno]['facility'][$wip['facilityno']]['A40008'] = (isset($contract_budget[$billno][$wip['facilityno']]['A40008']) && !is_null($contract_budget[$billno][$wip['facilityno']]['A40008'])) ? $contract_budget[$billno][$wip['facilityno']]['A40008'] : 0; $arrayData[$billno]['facility'][$wip['facilityno']]['A40010'] = (isset($contract_budget[$billno][$wip['facilityno']]['A40010']) && !is_null($contract_budget[$billno][$wip['facilityno']]['A40010'])) ? $contract_budget[$billno][$wip['facilityno']]['A40010'] : 0; + $arrayData[$billno]['facility'][$wip['facilityno']]['A40019'] = (isset($contract_budget[$billno][$wip['facilityno']]['A40019']) && !is_null($contract_budget[$billno][$wip['facilityno']]['A40019'])) ? $contract_budget[$billno][$wip['facilityno']]['A40019'] : 0; } $wipwhole_status[$wip['facilityno']] = $wip; } @@ -591,11 +590,23 @@ foreach ($received_array as $received) { $BillNo = $received['OrderBillNo']; if (isset($arrayData[$BillNo])) { // if (isset($received['InvoiceNo']) && isset($arrayData[$BillNo]['invoice'][$received['InvoiceNo']])) { - $arrayData[$BillNo]['received_budget'] += $received['CurrStandOffOAmount']; + $arrayData[$BillNo]['received_budget'] += $received['CurrStandOffOAmount']; // array_push($arrayData[$BillNo]['invoice'][$received['InvoiceNo']], date($received['ReceivedDate']), $received['PayWriteOffOAmount'], $received['Fee'], $received['BillNo']); // } } } +//未在T8的收款資料 +$sql_wms = "SELECT * FROM account_received WHERE type='T' "; +$query_wms = mysqli_query($link, $sql_wms); +foreach ($query_wms as $wms) { + if (isset($arrayData[$wms['BillNo']]) && isset($arrayData[$wms['BillNo']]['invoice_budget'])) { + $arrayData[$wms['BillNo']]['invoice_budget'] += $wms['invoice_budget']; + $arrayData[$wms['BillNo']]['invoice'][$wms['invoice_no']] = [date("Y-m-d", strtotime($wms['invoice_date'])), $wms['invoice_budget'], 1]; + } + if (isset($arrayData[$wms['BillNo']]) && isset($arrayData[$wms['BillNo']]['received_budget'])) { + $arrayData[$wms['BillNo']]['received_budget'] += $wms['received_budget']; + } +} // $final_paystage ['type'] ['PlanPayDate'] ['PayAmount'] ['facilityno'] ['sequenceNumber'] ['name'] ['InvoiceAmount'] ['receivedAmount'] foreach ($final_paystage as $key => &$payStage) { if (isset($arrayData[$key]['invoice_budget']) && isset($arrayData[$key]['received_budget'])) { @@ -635,6 +646,7 @@ foreach ($final_paystage as $key => &$payStage) { // 0 合約號 1 作番號 2 部門id 3 部門名稱 4 經理名稱 5 營業員id 6 營業員名稱 7 客戶名稱 8 抬頭 9 統編 10 通訊地址 // 11 收款階段名稱 12 應收日期 13 收款金額 14 已開金額 15 已收金額 16 催收次數 $excel_aray = array(); +$print_array = array(); $today = strtotime(date('Ymt')); foreach ($arrayData as $key => $value) { if (isset($final_paystage[$key])) { @@ -659,6 +671,17 @@ foreach ($arrayData as $key => $value) { $unReceivedAmount = 0; break; } + if ($havetopay == "V" && $unReceivedAmount > 1) { + $print_array[$keyname] = [ + $value[10], $thisPayStage['facilityno'], $value[0], $value[1], $value[11], $value[2], $value[3], $value[4], $value[5], $value[6], $value[7], $value[8], + $thisPayStage['name'], $thisPayStage['PlanPayDate'], $havetopay, + number_format(round($final_paystage[$key][$sequence]['PayAmount'])), + number_format(round($final_paystage[$key][$sequence]['InvoiceAmount'])), number_format(round($unInvoiceAmount)), + number_format(round($final_paystage[$key][$sequence]['receivedAmount'])), number_format(round($unReceivedAmount)), + number_format(round($final_paystage[$key][$sequence]['collect_month'])) + + ]; + } $excel_aray[$keyname] = [ $value[10], $thisPayStage['facilityno'], $value[0], $value[1], $value[11], $value[2], $value[3], $value[4], $value[5], $value[6], $value[7], $value[8], $thisPayStage['name'], $thisPayStage['PlanPayDate'], $havetopay, @@ -671,7 +694,7 @@ foreach ($arrayData as $key => $value) { } } } -$total_data = json_encode($excel_aray); +$total_data = json_encode($print_array); ?> - - \ No newline at end of file + + + + + \ No newline at end of file diff --git a/wms/bonus/bonus_check.php b/wms/bonus/bonus_check.php new file mode 100644 index 00000000..9a2e5640 --- /dev/null +++ b/wms/bonus/bonus_check.php @@ -0,0 +1,199 @@ +prepare($sql); +$stmt->bindParam(':id', $_GET['id']); +$stmt->execute(); +$result = $stmt->fetch(PDO::FETCH_ASSOC); +// echo '
';
+// print_r($result['bonus_json']);
+// echo '
'; +$bonus_json = json_decode($result['bonus_json']); + +$paykind = [ + 'monthly' => '月繳', + 'bimonthly' => '雙月繳', + 'quarterly' => '季繳', + 'semiannually' => '半年繳', + 'annually' => '年繳' +]; + +$maintain_type = [ + 'new' => '新簽約', + 'free_to_charge' => '免保轉有費', + 'renew_priceissue' => '續簽約' +]; +?> + + + + + + + + + + +
+
+ +
+ + + + + + + + +
+

獎金計算

+
+ + + +
+
+
+ + \ No newline at end of file diff --git a/wms/bonus/bonus_detail.php b/wms/bonus/bonus_detail.php index 93762ac3..93dafa31 100644 --- a/wms/bonus/bonus_detail.php +++ b/wms/bonus/bonus_detail.php @@ -48,17 +48,6 @@ $maintain_type = [ - @@ -145,6 +145,14 @@ $maintain_type = [
+ - - - - - --> - - - 安裝 - 5、安裝完畢款 - - - - - - - - - - - - 6、驗收款 - - - - - - - - - - - - 7、其他 - - - - - - - - - - + + + + + + + 6、驗收款 + + + + + + + + + + + + 7、其他 + + + + + + + + + + - - 合計 - - - - - - - - - - - - + + 合計 + + + + + + + + + + + + - - + + - + - + - + + - \ No newline at end of file diff --git a/wms/contract-repair/js/alpine.js b/wms/contract-repair/js/alpine.js index 43991cca..3d21a269 100644 --- a/wms/contract-repair/js/alpine.js +++ b/wms/contract-repair/js/alpine.js @@ -900,7 +900,13 @@ const bonunsIndex = () => { total: total, fee_per_st: fee_per_st, commission_fee: commission_fee, - discount: discount + discount: discount, + bonus_actual: '', + note: '', + id: id, + // bonus_actual: bonus_actual, + // payDay: payDay, + // note: note }, step: 1, @@ -929,6 +935,9 @@ const bonunsIndex = () => { this.step = 3; s } }, + issue() { + console.log(1233); + }, getContractData() { axios.get('./api/get.php?contract_no=' + this.data.contract_no).then(res => { if (!res.data) { @@ -965,7 +974,39 @@ const bonunsIndex = () => { }, save() { if (this.step == 1) { - window.history.back(); + // window.history.back(); + const form = new FormData(); + form.append('id', this.data.id); + form.append('bonus_actual', this.data.bonus_actual); + form.append('pay_day', this.data.payDay); + form.append('note', this.data.note); + form.append('user_id', this.data.user_id); + form.append('postType', 'b'); + axios.post('./api/postStatus.php', form).then((res) => { + alert('更新成功'); + window.history.go(-1); + + }).catch((err) => { + // alert('更新失敗'); + alert('更新失敗' + err.response.data); + }) + } + }, + stop() { + if (this.step == 1) { + const form = new FormData(); + form.append('id', this.data.id); + form.append('bonus_actual', this.data.bonus_actual); + form.append('pay_day', this.data.payDay); + form.append('note', this.data.note); + form.append('postType', 'c'); + axios.post('./api/postStatus.php', form).then((res) => { + console.log(res); + alert('更新成功'); + window.history.go(-1); + }).catch((err) => { + alert(err.response.data); + }) } }, calBons() { @@ -1001,7 +1042,7 @@ const bonunsIndex = () => { } } -const bonunsIndexTest = () => { +const bonusIndexTest = () => { return { data: { bonus_verson: '2.1', @@ -1028,8 +1069,8 @@ const bonunsIndexTest = () => { step: 1, isLoading: false, fail_arr: [], - test() { - console.log(this.data.paykind); + issue() { + console.log('123'); }, nextStepFn() { if (this.step == 1) { diff --git a/wms/contract-repair/styles/style.css b/wms/contract-repair/styles/style.css index 7cc8f7dd..263ae3cc 100644 --- a/wms/contract-repair/styles/style.css +++ b/wms/contract-repair/styles/style.css @@ -654,7 +654,7 @@ main table th { align-items: center; width: 70px; height: 45px; - font-size: 15px; + font-size: 10px; } .contract-input-component .form table .fixed, .contract-management .form table .fixed, diff --git a/wms/contract-repair/styles/style.scss b/wms/contract-repair/styles/style.scss index 2eabc33d..bd419e02 100644 --- a/wms/contract-repair/styles/style.scss +++ b/wms/contract-repair/styles/style.scss @@ -707,7 +707,7 @@ main { align-items: center; width: 70px; height: 45px; - font-size: 15px; + font-size: 10px; } table { diff --git a/wms/contract/api/T8salIncomeApply.php b/wms/contract/api/T8salIncomeApply.php index 0a3d7698..f419d4d8 100644 --- a/wms/contract/api/T8salIncomeApply.php +++ b/wms/contract/api/T8salIncomeApply.php @@ -3,14 +3,15 @@ require_once("../../T8_Authorization_from_bpm.php"); function T8API($data) { - // echo '
';
-    // print_r(json_encode($data));
-    // echo '
'; $api_url = 'https://erp.masada.com.tw:780/twWebAPI/V1/SALINCOMEAPPLY/PostERPData'; $validation = get_Auth(); + echo '
';
+    print_r(json_encode($data));
+    echo '
'; $header = [ - "CHI_Authorization :" . $validation + "CHI_Authorization :" . $validation, + "GroupId:TEST" ]; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $api_url); // 设置请求的URL @@ -20,6 +21,7 @@ function T8API($data) curl_setopt($ch, CURLOPT_POST, 1); // 使用 POST curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data)); $response = curl_exec($ch); + if ($response === false) { echo 'Curl error: ' . curl_error($ch); } else { @@ -32,6 +34,7 @@ function T8API($data) // print_r($result); return $result; } + return $result; } curl_close($ch); diff --git a/wms/contract/api/getComboNo.php b/wms/contract/api/getComboNo.php index c258be15..265d4096 100644 --- a/wms/contract/api/getComboNo.php +++ b/wms/contract/api/getComboNo.php @@ -1,59 +1,62 @@ -'BW002', - 'month'=>'EM002', - 'quarter'=>'EQ002', - 'half'=>'HY002', - 'year'=>'EY002' - ]; - private $bwarr = [ - 'week','month','week','month','week','quarter', - 'week','month','week','month','week','half', - 'week','month','week','month','week','quarter', - 'week','month','week','month','week','year' - ]; - private $emarr = [ - 'month','month','quarter','month','month','half', - 'month','month','quarter','month','month','year' - ]; - private $combo; - private $startdate; - private $enddate; - public function __construct($combo, $startdate, $enddate){ - $this->combo = $combo; - $this->startdate = $startdate; - $this->enddate = $enddate; - } - public function getComboNo(){ - $comboarr = (array) $this->combo === 'bw' ? $this->bwarr : $this->emarr; - - $startdate = new DateTime($this->startdate); - $enddate = new DateTime($this->enddate); - - $interval = date_diff($startdate, $enddate); - - $months = $interval->y * 12 + $interval->m; - $months = $this->combo === 'bw' ? $months*2 : $months; - - $newarr = []; - $idx = 0; - $ori_first_month = date('m', strtotime($this->startdate)); - $first_day = date('Y-m-d', strtotime($this->startdate. ' + 3 days')); - $new_first_month = date('m', strtotime($first_day)); - if($ori_first_month != $new_first_month){ - $first_day = date('Y-m-t', strtotime($this->startdate)); - } - $scheduleDate = new DateTime($first_day); - for ($i = 0; $i < $months; $i++){ - $newarr[] = [$this->comboarr[$comboarr[$idx]], $scheduleDate->format("Y-m-d")]; - $idx ++; - $scheduleDate = $startdate->modify("+1 month"); - if($idx >= count($comboarr)){ - $idx = 0; - } - } - return json_encode($newarr); - } -} \ No newline at end of file + 'BW002', + 'month' => 'EM002', + 'quarter' => 'EQ002', + 'half' => 'HY002', + 'year' => 'EY002' + ]; + private $bwarr = [ + 'week', 'month', 'week', 'month', 'week', 'quarter', + 'week', 'month', 'week', 'month', 'week', 'half', + 'week', 'month', 'week', 'month', 'week', 'quarter', + 'week', 'month', 'week', 'month', 'week', 'year' + ]; + private $emarr = [ + 'month', 'month', 'quarter', 'month', 'month', 'half', + 'month', 'month', 'quarter', 'month', 'month', 'year' + ]; + private $combo; + private $startdate; + private $enddate; + public function __construct($combo, $startdate, $enddate) + { + $this->combo = $combo; + $this->startdate = $startdate; + $this->enddate = $enddate; + } + public function getComboNo() + { + $comboarr = (array) $this->combo === 'bw' ? $this->bwarr : $this->emarr; + + $startdate = new DateTime($this->startdate); + $enddate = new DateTime($this->enddate); + + $interval = date_diff($startdate, $enddate); + + $months = $interval->y * 12 + $interval->m; + $months = $this->combo === 'bw' ? $months * 2 : $months; + + $newarr = []; + $idx = 0; + $ori_first_month = date('m', strtotime($this->startdate)); + $first_day = date('Y-m-d', strtotime($this->startdate . ' + 3 days')); + $new_first_month = date('m', strtotime($first_day)); + if ($ori_first_month != $new_first_month) { + $first_day = date('Y-m-d', strtotime($this->startdate)); + } + $scheduleDate = new DateTime($first_day); + for ($i = 0; $i <= $months; $i++) { + $newarr[] = [$this->comboarr[$comboarr[$idx]], $scheduleDate->format("Y-m-d")]; + $idx++; + $scheduleDate = $scheduleDate->modify("+1 month"); + if ($idx >= count($comboarr)) { + $idx = 0; + } + } + return json_encode($newarr); + } +} diff --git a/wms/contract/api/getContractData.php b/wms/contract/api/getContractData.php index 0f7f89c8..253e8d54 100644 --- a/wms/contract/api/getContractData.php +++ b/wms/contract/api/getContractData.php @@ -1,7 +1,7 @@ -prepare($sql_str); $stmt->bindParam(':vol_no', $contractno); $stmt->execute(); - $contract= $stmt->fetch(PDO::FETCH_ASSOC); + $contract = $stmt->fetch(PDO::FETCH_ASSOC); - if(empty($contract)){ + if (empty($contract)) { echo false; exit; } @@ -21,42 +21,99 @@ if(isset($_GET['contractno']) && $_GET['contractno']!='' && isset($_GET['contrac $stmt = $conn->prepare($sql_str); $stmt->bindParam(':apply_key', $apply_key); $stmt->execute(); - $elevators= $stmt->fetchAll(PDO::FETCH_ASSOC); + $elevators = $stmt->fetchAll(PDO::FETCH_ASSOC); $count = COUNT($elevators); + // foreach ($elevators as $key => $elevator) { + + // $elevator['discount'] = ($elevator['sold_price'] / $elevator['stand_price']) * 100; + // } $contract['elevators'] = $elevators; $contract['num'] = $count; $contractResponse = json_encode($contract); - + // 設定回應標頭為 JSON header('Content-Type: application/json'); - + // 將 JSON 回應返回給客戶端 echo $contractResponse; // echo json_encode($contractResponse); - }catch (PDOException $e ){ - die("ERROR!!!: ". $e->getMessage()); + } catch (PDOException $e) { + die("ERROR!!!: " . $e->getMessage()); } } -if(isset($_GET['contractno']) && $_GET['contractno']!='' && isset($_GET['contracttype']) && $_GET['contracttype']=='m'){ - try{ +if (isset($_GET['contractno']) && $_GET['contractno'] != '' && isset($_GET['contracttype']) && $_GET['contracttype'] == 'm') { + try { $contractno = $_GET['contractno']; - $sql_str = "SELECT * FROM hope_elevator_customer WHERE vol_no = :vol_no ORDER BY created_at DESC"; + $sql_str = "SELECT a.*,b.lm_tel,b.uscc,b.manager,b.linkman FROM pricereview_main AS a + LEFT JOIN hope_elevator_customer AS b ON a.contractno = b.vol_no + WHERE a.contractno = :contractno AND a.status != 'YN' "; $stmt = $conn->prepare($sql_str); - $stmt->bindParam(':vol_no', $contractno); + $stmt->bindParam(':contractno', $contractno); $stmt->execute(); - $contract= $stmt->fetch(PDO::FETCH_ASSOC); + $contract = $stmt->fetch(PDO::FETCH_ASSOC); + + $salesman = $contract['person']; + $sql = "SELECT * FROM account WHERE accountid = :accountid "; + $stmt = $conn->prepare($sql); + $stmt->bindParam(':accountid', $salesman); + $stmt->execute(); + $account_detail = $stmt->fetch(PDO::FETCH_ASSOC); + $contract['manager'] = $account_detail['manager']; + $contract['salesman_departno'] = $account_detail['department_id']; + + + $mid = $contract['id']; + $sql = "SELECT * FROM pricereview_item WHERE mid = :mid AND item_group = 'A' "; + $stmt = $conn->prepare($sql); + $stmt->bindParam(':mid', $mid); + $stmt->execute(); + $results = $stmt->fetchAll(PDO::FETCH_ASSOC); + $elevators_detail_arr = []; + foreach ($results as $keys => $result) { + $note = explode(',', $result['note']); + $result['spec'] = $note[0]; //型號 + $result['person'] = $note[1]; // 人承 + $result['floor'] = $note[2]; // 樓層 + $result['speed'] = $note[3]; // 速度 + for ($i = 0; $i < $result['item_qty']; $i++) { + $result['item_no'] = $i + 1; + array_push($elevators_detail_arr, $result); + } + } + $count = COUNT($elevators_detail_arr); + + $contract['elevators'] = $results; + $contract['elevators_detail_arr'] = $elevators_detail_arr; + $contract['nums'] = $count; + // echo '
';
+        // print_r($contract);
+        // echo '
'; + // exit; $contractResponse = json_encode($contract); - // 設定回應標頭為 JSON header('Content-Type: application/json'); - + // 將 JSON 回應返回給客戶端 echo $contractResponse; - }catch (PDOException $e ){ - die("ERROR!!!: ". $e->getMessage()); + } catch (PDOException $e) { + die("ERROR!!!: " . $e->getMessage()); } } +if (!empty($_GET['contracttype']) && $_GET['contracttype'] == 'accountManger' && !empty($_GET['salesman'])) { + try { + $salesman = $_GET['salesman']; + $sql = "SELECT manager FROM account WHERE accountid = :accountid"; + $stmt = $conn->prepare($sql); + $stmt->bindParam(':accountid', $salesman); + $stmt->execute(); + $result = $stmt->fetch(PDO::FETCH_ASSOC); + header('Content-Type:application/json'); + echo json_encode($result); + } catch (PDOException $e) { + die("ERROR!!!:" . $e->getMessage()); + } +} diff --git a/wms/contract/api/postContractData.php b/wms/contract/api/postContractData.php index 2a9e082c..29038b9f 100644 --- a/wms/contract/api/postContractData.php +++ b/wms/contract/api/postContractData.php @@ -18,7 +18,7 @@ if (isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['c $phone = !empty($_POST['phone']) ? $_POST['phone'] : null; $email = !empty($_POST['email']) ? $_POST['email'] : null; $mworker = !empty($_POST['mworker']) ? $_POST['mworker'] : null; - $mcycle = !empty($_POST['mcycle']) ? $_POST['mcycle'] : null; + // $mcycle = !empty($_POST['mcycle']) ? $_POST['mcycle'] : null; $salesman = !empty($_POST['salesman']) ? $_POST['salesman'] : null; $contract_begin_date = !empty($_POST['contract_begin_date']) ? $_POST['contract_begin_date'] : null; $contract_end_date = !empty($_POST['contract_end_date']) ? $_POST['contract_end_date'] : null; @@ -35,17 +35,53 @@ if (isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['c $files = !empty($_FILES['files']) ? $_FILES['files'] : null; $elevators = !empty($_POST['elevators']) ? json_decode($_POST['elevators'], true) : []; $payType = !empty($_POST['payType']) ? $_POST['payType'] : null; + + $sql = "SELECT * FROM account WHERE accountid = '$salesman'"; + $stmt = $conn->prepare($sql); + $stmt->execute(); + $accountData = $stmt->fetch(PDO::FETCH_ASSOC); + + $depId = $accountData['department_id']; // validate + //create facility table + $createFacilityNo = new CreateFacilityNo(); + $dailyNecessities = [ + 'MAE100' => 'X', + 'MAM200' => 'W', + 'MAH100' => 'H', + 'MAQ100' => 'Z', + 'MAF100' => 'F', + 'MAZ100' => 'B', + ]; + + $maintain_times = [ + '1' => 'em', //月保 + '2' => 'bw' // 雙周保 + ]; + $facility_arr = []; + foreach ($elevators as $elevator) { + $facility_arr[] = $dailyNecessities[$elevator['spec']]; + } + echo json_encode($facility_arr); + // 電梯做番號 + $facilityno = $createFacilityNo->makeBFacilityNo("T", $facility_arr, (int)$num); + // if ($user_id == 'M0225') { + // echo '
';
+        //     print_r($facilityno);
+        //     echo '
'; + // exit(); + // } + echo json_encode($facilityno); + /// 獎金計算 $fail_arr = []; if ($contractno === '') return $fail_arr[] = '合約號為必填'; - if ($total_price == '') $fail_arr[] = '合約總價為必填'; if ($vat == '') $fail_arr[] = '統一編號為必填'; if ($mtype == '') $fail_arr[] = '維修型態為必填'; if ($phone == '') $fail_arr[] = '客戶電話為必填'; - if ($email == '') $fail_arr[] = 'Email為必填'; + // if ($email == '') $fail_arr[] = 'Email為必填'; if ($mworker == '') $fail_arr[] = '保養員為必填'; - if ($mcycle == '') $fail_arr[] = '保養頻率為必填'; + // if ($mcycle == '') $fail_arr[] = '保養頻率為必填'; if ($salesman == '') $fail_arr[] = '營業員為必填'; if ($contract_begin_date == '') $fail_arr[] = '合約開始時間為必填'; if ($contract_end_date == '') $fail_arr[] = '合約結束時間為必填'; @@ -63,7 +99,8 @@ if (isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['c echo json_encode($fail_arr); exit(); } - + T8insert($_POST, $facilityno, $depId); + bonusCreate($_POST, $facilityno, $conn); //create account table $accounttype = "A"; $accountid = $vat; @@ -75,6 +112,8 @@ if (isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['c $create_at = date('Y-m-d H:i:s'); $conn->beginTransaction(); + // bonusCreate($_POST, $facilityno, $conn); + // exit(); $sql_str = "INSERT INTO account (accounttype, accountid, pwd, name, tel, address, email, repairerid, creater, create_at) VALUES (:accounttype, :accountid, :pwd, :name, :tel, :address, :email, :repairerid, :creater, :create_at)"; $stmt = $conn->prepare($sql_str); @@ -127,30 +166,35 @@ if (isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['c $stmt->execute(); //create facility table - $createFacilityNo = new CreateFacilityNo(); - $dailyNecessities = [ - 'MAE100' => 'X', - 'MAM200' => 'W', - 'MAH100' => 'H', - 'MAQ100' => 'Z', - 'MAF100' => 'F', - 'MAZ100' => 'B', - ]; - $facility_arr = []; - foreach ($elevators as $elevator) { - $facility_arr[] = $dailyNecessities[$elevator['spec']]; - } - echo json_encode($facility_arr); - // 電梯做番號 - $facilityno = $createFacilityNo->makeBFacilityNo("T", $facility_arr, (int)$num); - // if ($user_id == 'M0225') { - // echo '
';
-        //     print_r($facilityno);
-        //     echo '
'; - // exit(); + // $createFacilityNo = new CreateFacilityNo(); + // $dailyNecessities = [ + // 'MAE100' => 'X', + // 'MAM200' => 'W', + // 'MAH100' => 'H', + // 'MAQ100' => 'Z', + // 'MAF100' => 'F', + // 'MAZ100' => 'B', + // ]; + + // $maintain_times = [ + // '1' => 'em', //月保 + // '2' => 'bw' // 雙周保 + // ]; + // $facility_arr = []; + // foreach ($elevators as $elevator) { + // $facility_arr[] = $dailyNecessities[$elevator['spec']]; // } - echo json_encode($facilityno); - echo '-------'; + // echo json_encode($facility_arr); + // // 電梯做番號 + // $facilityno = $createFacilityNo->makeBFacilityNo("T", $facility_arr, (int)$num); + // // if ($user_id == 'M0225') { + // // echo '
';
+        // //     print_r($facilityno);
+        // //     echo '
'; + // // exit(); + // // } + // echo json_encode($facilityno); + // echo '-------'; $sql_str = "SELECT accountid, name FROM account WHERE accountid = :accountid"; $stmt = $conn->prepare($sql_str); $stmt->bindParam(':accountid', $mworker); @@ -162,6 +206,12 @@ if (isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['c $repairerid = $mworker; $repairername = $worker['name']; foreach ($elevators as $idx => $elevator) { + // 民國年轉換西元年 + $ROCuseful_date = $elevator['useful_date']; + $click = explode("-", $ROCuseful_date); + $click[0] = intval($click[0]) + 1911; + $ADuseful_date = implode("-", $click); + $sql_str = "INSERT INTO facility (contractno, define, facilityno, latitude, longitude, customerid, weight, numberofpassenger, numberofstop, numberoffloor, opentype, speed, repairtype, maintainance, facility_kind, address, repairerid, repairername, creater, create_at, area, takecertificatedate, licensedate) VALUES (:contractno, :define, :facilityno, :latitude, :longitude, :customerid, :weight, :numberofpassenger, :numberofstop, :numberoffloor, :opentype, :speed, :repairtype, :maintainance, :facility_kind, :address, :repairerid, :repairername, :creater, :create_at, :area, :takecertificatedate, :licensedate)"; $stmt = $conn->prepare($sql_str); @@ -187,15 +237,17 @@ if (isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['c $stmt->bindParam(':create_at', $create_at); $stmt->bindParam(':area', $area); $stmt->bindParam(':takecertificatedate', $elevator['takecertificatedate']); - $stmt->bindParam(':licensedate', $elevator['useful_date']); + $stmt->bindParam(':licensedate', $ADuseful_date); $result = $stmt->execute(); } //create schedule table - $comboNo = new CreateComboNo($mcycle, $contract_begin_date, $contract_end_date); - $comboArr = json_decode($comboNo->getComboNo(), true); + // $comboNo = new CreateComboNo($mcycle, $contract_begin_date, $contract_end_date); + // $comboArr = json_decode($comboNo->getComboNo(), true); foreach ($facilityno as $no) { + $comboNo = new CreateComboNo($maintain_times[$elevator['maintain_times']], $contract_begin_date, $contract_end_date); + $comboArr = json_decode($comboNo->getComboNo(), true); foreach ($comboArr as $combo) { $sql_str = 'INSERT INTO schedule (contractno, facilityno, combono, repairerid, repairername, duedate, creater, create_at) VALUES (:contractno, :facilityno, :combono, :repairerid, :repairername, :duedate, :creater, :create_at)'; $stmt = $conn->prepare($sql_str); @@ -218,7 +270,7 @@ if (isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['c $customer_phone = $phone; $customer_email = $email; $repairman = $mworker; - $cycle = $mcycle; + // $cycle = $mcycle; $contact_person = $partyA; $contact_address = $partyAaddress; $contact_phone = $partyAphone; @@ -285,8 +337,8 @@ if (isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['c } else { $files = null; } - $sql_str = "INSERT INTO contract_b_signed_back (contract_no, contract_type, company, customer_no, salesperson, contract_start_date, contract_end_date, total_price,payType, customer_phone, customer_email, repairman, cycle, contact_person, contact_address, contact_phone, contact_email, elevators_number, area, address, files_id, bonus, max_bonus, created_at, created_by) - VALUES (:contract_no, :contract_type, :company, :customer_no, :salesperson, :contract_start_date, :contract_end_date, :total_price, :payType ,:customer_phone, :customer_email, :repairman, :cycle, :contact_person, :contact_address, :contact_phone, :contact_email, :elevators_number, :area, :address, :files_id, :bonus, :max_bonus, :created_at, :created_by)"; + $sql_str = "INSERT INTO contract_b_signed_back (contract_no, contract_type, company, customer_no, salesperson, contract_start_date, contract_end_date, total_price,payType, customer_phone, customer_email, repairman, contact_person, contact_address, contact_phone, contact_email, elevators_number, area, address, files_id, bonus, max_bonus, created_at, created_by) + VALUES (:contract_no, :contract_type, :company, :customer_no, :salesperson, :contract_start_date, :contract_end_date, :total_price, :payType ,:customer_phone, :customer_email, :repairman, :contact_person, :contact_address, :contact_phone, :contact_email, :elevators_number, :area, :address, :files_id, :bonus, :max_bonus, :created_at, :created_by)"; $stmt = $conn->prepare($sql_str); $stmt->bindParam(":contract_no", $contractno); $stmt->bindParam(":contract_type", $contract_type); @@ -299,7 +351,7 @@ if (isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['c $stmt->bindParam(":customer_phone", $customer_phone); $stmt->bindParam(":customer_email", $customer_email); $stmt->bindParam(":repairman", $repairman); - $stmt->bindParam(":cycle", $cycle); + // $stmt->bindParam(":cycle", $cycle); // 保養頻率在做番上,這邊不 insert。 $stmt->bindParam(":contact_person", $contact_person); $stmt->bindParam(":contact_address", $contact_address); $stmt->bindParam(":contact_phone", $contact_phone); @@ -316,20 +368,9 @@ if (isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['c $stmt->execute(); - // $date = date('Y-m-sH-s-i'); - // $createTime = str_replace("-", '', $date); - // $sql = "INSERT INTO comCustomer(BizPartnerId,PersonId,CreatorId,IsInUsed,InvoiceAddress,CreateTime)VALUES(:BizPartnerId,:PersonId,:CreatorId,1,:InvoiceAddress,:CreateTime)"; - // $stmt = $connT8->prepare($sql); - // $stmt->bindParam(':BizPartnerId', $contractno); - // $stmt->bindParam(':PersonId', $salesman); - // $stmt->bindParam(':CreatorId', $user_id); - // $stmt->bindParam(':InvoiceAddress', $address); - // $stmt->bindParam(':CreateTime', $createTime); - - // $stmt->execute(); - T8insert($_POST, $facilityno); + // T8insert($_POST, $facilityno); - header('Content-Type: application/json'); + // header('Content-Type: application/json'); $jsonData = json_encode($files); $conn->commit(); @@ -341,7 +382,7 @@ if (isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['c } }; -function T8insert($data, $facilityno) +function T8insert($data, $facilityno, $depId) { require_once("../connt8.php"); // 引入 T8 API 連線 @@ -362,7 +403,6 @@ function T8insert($data, $facilityno) $elevators = !empty($data['elevators']) ? json_decode($data['elevators'], true) : []; //電梯 $area = !empty($data['area']) ? $data['area'] : null; //縣市 Ex. A->台北 , B-> ..。 $payType = !empty($data['payType']) ? $data['payType'] : null; - $user_id = !empty($_POST['user_id']) ? $_POST['user_id'] : null; @@ -372,9 +412,9 @@ function T8insert($data, $facilityno) $stmt = $conn->prepare($sql); $stmt->bindParam(':BizPartnerId', $contractno); $stmt->execute(); - $result = $stmt->fetchAll(PDO::FETCH_ASSOC); - $date = date('Y-m-sH-s-i'); - $date_1 = date('Y-m-s'); + $result = $stmt->fetch(PDO::FETCH_ASSOC); + $date = date('Y-m-dH-s-i'); + $date_1 = date('Y-m-d'); $createTime = str_replace("-", '', $date); $insertTime = str_replace('-', '', $date_1); $beginDate = str_replace("-", '', $contract_begin_date); @@ -493,12 +533,12 @@ function T8insert($data, $facilityno) // echo '
';
         // print_r($elevator);
         // echo '
'; - + $facility_no = $facilityno[$index]; $sql = "INSERT INTO comMaterial (FOrgid,MaterialId,MaterialTypeId,MaterialCategoryId,CreatorId,CreateTime) VALUES ('1000',:MaterialId,'10','E',:CreatorId,:CreateTime)"; $stmt = $connT8->prepare($sql); - $stmt->bindParam(':MaterialId', $facilityno[$index]); + $stmt->bindParam(':MaterialId', $facility_no); $stmt->bindParam(':CreatorId', $user_id); $stmt->bindParam(':CreateTime', $createTime); $stmt->execute(); @@ -507,7 +547,7 @@ function T8insert($data, $facilityno) (MaterialTypeId,MaterialId,MaterialName,MaterialCategoryId,IsInUsed,UnitId,CreatorId,CreateTime) VALUES ('10',:MaterialId,:MaterialName,'E',1,'SET',:CreatorId,:CreateTime)"; $stmt = $connT8->prepare($sql); - $stmt->bindParam(':MaterialId', $facilityno[$index]); + $stmt->bindParam(':MaterialId', $facility_no); $stmt->bindParam(':MaterialName', $customer); $stmt->bindParam(':CreatorId', $user_id); $stmt->bindParam(':CreateTime', $createTime); @@ -517,7 +557,7 @@ function T8insert($data, $facilityno) (Orgid,MaterialTypeId,MaterialId,CurrId,SUnitId,TaxId,CreatorId,CreateTime) VALUES ('1000','10',:MaterialId,'TWD','SET','ST005',:CreatorId,:CreateTime)"; $stmt = $connT8->prepare($sql); - $stmt->bindParam(':MaterialId', $facilityno[$index]); + $stmt->bindParam(':MaterialId', $facility_no); $stmt->bindParam(':CreatorId', $user_id); $stmt->bindParam(':CreateTime', $createTime); $stmt->execute(); @@ -533,6 +573,9 @@ function T8insert($data, $facilityno) //分幾期 => 總共保養月 / 分期月 $SQuantity = $elevator['maintain_months'] / $IncomeId[$payType]; + $date_1 = getNext25thDate($contract_begin_date); + + // 依每台電梯去加入各個的付款項 for ($i = 0; $i < $IncomeId[$payType]; $i++) { $row++; @@ -547,14 +590,16 @@ function T8insert($data, $facilityno) "RowCode" => $row, "RowNo" => $row, "ItemType" => 1, - "SPrice" => $elevator['sold_price'], + "SPrice" => intval($elevator['sold_price']), "SQuantity" => $SQuantity, "ProjectId" => "$contractno", - "FromSourceTag" => 0, - "CU_MaterialId" => "$facilityno[$index]", - "CU_EstPayDate" => "$payDay" + "CU_MaterialId" => "$facility_no", + "CU_EstPayDate" => intval($payDay) ]; $salIncomeApplyDetail_rows[] = $rows_data; + // echo '
';
+            // print_r($salIncomeApplyDetail_rows);
+            // echo '
'; } } @@ -564,7 +609,7 @@ function T8insert($data, $facilityno) // $insertime = settype($insertTime, 'integer'); $salIncomeApplyMaster_rows = [ "BillNo" => "$contractno", - "BillDate" => $insertTime, + "BillDate" => intval($insertTime), "OrgId" => "1000", "FOrgId" => "1000", "TypeId" => "RAS", @@ -578,7 +623,10 @@ function T8insert($data, $facilityno) "DueToId" => "$contractno", "TaxId" => "ST005", "CompId" => "1001", - "CreatorId" => "$user_id" + "CreatorId" => "$user_id", + "CreateTime" => intval($insertTime), + "DeptId" => "$depId", + "IsPriceWithTax" => 1 ]; $salIncomeApplyMaster = [ @@ -593,6 +641,9 @@ function T8insert($data, $facilityno) $API_body[] = $salIncomeApplyMaster; $API_body[] = $salIncomeApplyDetail; // 呼叫 API + // echo '
';
+    // print_r($API_body);
+    // echo '
'; $result = T8API($API_body); if ($result['Status'] == 'Error' || $result['Status'] == 'Fails') { @@ -601,3 +652,102 @@ function T8insert($data, $facilityno) die('Error!:' . $result['ErrorMsg']); } } + + +function bonusCreate($data, $facilityno, $conn) +{ + try { + require_once("../../bonus/other/maintenance_contract_bonus_v2_1.php"); + $elevators = !empty($_POST['elevators']) ? json_decode($_POST['elevators'], true) : []; + $contract_begin_date = !empty($data['contract_begin_date']) ? $data['contract_begin_date'] : ''; + $salesman = !empty($data['salesman']) ? $data['salesman'] : ''; + $payType = !empty($data['payType']) ? $data['payType'] : ''; + $status = 1; + $bonus_json = []; + $create_id = $data['user_id']; + $create_at = date('Y-m-d'); + $contract_no = !empty($data['contractno']) ? $data['contractno'] : ''; + $contract_kind = 3; + + $payment = [ + 'A40006' => 'annually', //年繳 + 'A40007' => 'quarterly', //季繳 + 'A40004' => 'bimonthly', // 雙月繳 + 'A40005' => 'semiannually', // 半年繳 + 'A40003' => 'monthly' //月繳 + ]; + + $payDay = getNext25thDate($contract_begin_date); + foreach ($elevators as $key => $elevator) { + // print_r($payDay); + // echo '
';
+            // print_r($elevator);
+            // echo '
'; + // exit; + $facility_no = $facilityno[$key]; + $ver = $elevator['bonus_verson']; //獎金版本 + $contract_type = $elevator['contract_type']; //合約類別 + $payment_period = $payment[$payType]; //付款方式 + $elevator_list_price = intval($elevator['stand_price']); //牌價 + $fee_per_st = $elevator['contract_price']; //作翻契約金額 + $commission_fee = $elevator['service_expense']; //服務費(月) + $receivable_date_due = $payDay; //第一筆保養款項收回日 + $sales_id = $salesman; //營業人員 + $discount = $elevator['discount']; + $region_director_id = $elevator['manager']; + $regular_contract_manger_id = !empty($elevator['regular_contract_manger_id']) ? $elevator['regular_contract_manger_id'] : ''; + $results = maintenance_contract_bonus_v2_1($ver, $contract_type, $payment_period, $elevator_list_price, $fee_per_st, $commission_fee, $receivable_date_due, $sales_id, $region_director_id, $regular_contract_manger_id); + + $bonus_json = [ + 'contract_type' => $contract_type, + 'total' => $elevator_list_price, + 'fee_per_st' => $fee_per_st, + 'commission_fee' => $commission_fee, + 'paykind' => $payment_period, + 'receivable_date_due' => $receivable_date_due, + 'discount' => $discount + ]; + if ($results['result_status'] != 'error') { + foreach ($results['bonus_array'] as $i => $result) { + + $bonus_type = $result['bonus_type']; + $pay_day = $result['pay_day_due']; + $amount = $result['bonus_amount']; + $receiver = $result['bonus_receiver']; + $a = json_encode($bonus_json); + $sql = "INSERT INTO bonus + (bonus_type,bonus_verson,contract_no,contract_type,facility_no,amount,receiver,pay_day_due,status,bonus_json,create_id,create_at) VALUES + ($bonus_type,'$ver','$contract_no',$contract_kind,'$facility_no',$amount,'$receiver','$pay_day',$status,'$a','$create_id','$create_at')"; + $stmt = $conn->prepare($sql); + $stmt->execute(); + } + } + } + // exit(); + } catch (PDOException $e) { + http_response_code(404); + echo $e->getMessage(); + die('Error!:' . $e->getMessage()); + } +} + +// 計算保養開始日期的當月25號 +function getNext25thDate($dateString) +{ + // 將傳入的日期字串轉換成 Unix 時間戳記 + $timestamp = strtotime($dateString); + + // 取得該日期的日期 + $day = date('d', $timestamp); + + // 如果日期大於 25,則回傳下個月的 25 號日期 + if ($day > 25) { + // 增加一個月 + $timestamp = strtotime('+1 month', $timestamp); + } + + // 設定日期為 25 號 + $targetDate = date('Y-m-25', $timestamp); + + return $targetDate; +} diff --git a/wms/contract/api/postNewContractData.php b/wms/contract/api/postNewContractData.php index 001fe1f5..d94dac12 100644 --- a/wms/contract/api/postNewContractData.php +++ b/wms/contract/api/postNewContractData.php @@ -1,139 +1,325 @@ - 0) { - header("HTTP/1.1 422 Unprocessable Entity"); - echo json_encode($fail_arr); - exit(); - } - - - $conn->beginTransaction(); - - $sql_str = "SELECT accountid, name FROM account WHERE accountid = :accountid ORDER BY create_at DESC"; - $stmt = $conn -> prepare($sql_str); - $stmt -> bindParam(":accountid",$salesman); - $stmt -> execute(); - $saleman = $stmt->fetch(PDO::FETCH_ASSOC); - $salesman_name = $saleman['name']; - if(!empty($files)){ - $englisharr = range('a', 'z'); - $files = $_FILES['files']; - $newfiles = []; - foreach( $files as $file ){ - $i = 0; //新陣列的索引編號 - foreach( $file as $key => $val ){ - $newfiles[$i]['name'] = $files['name'][$key]; - $newfiles[$i]['type'] = $files['type'][$key]; - $newfiles[$i]['tmp_name'] = $files['tmp_name'][$key]; - $newfiles[$i]['error'] = $files['error'][$key]; - $newfiles[$i]['size'] = $files['size'][$key]; - $i++; - } //foreach 第2層 end - } - $max_size = 4096*4096; //設定允許上傳檔案容量的最大值(1M) - $allow_ext = array('jpeg', 'jpg', 'png','JPG','JPEG','PNG','GIF'); //設定允許上傳檔案的類型 - $path = '../images/contracts/'; - if (!file_exists($path)) { mkdir($path); } - $msg_result = ''; //負責接收所有檔案檢測後的回傳訊息 - $datetime = (string)date('YmdHis'); - $files_id = 'm' . $datetime; // 保養=>b + 日期時間 - foreach( $newfiles as $key => $file ){ - $randNum = rand(1000,9999); - $randEnglish = $englisharr[rand(0,25)]; - $file_name = 'm' . (string)date('YmdHis') . $randNum . $randEnglish . $randNum.$file['name']; - $msg = upload_chk( $file,$path, $max_size, $allow_ext, $file_name ); - if($msg==1){ - $msg = '檔案傳送成功!'; - $sql_str = "INSERT INTO contract_back_files (files_id, file_name, file_mime, file_size, created_at, created_by) VALUES (:files_id, :file_name, :file_mime, :file_size, :created_at, :created_by)"; - $stmt = $conn -> prepare($sql_str); - $stmt -> bindParam(':files_id' ,$files_id); - $stmt -> bindParam(':file_name' ,$file_name); - $stmt -> bindParam(':file_mime' ,$file['type']); - $stmt -> bindParam(':file_size' ,$file['size']); - $stmt -> bindParam(':created_at' ,$created_at); - $stmt -> bindParam(':created_by' ,$created_by); - $stmt ->execute(); - }else{ - throw new PDOException('檔案上傳失敗:' . $msg); - } - $msg_result .= '第' . ($key+1) . '個上傳檔案的結果:' . $msg . '
'; - $src_name = $path.$file['name']; - if( file_exists($src_name) ){ - //副檔名 - $extname = pathinfo($src_name, PATHINFO_EXTENSION); - //主檔名 - $basename = basename($src_name, '.'.$extname); - } - } - }else{ - $files = null; - } - - $sql_str = "INSERT INTO contract_m_signed_back (contract_no, customer, manager, vat, case_name, linkman, lm_tel, address, salesman, salesman_name, files_id, created_at, created_by, qc_official_type) VALUES (:contract_no, :customer, :manager, :vat, :case_name, :linkman, :lm_tel, :address, :salesman, :salesman_name, :files_id, :created_at, :created_by, :qc)"; - $stmt = $conn -> prepare($sql_str); - $stmt -> bindParam(":contract_no",$contractno); - $stmt -> bindParam(":customer",$customer); - $stmt -> bindParam(":manager",$manager); - $stmt -> bindParam(":vat",$vat); - $stmt -> bindParam(":case_name",$case_name); - $stmt -> bindParam(":linkman",$linkman); - $stmt -> bindParam(":lm_tel",$lm_tel); - $stmt -> bindParam(":address",$address); - $stmt -> bindParam(":salesman",$salesman); - $stmt -> bindParam(":salesman_name",$salesman_name); - $stmt -> bindParam(":files_id",$files_id); - $stmt -> bindParam(":created_at",$created_at); - $stmt -> bindParam(":created_by",$created_by); - $stmt -> bindParam(":qc",$qc); - $stmt -> execute(); - - - $result = $conn->commit(); - if($result){ - header("HTTP/1.1 201 Created"); - } - - }catch(PDOException $e){ - $conn->rollback(); - header("HTTP/1.1 500 Internal Server Error"); - die('Error!:'.$e->getMessage()); - } - } \ No newline at end of file +'; + // print_r($elevators); + // echo ''; + // exit; + $files = !empty($_FILES['files']) ? $_FILES['files'] : null; + $files_id = null; + + $fail_arr = []; + if (empty($contractno)) $fail_arr[] = '合約號為必填'; + if (empty($customer)) $fail_arr[] = '客戶名稱為必填'; + if (empty($manager)) $fail_arr[] = '負責人為必填'; + if (empty($vat)) $fail_arr[] = '統編/身分證為必填'; + if (empty($case_name)) $fail_arr[] = '案名為必填'; + if (empty($linkman)) $fail_arr[] = '聯絡人為必填'; + if (empty($lm_tel)) $fail_arr[] = '聯絡人電話為必填'; + if (empty($address)) $fail_arr[] = '地址為必填'; + if (empty($salesman)) $fail_arr[] = '營業員為必填'; + if (empty($qc)) $fail_arr[] = '請選擇QC或官檢'; + if (count($fail_arr) > 0) { + header("HTTP/1.1 422 Unprocessable Entity"); + echo json_encode($fail_arr); + exit(); + } + //create facility table + $createFacilityNo = new CreateFacilityNo(); + $dailyNecessities = [ + 'MAE100' => 'X', + 'MAM200' => 'W', + 'MAH100' => 'H', + 'MAQ100' => 'Z', + 'MAF100' => 'F', + 'MAZ100' => 'B', + ]; + $arr = []; + // 建立作番號 + foreach ($elevators_detail_arr as $elevator) { + // $spec = explode('-', $elevator['item_spec']); + $arr[] = $dailyNecessities[$elevator['spec']]; + } + $facilityno = $createFacilityNo->makeMFacilityNo('M', $arr, intval($elevators_nums)); + echo '
';
+    print_r($facilityno);
+    echo '
'; + exit(); + $conn->beginTransaction(); + + $sql_str = "SELECT accountid, name FROM account WHERE accountid = :accountid ORDER BY create_at DESC"; + $stmt = $conn->prepare($sql_str); + $stmt->bindParam(":accountid", $salesman); + $stmt->execute(); + $saleman = $stmt->fetch(PDO::FETCH_ASSOC); + $salesman_name = $saleman['name']; + if (!empty($files)) { + $englisharr = range('a', 'z'); + $files = $_FILES['files']; + $newfiles = []; + foreach ($files as $file) { + $i = 0; //新陣列的索引編號 + foreach ($file as $key => $val) { + $newfiles[$i]['name'] = $files['name'][$key]; + $newfiles[$i]['type'] = $files['type'][$key]; + $newfiles[$i]['tmp_name'] = $files['tmp_name'][$key]; + $newfiles[$i]['error'] = $files['error'][$key]; + $newfiles[$i]['size'] = $files['size'][$key]; + $i++; + } //foreach 第2層 end + } + $max_size = 4096 * 4096; //設定允許上傳檔案容量的最大值(1M) + $allow_ext = array('jpeg', 'jpg', 'png', 'JPG', 'JPEG', 'PNG', 'GIF'); //設定允許上傳檔案的類型 + $path = '../images/contracts/'; + if (!file_exists($path)) { + mkdir($path); + } + $msg_result = ''; //負責接收所有檔案檢測後的回傳訊息 + $datetime = (string)date('YmdHis'); + $files_id = 'm' . $datetime; // 保養=>b + 日期時間 + foreach ($newfiles as $key => $file) { + $randNum = rand(1000, 9999); + $randEnglish = $englisharr[rand(0, 25)]; + $file_name = 'm' . (string)date('YmdHis') . $randNum . $randEnglish . $randNum . $file['name']; + $msg = upload_chk($file, $path, $max_size, $allow_ext, $file_name); + if ($msg == 1) { + $msg = '檔案傳送成功!'; + $sql_str = "INSERT INTO contract_back_files (files_id, file_name, file_mime, file_size, created_at, created_by) VALUES (:files_id, :file_name, :file_mime, :file_size, :created_at, :created_by)"; + $stmt = $conn->prepare($sql_str); + $stmt->bindParam(':files_id', $files_id); + $stmt->bindParam(':file_name', $file_name); + $stmt->bindParam(':file_mime', $file['type']); + $stmt->bindParam(':file_size', $file['size']); + $stmt->bindParam(':created_at', $created_at); + $stmt->bindParam(':created_by', $created_by); + $stmt->execute(); + } else { + throw new PDOException('檔案上傳失敗:' . $msg); + } + $msg_result .= '第' . ($key + 1) . '個上傳檔案的結果:' . $msg . '
'; + $src_name = $path . $file['name']; + if (file_exists($src_name)) { + //副檔名 + $extname = pathinfo($src_name, PATHINFO_EXTENSION); + //主檔名 + $basename = basename($src_name, '.' . $extname); + } + } + } else { + $files = null; + } + + $sql_str = "INSERT INTO contract_m_signed_back (contract_no, customer, manager, vat, case_name, linkman, lm_tel, address, salesman, salesman_name, files_id, created_at, created_by, qc_official_type) VALUES (:contract_no, :customer, :manager, :vat, :case_name, :linkman, :lm_tel, :address, :salesman, :salesman_name, :files_id, :created_at, :created_by, :qc)"; + $stmt = $conn->prepare($sql_str); + $stmt->bindParam(":contract_no", $contractno); + $stmt->bindParam(":customer", $customer); + $stmt->bindParam(":manager", $manager); + $stmt->bindParam(":vat", $vat); + $stmt->bindParam(":case_name", $case_name); + $stmt->bindParam(":linkman", $linkman); + $stmt->bindParam(":lm_tel", $lm_tel); + $stmt->bindParam(":address", $address); + $stmt->bindParam(":salesman", $salesman); + $stmt->bindParam(":salesman_name", $salesman_name); + $stmt->bindParam(":files_id", $files_id); + $stmt->bindParam(":created_at", $created_at); + $stmt->bindParam(":created_by", $created_by); + $stmt->bindParam(":qc", $qc); + $stmt->execute(); + + + $result = $conn->commit(); + if ($result) { + header("HTTP/1.1 201 Created"); + } + } catch (PDOException $e) { + $conn->rollback(); + header("HTTP/1.1 500 Internal Server Error"); + die('Error!:' . $e->getMessage()); + } +} + +function T8Insert($data) +{ + require_once("../connt8.php"); + + $contractno = $data['contractno']; + $partyA = $data['customer']; + $phone = $data['lm_tel']; + $vat = $data['vat']; + $partyAaddress = $data['address']; + $user_id = $data['user_id']; + $salesman = $data['salesman']; + $createAt = date("Y-m-dH-i-s"); + $elevators[] = $data['elevators']; + $createTime = str_replace('-', '', $createAt); + + + $connT8->beginTransaction(); + + $sql = "SELECT * FROM comCustomer WHERE BizPartnerId = :BizPartnerId"; + $stmt = $conn->prepare($sql); + $stmt->bindParam(':BizPartnerId', $contractno); + $stmt->execute(); + $result = $stmt->fetch(PDO::FETCH_ASSOC); + // 新增客戶 table + if (empty($result)) { + // 若 客戶資料為空,新增一筆到 comCustomer + // 新增客戶資料 + $sql = "INSERT INTO comBusinessPartner + (BizPartnerId,BizPartnerName,BusinessAttr,CountryId,WorkTelNo,BizToDate,TaxNo,EnterpriseName,ContactAddress,EMail,CreatorId,CreateTime,BizPartnerTypeId) + VALUES(:BizPartnerId,:BizPartnerName,1,'TW',:WorkTelNo,99999999,:TaxNo,:EnterpriseName,:ContactAddress,:EMail,:CreatorId,:CreateTime,'10')"; + $stmt = $connT8->prepare($sql); + $stmt->bindParam(':BizPartnerId', $contractno); + $stmt->bindParam(':BizPartnerName', $partyA); //客戶名稱 + $stmt->bindParam(':WorkTelNo', $phone); + $stmt->bindParam(':TaxNo', $vat); + // $stmt->bindParam(':EnterpriseName', $customer); //企業名稱 + $stmt->bindParam(':ContactAddress', $partyAaddress); + $stmt->bindParam(':EMail', $email); + $stmt->bindParam(':CreatorId', $user_id); + $stmt->bindParam(':CreateTime', $createTime); + + $stmt->execute(); + + $sql = "INSERT INTO comCustomer + (OrgId,BizPartnerTypeId,CurrId,BizPartnerId,PersonId,CreatorId,IsInUsed,InvoiceAddress,CreateTime,InvoiceId) + VALUES('1000','10','TWD',:BizPartnerId,:PersonId,:CreatorId,1,:InvoiceAddress,:CreateTime,'35')"; + $stmt = $connT8->prepare($sql); + + $stmt->bindParam(':BizPartnerId', $contractno); + $stmt->bindParam(':PersonId', $salesman); + $stmt->bindParam(':CreatorId', $user_id); + $stmt->bindParam(':InvoiceAddress', $address); + $stmt->bindParam(':CreateTime', $createTime); + + $stmt->execute(); + } else { + // // 若客戶資料不為空,更新該客戶資訊。 + $sql = "UPDATE comCustomer SET + PersonId=:PersonId, + InvoiceAddress=:InvoiceAddress, + LastOperatorId=:LastOperatorId, + LastOperateTime=:LastOperateTime + WHERE BizPartnerId=:BizPartnerId + "; + $stmt = $connT8->prepare($sql); + $stmt->bindParam(':PersonId', $salesman); + $stmt->bindParam(':InvoiceAddress', $address); + $stmt->bindParam(':LastOperatorId', $user_id); + $stmt->bindParam(':LastOperateTime', $createTime); + $stmt->bindParam(':BizPartnerId', $contractno); + $stmt->execute(); + + + $sql = "UPDATE comBusinessPartner SET + BizPartnerName=:BizPartnerName, + WorkTelNo=:WorkTelNo, + TaxNo=:TaxNo, + EnterpriseName=:EnterpriseName, + ContactAddress=:ContactAddress, + EMail=:EMail, + LastOperatorId=:LastOperatorId, + LastOperateTime=:LastOperateTime + WHERE BizPartnerId = :BizPartnerId + "; + $stmt = $connT8->prepare($sql); + $stmt->bindParam(':BizPartnerName', $partyA); + $stmt->bindParam(':WorkTelNo', $phone); + $stmt->bindParam(':TaxNo', $vat); + $stmt->bindParam(':EnterpriseName', $customer); + $stmt->bindParam(':ContactAddress', $partyAaddress); + $stmt->bindParam(':EMail', $email); + $stmt->bindParam(':LastOperatorId', $user_id); + $stmt->bindParam(':LastOperateTime', $createTime); + $stmt->bindParam(':BizPartnerId', $contractno); + $stmt->execute(); + } + + $sql = "SELECT * FROM comProject WHERE ProjectId = :ProjectId"; + $stmt = $connT8->prepare($sql); + $stmt->bindParam(':ProjectId', $contractno); + $stmt->execute(); + $resultProject = $stmt->fetchAll(PDO::FETCH_ASSOC); + if (empty($resultProject)) { + //新增於 comProject。合約 table + $sql = "INSERT INTO comProject(ProjectId,ProjectName,TypeId,CreateTime,CreatorId,IsInUsed) + VALUES(:ProjectId,:ProjectName,'C0',:CreateTime,:CreatorId,1)"; + $stmt = $connT8->prepare($sql); + $stmt->bindParam(':ProjectId', $contractno); + $stmt->bindParam(':ProjectName', $customer); + $stmt->bindParam(':CreateTime', $createTime); + $stmt->bindParam(':CreatorId', $user_id); + $stmt->execute(); + } +} + + +function BounsCount($data, $conn) +{ + // echo '
';
+  // print_r($data);
+  // echo '
'; + // exit; + require_once("../../bonus/elevator_new/elevator_new_deal_bonus.php"); + $signing_date = $data['signing_date']; + $bonus_v1_0_date = '2024-01-02'; + $bonus_v2_0_date = '2024-01-03'; + $contractType = [ + '1' => 'strategy_customer', + '2' => 'general_customer' + ]; + $contract_type = $data['contract_type']; + + $type = $contractType[$contract_type]; //戰略客戶 or 一般客戶 + $elevator_knockdown_price = $data['price_total']; //受價總額 + + $salesman = $data['salesman']; + $manager = $data['manager']; + + $result_bonus = []; + if ($signing_date <= $bonus_v1_0_date) { + $ver = '1.0'; + $result_bonus = elevator_new_deal_bonus_v1_0($ver, $type, $elevator_knockdown_price, $salesman, $manager); + } else if ($signing_date >= $bonus_v2_0_date) { + $ver = '2.0'; + // $result_bonus = elevator_new_deal_bonus_v2_0($ver,$contract_type,); + } + + echo '
';
+  print_r($result_bonus);
+  echo '
'; + exit(); + try { + } catch (PDOException $e) { + header("HTTP/1.1 500 Internal Server Error"); + die('Error!:' . $e->getMessage()); + } +} diff --git a/wms/contract/api/testT8API.php b/wms/contract/api/testT8API.php index 59730e98..9512cbc8 100644 --- a/wms/contract/api/testT8API.php +++ b/wms/contract/api/testT8API.php @@ -1,21 +1,36 @@ '; -// print_r($countDay); -// echo ''; -// exit(); -$SQuantity = 2; -// $b = 24 / $a; -for ($i = 0; $i < 12; $i++) { - $paymonth = $i * $SQuantity; - $countDay = date('Y-m-d', strtotime("$date + $paymonth months")); - $payDay = str_replace('-', '', $countDay); - echo '
';
-    print_r($payDay);
-    echo '
'; -} +?> + + + 地址轉經緯度 + + + + +

輸入地址以獲取經緯度

+
+ + +
+
+ + + \ No newline at end of file diff --git a/wms/contract/conn.php b/wms/contract/conn.php index a795b27c..ed80762b 100644 --- a/wms/contract/conn.php +++ b/wms/contract/conn.php @@ -34,7 +34,7 @@ try { //設定主動以警告的形式報錯 $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); - $connT8 = new PDO("sqlsrv:Server=220.130.203.251;Database=T8masada", "M0225", "IFFBU1E="); + $connT8 = new PDO("sqlsrv:Server=220.130.203.251;Database=T8TEST", "M0225", "IFFBU1E="); if ($connT8) { $connT8->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); } diff --git a/wms/contract/contract-input.php b/wms/contract/contract-input.php index d3fdeacd..114cea2f 100644 --- a/wms/contract/contract-input.php +++ b/wms/contract/contract-input.php @@ -136,7 +136,7 @@ $contractpersons = $stmt->fetchAll(PDO::FETCH_ASSOC);

未填寫

- 保養頻率 + + 分期方式 + + +

未填寫

@@ -184,21 +196,13 @@ $contractpersons = $stmt->fetchAll(PDO::FETCH_ASSOC);

未填寫

- 分期方式 + 附件 - -

未填寫

+ - + + + - - - + - diff --git a/wms/crm/crmm04-edit.php b/wms/crm/crmm04-edit.php index 13e20ab7..98f2ff96 100644 --- a/wms/crm/crmm04-edit.php +++ b/wms/crm/crmm04-edit.php @@ -98,7 +98,7 @@ $hope_project_elevator_spec_columm = [ //'weight' => ['label' => "載重(KG)", "tag" => 'number', 'attr' => ['name' => 'weight[]', 'gt=0', 'min=0', 'required', 'class' => 'form-control form-control-sm']], 'stop' => ['label' => "停數", "tag" => 'number', 'attr' => ['name' => 'stop[]', 'min=0', 'class' => 'form-control form-control-sm']], 'open' => ['label' => "開門方式", "tag" => 'select', 'attr' => ['colspan' => 2, 'name' => 'open[]', 'class' => 'form-control form-control-sm'], 'options' => $open_kind_opt], - 'speed' => ['label' => "速度(m/min)", "tag" => 'select', 'attr' => ['name' => 'speed[]', 'class' => 'form-control form-control-sm'],'options' => $speed_opt], + 'speed' => ['label' => "速度(m/min)", "tag" => 'select', 'attr' => ['name' => 'speed[]', 'class' => 'form-control form-control-sm'], 'options' => $speed_opt], 'spec_num' => ['label' => "數量", "tag" => 'digits', 'attr' => ['name' => 'spec_num[]', 'min=0', 'class' => 'form-control form-control-sm']], 'spec_price' => ['label' => "單價", "tag" => 'number', 'attr' => ['name' => 'spec_price[]', 'min=0', 'class' => 'form-control form-control-sm']], @@ -204,14 +204,14 @@ function base_url($url) "indent | alignleft center alignright justify | undo redo | " }); - $('#cmecTbody').on('click', 'input[name^=spec_num]', function(){ - $(this).unbind().keyup(function(){ + $('#cmecTbody').on('click', 'input[name^=spec_num]', function() { + $(this).unbind().keyup(function() { $(this).val($(this).val().replace(/\D/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",")); sumNum(); }); }); - $('#is_renovation').change(function(){ + $('#is_renovation').change(function() { console.log($(this).val()); }); @@ -220,8 +220,8 @@ function base_url($url) }); sumNum = function() { var numAll = 0; - $("input[name^=spec_num]").each(function(){ - numAll += Number($(this).val().replace(/[,]+/g,"")); + $("input[name^=spec_num]").each(function() { + numAll += Number($(this).val().replace(/[,]+/g, "")); }); $('#num').val(numAll); } @@ -295,7 +295,7 @@ function base_url($url) } selectHpeoRow = function(obj) { - var id = $(obj).parent().parent().find('td:nth-child(1)>div').text(); + var id = $(obj).parent().parent().find('td:nth-child(1)>div').text(); var spec = $(obj).parent().parent().find('td:nth-child(2)>div').text(); var memo = $(obj).parent().parent().find('td:nth-child(3)>div').text(); var optional = $(obj).parent().parent().find('td:nth-child(4)>div').text(); @@ -307,13 +307,13 @@ function base_url($url) //').last() var tr = $('#hpeoTbody tr').last(); $(tr).children('td').each(function(i) { - $(this).find("input[name^='id']").val(id.trim()); + $(this).find("input[name^='id']").val(id.trim()); $(this).find("input[name^='spec']").val(spec.trim()); $(this).find("input[name^='memo']").val(memo.trim()); $(this).find("input[name^='optional']").val(optional.trim()); $(this).find("input[name^='unit']").val(unit.trim()); $(this).find("input[name^='price']").val(price.trim()); - + }); } @@ -333,7 +333,7 @@ function base_url($url)
-

有望客戶()訂正

+

有望客戶()訂正

@@ -381,7 +381,7 @@ function base_url($url)
-
+ +
diff --git a/wms/fun_global.php b/wms/fun_global.php index 72622a54..44c197dd 100644 --- a/wms/fun_global.php +++ b/wms/fun_global.php @@ -14,7 +14,7 @@ function sql_myself($user_id, $column = "creater") global $link; $follower_arr = []; // 下屬列表 - if($user_id == 'M0105'){ + if ($user_id == 'M0105') { $user_id = "M0137"; } $sql_cmd = "where ($column = '$user_id'"; diff --git a/wms/mkt/assets/js/pricereviewAlpine.js b/wms/mkt/assets/js/pricereviewAlpine.js index c839c4b5..892fb1fb 100644 --- a/wms/mkt/assets/js/pricereviewAlpine.js +++ b/wms/mkt/assets/js/pricereviewAlpine.js @@ -1,22 +1,22 @@ -const pricereviewCreate = ()=>{ +const pricereviewCreate = () => { return { - init(){ + init() { this.elevators = elevators; console.log(this.elevators); console.log(this.total_spec); }, - - openFn:{ - 4:'2U', - 5:"4PCO", - 7:"6PCO", - 8:"2S", - 9:"CO" + + openFn: { + 4: '2U', + 5: "4PCO", + 7: "6PCO", + 8: "2S", + 9: "CO" }, optionalArr: { - 1:'標配', - 2:'選配', - 3:'選配', + 1: '標配', + 2: '選配', + 3: '選配', }, total_spec: total_spec, options: options, @@ -26,41 +26,41 @@ const pricereviewCreate = ()=>{ subkind: 1, buttons: [], modalSelectedOptions: {}, - selectedOptions:[], + selectedOptions: [], elevators: [], - toElevators:[], + toElevators: [], toElevatorNo: '', currentOptionKey: '', currentOtherOptionKey: '', currentMaintainOptionKey: '', - optionKey:0, - otherOptionKey:0, - maintainOptionKey:0, - modalElevatorInfo:{ - spec:'', - person:'', - stop:'', - speed:'', - open:'CO', + optionKey: 0, + otherOptionKey: 0, + maintainOptionKey: 0, + modalElevatorInfo: { + spec: '', + person: '', + stop: '', + speed: '', + open: 'CO', num: 1, - price:'', - sale_price:'', + price: '', + sale_price: '', facility_id: '', }, otherOptions: [], - modalOtherOptionInfo:{ - pr_no:"", - name:"", + modalOtherOptionInfo: { + pr_no: "", + name: "", price: 0, - num:"", + num: "", }, - maintainOptions:[], - modalMaintainInfo:{ - price:0, - num:"", - memo:"", + maintainOptions: [], + modalMaintainInfo: { + price: 0, + num: "", + memo: "", }, - paymentRatio:[ + paymentRatio: [ { scale: 20, ticket: 30, @@ -90,41 +90,40 @@ const pricereviewCreate = ()=>{ ticket: '', }, ], - serviceFee:0, + serviceFee: 0, transactionDate: pre_order_date, - shippingDate:'', - remark:'', - async getElevatorPrice(idx){ + shippingDate: '', + remark: '', + async getElevatorPrice(idx) { const spec = this.elevators[idx].specifications const person = this.elevators[idx].person const stop = this.elevators[idx].stop const open_converted = this.elevators[idx].open_converted const speed = this.elevators[idx].speed const model = spec + '-' + person + '*' + stop + '-' + open_converted + speed; - try{ - const res = await axios.get("./api/getElevatorPrice.php", {params: {model: model}}) + console.log(model); + try { + const res = await axios.get("./api/getElevatorPrice.php", { params: { model: model } }) console.log(res.data); - if(res.data.id == null || res.data.id == ""){ + if (res.data == null || res.data == "") { console.log("公司並無提供此規格!!"); } - this.elevators[idx].price = res.data.price - this.elevators[idx].facility_id = res.data.id - }catch (error) { + this.elevators[idx].price = res.data + } catch (error) { console.error("Error fetching elevator price:", error); } - + }, - async getModalElevatorPrice(){ + async getModalElevatorPrice() { let model = this.modalElevatorInfo.spec + '-' + this.modalElevatorInfo.person + '*' + this.modalElevatorInfo.stop + '-' + this.modalElevatorInfo.open + this.modalElevatorInfo.speed; - try{ - const res = await axios.get("./api/getElevatorPrice.php", {params: {model: model}}) + try { + const res = await axios.get("./api/getElevatorPrice.php", { params: { model: model } }) console.log(res.data); - if(res.data.id == null || res.data.id == ""){ + if (res.data == null || res.data == "") { console.log("公司並無提供此規格!!"); } - this.modalElevatorInfo.price = res.data.price - this.modalElevatorInfo.facility_id = res.data.id - }catch (error) { + this.modalElevatorInfo.price = res.data + } catch (error) { console.error("Error fetching elevator price:", error); } }, @@ -168,147 +167,101 @@ const pricereviewCreate = ()=>{ } }, optionSubCategory: 1, - initOptinos(){ - this.options.forEach(option=>{ + initOptinos() { + this.options.forEach(option => { option.isShow = 1; }) }, - searchOptions(kind=this.kind, subkind=this.subkind){ - if(kind!=null) this.kind = kind; - if(subkind!=null) this.subkind = subkind; + searchOptions(kind = this.kind, subkind = this.subkind) { + if (kind != null) this.kind = kind; + if (subkind != null) this.subkind = subkind; this.initOptinos(); this.initButtons(kind); - this.options.forEach(option=>{ - if(option.kind != this.kind && this.kind != 1){ + this.options.forEach(option => { + if (option.kind != this.kind && this.kind != 1) { option.isShow = 0; - }else{ - if(option.subkind != this.subkind && this.subkind != 1){ + } else { + if (option.subkind != this.subkind && this.subkind != 1) { option.isShow = 0; } } - if(option.isShow == 1){ - if(option.group_name == null) option.group_name = '' - if(option.spec == null) option.spec = '' - if(option.memo == null) option.memo = '' - if(option.price == null) option.price = 0 - if(option.unit == null) option.unit = '' - if(String(option.id).includes(this.searchtext) || option.group_name.includes(this.searchtext) || option.memo.toLowerCase().includes(this.searchtext) || option.spec.toLowerCase().includes(this.searchtext) || option.unit.includes(this.searchtext) || String(option.price).includes(this.searchtext)){ + if (option.isShow == 1) { + if (option.group_name == null) option.group_name = '' + if (option.spec == null) option.spec = '' + if (option.memo == null) option.memo = '' + if (option.price == null) option.price = 0 + if (option.unit == null) option.unit = '' + if (String(option.id).includes(this.searchtext) || option.group_name.includes(this.searchtext) || option.memo.toLowerCase().includes(this.searchtext) || option.spec.toLowerCase().includes(this.searchtext) || option.unit.includes(this.searchtext) || String(option.price).includes(this.searchtext)) { option.isShow = 1 - }else{ + } else { option.isShow = 0 } } }) }, - selectOption(idx, id, name, price, memo){ - this.options[idx].selected = this.options[idx].selected==1 ? 0 : 1; - - if(this.modalSelectedOptions.hasOwnProperty(idx)){ + selectOption(idx, id, name, price, memo) { + this.options[idx].selected = this.options[idx].selected == 1 ? 0 : 1; + + if (this.modalSelectedOptions.hasOwnProperty(idx)) { delete this.modalSelectedOptions[idx]; - }else{ + } else { //this.optionKey => 已選option 流水號, idx:option表內的流水號, id:option 資料庫的ID - this.modalSelectedOptions[idx] = {key:this.optionKey, 'idx':idx, 'id': id, 'name': name, 'price': price, qty:1, 'memo': memo, 'toElevator':[] } + this.modalSelectedOptions[idx] = { key: this.optionKey, 'idx': idx, 'id': id, 'name': name, 'price': price, qty: 1, 'memo': memo, 'toElevator': [] } } - this.optionKey ++; + this.optionKey++; }, - initModalSelectedOptions(){ + initModalSelectedOptions() { this.modalSelectedOptions = {} - this.options.forEach(option=>{ + this.options.forEach(option => { option.selected = 0 }) this.$refs.optionsModal.style.display = "block" body.style.overflow = 'hidden' }, - chkOptions(){ - Object.keys(this.modalSelectedOptions).forEach(option=>{ + chkOptions() { + Object.keys(this.modalSelectedOptions).forEach(option => { this.selectedOptions.push(this.modalSelectedOptions[option]) }) console.log(this.modalSelectedOptions); console.log(this.selectedOptions); this.hideOptionsModal(); }, - hideOptionsModal(){ + hideOptionsModal() { this.$refs.optionsModal.style.display = 'none'; body.style.overflow = 'auto' }, - hideToElevatorModal(){ - this.$refs.toElevatorModal.style.display = 'none'; - body.style.overflow = 'auto' - }, - hideToOtherOptionElevatorModal(){ - this.$refs.toOtherOptionElevatorModal.style.display = 'none'; - body.style.overflow = 'auto' - }, - hideToMaintainOptionElevatorModal(){ - this.$refs.toMaintainOptionElevatorModal.style.display = 'none'; - body.style.overflow = 'auto' - }, - hideCreateElevatorModal(){ - this.$refs.createElevatorModal.style.display = 'none'; - body.style.overflow = 'auto' - this.modalElevatorInfo = { - spec:'', - person:'', - stop:'', - speed:'', - open:'CO', - num: 1, - price:'', - sale_price:'', - }; - }, - hideCreateOtherOptionModal(){ - this.$refs.createOtherOptionModal.style.display = 'none'; - body.style.overflow = 'auto' - }, - hideCreateMaintainModal(){ - this.$refs.createMaintainModal.style.display = 'none'; - body.style.overflow = 'auto' - }, - openCreateElevatorModal(){ - this.$refs.createElevatorModal.style.display = 'block'; - body.style.overflow = 'hidden' - }, - openCreateOtherOptionFn(){ - this.$refs.createOtherOptionModal.style.display = 'block'; - body.style.overflow = 'hidden' - }, - openCreateMaintainModal(){ - this.$refs.createMaintainModal.style.display = 'block'; - body.style.overflow = 'hidden' - }, - totalElevatorsPrice(){ + totalElevatorsPrice() { return this.elevators.reduce((total, elevator) => { return total + (elevator.spec_num * elevator.price); }, 0); }, - totalElevatorsNum(){ + totalElevatorsNum() { return this.elevators.reduce((total, elevator) => { return total + Number(elevator.spec_num); }, 0) }, - totalElevatorsSalePrice(){ + totalElevatorsSalePrice() { return this.elevators.reduce((total, elevator) => { return total + (elevator.spec_num * elevator.spec_price); }, 0); }, - totalOptionsPrice(){ + totalOptionsPrice() { return this.selectedOptions.reduce((total, option) => { return total + (option.qty * option.price); }, 0); }, - openAddElevatorFn(){ + openAddElevatorFn() { }, - createElevatorFn(){ - if(this.modalElevatorInfo.spec == '') return alert("請選擇電梯規格"); - if(this.modalElevatorInfo.stop == '') return alert("請填入停數"); - if(this.modalElevatorInfo.speed == '') return alert("請選擇速度"); - if(this.modalElevatorInfo.open == '') return alert("請選擇開梯方式"); - if(this.modalElevatorInfo.person == '') return alert("請填入人乘/載重"); - if(this.modalElevatorInfo.num == '') return alert("請填入數量"); - if(this.modalElevatorInfo.sale_price == '') return alert("請填入售價"); - this.total_spec ++; + createElevatorFn() { + if (this.modalElevatorInfo.spec == '') return alert("請選擇電梯規格"); + if (this.modalElevatorInfo.stop == '') return alert("請填入停數"); + if (this.modalElevatorInfo.speed == '') return alert("請選擇速度"); + if (this.modalElevatorInfo.open == '') return alert("請選擇開梯方式"); + if (this.modalElevatorInfo.person == '') return alert("請填入人乘/載重"); + if (this.modalElevatorInfo.num == '') return alert("請填入數量"); + if (this.modalElevatorInfo.sale_price == '') return alert("請填入售價"); + this.total_spec++; this.elevators.push({ id: this.total_spec, specifications: this.modalElevatorInfo.spec, @@ -318,14 +271,22 @@ const pricereviewCreate = ()=>{ open_converted: this.modalElevatorInfo.open, spec_price: this.modalElevatorInfo.sale_price, price: this.modalElevatorInfo.price, - open:'', + open: '', spec_num: this.modalElevatorInfo.num, - facility_id: this.modalElevatorInfo.facility_id, }); - console.log(this.elevators); - this.hideCreateElevatorModal(); + this.modalElevatorInfo = { + spec: '', + person: '', + stop: '', + speed: '', + open: 'CO', + num: 1, + price: '', + sale_price: '', + }; + this.$refs.closeCreateElevatorModalBtn.click(); }, - copyElevator(idx){ + copyElevator(idx) { const spec = this.elevators[idx].specifications const person = this.elevators[idx].person const stop = this.elevators[idx].stop @@ -337,7 +298,7 @@ const pricereviewCreate = ()=>{ const price = this.elevators[idx].price const facility_id = this.elevators[idx].facility_id - this.total_spec ++; + this.total_spec++; this.elevators.push({ id: this.total_spec, specifications: spec, @@ -353,44 +314,44 @@ const pricereviewCreate = ()=>{ }); console.log(this.elevators); }, - addOptionToElevator(key){ + addOptionToElevator(key) { this.currentOptionKey = key; this.toElevators = []; this.toElevatorNo = ""; - const matchElevators = this.selectedOptions.filter(option=> option.key == key)[0].toElevator.map(elevator=> elevator.id) + const matchElevators = this.selectedOptions.filter(option => option.key == key)[0].toElevator.map(elevator => elevator.id) console.log(matchElevators); this.toElevatorNo = matchElevators[0] - this.elevators.forEach(elevator=>{ - if(elevator.price > 0){ + this.elevators.forEach(elevator => { + if (elevator.price > 0) { this.toElevators.push({ id: elevator.id, model: elevator.specifications + '-' + elevator.person + '*' + elevator.stop + '-' + elevator.open_converted + elevator.speed, - checked: matchElevators.includes(elevator.id) ? 1: 0, + checked: matchElevators.includes(elevator.id) ? 1 : 0, }) } }) this.$refs.toElevatorModal.style.display = 'block'; body.style.overflow = 'hidden' }, - addOtherOptionToElevator(id){ + addOtherOptionToElevator(id) { this.currentOtherOptionKey = id; this.toElevators = []; this.toElevatorNo = ""; - const matchElevators = this.otherOptions.filter(option=> option.id == id)[0].toElevator.map(elevator=> elevator.id) + const matchElevators = this.otherOptions.filter(option => option.id == id)[0].toElevator.map(elevator => elevator.id) this.toElevatorNo = matchElevators[0] - this.elevators.forEach(elevator=>{ - if(elevator.price > 0){ + this.elevators.forEach(elevator => { + if (elevator.price > 0) { this.toElevators.push({ id: elevator.id, model: elevator.specifications + '-' + elevator.person + '*' + elevator.stop + '-' + elevator.open_converted + elevator.speed, - checked: matchElevators.includes(elevator.id) ? 1: 0, + checked: matchElevators.includes(elevator.id) ? 1 : 0, }) } }) this.$refs.toOtherOptionElevatorModal.style.display = 'block'; body.style.overflow = 'hidden' }, - chkOptionToElevators(){ + chkOptionToElevators() { const checkedOptions = []; // this.toElevators.forEach(elevator=>{ // if(elevator.checked){ @@ -400,13 +361,13 @@ const pricereviewCreate = ()=>{ // }); // } // }) - const matchElevators = this.elevators.filter(elevator=> elevator.id == this.toElevatorNo)[0] + const matchElevators = this.elevators.filter(elevator => elevator.id == this.toElevatorNo)[0] checkedOptions.push({ id: this.toElevatorNo, model: matchElevators['specifications'] + '-' + matchElevators['person'] + '*' + matchElevators['stop'] + '-' + matchElevators['open_converted'] + matchElevators['speed'], }) - this.selectedOptions.forEach(option=>{ - if(option.key == this.currentOptionKey){ + this.selectedOptions.forEach(option => { + if (option.key == this.currentOptionKey) { option.toElevator = []; option.toElevator.push(...checkedOptions) } @@ -414,7 +375,7 @@ const pricereviewCreate = ()=>{ this.currentOptionKey = '' this.hideToElevatorModal(); }, - chkOtherOptionToElevators(){ + chkOtherOptionToElevators() { const checkedOptions = []; // this.toElevators.forEach(elevator=>{ // if(elevator.checked){ @@ -424,13 +385,13 @@ const pricereviewCreate = ()=>{ // }); // } // }) - const matchElevators = this.elevators.filter(elevator=> elevator.id == this.toElevatorNo)[0] + const matchElevators = this.elevators.filter(elevator => elevator.id == this.toElevatorNo)[0] checkedOptions.push({ id: this.toElevatorNo, model: matchElevators['specifications'] + '-' + matchElevators['person'] + '*' + matchElevators['stop'] + '-' + matchElevators['open_converted'] + matchElevators['speed'], }) - this.otherOptions.forEach(option=>{ - if(option.id == this.currentOtherOptionKey){ + this.otherOptions.forEach(option => { + if (option.id == this.currentOtherOptionKey) { option.toElevator = []; option.toElevator.push(...checkedOptions) } @@ -440,36 +401,36 @@ const pricereviewCreate = ()=>{ this.hideToOtherOptionElevatorModal(); }, - removeElevator(id){ - if(!confirm("確定刪除嗎?")) return; - this.elevators = this.elevators.filter(elevator=> elevator.id != id) + removeElevator(id) { + if (!confirm("確定刪除嗎?")) return; + this.elevators = this.elevators.filter(elevator => elevator.id != id) const issetElevators = []; - this.elevators.forEach(elevator=>{ + this.elevators.forEach(elevator => { issetElevators.push(elevator.id); }) - this.selectedOptions.forEach(option=>{ - option.toElevator = option.toElevator.filter(el=>{ + this.selectedOptions.forEach(option => { + option.toElevator = option.toElevator.filter(el => { return issetElevators.includes(el.id) }) }) console.log(this.selectedOptions); }, - removeOption(key){ + removeOption(key) { console.log(this.selectedOptions); - this.selectedOptions = this.selectedOptions.filter(option=> option.key != key) + this.selectedOptions = this.selectedOptions.filter(option => option.key != key) }, - removeOtherOption(id){ - this.otherOptions = this.otherOptions.filter(option=> option.id != id) + removeOtherOption(id) { + this.otherOptions = this.otherOptions.filter(option => option.id != id) }, - createOtherOptionFn(){ + createOtherOptionFn() { this.otherOptions.push({ id: this.otherOptionKey, pr_no: this.modalOtherOptionInfo.pr_no, name: this.modalOtherOptionInfo.name, price: this.modalOtherOptionInfo.price, num: this.modalOtherOptionInfo.num, - toElevator:[], + toElevator: [], }) this.modalOtherOptionInfo = { pr_no: '', @@ -477,46 +438,47 @@ const pricereviewCreate = ()=>{ price: 0, num: '', } - this.otherOptionKey ++; - this.hideCreateOtherOptionModal(); + this.otherOptionKey++; + console.log(this.otherOptions); + this.$refs.closeCreateOtherOptionModalBtn.click(); }, - totalOtherOptionsPrice(){ + totalOtherOptionsPrice() { return this.otherOptions.reduce((total, option) => { return total + (Number(option.num) * Number(option.price)); }, 0); }, - totalOtherOptionsNum(){ + totalOtherOptionsNum() { return this.otherOptions.reduce((total, option) => { return total + Number(option.num); }, 0); }, - createMaintainOptionFn(){ + createMaintainOptionFn() { this.maintainOptions.push({ id: this.maintainOptionKey, price: this.modalMaintainInfo.price, num: this.modalMaintainInfo.num, memo: this.modalMaintainInfo.memo, - toElevator:[], + toElevator: [], }) this.modalMaintainInfo = { - price:0, - num:"", - memo:"", + price: 0, + num: "", + memo: "", } - this.maintainOptionKey ++; - this.hideCreateMaintainModal(); + this.maintainOptionKey++; + this.$refs.closeCreateMaintainOptionModalBtn.click(); }, - totalMaintainOptionsPrice(){ + totalMaintainOptionsPrice() { return this.maintainOptions.reduce((total, option) => { return total + (Number(option.num) * Number(option.price)); }, 0); }, - totalMaintainOptionsNum(){ + totalMaintainOptionsNum() { return this.maintainOptions.reduce((total, option) => { return total + Number(option.num); }, 0); }, - chkMaintainOptionToElevators(){ + chkMaintainOptionToElevators() { const checkedOptions = []; // this.toElevators.forEach(elevator=>{ // if(elevator.checked){ @@ -526,13 +488,13 @@ const pricereviewCreate = ()=>{ // }); // } // }) - const matchElevators = this.elevators.filter(elevator=> elevator.id == this.toElevatorNo)[0] + const matchElevators = this.elevators.filter(elevator => elevator.id == this.toElevatorNo)[0] checkedOptions.push({ id: this.toElevatorNo, model: matchElevators['specifications'] + '-' + matchElevators['person'] + '*' + matchElevators['stop'] + '-' + matchElevators['open_converted'] + matchElevators['speed'], }) - this.maintainOptions.forEach(option=>{ - if(option.id == this.currentMaintainOptionKey){ + this.maintainOptions.forEach(option => { + if (option.id == this.currentMaintainOptionKey) { option.toElevator = []; option.toElevator.push(...checkedOptions) } @@ -540,18 +502,18 @@ const pricereviewCreate = ()=>{ this.currentMaintainOptionKey = '' this.hideToMaintainOptionElevatorModal(); }, - addMaintainOptionToElevator(id){ + addMaintainOptionToElevator(id) { this.currentMaintainOptionKey = id; this.toElevators = []; this.toElevatorNo = ""; - const matchElevators = this.maintainOptions.filter(option=> option.id == id)[0].toElevator.map(elevator=> elevator.id) + const matchElevators = this.maintainOptions.filter(option => option.id == id)[0].toElevator.map(elevator => elevator.id) this.toElevatorNo = matchElevators[0] - this.elevators.forEach(elevator=>{ - if(elevator.price > 0){ + this.elevators.forEach(elevator => { + if (elevator.price > 0) { this.toElevators.push({ id: elevator.id, model: elevator.specifications + '-' + elevator.person + '*' + elevator.stop + '-' + elevator.open_converted + elevator.speed, - checked: matchElevators.includes(elevator.id) ? 1: 0, + checked: matchElevators.includes(elevator.id) ? 1 : 0, }) } }) @@ -559,32 +521,32 @@ const pricereviewCreate = ()=>{ this.$refs.toMaintainOptionElevatorModal.style.display = 'block'; body.style.overflow = 'hidden' }, - removeMaintainOption(id){ - this.maintainOptions = this.maintainOptions.filter(option=> option.id != id) + removeMaintainOption(id) { + this.maintainOptions = this.maintainOptions.filter(option => option.id != id) }, - totalPrice(){ + totalPrice() { return this.totalElevatorsPrice() + this.totalOptionsPrice() + this.totalOtherOptionsPrice() + this.totalMaintainOptionsPrice(); }, - totalSalePrice(){ + totalSalePrice() { return this.elevators.reduce((total, elevator) => { return total + (elevator.spec_num * elevator.spec_price); }, 0); }, - scalePrice(scale){ - if(scale === '') return 0; + scalePrice(scale) { + if (scale === '') return 0; return this.totalSalePrice() * scale / 100; }, - totalScale(){ + totalScale() { let total = 0; - Object.keys(this.paymentRatio).forEach(pay=>{ - if(this.paymentRatio[pay].scale != '' && this.paymentRatio[pay].scale > 0){ + Object.keys(this.paymentRatio).forEach(pay => { + if (this.paymentRatio[pay].scale != '' && this.paymentRatio[pay].scale > 0) { total += Number(this.paymentRatio[pay].scale) } }) return total; }, - customerInfo:{ + customerInfo: { contractno: contractno, company: customer, manager: manager, @@ -593,52 +555,11 @@ const pricereviewCreate = ()=>{ uscc: uscc, person: salesman, }, - penalty:"", - deposit_rate:0, - keep_rate:0, - warranty_rate:0, - error: [], - submit(){ - this.error = [] - for(let i=0;i 0){ - let errortext = ''; - this.error.forEach(err=>{ - errortext += err+'\n'; - }) - alert(errortext) - return; - } - + penalty: "", + deposit_rate: 0, + keep_rate: 0, + warranty_rate: 0, + submit() { const form = new FormData(); form.append('contractno', contractno); form.append('ekind', "新梯"); @@ -648,7 +569,7 @@ const pricereviewCreate = ()=>{ form.append('address', this.customerInfo.address); form.append('price_lowest', this.totalPrice()); form.append('price_total', this.totalSalePrice()); - form.append('price_rate', Math.round(this.totalSalePrice() / this.totalPrice() * 100 *10) / 10); + form.append('price_rate', Math.round(this.totalSalePrice() / this.totalPrice() * 100 * 10) / 10); form.append('special_fee', this.serviceFee); form.append('predeal_date', this.transactionDate); form.append('facilitok_date', this.shippingDate); @@ -669,27 +590,25 @@ const pricereviewCreate = ()=>{ form.append('maintainOptions', JSON.stringify(this.maintainOptions)); form.append('paymentRatio', JSON.stringify(this.paymentRatio)); - - axios.post('./api/postNewElevatorPricereview.php', form).then(res=>{ + + axios.post('./api/postNewElevatorPricereview.php', form).then(res => { console.log(res.data); - if(res.data == "success"){ + if (res.data == "success") { alert("送審成功!"); window.location.href = './pricereview-index.php?' + token_link; } - }).catch(err=>{ + }).catch(err => { console.error(err); }) }, - + } } - - -const pricereviewCheck = ()=>{ +const pricereviewCheck = () => { return { - init(){ - this.elevators = items.filter(item=> item.item_group =='A'); - this.elevators.forEach(el=>{ + init() { + this.elevators = items.filter(item => item.item_group == 'A'); + this.elevators.forEach(el => { el.options = [] el.optionsTotalPrice = 0; el.otherOptions = [] @@ -698,18 +617,18 @@ const pricereviewCheck = ()=>{ el.maintainOptionsTotalPrice = 0; }) this.options = options; - this.otherOptions = items.filter(item=> item.item_group =='E'); - this.maintainOptions = items.filter(item=> item.item_group =='D'); + this.otherOptions = items.filter(item => item.item_group == 'E'); + this.maintainOptions = items.filter(item => item.item_group == 'D'); console.log(this.options); - - this.elevators.forEach((elevator, idx)=>{ - - this.options.forEach(option=>{ - if(option.option_relate_spec == elevator.item_no){ + + this.elevators.forEach((elevator, idx) => { + + this.options.forEach(option => { + if (option.option_relate_spec == elevator.item_no) { elevator.optionsTotalPrice += option.option_mi * option.item_qty this.elevators[idx].options.push({ - 'id': option.id, //&lt;br&gt;() - 'item_spec': option.item_spec.trim().replaceAll('&', '').replaceAll('lt;', '').replaceAll('br', '').replaceAll('gt;', '').replaceAll('()', ''), + 'id': option.id, + 'item_spec': option.item_spec.trim(), 'item_unit_price': option.item_unit_price, 'item_qty': option.item_qty, 'mi': Math.round(option.option_mi), @@ -717,11 +636,11 @@ const pricereviewCheck = ()=>{ } }) - this.otherOptions.forEach(option=>{ - if(option.option_relate_spec == elevator.item_no){ + this.otherOptions.forEach(option => { + if (option.option_relate_spec == elevator.item_no) { elevator.otherOptionsTotalPrice += option.item_unit_price * option.item_qty this.elevators[idx].otherOptions.push({ - 'id': option.id, + 'id': option.id, 'item_spec': option.item_spec.trim(), 'item_unit_price': option.item_unit_price, 'item_qty': option.item_qty, @@ -730,11 +649,11 @@ const pricereviewCheck = ()=>{ } }) - this.maintainOptions.forEach(option=>{ - if(option.option_relate_spec == elevator.item_no){ + this.maintainOptions.forEach(option => { + if (option.option_relate_spec == elevator.item_no) { elevator.maintainOptionsTotalPrice += option.item_unit_price * option.item_qty this.elevators[idx].maintainOptions.push({ - 'id': option.id, + 'id': option.id, 'item_spec': option.item_spe.trim(), 'item_unit_price': option.item_unit_price, 'item_qty': option.item_qty, @@ -751,39 +670,36 @@ const pricereviewCheck = ()=>{ let stop = model.split('-')[1].split('*')[1].split('-')[0]; let open = model.split('-')[2]; let speed = ''; - for(let i=0;i',res.data); - if(res.data){ + }) + + }, + async getElevatorMi(idx, spec, person, stop, open, speed, item_weight) { + try { + const res = await axios.get('./api/getElevatorMi.php', { + params: { + spec: spec, + person: person, + stop: stop, + open: open, + speed: speed, + weight: item_weight + } + }) + console.log('---->', res.data); + if (res.data) { this.elevators[idx].mi = res.data this.elevators[idx].totalMi = res.data['equipment_fee'] + res.data['customs_shipping_fee'] + res.data['free1y_fee'] + res.data['install_fee'] + res.data['other_fee'] + res.data['transport_site_fee'] + res.data['unloading_fee']; - }else{ + } else { this.isNotfoundMi = true; this.elevators[idx].mi = { 'equipment_fee': 0, @@ -795,22 +711,22 @@ const pricereviewCheck = ()=>{ 'unloading_fee': 0 } } - + console.log(this.elevators[idx]); - }catch (error) { + } catch (error) { console.error("Error fetching elevator price:", error); } }, - isNotfoundMi:false, - openFn:[ + isNotfoundMi: false, + openFn: [ 'CO', '2S', '2U', '4PCO', '6PCO' ], - sign1:'', - sign2:'', - sign3:'', - sign4:'', + sign1: '', + sign2: '', + sign3: '', + sign4: '', is_renovate: false, elevators_total_price: 0, contractno: contractno, @@ -830,53 +746,68 @@ const pricereviewCheck = ()=>{ memo: memo, qty: 0, pays: pays, - elevators:[], + elevators: [], options: [], otherOptions: [], maintainOptions: [], mid: mid, user_id: user_id, - reviewcomment:'', - optionsTotalPrice(){ + optionsTotalPrice() { return this.options.reduce((total, option) => { return total + (option.item_qty * option.item_unit_price); }, 0); }, - otherOptionsTotalPrice(){ + otherOptionsTotalPrice() { return this.otherOptions.reduce((total, option) => { return total + (option.item_qty * option.item_unit_price); }, 0); }, - maintainOptionsTotalPrice(){ + maintainOptionsTotalPrice() { return this.maintainOptions.reduce((total, option) => { return total + (option.item_qty * option.item_unit_price); }, 0); }, - totalScale(){ + totalScale() { return this.pays.reduce((total, option) => { - return total + Number(option.pay_scale ); + return total + Number(option.pay_scale); }, 0); }, - check(sign, status){ + + check(sign, status) { console.log(sign); const form = new FormData(); form.append('sign', sign); form.append('mid', this.mid); form.append('result', status); form.append('user_id', this.user_id); - form.append('reviewcomment', this.reviewcomment); - axios.post('./api/postPricereviewSign.php', form).then(res=>{ + axios.post('./api/postPricereviewSign.php', form).then(res => { console.log(res.data); - if(res.data == 1){ + if (res.data == 1) { alert("簽核成功!"); window.location.reload() } }) }, - async getUsername(user_id){ - if(user_id == '') return '---' - const res = await axios.get('./api/getUsername.php', {params: {user_id: user_id}}) - return res.data ; + agree(sign) { + console.log(sign); + }, + closeCase(sign) { + console.log(sign); + }, + } +} + + +const pricereviewMaintainCreate = () => { + return { + init() { + // this.elevators = elevator; + }, + elevator: [], + async getElevatorPrice(idx) { + const spec = this.elevator[idx].specifications; + const person = this.elevators[idx].person; }, + } } \ No newline at end of file diff --git a/wms/mkt/css/pricereview.css b/wms/mkt/css/pricereview.css index 5986f447..f5953715 100644 --- a/wms/mkt/css/pricereview.css +++ b/wms/mkt/css/pricereview.css @@ -1,34 +1,58 @@ -#pricereviewCreate input[type=text], #pricereviewCreate input[type=number], #pricereviewCreate select { +#pricereviewCreate input[type=text], +#pricereviewCreate input[type=number], +#pricereviewCreate select { margin: 1px; } + #pricereviewCreate textarea { resize: vertical; } -#pricereviewCreate > .modal { + +#pricereviewCreate>.modal { padding: 20px; } -#pricereviewCreate > .modal table, #pricereviewCreate > .modal th, #pricereviewCreate > .modal td { + +#pricereviewCreate>.modal table, +#pricereviewCreate>.modal th, +#pricereviewCreate>.modal td { border: 1px #ccc solid; } -#pricereviewCreate > .modal table > thead tr th { + +#pricereviewCreate>.modal table>thead tr th { color: #A52A2A; } -#pricereviewCreate > .modal table > tbody .selected { + +#pricereviewCreate>.modal table>tbody .selected { background-color: #E7FEFB; } -#pricereviewCreate .container table, #pricereviewCreate .container th, #pricereviewCreate .container td { + +#pricereviewCreate .container table, +#pricereviewCreate .container th, +#pricereviewCreate .container td { border: 1px #ccc solid; padding: 15px; } -#pricereviewCreate .container table.noborder, #pricereviewCreate .container table .noborder th, #pricereviewCreate .container table .noborder td, #pricereviewCreate .container th.noborder, #pricereviewCreate .container th .noborder th, #pricereviewCreate .container th .noborder td, #pricereviewCreate .container td.noborder, #pricereviewCreate .container td .noborder th, #pricereviewCreate .container td .noborder td { + +#pricereviewCreate .container table.noborder, +#pricereviewCreate .container table .noborder th, +#pricereviewCreate .container table .noborder td, +#pricereviewCreate .container th.noborder, +#pricereviewCreate .container th .noborder th, +#pricereviewCreate .container th .noborder td, +#pricereviewCreate .container td.noborder, +#pricereviewCreate .container td .noborder th, +#pricereviewCreate .container td .noborder td { border: none; } + #pricereviewCreate .container table thead th { background-color: #6D9EEB; } + #pricereviewCreate .container table tbody td input { font-size: 14px; } + #pricereviewCreate .container table tbody th { background-color: #CCE4F8; font-size: 14px; @@ -36,15 +60,18 @@ min-width: 100px; text-align: center; } + #pricereviewCreate .container table input { font-size: 13px; } + #pricereviewCreate .container .pricreviewmain { background-color: #F2F2F2; padding: 20px; border-radius: 6px; margin: 30px 0; } + #pricereviewCreate .container .pricreviewmain button { color: #fff; width: 55px; @@ -53,56 +80,81 @@ margin-left: 10px; font-size: 13px; } + #pricereviewCreate .container .pricreviewmain button.addbtn { background-color: #337AB7; width: 30px; } + #pricereviewCreate .container .pricreviewmain button.deleteBtn { background-color: #D9534F; color: #fff; font-size: 12px; width: 30px; } + #pricereviewCreate .container .pricreviewmain button.selectElevator { background-color: #D9534F; color: #fff; } -#pricereviewCreate .container .pricreviewmain > .divitem { + +#pricereviewCreate .container .pricreviewmain>.divitem { border: 1px #ccc solid; padding: 10px; border-radius: 4px; } -#pricereviewCreate .container .pricreviewmain > .divitem .title { + +#pricereviewCreate .container .pricreviewmain>.divitem .title { display: flex; align-items: center; border-bottom: 1px #ccc solid; padding: 10px 0; margin-bottom: 10px; } -#pricereviewCreate .container .pricreviewmain > .divitem .title h6 { + +#pricereviewCreate .container .pricreviewmain>.divitem .title h6 { font-weight: 600; } -#pricereviewCreate .container .pricreviewmain > .divitem table, #pricereviewCreate .container .pricreviewmain > .divitem th, #pricereviewCreate .container .pricreviewmain > .divitem td { + +#pricereviewCreate .container .pricreviewmain>.divitem table, +#pricereviewCreate .container .pricreviewmain>.divitem th, +#pricereviewCreate .container .pricreviewmain>.divitem td { font-size: 14px; background-color: transparent; } -#pricereviewCreate .container .pricreviewmain > .divitem table input, #pricereviewCreate .container .pricreviewmain > .divitem table select, #pricereviewCreate .container .pricreviewmain > .divitem table textarea, #pricereviewCreate .container .pricreviewmain > .divitem th input, #pricereviewCreate .container .pricreviewmain > .divitem th select, #pricereviewCreate .container .pricreviewmain > .divitem th textarea, #pricereviewCreate .container .pricreviewmain > .divitem td input, #pricereviewCreate .container .pricreviewmain > .divitem td select, #pricereviewCreate .container .pricreviewmain > .divitem td textarea { + +#pricereviewCreate .container .pricreviewmain>.divitem table input, +#pricereviewCreate .container .pricreviewmain>.divitem table select, +#pricereviewCreate .container .pricreviewmain>.divitem table textarea, +#pricereviewCreate .container .pricreviewmain>.divitem th input, +#pricereviewCreate .container .pricreviewmain>.divitem th select, +#pricereviewCreate .container .pricreviewmain>.divitem th textarea, +#pricereviewCreate .container .pricreviewmain>.divitem td input, +#pricereviewCreate .container .pricreviewmain>.divitem td select, +#pricereviewCreate .container .pricreviewmain>.divitem td textarea { font-size: 13px; } -#pricereviewCreate .container .pricreviewmain > .divitem table input[type=number]::-webkit-outer-spin-button, -#pricereviewCreate .container .pricreviewmain > .divitem table input[type=number]::-webkit-inner-spin-button, #pricereviewCreate .container .pricreviewmain > .divitem th input[type=number]::-webkit-outer-spin-button, -#pricereviewCreate .container .pricreviewmain > .divitem th input[type=number]::-webkit-inner-spin-button, #pricereviewCreate .container .pricreviewmain > .divitem td input[type=number]::-webkit-outer-spin-button, -#pricereviewCreate .container .pricreviewmain > .divitem td input[type=number]::-webkit-inner-spin-button { + +#pricereviewCreate .container .pricreviewmain>.divitem table input[type=number]::-webkit-outer-spin-button, +#pricereviewCreate .container .pricreviewmain>.divitem table input[type=number]::-webkit-inner-spin-button, +#pricereviewCreate .container .pricreviewmain>.divitem th input[type=number]::-webkit-outer-spin-button, +#pricereviewCreate .container .pricreviewmain>.divitem th input[type=number]::-webkit-inner-spin-button, +#pricereviewCreate .container .pricreviewmain>.divitem td input[type=number]::-webkit-outer-spin-button, +#pricereviewCreate .container .pricreviewmain>.divitem td input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; } -#pricereviewCreate .container .pricreviewmain > .divitem table tr:hover .deleteBtn, #pricereviewCreate .container .pricreviewmain > .divitem table tr:hover .copyBtn { + +#pricereviewCreate .container .pricreviewmain>.divitem table tr:hover .deleteBtn, +#pricereviewCreate .container .pricreviewmain>.divitem table tr:hover .copyBtn { opacity: 1; } -#pricereviewCreate .container .pricreviewmain > .divitem table .saletd { + +#pricereviewCreate .container .pricreviewmain>.divitem table .saletd { position: relative; } -#pricereviewCreate .container .pricreviewmain > .divitem table .saletd > .deleteBtn { + +#pricereviewCreate .container .pricreviewmain>.divitem table .saletd>.deleteBtn { position: absolute; top: 50%; transform: translateY(-50%); @@ -110,7 +162,8 @@ opacity: 0; transition: 0.3s; } -#pricereviewCreate .container .pricreviewmain > .divitem table .saletd > .copyBtn { + +#pricereviewCreate .container .pricreviewmain>.divitem table .saletd>.copyBtn { position: absolute; top: 50%; transform: translateY(-50%); @@ -120,29 +173,35 @@ width: 30px; height: 30px; } -#pricereviewCreate .container .pricreviewmain > .divitem table textarea { + +#pricereviewCreate .container .pricreviewmain>.divitem table textarea { height: auto; min-height: 50px; } -#pricereviewCreate .container .pricreviewmain > .filediv { + +#pricereviewCreate .container .pricreviewmain>.filediv { display: flex; flex-direction: column; margin-top: 20px; } -#pricereviewCreate .container .pricreviewmain > .filediv label { + +#pricereviewCreate .container .pricreviewmain>.filediv label { display: flex; align-items: center; margin: 10px 0; } -#pricereviewCreate .container .pricreviewmain > .filediv label p { + +#pricereviewCreate .container .pricreviewmain>.filediv label p { width: 100px; font-size: 15px; font-weight: 600; } -#pricereviewCreate .container .pricreviewmain > .filediv label input[type=file] { + +#pricereviewCreate .container .pricreviewmain>.filediv label input[type=file] { width: 400px; } -#pricereviewCreate .container .pricreviewmain > .filediv label button { + +#pricereviewCreate .container .pricreviewmain>.filediv label button { width: 90px; height: 35px; margin: 0; @@ -150,14 +209,19 @@ margin-top: 20px; } -.container-fluid, .container { +.container-fluid, +.container { max-width: 1400px !important; width: 100%; } -.container-fluid h4, .container h4 { + +.container-fluid h4, +.container h4 { font-weight: 600; } -.container-fluid .btn-secondary, .container .btn-secondary { + +.container-fluid .btn-secondary, +.container .btn-secondary { background-color: #6C757D; } @@ -172,39 +236,51 @@ padding: 20px; display: none; } + @keyframes fade-in { 0% { transform: translate(-50%, -60%); opacity: 0; } + 100% { transform: translate(-50%, -55%); opacity: 1; } } -.window-modal table, .window-modal th, .window-modal td { + +.window-modal table, +.window-modal th, +.window-modal td { border: 1px #ccc solid; } -.window-modal table > thead tr th { + +.window-modal table>thead tr th { color: #A52A2A; } -.window-modal table > tbody .selected { + +.window-modal table>tbody .selected { background-color: #E7FEFB; } + .window-modal#optionModal .window-modal-content { max-height: 80vh; } + .window-modal#optionModal .window-modal-content .window-modal-body { height: 400px; overflow-y: scroll; } + .window-modal#toElevatorModal .window-modal-content { min-height: 270px; height: auto; } + .window-modal#toElevatorModal .window-modal-content .window-modal-body { height: auto; } + .window-modal .window-modal-content { z-index: 9; background-color: #fff; @@ -218,19 +294,24 @@ box-shadow: 0 5px 5px #222; animation: fade-in 0.2s linear; } + .window-modal .window-modal-content.modal-xl { width: 1200px; } + .window-modal .window-modal-content.modal-lg { width: 800px; } + .window-modal .window-modal-content.modal-m { width: 450px; } + .window-modal .window-modal-content .window-modal-header { display: flex; flex-direction: column; } + .window-modal .window-modal-content .window-modal-header button.btn-close { position: absolute; top: 10px; @@ -240,9 +321,11 @@ outline: none; border-radius: 50%; } -.window-modal .window-modal-content .window-modal-header > div > input { + +.window-modal .window-modal-content .window-modal-header>div>input { width: 250px; } + .window-modal .window-back { position: absolute; top: 0; @@ -252,45 +335,60 @@ background-color: transparent; } -#pricereviewCheck > .container { +#pricereviewCheck>.container { background-color: #F2F2F2; border-radius: 15px; padding: 20px; } -#pricereviewCheck > .container textarea { + +#pricereviewCheck>.container textarea { resize: vertical; } -#pricereviewCheck > .container table, #pricereviewCheck > .container th, #pricereviewCheck > .container td { + +#pricereviewCheck>.container table, +#pricereviewCheck>.container th, +#pricereviewCheck>.container td { border: 1px #ccc solid; } -#pricereviewCheck > .container table.noborder { + +#pricereviewCheck>.container table.noborder { border: none !important; } -#pricereviewCheck > .container table.noborder th, #pricereviewCheck > .container table.noborder td { + +#pricereviewCheck>.container table.noborder th, +#pricereviewCheck>.container table.noborder td { border: none !important; } -#pricereviewCheck > .container .customerinfo-table input { + +#pricereviewCheck>.container .customerinfo-table input { background-color: #EEE5E5; } -#pricereviewCheck > .container .mi-table th { + +#pricereviewCheck>.container .mi-table th { font-weight: 600; } -#pricereviewCheck > .container .mi-table input[type=text] { + +#pricereviewCheck>.container .mi-table input[type=text] { background-color: #EEEEEE; cursor: not-allowed; padding: 6px 12px; font-size: 14px; } -#pricereviewCheck > .container .mi-table .mi-info { + +#pricereviewCheck>.container .mi-table .mi-info { font-size: 14px; } -#pricereviewCheck > .container .mi-table .mi-info span { + +#pricereviewCheck>.container .mi-table .mi-info span { font-size: 15px; font-weight: 600; } -#pricereviewCheck > .container .mi-table .mi-info .line { + +#pricereviewCheck>.container .mi-table .mi-info .line { width: 100%; height: 0.5px; margin: 30px 0; background-color: #ccc; -}/*# sourceMappingURL=pricereview.css.map */ \ No newline at end of file +} + +/*# sourceMappingURL=pricereview.css.map */ \ No newline at end of file diff --git a/wms/mkt/css/pricereview.css.map b/wms/mkt/css/pricereview.css.map index d113f93f..a7e072e9 100644 --- a/wms/mkt/css/pricereview.css.map +++ b/wms/mkt/css/pricereview.css.map @@ -1 +1,10 @@ -{"version":3,"sources":["pricereview.scss","pricereview.css"],"names":[],"mappings":"AACI;EACI,WAAA;ACAR;ADEI;EACI,gBAAA;ACAR;ADEI;EACI,aAAA;ACAR;ADCQ;EACI,sBAAA;ACCZ;ADCQ;EACI,cAAA;ACCZ;ADCQ;EACI,yBAAA;ACCZ;ADKQ;EACI,sBAAA;EACA,aAAA;ACHZ;ADIY;EACI,YAAA;ACFhB;ADMY;EACI,yBAAA;ACJhB;ADOgB;EACI,eAAA;ACLpB;ADOgB;EACI,yBAAA;EACA,eAAA;EACA,iBAAA;EACA,gBAAA;EACA,kBAAA;ACLpB;ADQY;EACI,eAAA;ACNhB;ADSQ;EACI,yBAAA;EACA,aAAA;EACA,kBAAA;EACA,cAAA;ACPZ;ADQY;EACI,WAAA;EACA,WAAA;EACA,YAAA;EACA,UAAA;EACA,iBAAA;EACA,eAAA;ACNhB;ADOgB;EACI,yBAAA;EACA,WAAA;ACLpB;ADOgB;EACI,yBAAA;EACA,WAAA;EACA,eAAA;EACA,WAAA;ACLpB;ADOgB;EACI,yBAAA;EACA,WAAA;ACLpB;ADSY;EACI,sBAAA;EACA,aAAA;EACA,kBAAA;ACPhB;ADQgB;EACI,aAAA;EACA,mBAAA;EACA,6BAAA;EACA,eAAA;EACA,mBAAA;ACNpB;ADOoB;EACI,gBAAA;ACLxB;ADSgB;EACI,eAAA;EACA,6BAAA;ACPpB;ADQoB;EACI,eAAA;ACNxB;ADQoB;;;;EAEA,wBAAA;EACA,SAAA;ACJpB;ADQoB;EACI,UAAA;ACNxB;ADQoB;EACI,kBAAA;ACNxB;ADOwB;EACI,kBAAA;EACA,QAAA;EACA,2BAAA;EACA,UAAA;EACA,UAAA;EACA,gBAAA;ACL5B;ADOwB;EACI,kBAAA;EACA,QAAA;EACA,2BAAA;EACA,WAAA;EACA,UAAA;EACA,gBAAA;EACA,WAAA;EACA,YAAA;ACL5B;ADQoB;EACI,YAAA;EACA,gBAAA;ACNxB;ADUY;EACI,aAAA;EACA,sBAAA;EACA,gBAAA;ACRhB;ADSgB;EACI,aAAA;EACA,mBAAA;EACA,cAAA;ACPpB;ADQoB;EACI,YAAA;EACA,eAAA;EACA,gBAAA;ACNxB;ADQoB;EACI,YAAA;ACNxB;ADQoB;EACI,WAAA;EACA,YAAA;EACA,SAAA;EACA,kBAAA;EACA,gBAAA;ACNxB;;ADcA;EACI,4BAAA;EACA,WAAA;ACXJ;ADYI;EACI,gBAAA;ACVR;ADYI;EACI,yBAAA;ACVR;;ADcA;EACI,eAAA;EACA,MAAA;EACA,OAAA;EACA,WAAA;EACA,aAAA;EACA,oCAAA;EACA,UAAA;EACA,aAAA;EACA,aAAA;ACXJ;ADYI;EACI;IACI,gCAAA;IACA,UAAA;ECVV;EDYM;IACI,gCAAA;IACA,UAAA;ECVV;AACF;ADYI;EACI,sBAAA;ACVR;ADYI;EACI,cAAA;ACVR;ADYI;EACI,yBAAA;ACVR;ADYI;EACI,gBAAA;ACVR;ADWQ;EACI,aAAA;EACA,kBAAA;ACTZ;ADYI;EACI,iBAAA;EACA,YAAA;ACVR;ADWQ;EACI,YAAA;ACTZ;ADYI;EACI,UAAA;EACA,sBAAA;EACA,mBAAA;EACA,kBAAA;EACA,aAAA;EACA,aAAA;EACA,QAAA;EACA,SAAA;EACA,gCAAA;EACA,0BAAA;EACA,8BAAA;ACVR;ADWQ;EACI,aAAA;ACTZ;ADWQ;EACI,YAAA;ACTZ;ADWQ;EACI,YAAA;ACTZ;ADWQ;EACI,aAAA;EACA,sBAAA;ACTZ;ADUY;EACI,kBAAA;EACA,SAAA;EACA,WAAA;EACA,6BAAA;EACA,YAAA;EACA,aAAA;EACA,kBAAA;ACRhB;ADUY;EACI,YAAA;ACRhB;ADYI;EACI,kBAAA;EACA,MAAA;EACA,OAAA;EACA,WAAA;EACA,YAAA;EACA,6BAAA;ACVR;;ADeI;EACI,yBAAA;EACA,mBAAA;EACA,aAAA;ACZR;ADaQ;EACI,gBAAA;ACXZ;ADaQ;EACI,sBAAA;ACXZ;ADaQ;EACI,uBAAA;ACXZ;ADYY;EACI,uBAAA;ACVhB;ADcY;EACI,yBAAA;ACZhB;ADgBY;EACI,gBAAA;ACdhB;ADgBY;EACI,yBAAA;EACA,mBAAA;EACA,iBAAA;EACA,eAAA;ACdhB;ADgBY;EACI,eAAA;ACdhB;ADegB;EACI,eAAA;EACA,gBAAA;ACbpB;ADegB;EACI,WAAA;EACA,aAAA;EACA,cAAA;EACA,sBAAA;ACbpB","file":"pricereview.css"} \ No newline at end of file +{ + "version": 3, + "sources": [ + "pricereview.scss", + "pricereview.css" + ], + "names": [], + "mappings": "AACI;EACI,WAAA;ACAR;ADEI;EACI,gBAAA;ACAR;ADEI;EACI,aAAA;ACAR;ADCQ;EACI,sBAAA;ACCZ;ADCQ;EACI,cAAA;ACCZ;ADCQ;EACI,yBAAA;ACCZ;ADKQ;EACI,sBAAA;EACA,aAAA;ACHZ;ADIY;EACI,YAAA;ACFhB;ADMY;EACI,yBAAA;ACJhB;ADOgB;EACI,eAAA;ACLpB;ADOgB;EACI,yBAAA;EACA,eAAA;EACA,iBAAA;EACA,gBAAA;EACA,kBAAA;ACLpB;ADQY;EACI,eAAA;ACNhB;ADSQ;EACI,yBAAA;EACA,aAAA;EACA,kBAAA;EACA,cAAA;ACPZ;ADQY;EACI,WAAA;EACA,WAAA;EACA,YAAA;EACA,UAAA;EACA,iBAAA;EACA,eAAA;ACNhB;ADOgB;EACI,yBAAA;EACA,WAAA;ACLpB;ADOgB;EACI,yBAAA;EACA,WAAA;EACA,eAAA;EACA,WAAA;ACLpB;ADOgB;EACI,yBAAA;EACA,WAAA;ACLpB;ADSY;EACI,sBAAA;EACA,aAAA;EACA,kBAAA;ACPhB;ADQgB;EACI,aAAA;EACA,mBAAA;EACA,6BAAA;EACA,eAAA;EACA,mBAAA;ACNpB;ADOoB;EACI,gBAAA;ACLxB;ADSgB;EACI,eAAA;EACA,6BAAA;ACPpB;ADQoB;EACI,eAAA;ACNxB;ADQoB;;;;EAEA,wBAAA;EACA,SAAA;ACJpB;ADQoB;EACI,UAAA;ACNxB;ADQoB;EACI,kBAAA;ACNxB;ADOwB;EACI,kBAAA;EACA,QAAA;EACA,2BAAA;EACA,UAAA;EACA,UAAA;EACA,gBAAA;ACL5B;ADOwB;EACI,kBAAA;EACA,QAAA;EACA,2BAAA;EACA,WAAA;EACA,UAAA;EACA,gBAAA;EACA,WAAA;EACA,YAAA;ACL5B;ADQoB;EACI,YAAA;EACA,gBAAA;ACNxB;ADUY;EACI,aAAA;EACA,sBAAA;EACA,gBAAA;ACRhB;ADSgB;EACI,aAAA;EACA,mBAAA;EACA,cAAA;ACPpB;ADQoB;EACI,YAAA;EACA,eAAA;EACA,gBAAA;ACNxB;ADQoB;EACI,YAAA;ACNxB;ADQoB;EACI,WAAA;EACA,YAAA;EACA,SAAA;EACA,kBAAA;EACA,gBAAA;ACNxB;;ADcA;EACI,4BAAA;EACA,WAAA;ACXJ;ADYI;EACI,gBAAA;ACVR;ADYI;EACI,yBAAA;ACVR;;ADcA;EACI,eAAA;EACA,MAAA;EACA,OAAA;EACA,WAAA;EACA,aAAA;EACA,oCAAA;EACA,UAAA;EACA,aAAA;EACA,aAAA;ACXJ;ADYI;EACI;IACI,gCAAA;IACA,UAAA;ECVV;EDYM;IACI,gCAAA;IACA,UAAA;ECVV;AACF;ADYI;EACI,sBAAA;ACVR;ADYI;EACI,cAAA;ACVR;ADYI;EACI,yBAAA;ACVR;ADYI;EACI,gBAAA;ACVR;ADWQ;EACI,aAAA;EACA,kBAAA;ACTZ;ADYI;EACI,iBAAA;EACA,YAAA;ACVR;ADWQ;EACI,YAAA;ACTZ;ADYI;EACI,UAAA;EACA,sBAAA;EACA,mBAAA;EACA,kBAAA;EACA,aAAA;EACA,aAAA;EACA,QAAA;EACA,SAAA;EACA,gCAAA;EACA,0BAAA;EACA,8BAAA;ACVR;ADWQ;EACI,aAAA;ACTZ;ADWQ;EACI,YAAA;ACTZ;ADWQ;EACI,YAAA;ACTZ;ADWQ;EACI,aAAA;EACA,sBAAA;ACTZ;ADUY;EACI,kBAAA;EACA,SAAA;EACA,WAAA;EACA,6BAAA;EACA,YAAA;EACA,aAAA;EACA,kBAAA;ACRhB;ADUY;EACI,YAAA;ACRhB;ADYI;EACI,kBAAA;EACA,MAAA;EACA,OAAA;EACA,WAAA;EACA,YAAA;EACA,6BAAA;ACVR;;ADeI;EACI,yBAAA;EACA,mBAAA;EACA,aAAA;ACZR;ADaQ;EACI,gBAAA;ACXZ;ADaQ;EACI,sBAAA;ACXZ;ADaQ;EACI,uBAAA;ACXZ;ADYY;EACI,uBAAA;ACVhB;ADcY;EACI,yBAAA;ACZhB;ADgBY;EACI,gBAAA;ACdhB;ADgBY;EACI,yBAAA;EACA,mBAAA;EACA,iBAAA;EACA,eAAA;ACdhB;ADgBY;EACI,eAAA;ACdhB;ADegB;EACI,eAAA;EACA,gBAAA;ACbpB;ADegB;EACI,WAAA;EACA,aAAA;EACA,cAAA;EACA,sBAAA;ACbpB", + "file": "pricereview.css" +} \ No newline at end of file diff --git a/wms/mkt/css/pricereview.scss b/wms/mkt/css/pricereview.scss index ea3c48bc..37d03e17 100644 --- a/wms/mkt/css/pricereview.scss +++ b/wms/mkt/css/pricereview.scss @@ -1,41 +1,61 @@ -#pricereviewCreate{ - input[type='text'], input[type='number'], select{ +#pricereviewCreate { + + input[type='text'], + input[type='number'], + select { margin: 1px; } - textarea{ + + textarea { resize: vertical; } - >.modal{ + + >.modal { padding: 20px; - table, th, td{ - border:1px #ccc solid; + + table, + th, + td { + border: 1px #ccc solid; } - table > thead tr th{ - color:#A52A2A; + + table>thead tr th { + color: #A52A2A; } - table > tbody .selected{ + + table>tbody .selected { background-color: #E7FEFB; } - table > tbody .selected td{ - } + + table>tbody .selected td {} } - .container{ - table, th, td{ - border:1px #ccc solid; + + .container { + + table, + th, + td { + border: 1px #ccc solid; padding: 15px; - &.noborder, .noborder th, .noborder td{ - border:none; + + &.noborder, + .noborder th, + .noborder td { + border: none; } } - table{ - thead th{ + + table { + thead th { background-color: #6D9EEB; } + tbody { - td input{ + td input { font-size: 14px; } - th{ + + th { background-color: #CCE4F8; font-size: 14px; padding: 15px 2px; @@ -43,116 +63,143 @@ text-align: center; } } - input{ + + input { font-size: 13px; } } - .pricreviewmain{ + + .pricreviewmain { background-color: #F2F2F2; padding: 20px; - border-radius: 6px ; - margin:30px 0; - button{ - color:#fff; + border-radius: 6px; + margin: 30px 0; + + button { + color: #fff; width: 55px; height: 30px; padding: 0; margin-left: 10px; font-size: 13px; - &.addbtn{ + + &.addbtn { background-color: #337AB7; width: 30px; } - &.deleteBtn{ + + &.deleteBtn { background-color: #D9534F; - color:#fff; + color: #fff; font-size: 12px; width: 30px; } - &.selectElevator{ + + &.selectElevator { background-color: #D9534F; - color:#fff; + color: #fff; } } - - >.divitem{ - border:1px #ccc solid; + + >.divitem { + border: 1px #ccc solid; padding: 10px; - border-radius: 4px ; - .title{ + border-radius: 4px; + + .title { display: flex; align-items: center; border-bottom: 1px #ccc solid; padding: 10px 0; margin-bottom: 10px; - h6{ + + h6 { font-weight: 600; } - + } - table, th, td{ + + table, + th, + td { font-size: 14px; background-color: transparent; - input, select, textarea{ + + input, + select, + textarea { font-size: 13px; } + input[type=number]::-webkit-outer-spin-button, input[type=number]::-webkit-inner-spin-button { - -webkit-appearance: none; - margin: 0; + -webkit-appearance: none; + margin: 0; } } + table { - tr:hover .deleteBtn ,tr:hover .copyBtn{ + + tr:hover .deleteBtn, + tr:hover .copyBtn { opacity: 1; } - .saletd{ + + .saletd { position: relative; - >.deleteBtn{ + + >.deleteBtn { position: absolute; top: 50%; transform: translateY(-50%); - right:2px; + right: 2px; opacity: 0; transition: .3s; } - >.copyBtn{ + + >.copyBtn { position: absolute; top: 50%; transform: translateY(-50%); - right:38px; + right: 38px; opacity: 0; transition: .3s; width: 30px; height: 30px; } } - textarea{ + + textarea { height: auto; min-height: 50px; } } } - >.filediv{ + + >.filediv { display: flex; flex-direction: column; margin-top: 20px; - label{ + + label { display: flex; align-items: center; - margin:10px 0; - p{ - width:100px; + margin: 10px 0; + + p { + width: 100px; font-size: 15px; font-weight: 600; } - input[type="file"]{ - width:400px + + input[type="file"] { + width: 400px } - button{ - width:90px; + + button { + width: 90px; height: 35px; - margin:0; + margin: 0; margin-right: 15px; margin-top: 20px; } @@ -162,154 +209,166 @@ } } -.container-fluid, .container{ - max-width:1400px !important; +.container-fluid, +.container { + max-width: 1400px !important; width: 100%; - h4{ + + h4 { font-weight: 600; } - .btn-secondary{ + + .btn-secondary { background-color: #6C757D; } } -.window-modal{ +.window-modal { position: fixed; top: 0; - left:0; + left: 0; width: 100%; height: 100vh; background-color: rgba(0, 0, 0, 0.5); z-index: 9; padding: 20px; display: none; + @keyframes fade-in { - 0%{ - transform: translate(-50%, -60%); + 0% { + transform: translate(-50%, -55%); opacity: 0; } - 100%{ - transform: translate(-50%, -55%); + + 100% { + transform: translate(-50%, -50%); opacity: 1; } } - table, th, td{ - border:1px #ccc solid; + + table, + th, + td { + border: 1px #ccc solid; } - table > thead tr th{ - color:#A52A2A; + + table>thead tr th { + color: #A52A2A; } - table > tbody .selected{ + + table>tbody .selected { background-color: #E7FEFB; } - &#optionModal .window-modal-content{ - max-height: 80vh; - .window-modal-body{ - height: 400px; - overflow-y: scroll; - } - } - &#toElevatorModal .window-modal-content{ - min-height: 270px; - height: auto; - .window-modal-body{ - height: auto; - } - } - .window-modal-content{ - z-index: 9; + + .window-modal-content { background-color: #fff; border-radius: 10px; position: absolute; - width:1200px; + width: 1200px; padding: 30px; top: 50%; - left:50%; - transform: translate(-50%, -55%); + left: 50%; + transform: translate(-50%, -50%); box-shadow: 0 5px 5px #222; animation: fade-in .2s linear; - &.modal-xl{ - width:1200px; + + &.modal-xl { + width: 1200px; } - &.modal-lg{ - width:800px; + + &.modal-lg { + width: 800px; } - &.modal-m{ - width:450px; + + &.modal-m { + width: 400px; } - .window-modal-header{ + + .window-modal-header { display: flex; flex-direction: column; - button.btn-close{ + + button.btn-close { position: absolute; top: 10px; - right:10px; + right: 10px; background-color: transparent; - border:none; + border: none; outline: none; border-radius: 50%; } - >div > input{ + + >div>input { width: 250px; } } - } - .window-back{ - position: absolute; - top: 0; - left:0; - width: 100%; - height: 100%; - background-color: transparent; + + .window-modal-body { + overflow-y: scroll; + height: 400px; + } } } -#pricereviewCheck{ - >.container{ +#pricereviewCheck { + >.container { background-color: #F2F2F2; border-radius: 15px; padding: 20px; - textarea{ + + textarea { resize: vertical; } - table, th, td{ - border:1px #ccc solid; + + table, + th, + td { + border: 1px #ccc solid; } - table.noborder{ - border:none !important; - th ,td{ - border:none !important; + + table.noborder { + border: none !important; + + th, + td { + border: none !important; } } - .customerinfo-table{ - input{ + + .customerinfo-table { + input { background-color: #EEE5E5; } } - .mi-table{ - th{ + + .mi-table { + th { font-weight: 600; } - input[type=text]{ + + input[type=text] { background-color: #EEEEEE; cursor: not-allowed; padding: 6px 12px; font-size: 14px; } - .mi-info{ + + .mi-info { font-size: 14px; - span{ + + span { font-size: 15px; font-weight: 600; } - .line{ + + .line { width: 100%; height: .5px; - margin:30px 0; + margin: 30px 0; background-color: #ccc; } } } } - + } \ No newline at end of file diff --git a/wms/mkt/pricereviewMaintainCreate.php b/wms/mkt/pricereviewMaintainCreate.php new file mode 100644 index 00000000..74b91ccf --- /dev/null +++ b/wms/mkt/pricereviewMaintainCreate.php @@ -0,0 +1,195 @@ +prepare($sql); +// $stmt->bindParam(':vol_no', $vol_no); +$stmt->execute(); +$hope_contract = $stmt->fetch(PDO::FETCH_ASSOC); + +$hope_customer_status = [ + 'A' => '有望簽約(已報價)', + 'B' => '觀望考慮(等待時機報價)', + 'C' => '在途合約', + 'D' => '已簽約', + 'N' => '無望簽約', +]; + +$salename = $hope_contract['salesman']; +$sql = "SELECT * FROM account WHERE accountid = :salename"; +$stmt = $conn->prepare($sql); +$stmt->bindParam(':salename', $salename); +$stmt->execute(); +$salename = $stmt->fetch(PDO::FETCH_ASSOC); +// echo '
';
+// print_r($hope_customer_status);
+// echo '
'; + + +?> + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
有望客戶基本資料
卷號客戶名稱負責人客戶來源
地址案件名稱市話 / 手機業主方聯繫人
營業員台數預定成交日有望客戶狀態
有望客戶狀態
+ + + + + + + + + +
洽商進度
+ +
+ + +
+
+
+

整機單價

+ +
+ + + + + + + + + + + + + + + + + + + + + +
項次電梯人乘/
載重
停數速度(m/min)保養月數保養次數(月)保養方式公司發布價(月)數量公司發布價(總價)售價(月)售價(總價)
+
+
+
+
+ + \ No newline at end of file