From 2377ab6b8f454faf99458cb8bfa980aa67619a35 Mon Sep 17 00:00:00 2001 From: "sosuke.iwabuchi" Date: Mon, 29 Jan 2024 17:56:13 +0900 Subject: [PATCH] =?UTF-8?q?=E5=88=9D=E5=9B=9E=E5=85=A5=E9=87=91=E4=BD=9C?= =?UTF-8?q?=E6=88=90=E6=99=82=E3=81=AB=E4=BF=9D=E8=A8=BC=E9=87=91=E3=81=AE?= =?UTF-8?q?=E5=85=A5=E9=87=91=E4=BA=88=E5=AE=9A=E3=82=92=E4=BD=9C=E6=88=90?= =?UTF-8?q?=E3=81=99=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=E5=AF=BE=E5=BF=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apps/入金予定結果/index.tsx | 35 ++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/src/apps/入金予定結果/index.tsx b/src/apps/入金予定結果/index.tsx index 64ab261..dbc9805 100644 --- a/src/apps/入金予定結果/index.tsx +++ b/src/apps/入金予定結果/index.tsx @@ -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,