@accounter/client
Version:
Accounter client application
1 lines • 6.41 kB
JavaScript
import{s as e}from"./dist-ypP48_Ax.js";import{i as t,o as n}from"./utils-CbS-oR5I.js";import{y as r}from"./routes-Cawu7UJi.js";import{t as i}from"./loader-circle-CfW9jOIr.js";import{Gt as a,gt as o,kt as s,p as c}from"./common-D-vYt_Yl.js";import{c as l}from"./separator-BvKylNhK.js";import{t as u}from"./funnel-BrJTCiKR.js";import{t as d}from"./button-DUNsVBiu.js";import{Qo as f,ka as p}from"./graphql-DC5GYCFE.js";import{t as m}from"./graphql-document-dedupe-fragments-C4jAugiJ.js";import{t as h}from"./page-layout-DfY10rJx.js";import{t as g}from"./report-commentary-row-aLpUDrKM.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)(c,{opened:i,onClose:()=>a(!1),withCloseButton:!0,content:(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(o,{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)(o,{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)(d,{variant:`outline`,size:`icon`,className:`size-7.5`,onClick:()=>a(!0),children:(0,v.jsx)(u,{className:`size-5`})})]})}var b=()=>{let{year:e}=r(),{setFiltersContext:t}=(0,_.useContext)(l),[n,o]=(0,_.useState)(e?Number(e):new Date().getFullYear()),[c,u]=(0,_.useState)([]),[{data:d,fetching:b}]=f({query:m(p),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:o,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)(s,{filename:`tax_report_${n}`}),children:b?(0,v.jsx)(i,{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)(a,{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};