@accounter/client
Version:
Accounter client application
1 lines • 6.31 kB
JavaScript
import{s as e}from"./dist-C51EwTaa.js";import{i as t,o as n}from"./utils-DdVdMk8X.js";import{Lo as r,va as i}from"./error-handling-Dpfd9svJ.js";import{y as a}from"./routes-DUvpW9-n.js";import{ft as o}from"./select-CrsvQyhZ.js";import{t as s}from"./funnel-BFbxpUGW.js";import{t as c}from"./button-Dzp2INW0.js";import{Kt as l,P as u,Pt as d,cn as f,gr as p,ln as m}from"./index-CL8-JoMZ.js";import{t as h}from"./page-layout-DoLDsSrs.js";import{t as g}from"./report-commentary-row-CXrND4Xq.js";var _=e(n(),1),v=t();function y({year:e,setYear:t,referenceYears:n,setReferenceYears:r}){let[i,a]=(0,_.useState)(!1);return(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(u,{opened:i,onClose:()=>a(!1),withCloseButton:!0,content:(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(d,{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,v.jsx)(d,{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,v.jsx)(c,{variant:`outline`,size:`icon`,className:`size-7.5`,onClick:()=>a(!0),children:(0,v.jsx)(s,{className:`size-5`})})]})}var b=()=>{let{year:e}=a(),{setFiltersContext:t}=(0,_.useContext)(f),[n,s]=(0,_.useState)(e?Number(e):new Date().getFullYear()),[c,u]=(0,_.useState)([]),[{data:d,fetching:b}]=r({query:p(i),variables:{reportYear:n,referenceYears:c}});(0,_.useEffect)(()=>{t((0,v.jsx)(`div`,{className:`flex flex-row gap-2`,children:(0,v.jsx)(y,{year:n,setYear:s,referenceYears:c,setReferenceYears:u})}))},[n,b,t,c,u]);let x=d?.taxReport,S=x?.report,C=x?.reference??[];return(0,v.jsx)(h,{title:`Tax Report`,headerActions:(0,v.jsx)(l,{filename:`tax_report_${n}`}),children:b?(0,v.jsx)(o,{className:`h-10 w-10 animate-spin mr-2 self-center`}):(0,v.jsx)(`div`,{className:`flex flex-col gap-4`,children:S&&(0,v.jsxs)(m,{highlightOnHover:!0,fontSize:`md`,children:[(0,v.jsx)(`thead`,{children:(0,v.jsxs)(`tr`,{children:[(0,v.jsx)(`th`,{}),(0,v.jsx)(`th`,{children:n},n),(0,v.jsx)(`th`,{}),C.map(e=>(0,v.jsx)(`th`,{children:e.year},e.year))]})}),(0,v.jsxs)(`tbody`,{children:[(0,v.jsx)(g,{dataRow:e=>(0,v.jsxs)(`tr`,{children:[(0,v.jsx)(`th`,{children:`Profit Before Tax`}),(0,v.jsx)(`th`,{children:S.profitBeforeTax.amount.formatted}),(0,v.jsx)(`th`,{children:e}),C.map(e=>(0,v.jsx)(`th`,{children:e.profitBeforeTax.amount.formatted},e.year))]}),commentaryData:S.profitBeforeTax}),(0,v.jsx)(g,{dataRow:e=>(0,v.jsxs)(`tr`,{children:[(0,v.jsx)(`td`,{children:`R&D Expenses By Records`}),(0,v.jsx)(`td`,{children:S.researchAndDevelopmentExpensesByRecords.amount.formatted}),(0,v.jsx)(`th`,{children:e}),C.map(e=>(0,v.jsx)(`td`,{children:e.researchAndDevelopmentExpensesByRecords.amount.formatted},e.year))]}),commentaryData:S.researchAndDevelopmentExpensesByRecords}),(0,v.jsxs)(`tr`,{children:[(0,v.jsx)(`td`,{children:`R&D Expenses For Tax`}),(0,v.jsx)(`td`,{children:S.researchAndDevelopmentExpensesForTax.formatted}),(0,v.jsx)(`td`,{}),C.map(e=>(0,v.jsx)(`td`,{children:e.researchAndDevelopmentExpensesForTax.formatted},e.year)),(0,v.jsx)(`td`,{})]}),(0,v.jsx)(g,{dataRow:e=>(0,v.jsxs)(`tr`,{children:[(0,v.jsx)(`td`,{children:`Fines`}),(0,v.jsx)(`td`,{children:S.fines.amount.formatted}),(0,v.jsx)(`th`,{children:e}),C.map(e=>(0,v.jsx)(`td`,{children:e.fines.amount.formatted},e.year))]}),commentaryData:S.fines}),(0,v.jsx)(g,{dataRow:e=>(0,v.jsxs)(`tr`,{children:[(0,v.jsx)(`td`,{children:`Untaxable Gifts`}),(0,v.jsx)(`td`,{children:S.untaxableGifts.amount.formatted}),(0,v.jsx)(`th`,{children:e}),C.map(e=>(0,v.jsx)(`td`,{children:e.untaxableGifts.amount.formatted},e.year))]}),commentaryData:S.untaxableGifts}),(0,v.jsxs)(`tr`,{children:[(0,v.jsx)(`td`,{children:`Business Trips Excess Expenses`}),(0,v.jsx)(`td`,{children:S.businessTripsExcessExpensesAmount.formatted}),(0,v.jsx)(`td`,{}),C.map(e=>(0,v.jsx)(`td`,{children:e.businessTripsExcessExpensesAmount.formatted},e.year)),(0,v.jsx)(`td`,{})]}),(0,v.jsxs)(`tr`,{children:[(0,v.jsx)(`td`,{children:`Salary Excess Expenses`}),(0,v.jsx)(`td`,{children:S.salaryExcessExpensesAmount.formatted}),(0,v.jsx)(`td`,{}),C.map(e=>(0,v.jsx)(`td`,{children:e.salaryExcessExpensesAmount.formatted},e.year)),(0,v.jsx)(`td`,{})]}),(0,v.jsx)(g,{dataRow:e=>(0,v.jsxs)(`tr`,{children:[(0,v.jsx)(`td`,{children:`Reserves`}),(0,v.jsx)(`td`,{children:S.reserves.amount.formatted}),(0,v.jsx)(`th`,{children:e}),C.map(e=>(0,v.jsx)(`td`,{children:e.reserves.amount.formatted},e.year))]}),commentaryData:S.reserves}),(0,v.jsx)(g,{dataRow:e=>(0,v.jsxs)(`tr`,{children:[(0,v.jsx)(`td`,{children:`Nontaxable Linkage`}),(0,v.jsx)(`td`,{children:S.nontaxableLinkage.amount.formatted}),(0,v.jsx)(`th`,{children:e}),C.map(e=>(0,v.jsx)(`td`,{children:e.nontaxableLinkage.amount.formatted},e.year))]}),commentaryData:S.nontaxableLinkage}),(0,v.jsxs)(`tr`,{children:[(0,v.jsx)(`th`,{children:`Taxable Income`}),(0,v.jsx)(`th`,{children:S.taxableIncome.formatted}),(0,v.jsx)(`th`,{}),C.map(e=>(0,v.jsx)(`th`,{children:e.taxableIncome.formatted},e.year)),(0,v.jsx)(`td`,{})]}),(0,v.jsxs)(`tr`,{children:[(0,v.jsx)(`td`,{children:`Tax Rate`}),(0,v.jsxs)(`td`,{children:[(S.taxRate*100).toFixed(1),`%`]}),(0,v.jsx)(`td`,{}),C.map(e=>(0,v.jsxs)(`td`,{children:[(e.taxRate*100).toFixed(1),`%`]},e.year)),(0,v.jsx)(`td`,{})]}),(0,v.jsx)(g,{dataRow:e=>(0,v.jsxs)(`tr`,{children:[(0,v.jsx)(`td`,{children:`Income with Special Tax Rate`}),(0,v.jsx)(`td`,{children:S.specialTaxableIncome.amount.formatted}),(0,v.jsx)(`th`,{children:e}),C.map(e=>(0,v.jsx)(`td`,{children:e.specialTaxableIncome.amount.formatted},e.year))]}),commentaryData:S.specialTaxableIncome}),(0,v.jsxs)(`tr`,{children:[(0,v.jsx)(`td`,{children:`Special Tax Rate`}),(0,v.jsxs)(`td`,{children:[(S.specialTaxRate*100).toFixed(1),`%`]}),(0,v.jsx)(`td`,{}),C.map(e=>(0,v.jsxs)(`td`,{children:[(e.specialTaxRate*100).toFixed(1),`%`]},e.year)),(0,v.jsx)(`td`,{})]})]}),(0,v.jsx)(`tfoot`,{children:(0,v.jsxs)(`tr`,{children:[(0,v.jsx)(`th`,{children:`Annual Tax Expense`}),(0,v.jsx)(`th`,{children:S.annualTaxExpense.formatted}),(0,v.jsx)(`th`,{}),C.map(e=>(0,v.jsx)(`th`,{children:e.annualTaxExpense.formatted},e.year)),(0,v.jsx)(`td`,{})]})})]})})})};export{b as TaxReport};