| @@ -25,9 +25,10 @@ import { 車室情報2, 車室情報2モデル } from "@/types/車室情報 | |||||
| import { 顧客マスタフィールド名 } from "@/types/顧客マスタ"; | import { 顧客マスタフィールド名 } from "@/types/顧客マスタ"; | ||||
| import { sprintf } from "sprintf"; | import { sprintf } from "sprintf"; | ||||
| import { CancelError, Message } from "@/exception"; | 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 bulkRequest from "@/rest-api/bulk"; | ||||
| import apiClient from "@/middleware/api-client"; | import apiClient from "@/middleware/api-client"; | ||||
| import { addMonths, getDate, setDate } from "date-fns"; | |||||
| export class 申込 { | export class 申込 { | ||||
| private 定期申込予約: 定期申込予約; | private 定期申込予約: 定期申込予約; | ||||
| @@ -202,6 +203,24 @@ export class 申込 { | |||||
| const F = 顧客マスタフィールド名; | const F = 顧客マスタフィールド名; | ||||
| const 顧客コード = await getNext顧客コード(); | 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({ | bulkRequest.create({ | ||||
| app: AppID.顧客マスタ, | app: AppID.顧客マスタ, | ||||
| record: makeRecordData({ | record: makeRecordData({ | ||||
| @@ -211,7 +230,11 @@ export class 申込 { | |||||
| [F.電話番号]: this.定期申込予約.電話番号.value, | [F.電話番号]: this.定期申込予約.電話番号.value, | ||||
| [F.メールアドレス]: this.定期申込予約.メールアドレス.value, | [F.メールアドレス]: this.定期申込予約.メールアドレス.value, | ||||
| [F.SMBC契約番号]: String(await getNextSMBC番号()), | [F.SMBC契約番号]: String(await getNextSMBC番号()), | ||||
| [F.支払方法]: "その他", | |||||
| [F.支払方法]: "口座振替", | |||||
| [F.振替日]: "27", //TODO | |||||
| [F.振替開始日]: 振替開始日, | |||||
| [F.契約者_郵便番号]: 郵便番号, | |||||
| [F.住所]: 住所, | |||||
| }), | }), | ||||
| }); | }); | ||||
| @@ -234,6 +257,19 @@ export class 申込 { | |||||
| [F.車両番号]: this.定期申込予約.車両番号.value, | [F.車両番号]: this.定期申込予約.車両番号.value, | ||||
| [F.車室番号]: 対象車室.車室番号.value, | [F.車室番号]: 対象車室.車室番号.value, | ||||
| [F.プラン名]: this.定期申込予約.定期駐車場プラン.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 }) => { | async ({ id }) => { | ||||
| @@ -20,6 +20,7 @@ const F = { | |||||
| 初回入金予定_初月分入金予定: "初回入金予定_初月分入金予定", | 初回入金予定_初月分入金予定: "初回入金予定_初月分入金予定", | ||||
| 初回入金予定_日割り分入金予定: "初回入金予定_日割り分入金予定", | 初回入金予定_日割り分入金予定: "初回入金予定_日割り分入金予定", | ||||
| 初回入金予定_保証金入金予定: "初回入金予定_保証金入金予定", | 初回入金予定_保証金入金予定: "初回入金予定_保証金入金予定", | ||||
| 初回入金予定_初回入金充当状態: "初回入金予定_初回入金充当状態", | |||||
| } as const; | } as const; | ||||
| export const 状態Dropdown = { | export const 状態Dropdown = { | ||||
| @@ -96,4 +97,5 @@ export type 定期申込予約 = AppRecord & { | |||||
| [F.初回入金予定_初月分入金予定]: KintoneRecordField.SingleLineText; | [F.初回入金予定_初月分入金予定]: KintoneRecordField.SingleLineText; | ||||
| [F.初回入金予定_日割り分入金予定]: KintoneRecordField.SingleLineText; | [F.初回入金予定_日割り分入金予定]: KintoneRecordField.SingleLineText; | ||||
| [F.初回入金予定_保証金入金予定]: KintoneRecordField.SingleLineText; | [F.初回入金予定_保証金入金予定]: KintoneRecordField.SingleLineText; | ||||
| [F.初回入金予定_初回入金充当状態]: KintoneRecordField.SingleLineText; | |||||
| }; | }; | ||||
| @@ -2,7 +2,13 @@ import { KintoneRecordField } from "@kintone/rest-api-client"; | |||||
| import { AppRecord } from "."; | import { AppRecord } from "."; | ||||
| const F = { | const F = { | ||||
| プラン名: "key", | |||||
| KEY: "key", | |||||
| 駐車場名: "駐車場名", | |||||
| 支払パターン: "支払パターン", | |||||
| プラン: "プラン", | |||||
| 駐車場備考: "駐車場備考", | |||||
| 種別: "種別", | |||||
| 契約金額: "契約金額", | |||||
| } as const; | } as const; | ||||
| // export const 支払種別Dropdown = { | // export const 支払種別Dropdown = { | ||||
| @@ -27,27 +33,27 @@ export type 対象車室番号行データ = { | |||||
| export type 定期駐車場プランマスタ = AppRecord & { | export type 定期駐車場プランマスタ = AppRecord & { | ||||
| 備考: KintoneRecordField.MultiLineText; | 備考: KintoneRecordField.MultiLineText; | ||||
| 状況: KintoneRecordField.RadioButton; | 状況: KintoneRecordField.RadioButton; | ||||
| 支払パターン: KintoneRecordField.Dropdown; | |||||
| [F.支払パターン]: KintoneRecordField.Dropdown; | |||||
| 保証金: KintoneRecordField.Number; | 保証金: KintoneRecordField.Number; | ||||
| 収容台数: KintoneRecordField.Number; | 収容台数: KintoneRecordField.Number; | ||||
| 住所_駐車場マスタ: KintoneRecordField.SingleLineText; | 住所_駐車場マスタ: KintoneRecordField.SingleLineText; | ||||
| パスカード保証金: KintoneRecordField.Number; | パスカード保証金: KintoneRecordField.Number; | ||||
| 定期駐車場名: KintoneRecordField.SingleLineText; | 定期駐車場名: KintoneRecordField.SingleLineText; | ||||
| 駐車場名: KintoneRecordField.SingleLineText; | |||||
| key: KintoneRecordField.SingleLineText; | |||||
| [F.駐車場名]: KintoneRecordField.SingleLineText; | |||||
| [F.KEY]: KintoneRecordField.SingleLineText; | |||||
| その他収入: KintoneRecordField.Number; | その他収入: KintoneRecordField.Number; | ||||
| 住所_手入力: KintoneRecordField.SingleLineText; | 住所_手入力: KintoneRecordField.SingleLineText; | ||||
| 担当: KintoneRecordField.SingleLineText; | 担当: KintoneRecordField.SingleLineText; | ||||
| 内税: KintoneRecordField.Number; | 内税: KintoneRecordField.Number; | ||||
| 定期_駐車場名: KintoneRecordField.SingleLineText; | 定期_駐車場名: KintoneRecordField.SingleLineText; | ||||
| 契約金額: KintoneRecordField.Number; | |||||
| [F.契約金額]: KintoneRecordField.Number; | |||||
| 利用者へ表示するプラン名: KintoneRecordField.SingleLineText; | 利用者へ表示するプラン名: KintoneRecordField.SingleLineText; | ||||
| 税率: KintoneRecordField.Number; | 税率: KintoneRecordField.Number; | ||||
| 種別: KintoneRecordField.Dropdown; | |||||
| [F.種別]: KintoneRecordField.Dropdown; | |||||
| 住所_使用: KintoneRecordField.SingleLineText; | 住所_使用: KintoneRecordField.SingleLineText; | ||||
| 駐車場備考: KintoneRecordField.Dropdown; | |||||
| [F.駐車場備考]: KintoneRecordField.Dropdown; | |||||
| 表示順: KintoneRecordField.Number; | 表示順: KintoneRecordField.Number; | ||||
| プラン: KintoneRecordField.Dropdown; | |||||
| [F.プラン]: KintoneRecordField.Dropdown; | |||||
| チェーンゲート保証金: KintoneRecordField.Number; | チェーンゲート保証金: KintoneRecordField.Number; | ||||
| 年額: KintoneRecordField.Calc; | 年額: KintoneRecordField.Calc; | ||||
| 保証金合計額: KintoneRecordField.Calc; | 保証金合計額: KintoneRecordField.Calc; | ||||
| @@ -10,6 +10,19 @@ const F = { | |||||
| 顧客コード: "顧客コード", | 顧客コード: "顧客コード", | ||||
| 車室番号: "車室番号", | 車室番号: "車室番号", | ||||
| プラン名: "契約駐車場_0", | プラン名: "契約駐車場_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; | } as const; | ||||
| // export const 支払種別Dropdown = { | // export const 支払種別Dropdown = { | ||||
| @@ -10,6 +10,8 @@ const F = { | |||||
| ゆうちょ口座記号: "YuchoAccountsSymbol", | ゆうちょ口座記号: "YuchoAccountsSymbol", | ||||
| ゆうちょ口座番号: "YuchoAccountsNo", | ゆうちょ口座番号: "YuchoAccountsNo", | ||||
| 口座登録催促予定日時: "口座登録催促予定日時", | 口座登録催促予定日時: "口座登録催促予定日時", | ||||
| 振替日: "TransferDivision", | |||||
| 振替開始日: "TransferStartDate", | |||||
| 顧客名: "CustomerName", | 顧客名: "CustomerName", | ||||
| 顧客名カナ: "顧客名カナ", | 顧客名カナ: "顧客名カナ", | ||||
| @@ -51,6 +53,8 @@ export type 顧客マスタ = AppRecord & { | |||||
| SMBC入金額: KintoneRecordField.Number; | SMBC入金額: KintoneRecordField.Number; | ||||
| [F.ゆうちょ口座記号]: KintoneRecordField.Number; | [F.ゆうちょ口座記号]: KintoneRecordField.Number; | ||||
| [F.ゆうちょ口座番号]: KintoneRecordField.Number; | [F.ゆうちょ口座番号]: KintoneRecordField.Number; | ||||
| [F.振替日]: KintoneRecordField.Number; | |||||
| [F.振替開始日]: KintoneRecordField.Date; | |||||
| クレジット入金額: KintoneRecordField.Number; | クレジット入金額: KintoneRecordField.Number; | ||||
| コンビニ払入金額: KintoneRecordField.Number; | コンビニ払入金額: KintoneRecordField.Number; | ||||
| [F.メールアドレス]: KintoneRecordField.Link; | [F.メールアドレス]: KintoneRecordField.Link; | ||||