Browse Source

更新電梯標準價查詢

main
Cheng 1 year ago
parent
commit
4fb67d254d
  1. 6
      wms/cont/sign_list.php
  2. 254
      wms/contract/api/postContractData.php
  3. 1651
      wms/mkt/price_normal-index.php
  4. 8
      wms/mkt/pricereview-create.php
  5. 5040
      wms/mkt/pricereview_renovate-create.php

6
wms/cont/sign_list.php

@ -76,9 +76,9 @@ status,
f_return_content('payment_kind',payment_kind ) payment_kind FROM $table f_return_content('payment_kind',payment_kind ) payment_kind FROM $table
where 1=1 $where ORDER BY vol_no"; where 1=1 $where ORDER BY vol_no";
$data = mysqli_query($link, $sql); $data = mysqli_query($link, $sql);
echo '<pre>'; // echo '<pre>';
print_r($sql); // print_r($sql);
echo '</pre>'; // echo '</pre>';
?> ?>

254
wms/contract/api/postContractData.php

@ -354,6 +354,8 @@ function T8insert($data, $facilityno)
$contract_end_date = !empty($data['contract_end_date']) ? $data['contract_end_date'] : null; $contract_end_date = !empty($data['contract_end_date']) ? $data['contract_end_date'] : null;
$num = !empty($data['num']) ? $data['num'] : null; // 電梯數量 $num = !empty($data['num']) ? $data['num'] : null; // 電梯數量
$elevators = !empty($data['elevators']) ? json_decode($data['elevators'], true) : []; //電梯 $elevators = !empty($data['elevators']) ? json_decode($data['elevators'], true) : []; //電梯
$area = !empty($_POST['area']) ? $_POST['area'] : null; //縣市 Ex. A->台北 , B-> ..。
$user_id = !empty($_POST['user_id']) ? $_POST['user_id'] : null; $user_id = !empty($_POST['user_id']) ? $_POST['user_id'] : null;
@ -368,141 +370,143 @@ function T8insert($data, $facilityno)
$createTime = str_replace("-", '', $date); $createTime = str_replace("-", '', $date);
$beginDate = str_replace("-", '', $contract_begin_date); $beginDate = str_replace("-", '', $contract_begin_date);
$endDate = str_replace("-", '', $contract_end_date); $endDate = str_replace("-", '', $contract_end_date);
// if (empty($result)) { if (empty($result)) {
// 若 客戶資料為空,新增一筆到 comCustomer // 若 客戶資料為空,新增一筆到 comCustomer
// 新增客戶資料 // 新增客戶資料
$sql = "INSERT INTO comBusinessPartner(BizPartnerId,BizPartnerName,BusinessAttr,WorkTelNo,BizToDate,TaxNo,EnterpriseName,ContactAddress,EMail,CreatorId,CreateTime,BizPartnerTypeId) $sql = "INSERT INTO comBusinessPartner
VALUES(:BizPartnerId,:BizPartnerName,1,:WorkTelNo,99999999,:TaxNo,:EnterpriseName,:ContactAddress,:EMail,:CreatorId,:CreateTime,'10')"; (BizPartnerId,BizPartnerName,BusinessAttr,CountryId,WorkTelNo,BizToDate,TaxNo,EnterpriseName,ContactAddress,EMail,CreatorId,CreateTime,BizPartnerTypeId)
$stmt = $connT8->prepare($sql); VALUES(:BizPartnerId,:BizPartnerName,1,'TW',:WorkTelNo,99999999,:TaxNo,:EnterpriseName,:ContactAddress,:EMail,:CreatorId,:CreateTime,'10')";
$stmt->bindParam(':BizPartnerId', $contractno); $stmt = $connT8->prepare($sql);
$stmt->bindParam(':BizPartnerName', $partyA); $stmt->bindParam(':BizPartnerId', $contractno);
$stmt->bindParam(':WorkTelNo', $phone); $stmt->bindParam(':BizPartnerName', $partyA);
$stmt->bindParam(':TaxNo', $vat); $stmt->bindParam(':WorkTelNo', $phone);
$stmt->bindParam(':EnterpriseName', $customer); //企業名稱 $stmt->bindParam(':TaxNo', $vat);
$stmt->bindParam(':ContactAddress', $partyAaddress); $stmt->bindParam(':EnterpriseName', $customer); //企業名稱
$stmt->bindParam(':EMail', $email); $stmt->bindParam(':ContactAddress', $partyAaddress);
$stmt->bindParam(':CreatorId', $user_id); $stmt->bindParam(':EMail', $email);
$stmt->bindParam(':CreateTime', $createTime); $stmt->bindParam(':CreatorId', $user_id);
$stmt->bindParam(':CreateTime', $createTime);
$stmt->execute(); $stmt->execute();
$sql = "INSERT INTO comCustomer(OrgId,BizPartnerTypeId,BizPartnerId,PersonId,CreatorId,IsInUsed,InvoiceAddress,CreateTime) $sql = "INSERT INTO comCustomer(OrgId,BizPartnerTypeId,CurrId,BizPartnerId,PersonId,CreatorId,IsInUsed,InvoiceAddress,CreateTime)
VALUES('1000','10',:BizPartnerId,:PersonId,:CreatorId,1,:InvoiceAddress,:CreateTime)"; VALUES('1000','10','TWD',:BizPartnerId,:PersonId,:CreatorId,1,:InvoiceAddress,:CreateTime)";
$stmt = $connT8->prepare($sql); $stmt = $connT8->prepare($sql);
$stmt->bindParam(':BizPartnerId', $contractno); $stmt->bindParam(':BizPartnerId', $contractno);
$stmt->bindParam(':PersonId', $salesman); $stmt->bindParam(':PersonId', $salesman);
$stmt->bindParam(':CreatorId', $user_id); $stmt->bindParam(':CreatorId', $user_id);
$stmt->bindParam(':InvoiceAddress', $address); $stmt->bindParam(':InvoiceAddress', $address);
$stmt->bindParam(':CreateTime', $createTime); $stmt->bindParam(':CreateTime', $createTime);
$stmt->execute(); $stmt->execute();
} else {
// // 若客戶資料不為空,更新該客戶資訊。
$sql = "UPDATE comCustomer SET
PersonId=:PersonId,
InvoiceAddress=:InvoiceAddress,
LastOperatorId=:LastOperatorId,
LastOperateTime=:LastOperateTime
WHERE BizPartnerId=:BizPartnerId
";
$stmt = $connT8->prepare($sql);
$stmt->bindParam(':PersonId', $salesman);
$stmt->bindParam(':InvoiceAddress', $address);
$stmt->bindParam(':LastOperatorId', $user_id);
$stmt->bindParam(':LastOperateTime', $createTime);
$stmt->bindParam(':BizPartnerId', $contractno);
$stmt->execute();
// $sql = "INSERT INTO comBusinessPartner(BizPartnerId,BizPartnerName,WorkTelNo,TaxNo,EnterpriseName,ContactAddress,EMail,CreatorId,CreateTime)VALUES(:BizPartnerId,:BizPartnerName,:WorkTelNo,:TaxNo,:EnterpriseName,:ContactAddress,:EMail,:CreatorId,:CreateTime)"; $sql = "UPDATE comBusinessPartner SET
// $stmt = $connT8->prepare($sql); BizPartnerName=:BizPartnerName,
// $stmt->bindParam(':BizPartnerId', $contractno); WorkTelNo=:WorkTelNo,
// $stmt->bindParam(':BizPartnerName', $partyA); TaxNo=:TaxNo,
// $stmt->bindParam(':WorkTelNo', $phone); EnterpriseName=:EnterpriseName,
// $stmt->bindParam(':TaxNo', $vat); ContactAddress=:ContactAddress,
// $stmt->bindParam(':EnterpriseName', $customer); //企業名稱 EMail=:EMail,
// $stmt->bindParam(':ContactAddress', $partyAaddress); LastOperatorId=:LastOperatorId,
// $stmt->bindParam(':EMail', $email); LastOperateTime=:LastOperateTime
// $stmt->bindParam(':CreatorId', $user_id); WHERE BizPartnerId = :BizPartnerId
// $stmt->bindParam(':CreateTime', $createTime); ";
$stmt = $connT8->prepare($sql);
// $stmt->execute(); $stmt->bindParam(':BizPartnerName', $partyA);
// } else { $stmt->bindParam(':WorkTelNo', $phone);
// // 若客戶資料不為空,更新該客戶資訊。 $stmt->bindParam(':TaxNo', $vat);
// $sql = "UPDATE comCustomer SET $stmt->bindParam(':EnterpriseName', $customer);
// PersonId=:PersonId, $stmt->bindParam(':ContactAddress', $partyAaddress);
// InvoiceAddress=:InvoiceAddress, $stmt->bindParam(':EMail', $email);
// LastOperatorId=:LastOperatorId, $stmt->bindParam(':LastOperatorId', $user_id);
// LastOperateTime=:LastOperateTime, $stmt->bindParam(':LastOperateTime', $createTime);
// WHERE BizPartnerId=:BizPartnerId $stmt->bindParam(':BizPartnerId', $contractno);
// "; $stmt->execute();
// $stmt = $connT8->prepare($sql); }
// $stmt->bindParam(':PersonId', $salesman); // echo '<pre>';
// $stmt->bindParam(':InvoiceAddress', $address); // print_r($elevators['maintainance']);
// $stmt->bindParam(':LastOperatorId', $user_id); // echo '</pre>';
// $stmt->bindParam(':LastOperateTime', $createTime); foreach ($elevators as $index => $elevator) {
// $stmt->bindParam(':BizPartnerId', $contractno); $type[] = $elevator['maintainance'];
// $stmt->execute(); if ($type[$index] == 'A') {
$type = 'C3';
} else if ($type[$index] == 'B') {
// $sql = "UPDATE comBusinessPartner SET $type = 'C4';
// BizPartnerName=:BizPartnerName, } else if ($type[$index] == 'C') {
// WorkTelNo=:WorkTelNo, $type = 'C5';
// TaxNo=:TaxNo, }
// EnterpriseName=:EnterpriseName, }
// ContractAddress=:ContractAddress, // echo '<pre>';
// EMail=:EMail, // print_r($type);
// LastOperatorId=:LastOperatorId, // echo '</pre>';
// LastOperateTime=:LastOperateTime
// WHERE BizPartnerId = :BizPartnerId
// ";
// $stmt = $connT8->prepare($sql);
// $stmt->bindParam(':BizPartnerName', $partyA);
// $stmt->bindParam(':WorkTelNo', $phone);
// $stmt->bindParam(':TaxNo', $vat);
// $stmt->bindParam(':EnterpriseName', $customer);
// $stmt->bindParam(':ContractAddress', $partyAaddress);
// $stmt->bindParam(':EMail', $email);
// $stmt->bindParam(':LastOperatorId', $user_id);
// $stmt->bindParam(':LastOperateTime', $createTime);
// $stmt->bindParam(':BizPartnerId', $contractno);
// $stmt->execute();
// }
// //新增於 comProject。合約 table // //新增於 comProject。合約 table
// $sql = "INSERT INTO comProject(ProjectId,ProjectName,TypeId,ValidityFromDate,ValidityToDate,CreateTime,CreatorId,IsInUsed) VALUES(:ProjectId,:ProjectName,:TypeId,:ValidityFromDate,ValidityToDate,:CreateTime,:CreatorId,1)"; $sql = "INSERT INTO comProject(ProjectId,ProjectName,TypeId,ValidityFromDate,ValidityToDate,CreateTime,CreatorId,IsInUsed)
// $stmt = $connT8->prepare($sql); VALUES(:ProjectId,:ProjectName,:TypeId,:ValidityFromDate,:ValidityToDate,:CreateTime,:CreatorId,1)";
// $stmt->bindParam(':ProjectId', $contractno); $stmt = $connT8->prepare($sql);
// $stmt->bindParam(':ProjectName', $customer); $stmt->bindParam(':ProjectId', $contractno);
// $stmt->bindParam(':TypeId', $elevators['maintainance']); $stmt->bindParam(':ProjectName', $customer);
// $stmt->bindParam(':ValidityFromDate', $beginDate); $stmt->bindParam(':TypeId', $type);
// $stmt->bindParam(':ValidityToDate', $endDate); $stmt->bindParam(':ValidityFromDate', $beginDate);
// $stmt->bindParam(':CreateTime', $createTime); $stmt->bindParam(':ValidityToDate', $endDate);
// $stmt->bindParam(':CreatorId', $user_id); $stmt->bindParam(':CreateTime', $createTime);
// $stmt->execute(); $stmt->bindParam(':CreatorId', $user_id);
$stmt->execute();
// // 新增電梯數 // // 新增電梯數
// foreach ($elevators as $index => $elevator) { foreach ($elevators as $index => $elevator) {
// echo '<pre>'; echo '<pre>';
// print_r($elevator); print_r($elevator);
// echo '</pre>'; echo '</pre>';
// if ($elevator['maintainance'] == 'A') {
// $elevator['maintainance'] = 'C3'; $sql = "INSERT INTO comMaterial
// } else if ($elevator['maintainance'] == 'B') { (MaterialId,MaterialCategoryId,CreatorId,CreateTime)
// $elevator['maintainance'] = 'C4'; VALUES (:MaterialId,'E',:CreatorId,:CreateTime)";
// } else if ($elevator['maintainance'] == 'C') { $stmt = $connT8->prepare($sql);
// $elevator['maintainance'] = 'C5'; $stmt->bindParam(':MaterialId', $facilityno[$index]);
// } $stmt->bindParam(':CreatorId', $user_id);
// $sql = "INSERT INTO comMaterial(MaterialId,MaterialCategoryId,CreatorId,CreateTime) VALUES (:MaterialId,'E',:CreatorId,:CreateTime)"; $stmt->bindParam(':CreateTime', $createTime);
// $stmt = $connT8->prepare($sql); $stmt->execute();
// $stmt->bindParam(':MaterialId', $facilityno[$index]); /// 還沒修完
// $stmt->bindParam(':CreatorId', $user_id);
// $stmt->bindParam(':CreateTime', $createTime); $sql = "INSERT INTO comMaterialGroup
// $stmt->execute(); (MaterialTypeId,MaterialId,MaterialName,MaterialCategoryId,UnitId,CreatorId,CreateTime)
// /// 還沒修完 VALUES ('10',:MaterialId,:MaterialName,'E','SET',:CreatorId,:CreateTime)";
$stmt = $connT8->prepare($sql);
// $sql = "INSERT INTO comMaterialGroup(MaterialId,MaterialName,MaterialCategoryId,UnitId,CreatorId,CreateTime) VALUES (:MaterialId,:MaterialName,'E','SET',:CreatorId,:CreateTime)"; $stmt->bindParam(':MaterialId', $facilityno[$index]);
// $stmt = $connT8->prepare($sql); $stmt->bindParam(':MaterialName', $customer);
// $stmt->bindParam(':MaterialId', $facilityno[$index]); $stmt->bindParam(':CreatorId', $user_id);
// $stmt->bindParam(':MaterialName', $customer); $stmt->bindParam(':CreateTime', $createTime);
// $stmt->bindParam(':CreatorId', $user_id); $stmt->execute();
// $stmt->bindParam(':CreateTime', $createTime); /// 還沒修完
// $stmt->execute();
// /// 還沒修完 $sql = "INSERT INTO comMaterialPurchases
(MaterialId,CurrId,SUnitId,TaxId,CreatorId,CreateTime)
// $sql = "INSERT INTO comMaterialPurchases(MaterialId,CurrId,SUnitId,TaxId,CreatorId,CreateTime) VALUES (:MaterialId,'TWD','SET','ST005',:CreatorId,:CreateTime)"; VALUES (:MaterialId,'TWD','SET','ST005',:CreatorId,:CreateTime)";
// $stmt = $connT8->prepare($sql); $stmt = $connT8->prepare($sql);
// $stmt->bindParam(':MaterialId', $facilityno[$index]); $stmt->bindParam(':MaterialId', $facilityno[$index]);
// $stmt->bindParam(':CreatorId', $user_id); $stmt->bindParam(':CreatorId', $user_id);
// $stmt->bindParam(':CreateTime', $createTime); $stmt->bindParam(':CreateTime', $createTime);
// $stmt->execute(); $stmt->execute();
}
$connT8->commit(); $connT8->commit();
// }
} }

1651
wms/mkt/price_normal-index.php

File diff suppressed because it is too large

8
wms/mkt/pricereview-create.php

@ -47,6 +47,7 @@ if (count($last_pr_arr) > 0) {
$last_pr_arr["qty_total"] += $last_pritem_arr["A"][$row["item_no"]]["item_qty"]; $last_pr_arr["qty_total"] += $last_pritem_arr["A"][$row["item_no"]]["item_qty"];
} }
} }
mysqli_free_result($res); mysqli_free_result($res);
$sql = "select * from pricereview_pay where mid = '" . $last_pr_arr["id"] . "' order by pay_kind"; $sql = "select * from pricereview_pay where mid = '" . $last_pr_arr["id"] . "' order by pay_kind";
@ -143,6 +144,7 @@ while ($row = mysqli_fetch_assoc($res)) {
$opt_data_arr[$row["kind"]][$row["group_name"]][$row["id"]]["unit"] = $row["unit"]; $opt_data_arr[$row["kind"]][$row["group_name"]][$row["id"]]["unit"] = $row["unit"];
$opt_data_arr[$row["kind"]][$row["group_name"]][$row["id"]]["price"] = $row["price"]; $opt_data_arr[$row["kind"]][$row["group_name"]][$row["id"]]["price"] = $row["price"];
} }
mysqli_free_result($res); mysqli_free_result($res);
$option_str = '<table id="table_index2" class="table table-striped table-bordered" style="width:100%">'; $option_str = '<table id="table_index2" class="table table-striped table-bordered" style="width:100%">';
$option_str .= '<thead> $option_str .= '<thead>
@ -506,7 +508,7 @@ $option_str .= "</tbody></table>";
$(document).ready(function() { $(document).ready(function() {
$('input[name=pay_scale]').each(function() { $('input[name=pay_scale]').each(function() {
if ($(this).val() != '') { if ($(this).val() != '') {
console.log($(this).val()); // console.log($(this).val());
$(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[name=pay_amount]').val(commafy(($("#price_total").val().replace(/[,]+/g, "") / 100 * $(this).val()).toFixed(0)));
var payAllScale = 0; var payAllScale = 0;
var payAllAmt = 0; var payAllAmt = 0;
@ -737,11 +739,13 @@ $option_str .= "</tbody></table>";
var jobj = $(this); // 父視窗 var jobj = $(this); // 父視窗
$("#optionModal .modal-body td").unbind().click(function() { $("#optionModal .modal-body td").unbind().click(function() {
var pobj = $(this).closest('td').parent(); var pobj = $(this).closest('td').parent();
console.log(jobj.html(pobj.find('td').eq(0).html() + ' ' + pobj.find('td').eq(1).html()));
jobj.html(pobj.find('td').eq(0).html() + ' ' + pobj.find('td').eq(1).html()); jobj.html(pobj.find('td').eq(0).html() + ' ' + pobj.find('td').eq(1).html());
jobj.closest('td').parent().find('input[name=option_unit_price]').val(pobj.find('td').eq(5).html()); jobj.closest('td').parent().find('input[name=option_unit_price]').val(pobj.find('td').eq(5).html());
jobj.closest('td').parent().find('input[name=option_price_bp]').val(commafy(pobj.find('td').eq(5).html().replace(/[,]+/g, "") * jobj.closest('td').parent().find('input[name=option_qty]').val().replace(/[,]+/g, ""))); jobj.closest('td').parent().find('input[name=option_price_bp]').val(commafy(pobj.find('td').eq(5).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('input[name=option_id]').val()); jobj.closest('td').parent().find('input[name=op_id]').val(pobj.find('input[name=option_id]').val());
$("#optionModal").modal('hide'); $("#optionModal").modal('hide');
}); });
}); });
$("#optionFaciModal").on("hidden.bs.modal", function() { $("#optionFaciModal").on("hidden.bs.modal", function() {
@ -1817,7 +1821,7 @@ if($_SERVER["REQUEST_METHOD"] == "POST"){
?> ?>
<tr name="option_templ"> <tr name="option_templ">
<td name="option_seat"> <td name="option_seat">
<a href="" name="option_href" data-toggle="modal"><?php echo $v["item_spec"]; ?></a> <a href="" name="option_href" data-toggle="modal"><?php echo $v["item_spec"] . '-(' . $v['item-memo'] . ')'; ?></a>
</td> </td>
<td><input type="text" name="option_unit_price" class="form-control dollar-right" size="8" value="<?php echo number_format($v["item_unit_price"]); ?>" readonly></td> <td><input type="text" name="option_unit_price" class="form-control dollar-right" size="8" value="<?php echo number_format($v["item_unit_price"]); ?>" readonly></td>
<td><input type="text" name="option_qty" class="form-control" size="2" maxlength="2" value="<?php echo $v["item_qty"]; ?>"></td> <td><input type="text" name="option_qty" class="form-control" size="2" maxlength="2" value="<?php echo $v["item_qty"]; ?>"></td>

5040
wms/mkt/pricereview_renovate-create.php

File diff suppressed because it is too large
Loading…
Cancel
Save