@accounter/client
Version:
Accounter client application
1 lines • 6.28 kB
JavaScript
import{s as e}from"./dist-BbgEzppd.js";import{i as t,o as n}from"./utils-BUNz070n.js";import{Ui as r,Ya as i}from"./error-handling-AQOG1RNy.js";import{x as a}from"./routes-BXbESQBe.js";import{dt as o}from"./select-6mBYg_R6.js";import{Tt as s,fr as c,p as l,sn as u}from"./common-Cy-x5Vhe.js";import{t as d}from"./funnel-BvwoBZ0O.js";import{t as f}from"./button-CBTN3XMQ.js";import{w as p}from"./index-B8E5XsZe.js";import{t as m}from"./page-layout-BO3YzLcj.js";import{t as h}from"./report-commentary-row-jGl9xUnN.js";var g=e(n(),1),_=t();function v({year:e,setYear:t,referenceYears:n,setReferenceYears:r}){let[i,a]=(0,g.useState)(!1);return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(l,{opened:i,onClose:()=>a(!1),withCloseButton:!0,content:(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(s,{label:`Change report year`,value:new Date(e,0,1),onChange:e=>e&&t(e?.getFullYear()),popoverProps:{withinPortal:!0},minDate:new Date(2010,0,1),maxDate:new Date}),(0,_.jsx)(s,{type:`multiple`,label:`Pick reference years`,value:n?.map(e=>new Date(e,0,1)),onChange:t=>r(t.map(e=>e.getFullYear()).filter(t=>e!==t)),popoverProps:{withinPortal:!0},minDate:new Date(2010,0,1),maxDate:new Date})]})}),(0,_.jsx)(f,{variant:`outline`,size:`icon`,className:`size-7.5`,onClick:()=>a(!0),children:(0,_.jsx)(d,{className:`size-5`})})]})}var y=()=>{let{year:e}=a(),{setFiltersContext:t}=(0,g.useContext)(p),[n,s]=(0,g.useState)(e?Number(e):new Date().getFullYear()),[l,d]=(0,g.useState)([]),[{data:f,fetching:y}]=i({query:c(r),variables:{reportYear:n,referenceYears:l}});(0,g.useEffect)(()=>{t((0,_.jsx)(`div`,{className:`flex flex-row gap-2`,children:(0,_.jsx)(v,{year:n,setYear:s,referenceYears:l,setReferenceYears:d})}))},[n,y,t,l,d]);let b=f?.taxReport,x=b?.report,S=b?.reference??[];return(0,_.jsx)(m,{title:`Tax Report`,children:y?(0,_.jsx)(o,{className:`h-10 w-10 animate-spin mr-2 self-center`}):(0,_.jsx)(`div`,{className:`flex flex-col gap-4`,children:x&&(0,_.jsxs)(u,{highlightOnHover:!0,fontSize:`md`,children:[(0,_.jsx)(`thead`,{children:(0,_.jsxs)(`tr`,{children:[(0,_.jsx)(`th`,{}),(0,_.jsx)(`th`,{children:n},n),(0,_.jsx)(`th`,{}),S.map(e=>(0,_.jsx)(`th`,{children:e.year},e.year))]})}),(0,_.jsxs)(`tbody`,{children:[(0,_.jsx)(h,{dataRow:e=>(0,_.jsxs)(`tr`,{children:[(0,_.jsx)(`th`,{children:`Profit Before Tax`}),(0,_.jsx)(`th`,{children:x.profitBeforeTax.amount.formatted}),(0,_.jsx)(`th`,{children:e}),S.map(e=>(0,_.jsx)(`th`,{children:e.profitBeforeTax.amount.formatted},e.year))]}),commentaryData:x.profitBeforeTax}),(0,_.jsx)(h,{dataRow:e=>(0,_.jsxs)(`tr`,{children:[(0,_.jsx)(`td`,{children:`R&D Expenses By Records`}),(0,_.jsx)(`td`,{children:x.researchAndDevelopmentExpensesByRecords.amount.formatted}),(0,_.jsx)(`th`,{children:e}),S.map(e=>(0,_.jsx)(`td`,{children:e.researchAndDevelopmentExpensesByRecords.amount.formatted},e.year))]}),commentaryData:x.researchAndDevelopmentExpensesByRecords}),(0,_.jsxs)(`tr`,{children:[(0,_.jsx)(`td`,{children:`R&D Expenses For Tax`}),(0,_.jsx)(`td`,{children:x.researchAndDevelopmentExpensesForTax.formatted}),(0,_.jsx)(`td`,{}),S.map(e=>(0,_.jsx)(`td`,{children:e.researchAndDevelopmentExpensesForTax.formatted},e.year)),(0,_.jsx)(`td`,{})]}),(0,_.jsx)(h,{dataRow:e=>(0,_.jsxs)(`tr`,{children:[(0,_.jsx)(`td`,{children:`Fines`}),(0,_.jsx)(`td`,{children:x.fines.amount.formatted}),(0,_.jsx)(`th`,{children:e}),S.map(e=>(0,_.jsx)(`td`,{children:e.fines.amount.formatted},e.year))]}),commentaryData:x.fines}),(0,_.jsx)(h,{dataRow:e=>(0,_.jsxs)(`tr`,{children:[(0,_.jsx)(`td`,{children:`Untaxable Gifts`}),(0,_.jsx)(`td`,{children:x.untaxableGifts.amount.formatted}),(0,_.jsx)(`th`,{children:e}),S.map(e=>(0,_.jsx)(`td`,{children:e.untaxableGifts.amount.formatted},e.year))]}),commentaryData:x.untaxableGifts}),(0,_.jsxs)(`tr`,{children:[(0,_.jsx)(`td`,{children:`Business Trips Excess Expenses`}),(0,_.jsx)(`td`,{children:x.businessTripsExcessExpensesAmount.formatted}),(0,_.jsx)(`td`,{}),S.map(e=>(0,_.jsx)(`td`,{children:e.businessTripsExcessExpensesAmount.formatted},e.year)),(0,_.jsx)(`td`,{})]}),(0,_.jsxs)(`tr`,{children:[(0,_.jsx)(`td`,{children:`Salary Excess Expenses`}),(0,_.jsx)(`td`,{children:x.salaryExcessExpensesAmount.formatted}),(0,_.jsx)(`td`,{}),S.map(e=>(0,_.jsx)(`td`,{children:e.salaryExcessExpensesAmount.formatted},e.year)),(0,_.jsx)(`td`,{})]}),(0,_.jsx)(h,{dataRow:e=>(0,_.jsxs)(`tr`,{children:[(0,_.jsx)(`td`,{children:`Reserves`}),(0,_.jsx)(`td`,{children:x.reserves.amount.formatted}),(0,_.jsx)(`th`,{children:e}),S.map(e=>(0,_.jsx)(`td`,{children:e.reserves.amount.formatted},e.year))]}),commentaryData:x.reserves}),(0,_.jsx)(h,{dataRow:e=>(0,_.jsxs)(`tr`,{children:[(0,_.jsx)(`td`,{children:`Nontaxable Linkage`}),(0,_.jsx)(`td`,{children:x.nontaxableLinkage.amount.formatted}),(0,_.jsx)(`th`,{children:e}),S.map(e=>(0,_.jsx)(`td`,{children:e.nontaxableLinkage.amount.formatted},e.year))]}),commentaryData:x.nontaxableLinkage}),(0,_.jsxs)(`tr`,{children:[(0,_.jsx)(`th`,{children:`Taxable Income`}),(0,_.jsx)(`th`,{children:x.taxableIncome.formatted}),(0,_.jsx)(`th`,{}),S.map(e=>(0,_.jsx)(`th`,{children:e.taxableIncome.formatted},e.year)),(0,_.jsx)(`td`,{})]}),(0,_.jsxs)(`tr`,{children:[(0,_.jsx)(`td`,{children:`Tax Rate`}),(0,_.jsxs)(`td`,{children:[(x.taxRate*100).toFixed(1),`%`]}),(0,_.jsx)(`td`,{}),S.map(e=>(0,_.jsxs)(`td`,{children:[(e.taxRate*100).toFixed(1),`%`]},e.year)),(0,_.jsx)(`td`,{})]}),(0,_.jsx)(h,{dataRow:e=>(0,_.jsxs)(`tr`,{children:[(0,_.jsx)(`td`,{children:`Income with Special Tax Rate`}),(0,_.jsx)(`td`,{children:x.specialTaxableIncome.amount.formatted}),(0,_.jsx)(`th`,{children:e}),S.map(e=>(0,_.jsx)(`td`,{children:e.specialTaxableIncome.amount.formatted},e.year))]}),commentaryData:x.specialTaxableIncome}),(0,_.jsxs)(`tr`,{children:[(0,_.jsx)(`td`,{children:`Special Tax Rate`}),(0,_.jsxs)(`td`,{children:[(x.specialTaxRate*100).toFixed(1),`%`]}),(0,_.jsx)(`td`,{}),S.map(e=>(0,_.jsxs)(`td`,{children:[(e.specialTaxRate*100).toFixed(1),`%`]},e.year)),(0,_.jsx)(`td`,{})]})]}),(0,_.jsx)(`tfoot`,{children:(0,_.jsxs)(`tr`,{children:[(0,_.jsx)(`th`,{children:`Annual Tax Expense`}),(0,_.jsx)(`th`,{children:x.annualTaxExpense.formatted}),(0,_.jsx)(`th`,{}),S.map(e=>(0,_.jsx)(`th`,{children:e.annualTaxExpense.formatted},e.year)),(0,_.jsx)(`td`,{})]})})]})})})};export{y as TaxReport};