|
|
|
@@ -9,9 +9,16 @@ import { EmailID, sendEmail } from "@/mypage/メール"; |
|
|
|
import { makeReceipt } from "@/mypage/領収証発行"; |
|
|
|
import bulkRequest from "@/rest-api/bulk"; |
|
|
|
import { get定期申込予約 } from "@/rest-api/定期申込予約"; |
|
|
|
import { get定期駐車場プランマスタ } from "@/rest-api/定期駐車場プランマスタ"; |
|
|
|
import { get車室情報管理 } from "@/rest-api/車室情報管理"; |
|
|
|
import { get顧客マスタ } from "@/rest-api/顧客マスタ"; |
|
|
|
import { 入金予定結果, 入金予定結果フィールド名 } from "@/types/入金予定結果"; |
|
|
|
import { |
|
|
|
入金予定結果, |
|
|
|
入金予定結果フィールド名, |
|
|
|
支払種別Dropdown, |
|
|
|
} from "@/types/入金予定結果"; |
|
|
|
import { 定期申込予約フィールド名 } from "@/types/定期申込予約"; |
|
|
|
import { 車室情報管理フィールド名 } from "@/types/車室情報管理"; |
|
|
|
import { 顧客マスタフィールド名 } from "@/types/顧客マスタ"; |
|
|
|
import { KintoneRestAPIClient } from "@kintone/rest-api-client"; |
|
|
|
import { addDays, format, setHours } from "date-fns"; |
|
|
|
@@ -130,17 +137,22 @@ const setData = (event: any, targets: string[]) => { |
|
|
|
}; |
|
|
|
const 初回請求金額確定 = async (record: 入金予定結果) => { |
|
|
|
初回請求金額確定チェック(record); |
|
|
|
const F = 定期申込予約フィールド名; |
|
|
|
const P = 入金予定結果フィールド名; |
|
|
|
|
|
|
|
const 申込 = await get定期申込予約( |
|
|
|
record.first_payment_entry_record_no.value |
|
|
|
); |
|
|
|
const 契約 = await get車室情報管理(record.contract_record_number.value); |
|
|
|
const プラン = await get定期駐車場プランマスタ( |
|
|
|
契約[車室情報管理フィールド名.プラン名].value |
|
|
|
); |
|
|
|
|
|
|
|
// 申込の初回振り込み情報を入力する |
|
|
|
const F = 定期申込予約フィールド名; |
|
|
|
const 支払予定日 = record.payment_plan_date.value ?? ""; |
|
|
|
const 支払予定金額 = record.payment_plan_amount.value ?? ""; |
|
|
|
|
|
|
|
const 日割り金額 = Number(支払予定金額) - Number(申込.定期駐車料金.value); |
|
|
|
const 日割り金額 = Number(支払予定金額) - Number(プラン.契約金額.value); |
|
|
|
const 日割り月 = (() => { |
|
|
|
if (日割り金額 === 0) return ""; |
|
|
|
let month = Number(record.target_month.value) - 1; |
|
|
|
@@ -150,6 +162,23 @@ const setData = (event: any, targets: string[]) => { |
|
|
|
return String(month); |
|
|
|
})(); |
|
|
|
|
|
|
|
// 保証金計算 |
|
|
|
const 保証金 = Number(プラン.保証金合計額.value ?? 0); |
|
|
|
if (0 < 保証金) { |
|
|
|
bulkRequest.create({ |
|
|
|
app: AppID.入金予定結果, |
|
|
|
record: makeRecordData({ |
|
|
|
[P.車室情報管理レコード番号]: record.contract_record_number.value, |
|
|
|
[P.支払種別]: 支払種別Dropdown.保証金, |
|
|
|
[P.支払方法]: record.payment_method.value ?? "", |
|
|
|
[P.支払予定日]: record.payment_plan_date.value ?? "", |
|
|
|
[P.支払予定金額]: プラン.保証金合計額.value, |
|
|
|
[P.入金額]: "0", |
|
|
|
[P.残金]: String(保証金), |
|
|
|
}), |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
bulkRequest.update({ |
|
|
|
app: AppID.定期申込予約, |
|
|
|
id: record.first_payment_entry_record_no.value, |
|
|
|
|