@accounter/client
Version:
Accounter client application
1 lines • 6.11 kB
JavaScript
import{t as e}from"./funnel-CDY9d08i.js";import{Al as t,Cu as n,Hi as r,Id as i,In as a,N as o,Td as s,Uc as c,Wl as l,Zu as u,er as d,jd as f,ln as p,rr as m}from"./index-CSYTUOOk.js";import{t as h}from"./page-layout-DE94O32j.js";import{t as g}from"./report-commentary-row-BQltE-53.js";var _=i(f(),1),v=n();function y({year:t,setYear:n,referenceYears:r,setReferenceYears:i}){let[a,s]=(0,_.useState)(!1);return(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(o,{opened:a,onClose:()=>s(!1),withCloseButton:!0,content:(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(p,{label:`Change report year`,value:new Date(t,0,1),onChange:e=>e&&n(e?.getFullYear()),popoverProps:{withinPortal:!0},minDate:new Date(2010,0,1),maxDate:new Date}),(0,v.jsx)(p,{type:`multiple`,label:`Pick reference years`,value:r?.map(e=>new Date(e,0,1)),onChange:e=>i(e.map(e=>e.getFullYear()).filter(e=>t!==e)),popoverProps:{withinPortal:!0},minDate:new Date(2010,0,1),maxDate:new Date})]})}),(0,v.jsx)(l,{variant:`outline`,size:`icon`,className:`size-7.5`,onClick:()=>s(!0),children:(0,v.jsx)(e,{className:`size-5`})})]})}var b=()=>{let{year:e}=s(),{setFiltersContext:n}=(0,_.useContext)(d),[i,o]=(0,_.useState)(e?Number(e):new Date().getFullYear()),[l,f]=(0,_.useState)([]),[{data:p,fetching:b}]=t({query:r(c),variables:{reportYear:i,referenceYears:l}});(0,_.useEffect)(()=>{n((0,v.jsx)(`div`,{className:`flex flex-row gap-2`,children:(0,v.jsx)(y,{year:i,setYear:o,referenceYears:l,setReferenceYears:f})}))},[i,b,n,l,f]);let x=p?.taxReport,S=x?.report,C=x?.reference??[];return(0,v.jsx)(h,{title:`Tax Report`,headerActions:(0,v.jsx)(a,{filename:`tax_report_${i}`}),children:b?(0,v.jsx)(u,{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:i},i),(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};