10994015 1 year ago
parent
commit
8ddf203407
  1. 36
      wms/contract/contract-new-apply.php
  2. 7
      wms/contract/js/alpine.js

36
wms/contract/contract-new-apply.php

@ -8,15 +8,15 @@ if(!(isset($_GET['id']) && !empty($_GET['id']))){
exit;
}
$id = $_GET["id"];
$sql_str = "SELECT pricereview_main.*, account.name as accountname, pricereview_item.*
$sql_str = "SELECT pricereview_main.*, pricereview_main.id as mainid, account.name as accountname
FROM pricereview_main
JOIN account ON pricereview_main.person = account.accountid
JOIN pricereview_item ON pricereview_main.id = pricereview_item.mid
WHERE pricereview_main.id = :id";
$stmt = $conn->prepare($sql_str);
$stmt->bindParam(':id',$id);
$stmt->execute();
$contract = $stmt->fetch(PDO::FETCH_ASSOC);
print_r($contract);
$accounttype = "M";
$sql_str = "SELECT * FROM account WHERE accounttype = :accounttype";
$stmt = $conn->prepare($sql_str);
@ -30,13 +30,27 @@ $stmt->bindParam(':vol_no', $contract['contractno']);
$stmt->execute();
$customer = $stmt->fetch(PDO::FETCH_ASSOC);
$mid = $contract['id'];
$mid = $contract['mainid'];
$sql_str = "SELECT * FROM pricereview_pay WHERE mid = :mid ORDER BY pay_kind ASC";
$stmt = $conn->prepare($sql_str);
$stmt->bindParam(':mid', $mid);
$stmt->execute();
$pays = $stmt->fetchAll(PDO::FETCH_ASSOC);
print_r($pays);
$price_a = 0;
$price_b = 0;
foreach($pays as $pay){
if($pay['pay_kind'] <= 4){
$price_a = $price_a + $pay['pay_amount'];
}else{
$price_b = $price_b + $pay['pay_amount'];
}
}
$sql_str = "SELECT * FROM pricereview_item WHERE mid = :mid AND item_group = 'A'";
$stmt = $conn->prepare($sql_str);
$stmt->bindParam(':mid', $mid);
$stmt->execute();
$items = $stmt->fetchAll(PDO::FETCH_ASSOC);
print_r($items);
?>
<link rel="stylesheet" href="./styles/style.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css" integrity="sha512-z3gLpd7yknf1YoNbCzqRKc4qyor8gaKU1qmn+CShxbuBusANI9QpRohGBreCFkKxLhei6S9CQXFEbbKuqLg0DA==" crossorigin="anonymous" referrerpolicy="no-referrer" />
@ -225,21 +239,23 @@ print_r($pays);
</tr>
</thead>
<tbody style="font-weight: bolder;margin-bottom: 20px">
<template x-for="(item, idx) in data.items">
<tr>
<td style="vertical-align: middle">1</td>
<td style="vertical-align: middle"><p x-text="idx+1"></p></td>
<td colspan="3" style="vertical-align: middle">
<input class="form-control disabled_select" type="text" value="MAE100-6 *4-2S45" >
<input class="form-control disabled_select" type="text" x-model="item.item_spec" >
<p class="alerttext" x-show="data.tradedeadline==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td>
<td style="vertical-align: middle">
<input class="form-control disabled_select" type="number" value="6" >
<input class="form-control disabled_select" type="number" x-model="item.item_qty" >
<p class="alerttext" x-show="data.tradedeadline==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td>
<td colspan="3" style="vertical-align: middle">
<input class="form-control disabled_select" type="number" value="3180000" >
<input class="form-control disabled_select" type="number" x-model="item.item_price_ct" >
<p class="alerttext" x-show="data.tradedeadline==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td>
</tr>
</template>
</tbody>
</table>
<table class="table table-bordered query-table table-striped table-bordered display compact" style="width:99%;margin-left:.5%">
@ -421,4 +437,8 @@ print_r($pays);
const vat = '<?php echo $customer['uscc'] ?>';
const price_total = <?php echo $contract['price_total'] ?>;
const address = '<?php echo $contract['address'] ?>';
const price_a = <?php echo $price_a; ?>;
const price_b = <?php echo $price_b; ?>;
const items = [...<?php echo json_encode($items); ?>];
console.log(items)
</script>

7
wms/contract/js/alpine.js

@ -1186,8 +1186,8 @@ const contractNewApply = ()=>{
manager: manager,
vat: vat,
total_price: price_total,
price_a:'',
price_b:'',
price_a: price_a,
price_b: price_b,
address: address,
workdeadline_a:30, //完工期限: 幾天內安裝完成,預設30
workdeadline_b:7, //完工期限: 幾天內整理完善,預設7
@ -1195,9 +1195,10 @@ const contractNewApply = ()=>{
freedeadline:18, //免保期限(月)
tradeaddress:'', //交貨地點
tradedeadline: 90, //交貨期限
items: items,
},
pays:{
1:10,
1:0,
2:0,
3:0,
4:0,

Loading…
Cancel
Save