Skip to content

Commit

Permalink
generate 401 report
Browse files Browse the repository at this point in the history
  • Loading branch information
jing12345678910 committed Aug 15, 2024
1 parent 0c8e709 commit ca65b06
Show file tree
Hide file tree
Showing 4 changed files with 146 additions and 41 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "iSunFA",
"version": "0.8.0+7",
"version": "0.8.0+8",
"private": false,
"scripts": {
"dev": "next dev",
Expand Down
144 changes: 107 additions & 37 deletions src/components/tax_report_body_all/tax_report_body_all.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
};
Expand Down Expand Up @@ -90,18 +92,21 @@ const TaxReportBodyAll = ({ reportId }: ITaxReportBodyAllProps) => {
<tbody>
<tr>
<td className="border border-black px-2 py-0">統一編號</td>
<td className="border border-black px-2 py-0">28682266</td>
<td className="border border-black px-2 py-0">
{report401?.basicInfo.uniformNumber || 'N/A'}
</td>
</tr>
<tr>
<td className="border border-black px-2 py-0">營業人名稱</td>
<td className="border border-black px-2 py-0">
{report401?.basicInfo.businessName || 'N/A'}
{report401?.sales.breakdown.triplicateAndElectronic.amount || 'N/A'}
</td>
</tr>
<tr>
<td className="border border-black px-2 py-0">稅籍編號</td>
<td className="border border-black px-2 py-0">123456789</td>
<td className="border border-black px-2 py-0">
{report401?.basicInfo.taxSerialNumber || 'N/A'}
</td>
</tr>
</tbody>
</table>
Expand All @@ -115,7 +120,10 @@ const TaxReportBodyAll = ({ reportId }: ITaxReportBodyAllProps) => {
</h1>
<p className="text-xs">(一般稅額計算-專營應稅營業人使用)</p>
<div className="flex justify-between text-xs">
<p className="flex-1 text-center">所屬年月份:112年11–12月</p>
<p className="flex-1 text-center">
所屬年月份:{report401?.basicInfo.currentYear || 'N/A'}
{report401?.basicInfo.currentMonth || 'N/A'}
</p>
<p className="text-right">金額單位:新臺幣元</p>
</div>
</div>
Expand Down Expand Up @@ -156,13 +164,17 @@ const TaxReportBodyAll = ({ reportId }: ITaxReportBodyAllProps) => {
<tbody>
<tr>
<td className="text-nowrap border border-black px-2 py-0">負責人姓名</td>
<td className="border border-black px-2 py-0"></td>
<td className="border border-black px-2 py-0">
{report401?.basicInfo.personInCharge || 'N/A'}
</td>
<td className="text-nowrap border border-black px-2 py-0">營業地址</td>
<td className="border border-black px-2 py-0" colSpan={9}>
231新北市新店區中興路一段222號(營業地址)
{report401?.basicInfo.businessAddress || 'N/A'}
</td>
<td className="text-nowrap border border-black px-2 py-0">使用發票份數</td>
<td className="border border-black px-2 py-0 text-right"></td>
<td className="border border-black px-2 py-0 text-right">
{report401?.basicInfo.usedInvoiceCount || 'N/A'}
</td>
</tr>
<tr>
<td className="border border-black px-2 py-0 text-center" rowSpan={10}>
Expand Down Expand Up @@ -208,9 +220,13 @@ const TaxReportBodyAll = ({ reportId }: ITaxReportBodyAllProps) => {
三聯式發票、電子計算機發票
</td>
<td className="border border-black px-2 py-0">1</td>
<td className="border border-black px-2 py-0"></td>
<td className="border border-black px-2 py-0">
{report401?.sales.breakdown.triplicateAndElectronic.amount || 'N/A'}
</td>
<td className="border border-black px-2 py-0">2</td>
<td className="border border-black px-2 py-0"></td>
<td className="border border-black px-2 py-0">
{report401?.sales.breakdown.triplicateAndElectronic.tax || 'N/A'}
</td>
<td className="border border-black px-2 py-0" colSpan={2}>
3 (非經海關出口應附證明文件者)
</td>
Expand All @@ -224,9 +240,13 @@ const TaxReportBodyAll = ({ reportId }: ITaxReportBodyAllProps) => {
收銀機發票(三聯式)及電子發票
</td>
<td className="border border-black px-2 py-0">5</td>
<td className="border border-black px-2 py-0"></td>
<td className="border border-black px-2 py-0">
{report401?.sales.breakdown.cashRegisterTriplicate.amount || 'N/A'}
</td>
<td className="border border-black px-2 py-0">6</td>
<td className="border border-black px-2 py-0"></td>
<td className="border border-black px-2 py-0">
{report401?.sales.breakdown.cashRegisterTriplicate.tax || 'N/A'}
</td>
<td className="border border-black px-2 py-0">7</td>
<td className="border border-black px-2 py-0"></td>
<td className="border border-black px-2 py-0">8</td>
Expand All @@ -239,9 +259,13 @@ const TaxReportBodyAll = ({ reportId }: ITaxReportBodyAllProps) => {
二聯式發票、收銀機發票(二聯式)
</td>
<td className="border border-black px-2 py-0">9</td>
<td className="border border-black px-2 py-0"></td>
<td className="border border-black px-2 py-0">
{report401?.sales.breakdown.duplicateAndCashRegister.amount || 'N/A'}
</td>
<td className="border border-black px-2 py-0">10</td>
<td className="border border-black px-2 py-0"></td>
<td className="border border-black px-2 py-0">
{report401?.sales.breakdown.duplicateAndCashRegister.tax || 'N/A'}
</td>
<td className="border border-black px-2 py-0" colSpan={2}>
11 (經海關出口免附證明文件者)
</td>
Expand All @@ -255,9 +279,13 @@ const TaxReportBodyAll = ({ reportId }: ITaxReportBodyAllProps) => {
免用發票
</td>
<td className="border border-black px-2 py-0">13</td>
<td className="border border-black px-2 py-0"></td>
<td className="border border-black px-2 py-0">
{report401?.sales.breakdown.taxExempt.amount || 'N/A'}
</td>
<td className="border border-black px-2 py-0">14</td>
<td className="border border-black px-2 py-0"></td>
<td className="border border-black px-2 py-0">
{report401?.sales.breakdown.taxExempt.tax || 'N/A'}
</td>
<td className="border border-black px-2 py-0">15</td>
<td className="border border-black px-2 py-0"></td>
<td className="border border-black px-2 py-0">11</td>
Expand All @@ -270,9 +298,13 @@ const TaxReportBodyAll = ({ reportId }: ITaxReportBodyAllProps) => {
減:退回及折讓
</td>
<td className="border border-black px-2 py-0">17</td>
<td className="border border-black px-2 py-0"></td>
<td className="border border-black px-2 py-0">
{report401?.sales.breakdown.returnsAndAllowances.amount || 'N/A'}
</td>
<td className="border border-black px-2 py-0">18</td>
<td className="border border-black px-2 py-0"></td>
<td className="border border-black px-2 py-0">
{report401?.sales.breakdown.returnsAndAllowances.tax || 'N/A'}
</td>
<td className="border border-black px-2 py-0">19</td>
<td className="border border-black px-2 py-0"></td>
<td className="border border-black px-2 py-0">12</td>
Expand All @@ -285,9 +317,13 @@ const TaxReportBodyAll = ({ reportId }: ITaxReportBodyAllProps) => {
合計
</td>
<td className="border border-black px-2 py-0">21①</td>
<td className="border border-black px-2 py-0"></td>
<td className="border border-black px-2 py-0">
{report401?.sales.breakdown.total.amount || 'N/A'}
</td>
<td className="border border-black px-2 py-0">22②</td>
<td className="border border-black px-2 py-0"></td>
<td className="border border-black px-2 py-0">
{report401?.sales.breakdown.total.tax || 'N/A'}
</td>
<td className="border border-black px-2 py-0">23③</td>
<td className="border border-black px-2 py-0"></td>
<td className="border border-black px-2 py-0">13</td>
Expand All @@ -306,13 +342,13 @@ const TaxReportBodyAll = ({ reportId }: ITaxReportBodyAllProps) => {
</td>
<td className="border border-black px-2 py-0" colSpan={5} rowSpan={2}>
<div className="flex items-center">
元(
{report401?.sales.totalTaxableAmount || 'N/A'}元(
<div>
<span>內含銷售</span>
<br />
<span>固定資產</span>
</div>
元)
{report401?.sales.includeFixedAsset || 'N/A'}元)
</div>
</td>
<td className="border border-black px-2 py-0">14</td>
Expand Down Expand Up @@ -394,9 +430,13 @@ const TaxReportBodyAll = ({ reportId }: ITaxReportBodyAllProps) => {
</td>
<td className="text-nowrap border border-black px-2 py-0 text-center">進貨及費用</td>
<td className="border border-black px-2 py-0 text-center">28</td>
<td className="border border-black px-2 py-0 text-center" colSpan={2}></td>
<td className="border border-black px-2 py-0 text-center" colSpan={2}>
{report401?.purchases.breakdown.uniformInvoice.generalPurchases.amount || 'N/A'}
</td>
<td className="border border-black px-2 py-0 text-center">29</td>
<td className="border border-black px-2 py-0 text-center" colSpan={2}></td>
<td className="border border-black px-2 py-0 text-center" colSpan={2}>
{report401?.purchases.breakdown.uniformInvoice.generalPurchases.tax || 'N/A'}
</td>
<td className="border border-black px-2 py-0 text-center" rowSpan={2} colSpan={3}>
保稅區營業人按進口報關程序銷售貨物至我國
<br />
Expand All @@ -412,9 +452,13 @@ const TaxReportBodyAll = ({ reportId }: ITaxReportBodyAllProps) => {
<tr>
<td className="text-nowrap border border-black px-2 py-0 text-center">固定資產</td>
<td className="border border-black px-2 py-0 text-center">30</td>
<td className="border border-black px-2 py-0 text-center" colSpan={2}></td>
<td className="border border-black px-2 py-0 text-center" colSpan={2}>
{report401?.purchases.breakdown.uniformInvoice.fixedAssets.amount || 'N/A'}
</td>
<td className="border border-black px-2 py-0 text-center">31</td>
<td className="border border-black px-2 py-0 text-center" colSpan={2}></td>
<td className="border border-black px-2 py-0 text-center" colSpan={2}>
{report401?.purchases.breakdown.uniformInvoice.fixedAssets.tax || 'N/A'}
</td>
</tr>
<tr>
<td className="text-nowrap border border-black px-2 py-0 text-start" rowSpan={2}>
Expand All @@ -423,9 +467,15 @@ const TaxReportBodyAll = ({ reportId }: ITaxReportBodyAllProps) => {
</td>
<td className="text-nowrap border border-black px-2 py-0 text-center">進貨及費用</td>
<td className="border border-black px-2 py-0 text-center">32</td>
<td className="border border-black px-2 py-0 text-center" colSpan={2}></td>
<td className="border border-black px-2 py-0 text-center" colSpan={2}>
{report401?.purchases.breakdown.cashRegisterAndElectronic.generalPurchases.amount ||
'N/A'}
</td>
<td className="border border-black px-2 py-0 text-center">33</td>
<td className="border border-black px-2 py-0 text-center" colSpan={2}></td>
<td className="border border-black px-2 py-0 text-center" colSpan={2}>
{report401?.purchases.breakdown.cashRegisterAndElectronic.generalPurchases.tax ||
'N/A'}
</td>
<td className="border border-black px-2 py-0 text-center" colSpan={3}>
申報單位蓋章處(統一發票專用章)
</td>
Expand All @@ -436,9 +486,13 @@ const TaxReportBodyAll = ({ reportId }: ITaxReportBodyAllProps) => {
<tr>
<td className="text-nowrap border border-black px-2 py-0 text-center">固定資產</td>
<td className="border border-black px-2 py-0 text-center">34</td>
<td className="border border-black px-2 py-0 text-center" colSpan={2}></td>
<td className="border border-black px-2 py-0 text-center" colSpan={2}>
{report401?.purchases.breakdown.cashRegisterAndElectronic.fixedAssets.amount || 'N/A'}
</td>
<td className="border border-black px-2 py-0 text-center">35</td>
<td className="border border-black px-2 py-0 text-center" colSpan={2}></td>
<td className="border border-black px-2 py-0 text-center" colSpan={2}>
{report401?.purchases.breakdown.cashRegisterAndElectronic.fixedAssets.tax || 'N/A'}
</td>
<td className="border border-black px-2 py-0 text-left" rowSpan={9} colSpan={3}>
<p>
<span>附 1.統一發票明細表</span>
Expand Down Expand Up @@ -490,26 +544,38 @@ const TaxReportBodyAll = ({ reportId }: ITaxReportBodyAllProps) => {
</td>
<td className="text-nowrap border border-black px-2 py-0 text-center">進貨及費用</td>
<td className="border border-black px-2 py-0 text-center">36</td>
<td className="border border-black px-2 py-0 text-center" colSpan={2}></td>
<td className="border border-black px-2 py-0 text-center" colSpan={2}>
{report401?.purchases.breakdown.otherTaxableVouchers.generalPurchases.amount || 'N/A'}
</td>
<td className="border border-black px-2 py-0 text-center">37</td>
<td className="border border-black px-2 py-0 text-center" colSpan={2}></td>
<td className="border border-black px-2 py-0 text-center" colSpan={2}>
{report401?.purchases.breakdown.otherTaxableVouchers.generalPurchases.tax || 'N/A'}
</td>
</tr>
<tr>
<td className="text-nowrap border border-black px-2 py-0 text-center">固定資產</td>
<td className="border border-black px-2 py-0 text-center">38</td>
<td className="border border-black px-2 py-0 text-center" colSpan={2}></td>
<td className="border border-black px-2 py-0 text-center" colSpan={2}>
{report401?.purchases.breakdown.otherTaxableVouchers.fixedAssets.amount || 'N/A'}
</td>
<td className="border border-black px-2 py-0 text-center">39</td>
<td className="border border-black px-2 py-0 text-center" colSpan={2}></td>
<td className="border border-black px-2 py-0 text-center" colSpan={2}>
{report401?.purchases.breakdown.otherTaxableVouchers.fixedAssets.tax || 'N/A'}
</td>
</tr>
<tr>
<td className="text-nowrap border border-black px-2 py-0 text-start" rowSpan={2}>
海關代徵營業稅繳納證扣抵聯
</td>
<td className="text-nowrap border border-black px-2 py-0 text-center">進貨及費用</td>
<td className="border border-black px-2 py-0 text-center">78</td>
<td className="border border-black px-2 py-0 text-center" colSpan={2}></td>
<td className="border border-black px-2 py-0 text-center" colSpan={2}>
{report401?.purchases.breakdown.customsDutyPayment.generalPurchases.amount || 'N/A'}
</td>
<td className="border border-black px-2 py-0 text-center">79</td>
<td className="border border-black px-2 py-0 text-center" colSpan={2}></td>
<td className="border border-black px-2 py-0 text-center" colSpan={2}>
{report401?.purchases.breakdown.customsDutyPayment.generalPurchases.tax || 'N/A'}
</td>
</tr>
<tr>
<td className="text-nowrap border border-black px-2 py-0 text-center">固定資產</td>
Expand All @@ -532,9 +598,13 @@ const TaxReportBodyAll = ({ reportId }: ITaxReportBodyAllProps) => {
<tr>
<td className="text-nowrap border border-black px-2 py-0 text-center">固定資產</td>
<td className="border border-black px-2 py-0 text-center">80</td>
<td className="border border-black px-2 py-0 text-center" colSpan={2}></td>
<td className="border border-black px-2 py-0 text-center" colSpan={2}>
{report401?.purchases.breakdown.customsDutyPayment.fixedAssets.amount || 'N/A'}
</td>
<td className="border border-black px-2 py-0 text-center">81</td>
<td className="border border-black px-2 py-0 text-center" colSpan={2}></td>
<td className="border border-black px-2 py-0 text-center" colSpan={2}>
{report401?.purchases.breakdown.customsDutyPayment.fixedAssets.tax || 'N/A'}
</td>
</tr>
<tr>
<td className="text-nowrap border border-black px-2 py-0 text-start" rowSpan={2}>
Expand Down
Loading

0 comments on commit ca65b06

Please sign in to comment.