| @@ -0,0 +1,37 @@ | |||||
| import { apptemplate, eventHnalder } from "@/common/app-template"; | |||||
| import { setHeaderButton } from "@/common/header-button"; | |||||
| import { KintoneEvent } from "@/common/kintone-event"; | |||||
| import { ShowConfirmDialog, SuccessDialog } from "@/middleware/swal"; | |||||
| import { saveReceipt } from "@/mypage/領収証発行"; | |||||
| import { 領収証 } from "@/types/領収証"; | |||||
| import { setup } from ".."; | |||||
| setup(() => { | |||||
| kintone.events.on( | |||||
| [KintoneEvent.詳細.レコード詳細画面を表示した後], | |||||
| eventHnalder(async (event) => { | |||||
| const record = event.record as 領収証; | |||||
| // PDFファイル作成処理 | |||||
| setHeaderButton( | |||||
| "領収証PDF作成", | |||||
| apptemplate(async ({ needReloadAtEnd }) => { | |||||
| const confirm = await ShowConfirmDialog({ | |||||
| title: "領収証PDFを作成しますか", | |||||
| text: "※作成済みのファイルは破棄されます", | |||||
| }); | |||||
| if (!confirm.isConfirmed) { | |||||
| return; | |||||
| } | |||||
| const ret = await saveReceipt(Number(record.$id.value)); | |||||
| if (!ret) throw new Error("API実行失敗"); | |||||
| await SuccessDialog.fire(); | |||||
| needReloadAtEnd(true); | |||||
| }) | |||||
| ); | |||||
| }) | |||||
| ); | |||||
| }); | |||||
| @@ -3,5 +3,6 @@ export const MyPageApiID = { | |||||
| 定期選考候補者設定: "season-ticket-contract-selection/fill-candidates", | 定期選考候補者設定: "season-ticket-contract-selection/fill-candidates", | ||||
| 定期選考一斉通知: "season-ticket-contract-selection/notice-to-candidates", | 定期選考一斉通知: "season-ticket-contract-selection/notice-to-candidates", | ||||
| 領収証発行: "receipt/create", | 領収証発行: "receipt/create", | ||||
| 領収証ファイル保存: "receipt/save", | |||||
| } as const; | } as const; | ||||
| export type MyPageApiID = (typeof MyPageApiID)[keyof typeof MyPageApiID]; | export type MyPageApiID = (typeof MyPageApiID)[keyof typeof MyPageApiID]; | ||||
| @@ -7,3 +7,10 @@ export const makeReceipt = (recordNos: number[]) => { | |||||
| }; | }; | ||||
| return send(MyPageApiID.領収証発行, sendData); | return send(MyPageApiID.領収証発行, sendData); | ||||
| }; | }; | ||||
| export const saveReceipt = (recordNo: number) => { | |||||
| const sendData = { | |||||
| receipt_record_no: recordNo, | |||||
| }; | |||||
| return send(MyPageApiID.領収証ファイル保存, sendData); | |||||
| }; | |||||
| @@ -0,0 +1,68 @@ | |||||
| import { KintoneRecordField } from "@kintone/rest-api-client"; | |||||
| import { AppRecord } from "."; | |||||
| const F = {} as const; | |||||
| // export const 状態Dropdown = { | |||||
| // 空き: "空き", | |||||
| // 契約中: "契約中", | |||||
| // } as const; | |||||
| // export type 状態Dropdown = (typeof 状態Dropdown)[keyof typeof 状態Dropdown]; | |||||
| export const 領収証フィールド名 = F; | |||||
| export type 領収証 = AppRecord & { | |||||
| 顧客コード: KintoneRecordField.Number; | |||||
| 領収証番号: KintoneRecordField.SingleLineText; | |||||
| 合計: KintoneRecordField.Number; | |||||
| インボイス登録番号: KintoneRecordField.SingleLineText; | |||||
| 顧客名: KintoneRecordField.SingleLineText; | |||||
| 初回領収証ダウンロード日時: KintoneRecordField.DateTime; | |||||
| 宛名: KintoneRecordField.SingleLineText; | |||||
| 領収証名称: KintoneRecordField.SingleLineText; | |||||
| 発行日: KintoneRecordField.Date; | |||||
| 発行事業者名: KintoneRecordField.MultiLineText; | |||||
| 領収証PDF: KintoneRecordField.File; | |||||
| テーブル_入金実績: { | |||||
| type: "SUBTABLE"; | |||||
| value: { | |||||
| id: string; | |||||
| value: { | |||||
| 入金実績_入金額: KintoneRecordField.Number; | |||||
| 入金実績_支払種別: KintoneRecordField.SingleLineText; | |||||
| 入金実績支払対象_利用_月: KintoneRecordField.SingleLineText; | |||||
| 入金実績_入金日: KintoneRecordField.Date; | |||||
| 入金実績支払対象_利用_年: KintoneRecordField.SingleLineText; | |||||
| 入金実績_入金予定レコード番号: KintoneRecordField.Number; | |||||
| }; | |||||
| }[]; | |||||
| }; | |||||
| テーブル_明細: { | |||||
| type: "SUBTABLE"; | |||||
| value: { | |||||
| id: string; | |||||
| value: { | |||||
| 明細_単価: KintoneRecordField.Number; | |||||
| 明細_備考: KintoneRecordField.SingleLineText; | |||||
| 明細_数量: KintoneRecordField.Number; | |||||
| 明細_名称: KintoneRecordField.SingleLineText; | |||||
| 明細_金額: KintoneRecordField.Number; | |||||
| 明細_駐車場名: KintoneRecordField.SingleLineText; | |||||
| 明細_税率: KintoneRecordField.Number; | |||||
| 明細_対象月: KintoneRecordField.SingleLineText; | |||||
| }; | |||||
| }[]; | |||||
| }; | |||||
| テーブル_内税明細: { | |||||
| type: "SUBTABLE"; | |||||
| value: { | |||||
| id: string; | |||||
| value: { | |||||
| 内税明細_税込金額合計: KintoneRecordField.Number; | |||||
| 内税明細_消費税_内税: KintoneRecordField.Number; | |||||
| 内税明細_税率: KintoneRecordField.Number; | |||||
| }; | |||||
| }[]; | |||||
| }; | |||||
| }; | |||||