Browse Source

新梯、保養簽回&獎金

main
Cheng 1 year ago
parent
commit
79d4fecce6
  1. 5
      wms/bonus/elevator_new/elevator_new_deal_bonus_v2_0.php
  2. 17
      wms/bonus/elevator_new/elevator_new_deal_bonus_v2_0_examination.php
  3. 2
      wms/contract/api/T8api.php
  4. 15
      wms/contract/api/getContractData.php
  5. 1
      wms/contract/api/postContractData.php
  6. 247
      wms/contract/api/postNewContractData.php
  7. 379
      wms/contract/api/test copy.json
  8. 127
      wms/contract/api/testT8API.php
  9. 14
      wms/contract/contract-newelevator-input.php
  10. 13
      wms/contract/js/alpine.js

5
wms/bonus/elevator_new/elevator_new_deal_bonus_v2_0.php

@ -35,7 +35,8 @@ result_array[
function elevator_new_deal_bonus_v2_0($ver, $contract_type, $elevator_type, $elevator_list_price, $elevator_knockdown_price, $sales_id, $region_manger_id){ function elevator_new_deal_bonus_v2_0($ver, $contract_type, $elevator_type, $elevator_list_price, $elevator_knockdown_price, $sales_id, $region_manger_id)
{
$bonus_array = []; $bonus_array = [];
if ($ver == "2.0") { if ($ver == "2.0") {
$discount = round($elevator_knockdown_price / $elevator_list_price, 3); #銷售點數,取到小數點第三位。 $discount = round($elevator_knockdown_price / $elevator_list_price, 3); #銷售點數,取到小數點第三位。
@ -160,5 +161,3 @@ function elevator_new_deal_bonus_v2_0($ver, $contract_type, $elevator_type, $ele
return $result_array; return $result_array;
}; };
?>

17
wms/bonus/elevator_new/elevator_new_deal_bonus_v2_0_examination.php

@ -99,8 +99,21 @@ for($i = 0; $i<count($examination_array); $i++){
$examination_array[$i][5], $examination_array[$i][5],
$examination_array[$i][6] $examination_array[$i][6]
); );
$customer = [
'strategy_customer' => '戰略客戶',
'general_customer' => '一般客戶'
];
//作番機種($elevator_type):客梯(passenger)、貨梯(cargo)、小電梯(dumbwaiter)、平台梯(flatbase)、強驅(positive_drive)
$elevator = [
"passenger" => "客梯",
"cargo" => "貨梯",
"dumbwaiter" => "小電梯",
"flatbase" => "平台踢",
"positive_drive" => "強驅"
];
echo "獎金版本:" . $result["ver"] . "<br>"; echo "獎金版本:" . $result["ver"] . "<br>";
echo "計算結果:" . $result["result_status"] . "<br>"; echo "計算結果:" . $result["result_status"] . "<br>";
echo "參數說明: " . $customer[$examination_array[$i][1]] . " 、 " . $elevator[$examination_array[$i][2]] . "、 作番表價:" . $examination_array[$i][3] . " 、 作番賣價: " . $examination_array[$i][4] . "、 營業員員工號:" . $examination_array[$i][5] . " 、 區域經理員工號:" . $examination_array[$i][6] . "<br>";
echo "輸入參數:" . $examination_array[$i][1] . " " . $examination_array[$i][2] . " " . $examination_array[$i][3] . " " . $examination_array[$i][4] . " " echo "輸入參數:" . $examination_array[$i][1] . " " . $examination_array[$i][2] . " " . $examination_array[$i][3] . " " . $examination_array[$i][4] . " "
. $examination_array[$i][5] . " " . $examination_array[$i][6] . "<br>"; . $examination_array[$i][5] . " " . $examination_array[$i][6] . "<br>";
for ($j = 0; $j < count($result["bonus_array"]); $j++) { for ($j = 0; $j < count($result["bonus_array"]); $j++) {
@ -109,8 +122,4 @@ for($i = 0; $i<count($examination_array); $i++){
. $result["bonus_array"][$j]["payment_schedul_regulation"] . "<br>"; . $result["bonus_array"][$j]["payment_schedul_regulation"] . "<br>";
}; };
echo "-------------------------" . "<br>"; echo "-------------------------" . "<br>";
}; };
?>

2
wms/contract/api/T8api.php

@ -7,7 +7,7 @@ function T8salIncomeApply($data, $api_url)
// $api_url = 'https://erp.masada.com.tw:780/twWebAPI/V1/SALINCOMEAPPLY/PostERPData'; // $api_url = 'https://erp.masada.com.tw:780/twWebAPI/V1/SALINCOMEAPPLY/PostERPData';
$validation = get_Auth(); $validation = get_Auth();
// echo '<pre>'; // echo '<pre>';
// print_r(json_encode($data)); // print_r(json_encode($data, JSON_UNESCAPED_UNICODE));
// echo '</pre>'; // echo '</pre>';
$header = [ $header = [
"CHI_Authorization :" . $validation, "CHI_Authorization :" . $validation,

15
wms/contract/api/getContractData.php

@ -186,28 +186,13 @@ if (isset($_GET['contractno']) && $_GET['contractno'] != '' && isset($_GET['cont
foreach ($other_option_arr as $key => $option) { foreach ($other_option_arr as $key => $option) {
if ($option['item_qty'] == $result['item_qty']) { if ($option['item_qty'] == $result['item_qty']) {
$result['option_other_price'] += intval($option['item_unit_price']); $result['option_other_price'] += intval($option['item_unit_price']);
// echo '1..';
// echo "<pre>";
// print_r($option['item_unit_price']);
// echo "</pre>";
} else if ($option['item_qty'] / $result['item_qty'] != 1) { } else if ($option['item_qty'] / $result['item_qty'] != 1) {
$item_qty = intval($option['item_qty']) / intval($result['item_qty']); // 總option數量 / 總電梯台數 $item_qty = intval($option['item_qty']) / intval($result['item_qty']); // 總option數量 / 總電梯台數
$result['option_other_price'] += intval($option['item_unit_price']) * $item_qty; $result['option_other_price'] += intval($option['item_unit_price']) * $item_qty;
// echo '2..';
// echo "<pre>";
// print_r(intval($option['item_unit_price']) . ' *' . $item_qty . '=' . intval($option['item_unit_price']) * $item_qty);
// echo "</pre>";
} else { } else {
$result['option_other_price'] += $option['item_unit_price'] * intval($option['item_qty']); $result['option_other_price'] += $option['item_unit_price'] * intval($option['item_qty']);
// echo '
} }
// echo '<pre>';
// print_r($option['item_no'] . '--->' . $option['item_unit_price'] . '--->' . $option['item_qty']);
// echo '</pre>';
} }
// print_r($result['option_other_price']);
// exit();
} }

1
wms/contract/api/postContractData.php

@ -620,6 +620,7 @@ function T8insert($data, $facilityno, $depId)
"SPrice" => intval($elevator['sold_price']), "SPrice" => intval($elevator['sold_price']),
"SQuantity" => $SQuantity, "SQuantity" => $SQuantity,
"ProjectId" => "$contractno", "ProjectId" => "$contractno",
"FromBillNo" => "$contractno",
"CU_MaterialId" => "$facility_no", "CU_MaterialId" => "$facility_no",
"CU_EstPayDate" => intval($payDay) "CU_EstPayDate" => intval($payDay)
]; ];

247
wms/contract/api/postNewContractData.php

@ -1,10 +1,16 @@
<meta charset="UTF-8">
<?php <?php
// header("Content-Type: text/html; charset=utf-8");
// echo '你好';
// exit;
require_once("../conn.php"); require_once("../conn.php");
// include_once("../../fun_global.php");
include_once("./getFacilityNo.php"); include_once("./getFacilityNo.php");
include_once("./getComboNo.php"); include_once("./getComboNo.php");
include_once("./upload_chk.php"); include_once("./upload_chk.php");
ini_set('date.timezone', 'Asia/Taipei'); ini_set('date.timezone', 'Asia/Taipei');
if ($_SERVER['REQUEST_METHOD'] != 'POST') { if ($_SERVER['REQUEST_METHOD'] != 'POST') {
exit(); exit();
} }
@ -25,10 +31,13 @@ if (isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['c
$qc = $_POST["qc"]; $qc = $_POST["qc"];
$contracttype = $_POST["contracttype"]; $contracttype = $_POST["contracttype"];
$elevators_nums = $_POST['nums']; $elevators_nums = $_POST['nums'];
$elevators = json_decode($_POST['elevators'], true); $area_no = $_POST['area_no'];
$elevators_detail_arr = json_decode($_POST['elevators_detail_arr'], true); $elevators = json_decode($_POST['elevators'], JSON_UNESCAPED_UNICODE);
$elevators_detail_arr = json_decode($_POST['elevators_detail_arr'], JSON_UNESCAPED_UNICODE);
// echo "<pre>";
// print_r($elevators_detail_arr);
// echo "</pre>";
// exit();
$files = !empty($_FILES['files']) ? $_FILES['files'] : null; $files = !empty($_FILES['files']) ? $_FILES['files'] : null;
$files_id = null; $files_id = null;
@ -67,19 +76,131 @@ if (isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['c
$facilityno = $createFacilityNo->makeMFacilityNo('M', $arr, intval($elevators_nums)); $facilityno = $createFacilityNo->makeMFacilityNo('M', $arr, intval($elevators_nums));
echo json_encode($facilityno); echo json_encode($facilityno);
// $bonus_result = BounsCount($_POST, $conn, $facilityno); $bonus_result = BounsCount($_POST, $conn, $facilityno);
// if (!empty($bonus_result) && $bonus_result['status'] == "2") { if (!empty($bonus_result) && $bonus_result['status'] == "2") {
// $fail_arr[] = '獎金計算錯誤,請再檢查或連繫資訊人員'; $fail_arr[] = '獎金計算錯誤,請再檢查或連繫資訊人員';
// // header("HTTP/1.1 422 Unprocessable Entity"); // header("HTTP/1.1 422 Unprocessable Entity");
// echo json_encode($fail_arr, JSON_UNESCAPED_UNICODE); echo json_encode($fail_arr, JSON_UNESCAPED_UNICODE);
// exit(); exit();
// } }
T8Insert($_POST, $facilityno, $connT8); T8Insert($_POST, $facilityno, $connT8);
exit(); exit();
$conn->beginTransaction(); $conn->beginTransaction();
//create account table
$accounttype = "A";
$accountid = $vat;
$pwd = "123";
$name = $customer;
$tel = $lm_tel ?? '';
$sql = "INSERT INTO account (accounttype, accountid, pwd, name, tel, address, creater, create_at)
VALUES (:accounttype, :accountid, :pwd, :name, :tel, :address , :creater, :created_at)";
$stmt = $conn->prepare($sql);
$stmt->bindParam(':accounttype', $accounttype);
$stmt->bindParam(':accountid', $contractno);
$stmt->bindParam(':pwd', $pwd);
$stmt->bindParam(':name', $customer);
$stmt->bindParam(':tel', $tel);
$stmt->bindParam(':address', $address);
$stmt->bindParam(':creater', $created_by);
$stmt->bindParam(':created_at', $created_at);
$stmt->execute();
// exit();
//create table Wipwholestatus (作番大日程)
foreach ($elevators_detail_arr as $key => $value) {
$facilityno = $facilityno[$key]; // 作番
$weight = $value['item_weight']; // 載重
$person = $value['person']; // 人乘
$floor = $value['floor']; // 樓層
$open = $value['item_op']; // 開門方式
$speed = $value['speed']; //速度
$qc = $value['qc'];
$facility_kind = $value['spec']; //型號
$contract_arrival_date = $value['contract_arrival_date']; //到工地日期
$site_manager = $value['manage'];
$warehouseid = $value['warehouseid'];
$sql = "INSERT INTO Wipwholestatus
(contract_type,contractno,salesid,custom,accountid,site_manager,warehouseid,facilityno,weight,numberofpassenger,numberoffloor,opentype,speed,facility_kind,area_no,address,contract_arrival_date,real_contract_arrival_date,qc_official_type,creater,create_at) VALUES
('A',:contractno,:salesid,:custom,:accountid,:site_manager,:warehouseid,:facilityno,:weight,:numberofpassenger,:numberoffloor,:opentype,:speed,:facility_kind,:area_no,:address,:contract_arrival_date,:real_contract_arrival_date,:qc_official_type,:creater,:create_at)";
// $sql = "INSERT INTO Wipwholestatus
// (contract_type,contractno,salesid,custom,accountid,facilityno,weight,numberofpassenger,numberoffloor,opentype,speed,facility_kind,address,contract_arrival_date,qc_official_type,creater,create_at) VALUES
// ('A','$contractno','$salesman','$customer','$customer','$facilityno','$weight','$person','$floor','$open','$speed','$facility_kind','$address','$contract_arrival_date','$qc','$created_by','$created_at')";
$stmt = $conn->prepare($sql);
$stmt->bindParam(':contractno', $contractno);
$stmt->bindParam(':salesid', $salesman);
$stmt->bindParam(':custom', $customer);
$stmt->bindParam(':accountid', $customer);
$stmt->bindParam(':site_manager', $site_manager);
$stmt->bindParam(':warehouseid', $warehouseid);
$stmt->bindParam(':facilityno', $facilityno);
$stmt->bindParam(':weight', $weight);
$stmt->bindParam(':numberofpassenger', $person);
$stmt->bindParam(':numberoffloor', $floor);
$stmt->bindParam(':opentype', $open);
$stmt->bindParam(':speed', $speed);
$stmt->bindParam(':facility_kind', $facility_kind);
$stmt->bindParam(':area_no', $area_no);
$stmt->bindParam(':address', $address);
$stmt->bindParam(':contract_arrival_date', $contract_arrival_date);
$stmt->bindParam(':real_contract_arrival_date', $contract_arrival_date);
$stmt->bindParam(':qc_official_type', $qc);
$stmt->bindParam(':creater', $created_by);
$stmt->bindParam(':create_at', $created_at);
$stmt->execute();
$lastId = $conn->lastInsertId();
// echo "<pre>";
// print_r($lastId);
// echo "</pre>";
if (!empty($lastId)) {
echo '123';
// 寫入待簽程狀態 A (營業)
do_wws_assign1($salesman, $lastId, 'A', $conn);
// // 寫入待簽程狀態 G (工務)
do_wws_assign1($warehouseid, $lastId, 'G', $conn);
}
// create table worksite (戰情室)
$latitude = $value['latitude'];
$longitude = $value['longitude'];
$sql = "INSERT INTO worksite
(latitude,longitude,facilitynum,facilityno,address,buildcompany,process,status,marchintotime,creater,create_at)VALUES
(:latitude,:longitude,'1',:facilityno,:address,:bulidcompany,'進行中','未工勘',:marchintotime,:creater,:create_at)";
$stmt = $conn->prepare($sql);
$stmt->bindParam(':latitude', $latitude);
$stmt->bindParam(':longitude', $longitude);
$stmt->bindParam(':facilityno', $facilityno);
$stmt->bindParam(':address', $address);
$stmt->bindParam(':bulidcompany', $customer);
$stmt->bindParam(':marchintotime', $contract_arrival_date);
$stmt->bindParam(':creater', $created_by);
$stmt->bindParam(':create_at', $created_at);
$stmt->execute();
// create table schedule
$contract_begin_date = '';
$contract_end_date = ''; // 一年
$comboNo = new CreateComboNo('em', $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);
$stmt->bindParam(':contractno', $contractno);
$stmt->bindParam(':facilityno', $facility_no);
$stmt->bindParam(':combono', $combo[0]);
$stmt->bindParam(':repairerid', $repairerid);
$stmt->bindParam(':repairername', $repairername);
$stmt->bindParam(':duedate', $combo[1]);
$stmt->bindParam(':creater', $creater);
$stmt->bindParam(':create_at', $create_at);
$result = $stmt->execute();
}
}
$sql_str = "SELECT accountid, name FROM account WHERE accountid = :accountid ORDER BY create_at DESC"; $sql_str = "SELECT accountid, name FROM account WHERE accountid = :accountid ORDER BY create_at DESC";
$stmt = $conn->prepare($sql_str); $stmt = $conn->prepare($sql_str);
$stmt->bindParam(":accountid", $salesman); $stmt->bindParam(":accountid", $salesman);
@ -125,7 +246,7 @@ if (isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['c
$stmt->bindParam(':file_size', $file['size']); $stmt->bindParam(':file_size', $file['size']);
$stmt->bindParam(':created_at', $created_at); $stmt->bindParam(':created_at', $created_at);
$stmt->bindParam(':created_by', $created_by); $stmt->bindParam(':created_by', $created_by);
// $stmt->execute(); $stmt->execute();
} else { } else {
throw new PDOException('檔案上傳失敗:' . $msg); throw new PDOException('檔案上傳失敗:' . $msg);
} }
@ -158,7 +279,7 @@ if (isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['c
$stmt->bindParam(":created_at", $created_at); $stmt->bindParam(":created_at", $created_at);
$stmt->bindParam(":created_by", $created_by); $stmt->bindParam(":created_by", $created_by);
$stmt->bindParam(":qc", $qc); $stmt->bindParam(":qc", $qc);
// $stmt->execute(); $stmt->execute();
$result = $conn->commit(); $result = $conn->commit();
@ -194,6 +315,15 @@ function T8Insert($data, $facilityno, $connT8)
$createTime = str_replace('-', '', $createAt); $createTime = str_replace('-', '', $createAt);
$signing_date = intval(str_replace("-", '', $data['signing_date'])); //簽訂日期 $signing_date = intval(str_replace("-", '', $data['signing_date'])); //簽訂日期
// echo // echo
// $pay_kind = [
// '1' => '簽約',
// '2' => '二次款',
// '3' => '貨抵工地',
// '4' => '材料其他',
// '5' => '試車完工', //安裝完畢
// '6' => '交車' //交車
// ];
$pay_kind = [ $pay_kind = [
'1' => '簽約', '1' => '簽約',
'2' => '二次款', '2' => '二次款',
@ -228,7 +358,6 @@ function T8Insert($data, $facilityno, $connT8)
$stmt->bindParam(':TaxNo', $vat); $stmt->bindParam(':TaxNo', $vat);
$stmt->bindParam(':EnterpriseName', $partyA); //企業名稱 $stmt->bindParam(':EnterpriseName', $partyA); //企業名稱
$stmt->bindParam(':ContactAddress', $partyAaddress); $stmt->bindParam(':ContactAddress', $partyAaddress);
// $stmt->bindParam(':EMail', $email);
$stmt->bindParam(':CreatorId', $user_id); $stmt->bindParam(':CreatorId', $user_id);
$stmt->bindParam(':CreateTime', $createTime); $stmt->bindParam(':CreateTime', $createTime);
$stmt->execute(); $stmt->execute();
@ -236,8 +365,8 @@ function T8Insert($data, $facilityno, $connT8)
$sql = "INSERT INTO comCustomer $sql = "INSERT INTO comCustomer
(OrgId,BizPartnerTypeId,CurrId,BizPartnerId,PersonId,CreatorId,IsInUsed,InvoiceAddress,CreateTime,InvoiceId) (OrgId,BizPartnerTypeId,ConditionId,CurrId,BizPartnerId,PersonId,CreatorId,IsInUsed,InvoiceAddress,CreateTime,InvoiceId)
VALUES('1000','10','TWD',:BizPartnerId,:PersonId,:CreatorId,1,:InvoiceAddress,:CreateTime,'35')"; VALUES('1000','10','TWD','0008',:BizPartnerId,:PersonId,:CreatorId,1,:InvoiceAddress,:CreateTime,'35')";
// $sql = "INSERT INTO comCustomer // $sql = "INSERT INTO comCustomer
// (OrgId,BizPartnerTypeId,CurrId,BizPartnerId,PersonId,CreatorId,IsInUsed,InvoiceAddress,CreateTime,InvoiceId) // (OrgId,BizPartnerTypeId,CurrId,BizPartnerId,PersonId,CreatorId,IsInUsed,InvoiceAddress,CreateTime,InvoiceId)
// VALUES('1000','10','TWD','$contractno','$salesman','$user_id',1,'$partyAaddress','$createTime','35')"; // VALUES('1000','10','TWD','$contractno','$salesman','$user_id',1,'$partyAaddress','$createTime','35')";
@ -253,6 +382,7 @@ function T8Insert($data, $facilityno, $connT8)
// // 若客戶資料不為空,更新該客戶資訊。 // // 若客戶資料不為空,更新該客戶資訊。
$sql = "UPDATE comCustomer SET $sql = "UPDATE comCustomer SET
PersonId=:PersonId, PersonId=:PersonId,
ConditionId='0008',
InvoiceAddress=:InvoiceAddress, InvoiceAddress=:InvoiceAddress,
LastOperatorId=:LastOperatorId, LastOperatorId=:LastOperatorId,
LastOperateTime=:LastOperateTime LastOperateTime=:LastOperateTime
@ -306,12 +436,18 @@ function T8Insert($data, $facilityno, $connT8)
$stmt->bindParam(':CreatorId', $user_id); $stmt->bindParam(':CreatorId', $user_id);
$stmt->execute(); $stmt->execute();
} }
$sql = "SELECT * FROM salSalesOrder WHERE BillNo = :BillNo";
$stmt = $connT8->prepare($sql);
$stmt->bindParam(':BillNo', $contractno);
$contractT8 = $stmt->fetch(PDO::FETCH_ASSOC);
if (empty($contractT8)) {
foreach ($elevators as $index => $elevator) { foreach ($elevators as $index => $elevator) {
$count = 1; $count = 1;
// 產品集成維護 // 產品集成維護
$facility_no = $facilityno[$index]; $facility_no = $facilityno[$index];
$MaterialName = "$partyA($facility_no)"; $MaterialName = "$partyA($facility_no)";
$contract_arrival_a = $elevator['contract_arrival_date'];
$sql = "INSERT INTO comMaterial $sql = "INSERT INTO comMaterial
(FOrgid,MaterialId,MaterialTypeId,MaterialCategoryId,CreatorId,CreateTime,IsInUsed) (FOrgid,MaterialId,MaterialTypeId,MaterialCategoryId,CreatorId,CreateTime,IsInUsed)
VALUES ('1000',:MaterialId,'10','A',:CreatorId,:CreateTime,1)"; VALUES ('1000',:MaterialId,'10','A',:CreatorId,:CreateTime,1)";
@ -359,21 +495,37 @@ function T8Insert($data, $facilityno, $connT8)
$stmt->bindParam(':CreatorId', $user_id); $stmt->bindParam(':CreatorId', $user_id);
$stmt->bindParam(':CreateTime', $createTime); $stmt->bindParam(':CreateTime', $createTime);
$stmt->execute(); $stmt->execute();
// 階段收款資訊 // 階段收款資訊
$salOrderStagePay_row = []; $salOrderStagePay_row = [];
$equipment_total = 0; $equipment_total = 0;
$install_total = 0; $install_total = 0;
$equipment_total = $pay_arr['equipment_total']; $equipment_total = $pay_arr['equipment_total'];
$install_total = $pay_arr['install_total']; $install_total = $pay_arr['install_total'];
$count_a = 0;
$count_month = 1;
foreach ($pay_arr['elevotor_pay_detail'] as $key => $detail) { foreach ($pay_arr['elevotor_pay_detail'] as $key => $detail) {
if ($detail['kind'] == 3) {
$PlanPayDate = $contract_arrival_a;
} else if ($detail['kind'] > 3) {
$PlanPayDate = date("Y-m-d", strtotime($contract_arrival_a . '+' . $count_month . ' month'));
$count_month++;
} else {
$PlanPayDate = $signing_date;
$count_a++;
if ($count_a == 1) {
$PlanPayDate = date("Y-m-d", strtotime($signing_date . '+' . $count_a . ' month'));
}
}
$contract_arrival_date = intval(str_replace("-", '', $PlanPayDate)); //貨到工地日
$PayStage = $pay_kind[$detail['kind']]; $PayStage = $pay_kind[$detail['kind']];
$PlanPercentage = intval($detail['pay_scale']) / 100; $PlanPercentage = intval($detail['pay_scale']) / 100;
$rows = [ $rows = [
"PayStage" => "$PayStage", //收款階段 "PayStage" => "$PayStage", //收款階段
"PlanPercentage" => $PlanPercentage, //計劃收款比例(%) "PlanPercentage" => $PlanPercentage, //計劃收款比例(%)
"PlanPayAmt" => $detail['amount'], //計劃收款金額 "PlanPayAmt" => $detail['amount'], //計劃收款金額
"PlanPayDate" => 20240101, //計劃收款日期 1.第一筆都是簽約日 "PlanPayDate" => $contract_arrival_date, //計劃收款日期 1.第一筆都是簽約日
"BillNo" => "$contractno", "BillNo" => "$contractno",
"RowCode" => $key + 1, "RowCode" => $key + 1,
"RowNo" => $key + 1, "RowNo" => $key + 1,
@ -393,7 +545,8 @@ function T8Insert($data, $facilityno, $connT8)
"MaterialId" => "A40001", //1.設備(A40001)、2.安裝(A4008)、3.作番號(作番) "MaterialId" => "A40001", //1.設備(A40001)、2.安裝(A4008)、3.作番號(作番)
"SUnitId" => "SET", "SUnitId" => "SET",
"SQuantity" => 1, //交易數量 "SQuantity" => 1, //交易數量
"SPrice" => $equipment_total //交易價格 "SPrice" => $equipment_total, //交易價格
"CU_MaterialId" => $facility_no
]; ];
$count++; $count++;
// 安裝 // 安裝
@ -407,7 +560,8 @@ function T8Insert($data, $facilityno, $connT8)
"MaterialId" => "A40008", //1.設備(A40001)、2.安裝(A4008)、3.作番號(作番) "MaterialId" => "A40008", //1.設備(A40001)、2.安裝(A4008)、3.作番號(作番)
"SUnitId" => "SET", "SUnitId" => "SET",
"SQuantity" => 1, //交易數量 "SQuantity" => 1, //交易數量
"SPrice" => $install_total //交易價格 "SPrice" => $install_total, //交易價格
"CU_MaterialId" => $facility_no
]; ];
$count++; $count++;
// 產品(作番) // 產品(作番)
@ -421,7 +575,8 @@ function T8Insert($data, $facilityno, $connT8)
"MaterialId" => "$facility_no", //1.設備(A40001)、2.安裝(A4008)、3.作番號(作番) "MaterialId" => "$facility_no", //1.設備(A40001)、2.安裝(A4008)、3.作番號(作番)
"SUnitId" => "SET", "SUnitId" => "SET",
"SQuantity" => 1, //交易數量 "SQuantity" => 1, //交易數量
"SPrice" => 0 //交易價格 "SPrice" => 0, //交易價格
"CU_MaterialId" => $facility_no // 歸屬作番號
]; ];
$count++; $count++;
$SubOrder_row[] = $row1; $SubOrder_row[] = $row1;
@ -440,12 +595,13 @@ function T8Insert($data, $facilityno, $connT8)
"CurrId" => "TWD", "CurrId" => "TWD",
"CurrOAmount" => 1, "CurrOAmount" => 1,
"CurrLAmount" => 1, "CurrLAmount" => 1,
"PersonId" => "$user_id", //業務人員 "PersonId" => "$salesman", //業務人員
"DueToId" => "$contractno", //債務方 "DueToId" => "$contractno", //債務方
"TradeConditionId" => "", "TradeConditionId" => "",
"TaxId" => "ST005", "TaxId" => "ST005",
"CreditorCompId" => "1001", "CreditorCompId" => "1001",
"CreditorOrgId" => "1000", "CreditorOrgId" => "1000",
"CreatorId" => "$user_id"
// "CompId" => "1001", // "CompId" => "1001",
// "CreditorCurrOAmount" => 1, // "CreditorCurrOAmount" => 1,
// "CreditorCurrLAmount" => 1 // "CreditorCurrLAmount" => 1
@ -460,7 +616,7 @@ function T8Insert($data, $facilityno, $connT8)
]; ];
$salOrderStagePay = [ $salOrderStagePay = [
"name" => "salOrderStagePay", "name" => "salOrderStagePay",
"rows" => [$salOrderStagePay_row] "rows" => $salOrderStagePay_row
]; ];
$API_body = []; $API_body = [];
@ -473,9 +629,15 @@ function T8Insert($data, $facilityno, $connT8)
$api_url = "https://erp.masada.com.tw:780/twWebAPI/V1/SALSALESORDER/PostERPData"; $api_url = "https://erp.masada.com.tw:780/twWebAPI/V1/SALSALESORDER/PostERPData";
$result = T8salIncomeApply($API_body, $api_url); $result = T8salIncomeApply($API_body, $api_url);
echo "<pre>"; // echo "<pre>";
print_r($result); // print_r($result);
echo "</pre>"; // echo "</pre>";
if ($result['Status'] == 'Fails' || $result['Status'] == 'Error') {
echo $result['ErrorMsg'];
}
} else {
echo '資料已新增過,請洽資訊人員';
}
$connT8->commit(); $connT8->commit();
} catch (PDOException $e) { } catch (PDOException $e) {
$connT8->rollback(); $connT8->rollback();
@ -487,10 +649,7 @@ function T8Insert($data, $facilityno, $connT8)
function BounsCount($data, $conn, $facilityno) function BounsCount($data, $conn, $facilityno)
{ {
// echo '<pre>'; try {
// print_r($facilityno);
// echo '</pre>';
// exit;
require_once("../../bonus/elevator_new/elevator_new_deal_bonus.php"); require_once("../../bonus/elevator_new/elevator_new_deal_bonus.php");
$dailyNecessities = [ $dailyNecessities = [
'MAE100' => 'passenger', //小機房 'MAE100' => 'passenger', //小機房
@ -575,8 +734,9 @@ function BounsCount($data, $conn, $facilityno)
} else if ($signing_date >= $bonus_v2_0_date) { } else if ($signing_date >= $bonus_v2_0_date) {
$ver = '2.0'; $ver = '2.0';
foreach ($elevators as $key => $elevator) { foreach ($elevators as $key => $elevator) {
$option_other_price = !empty($elevator['option_other_price']) ? intval($elevator['option_other_price']) : 0;
$elevator_type = $dailyNecessities[$elevator['spec']]; $elevator_type = $dailyNecessities[$elevator['spec']];
$elevator_list_price = $elevator['option_other_price'] + $elevator['option_price'] + $elevator['elevator_price']; $elevator_list_price = $option_other_price + $elevator['option_price'] + $elevator['elevator_price'];
$elevator_knockdown_price = $elevator['elevator_price']; $elevator_knockdown_price = $elevator['elevator_price'];
$commission_fee = $elevator['commission_fee']; $commission_fee = $elevator['commission_fee'];
$result_bonus = elevator_new_deal_bonus_v2_0( $result_bonus = elevator_new_deal_bonus_v2_0(
@ -630,10 +790,27 @@ function BounsCount($data, $conn, $facilityno)
} }
} }
return $request; return $request;
try {
} catch (PDOException $e) { } catch (PDOException $e) {
header("HTTP/1.1 500 Internal Server Error"); header("HTTP/1.1 500 Internal Server Error");
die('Error!:' . $e->getMessage()); die('Error!:' . $e->getMessage());
} }
} }
function do_wws_assign1($user_id, $form_id, $flow_code, $conn)
{
$tds = date("Y-m-d H:i:s");
$sql = "select appwms.nextval('form_key') form_key";
$stmt = $conn->prepare($sql);
$stmt->execute();
$result = $stmt->fetch(PDO::FETCH_ASSOC);
$form_key = $result['form_key'];
$sql = "INSERT INTO flow (system_id, flow_id, form_key, form_id,flow_code) VALUES ('wws', 'wws01', '$form_key', '$form_id','$flow_code');";
$stmt = $conn->prepare($sql);
$stmt->execute();
$sql = "INSERT INTO subflow (form_key, seq, current_assigner, create_date) VALUES ('$form_key', '1', '$user_id', '$tds');";
$stmt = $conn->prepare($sql);
$stmt->execute();
}

379
wms/contract/api/test copy.json

@ -3,22 +3,23 @@
"name": "MainSalesOrder", "name": "MainSalesOrder",
"rows": [ "rows": [
{ {
"BillNo": "M24020076", "BillNo": "M23110121",
"BillDate": 20240305, "BillDate": 20240313,
"TypeId": "SO", "TypeId": "SO",
"FOrgId": "1000", "FOrgId": "1000",
"OrgId": "1000", "OrgId": "1000",
"ModeId": "M", "ModeId": "M",
"BizPartnerId": "M24020076", "BizPartnerId": "M23110121",
"CurrId": "TWD", "CurrId": "TWD",
"CurrOAmount": 1, "CurrOAmount": 1,
"CurrLAmount": 1, "CurrLAmount": 1,
"PersonId": "M0225", "PersonId": "M0042",
"DueToId": "M24020076", "DueToId": "M23110121",
"TradeConditionId": "", "TradeConditionId": "",
"TaxId": "ST005", "TaxId": "ST005",
"CreditorCompId": "1001", "CreditorCompId": "1001",
"CreditorOrgId": "1000" "CreditorOrgId": "1000",
"CreatorId": "M0225"
} }
] ]
}, },
@ -27,87 +28,371 @@
"rows": [ "rows": [
{ {
"TaxId": "ST005", "TaxId": "ST005",
"RequirementDate": 20240305, "RequirementDate": 20240313,
"ConsignmentDate": 20240305, "ConsignmentDate": 20240313,
"BillNo": "M24020076", "BillNo": "M23110121",
"RowCode": 1, "RowCode": 1,
"ItemType": 1, "ItemType": 1,
"MaterialId": "A40001", "MaterialId": "A40001",
"SUnitId": "SET", "SUnitId": "SET",
"SQuantity": 1, "SQuantity": 1,
"SPrice": 910000 "SPrice": 3904000,
"CU_MaterialId": "4MH00836"
}, },
{ {
"TaxId": "ST005", "TaxId": "ST005",
"RequirementDate": 20240305, "RequirementDate": 20240313,
"ConsignmentDate": 20240305, "ConsignmentDate": 20240313,
"BillNo": "M24020076", "BillNo": "M23110121",
"RowCode": 2, "RowCode": 2,
"ItemType": 1, "ItemType": 1,
"MaterialId": "A40008", "MaterialId": "A40008",
"SUnitId": "SET", "SUnitId": "SET",
"SQuantity": 1, "SQuantity": 1,
"SPrice": 390000 "SPrice": 976000,
"CU_MaterialId": "4MH00836"
}, },
{ {
"TaxId": "ST005", "TaxId": "ST005",
"RequirementDate": 20240305, "RequirementDate": 20240313,
"ConsignmentDate": 20240305, "ConsignmentDate": 20240313,
"BillNo": "M24020076", "BillNo": "M23110121",
"RowCode": 3, "RowCode": 3,
"ItemType": 0, "ItemType": 0,
"MaterialId": "4MW00705", "MaterialId": "4MH00836",
"SUnitId": "SET", "SUnitId": "SET",
"SQuantity": 1, "SQuantity": 1,
"SPrice": 0 "SPrice": 0,
"CU_MaterialId": "4MH00836"
},
{
"TaxId": "ST005",
"RequirementDate": 20240313,
"ConsignmentDate": 20240313,
"BillNo": "M23110121",
"RowCode": 1,
"ItemType": 1,
"MaterialId": "A40001",
"SUnitId": "SET",
"SQuantity": 1,
"SPrice": 3904000,
"CU_MaterialId": "4MH00837"
},
{
"TaxId": "ST005",
"RequirementDate": 20240313,
"ConsignmentDate": 20240313,
"BillNo": "M23110121",
"RowCode": 2,
"ItemType": 1,
"MaterialId": "A40008",
"SUnitId": "SET",
"SQuantity": 1,
"SPrice": 976000,
"CU_MaterialId": "4MH00837"
},
{
"TaxId": "ST005",
"RequirementDate": 20240313,
"ConsignmentDate": 20240313,
"BillNo": "M23110121",
"RowCode": 3,
"ItemType": 0,
"MaterialId": "4MH00837",
"SUnitId": "SET",
"SQuantity": 1,
"SPrice": 0,
"CU_MaterialId": "4MH00837"
},
{
"TaxId": "ST005",
"RequirementDate": 20240313,
"ConsignmentDate": 20240313,
"BillNo": "M23110121",
"RowCode": 1,
"ItemType": 1,
"MaterialId": "A40001",
"SUnitId": "SET",
"SQuantity": 1,
"SPrice": 3904000,
"CU_MaterialId": "4MH00838"
},
{
"TaxId": "ST005",
"RequirementDate": 20240313,
"ConsignmentDate": 20240313,
"BillNo": "M23110121",
"RowCode": 2,
"ItemType": 1,
"MaterialId": "A40008",
"SUnitId": "SET",
"SQuantity": 1,
"SPrice": 976000,
"CU_MaterialId": "4MH00838"
},
{
"TaxId": "ST005",
"RequirementDate": 20240313,
"ConsignmentDate": 20240313,
"BillNo": "M23110121",
"RowCode": 3,
"ItemType": 0,
"MaterialId": "4MH00838",
"SUnitId": "SET",
"SQuantity": 1,
"SPrice": 0,
"CU_MaterialId": "4MH00838"
},
{
"TaxId": "ST005",
"RequirementDate": 20240313,
"ConsignmentDate": 20240313,
"BillNo": "M23110121",
"RowCode": 1,
"ItemType": 1,
"MaterialId": "A40001",
"SUnitId": "SET",
"SQuantity": 1,
"SPrice": 3904000,
"CU_MaterialId": "4MH00839"
},
{
"TaxId": "ST005",
"RequirementDate": 20240313,
"ConsignmentDate": 20240313,
"BillNo": "M23110121",
"RowCode": 2,
"ItemType": 1,
"MaterialId": "A40008",
"SUnitId": "SET",
"SQuantity": 1,
"SPrice": 976000,
"CU_MaterialId": "4MH00839"
},
{
"TaxId": "ST005",
"RequirementDate": 20240313,
"ConsignmentDate": 20240313,
"BillNo": "M23110121",
"RowCode": 3,
"ItemType": 0,
"MaterialId": "4MH00839",
"SUnitId": "SET",
"SQuantity": 1,
"SPrice": 0,
"CU_MaterialId": "4MH00839"
},
{
"TaxId": "ST005",
"RequirementDate": 20240313,
"ConsignmentDate": 20240313,
"BillNo": "M23110121",
"RowCode": 1,
"ItemType": 1,
"MaterialId": "A40001",
"SUnitId": "SET",
"SQuantity": 1,
"SPrice": 3904000,
"CU_MaterialId": "4MH00840"
},
{
"TaxId": "ST005",
"RequirementDate": 20240313,
"ConsignmentDate": 20240313,
"BillNo": "M23110121",
"RowCode": 2,
"ItemType": 1,
"MaterialId": "A40008",
"SUnitId": "SET",
"SQuantity": 1,
"SPrice": 976000,
"CU_MaterialId": "4MH00840"
},
{
"TaxId": "ST005",
"RequirementDate": 20240313,
"ConsignmentDate": 20240313,
"BillNo": "M23110121",
"RowCode": 3,
"ItemType": 0,
"MaterialId": "4MH00840",
"SUnitId": "SET",
"SQuantity": 1,
"SPrice": 0,
"CU_MaterialId": "4MH00840"
},
{
"TaxId": "ST005",
"RequirementDate": 20240313,
"ConsignmentDate": 20240313,
"BillNo": "M23110121",
"RowCode": 1,
"ItemType": 1,
"MaterialId": "A40001",
"SUnitId": "SET",
"SQuantity": 1,
"SPrice": 3904000,
"CU_MaterialId": "4MH00841"
},
{
"TaxId": "ST005",
"RequirementDate": 20240313,
"ConsignmentDate": 20240313,
"BillNo": "M23110121",
"RowCode": 2,
"ItemType": 1,
"MaterialId": "A40008",
"SUnitId": "SET",
"SQuantity": 1,
"SPrice": 976000,
"CU_MaterialId": "4MH00841"
},
{
"TaxId": "ST005",
"RequirementDate": 20240313,
"ConsignmentDate": 20240313,
"BillNo": "M23110121",
"RowCode": 3,
"ItemType": 0,
"MaterialId": "4MH00841",
"SUnitId": "SET",
"SQuantity": 1,
"SPrice": 0,
"CU_MaterialId": "4MH00841"
},
{
"TaxId": "ST005",
"RequirementDate": 20240313,
"ConsignmentDate": 20240313,
"BillNo": "M23110121",
"RowCode": 1,
"ItemType": 1,
"MaterialId": "A40001",
"SUnitId": "SET",
"SQuantity": 1,
"SPrice": 3904000,
"CU_MaterialId": "4MH00842"
},
{
"TaxId": "ST005",
"RequirementDate": 20240313,
"ConsignmentDate": 20240313,
"BillNo": "M23110121",
"RowCode": 2,
"ItemType": 1,
"MaterialId": "A40008",
"SUnitId": "SET",
"SQuantity": 1,
"SPrice": 976000,
"CU_MaterialId": "4MH00842"
},
{
"TaxId": "ST005",
"RequirementDate": 20240313,
"ConsignmentDate": 20240313,
"BillNo": "M23110121",
"RowCode": 3,
"ItemType": 0,
"MaterialId": "4MH00842",
"SUnitId": "SET",
"SQuantity": 1,
"SPrice": 0,
"CU_MaterialId": "4MH00842"
},
{
"TaxId": "ST005",
"RequirementDate": 20240313,
"ConsignmentDate": 20240313,
"BillNo": "M23110121",
"RowCode": 1,
"ItemType": 1,
"MaterialId": "A40001",
"SUnitId": "SET",
"SQuantity": 1,
"SPrice": 3904000,
"CU_MaterialId": "4MH00843"
},
{
"TaxId": "ST005",
"RequirementDate": 20240313,
"ConsignmentDate": 20240313,
"BillNo": "M23110121",
"RowCode": 2,
"ItemType": 1,
"MaterialId": "A40008",
"SUnitId": "SET",
"SQuantity": 1,
"SPrice": 976000,
"CU_MaterialId": "4MH00843"
},
{
"TaxId": "ST005",
"RequirementDate": 20240313,
"ConsignmentDate": 20240313,
"BillNo": "M23110121",
"RowCode": 3,
"ItemType": 0,
"MaterialId": "4MH00843",
"SUnitId": "SET",
"SQuantity": 1,
"SPrice": 0,
"CU_MaterialId": "4MH00843"
} }
] ]
}, },
{ {
"name": "salOrderStagePay", "name": "salOrderStagePay",
"rows": [ "rows": [
[
{ {
"PayStage": "簽約", "PayStage": "簽約",
"PlanPercentage": 0.2, "PlanPercentage": 0.2,
"PlanPayAmt": 260000, "PlanPayAmt": 976000,
"PlanPayDate": 20240101, "PlanPayDate": 20240413,
"BillNo": "M24020076", "BillNo": "M23110121",
"RowCode": 0,
"RowNo": 0,
"UnWriteOffOAmount": 260000
},
{
"PayStage": "貨抵工地",
"PlanPercentage": 0.5,
"PlanPayAmt": 650000,
"PlanPayDate": 20240101,
"BillNo": "M24020076",
"RowCode": 1, "RowCode": 1,
"RowNo": 1, "RowNo": 1,
"UnWriteOffOAmount": 650000 "UnWriteOffOAmount": 976000
}, },
{ {
"PayStage": "試車完工", "PayStage": "二次款",
"PlanPercentage": 0.2, "PlanPercentage": 0.4,
"PlanPayAmt": 260000, "PlanPayAmt": 1952000,
"PlanPayDate": 20240101, "PlanPayDate": 20240313,
"BillNo": "M24020076", "BillNo": "M23110121",
"RowCode": 2, "RowCode": 2,
"RowNo": 2, "RowNo": 2,
"UnWriteOffOAmount": 260000 "UnWriteOffOAmount": 1952000
}, },
{ {
"PayStage": "交車", "PayStage": "貨抵工地",
"PlanPercentage": 0.1, "PlanPercentage": 0.2,
"PlanPayAmt": 130000, "PlanPayAmt": 976000,
"PlanPayDate": 20240101, "PlanPayDate": 20241104,
"BillNo": "M24020076", "BillNo": "M23110121",
"RowCode": 3, "RowCode": 3,
"RowNo": 3, "RowNo": 3,
"UnWriteOffOAmount": 130000 "UnWriteOffOAmount": 976000
},
{
"PayStage": "試車完工",
"PlanPercentage": 0.1,
"PlanPayAmt": 488000,
"PlanPayDate": 20241204,
"BillNo": "M23110121",
"RowCode": 4,
"RowNo": 4,
"UnWriteOffOAmount": 488000
},
{
"PayStage": "交車",
"PlanPercentage": 0.1,
"PlanPayAmt": 488000,
"PlanPayDate": 20250104,
"BillNo": "M23110121",
"RowCode": 5,
"RowNo": 5,
"UnWriteOffOAmount": 488000
} }
] ]
]
} }
] ]

127
wms/contract/api/testT8API.php

@ -1,9 +1,5 @@
<?php <?php
// [
// {
// //salSalesOrder
// "name": "MainSalesOrder",
// "rows": [
// { // {
// "BillNo": "Z001", //合約單號 // "BillNo": "Z001", //合約單號
// "BillDate": 20210420, //簽約日期 // "BillDate": 20210420, //簽約日期
@ -70,27 +66,55 @@ require_once("../../T8_Authorization_from_bpm.php");
$api_url = "https://erp.masada.com.tw:780/twWebAPI/V1/SALSALESORDER/PostERPData"; $api_url = "https://erp.masada.com.tw:780/twWebAPI/V1/SALSALESORDER/PostERPData";
$validation = get_Auth(); $validation = get_Auth();
// $header = [
// "CHI_Authorization :" . $validation,
// "GroupId:TEST"
// ];
// $url = "https://erp.masada.com.tw:780/twWebAPI/V1/GLFEEWRITEOFF/DeleteERPData?pkValue=M24020032";
// $ch = curl_init();
// curl_setopt($ch, CURLOPT_URL, $url);
// curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
// $response = curl_exec($ch);
// if ($response === false) {
// echo 'Curl error: ' . curl_error($ch);
// } else {
// $result = json_decode($response, true);
// // 若 API 傳入失敗。
// if ($result['Status'] == 'Erroe') {
// echo 'API傳入失敗,' . $result['ErrorMsg'];
// print_r($result);
// } else {
// // print_r($result);
// print_r($result);
// }
// print_r($result);
// }
// curl_close($ch);
// exit();
$contract_no = "M24020003";
// $contract_no = "M24010109";
$MainSalesOrder_row = [ $MainSalesOrder_row = [
"BillNo" => "M24020076", //合約單號 "BillNo" => "$contract_no", //合約單號
"BillDate" => 20210420, //簽約日期 "BillDate" => 20210420, //簽約日期
"TypeId" => "SO", // "TypeId" => "SO", //
"FOrgId" => "1000", "FOrgId" => "1000",
"OrgId" => "1000", "OrgId" => "1000",
"ModeId" => "M", // T汰改 M新梯 "ModeId" => "M", // T汰改 M新梯
"BizPartnerId" => "M24020076", //客戶代碼 "BizPartnerId" => "$contract_no", //客戶代碼
"CurrId" => "TWD", "CurrId" => "TWD",
"CurrOAmount" => 1, "CurrOAmount" => 1,
"CurrLAmount" => 1, "CurrLAmount" => 1,
"PersonId" => "M0225", //業務人員 "PersonId" => "M0177", //業務人員
"DueToId" => "M24020076", //債務方 "DueToId" => "$contract_no", //債務方
"TradeConditionId" => "", "TradeConditionId" => "",
"TaxId" => "ST005", "TaxId" => "ST005",
"CreditorCompId" => "1001", "CreditorCompId" => "1001",
"CreditorOrgId" => "1000", "CreditorOrgId" => "1000",
// "CompId" => "1001", "CreatorId" => "M0225"
// "CreditorCurrOAmount" => 1,
// "CreditorCurrLAmount" => 1
]; ];
// //salSalesOrderDetail // //salSalesOrderDetail
// $SubOrder_row = []; // $SubOrder_row = [];
@ -104,13 +128,13 @@ for ($i = 0; $i < 3; $i++) {
"ConsignmentDate" => 20210420, //發貨日期 "ConsignmentDate" => 20210420, //發貨日期
// "DispatchCompId" => "1001", // "DispatchCompId" => "1001",
// "DispatchOrgId" => "1000", // "DispatchOrgId" => "1000",
"BillNo" => "M24020076", //合約號 "BillNo" => "$contract_no", //合約號
"RowCode" => $i, //全部筆數排列 "RowCode" => $i, //全部筆數排列
"ItemType" => 1, "ItemType" => 1,
"MaterialId" => "A40001", //1.設備(A40001)、2.安裝(A4008)、3.作番號(作番) "MaterialId" => "A40001", //1.設備(A40001)、2.安裝(A4008)、3.作番號(作番)
"SUnitId" => "SET", "SUnitId" => "SET",
"SQuantity" => 1, //交易數量 "SQuantity" => 1, //交易數量
"SPrice" => 50000 //交易價格 "SPrice" => 100000 //交易價格
]; ];
} }
if ($i == 1) { if ($i == 1) {
@ -122,25 +146,21 @@ for ($i = 0; $i < 3; $i++) {
"ConsignmentDate" => 20210420, //發貨日期 "ConsignmentDate" => 20210420, //發貨日期
// "DispatchCompId" => "1001", // "DispatchCompId" => "1001",
// "DispatchOrgId" => "1000", // "DispatchOrgId" => "1000",
"BillNo" => "M24020076", //合約號 "BillNo" => "$contract_no", //合約號
"RowCode" => $i, //全部筆數排列 "RowCode" => $i, //全部筆數排列
"ItemType" => 1, "ItemType" => 1,
"MaterialId" => "A40008", //1.設備(A40001)、2.安裝(A4008)、3.作番號(作番) "MaterialId" => "A40008", //1.設備(A40001)、2.安裝(A4008)、3.作番號(作番)
"SUnitId" => "SET", "SUnitId" => "SET",
"SQuantity" => 1, //交易數量 "SQuantity" => 1, //交易數量
"SPrice" => 700000 //交易價格 "SPrice" => 650000 //交易價格
]; ];
} }
if ($i == 2) { if ($i == 2) {
$row = [ $row = [
// "SupplyCompId" => "1001",
// "SupplyOrgId" => "1000",
"TaxId" => "ST005", "TaxId" => "ST005",
"RequirementDate" => 20210420, //出貨日期 "RequirementDate" => 20210420, //出貨日期
"ConsignmentDate" => 20210420, //發貨日期 "ConsignmentDate" => 20210420, //發貨日期
// "DispatchCompId" => "1001", "BillNo" => "$contract_no", //合約號
// "DispatchOrgId" => "1000",
"BillNo" => "M24020076", //合約號
"RowCode" => $i, //全部筆數排列 "RowCode" => $i, //全部筆數排列
"ItemType" => 0, "ItemType" => 0,
"MaterialId" => "4MH00669", //1.設備(A40001)、2.安裝(A4008)、3.作番號(作番) "MaterialId" => "4MH00669", //1.設備(A40001)、2.安裝(A4008)、3.作番號(作番)
@ -152,65 +172,14 @@ for ($i = 0; $i < 3; $i++) {
$SubOrder_row[] = $row; $SubOrder_row[] = $row;
} }
// // $salOrderStagePay_row = [];
// // // for ($i = 0; $i < 2; $i) {
// // // if ($i == 0) {
// // // $row = [
// // // "BillNo" => "M24010201",
// // // "RowCode" => 1,
// // // "RowNo" => 1,
// // // "PayStage" => "簽約", //收款階段
// // // "PlanPercentage" => 0.10, //計劃收款比例(%)
// // // "PlanPayAmt" => 100000, //計劃收款金額
// // // "PlanPayDate" => 20240101, //計劃收款日期 1.第一筆都是簽約日
// // // "UnWriteOffOAmount" => 100000 //未核銷金額
// // // ];
// // // }
// // // if ($i == 1) {
// // // $row = [
// // // "BillNo" => "M24010201",
// // // "RowCode" => 1,
// // // "RowNo" => 1,
// // // "PayStage" => "貨抵工地", //收款階段
// // // "PlanPercentage" => 0.40, //計劃收款比例(%)
// // // "PlanPayAmt" => 100000, //計劃收款金額
// // // "PlanPayDate" => 20240101, //計劃收款日期 1.第一筆都是簽約日
// // // "UnWriteOffOAmount" => 100000 //未核銷金額
// // // ];
// // // }
// // // if ($i == 2) {
// // // $row = [
// // // "BillNo" => "M24010201",
// // // "RowCode" => 1,
// // // "RowNo" => 1,
// // // "PayStage" => "試車完工", //收款階段
// // // "PlanPercentage" => 0.30, //計劃收款比例(%)
// // // "PlanPayAmt" => 100000, //計劃收款金額
// // // "PlanPayDate" => 20240101, //計劃收款日期 1.第一筆都是簽約日
// // // "UnWriteOffOAmount" => 100000 //未核銷金額
// // // ];
// // // }
// // // if ($i == 3) {
// // // $row = [
// // // "BillNo" => "M24010201",
// // // "RowCode" => 1,
// // // "RowNo" => 1,
// // // "PayStage" => "交車", //收款階段
// // // "PlanPercentage" => 0.20, //計劃收款比例(%)
// // // "PlanPayAmt" => 100000, //計劃收款金額
// // // "PlanPayDate" => 20240101, //計劃收款日期 1.第一筆都是簽約日
// // // "UnWriteOffOAmount" => 100000 //未核銷金額
// // // ];
// // // }
// // // $salOrderStagePay_row[] = $row;
// // // }
$salOrderStagePay_row = []; $salOrderStagePay_row = [];
$roww = [ $roww = [
"PayStage" => "簽約", //收款階段 "PayStage" => "簽約", //收款階段
"PlanPercentage" => 0.5, //計劃收款比例(%) "PlanPercentage" => 0.5, //計劃收款比例(%)
"PlanPayAmt" => 375000, //計劃收款金額 "PlanPayAmt" => 375000, //計劃收款金額
"PlanPayDate" => 20240101, //計劃收款日期 1.第一筆都是簽約日 "PlanPayDate" => 20240101, //計劃收款日期 1.第一筆都是簽約日
"BillNo" => "M24020076", "BillNo" => "$contract_no",
"RowCode" => 1, "RowCode" => 1,
"RowNo" => 1, "RowNo" => 1,
"UnWriteOffOAmount" => 375000 //未核銷金額 "UnWriteOffOAmount" => 375000 //未核銷金額
@ -220,12 +189,14 @@ $roww2 = [
"PlanPercentage" => 0.5, "PlanPercentage" => 0.5,
"PlanPayAmt" => 375000, "PlanPayAmt" => 375000,
"PlanPayDate" => 20240101, "PlanPayDate" => 20240101,
"BillNo" => "M24020076", "BillNo" => "$contract_no",
"RowCode" => 2, "RowCode" => 2,
"RowNo" => 2, "RowNo" => 2,
"UnWriteOffOAmount" => 375000 "UnWriteOffOAmount" => 375000
]; ];
$salOrderStagePay_row[] = $roww; $salOrderStagePay_row[] = $roww;
$salOrderStagePay_row[] = $roww2;
$MainSalesOrder = [ $MainSalesOrder = [
"name" => "MainSalesOrder", "name" => "MainSalesOrder",
@ -250,9 +221,9 @@ $APIbody[] = $salOrderStagePay;
// print_r($data); // print_r($data);
// echo "</pre>"; // echo "</pre>";
// echo "<pre>"; echo "<pre>";
// print_r(json_encode($APIbody, JSON_UNESCAPED_UNICODE)); print_r(json_encode($APIbody, JSON_UNESCAPED_UNICODE));
// echo "</pre>"; echo "</pre>";
// exit(); // exit();
$header = [ $header = [

14
wms/contract/contract-newelevator-input.php

@ -134,7 +134,17 @@ $persons = array_map(function ($person) {
</td> </td>
</tr> </tr>
<tr> <tr>
<td style="vertical-align: middle">區域</td>
<td>
<select id="area_no" name="area_no" x-model="data.area_no">
<option value="">請選擇</option>
<option value="N">北區</option>
<option value="Y">宜蘭</option>
<option value="T">桃園</option>
<option value="C">中區</option>
<option value="K">南區</option>
</select>
</td>
</tr> </tr>
</tbody> </tbody>
</template> </template>
@ -187,7 +197,7 @@ $persons = array_map(function ($person) {
<tr> <tr>
<td style="vertical-align: middle">QC和官檢</td> <td style="vertical-align: middle">QC和官檢</td>
<td> <td>
<select class="" id="qc" x-model="data.qc"> <select class="" id="qc" x-model="elevator.qc">
<option value="">請選擇QC或官檢</option> <option value="">請選擇QC或官檢</option>
<option value="Q">只需QC</option> <option value="Q">只需QC</option>
<option value="O">只需官檢</option> <option value="O">只需官檢</option>

13
wms/contract/js/alpine.js

@ -829,6 +829,8 @@ const contractNewInput = () => {
elevators_detail_arr: [], // 電梯台數 Array elevators_detail_arr: [], // 電梯台數 Array
pay_arr: [], //電梯付款種類 pay_arr: [], //電梯付款種類
nums: 0, //電梯數量 nums: 0, //電梯數量
area_no: 'T',
contract_arrival_date: ''
}, },
step: 1, step: 1,
isLoading: false, isLoading: false,
@ -868,14 +870,15 @@ const contractNewInput = () => {
this.data.elevators_detail_arr[i].longitude = ''; // 緯度 this.data.elevators_detail_arr[i].longitude = ''; // 緯度
this.data.elevators_detail_arr[i].manage = ''; // 工地負責人 this.data.elevators_detail_arr[i].manage = ''; // 工地負責人
this.data.elevators_detail_arr[i].qc = ''; // QC和官檢 this.data.elevators_detail_arr[i].qc = ''; // QC和官檢
this.data.elevators_detail_arr[i].contract_arrival_date = ''; //合約交期(到工地) this.data.elevators_detail_arr[i].contract_arrival_date = this.data.contract_arrival_date; //合約交期(到工地)
// this.data.elevators_detail_arr[i].area_no = ''; //區域
} }
this.step = 3; this.step = 3;
this.isLoading = false; this.isLoading = false;
} else if (this.step == 3) { } else if (this.step == 3) {
console.log(this.data.elevators_detail_arr); console.log(this.data.elevators_detail_arr);
this.step = 4; // this.step = 4;
this.isLoading = false; // this.isLoading = false;
} }
}, },
getContractDate() { getContractDate() {
@ -889,7 +892,7 @@ const contractNewInput = () => {
return return
} }
if (!this.customize) { if (!this.customize) {
console.log(res.data); console.log(res.data.customer);
this.data.customer = res.data.company this.data.customer = res.data.company
this.data.manager = res.data.manager this.data.manager = res.data.manager
this.data.vat = res.data.uscc this.data.vat = res.data.uscc
@ -904,6 +907,7 @@ const contractNewInput = () => {
this.data.elevators_detail_arr = res.data.elevators_detail_arr; this.data.elevators_detail_arr = res.data.elevators_detail_arr;
this.data.nums = res.data.nums; this.data.nums = res.data.nums;
this.data.pay_arr = res.data.pay_arr; this.data.pay_arr = res.data.pay_arr;
this.data.contract_arrival_date = res.data.facilitok_date;
} }
this.step = 2 this.step = 2
this.isLoading = false this.isLoading = false
@ -919,6 +923,7 @@ const contractNewInput = () => {
form.append('customer', this.data.customer); form.append('customer', this.data.customer);
form.append('manager', this.data.manager); form.append('manager', this.data.manager);
form.append('vat', this.data.vat); form.append('vat', this.data.vat);
form.append('area_no', this.data.area_no);
form.append('case_name', this.data.case_name); form.append('case_name', this.data.case_name);
form.append('linkman', this.data.linkman); form.append('linkman', this.data.linkman);
form.append('lm_tel', this.data.lm_tel); form.append('lm_tel', this.data.lm_tel);

Loading…
Cancel
Save