diff --git a/wms/contract/api/postContractNewApplyData.php b/wms/contract/api/postContractNewApplyData.php
index a3930586..5396cef2 100644
--- a/wms/contract/api/postContractNewApplyData.php
+++ b/wms/contract/api/postContractNewApplyData.php
@@ -19,6 +19,7 @@ if(isset($_POST['vol_no']) && !empty($_POST['vol_no']) && ($_POST['status'] == 0
$manager = $_POST['manager'];
$vat = $_POST['vat'];
$total_price = $_POST['total_price'];
+ $total_items = $_POST['total_items'];
$buy_fee = $_POST['price_a'];
$install_fee = $_POST['price_b'];
$contact_address = $_POST['address'];
@@ -45,7 +46,7 @@ if(isset($_POST['vol_no']) && !empty($_POST['vol_no']) && ($_POST['status'] == 0
$conn->beginTransaction();
try{
if($isFirst == 1){
- $sql_str = "INSERT INTO contract_new_apply (mid, contractno, sales_man, apply_date, apply_type, case_name, customer, manager, vat, total_price, buy_fee, install_fee, contact_address, workdeadline_a, workdeadline_b, test_time, freedeadline, trade_address, tradedeadline, secondPayDeadline, progress, status, person, personname, submit_date, created_at, created_by) VALUES (:mid, :contractno, :sales_man, :apply_date, :apply_type, :case_name, :customer, :manager, :vat, :total_price, :buy_fee, :install_fee, :contact_address, :workdeadline_a, :workdeadline_b, :test_time, :freedeadline, :trade_address, :tradedeadline, :secondPayDeadline, :progress, :status, :person, :personname, :submit_date, :created_at, :created_by)";
+ $sql_str = "INSERT INTO contract_new_apply (mid, contractno, sales_man, apply_date, apply_type, case_name, customer, manager, vat, total_price, total_items, buy_fee, install_fee, contact_address, workdeadline_a, workdeadline_b, test_time, freedeadline, trade_address, tradedeadline, secondPayDeadline, progress, status, person, personname, submit_date, created_at, created_by) VALUES (:mid, :contractno, :sales_man, :apply_date, :apply_type, :case_name, :customer, :manager, :vat, :total_price, :total_items, :buy_fee, :install_fee, :contact_address, :workdeadline_a, :workdeadline_b, :test_time, :freedeadline, :trade_address, :tradedeadline, :secondPayDeadline, :progress, :status, :person, :personname, :submit_date, :created_at, :created_by)";
$stmt = $conn -> prepare($sql_str);
$stmt ->bindParam(':mid', $mid);
$stmt ->bindParam(':contractno', $vol_no);
@@ -57,6 +58,7 @@ if(isset($_POST['vol_no']) && !empty($_POST['vol_no']) && ($_POST['status'] == 0
$stmt ->bindParam(':manager', $manager);
$stmt ->bindParam(':vat', $vat);
$stmt ->bindParam(':total_price', $total_price);
+ $stmt ->bindParam(':total_items', $total_items);
$stmt ->bindParam(':buy_fee', $buy_fee);
$stmt ->bindParam(':install_fee', $install_fee);
$stmt ->bindParam(':contact_address', $contact_address);
@@ -95,7 +97,7 @@ if(isset($_POST['vol_no']) && !empty($_POST['vol_no']) && ($_POST['status'] == 0
header("HTTP/1.1 201 success!");
$conn->commit();
}else{
- $sql_str = "UPDATE contract_new_apply SET status = :status, apply_date=:apply_date, apply_type=:apply_type, case_name=:case_name, customer=:customer, manager=:manager, vat=:vat, total_price=:total_price, buy_fee=:buy_fee, install_fee=:install_fee, contact_address=:contact_address, trade_address=:trade_address, workdeadline_a=:workdeadline_a, workdeadline_b=:workdeadline_b, test_time=:test_time, freedeadline=:freedeadline, trade_address=:trade_address, trade_address=:trade_address, tradedeadline=:tradedeadline, secondPayDeadline=:secondPayDeadline, progress=:progress, person=:person, personname=:personname, submit_date=:submit_date, updated_at=:updated_at, updated_by=:updated_by WHERE mid = :mid";
+ $sql_str = "UPDATE contract_new_apply SET status = :status, apply_date=:apply_date, apply_type=:apply_type, case_name=:case_name, customer=:customer, manager=:manager, vat=:vat, total_price=:total_price, total_items=:total_items, buy_fee=:buy_fee, install_fee=:install_fee, contact_address=:contact_address, trade_address=:trade_address, workdeadline_a=:workdeadline_a, workdeadline_b=:workdeadline_b, test_time=:test_time, freedeadline=:freedeadline, trade_address=:trade_address, trade_address=:trade_address, tradedeadline=:tradedeadline, secondPayDeadline=:secondPayDeadline, progress=:progress, person=:person, personname=:personname, submit_date=:submit_date, updated_at=:updated_at, updated_by=:updated_by WHERE mid = :mid";
$stmt = $conn -> prepare($sql_str);
$stmt ->bindParam(':mid', $mid);
$stmt ->bindParam(':status', $status);
@@ -106,6 +108,7 @@ if(isset($_POST['vol_no']) && !empty($_POST['vol_no']) && ($_POST['status'] == 0
$stmt ->bindParam(':manager', $manager);
$stmt ->bindParam(':vat', $vat);
$stmt ->bindParam(':total_price', $total_price);
+ $stmt ->bindParam(':total_items', $total_items);
$stmt ->bindParam(':buy_fee', $buy_fee);
$stmt ->bindParam(':install_fee', $install_fee);
$stmt ->bindParam(':contact_address', $contact_address);
diff --git a/wms/contract/contract-download.php b/wms/contract/contract-download.php
index 837bde91..169bbf06 100644
--- a/wms/contract/contract-download.php
+++ b/wms/contract/contract-download.php
@@ -51,16 +51,13 @@ if(isset($_GET['id']) && $_GET['id']!=""){
$install_total_price = 0;
// $noteArr = explode(",", $contracts[0]['note']);
$noteArr = array(1,1,1,1,1);
- $qty = $contracts[0]['item_qty'];
- // print_r($contracts);
- // print_r($buyArr);
+ $qty = $contracts[0]['total_items'];
foreach($contracts as $idx=>$amount){
$isset = false;
if($amount['pay_kind']==5 || $amount['pay_kind']==6){
- echo "111111";
if($amount['pay_scale'] >= 0){
$install_total_price = $install_total_price + $amount['pay_amount'];
- $installArr[] = ['installment'=> $amount['pay_kind'], 'scale'=> $amount['pay_scale'], 'amount'=> $amount['pay_amount'], 'note'=>$amount['note']];
+ $installArr[] = ['installment'=> $amount['pay_kind'], 'scale'=> $amount['pay_scale'], 'amount'=> $amount['pay_amount'], 'pay_period'=>$amount['pay_period']];
}
}
if($amount['pay_kind']==1 || $amount['pay_kind']==2 || $amount['pay_kind']==3){
@@ -72,7 +69,7 @@ if(isset($_GET['id']) && $_GET['id']!=""){
}
}
if(!$isset){{
- $buyArr[] = ['installment'=>$amount['pay_kind'], 'scale'=>$amount['pay_scale'], 'amount'=>$amount['pay_amount'], 'note'=>$amount['note']];
+ $buyArr[] = ['installment'=>$amount['pay_kind'], 'scale'=>$amount['pay_scale'], 'amount'=>$amount['pay_amount'], 'pay_period'=>$amount['pay_period']];
}
if($amount['pay_kind'] == 2){
$buyNo2Pay = true;
@@ -82,7 +79,7 @@ if(isset($_GET['id']) && $_GET['id']!=""){
}
}
- // print_r($buyArr);
+ print_r($buyArr);
}
catch (PDOException $e ){
@@ -389,8 +386,7 @@ if(isset($_GET['id']) && $_GET['id']!=""){
let buy_pay_text = ''
const chineseArr = ['零','一','二','三','四','五','六','七']
const bigChineseArr = ['零','壹','貳','參','肆','伍','陸','柒','捌','玖','拾'];
- // const num = ;
- const num = 7;
+ const num = ;
const people = ;
const floor = ;
const speed = ;
@@ -399,11 +395,11 @@ if(isset($_GET['id']) && $_GET['id']!=""){
buyArr.forEach((item, idx) => {
if(item.scale > 0){
if(item.installment == 1){
- buy_pay_text = `${buy_pay_text}第${chineseArr[idx+1]}期款:合約簽定時,甲方應付合約定金新台幣 ${numberToChinese(item.amount)} 元整( ${numberWithCommas(item.amount)} )(含5%加值型營業稅)(30天期票)。
`
+ buy_pay_text = `${buy_pay_text}第${chineseArr[idx+1]}期款:合約簽定時,甲方應付合約定金新台幣 ${numberToChinese(item.amount)} 元整( ${numberWithCommas(item.amount)} )(含5%加值型營業稅)(${item.pay_period}天期票)。
`
}else if(item.installment == 2){
- buy_pay_text = `${buy_pay_text}第${chineseArr[idx+1]}期款:合約簽訂後 ____ 天付第二期款新台幣 ${numberToChinese(item.amount)} 元整( ${numberWithCommas(item.amount)} )(含5%加值型營業稅)(30天期票)。
`
+ buy_pay_text = `${buy_pay_text}第${chineseArr[idx+1]}期款:合約簽訂後 ____ 天付第二期款新台幣 ${numberToChinese(item.amount)} 元整( ${numberWithCommas(item.amount)} )(含5%加值型營業稅)(${item.pay_period}天期票)。
`
}else if(item.installment == 3){
- buy_pay_text = `${buy_pay_text}第${chineseArr[idx+1]}期款:產品貨到工地時應付新台幣 ${numberToChinese(item.amount)} 元整( ${numberWithCommas(item.amount)} )( 含5%加值型營業稅)(30天期票)。
`
+ buy_pay_text = `${buy_pay_text}第${chineseArr[idx+1]}期款:產品貨到工地時應付新台幣 ${numberToChinese(item.amount)} 元整( ${numberWithCommas(item.amount)} )( 含5%加值型營業稅)(${item.pay_period}天期票)。
`
}
}
});;
@@ -412,9 +408,9 @@ if(isset($_GET['id']) && $_GET['id']!=""){
installArr.forEach((item,idx)=>{
if(item.scale > 0){
if(item.installment == 5){
- install_pay_text = `${install_pay_text}第${chineseArr[idx+1]}期款:甲方應於安裝及試車完成後給付安裝費用 ${numberToChinese(item.amount)} 元整( ${numberWithCommas(item.amount)} )(含5%加值型營業稅)(30天期票)。
`
+ install_pay_text = `${install_pay_text}第${chineseArr[idx+1]}期款:甲方應於安裝及試車完成後給付安裝費用 ${numberToChinese(item.amount)} 元整( ${numberWithCommas(item.amount)} )(含5%加值型營業稅)(${item.pay_period}天期票)。
`
}else if(item.installment == 6){
- install_pay_text = `${install_pay_text}第二期款:甲方應於交車後給付 ${numberToChinese(item.amount)} 元整( ${numberWithCommas(item.amount)} )(含5%加值型營業稅)(30天期票)。
`
+ install_pay_text = `${install_pay_text}第二期款:甲方應於交車後給付 ${numberToChinese(item.amount)} 元整( ${numberWithCommas(item.amount)} )(含5%加值型營業稅)(${item.pay_period}天期票)。
`
}
}
})
diff --git a/wms/contract/contract-new-apply.php b/wms/contract/contract-new-apply.php
index 53eac32d..5b4c7187 100644
--- a/wms/contract/contract-new-apply.php
+++ b/wms/contract/contract-new-apply.php
@@ -45,7 +45,11 @@ if(empty($contract_new_apply)){
$stmt->bindParam(':mid', $mid);
$stmt->execute();
$items = $stmt->fetchAll(PDO::FETCH_ASSOC);
-
+ $total_items = 0;
+ foreach($items as $item){
+ $total_items += $item['item_qty'];
+ }
+ echo $total_items ;
$sql_str = "SELECT * FROM pricereview_pay WHERE mid = :mid ORDER BY pay_kind ASC";
$stmt = $conn->prepare($sql_str);
$stmt->bindParam(':mid', $mid);
@@ -84,6 +88,13 @@ if(empty($contract_new_apply)){
$stmt->bindParam(':mid', $mid);
$stmt->execute();
$pays = $stmt->fetchAll(PDO::FETCH_ASSOC);
+
+ $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);
$price_a = 0;
$price_b = 0;
foreach($pays as $pay){
@@ -284,7 +295,7 @@ $person = $contract['person'];
未填寫
未填寫