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
where 1=1 $where ORDER BY vol_no";
$data = mysqli_query($link, $sql);
echo '<pre>';
print_r($sql);
echo '</pre>';
// echo '<pre>';
// print_r($sql);
// 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;
$num = !empty($data['num']) ? $data['num'] : null; // 電梯數量
$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;
@ -368,141 +370,143 @@ function T8insert($data, $facilityno)
$createTime = str_replace("-", '', $date);
$beginDate = str_replace("-", '', $contract_begin_date);
$endDate = str_replace("-", '', $contract_end_date);
// if (empty($result)) {
// 若 客戶資料為空,新增一筆到 comCustomer
// 新增客戶資料
$sql = "INSERT INTO comBusinessPartner(BizPartnerId,BizPartnerName,BusinessAttr,WorkTelNo,BizToDate,TaxNo,EnterpriseName,ContactAddress,EMail,CreatorId,CreateTime,BizPartnerTypeId)
VALUES(:BizPartnerId,:BizPartnerName,1,:WorkTelNo,99999999,:TaxNo,:EnterpriseName,:ContactAddress,:EMail,:CreatorId,:CreateTime,'10')";
$stmt = $connT8->prepare($sql);
$stmt->bindParam(':BizPartnerId', $contractno);
$stmt->bindParam(':BizPartnerName', $partyA);
$stmt->bindParam(':WorkTelNo', $phone);
$stmt->bindParam(':TaxNo', $vat);
$stmt->bindParam(':EnterpriseName', $customer); //企業名稱
$stmt->bindParam(':ContactAddress', $partyAaddress);
$stmt->bindParam(':EMail', $email);
$stmt->bindParam(':CreatorId', $user_id);
$stmt->bindParam(':CreateTime', $createTime);
if (empty($result)) {
// 若 客戶資料為空,新增一筆到 comCustomer
// 新增客戶資料
$sql = "INSERT INTO comBusinessPartner
(BizPartnerId,BizPartnerName,BusinessAttr,CountryId,WorkTelNo,BizToDate,TaxNo,EnterpriseName,ContactAddress,EMail,CreatorId,CreateTime,BizPartnerTypeId)
VALUES(:BizPartnerId,:BizPartnerName,1,'TW',:WorkTelNo,99999999,:TaxNo,:EnterpriseName,:ContactAddress,:EMail,:CreatorId,:CreateTime,'10')";
$stmt = $connT8->prepare($sql);
$stmt->bindParam(':BizPartnerId', $contractno);
$stmt->bindParam(':BizPartnerName', $partyA);
$stmt->bindParam(':WorkTelNo', $phone);
$stmt->bindParam(':TaxNo', $vat);
$stmt->bindParam(':EnterpriseName', $customer); //企業名稱
$stmt->bindParam(':ContactAddress', $partyAaddress);
$stmt->bindParam(':EMail', $email);
$stmt->bindParam(':CreatorId', $user_id);
$stmt->bindParam(':CreateTime', $createTime);
$stmt->execute();
$stmt->execute();
$sql = "INSERT INTO comCustomer(OrgId,BizPartnerTypeId,BizPartnerId,PersonId,CreatorId,IsInUsed,InvoiceAddress,CreateTime)
VALUES('1000','10',:BizPartnerId,:PersonId,:CreatorId,1,:InvoiceAddress,:CreateTime)";
$stmt = $connT8->prepare($sql);
$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', $contractno);
$stmt->bindParam(':PersonId', $salesman);
$stmt->bindParam(':CreatorId', $user_id);
$stmt->bindParam(':InvoiceAddress', $address);
$stmt->bindParam(':CreateTime', $createTime);
$stmt->bindParam(':BizPartnerId', $contractno);
$stmt->bindParam(':PersonId', $salesman);
$stmt->bindParam(':CreatorId', $user_id);
$stmt->bindParam(':InvoiceAddress', $address);
$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)";
// $stmt = $connT8->prepare($sql);
// $stmt->bindParam(':BizPartnerId', $contractno);
// $stmt->bindParam(':BizPartnerName', $partyA);
// $stmt->bindParam(':WorkTelNo', $phone);
// $stmt->bindParam(':TaxNo', $vat);
// $stmt->bindParam(':EnterpriseName', $customer); //企業名稱
// $stmt->bindParam(':ContactAddress', $partyAaddress);
// $stmt->bindParam(':EMail', $email);
// $stmt->bindParam(':CreatorId', $user_id);
// $stmt->bindParam(':CreateTime', $createTime);
// $stmt->execute();
// } else {
// // 若客戶資料不為空,更新該客戶資訊。
// $sql = "UPDATE comCustomer SET
// PersonId=:PersonId,
// InvoiceAddress=:InvoiceAddress,
// LastOperatorId=:LastOperatorId,
// LastOperateTime=:LastOperateTime,
// WHERE BizPartnerId=:BizPartnerId
// ";
// $stmt = $connT8->prepare($sql);
// $stmt->bindParam(':PersonId', $salesman);
// $stmt->bindParam(':InvoiceAddress', $address);
// $stmt->bindParam(':LastOperatorId', $user_id);
// $stmt->bindParam(':LastOperateTime', $createTime);
// $stmt->bindParam(':BizPartnerId', $contractno);
// $stmt->execute();
// $sql = "UPDATE comBusinessPartner SET
// BizPartnerName=:BizPartnerName,
// WorkTelNo=:WorkTelNo,
// TaxNo=:TaxNo,
// EnterpriseName=:EnterpriseName,
// ContractAddress=:ContractAddress,
// EMail=:EMail,
// LastOperatorId=:LastOperatorId,
// LastOperateTime=:LastOperateTime
// WHERE BizPartnerId = :BizPartnerId
// ";
// $stmt = $connT8->prepare($sql);
// $stmt->bindParam(':BizPartnerName', $partyA);
// $stmt->bindParam(':WorkTelNo', $phone);
// $stmt->bindParam(':TaxNo', $vat);
// $stmt->bindParam(':EnterpriseName', $customer);
// $stmt->bindParam(':ContractAddress', $partyAaddress);
// $stmt->bindParam(':EMail', $email);
// $stmt->bindParam(':LastOperatorId', $user_id);
// $stmt->bindParam(':LastOperateTime', $createTime);
// $stmt->bindParam(':BizPartnerId', $contractno);
// $stmt->execute();
// }
$sql = "UPDATE comBusinessPartner SET
BizPartnerName=:BizPartnerName,
WorkTelNo=:WorkTelNo,
TaxNo=:TaxNo,
EnterpriseName=:EnterpriseName,
ContactAddress=:ContactAddress,
EMail=:EMail,
LastOperatorId=:LastOperatorId,
LastOperateTime=:LastOperateTime
WHERE BizPartnerId = :BizPartnerId
";
$stmt = $connT8->prepare($sql);
$stmt->bindParam(':BizPartnerName', $partyA);
$stmt->bindParam(':WorkTelNo', $phone);
$stmt->bindParam(':TaxNo', $vat);
$stmt->bindParam(':EnterpriseName', $customer);
$stmt->bindParam(':ContactAddress', $partyAaddress);
$stmt->bindParam(':EMail', $email);
$stmt->bindParam(':LastOperatorId', $user_id);
$stmt->bindParam(':LastOperateTime', $createTime);
$stmt->bindParam(':BizPartnerId', $contractno);
$stmt->execute();
}
// echo '<pre>';
// print_r($elevators['maintainance']);
// echo '</pre>';
foreach ($elevators as $index => $elevator) {
$type[] = $elevator['maintainance'];
if ($type[$index] == 'A') {
$type = 'C3';
} else if ($type[$index] == 'B') {
$type = 'C4';
} else if ($type[$index] == 'C') {
$type = 'C5';
}
}
// echo '<pre>';
// print_r($type);
// echo '</pre>';
// //新增於 comProject。合約 table
// $sql = "INSERT INTO comProject(ProjectId,ProjectName,TypeId,ValidityFromDate,ValidityToDate,CreateTime,CreatorId,IsInUsed) VALUES(:ProjectId,:ProjectName,:TypeId,:ValidityFromDate,ValidityToDate,:CreateTime,:CreatorId,1)";
// $stmt = $connT8->prepare($sql);
// $stmt->bindParam(':ProjectId', $contractno);
// $stmt->bindParam(':ProjectName', $customer);
// $stmt->bindParam(':TypeId', $elevators['maintainance']);
// $stmt->bindParam(':ValidityFromDate', $beginDate);
// $stmt->bindParam(':ValidityToDate', $endDate);
// $stmt->bindParam(':CreateTime', $createTime);
// $stmt->bindParam(':CreatorId', $user_id);
// $stmt->execute();
$sql = "INSERT INTO comProject(ProjectId,ProjectName,TypeId,ValidityFromDate,ValidityToDate,CreateTime,CreatorId,IsInUsed)
VALUES(:ProjectId,:ProjectName,:TypeId,:ValidityFromDate,:ValidityToDate,:CreateTime,:CreatorId,1)";
$stmt = $connT8->prepare($sql);
$stmt->bindParam(':ProjectId', $contractno);
$stmt->bindParam(':ProjectName', $customer);
$stmt->bindParam(':TypeId', $type);
$stmt->bindParam(':ValidityFromDate', $beginDate);
$stmt->bindParam(':ValidityToDate', $endDate);
$stmt->bindParam(':CreateTime', $createTime);
$stmt->bindParam(':CreatorId', $user_id);
$stmt->execute();
// // 新增電梯數
// foreach ($elevators as $index => $elevator) {
// echo '<pre>';
// print_r($elevator);
// echo '</pre>';
// if ($elevator['maintainance'] == 'A') {
// $elevator['maintainance'] = 'C3';
// } else if ($elevator['maintainance'] == 'B') {
// $elevator['maintainance'] = 'C4';
// } else if ($elevator['maintainance'] == 'C') {
// $elevator['maintainance'] = 'C5';
// }
// $sql = "INSERT INTO comMaterial(MaterialId,MaterialCategoryId,CreatorId,CreateTime) VALUES (:MaterialId,'E',:CreatorId,:CreateTime)";
// $stmt = $connT8->prepare($sql);
// $stmt->bindParam(':MaterialId', $facilityno[$index]);
// $stmt->bindParam(':CreatorId', $user_id);
// $stmt->bindParam(':CreateTime', $createTime);
// $stmt->execute();
// /// 還沒修完
// $sql = "INSERT INTO comMaterialGroup(MaterialId,MaterialName,MaterialCategoryId,UnitId,CreatorId,CreateTime) VALUES (:MaterialId,:MaterialName,'E','SET',:CreatorId,:CreateTime)";
// $stmt = $connT8->prepare($sql);
// $stmt->bindParam(':MaterialId', $facilityno[$index]);
// $stmt->bindParam(':MaterialName', $customer);
// $stmt->bindParam(':CreatorId', $user_id);
// $stmt->bindParam(':CreateTime', $createTime);
// $stmt->execute();
// /// 還沒修完
// $sql = "INSERT INTO comMaterialPurchases(MaterialId,CurrId,SUnitId,TaxId,CreatorId,CreateTime) VALUES (:MaterialId,'TWD','SET','ST005',:CreatorId,:CreateTime)";
// $stmt = $connT8->prepare($sql);
// $stmt->bindParam(':MaterialId', $facilityno[$index]);
// $stmt->bindParam(':CreatorId', $user_id);
// $stmt->bindParam(':CreateTime', $createTime);
// $stmt->execute();
foreach ($elevators as $index => $elevator) {
echo '<pre>';
print_r($elevator);
echo '</pre>';
$sql = "INSERT INTO comMaterial
(MaterialId,MaterialCategoryId,CreatorId,CreateTime)
VALUES (:MaterialId,'E',:CreatorId,:CreateTime)";
$stmt = $connT8->prepare($sql);
$stmt->bindParam(':MaterialId', $facilityno[$index]);
$stmt->bindParam(':CreatorId', $user_id);
$stmt->bindParam(':CreateTime', $createTime);
$stmt->execute();
/// 還沒修完
$sql = "INSERT INTO comMaterialGroup
(MaterialTypeId,MaterialId,MaterialName,MaterialCategoryId,UnitId,CreatorId,CreateTime)
VALUES ('10',:MaterialId,:MaterialName,'E','SET',:CreatorId,:CreateTime)";
$stmt = $connT8->prepare($sql);
$stmt->bindParam(':MaterialId', $facilityno[$index]);
$stmt->bindParam(':MaterialName', $customer);
$stmt->bindParam(':CreatorId', $user_id);
$stmt->bindParam(':CreateTime', $createTime);
$stmt->execute();
/// 還沒修完
$sql = "INSERT INTO comMaterialPurchases
(MaterialId,CurrId,SUnitId,TaxId,CreatorId,CreateTime)
VALUES (:MaterialId,'TWD','SET','ST005',:CreatorId,:CreateTime)";
$stmt = $connT8->prepare($sql);
$stmt->bindParam(':MaterialId', $facilityno[$index]);
$stmt->bindParam(':CreatorId', $user_id);
$stmt->bindParam(':CreateTime', $createTime);
$stmt->execute();
}
$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"];
}
}
mysqli_free_result($res);
$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"]]["price"] = $row["price"];
}
mysqli_free_result($res);
$option_str = '<table id="table_index2" class="table table-striped table-bordered" style="width:100%">';
$option_str .= '<thead>
@ -506,7 +508,7 @@ $option_str .= "</tbody></table>";
$(document).ready(function() {
$('input[name=pay_scale]').each(function() {
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)));
var payAllScale = 0;
var payAllAmt = 0;
@ -737,11 +739,13 @@ $option_str .= "</tbody></table>";
var jobj = $(this); // 父視窗
$("#optionModal .modal-body td").unbind().click(function() {
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.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=op_id]').val(pobj.find('input[name=option_id]').val());
$("#optionModal").modal('hide');
});
});
$("#optionFaciModal").on("hidden.bs.modal", function() {
@ -1817,7 +1821,7 @@ if($_SERVER["REQUEST_METHOD"] == "POST"){
?>
<tr name="option_templ">
<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><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>

5040
wms/mkt/pricereview_renovate-create.php

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