Browse Source

Merge branch 'main' into gary

gary
gary_chen\gary_chen 1 year ago
parent
commit
79bbb0c397
  1. BIN
      wms/account-receivable-facility.xlsx
  2. 1036
      wms/account-receivable-index.php
  3. 1062
      wms/account-receivable-renovate-index.php
  4. BIN
      wms/account-receivable-test.xlsx
  5. 6
      wms/contract-repair/api/bpmAPI.php
  6. 85
      wms/contract-repair/api/putContractData.php
  7. 1
      wms/contract-repair/contract-repair-input.php
  8. 2
      wms/contract-repair/contract-repair-management.php
  9. 32
      wms/contract/api/T8salIncomeApply.php
  10. 23
      wms/contract/api/postContractData.php
  11. 123
      wms/contract/api/testT8API.php
  12. 69
      wms/contract/testT8API.php
  13. 16
      wms/css/function.js
  14. 1
      wms/excel-upload.php
  15. 3
      wms/frame/api_getdata.php
  16. 195
      wms/frame/pending.php
  17. 57
      wms/fun_global.php
  18. 40
      wms/mkt/assets/js/alpine.js
  19. 6
      wms/mkt/price_normal-index.php
  20. 2
      wms/mkt/price_option-index.php
  21. 2
      wms/mkt/price_option-select.php
  22. 34
      wms/mkt/pricereview-check.php
  23. 75
      wms/mkt/pricereview-create.php
  24. 170
      wms/mkt/pricereview-index.php
  25. 10
      wms/mkt/pricereview-record-check.php
  26. 1
      wms/mkt/pricereview_facility-api.php
  27. 24
      wms/mkt/pricereview_mi-api.php
  28. 7
      wms/rib02-create.php
  29. 31
      wms/rib02-submit.php
  30. 2
      workflow/lib/DB.php

BIN
wms/account-receivable-facility.xlsx

Binary file not shown.

1036
wms/account-receivable-index.php

File diff suppressed because it is too large

1062
wms/account-receivable-renovate-index.php

File diff suppressed because it is too large

BIN
wms/account-receivable-test.xlsx

Binary file not shown.

6
wms/contract-repair/api/bpmAPI.php

@ -1,4 +1,6 @@
<?php
header("Access-Control-Allow-Origin: https://bpm.masada.com.tw");
require_once("../conn.php");
$sql = "SELECT * FROM account WHERE accountid = 'M0225'";
@ -7,7 +9,7 @@ $stmt->execute();
$result = $stmt->fetch(PDO::FETCH_ASSOC);
// echo '<pre>';
// print_r(json_encode($result));
// print_r($result);
// echo '</pre>';
return json_encode($result);
echo json_encode($result, JSON_UNESCAPED_UNICODE);

85
wms/contract-repair/api/putContractData.php

@ -56,7 +56,7 @@ if (isset($_POST['contracttype']) && $_POST['contracttype'] == 'r' && isset($_PO
// echo json_encode($sql);
// exit;
$stmt->execute();
t8Insert($_POST);
// t8Insert($_POST);
// header("HTTP/1.1 204 NO Content");
$conn->commit();
@ -67,49 +67,50 @@ if (isset($_POST['contracttype']) && $_POST['contracttype'] == 'r' && isset($_PO
}
}
function t8Insert($data)
{
require_once('../../contract/connt8.php');
$create_date = date('Y-m-dH-i-s');
$repair_no = !empty($data['repair_no']) ? $data['repair_no'] : null; // 報價單號
$company = !empty($data['company']) ? $data['company'] : null; //立約人
$repaireid = !empty($data['repaireid']) ? $data['repaireid'] : null; //維保人員
$facilityno = !empty($data['facilityno']) ? $data['facilityno'] : null; // 電梯編號
$type = !empty($data['type']) ? $data['type'] : null; //工程進度
$sign_date = !empty($data['sign_date']) ? $data['sign_date'] : null; //簽訂時間
$invoice = !empty($data['invoice']) ? $data['invoice'] : null; // 發票抬頭
$taxid = !empty($data['taxid']) ? $data['taxid'] : null; //統編
$address = !empty($data['address']) ? $data['address'] : null; //工程地址
$contract_status = !empty($data['contract_status']) ? $data['contract_status'] : null;
$user_id = !empty($_data['user_id']) ? $data['user_id'] : null;
// 塞保養合約進T8的 API function
// function t8Insert($data)
// {
// require_once('../../contract/connt8.php');
// $create_date = date('Y-m-dH-i-s');
// $repair_no = !empty($data['repair_no']) ? $data['repair_no'] : null; // 報價單號
// $company = !empty($data['company']) ? $data['company'] : null; //立約人
// $repaireid = !empty($data['repaireid']) ? $data['repaireid'] : null; //維保人員
// $facilityno = !empty($data['facilityno']) ? $data['facilityno'] : null; // 電梯編號
// $type = !empty($data['type']) ? $data['type'] : null; //工程進度
// $sign_date = !empty($data['sign_date']) ? $data['sign_date'] : null; //簽訂時間
// $invoice = !empty($data['invoice']) ? $data['invoice'] : null; // 發票抬頭
// $taxid = !empty($data['taxid']) ? $data['taxid'] : null; //統編
// $address = !empty($data['address']) ? $data['address'] : null; //工程地址
// $contract_status = !empty($data['contract_status']) ? $data['contract_status'] : null;
// $user_id = !empty($_data['user_id']) ? $data['user_id'] : null;
$sign = str_replace("-", '', $sign_date);
$create = str_replace('-', '', $create_date);
// $sign = str_replace("-", '', $sign_date);
// $create = str_replace('-', '', $create_date);
$sql = "INSERT INTO comBusinessPartner
(BizPartnerId,BizPartnerName,BusinessAttr,CountryId,BizToDate,TaxNo,ContactAddress,CreatorId,CreateTime,BizPartnerTypeId)
VALUES(:BizPartnerId,:BizPartnerName,1,'TW',99999999,:TaxNo,:ContactAddress,:CreatorId,:CreateTime,'10')";
$stmt = $connT8->prepare($sql);
$stmt->bindParam(':BizPartnerId', $repair_no); //報價單編號
$stmt->bindParam(':BizPartnerName', $company);
$stmt->bindParam(':TaxNo', $taxid);
$stmt->bindParam(':ContactAddress', $address);
$stmt->bindParam(':CreatorId', $user_id);
$stmt->bindParam(':CreateTime', $create);
$stmt->execute();
// $sql = "INSERT INTO comBusinessPartner
// (BizPartnerId,BizPartnerName,BusinessAttr,CountryId,BizToDate,TaxNo,ContactAddress,CreatorId,CreateTime,BizPartnerTypeId)
// VALUES(:BizPartnerId,:BizPartnerName,1,'TW',99999999,:TaxNo,:ContactAddress,:CreatorId,:CreateTime,'10')";
// $stmt = $connT8->prepare($sql);
// $stmt->bindParam(':BizPartnerId', $repair_no); //報價單編號
// $stmt->bindParam(':BizPartnerName', $company);
// $stmt->bindParam(':TaxNo', $taxid);
// $stmt->bindParam(':ContactAddress', $address);
// $stmt->bindParam(':CreatorId', $user_id);
// $stmt->bindParam(':CreateTime', $create);
// $stmt->execute();
$sql = "INSERT INTO comCustomer
(OrgId,BizPartnerTypeId,CurrId,BizPartnerId,PersonId,CreatorId,IsInUsed,InvoiceAddress,CreateTime)
VALUES('1000','10','TWD',:BizPartnerId,:PersonId,:CreatorId,1,:InvoiceAddress,:CreateTime)";
$stmt = $connT8->prepare($sql);
$stmt->bindParam(':BizPartnerId', $repair_no);
$stmt->bindParam(':PersonId', $salesman);
$stmt->bindParam(':CreatorId', $user_id);
$stmt->bindParam(':InvoiceAddress', $address);
$stmt->bindParam(':CreateTime', $create);
$stmt->execute();
// $sql = "INSERT INTO comCustomer
// (OrgId,BizPartnerTypeId,CurrId,BizPartnerId,PersonId,CreatorId,IsInUsed,InvoiceAddress,CreateTime)
// VALUES('1000','10','TWD',:BizPartnerId,:PersonId,:CreatorId,1,:InvoiceAddress,:CreateTime)";
// $stmt = $connT8->prepare($sql);
// $stmt->bindParam(':BizPartnerId', $repair_no);
// $stmt->bindParam(':PersonId', $salesman);
// $stmt->bindParam(':CreatorId', $user_id);
// $stmt->bindParam(':InvoiceAddress', $address);
// $stmt->bindParam(':CreateTime', $create);
// $stmt->execute();
$sql = "INSERT INTO ";
// $sql = "INSERT INTO ";
$connT8->commit();
}
// $connT8->commit();
// }

1
wms/contract-repair/contract-repair-input.php

@ -78,6 +78,7 @@ $contract_stauts = ["合約簽回", "採購", "工程發包", "工程中", "修
<input type="text" x-model="data.company" />
<p class="alerttext" x-show="data.company==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td>
<td style="vertical-align: middle">維保人員</td>
<td style="vertical-align: middle">
<select class="repaireid" id="repaireid" x-model="data.repairerid">

2
wms/contract-repair/contract-repair-management.php

@ -64,7 +64,7 @@ $contracts = $stmt->fetchAll(PDO::FETCH_ASSOC);
echo '修理完成';
}
?></th>
<td><?php echo $contract['create_user'] ?></td>
<td><?php echo $contract['create_userid'] ?></td>
<td><?php echo $contract['create_date'] ?></td>
<td style="width:30px">
<p>

32
wms/contract/api/T8salIncomeApply.php

@ -39,3 +39,35 @@ function T8API($data)
curl_close($ch);
}
// T8API($data);
function pending($user_id, $token)
{
$api_url = 'localhost:3000/wms/frame/api_getdata';
$data = [
'p' => 'pending',
'token' => $token
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $api_url); // 设置请求的URL
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
// curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
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 {
$result = json_decode($response, true);
// 若 API 傳入失敗。
if ($result['Status'] == 'Erroe') {
echo 'API傳入失敗,' . $result['ErrorMsg'];
return $result;
} else {
echo '<pre>';
print_r($result);
echo '</pre>';
return $result;
}
}
}

23
wms/contract/api/postContractData.php

@ -524,29 +524,34 @@ function T8insert($data, $facilityno)
// 分期代碼計算
$IncomeId = [
'A40006' => 1,
'A40007' => 4,
'A40003' => 12,
'A40004' => 6,
'A40005' => 2
'A40006' => 1, //年繳
'A40007' => 4, //季繳
'A40003' => 12, //月繳
'A40004' => 6, //雙月繳
'A40005' => 2 //半年繳
];
//分幾期 => 總共保養月 / 分期月
$SQuantity = $elevator['maintain_months'] / $IncomeId[$payType];
// 依每台電梯去加入各個的付款項
for ($i = 1; $i <= $IncomeId[$payType]; $i++) {
for ($i = 0; $i < $IncomeId[$payType]; $i++) {
// 計算分期款的收款月份
$paymonth = $i * $SQuantity;
$payday = date('Y-m-d', strtotime("$date_1 + $paymonth months"));
$rows_data = [
"BillNo" => "$contractno",
"IncomeId" => "$payType",
"TaxId" => "ST005",
"RowCode" => $i,
"RowNo" => $i,
"RowCode" => $i + 1,
"RowNo" => $i + 1,
"ItemType" => 1,
"SPrice" => $elevator['sold_price'],
"SQuantity" => $SQuantity,
"ProjectId" => "$contractno",
"FromSourceTag" => 0,
"CU_MaterialId" => "$facilityno[$index]"
"CU_MaterialId" => "$facilityno[$index]",
"CU_EstPayDate" => "$payday"
];
$salIncomeApplyDetail_rows[] = $rows_data;
}

123
wms/contract/api/testT8API.php

@ -1,109 +1,14 @@
&nbsp;
<link rel="stylesheet" name="dynamicTableStyle" type="text/css" href="/sys/xform/designer/standardtable/tablestyle/tb_normal_lightweight/standardtable.css">
<table id="fd_3c93363caa751c" formdesign="landray" align="center" class="tb_normal_lightweight" style="width: 98%;" layout2col="undefined" fd_values="{id:&quot;fd_3c93363caa751c&quot;,label:&quot;主表&quot;,isDefault:&quot;true&quot;,tableStyle:&quot;{quot;pathProfixquot;:quot;sys/xform/designer/standardtable/tablestyle/tb_normal_lightweightquot;,quot;tbClassNamequot;:quot;tb_normal_lightweightquot;}&quot;}" fd_type="standardTable" tablestyle="{quot;pathProfixquot;:quot;sys/xform/designer/standardtable/tablestyle/tb_normal_lightweightquot;,quot;tbClassNamequot;:quot;tb_normal_lightweightquot;}">
<tbody>
<tr style="height: 30px;">
<td row="0" column="0" class="td_normal_title" style="width: auto; height: auto;">&nbsp;</td>
<td row="0" column="1" class="" style="">&nbsp;</td>
<td row="0" column="2">&nbsp;</td>
</tr>
<tr>
<td row="1" column="0">&nbsp;</td>
<td row="1" column="1">&nbsp;</td>
<td row="1" column="2">&nbsp;</td>
</tr>
<tr style="height: 30px;">
<td row="2" column="0" class="" style=""><label formdesign="landray" class="xform_new_address" style="display: inline-block; width: 166px;" fd_values="{id:&quot;fd_3c93374e32374e&quot;,width:&quot;120&quot;,_label_bind:&quot;false&quot;,label:&quot;&quot;,_label_bind_id:&quot;&quot;,_org_person:&quot;true&quot;,_orgType:&quot;ORG_TYPE_PERSON&quot;,new_addressCustomType:&quot;org&quot;,new_address_select_value_id:&quot;&quot;,new_address_select_value_name:&quot;&quot;}" fd_type="new_address"><input id="fd_3c93374e32374e" class="inputsgl" canshow="true" "="" thousandshow=" true" _readonly="false" style="width:120px" required="false" _required="false" summary="false" ismark="false" tablename="fd_3c93363caa751c" label="" businesstype="addressDialog" multiselect="false" orgtype="ORG_TYPE_PERSON" scope="11" readonly=""><label>&nbsp;<a style="">選擇</a></label></label></td>
<td row="2" column="1">&nbsp;</td>
<td row="2" column="2">&nbsp;</td>
</tr>
<tr style="height: 30px;">
<td row="3" column="0">
<div formdesign="landray" id="fd_3c9337572bd274" label="" _width="200" class="xform_formula_load" loadtype="" returntype="select" datatype="undefined" scale="0" thousandshow="undefined" displayformat="undefined" controlids="" expression_mode="notRow" fd_values="{id:&quot;fd_3c9337572bd274&quot;,_label_bind:&quot;false&quot;,label:&quot;&quot;,_label_bind_id:&quot;&quot;,width:&quot;200&quot;,loadType:&quot;&quot;,returnType:&quot;select&quot;,decimal:&quot;0&quot;}" fd_type="formula_calculation" style="display: inline-flex; width: 215px;"><label class="select_tag_left"><label class="select_tag_right"> <label class="select_tag_face" style="width: 100px;"> --- 請選擇 --- </label> </label></label> <a href="javascript:void(0);" style="white-space: nowrap;">公式加載</a></div>
<div formdesign="landray" id="fd_3c933771241e32" class="xform_dateFormat" canshow="true" tablename="fd_3c93363caa751c" label="" dateformat_mode="notRow" fd_values="{id:&quot;fd_3c933771241e32&quot;,width:&quot;200&quot;,_label_bind:&quot;false&quot;,label:&quot;&quot;,_label_bind_id:&quot;&quot;}" fd_type="dateFormat" style="display: inline-block; width: 219px;"><input type="text" class="inputsgl" readonly="" style="width: 200px;"></div>
<div formdesign="landray" style="display: inline-block; width: 100%; min-width: 400px;" fd_values="{id:&quot;fd_3c93377a0f1596&quot;,tableStyle:&quot;{quot;pathProfixquot;:quot;sys/xform/designer/standardtable/tablestyle/tb_normal_solidborder_radius_bgcolorquot;,quot;tbClassNamequot;:quot;tb_normal_solidborder_radius_bgcolorquot;}&quot;}" fd_type="stageDiagram" tablestyle="{quot;pathProfixquot;:quot;sys/xform/designer/standardtable/tablestyle/tb_normal_solidborder_radius_bgcolorquot;,quot;tbClassNamequot;:quot;tb_normal_solidborder_radius_bgcolorquot;}">
<div class="lui-flow-rotundity">
<ul class="lui-flow-rotundity-list">
<li><span class="spot"></span>
<p class="title"></p>
</li>
<li><span class="spot" style=""></span>
<p class="title"></p>
</li>
<li><span class="spot" style=""></span>
<p class="title"></p>
</li>
</ul>
</div>
</div>
</td>
<td row="3" column="1">&nbsp;</td>
<td row="3" column="2">&nbsp;</td>
</tr>
<tr>
<td row="4" column="0">
<table label="明細表1" id="fd_3c93375a6e8256" formdesign="landray" align="center" class="tb_normal" tablename="fd_3c93363caa751c" style="width: 100%;" data-multihead="false" width="100%" showindex="true" showrow="1" showstatisticrow="undefined" showcopyopt="undefined" dataentrymode="multipleRow" required="undefined" excelexport="undefined" excelimport="undefined" defaultfreezetitle="undefined" defaultfreezecol="undefined" showfold="undefined" layout2col="undefined" fd_values="{cell:&quot;6&quot;,_label_bind:&quot;false&quot;,label:&quot;明細表1&quot;,id:&quot;fd_3c93375a6e8256&quot;,width:&quot;100%&quot;,showRow:&quot;1&quot;,columnIndex:&quot;null&quot;}" fd_type="detailsTable">
<tbody>
<tr class="tr_normal_title" type="titleRow" style="height: 33px;">
<td row="0" column="0" align="center" class="td_normal_title" coltype="selectCol" style="width: 15px;"></td>
<td row="0" column="1" align="center" class="td_normal_title" coltype="noTitle" style="width: 25px; white-space: nowrap;"><label attach="fd_3c93375a6e8256">序號</label></td>
<td row="0" column="2" align="center" class="td_normal_title"></td>
<td row="0" column="3" align="center" class="td_normal_title"></td>
<td row="0" column="4" align="center" class="td_normal_title"></td>
<td row="0" column="5" align="center" class="td_normal_title" coltype="blankTitleCol" style="width: 48px;"></td>
</tr>
<tr type="templateRow">
<td row="1" column="0" align="center" coltype="selectCol" style="width: 15px;"><input type="checkbox" name="DocList_Selected"></td>
<td row="1" column="1" align="center" coltype="noTemplate" style="width: 25px;"><label attach="fd_3c93375a6e8256">1</label></td>
<td row="1" column="2" align="center"></td>
<td row="1" column="3" align="center"></td>
<td row="1" column="4" align="center"></td>
<td row="1" column="5" align="center" coltype="copyCol" style="width: 48px;">
<nobr><img class="copyIcon" src="style/img/icon_copy.png" title="复制行">&nbsp;&nbsp;<img class="delIcon" src="style/img/icon_del.png" title="刪除行">&nbsp;&nbsp;</nobr>
</td>
</tr>
<tr type="statisticRow">
<td row="2" column="0" align="center" coltype="selectCol" style="width: 15px;"></td>
<td row="2" column="1" align="center" coltype="noFoot" style="width: 25px;"><label attach="fd_3c93375a6e8256">&nbsp;</label></td>
<td row="2" column="2" align="center" class="" style="">
<div formdesign="landray" id="fd_3c933764473d64" enabledfiletype="" fdmulti="true" label="" required="false" isshowdownloadcount="true" othercannotdelete="false" allcannotdelete="false" slidedown="true" widthcontent="undefined" tablename="fd_3c93375a6e8256" fd_values="{id:&quot;fd_3c933764473d64&quot;,_label_bind:&quot;true&quot;,label:&quot;&quot;,_label_bind_id:&quot;&quot;}" fd_type="attachment" style="display: inline-block; width: 280px; text-align: left;"> <button onclick="return false;" class="btnopt" style="width: 71px; height: 25px;">上傳</button> <span style="padding-left:8px;display:inline-block">請選擇要上傳的文件</span></div>
<div formdesign="landray" id="fd_3c933766738938" fdmulti="false" hidepicname="false" label="" required="false" width="200" widthcontent="240" height="150" mobilepicdisplaythumb="true" class="lui_upload_img_box" tablename="fd_3c93375a6e8256" fd_values="{width:&quot;200&quot;,height:&quot;150&quot;,widthContent:&quot;240&quot;,id:&quot;fd_3c933766738938&quot;,_label_bind:&quot;true&quot;,label:&quot;&quot;,_label_bind_id:&quot;&quot;}" fd_type="docimg" style="display: inline-block; width: 240px;">
<div class="lui_upload_img_item lui_upload_img" style="width:100%;height:180px;margin: 0px;" align="center"><span class="lui_upload_img_txt" style="width:240px;height:180px;margin: 0px;"><i class="icon icon-plus" style="margin-top:45px"></i>圖片上傳</span></div>
</div>
<div formdesign="landray" id="fd_3c9337682f649c" style="display: inline-block; width: 39px;" fd_values="{id:&quot;fd_3c9337682f649c&quot;,_label_bind:&quot;false&quot;,label:&quot;&quot;,_label_bind_id:&quot;&quot;}" fd_type="hidden"><label title="隱藏字段" label="" style="background: url(&quot;style/img/hidden.png&quot;) no-repeat; width: 24px; height: 24px; display: inline-block;"></label></div>
<div formdesign="landray" id="fd_3c93376b1bdd94" fd_values="{id:&quot;fd_3c93376b1bdd94&quot;}" fd_type="right" style="border: 1px dotted orange; width: 100%; min-height: 18px; padding: 1px; height: auto;">
<div class="rightIconBar" style="background-color: red; height: 10px; width: 10px; position: relative; cursor: move;"></div>
<table class="righBar" cellpadding="1" style="border-collapse: collapse; border: none; display: none;">
<tbody>
<tr style="height: 18px;">
<td style="border: 1px solid red; background-color: rgb(251, 212, 180); width: 36px;"><button type="button" onmousedown="Designer_Control_Right_CancelBubbleFun(event);" class="modeCell" title="只讀" mode_g="view" mode_d="view" ondblclick="Designer_Control_Right_CancelBubbleFun(event);" style="float: left; cursor: pointer; width: 16px; height: 16px; background: url(&quot;style/img/right_icon.gif&quot;) 0px -48px no-repeat; border: 0px;" onclick="Designer_Control_Right_SetModeCellValue(this);">&nbsp;&nbsp;&nbsp;</button><button type="button" onmousedown="Designer_Control_Right_CancelBubbleFun(event);" class="defaultCell" title="隨默認權限" ondblclick="Designer_Control_Right_CancelBubbleFun(event);" style="float: right; cursor: pointer; width: 16px; height: 16px; background: url(&quot;style/img/right_icon.gif&quot;) 0px -80px no-repeat; border: 0px; display: none;" onclick="Designer_Control_Right_SetDefaultCellValue(this);">&nbsp;&nbsp;&nbsp;</button></td>
<td style="border: 1px solid red; background-color: rgb(251, 212, 180); word-break: keep-all; display: none;"><button type="button" onmousedown="Designer_Control_Right_CancelBubbleFun(event);" class="readerCell" title="未設置讀者" readerids="" readernames="" ondblclick="Designer_Control_Right_CancelBubbleFun(event);" style="cursor:pointer;width:16px;height:16px;background:url(style/img/right_icon.gif) no-repeat 0px -16px;border:0px;" onclick="Designer_Control_Right_SetReaderCellValue(this);">&nbsp;&nbsp;&nbsp;</button></td>
<td style="border: none; padding: 0px 2px 0px 0px;">&nbsp;<span ondblclick="Designer_Control_Right_CancelBubbleFun(event); Designer_Control_Right_ShowLabelEditor(this);" style="padding:0;margin:0;border:0;line-height:16px;">權限區段1</span></td>
</tr>
</tbody>
</table>
</div>
</td>
<td row="2" column="3" align="center">&nbsp;</td>
<td row="2" column="4" align="center">&nbsp;</td>
<td row="2" column="5" align="center" coltype="emptyCell" style="width: 48px;"><label attach="fd_3c93375a6e8256">&nbsp;</label></td>
</tr>
<tr type="optRow" class="tr_normal_opt">
<td row="3" column="0" align="center" coltype="optCol" colspan="6" style=""><label attach="fd_3c93375a6e8256" style="display:none;">&nbsp;</label>
<div name="tr_normal_opt_content" style="WIDTH: 100%; POSITION: relative; color:#fff;white-space: nowrap;">
<div name="tr_normal_opt_l" style="POSITION: absolute; LEFT: 0px; TOP: 0px">
<div style="display:inline-block; line-height: 20px; vertical-align: top;"><input style="position: relative; top: 6px;" type="checkbox" onclick="return false;"><span style="display:inline-block;position: relative;top:2px;margin-left:6px;">全選</span></div><span style="margin-left:15px; display:inline-block; line-height: 20px;"><span style="display:inline-block;width:20px;height:20px;background:url(style/img/normal_opt_sprite.png) no-repeat 0 0;background-position: 0 0;position: relative;top:2px;" "=""></span><span style=" display:inline-block;vertical-align: text-bottom;margin-left:6px;">刪除</span></span>
</div>
<div name="tr_normal_opt_c"><span style="display:inline-block; line-height: 20px;"><span style="display:inline-block;width:20px;height:20px;background:url(style/img/normal_opt_sprite.png) no-repeat 0 0;background-position: -20px 0;position: relative;top:2px;" title="添加行"></span><span style="display:inline-block;vertical-align: text-bottom;margin-left:6px;">添加行</span></span><span style="margin-left:15px; display:inline-block; line-height: 20px;"><span style="display:inline-block;width:20px;height:20px;background:url(style/img/normal_opt_sprite.png) no-repeat 0 0;background-position: -40px 0;position: relative;top:2px;" title="上移"></span><span style="display: inline-block; vertical-align: text-bottom; margin-left: 6px;">上移</span></span><span style="margin-left: 15px; display: inline-block; line-height: 20px;"><span style="display: inline-block; width: 20px; height: 20px; background: url(&quot;style/img/normal_opt_sprite.png&quot;) -60px 0px no-repeat; position: relative; top: 2px;" title="下移"></span><span style="display:inline-block;vertical-align: text-bottom;margin-left:6px;">下移</span></span></div>
<div name="tr_normal_opt_r" style="POSITION: absolute; RIGHT: 0px; TOP: 0px"><span name="excelExport" style="display: none; line-height: 20px;"><span style="display:inline-block;width:20px;height:20px;background:url(style/img/normal_opt_sprite.png) no-repeat 0 0;background-position: -100px 0; margin-right:6px;position: relative;top:2px;" "=""></span><span style=" display:inline-block;vertical-align: text-bottom;">批量導出</span></span><span name="excelImport" style="margin-left: 15px; display: none; line-height: 20px;"><span style="display:inline-block;width:20px;height:20px;background:url(style/img/normal_opt_sprite.png) no-repeat 0 0;background-position: -80px 0; margin-right:6px;position: relative;top:2px;" "=""></span><span style=" display:inline-block;vertical-align: text-bottom;">批量導入</span></span></div>
</div>
</td>
</tr>
</tbody>
</table>
</td>
<td row="4" column="1">&nbsp;</td>
<td row="4" column="2">&nbsp;</td>
</tr>
</tbody>
</table>
<?php
$date = Date('Y-m-d');
$date1 = Date('Y-m-d', strtotime("$date +1 months"));
$a = 1;
$b = 12 / $a;
for ($i = 0; $i < $b; $i++) {
$c = $i * $a;
$date1 = Date('Y-m-d', strtotime("$date + $c months"));
echo '<pre>';
print_r($date1);
echo '</pre>';
}

69
wms/contract/testT8API.php

@ -0,0 +1,69 @@
<?php
require_once('../T8_Authorization_from_bpm.php');
// require_once('../connt8.php');
// 其他出庫申請單
$validation = get_Auth();
$data = [
[
"name" => "OtherStockOutMtable",
"rows" => [
[
"BillNo" => "TEST01", // 單據編號 varchar(20)
"BillDate" =>20240120, // 單據日期 int
"OrgId" => "1000", //組織 varchar(20)
"FOrgId" => "1000", //核算組織 varchar(20)
"TypeId" => "OS", //單據類型 varchar(10)
"BizPartnerId" => "03051501", //往來對象(供應商) 可為空
"PersonId" => "C0003", // 經辦人員 varchar(20)
"DeptId" => "250", // 經辦部門 varchar(20)
"CompId" => "1001" // 公司 varchar(20)
]
]
], [
"name" => "OtherStockOutDetail",
"rows" => [
[
"BillNo" => "TEST01", //單據編號 varchar(20)
"RowCode" => 1, // 序號 int(10)
"MaterialId" => "MX00021003", // 產品代碼 -> 產品集成 varchar(40)
"SupplyOrgId" => "1000", // 供貨組織代碼 varchar(20)
"SQuantity" =>1, // 交易數量 numeric(19)
"WarehouseId" => "100" // 倉庫代碼 varchar(20)
]
]
]
];
$api_url = 'https://erp.masada.com.tw:780/twWebAPI/V1/STKOTHERSTOCKOUT/PostERPData';
$header = [
"CHI_Authorization :" . $validation
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $api_url); // 设置请求的URL
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
$response = curl_exec($ch);
if ($response === false) {
echo 'Curl error: ' . curl_error($ch);
} else {
$result = json_decode($response, true);
if ($result['Status'] == 'Error') {
echo '<pre>';
print_r($result);
echo '</pre>';
echo 'API 傳入錯誤,' . $result['ErrorMsg'];
} else {
echo '<pre>';
print_r($result['Status']);
echo '</pre>';
return $result;
}
}
curl_close($ch);

16
wms/css/function.js

@ -330,6 +330,7 @@ function login() {
password: password
},
success: function (data) {
// console.log(data);
console.log('返回的结果');
res = eval("(" + data + ")");
console.log(res);
@ -340,17 +341,12 @@ function login() {
var name = res.name;
var login = res.login;
var menu = res.menu;
var queryString = window.location.search;
var params = new URLSearchParams(queryString);
var redirect = params.get('redirect');
//console.log(token);
//window.localStorage.setItem("token",token);
//window.localStorage.setItem("name",name);
//window.localStorage.setItem("login",login);
window.localStorage.setItem("menu_" + res.uid, menu);
if (redirect == '' || redirect == 'null' || redirect == null) {
window.location.href = 'index.php?token=' + token;
} else {
window.location.href = decodeURIComponent(redirect) + '&token=' + token;
}
window.location.href = 'index.php?token=' + token;
} else {
window.location.href = 'login.php?errno=1';
}

1
wms/excel-upload.php

@ -3,6 +3,7 @@
include "header.php";
require_once 'PHPExcel/PHPExcel.php';
require_once 'PHPExcel/IOFactory.php';
$file_name = $_FILES["fileToUpload"]["name"];
$temp_file_name = $_FILES["fileToUpload"]["tmp_name"];
$target_dir = "excel-uploads/";

3
wms/frame/api_getdata.php

@ -22,7 +22,7 @@
*/
$json = array("st" => "ok", "err" => "", "errCode" => "");
echo '123';
/**
* 表單列表
*/
@ -220,3 +220,4 @@ try {
}
echo json_encode($json, JSON_UNESCAPED_UNICODE);
return json_encode($json, JSON_UNESCAPED_UNICODE);

195
wms/frame/pending.php

@ -3,134 +3,107 @@ $token = $_REQUEST["token"];
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, viewport-fit=cover" />
<title>待我簽核</title>
<link rel="stylesheet" href="css/plugins/fontawesome-free/css/all.min.css">
<link rel="stylesheet" href="css/dist/css/adminlte.min.css">
<script src="../css/jquery.min.js"></script>
<script src="../css/bootstrap.min.js"></script>
<style>
.content-wrapper {
background-color: #fff;
}
.col-lg-6 {
padding: 8px 0 0 0 !important;
}
.card {
height: 90vh;
line-height: 14 px;
font-size: 14px;
}
.card-header {
background-color: #f4f6f9;
padding-left: 16px;
}
.card-body ol {
font-size: 14px;
margin-left: -30px;
}
.nav-pills .nav-link {
color: #446887;
}
h5 svg {
vertical-align: baseline;
}
h5 a {
color: #000;
}
@media screen and (max-width: 992px) {
.card {
height: 95vh;
}
}
</style>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, viewport-fit=cover" />
<title>待我簽核</title>
<link rel="stylesheet" href="css/plugins/fontawesome-free/css/all.min.css">
<link rel="stylesheet" href="css/dist/css/adminlte.min.css">
<script src="../css/jquery.min.js"></script>
<script src="../css/bootstrap.min.js"></script>
<style>
.content-wrapper {
background-color: #fff;
}
.col-lg-6 {
padding:8px 0 0 0!important;
}
.card {
height: 90vh;
line-height: 14 px;
font-size: 14px;
}
.card-header {
background-color: #f4f6f9;
padding-left: 16px;
}
.card-body ol {
font-size: 14px;
margin-left: -30px;
}
.nav-pills .nav-link {
color: #446887;
}
h5 svg {
vertical-align: baseline;
}
h5 a {
color: #000;
}
@media screen and (max-width: 992px){
.card {
height: 95vh;
}
}
</style>
</head>
<body>
<div class="wrapper">
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
<!-- Main content -->
<div class="content">
<div class="container">
<div class="row">
<!-- /.col-md-6 -->
<div class="col-lg-6">
<div class="card">
<div class="card-header">
<h5 class="card-title m-0"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-pencil-square" viewBox="0 0 16 16">
<path d="M15.502 1.94a.5.5 0 0 1 0 .706L14.459 3.69l-2-2L13.502.646a.5.5 0 0 1 .707 0l1.293 1.293zm-1.75 2.456-2-2L4.939 9.21a.5.5 0 0 0-.121.196l-.805 2.414a.25.25 0 0 0 .316.316l2.414-.805a.5.5 0 0 0 .196-.12l6.813-6.814z" />
<path fill-rule="evenodd" d="M1 13.5A1.5 1.5 0 0 0 2.5 15h11a1.5 1.5 0 0 0 1.5-1.5v-6a.5.5 0 0 0-1 0v6a.5.5 0 0 1-.5.5h-11a.5.5 0 0 1-.5-.5v-11a.5.5 0 0 1 .5-.5H9a.5.5 0 0 0 0-1H2.5A1.5 1.5 0 0 0 1 2.5v11z" />
</svg>
<a href="/wms/sign/list.php?function_name=show&token=<?php echo $token; ?>" target="_parent">待我簽核</a>
</h5>
</div>
<div class="card-body p-0">
Loading...
</div>
</div>
<div class="container">
<div class="row">
<!-- /.col-md-6 -->
<div class="col-lg-6">
<div class="card">
<div class="card-header">
<h5 class="card-title m-0"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-pencil-square" viewBox="0 0 16 16"><path d="M15.502 1.94a.5.5 0 0 1 0 .706L14.459 3.69l-2-2L13.502.646a.5.5 0 0 1 .707 0l1.293 1.293zm-1.75 2.456-2-2L4.939 9.21a.5.5 0 0 0-.121.196l-.805 2.414a.25.25 0 0 0 .316.316l2.414-.805a.5.5 0 0 0 .196-.12l6.813-6.814z"/><path fill-rule="evenodd" d="M1 13.5A1.5 1.5 0 0 0 2.5 15h11a1.5 1.5 0 0 0 1.5-1.5v-6a.5.5 0 0 0-1 0v6a.5.5 0 0 1-.5.5h-11a.5.5 0 0 1-.5-.5v-11a.5.5 0 0 1 .5-.5H9a.5.5 0 0 0 0-1H2.5A1.5 1.5 0 0 0 1 2.5v11z"/></svg>
<a href="/wms/sign/list.php?function_name=show&token=<?php echo $token; ?>" target="_parent">待我簽核</a></h5>
</div>
<div class="card-body p-0">
Loading...
</div>
<!-- /.col-md-6 -->
</div>
<!-- /.row -->
</div><!-- /.container-fluid -->
</div>
<!-- /.col-md-6 -->
</div>
<!-- /.row -->
</div><!-- /.container-fluid -->
</div>
<!-- /.content -->
</div>
<!-- /.content-wrapper -->
</div>
<script>
$(document).ready(function() {
here();
});
<script>
$(document).ready(function() {
here();
});
function here() {
var URL = 'api_getdata.php';
$.ajax({
type: "GET",
data: {
p: 'pending',
token: '<?php echo $token; ?>'
},
url: URL,
success: function(msg) {
var obj = JSON.parse(msg);
console.log(msg);
var myhtml = '';
if (obj.st == 'ok') {
myhtml += '<ul class="nav nav-pills flex-column">';
for (i = 1; i <= Object.keys(obj.content).length; i++) {
if (obj.content[i].fname == '新梯價審流程') {
myhtml += '<li class="nav-item"><a href="/wms/mkt/pricereview-index.php?system_id=' + obj.content[i].sid + '&flow_id=' + obj.content[i].fid + '&function_name=show&token=<?php echo $token; ?>" class="nav-link" target="_parent">' + obj.content[i].sname + ' > ' + obj.content[i].fname + '(' + obj.content[i].cnt + ')</a></li>';
} else if (obj.content[i].fname == '汰改價審流程') {
myhtml += '<li class="nav-item"><a href="/wms/mkt/pricereview_renovate-index.php?system_id=' + obj.content[i].sid + '&flow_id=' + obj.content[i].fid + '&function_name=show&token=<?php echo $token; ?>" class="nav-link" target="_parent">' + obj.content[i].sname + ' > ' + obj.content[i].fname + '(' + obj.content[i].cnt + ')</a></li>';
} else if (obj.content[i].fname == '契约價審流程') {
myhtml += '<li class="nav-item"><a href="/wms/cont/sign_list.php?system_id=' + obj.content[i].sid + '&flow_id=' + obj.content[i].fid + '&function_name=show&token=<?php echo $token; ?>" class="nav-link" target="_parent">' + obj.content[i].sname + ' > ' + obj.content[i].fname + '(' + obj.content[i].cnt + ')</a></li>';
} else {
myhtml += '<li class="nav-item"><a href="/wms/sign/list.php?system_id=' + obj.content[i].sid + '&flow_id=' + obj.content[i].fid + '&function_name=show&token=<?php echo $token; ?>" class="nav-link" target="_parent">' + obj.content[i].sname + ' > ' + obj.content[i].fname + '(' + obj.content[i].cnt + ')</a></li>';
}
}
if (Object.keys(obj.content).length == 6) {
myhtml += '<li class="nav-item"><a href="/wms/sign/list.php?function_name=show&token=<?php echo $token; ?>" class="nav-link" target="_parent">.... 顯示更多</a></li>';
}
myhtml += '</ul>';
$('.card-body').empty().append(myhtml);
}
function here() {
var URL = 'api_getdata.php';
$.ajax({
type: "GET",
data: {p: 'pending', token: '<?php echo $token; ?>'},
url: URL,
success: function (msg) {
var obj = JSON.parse(msg);
var myhtml = '';
if (obj.st == 'ok') {
myhtml += '<ul class="nav nav-pills flex-column">';
for (i=1; i<=Object.keys(obj.content).length; i++) {
myhtml += '<li class="nav-item"><a href="/wms/sign/list.php?system_id='+obj.content[i].sid+'&flow_id='+obj.content[i].fid+'&function_name=show&token=<?php echo $token; ?>" class="nav-link" target="_parent">'+obj.content[i].sname+' > '+obj.content[i].fname+'('+obj.content[i].cnt+')</a></li>';
}
})
if (Object.keys(obj.content).length == 6) {
myhtml += '<li class="nav-item"><a href="/wms/sign/list.php?function_name=show&token=<?php echo $token; ?>" class="nav-link" target="_parent">.... 顯示更多</a></li>';
}
myhtml += '</ul>';
$('.card-body').empty().append(myhtml);
}
}
</script>
})
}
</script>
</body>
</html>

57
wms/fun_global.php

@ -83,13 +83,12 @@ function manage_class($user_id, &$ret = [])
* @return array
*
*/
function pricereview_class($rate, $user_id, &$ret = [], $special_fee)
function pricereview_class($rate, $user_id, &$ret = [], $special_fee, $i = 0)
{
global $link;
$sql = "select manager from account where accountid = '$user_id'";
$res = mysqli_query($link, $sql);
$i = 0;
while ($row = mysqli_fetch_assoc($res)) {
if ($row["manager"] == "M0001") return; // 董事長略過
if ($user_id == 'TEST01') {
@ -100,31 +99,31 @@ function pricereview_class($rate, $user_id, &$ret = [], $special_fee)
return $ret;
exit;
} else {
// 若為第一層且使用者ID為區經理,直接訂好接下來的簽核人員並跳出。
if ($i == 0 && ($user_id == 'M0033' || $user_id == "M0137" || $user_id == 'M0029' || $user_id == 'M0054' || $user_id == "M0086")) {
$ret[1] = $user_id . ",,";
$ret[2] = "M0024,,<##>M0107,,"; // 業務部專員:M0024許伃廷、M0107許紓晴(第2關有多位審核人)
$ret[2] = "M0175,,<##>M0107,,"; // 業務部專員:M0175陳君敏、M0107許紓晴(第2關有多位審核人)
$ret[3] = "M0060,,"; // 業務協理
if ($rate < 80 || $special_fee > 0) {
$ret[4] = "M0006,,"; // 總經理
}
return $ret;
exit();
exit;
}
if ($row["manager"] != "M0060" && $row["manager"] != "M0006" && $row["manager"] != "M0008") {
// 新梯的部分 桃竹本該給陳家文,改為劉永德
if ($row["manager"] == 'M0029') {
$ret[1] = "M0147,,";
$ret[1] = "M0137,,";
$i++;
pricereview_class($rate, $row["manager"], $ret, $special_fee);
pricereview_class($rate, $row["manager"], $ret, $special_fee, $i);
} else {
$ret[1] = $row["manager"] . ",,";
$i++;
pricereview_class($rate, $row["manager"], $ret, $special_fee);
pricereview_class($rate, $row["manager"], $ret, $special_fee, $i);
}
} else {
// if ($user_id == 'M0033' || $user_id == 'M0137' || $user_id == 'M0029' || $user_id == 'M0054' || $user_id == 'M0086') {
// $ret[1] = $user_id . ",,";
// }
$ret[2] = "M0024,,<##>M0107,,"; // 業務部專員:M0024許伃廷、M0107許紓晴(第2關有多位審核人)
$ret[2] = "M0175,,<##>M0107,,"; // 業務部專員:M0175陳君敏、M0107許紓晴(第2關有多位審核人)
$ret[3] = "M0060,,"; // 業務協理
if ($rate < 80 || $special_fee > 0) {
$ret[4] = "M0006,,"; // 總經理
@ -152,48 +151,28 @@ function pricereview_renovate_class($rate, $user_id, $renovate_flag)
$res = mysqli_query($link, $sql);
if ($row = mysqli_fetch_assoc($res)) {
if ($row["manager"] == "M0001") return; // 董事長略過
if ($row["manager"] == "TEST04" || $user_id == 'TEST01') {
$ret[1] = "test04,,";
$ret[2] = "test02,,";
$ret[3] = "test03,,";
$ret[4] = "test05,,";
return $ret;
exit();
if ($row["manager"] != "M0060" && $row["manager"] != "M0006" && $row["manager"] != "M0008") {
$ret[1] = $row["manager"];
} else {
if ($row["manager"] != "M0060" && $row["manager"] != "M0006" && $row["manager"] != "M0008") {
$ret[1] = $row["manager"];
} else {
$ret[1] = $user_id;
}
$ret[1] = $user_id;
}
}
// $ret[1] = "M0029";
mysqli_free_result($res);
$ret[2] = 'M0012';
if ($renovate_flag == "REN") {
// $ret[2] = 'M0012';
if ($rate <= 100) $ret[3] = "M0008"; // 詹總
if ($rate < 75) $ret[4] = "M0006"; // 總經理
if ($rate < 80) $ret[4] = "M0006"; // 總經理
} else {
// 全汰改
if ($rate <= 100) $ret[3] = "M0008"; // 詹總
if ($rate < 75) $ret[4] = "M0006"; // 總經理
if ($rate < 80) $ret[4] = "M0006"; // 總經理
}
mysqli_free_result($res);
return $ret;
}
/**
* 汰改(契約)價審簽核順位
* @param string $rate:破價比
* @param string $user_id:使用者ID
* @param string $renovate_flag:REN=M1改
* @return array
*
*/
function pricereview_maintainance_class($rate, $user_id, $renovate_flag)
{
}
/**
* 檢查使用者選單權限
*
@ -257,7 +236,7 @@ function accountid2name()
global $link;
$arr = [];
$sql = "select accountid, name from account where 1=1";
$sql = "select accountid, name from account where accounttype in ('B','E','M')";
$res = mysqli_query($link, $sql);
while ($row = mysqli_fetch_row($res)) {
$arr[$row[0]] = $row[1];

40
wms/mkt/assets/js/alpine.js

@ -199,7 +199,6 @@ const pricereviewOptionSelect = () => {
init() {
this.optionCategory = 0
this.initButtons();
console.log(this.options)
},
options: options,
orioptions: options,
@ -253,20 +252,22 @@ const pricereviewOptionSelect = () => {
},
optionSubCategory: 1,
changeCategory(category, subcategory = 0) {
// console.log(this.$refs.selectModalBody);
this.initButtons(category)
this.kind = (category == 'sub') ? this.kind : category;
if (subcategory != 0) {
this.subkind = subcategory
} else {
this.subkind = 0
}
if (category == 0) {
this.kind = 0;
this.subkind = 0;
}
this.initButtons(category)
this.searchtext = ""
this.reloadOptions();
},
reloadOptions() {
if (this.kind == 0) {
@ -274,23 +275,40 @@ const pricereviewOptionSelect = () => {
return;
}
if (this.subkind == 0) {
this.options = this.orioptions.filter(option => option.kind == this.kind)
this.options.forEach(option =>{
if (option.kind == this.kind) {
option.status = "Y"
}else{
option.status = "H"
}
})
return;
}
this.options = this.orioptions.filter(option => option.kind == this.kind && option.subkind == this.subkind)
this.options.forEach(option => {
if(option.kind == this.kind && option.subkind == this.subkind){
option.status = "Y"
}else{
option.status = "H"
}
})
},
searchOptions(e) {
e = null;
this.options = this.orioptions
this.reloadOptions();
let val = e.target.value.toLowerCase()
this.options = (this.options).filter(option=>{
let val = (e== null) ? this.searchtext.toLowerCase() : e.target.value.toLowerCase()
this.options.forEach(option=>{
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 = ''
return option.group_name.includes(val) || option.memo.toLowerCase().includes(val) || option.spec.toLowerCase().includes(val) || option.unit.includes(val) || String(option.price).includes(val)
if(option.group_name.includes(val) || option.memo.toLowerCase().includes(val) || option.spec.toLowerCase().includes(val) || option.unit.includes(val) || String(option.price).includes(val)){
option.status = "Y"
}else{
option.status = "N"
}
})
}
},
}
}

6
wms/mkt/price_normal-index.php

@ -39,6 +39,7 @@ include "../header.php";
</ul>
<div class="tab-content clearfix">
<div class="tab-pane active" id="1a">
<a href="./files/MAE100小機房.docx" download class="btn btn-success" style="margin:16px 0 ">下載電子檔(小機房)</a>
<table border=0 cellpadding=0 cellspacing=0 width=1012 style='border-collapse:
collapse;table-layout:fixed;width:760pt'>
<col class=xl71 width=285 style='mso-width-source:userset;mso-width-alt:9130;
@ -215,6 +216,7 @@ include "../header.php";
</table>
</div>
<div class="tab-pane" id="2a">
<a href="./files/MAM200.docx" download class="btn btn-success" style="margin:16px 0 ">下載電子檔(無機房)</a>
<table border=0 cellpadding=0 cellspacing=0 width=1021 style='border-collapse:
collapse;table-layout:fixed;width:767pt'>
<col width=285 style='mso-width-source:userset;mso-width-alt:9130;width:214pt'>
@ -369,6 +371,7 @@ include "../header.php";
</table>
</div>
<div class="tab-pane" id="3a">
<a href="./files/MAH100.docx" download class="btn btn-success" style="margin:16px 0 ">下載電子檔(小電梯)</a>
<table border=0 cellpadding=0 cellspacing=0 width=854 style='border-collapse:
collapse;table-layout:fixed;width:641pt'>
<col class=xl65 width=261 style='mso-width-source:userset;mso-width-alt:8362;
@ -433,6 +436,7 @@ include "../header.php";
</table>
</div>
<div class="tab-pane" id="4a">
<a href="./files/MAE100.docx" download class="btn btn-success" style="margin:16px 0 ">下載電子檔(高速梯)</a>
<table border=0 cellpadding=0 cellspacing=0 width=783 style='border-collapse:
collapse;table-layout:fixed;width:588pt'>
<tr height=51 style='mso-height-source:userset;height:38.0pt'>
@ -532,6 +536,7 @@ include "../header.php";
</table>
</div>
<div class="tab-pane" id="5a">
<a href="./files/MAF100.docx" download class="btn btn-success" style="margin:16px 0 ">下載電子檔(小機房貨梯)</a>
<table border=0 cellpadding=0 cellspacing=0 width=783 style='border-collapse:
collapse;table-layout:fixed;width:588pt'>
<tr height=51 style='mso-height-source:userset;height:38.0pt'>
@ -653,6 +658,7 @@ include "../header.php";
</table>
</div>
<div class="tab-pane" id="6a">
<a href="./files/MAP100.docx" download class="btn btn-success" style="margin:16px 0 ">下載電子檔(平台梯)</a>
<table border=0 cellpadding=0 cellspacing=0 width=1052>
<tr height=51 style='mso-height-source:userset;height:38.0pt'>
<td height=51 class=xl123 width=261 style='height:38.0pt;width:196pt'></td>

2
wms/mkt/price_option-index.php

@ -67,6 +67,7 @@ $optional_arr = [1 => '標', 2 => '選'];
<table id="table_index2" class="table table-striped table-bordered" style="width:100%">
<thead>
<tr class="kind-col">
<th scope="col" nowrap>ID</th>
<th scope="col" nowrap>名稱</th>
<th scope="col" nowrap>規格</th>
<th scope="col" nowrap>備註</th>
@ -88,6 +89,7 @@ $optional_arr = [1 => '標', 2 => '選'];
</template>
<template x-for="option in options">
<tr>
<td x-text="option.id"></td>
<td x-text="option.group_name"></td>
<td x-text="option.spec"></td>
<td x-text="option.memo"></td>

2
wms/mkt/price_option-select.php

@ -51,6 +51,7 @@ $optional_arr = [1 => '標配', 2 => '選配',3=>'加價'];
<table id="table_index2" class="table table-striped table-bordered" style="width:100%">
<thead>
<tr class="kind-col">
<th scope="col" nowrap>ID</th>
<th scope="col" nowrap>名稱</th>
<th scope="col" nowrap>規格</th>
<th scope="col" nowrap>備註</th>
@ -72,6 +73,7 @@ $optional_arr = [1 => '標配', 2 => '選配',3=>'加價'];
</template>
<template x-for="option in options">
<tr>
<td x-text="option.id"></td>
<td x-text="option.group_name"></td>
<td x-text="option.spec"></td>
<td x-text="option.memo"></td>

34
wms/mkt/pricereview-check.php

@ -325,19 +325,21 @@ foreach ($res as $data) {
xhr.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
data = JSON.parse(this.responseText);
console.log('123');
console.log(data);
if(data.err == "notfoundmi"){
for(let i=0;i<document.getElementsByClassName('total_mi_fix').length;i++){
document.getElementsByClassName('total_mi_fix')[i].value = "找不到此MI"
}
}
//console.log(data);return false;
if (data.st == 'err') {
console.log('123');
//alert(data.err);
return false;
}
// console.log(data.content);
Object.keys(data.content).forEach(function(k) {
console.log('k=>', k);
// console.log(data.content);
console.log(data.content);
//console.log(data.content[k][0]);
// 有值表示先前已寫入MI
if ($("#tb1").find("input[name=mi_fix]").eq(k).val() == "") {
@ -346,8 +348,6 @@ foreach ($res as $data) {
let a = data.content[k][0] + data.content[k][19][1];
$("#tb1").find("input[name=mi_fix]").eq(k).val(commafy(a));
}
console.log('123');
let a = data.content[k][0] + data.content[k][19][1];
$("#tb1").find("input[name=mi_fix]").eq(k).val(commafy(a));
var mihtml = "";
@ -361,14 +361,14 @@ foreach ($res as $data) {
mihtml += "<li>一年免保:" + commafy(data.content[k][6]) + "</li>";
mihtml += "<li>起吊+木箱+耗材:" + commafy(data.content[k][7]) + "</li>";
//mihtml += "<li>加價:"+commafy(data.content[k][9])+"</li>";
mihtml += "以上合計:" + commafy(data.content[k][12]) + "/台";
mihtml += "以上合計:" + commafy(data.content[k][12]) + "/台" ;
mihtml += "<hr>";
mihtml += "<h5>OPTION</h5>";
total_mi = total_mi + data.content[k][12];
console.log(data.content[k][12]);
Object.keys(data.content[k][14]).forEach(function(m) {
if (data.content[k][14][m][0] != '') {
mihtml += "<li>" + data.content[k][14][m][0] + ":" + commafy(data.content[k][14][m][1]) + "</li>";
mihtml += "<li>" + data.content[k][14][m][0].replace("&amp;lt;br&amp;gt;", "").replace("&lt;br&gt;", "").replace("&amp;", "").replace("amp;", "").replace("()", "").replace(/\s+/g, '') + ":" + commafy(data.content[k][14][m][1]) + "</li>";
}
});
Object.keys(data.content[k][16]).forEach(function(m) {
@ -382,16 +382,22 @@ foreach ($res as $data) {
mihtml += "<li>" + data.content[k][19][0] + ":" + commafy(data.content[k][19][1]) + "</li>";
mihtml += "以上合計:" + commafy(data.content[k][13]) +
"<br>";
total_mi += data.content[k][13];
if(total_mi == ""){
console.log("undefided!!!");
}
$("#tb1").find("tr[name=facil_templ2]").eq(k).find('td').eq(1).html(mihtml);
//$("#tb1").find("input[name=mi_fix]").eq(k).closest('td').append(mihtml);
console.log(document.getElementsByClassName('total_mi_fix')[k]);
document.getElementsByClassName('total_mi_fix')[k].value = commafy(total_mi)
// document.getElementsByClassName('item_price_ct')[k].value =commafy(total_mi)
document.getElementsByClassName('gross_profit')[k].value = commafy(Number(document.getElementsByClassName('item_price_ct')[k].value.replace(/[,]+/g, "")) - total_mi)
document.getElementsByClassName('gross_profit_rate')[k].value = Math.round((Number(document.getElementsByClassName('gross_profit')[k].value.replace(/[,]+/g, "")) / Number(document.getElementsByClassName('item_price_ct')[k].value.replace(/[,]+/g, "")) * 100) * 10) / 10
});
}
}
xhr.open('POST', 'pricereview_mi-api.php', true);
xhr.send(formdata);
@ -586,9 +592,9 @@ foreach ($res as $data) {
<td nowrap><a href="" data-toggle="modal"><?= $val["item_spec"]; ?> [規調]</a></td>
<td><input type="text" name="item_unit_price" class="form-control dollar-right" size="8" value="<?= number_format($val["item_unit_price"]); ?>"></td>
<td><input type="text" name="item_qty" class="form-control" size="2" value="1"></td>
<td><input type="text" name="item_price_bp" class="form-control dollar-right" size="9" value="<?= number_format($val["item_unit_price"]); ?>"></td>
<td><input type="text" name="mi_fix" class="form-control dollar-right" size="9" value="<?php echo ($val["mi_fix"]) ? number_format($val["mi_fix"]) : ""; ?>" disabled></td>
<td><input type="text" name="item_price_ct" class="form-control dollar-right" size="9" value="<?= number_format($val["item_price_ct"] / $val["item_qty"]); ?>"></td>
<td><input type="text" name="item_price_bp" class="form-control dollar-right" size="9" value="<?= number_format(1 * $val['item_unit_price']); ?>"></td>
<td><input type="text" name="mi_fix" class="form-control dollar-right total_mi_fix" size="9" value="<?php echo ($val["mi_fix"]) ? number_format($val["mi_fix"]) : ""; ?>" disabled></td>
<td><input type="text" name="item_price_ct" class="form-control dollar-right item_price_ct" size="9" value="<?= number_format($val["item_price_ct"] / $val["item_qty"]); ?>"></td>
<!--<td><input type="text" name="item_price" class="form-control dollar-right" size="8" value="<?php echo ($val["item_price"]) ? number_format($val["item_price"]) : ""; ?>"></td>
<td><input type="text" name="pv_rate" class="form-control" size="1" value="<?= $val["pv_rate"]; ?>"></td>
<td><input type="text" name="allocate" class="form-control" size="6" value="<?= $val["allocate"]; ?>"></td>-->

75
wms/mkt/pricereview-create.php

@ -29,9 +29,10 @@ if (!empty($row)) {
}
// 同一卷號只限一筆價審
$sql = "select count(*) from pricereview_main where contractno = '$vol_no' and status in ('Y1', 'YS', 'YY')";
$sql = "select count(*), price_total from pricereview_main where contractno = '$vol_no' and status in ('Y1', 'YS', 'YY')";
$res = mysqli_query($link, $sql);
$row = mysqli_fetch_row($res);
if ($row[0] > 0) {
echo "<script>";
echo "alert('請勿重覆價審!');";
@ -146,7 +147,7 @@ if ($last_pr_arr) {
// Option Data
$opt_data_arr = [];
$opt_kind_arr = ["A" => "小電梯型錄選配加價報價", "B" => "客梯型錄選配加價報價", "C" => "550-1600kg選配業務報價", "D" => "其它"];
$sql = "select * from option_price where status = 'Y' order by kind, id";
$sql = "select * from option_price where status = 'Y' order by id";
$res = mysqli_query($link, $sql);
while ($row = mysqli_fetch_assoc($res)) {
$opt_data_arr[$row["kind"]][$row["group_name"]][$row["id"]]["spec"] = $row["spec"];
@ -753,18 +754,12 @@ $option_str .= "</tbody></table>";
$("#optionModal").modal('show');
var jobj = $(this); // 父視窗
$("#optionModal .modal-body td").unbind().click(function() {
$("#optionModal .modal-body td").unbind().click(function(){
var pobj = $(this).closest('td').parent();
// console.log(pobj.find('input[name=optionID]').val());
// console.log(jobj.html(pobj.find('td').eq(0).html() + ' ' + pobj.find('td').eq(1).html()));
console.log(pobj.find('td').eq(0).html());
jobj.html(pobj.find('td').eq(1).html() + " " + pobj.find('td').eq(2).html() + '<br />(' + pobj.find('td').eq(3).html() + ')');
jobj.closest('td').parent().find('input[name=option_unit_price]').val(pobj.find('td').eq(6).html());
jobj.closest('td').parent().find('input[name=option_price_bp]').val(commafy(pobj.find('td').eq(6).html().replace(/[,]+/g, "") * jobj.closest('td').parent().find('input[name=option_qty]').val().replace(/[,]+/g, "")));
jobj.closest('td').parent().find('input[name=op_id]').val(pobj.find('td').eq(0).html());
$("#optionModal").modal('hide');
selectOptionFn(pobj, jobj)
});
$('#tb2').unbind('focus', 'tr[name=option_templ] a[name=option_href]');
});
$("#optionFaciModal").on("hidden.bs.modal", function() {
$("#optionFaciModal .modal-body").html('');
@ -876,7 +871,7 @@ $option_str .= "</tbody></table>";
});
$("input[name=pay_scale]").keyup(function() {
$(this).closest('td').next('td').find('input[name=pay_amount]').val(commafy(($("#price_total").val().replace(/[,]+/g, "") / 100 * $(this).val()).toFixed(0)));
$(this).closest('td').next('td').find('input[nam e=pay_amount]').val(commafy(($("#price_total").val().replace(/[,]+/g, "") / 100 * $(this).val()).toFixed(0)));
var payAllScale = 0;
var payAllAmt = 0;
$("input[name=pay_scale]").each(function() {
@ -1195,6 +1190,26 @@ $option_str .= "</tbody></table>";
});
if ((rv2 === false)) return rv2;
var rv3 = true;
$("input[name='price_total']").each(function() {
if (Number(this.value.replace(",", "")) <= 0) {
alert("售價總額需大於0!!!");
location.href = '#price_total';
return rv3 = false;
}
});
if ((rv3 === false)) return rv3;
var rv4 = true;
$("input[name='item_unit_price']").each(function() {
if (Number(this.value.replace(",", "")) <= 0) {
alert("請輸入正確規格!!!");
location.href = '#tb1';
return rv4 = false;
}
});
if ((rv4 === false)) return rv4; //item_unit_price
if ($("#pay_all_amount").val() != $("#price_total").val()) {
alert("【付款辦法】金額合計有誤!");
$("input[name=pay_scale]").eq(0).trigger("focus");
@ -1281,9 +1296,9 @@ $options = $stmt->fetchAll(PDO::FETCH_ASSOC);
<th scope="col" nowrap>定價</th>
</tr>
</thead>
<tbody>
<template x-for="option in options">
<tr style="cursor:pointer">
<tbody id="selectModalBody" x-ref="selectModalBody">
<template x-for="option in options" :key="option.id">
<tr style="cursor:pointer" x-show="option.status == 'Y'">
<td x-text='option.id' name="optionID"></td>
<td x-text="option.group_name"> </td>
<td x-text="option.spec"></td>
@ -2471,7 +2486,7 @@ if($_SERVER["REQUEST_METHOD"] == "POST"){
<input type="file" name="attatch2" id="attatch2"><a href="javascript:void(0);" name="filedel2" class="btn btn-danger btn-sm">X</a>
<div class="nextline"></div><br>
<button type="submit" name="save" id="save" value="save">保存</button>&nbsp;
<button type="submit" name="submit" id="submit" value="tosign">提交</button>
<button type="submit" name="submit" id="submit" value="tosign" >提交</button>
<input type="hidden" name="fp_id_all" id="fp_id_all">
<input type="hidden" name="fp_kind_all" id="fp_kind_all">
@ -2534,4 +2549,30 @@ include "../footer.php";
<script>
const options = [...<?php echo json_encode($options); ?>];
function selectOptionFn(pobj, jobj){
// var pobj = $(this).closest('td').parent();
console.log(pobj);
// console.log(pobj.find('input[name=optionID]').val());
// console.log(jobj.html(pobj.find('td').eq(0).html() + ' ' + pobj.find('td').eq(1).html()));
console.log(pobj.find('td').eq(0).html());
jobj.html(pobj.find('td').eq(1).html() + " " + pobj.find('td').eq(2).html() + '<br />(' + pobj.find('td').eq(3).html() + ')');
jobj.closest('td').parent().find('input[name=option_unit_price]').val(pobj.find('td').eq(6).html());
jobj.closest('td').parent().find('input[name=option_price_bp]').val(commafy(pobj.find('td').eq(6).html().replace(/[,]+/g, "") * jobj.closest('td').parent().find('input[name=option_qty]').val().replace(/[,]+/g, "")));
jobj.closest('td').parent().find('input[name=op_id]').val(pobj.find('td').eq(0).html());
$("#optionModal").modal('hide');
}
function checkSubmit(){
const price_total = document.getElementById('price_total')
if (Number(price_total.value.replace(",", "")) > 0) {
// 如果条件满足,允许表单提交
return true;
} else {
// 如果条件不满足,阻止表单提交
alert("售價總額需大於0!!");
return false;
}
}
</script>

170
wms/mkt/pricereview-index.php

@ -1,8 +1,8 @@
<?php
include "../header.php";
require_once('../contract/conn.php');
// if($user_id == "M0107" || $user_id == "M0174" || $user_id == "M0225"){
// }else{
// echo "維護中..";
// exit;
@ -37,7 +37,7 @@ if (!empty($_GET['system_id']) && !empty($_GET['flow_id'])) {
// echo '<pre>';
// print_r($sql_get);
// echo '</pre>';
// exit;
$result = mysqli_query($link, $sql_get);
if ($result == false) {
die(mysqli_error($link));
@ -57,15 +57,49 @@ if (!empty($_GET['system_id']) && !empty($_GET['flow_id'])) {
$id[] = $test;
}
}
$inClause = implode(',', $id);
}
// 查看已經簽核的單號。
if (!empty($_GET['check']) && $_GET['check'] == '1') {
if ($user_id == 'M0026' || $user_id == 'M0033') {
$sign = "sign1";
$clause = "sign1 like '%$user_id%' ";
}
if ($user_id == 'M0107' || $user_id == 'M0175') {
$sign = "sign2";
$clause = "sign2 like '%$user_id%' ";
}
if ($user_id == "M0060") {
$sign = "sign3";
$clause = "sign3 like '%$user_id%' ";
}
if (empty($sign)) {
echo "
<script>
alert('沒有該單號');
window.history.back();
</script>
";
}
$sql = "SELECT mid,$sign FROM pricereview_sign WHERE $clause ORDER BY mid";
$stmt = $conn->prepare($sql);
$stmt->execute();
$results = $stmt->fetchAll(PDO::FETCH_ASSOC);
foreach ($results as $result) {
if (strlen($result[$sign]) > 30 && $sign == 'sign2') {
$id[] = $result['mid'];
} else {
if (strlen($result[$sign]) > 10) {
$id[] = $result['mid'];
}
}
}
$inClause = implode(',', $id);
// echo '<pre>';
// print_r($inClause);
// echo '</pre>';
}
$data = array();
// sql語法存在變數中
$sql_cmd = sql_myself($user_id, "pricereview_main .creater");
@ -82,7 +116,7 @@ if ($user_id == "M0060") {
if (empty($sql_cmd)) $sql = "select pricereview_main.*, contract_new_apply.status as applystatus, contract_new_apply.progress as applyprogress from pricereview_main left join contract_new_apply on pricereview_main.id = contract_new_apply.mid where pricereview_main.status like 'Y%' and pricereview_main.ekind = '新梯' order by pricereview_main.id";
else $sql = "select pricereview_main.*, contract_new_apply.status as applystatus, contract_new_apply.progress as applyprogress from pricereview_main left join contract_new_apply on contract_new_apply.mid = pricereview_main.id $sql_cmd and pricereview_main.status like 'Y%' and pricereview_main.ekind = '新梯' order by pricereview_main.id";
if (!empty($res_get)) {
if (!empty($res_get) || (!empty($_GET['check']) && $_GET['check'] == 1)) {
$sql = "SELECT pricereview_main.*,contract_new_apply.status as applystatus, contract_new_apply.progress as applyprogress
from pricereview_main
left join contract_new_apply on contract_new_apply.mid = pricereview_main.id
@ -90,9 +124,40 @@ if (!empty($res_get)) {
$sql_cmd and pricereview_main.status like 'Y%' and pricereview_main.id IN ($inClause) AND pricereview_main.ekind = '新梯' order by pricereview_main.id";
// echo $sql;
}
$data = mysqli_query($link, $sql);
// 若結案不同意
if (!empty($_GET['check']) && $_GET['check'] == 2) {
foreach ($data as $data) {
if ($data['status'] == 'YY') {
$agree[] = $data['id'];
}
}
$inClause = implode(',', $agree);
$sql = "SELECT pricereview_main.*,contract_new_apply.status as applystatus, contract_new_apply.progress as applyprogress
from pricereview_main
left join contract_new_apply on contract_new_apply.mid = pricereview_main.id
$sql_cmd and pricereview_main.status like 'Y%' and pricereview_main.id IN ($inClause) AND pricereview_main.ekind = '新梯' order by pricereview_main.id";
$data = mysqli_query($link, $sql);
}
// 若結案同意
if (!empty($_GET['check']) && $_GET['check'] == 3) {
foreach ($data as $data) {
if ($data['status'] == 'YN') {
$agree[] = $data['id'];
}
}
$inClause = implode(',', $agree);
$sql = "SELECT pricereview_main.*,contract_new_apply.status as applystatus, contract_new_apply.progress as applyprogress
from pricereview_main
left join contract_new_apply on contract_new_apply.mid = pricereview_main.id
$sql_cmd and pricereview_main.status like 'Y%' and pricereview_main.id IN ($inClause) AND pricereview_main.ekind = '新梯' order by pricereview_main.id";
$data = mysqli_query($link, $sql);
}
$para = "function_name=pricereview&" . $token_link;
?>
<style>
#table_index2 {
@ -188,6 +253,80 @@ $para = "function_name=pricereview&" . $token_link;
</p>
-->
<?php
function get_pending($token)
{
global $link;
if (!$token) throw new \Exception("token empty", 802);
list($user_id) = explode(".", $token);
$i = 1;
$data = [];
$sql = "
SELECT
t.system_id,
t.system_name,
t.flow_id,
t.flow_name,
COUNT(*)
FROM (
SELECT s.form_key,
m.system_id,
y.system_name,
m.flow_id,
m.flow_name,
m.path
FROM subflow s,
flow f,
flow_main m,
system_main y
WHERE 1=1
AND m.flow_id NOT IN ('wws04')
AND EXISTS (
SELECT form_key,
MAX(seq)
FROM subflow
GROUP BY form_key
HAVING SUBSTRING(s.form_key, 1, 10) = form_key
AND s.seq = max(seq)
)
AND SUBSTRING(s.form_key, 1, 10) = f.form_key
AND f.flow_id = m.flow_id
AND f.system_id = y.system_id
AND s.current_assigner = '$user_id'
) t
GROUP BY t.system_id,
t.flow_id,
t.system_name,
t.flow_name
LIMIT 0, 6
";
// echo '<pre>';
// print_r($sql);
// echo '</pre>';
// exit;
$res = mysqli_query($link, $sql);
while ($row = mysqli_fetch_row($res)) {
// print_r($row);
$data[$i]["sid"] = $row[0];
$data[$i]["sname"] = $row[1];
$data[$i]["fid"] = $row[2];
$data[$i]["fname"] = $row[3];
$data[$i]["cnt"] = $row[4];
$i++;
}
mysqli_free_result($res);
return $data;
}
$result = get_pending($token);
print_r($result);
$result[1]['sid'] = !empty($result) ? $result[1]['sid'] : 'prm';
$result[1]['fid'] = !empty($result) ? $result[1]['fid'] : 'prm01';
if ($data) :
/*
if($_SERVER["REQUEST_METHOD"] == "POST"){
@ -199,8 +338,23 @@ if ($data) :
}
*/
?>
<style>
.categoryBtn{
width:120px;
height: 32px;
padding: 0;
line-height: 30px;
}
</style>
<link rel="stylesheet" href="common.css">
<div style="overflow-x:auto; white-space:nowrap;">
<?php if($user_id=== "M0060" || $user_id==="M0107" || $user_id==="M0175" || $user_id==="M0174" || $user_id==="M0225"){ ?>
<a href="/wms/mkt/pricereview-index.php?&function_name=pricereview&token=<?php echo $token; ?>" class=" btn <?php echo (!isset($_GET['system_id']) && !isset($_GET['check'])) ? "btn btn-primary" : "btn-secondary"; ?> btn-sm categoryBtn"> 所有價審</a>
<a href="/wms/mkt/pricereview-index.php?system_id=<?= $result[1]['sid'] ?>&flow_id=<?= $result[1]['fid'] ?>&function_name=pricereview&token=<?php echo $token; ?>" class=" btn <?php echo (isset($_GET['system_id'])) ? "btn-primary" : "btn-secondary"; ?> btn-sm categoryBtn"> 待我簽核</a>
<a href="/wms/mkt/pricereview-index.php?check=1&function_name=pricereview&token=<?php echo $token; ?>" class=" btn <?php echo (isset($_GET['check']) && $_GET['check'] == 1) ? "btn-primary" : "btn-secondary"; ?> btn-sm categoryBtn"> 簽核完畢</a>
<a href="/wms/mkt/pricereview-index.php?check=2&function_name=pricereview&token=<?php echo $token; ?>" class=" btn <?php echo (isset($_GET['check']) && $_GET['check'] == 2) ? "btn-primary" : "btn-secondary"; ?> btn-sm categoryBtn"> 結案同意</a>
<a href="/wms/mkt/pricereview-index.php?check=3&function_name=pricereview&token=<?php echo $token; ?>" class=" btn <?php echo (isset($_GET['check']) && $_GET['check'] == 3) ? "btn-primary" : "btn-secondary"; ?> btn-sm categoryBtn"> 結案不同意</a>
<?php } ?>
<table id="table_index" class="table table-striped table-bordered" style="width:100%">
<thead>
<tr>

10
wms/mkt/pricereview-record-check.php

@ -1,6 +1,6 @@
<?php
include "../header.php";
require_once("./conn.php");
if (isset($_POST['status'])) {
$fromsign = $_POST['fromsign'];
foreach ($_POST as $k => $v) {
@ -60,6 +60,7 @@ if (isset($_POST['status'])) {
} else {
$sql2 .= "status = 'YY'";
}
$sql_str = "";
} else {
$sql2 .= "status = 'YY'";
}
@ -140,7 +141,12 @@ if (isset($_POST['status'])) {
if ($fromsign == 1) {
echo "location.href='../sign/list.php?system_id=prm&flow_id=prm01&function_name=show&" . $token_link . "';";
} else {
echo "location.href='pricereview-check.php?id=" . $id . "&function_name=pricereview&" . $token_link . "';";
if ($user_id == "M0060") {
echo "alert('簽核成功!!!');";
echo "location.href='../sign/list.php?system_id=prm&flow_id=prm01&function_name=show&" . $token_link . "';";
} else {
echo "location.href='pricereview-check.php?id=" . $id . "&function_name=pricereview&" . $token_link . "';";
}
}
echo "</script>";
}

1
wms/mkt/pricereview_facility-api.php

@ -27,7 +27,6 @@ try {
foreach ($_POST as $k => $v) {
$$k = htmlspecialchars(stripslashes(trim($v)));
}
echo $fval;
list($source, $kind, $seat, $numberofstop, $speed, $op) = explode(",", $fval);
if (!$source || !$kind || !$seat) throw new \Exception("parameter empty[2]");

24
wms/mkt/pricereview_mi-api.php

@ -229,6 +229,7 @@ try {
$stmt->bindParam(':quotation_no', $quotation_no);
$stmt->execute();
$row_e = $stmt->fetch(PDO::FETCH_ASSOC);
// $sql2 = "select o.*, r.* from elevator_mi_option o, elevator_quotation_rule r ";
// $sql2 .= "where o.quotation_no = r.quotation_no and o.elevator_type = '" . $v['etype'] . "' ";
// $sql2 .= "and ($v[item_weight] between o.min_weight and o.max_weight) ";
@ -240,9 +241,12 @@ try {
// // echo $sql2;
// $res_e = mysqli_query($link, $sql2);
//$row_e = mysqli_fetch_assoc($res_e)
if ($row_e || true) {
if ($row_e) {
// 加價:先不納入
$row_e["option_price"] = 0;
if(!isset($row_e["purchase_cost"])){
}
// 基准采购成本+±1停材料费+设计费+出口费用
$part1 = $row_e["purchase_cost"] + ($v["floors"] - $row_e["base_floor"]) * $row_e["material_plus"] + $row_e["design"] * $row_e["design_hour"] + $row_e["export_fee"];
// 利潤
@ -311,13 +315,26 @@ try {
$todo_opt_arr = $v["option"];
if (empty($todo_opt_arr)) $todo_opt_arr = $opt_nosel_id_arr;
if (!empty($todo_opt_arr)) {
foreach ($todo_opt_arr as $val) {
foreach ($todo_opt_arr as $val) {
$sql4 = "select o.base_floor, o.base_floor_plus, o.price, r.equipment, p.price 'OP' ";
$sql4 .= "from option_mi o, elevator_quotation_rule r, option_price p ";
$sql4 .= "where o.quotation_no = r.quotation_no and o.option_price_id = p.id ";
$sql4 .= "and o.option_price_id = " . $opt_elev_arr[$val]["price_id"] . " ";
$sql4 .= "and ($v[item_weight] between o.min_weight and o.max_weight) and o.open_kind = '" . $v["item_op"] . "'";
$sql4 = "SELECT option_price.id,elevator_quotation_rule.equipment, option_mi.base_floor, option_mi.quotation_no, option_mi.base_floor_plus, option_mi.price, option_price.price as OP FROM option_price
LEFT JOIN option_mi ON option_price.id = option_mi.option_price_id
LEFT JOIN elevator_quotation_rule ON option_mi.quotation_no = elevator_quotation_rule.quotation_no
WHERE option_price.status = 'Y' ";
$sql4 = "SELECT option_price.id, elevator_quotation_rule.equipment, option_mi.base_floor, option_mi.quotation_no, option_mi.base_floor_plus, option_mi.price, option_price.price as OP
FROM option_price
LEFT JOIN option_mi ON option_price.id = option_mi.option_price_id
LEFT JOIN elevator_quotation_rule ON option_mi.quotation_no = elevator_quotation_rule.quotation_no
WHERE option_mi.option_price_id = " . $opt_elev_arr[$val]["price_id"] . "
AND (" . $v["item_weight"] . " BETWEEN option_mi.min_weight AND option_mi.max_weight)
AND option_mi.open_kind = '" . $v["item_op"] . "'";
$res_om = mysqli_query($link, $sql4);
if ($row_om = mysqli_fetch_assoc($res_om)) {
$row_om['price'] = (int)ceil($row_om['price']);
@ -333,6 +350,7 @@ try {
}
// 分配:OPTION數量除以電梯總台數
$option_amt = round(0 + ($row_om["price"] + $plus) * ($opt_elev_arr[$val]["item_qty"] / $myelev_qty) * $row_om["equipment"], 0);
// $option_amt = round($row_om['price'] * $opt_elev_arr[$val]["item_qty"], 0);
$option_fee += $option_amt; // option總金額
$oparr[$j][1] = $option_amt;
@ -424,6 +442,8 @@ try {
$mi_arr[$i][19] = $specarr;
$i++;
}
}else{
$rarr['err'] = "notfoundmi";
}
// mysqli_free_result($res_e);
}

7
wms/rib02-create.php

@ -120,11 +120,12 @@ foreach ($BizPartner as $biz) {
$invoiceNo = mysqli_query($link, $sql_invoiceNo);
$invoiceNo_array = array();
foreach ($invoiceNo as $invoice) {
array_push($invoiceNo_array, $invoice['InvoiceNo']);
if(is_iterable($invoiceNo)){
foreach ($invoiceNo as $invoice) {
array_push($invoiceNo_array, $invoice['InvoiceNo']);
}
}
$BizJSON = json_encode($BusinessPartner);
$InvoiceJSON = json_encode($invoiceNo_array);
$sql_Project = "SELECT * FROM comProject";

31
wms/rib02-submit.php

@ -19,10 +19,20 @@ foreach ($BizPartner as $biz) {
$sql_invoiceNo = "SELECT DISTINCT InvoiceNo FROM rib_sub WHERE rib_id !== $rib_id";
$invoiceNo = mysqli_query($link, $sql_invoiceNo);
$invoiceNo_array = array();
foreach ($invoiceNo as $invoice) {
array_push($invoiceNo_array, $invoice['InvoiceNo']);
if (is_iterable($invoiceNo)) {
foreach ($invoiceNo as $invoice) {
array_push($invoiceNo_array, $invoice['InvoiceNo']);
}
}
// 取得同筆報銷單的明細資料
$sql_all_ribsub = "SELECT * FROM rib_sub WHERE rib_id = $rib_id";
$all_ribsub_data = mysqli_query($link, $sql_all_ribsub);
if (is_iterable($all_ribsub_data)) {
foreach ($all_ribsub_data as $allribsub) {
$CurrLAmount = $allribsub['CurrentLAmount'];
}
}
$RowCode = $_POST['RowCode'];
$FeeDate = $_POST['FeeDate'];
$FeeTypeGen = isset($_POST['FeeTypeGen']) ? $_POST['FeeTypeGen'] : null;
@ -42,9 +52,10 @@ $IsCounteract = $_POST['IsCounteract'];
$InvoiceId = $_POST['InvoiceId'];
$VoucherCount = empty($_POST['VoucherCount']) ? 1 : $_POST['VoucherCount'];
$VoucherType = isset($_POST['VoucherType']) ? $_POST['VoucherType'] : 0;
$InvoiceNo = empty($_POST['InvoiceNo']) ? " ": (in_array(str_replace("-", "",$_POST['InvoiceNo']), $invoiceNo_array) ? " ": str_replace("-", "",$_POST['InvoiceNo']));
$InvoiceNo = empty($_POST['InvoiceNo']) ? " " : (in_array(str_replace("-", "", $_POST['InvoiceNo']), $invoiceNo_array) ? " " : str_replace("-", "", $_POST['InvoiceNo']));
$CurrLAmount = empty($_POST['CurrLAmount']) ? ($CurrId == "TWD" ? 1 : null) : $_POST['CurrLAmount'];
$CurrLAmount = empty($_POST['CurrLAmount']) ? null : $_POST['CurrLAmount'];
// $comSupplierName = empty($_POST['comSupplierName']) ? null : $_POST['comSupplierName'];
$FromSourceTag = 0;
$TaxRate = ($TaxId == "ST005") ? 0.05 : 0;
@ -54,7 +65,7 @@ if ($CurrId == "TWD") {
$OAmountUnWithTax = isset($_POST['OAmountUnWithTax']) ? round($_POST['OAmountUnWithTax']) : null;
$LAmountUnWithTax = isset($_POST['LAmountUnWithTax']) ? round($_POST['LAmountUnWithTax']) : null;
$LAmount = isset($_POST['LAmount']) ? round($_POST['LAmount']) : null;
}else{
} else {
$OTax = isset($_POST['OTax']) ? round($_POST['OTax'], 2) : NULL;
$LTax = isset($_POST['LTax']) ? round($_POST['LTax'], 2) : NULL;
$OAmountUnWithTax = isset($_POST['OAmountUnWithTax']) ? round($_POST['OAmountUnWithTax'], 2) : null;
@ -62,7 +73,7 @@ if ($CurrId == "TWD") {
$LAmount = isset($_POST['LAmount']) ? round($_POST['LAmount'], 2) : null;
}
$TaxNo = empty($_POST['TaxNo']) ? '' : $_POST['TaxNo'];
$TaxNo = empty($_POST['TaxNo']) ? ' ' : $_POST['TaxNo'];
if (empty($TaxNo)) {
$comSupplierName = "雜項請款用";
} else {
@ -90,10 +101,13 @@ if (isset($comSupplierName) && ($comSupplierName != "雜項請款用")) {
$SQL1 = "";
if ($submit == "add") {
if (($user_id == "M0056") || ($user_id == "M0209")) {
$ribsub_query = "SELECT * FROM rib_sub WHERE rib_id = $rib_id";
$ribsub_data = mysqli_query($link, $ribsub_query);
$SQL1 = "INSERT INTO rib_sub (`RowCode`,`rib_id`,`RowNo`,`FeeDate`,`FeeTypeId`,`WriteOffType`,
`BizOrgId`,`WriteOffId`,`FeeOrgId`,`FeeDeptId`,`FeeCompanyId`,`UnitId`,`Quantity`,
`Price`,`OAmount`,`FeeNoteShow`,`CurrId`,`SupplyOrgId`,`CurrOAmount`,`FromSourceTag`,`TaxId`,`IsCounteract`,`InvoiceId`,`TaxRate`,`CreatorId`,`TaxNo`,`CurrentLAmount`,`OTax`,`LTax`,
`Price`,`OAmount`,`FeeNoteShow`,`CurrId`,`SupplyOrgId`,`CurrOAmount`,`FromSourceTag`,`TaxId`,`IsCounteract`,`InvoiceId`,`TaxRate`,`CreatorId`,`TaxNo`,`OTax`,`LTax`,
`OAmountUnWithTax`,`LAmountUnWithTax`,`LAmount`";
$SQL1 .= isset($CurrLAmount) ? ",`CurrentLAmount`" : "";
$SQL1 .= empty($ProjectId) ? "" : ",`ProjectId`";
$SQL1 .= isset($FeeTypeGen) ? ",`FeeTypeGen`" : "";
$SQL1 .= empty($CU_MaterialId) ? "" : ",`CU_MaterialId`";
@ -105,8 +119,9 @@ if ($submit == "add") {
$SQL2 = ") VALUES ($RowCode, $rib_id, $RowCode,$FeeDate,'$FeeTypeId',2,
'1000','$WriteOffId','1000','$FeeDeptId','1000','$UnitId',$Quantity,
$Price,$OAmount,'$FeeNoteShow','$CurrId','1000',1,0,'$TaxId',$IsCounteract,'$InvoiceId',$TaxRate,'$user_id','$TaxNo',$CurrLAmount,$OTax,$LTax,
$Price,$OAmount,'$FeeNoteShow','$CurrId','1000',1,0,'$TaxId',$IsCounteract,'$InvoiceId',$TaxRate,'$user_id','$TaxNo',$OTax,$LTax,
$OAmountUnWithTax,$LAmountUnWithTax,$LAmount";
$SQL2 .= isset($CurrLAmount) ? "," . $CurrLAmount : "";
$SQL2 .= empty($ProjectId) ? "" : ",'" . $ProjectId . "'";
$SQL2 .= isset($FeeTypeGen) ? "," . $FeeTypeGen : "";
$SQL2 .= empty($CU_MaterialId) ? "" : ",'" . $CU_MaterialId . "'";

2
workflow/lib/DB.php

@ -19,7 +19,7 @@ if (file_exists($envFile)) {
class DB
{
private static $ds = array(
'default' => array('host' => '127.0.0.1', 'db_name' => 'appwms', 'user' => 'masadaroot', 'pwd' => 'x6h5E5p#u8y')
'default' => array('host' => '127.0.0.1', 'db_name' => 'appwms', 'user' => 'masadaroot', 'pwd' => '')
);
public static $instance;
/**

Loading…
Cancel
Save