From 1c0d147b49df467eec671a7a66184c4376f12dd2 Mon Sep 17 00:00:00 2001 From: "sosuke.iwabuchi" Date: Fri, 22 Mar 2024 18:19:50 +0900 Subject: [PATCH] =?UTF-8?q?=E8=87=AA=E5=8B=95=E6=89=BF=E8=AA=8D=E6=99=82?= =?UTF-8?q?=E3=81=AE=E5=87=A6=E7=90=86=E3=82=92=E6=9C=AC=E7=95=AA=E3=83=87?= =?UTF-8?q?=E3=83=BC=E3=82=BF=E3=81=AB=E5=90=88=E3=82=8F=E3=81=9B=E3=81=A6?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apps/定期申込予約/自動承認.ts | 40 ++++++++++++++++++- src/types/定期申込予約.ts | 2 + .../定期駐車場プランマスタ.ts | 22 ++++++---- src/types/車室情報管理.ts | 13 ++++++ src/types/顧客マスタ.ts | 4 ++ 5 files changed, 71 insertions(+), 10 deletions(-) diff --git a/src/apps/定期申込予約/自動承認.ts b/src/apps/定期申込予約/自動承認.ts index d12be25..9a164fa 100644 --- a/src/apps/定期申込予約/自動承認.ts +++ b/src/apps/定期申込予約/自動承認.ts @@ -25,9 +25,10 @@ import { 車室情報2, 車室情報2モデル } from "@/types/車室情報 import { 顧客マスタフィールド名 } from "@/types/顧客マスタ"; import { sprintf } from "sprintf"; import { CancelError, Message } from "@/exception"; -import { dateParse, now } from "@/common/datetime"; +import { dateParse, formatDateStr, now } from "@/common/datetime"; import bulkRequest from "@/rest-api/bulk"; import apiClient from "@/middleware/api-client"; +import { addMonths, getDate, setDate } from "date-fns"; export class 申込 { private 定期申込予約: 定期申込予約; @@ -202,6 +203,24 @@ export class 申込 { const F = 顧客マスタフィールド名; const 顧客コード = await getNext顧客コード(); + const 利用開始希望日 = dateParse(this.定期申込予約.利用開始希望日.value); + if (利用開始希望日 === null) throw new Error("利用希望日不正"); + + let 振替開始日 = ""; + if (getDate(利用開始希望日) === 1) { + // 利用開始日が1日の場合は当月の27日を設定 + 振替開始日 = formatDateStr(setDate(利用開始希望日, 27)); + } else { + // 利用開始日が1日以外の場合は翌月の27日を設定(日割り発生) + 振替開始日 = formatDateStr(addMonths(setDate(利用開始希望日, 27), 1)); + } + + const 郵便番号 = (() => { + const all = this.定期申込予約.住所.value.substring(0, 7).trim(); + return sprintf("%s-%s", all.substring(0, 3), all.substring(3)); + })(); + const 住所 = this.定期申込予約.住所.value.substring(7).trim(); + bulkRequest.create({ app: AppID.顧客マスタ, record: makeRecordData({ @@ -211,7 +230,11 @@ export class 申込 { [F.電話番号]: this.定期申込予約.電話番号.value, [F.メールアドレス]: this.定期申込予約.メールアドレス.value, [F.SMBC契約番号]: String(await getNextSMBC番号()), - [F.支払方法]: "その他", + [F.支払方法]: "口座振替", + [F.振替日]: "27", //TODO + [F.振替開始日]: 振替開始日, + [F.契約者_郵便番号]: 郵便番号, + [F.住所]: 住所, }), }); @@ -234,6 +257,19 @@ export class 申込 { [F.車両番号]: this.定期申込予約.車両番号.value, [F.車室番号]: 対象車室.車室番号.value, [F.プラン名]: this.定期申込予約.定期駐車場プラン.value, + + [F.定額_1月]: this.プラン?.契約金額.value ?? "", + [F.定額_2月]: this.プラン?.契約金額.value ?? "", + [F.定額_3月]: this.プラン?.契約金額.value ?? "", + [F.定額_4月]: this.プラン?.契約金額.value ?? "", + [F.定額_5月]: this.プラン?.契約金額.value ?? "", + [F.定額_6月]: this.プラン?.契約金額.value ?? "", + [F.定額_7月]: this.プラン?.契約金額.value ?? "", + [F.定額_8月]: this.プラン?.契約金額.value ?? "", + [F.定額_9月]: this.プラン?.契約金額.value ?? "", + [F.定額_10月]: this.プラン?.契約金額.value ?? "", + [F.定額_11月]: this.プラン?.契約金額.value ?? "", + [F.定額_12月]: this.プラン?.契約金額.value ?? "", }), }, async ({ id }) => { diff --git a/src/types/定期申込予約.ts b/src/types/定期申込予約.ts index 52729a7..70d4606 100644 --- a/src/types/定期申込予約.ts +++ b/src/types/定期申込予約.ts @@ -20,6 +20,7 @@ const F = { 初回入金予定_初月分入金予定: "初回入金予定_初月分入金予定", 初回入金予定_日割り分入金予定: "初回入金予定_日割り分入金予定", 初回入金予定_保証金入金予定: "初回入金予定_保証金入金予定", + 初回入金予定_初回入金充当状態: "初回入金予定_初回入金充当状態", } as const; export const 状態Dropdown = { @@ -96,4 +97,5 @@ export type 定期申込予約 = AppRecord & { [F.初回入金予定_初月分入金予定]: KintoneRecordField.SingleLineText; [F.初回入金予定_日割り分入金予定]: KintoneRecordField.SingleLineText; [F.初回入金予定_保証金入金予定]: KintoneRecordField.SingleLineText; + [F.初回入金予定_初回入金充当状態]: KintoneRecordField.SingleLineText; }; diff --git a/src/types/定期駐車場プランマスタ.ts b/src/types/定期駐車場プランマスタ.ts index ffcf5db..a9577bb 100644 --- a/src/types/定期駐車場プランマスタ.ts +++ b/src/types/定期駐車場プランマスタ.ts @@ -2,7 +2,13 @@ import { KintoneRecordField } from "@kintone/rest-api-client"; import { AppRecord } from "."; const F = { - プラン名: "key", + KEY: "key", + 駐車場名: "駐車場名", + 支払パターン: "支払パターン", + プラン: "プラン", + 駐車場備考: "駐車場備考", + 種別: "種別", + 契約金額: "契約金額", } as const; // export const 支払種別Dropdown = { @@ -27,27 +33,27 @@ export type 対象車室番号行データ = { export type 定期駐車場プランマスタ = AppRecord & { 備考: KintoneRecordField.MultiLineText; 状況: KintoneRecordField.RadioButton; - 支払パターン: KintoneRecordField.Dropdown; + [F.支払パターン]: KintoneRecordField.Dropdown; 保証金: KintoneRecordField.Number; 収容台数: KintoneRecordField.Number; 住所_駐車場マスタ: KintoneRecordField.SingleLineText; パスカード保証金: KintoneRecordField.Number; 定期駐車場名: KintoneRecordField.SingleLineText; - 駐車場名: KintoneRecordField.SingleLineText; - key: KintoneRecordField.SingleLineText; + [F.駐車場名]: KintoneRecordField.SingleLineText; + [F.KEY]: KintoneRecordField.SingleLineText; その他収入: KintoneRecordField.Number; 住所_手入力: KintoneRecordField.SingleLineText; 担当: KintoneRecordField.SingleLineText; 内税: KintoneRecordField.Number; 定期_駐車場名: KintoneRecordField.SingleLineText; - 契約金額: KintoneRecordField.Number; + [F.契約金額]: KintoneRecordField.Number; 利用者へ表示するプラン名: KintoneRecordField.SingleLineText; 税率: KintoneRecordField.Number; - 種別: KintoneRecordField.Dropdown; + [F.種別]: KintoneRecordField.Dropdown; 住所_使用: KintoneRecordField.SingleLineText; - 駐車場備考: KintoneRecordField.Dropdown; + [F.駐車場備考]: KintoneRecordField.Dropdown; 表示順: KintoneRecordField.Number; - プラン: KintoneRecordField.Dropdown; + [F.プラン]: KintoneRecordField.Dropdown; チェーンゲート保証金: KintoneRecordField.Number; 年額: KintoneRecordField.Calc; 保証金合計額: KintoneRecordField.Calc; diff --git a/src/types/車室情報管理.ts b/src/types/車室情報管理.ts index 05d327c..2e61cdf 100644 --- a/src/types/車室情報管理.ts +++ b/src/types/車室情報管理.ts @@ -10,6 +10,19 @@ const F = { 顧客コード: "顧客コード", 車室番号: "車室番号", プラン名: "契約駐車場_0", + + 定額_1月: "定額_1月", + 定額_2月: "定額_2月", + 定額_3月: "定額_3月", + 定額_4月: "定額_4月", + 定額_5月: "定額_5月", + 定額_6月: "定額_6月", + 定額_7月: "定額_7月", + 定額_8月: "定額_8月", + 定額_9月: "定額_9月", + 定額_10月: "定額_10月", + 定額_11月: "定額_11月", + 定額_12月: "定額_12月", } as const; // export const 支払種別Dropdown = { diff --git a/src/types/顧客マスタ.ts b/src/types/顧客マスタ.ts index 228833f..ae60a00 100644 --- a/src/types/顧客マスタ.ts +++ b/src/types/顧客マスタ.ts @@ -10,6 +10,8 @@ const F = { ゆうちょ口座記号: "YuchoAccountsSymbol", ゆうちょ口座番号: "YuchoAccountsNo", 口座登録催促予定日時: "口座登録催促予定日時", + 振替日: "TransferDivision", + 振替開始日: "TransferStartDate", 顧客名: "CustomerName", 顧客名カナ: "顧客名カナ", @@ -51,6 +53,8 @@ export type 顧客マスタ = AppRecord & { SMBC入金額: KintoneRecordField.Number; [F.ゆうちょ口座記号]: KintoneRecordField.Number; [F.ゆうちょ口座番号]: KintoneRecordField.Number; + [F.振替日]: KintoneRecordField.Number; + [F.振替開始日]: KintoneRecordField.Date; クレジット入金額: KintoneRecordField.Number; コンビニ払入金額: KintoneRecordField.Number; [F.メールアドレス]: KintoneRecordField.Link;