diff --git a/package.json b/package.json
index d0e82065e..1e1937d3c 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "iSunFA",
- "version": "0.8.0+7",
+ "version": "0.8.0+8",
"private": false,
"scripts": {
"dev": "next dev",
diff --git a/src/components/tax_report_body_all/tax_report_body_all.tsx b/src/components/tax_report_body_all/tax_report_body_all.tsx
index 7bbf64816..f85337aa4 100644
--- a/src/components/tax_report_body_all/tax_report_body_all.tsx
+++ b/src/components/tax_report_body_all/tax_report_body_all.tsx
@@ -23,6 +23,8 @@ const TaxReportBodyAll = ({ reportId }: ITaxReportBodyAllProps) => {
const fetchReport = async () => {
if (selectedCompany) {
const reportData = await generate401Report(selectedCompany.id, Date.now() / 1000);
+ // eslint-disable-next-line no-console
+ // console.log('Fetched report401 data:', reportData);
setReport401(reportData);
}
};
@@ -90,18 +92,21 @@ const TaxReportBodyAll = ({ reportId }: ITaxReportBodyAllProps) => {
負責人姓名 |
- |
+
+ {report401?.basicInfo.personInCharge || 'N/A'}
+ |
營業地址 |
- 231新北市新店區中興路一段222號(營業地址)
+ {report401?.basicInfo.businessAddress || 'N/A'}
|
使用發票份數 |
- 份 |
+
+ {report401?.basicInfo.usedInvoiceCount || 'N/A'}份
+ |
@@ -208,9 +220,13 @@ const TaxReportBodyAll = ({ reportId }: ITaxReportBodyAllProps) => {
三聯式發票、電子計算機發票
|
1 |
- |
+
+ {report401?.sales.breakdown.triplicateAndElectronic.amount || 'N/A'}
+ |
2 |
- |
+
+ {report401?.sales.breakdown.triplicateAndElectronic.tax || 'N/A'}
+ |
3 (非經海關出口應附證明文件者)
|
@@ -224,9 +240,13 @@ const TaxReportBodyAll = ({ reportId }: ITaxReportBodyAllProps) => {
收銀機發票(三聯式)及電子發票
5 |
- |
+
+ {report401?.sales.breakdown.cashRegisterTriplicate.amount || 'N/A'}
+ |
6 |
- |
+
+ {report401?.sales.breakdown.cashRegisterTriplicate.tax || 'N/A'}
+ |
7 |
|
8 |
@@ -239,9 +259,13 @@ const TaxReportBodyAll = ({ reportId }: ITaxReportBodyAllProps) => {
二聯式發票、收銀機發票(二聯式)
9 |
- |
+
+ {report401?.sales.breakdown.duplicateAndCashRegister.amount || 'N/A'}
+ |
10 |
- |
+
+ {report401?.sales.breakdown.duplicateAndCashRegister.tax || 'N/A'}
+ |
11 (經海關出口免附證明文件者)
|
@@ -255,9 +279,13 @@ const TaxReportBodyAll = ({ reportId }: ITaxReportBodyAllProps) => {
免用發票
13 |
- |
+
+ {report401?.sales.breakdown.taxExempt.amount || 'N/A'}
+ |
14 |
- |
+
+ {report401?.sales.breakdown.taxExempt.tax || 'N/A'}
+ |
15 |
|
11 |
@@ -270,9 +298,13 @@ const TaxReportBodyAll = ({ reportId }: ITaxReportBodyAllProps) => {
減:退回及折讓
17 |
- |
+
+ {report401?.sales.breakdown.returnsAndAllowances.amount || 'N/A'}
+ |
18 |
- |
+
+ {report401?.sales.breakdown.returnsAndAllowances.tax || 'N/A'}
+ |
19 |
|
12 |
@@ -285,9 +317,13 @@ const TaxReportBodyAll = ({ reportId }: ITaxReportBodyAllProps) => {
合計
21① |
- |
+
+ {report401?.sales.breakdown.total.amount || 'N/A'}
+ |
22② |
- |
+
+ {report401?.sales.breakdown.total.tax || 'N/A'}
+ |
23③ |
|
13 |
@@ -306,13 +342,13 @@ const TaxReportBodyAll = ({ reportId }: ITaxReportBodyAllProps) => {
- 元(
+ {report401?.sales.totalTaxableAmount || 'N/A'}元(
內含銷售
固定資產
- ㉗ 元)
+ ㉗{report401?.sales.includeFixedAsset || 'N/A'}元)
|
14 |
@@ -394,9 +430,13 @@ const TaxReportBodyAll = ({ reportId }: ITaxReportBodyAllProps) => {
進貨及費用 |
28 |
- |
+
+ {report401?.purchases.breakdown.uniformInvoice.generalPurchases.amount || 'N/A'}
+ |
29 |
- |
+
+ {report401?.purchases.breakdown.uniformInvoice.generalPurchases.tax || 'N/A'}
+ |
保稅區營業人按進口報關程序銷售貨物至我國
@@ -412,9 +452,13 @@ const TaxReportBodyAll = ({ reportId }: ITaxReportBodyAllProps) => {
|
固定資產 |
30 |
- |
+
+ {report401?.purchases.breakdown.uniformInvoice.fixedAssets.amount || 'N/A'}
+ |
31 |
- |
+
+ {report401?.purchases.breakdown.uniformInvoice.fixedAssets.tax || 'N/A'}
+ |
@@ -423,9 +467,15 @@ const TaxReportBodyAll = ({ reportId }: ITaxReportBodyAllProps) => {
|
進貨及費用 |
32 |
- |
+
+ {report401?.purchases.breakdown.cashRegisterAndElectronic.generalPurchases.amount ||
+ 'N/A'}
+ |
33 |
- |
+
+ {report401?.purchases.breakdown.cashRegisterAndElectronic.generalPurchases.tax ||
+ 'N/A'}
+ |
申報單位蓋章處(統一發票專用章)
|
@@ -436,9 +486,13 @@ const TaxReportBodyAll = ({ reportId }: ITaxReportBodyAllProps) => {
固定資產 |
34 |
- |
+
+ {report401?.purchases.breakdown.cashRegisterAndElectronic.fixedAssets.amount || 'N/A'}
+ |
35 |
- |
+
+ {report401?.purchases.breakdown.cashRegisterAndElectronic.fixedAssets.tax || 'N/A'}
+ |
附 1.統一發票明細表
@@ -490,16 +544,24 @@ const TaxReportBodyAll = ({ reportId }: ITaxReportBodyAllProps) => {
|
進貨及費用 |
36 |
- |
+
+ {report401?.purchases.breakdown.otherTaxableVouchers.generalPurchases.amount || 'N/A'}
+ |
37 |
- |
+
+ {report401?.purchases.breakdown.otherTaxableVouchers.generalPurchases.tax || 'N/A'}
+ |
固定資產 |
38 |
- |
+
+ {report401?.purchases.breakdown.otherTaxableVouchers.fixedAssets.amount || 'N/A'}
+ |
39 |
- |
+
+ {report401?.purchases.breakdown.otherTaxableVouchers.fixedAssets.tax || 'N/A'}
+ |
@@ -507,9 +569,13 @@ const TaxReportBodyAll = ({ reportId }: ITaxReportBodyAllProps) => {
|
進貨及費用 |
78 |
- |
+
+ {report401?.purchases.breakdown.customsDutyPayment.generalPurchases.amount || 'N/A'}
+ |
79 |
- |
+
+ {report401?.purchases.breakdown.customsDutyPayment.generalPurchases.tax || 'N/A'}
+ |
固定資產 |
@@ -532,9 +598,13 @@ const TaxReportBodyAll = ({ reportId }: ITaxReportBodyAllProps) => {
固定資產 |
80 |
- |
+
+ {report401?.purchases.breakdown.customsDutyPayment.fixedAssets.amount || 'N/A'}
+ |
81 |
- |
+
+ {report401?.purchases.breakdown.customsDutyPayment.fixedAssets.tax || 'N/A'}
+ |
diff --git a/src/components/view_financial_section/view_financial_section.tsx b/src/components/view_financial_section/view_financial_section.tsx
index 70c879ba5..efb3b4e28 100644
--- a/src/components/view_financial_section/view_financial_section.tsx
+++ b/src/components/view_financial_section/view_financial_section.tsx
@@ -14,6 +14,7 @@ import {
CashFlowStatementReport,
FinancialReport,
IncomeStatementReport,
+ // TaxReport401,
} from '@/interfaces/report';
import { useUserCtx } from '@/contexts/user_context';
import { ReportSheetType, ReportSheetTypeDisplayMap } from '@/constants/report';
@@ -31,7 +32,17 @@ interface IViewReportSectionProps {
reportLink: string;
reportId: string;
}
-
+// Info: (20240815 - Anna)增加類型保護函數
+function isTaxReport401(report: FinancialReport): boolean {
+ return (
+ 'basicInfo' in report &&
+ 'sales' in report &&
+ 'purchases' in report &&
+ 'taxCalculation' in report &&
+ 'imports' in report &&
+ 'bondedAreaSalesToTaxArea' in report
+ );
+}
const generateThumbnails = (count: number) => {
return Array.from({ length: count }, (_, index) => ({
number: index + 1,
@@ -44,11 +55,15 @@ const generateThumbnails = (count: number) => {
const balanceReportThumbnails = generateThumbnails(12);
const incomeReportThumbnails = generateThumbnails(9);
const cashFlowReportThumbnails = generateThumbnails(11);
+// Info: (20240815 - Anna)增加401報表的縮圖
+const report401Thumbnails = generateThumbnails(1);
enum TotalPages {
BALANCE_SHEET = 12,
INCOME_STATEMENT = 9,
CASH_FLOW_STATEMENT = 11,
+ // Info: (20240815 - Anna)增加401報表的頁數
+ REPORT_401 = 1,
}
function isValidIncomeStatementReport(report: IncomeStatementReport): boolean {
@@ -84,7 +99,17 @@ function isValidCashFlowStatementReport(report: CashFlowStatementReport): boolea
report.otherInfo.freeCash
);
}
-
+// Info: (20240815 - Anna)增加401報表的判斷函數
+// function isValidReport401(report: TaxReport401): boolean {
+// return !!(
+// report.basicInfo &&
+// report.sales &&
+// report.purchases &&
+// report.taxCalculation &&
+// report.imports &&
+// report.bondedAreaSalesToTaxArea !== undefined
+// );
+// }
const ViewFinancialSection = ({
reportId,
@@ -135,6 +160,10 @@ const ViewFinancialSection = ({
return !isValidBalanceSheetReport(reportFinancial as BalanceSheetReport);
case ReportSheetType.CASH_FLOW_STATEMENT:
return !isValidCashFlowStatementReport(reportFinancial as CashFlowStatementReport);
+ // Info:(20240815 - Anna) 新增定義 isValidReport401 函數
+ case ReportSheetType.REPORT_401:
+ // Info:(20240815 - Anna)使用 isTaxReport401 進行類型檢查
+ return !isTaxReport401(reportFinancial);
default:
return true;
}
@@ -259,6 +288,11 @@ const ViewFinancialSection = ({
setReportThumbnails(cashFlowReportThumbnails);
setNumPages(TotalPages.CASH_FLOW_STATEMENT);
break;
+ // Info:(20240815 - Anna) 創建401
+ case FinancialReportTypesKey.report_401:
+ setReportThumbnails(report401Thumbnails);
+ setNumPages(TotalPages.REPORT_401);
+ break;
default:
setReportThumbnails([]);
}
diff --git a/src/interfaces/report_type.ts b/src/interfaces/report_type.ts
index 191674a59..44e61f667 100644
--- a/src/interfaces/report_type.ts
+++ b/src/interfaces/report_type.ts
@@ -31,7 +31,7 @@ export enum ReportTypeToBaifaReportType {
balance_sheet = 'balance',
comprehensive_income_statement = 'comprehensive-income',
cash_flow_statement = 'cash-flow',
- report_401 = '401',
+ report_401 = 'report-401',
// change_in_equity_statement = 'change-in-equity'
}
@@ -39,6 +39,7 @@ export enum BaifaReportTypeToReportType {
balance = 'balance_sheet',
'comprehensive-income' = 'comprehensive_income_statement',
'cash-flow' = 'cash_flow_statement',
+ 'report-401' = 'report_401',
// 'change-in-equity' = 'change_in_equity_statement'
}
|