PageSourceSearch

https://shuraba-app.web.app/assets/AccountingPage-DQR9-a_S.js

js shuraba-app.web.app collected 2026-10-03 12:36:01 UTC 13,619 bytes, 1 lines download raw bytes

1import{c as E,r as l,v as F,u as $,z as A,av as D,aD as M,aE as R,j as e,G as B,aa as z,aw as V}from"./index-DUpygkxg.js";import{A as I}from"./AccountingTabBar-BNeW0zw8.js";import{g as _}from"./accounting-DlRhNTfy.js";import{a as K,e as O}from"./csvExport-CxRgDeT7.js";import{f as d}from"./formatters-QZX43yAa.js";import{u as P}from"./useToast-DyXTsHnJ.js";import{u as G}from"./useConfirm-BpzQO8EW.js";import{C as X}from"./chevron-down-Bhl8YpBs.js";import{R as H,C as q,X as J,Y as Q,T as U}from"./CartesianChart-DvcN2kyc.js";import{B as W,a as w}from"./BarChart-DHwxt_0D.js";import{L as Z}from"./Legend-Cq_Zep5W.js";import"./firebase-eOymXQZD.js";import"./tooltipContext-Bz8gGe_N.js";const ee=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 9.9-1",key:"1mm8w8"}]],re=E("lock-open",ee);const te=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],C=E("lock",te),ae=["4月","5月","6月","7月","8月","9月","10月","11月","12月","1月","2月","3月"];function se(t,x){return ae.map((c,i)=>{const a=(i+3)%12+1,k=i<9?x:x+1,m=t.filter(s=>{const o=new Date(s.date);return o.getFullYear()===k&&o.getMonth()+1===a&&s.fiscalYear===x}),g=m.filter(s=>s.majorCategory==="経常収益").reduce((s,o)=>s+o.amount,0),n=m.filter(s=>s.majorCategory!=="経常収益").reduce((s,o)=>s+o.amount,0);return{label:c,revenue:g,expense:n}})}function ke(){const[t,x]=l.useState(null),[c,i]=l.useState([]),[a,k]=l.useState(F()),[m,g]=l.useState(!0),[n,s]=l.useState(!1),[o,b]=l.useState(!1),[p,h]=l.useState(!1),f=$(),u=P(),j=G();l.useEffect(()=>{g(!0),Promise.all([A(),D()]).then(([r,Y])=>{i(r),x(_(r,a)),s(Y.includes(a))}).catch(r=>{console.error("Load error:",r)}).finally(()=>{g(!1)})},[a]),l.useEffect(()=>{if(!p)return;const r=()=>h(!1);return document.addEventListener("click",r),()=>document.removeEventListener("click",r)},[p]);const N=l.useCallback(async()=>{if(n){if(!await j({title:`${a}年度の締め処理を解除しますか?`,message:"経費データの編集・削除が再び可能になります。",variant:"danger",confirmLabel:"締め解除"}))return;b(!0);try{await M(a),s(!1)}catch(r){console.error("年度ロック解除エラー:",r),u.error("年度ロック解除に失敗しました")}finally{b(!1)}}else{if(!await j({title:`${a}年度の締め処理を行いますか?`,message:"この年度の経費データは編集・削除できなくなります。",confirmLabel:"年度締め"}))return;b(!0);try{await R(a),s(!0)}catch(r){console.error("年度締めエラー:",r),u.error("年度締めに失敗しました")}finally{b(!1)}}},[n,a,j,u]),y=c.filter(r=>r.fiscalYear===a),S=l.useCallback(()=>{K(y,a),h(!1)},[y,a]),L=l.useCallback(()=>{O(y,a),h(!1)},[y,a]);if(m)return e.jsx(B,{});if(!t)return null;const v=se(c,a),T=v.some(r=>r.revenue>0||r.expense>0);return e.jsxs("div",{className:"p-6",children:[e.jsxs("div",{className:"flex items-center gap-4 mb-4 border-b dark:border-gray-700 pb-3",children:[e.jsx("button",{className:"text-sm font-bold text-emerald-600 dark:text-emerald-400 border-b-2 border-emerald-500 pb-1",children:"会計処理"}),e.jsx("button",{onClick:()=>f("/reports"),className:"text-sm text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 pb-1",children:"報告書作成"}),e.jsx("button",{onClick:()=>f("/documents"),className:"text-sm text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 pb-1",children:"帳票管理"})]}),n&&e.jsxs("div",{className:"bg-amber-50 dark:bg-amber-900/30 border border-amber-200 dark:border-amber-800 rounded-xl p-3 mb-4 flex items-center justify-between print:hidden",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(C,{className:"w-5 h-5 text-amber-600 dark:text-amber-400"}),e.jsx("p",{className:"text-sm text-amber-700 dark:text-amber-400 font-medium",children:"この年度は締め処理済みです"})]}),e.jsx("button",{onClick:N,disabled:o,className:"text-xs px-3 py-1.5 bg-amber-100 dark:bg-amber-900/50 text-amber-700 dark:text-amber-400 rounded-lg hover:bg-amber-200 dark:hover:bg-amber-900/70 transition-colors font-medium disabled:opacity-50",children:o?"処理中...":"締め解除"})]}),e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h2",{className:"text-xl font-bold dark:text-gray-100",children:"会計処理"}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("select",{value:a,onChange:r=>k(Number(r.target.value)),className:"px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg text-sm dark:bg-gray-800 dark:text-gray-200",children:z(5).map(r=>e.jsxs("option",{value:r,children:[r,"年度"]},r))}),e.jsxs("button",{onClick:N,disabled:o,className:`px-4 py-2 text-sm rounded-lg transition-colors print:hidden flex items-center gap-1.5 disabled:opacity-50 ${n?"bg-amber-100 dar
1k:bg-amber-900/30 text-amber-700 dark:text-amber-400 hover:bg-amber-200 dark:hover:bg-amber-900/50":"bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-200 hover:bg-gray-200 dark:hover:bg-gray-600"}`,children:[n?e.jsx(C,{className:"w-4 h-4"}):e.jsx(re,{className:"w-4 h-4"}),o?"処理中...":n?"締め済":"年度締め"]}),e.jsxs("div",{className:"relative print:hidden",children:[e.jsxs("button",{onClick:r=>{r.stopPropagation(),h(!p)},className:"px-4 py-2 bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-200 text-sm rounded-lg hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors flex items-center gap-1.5",children:[e.jsx(V,{className:"w-4 h-4"}),"エクスポート",e.jsx(X,{className:"w-3 h-3"})]}),p&&e.jsxs("div",{className:"absolute right-0 top-full mt-1 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg dark:shadow-black/30 z-10 min-w-[180px]",children:[e.jsx("button",{onClick:S,className:"w-full text-left px-4 py-2.5 text-sm text-gray-700 dark:text-gray-200 hover:bg-gray-50 dark:hover:bg-gray-700 rounded-t-lg transition-colors",children:"CSV出力"}),e.jsx("button",{onClick:L,className:"w-full text-left px-4 py-2.5 text-sm text-gray-700 dark:text-gray-200 hover:bg-gray-50 dark:hover:bg-gray-700 rounded-b-lg transition-colors",children:"弥生会計形式"})]})]}),e.jsx("button",{onClick:()=>window.print(),className:"px-4 py-2 bg-teal-600 text-white text-sm rounded-lg hover:bg-teal-700 transition-colors print:hidden",children:"印刷"})]})]}),e.jsx(I,{activeTab:"activity"}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3 sm:gap-4 mb-6 print:hidden",children:[e.jsxs("div",{className:"bg-white dark:bg-gray-900 p-5 rounded-xl shadow-sm dark:shadow-black/20 border-l-4 border-green-400",children:[e.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"経常収益計"}),e.jsx("p",{className:"text-2xl font-bold text-green-600 dark:text-green-400",children:d(t.revenueTotal)})]}),e.jsxs("div",{className:"bg-white dark:bg-gray-900 p-5 rounded-xl shadow-sm dark:shadow-black/20 border-l-4 border-orange-400",children:[e.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"経常費用計"}),e.jsx("p",{className:"text-2xl font-bold text-orange-600 dark:text-orange-400",children:d(t.expenseTotal)}),e.jsxs("p",{className:"text-xs text-gray-400 mt-1",children:["事業費 ",d(t.projectExpenseTotal)," / 管理費 ",d(t.adminExpenseTotal)]})]}),e.jsxs("div",{className:"bg-white dark:bg-gray-900 p-5 rounded-xl shadow-sm dark:shadow-black/20 border-l-4 border-teal-400",children:[e.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"当期正味財産増減額"}),e.jsx("p",{className:`text-2xl font-bold ${t.netResult>=0?"text-teal-600 dark:text-teal-400":"text-red-500 dark:text-red-400"}`,children:d(t.netResult)})]})]}),T&&e.jsxs("div",{className:"bg-white dark:bg-gray-900 p-5 rounded-xl shadow-sm dark:shadow-black/20 mb-6 print:hidden",children:[e.jsx("h3",{className:"text-sm font-bold mb-4 dark:text-gray-100",children:"月別 収益・費用 推移"}),e.jsx(H,{width:"100%",height:280,children:e.jsxs(W,{data:v,children:[e.jsx(q,{strokeDasharray:"3 3"}),e.jsx(J,{dataKey:"label",fontSize:12}),e.jsx(Q,{fontSize:11,tickFormatter:r=>r>=1e3?`Â¥${(r/1e3).toFixed(0)}k`:`Â¥${r}`}),e.jsx(U,{formatter:r=>d(Number(r))}),e.jsx(Z,{}),e.jsx(w,{dataKey:"revenue",name:"収益",fill:"#10B981",radius:[4,4,0,0]}),e.jsx(w,{dataKey:"expense",name:"費用",fill:"#F59E0B",radius:[4,4,0,0]})]})})]}),e.jsxs("div",{className:"bg-white dark:bg-gray-900 rounded-xl shadow-sm dark:shadow-black/20 overflow-hidden",children:[e.jsxs("div",{className:"px-6 py-4 border-b dark:border-gray-700 bg-gray-50 dark:bg-gray-800",children:[e.jsx("h3",{className:"text-center font-bold dark:text-gray-100",children:"活動計算書"}),e.jsxs("p",{className:"text-center text-xs text-gray-500 dark:text-gray-400 mt-1",children:[a,"å¹´4月1日から",a+1,"å¹´3月31日まで"]}),e.jsx("p",{className:"text-center text-xs text-gray-500 dark:text-gray-400",children:"特定非営利活動法人 mie"})]}),e.jsx("div",{className:"overflow-x-auto print:overflow-visible",children:e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{className:"bg-gray-50 dark:bg-gray-800 border-b dark:border-gray-700",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-6 py-3 text-left text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider w-2/3",children:"科目"}),e.jsx("th",{className:"px-6 py-3 text-right text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"金額"})]})}),e.jsxs("tbody",{children:[e.jsx("tr",{className:"bg-green-50 dark:bg-green-900/30 border-b dark:border-gray-700",children:e.jsx("td",{className:"px-6 py-2.5 text-sm font-bold dark:text-gray-100",colSpan:2,children:"I. 経常収益"})}),t.revenues.map(r=>e.jsxs("tr",{className:"border-b dark:border-gray-700",children:[e.jsx("td",{className:"px-6 py-2 text-sm pl-10 dark:text-gray-200",children:r.account}),e.jsx("td",{className:"px-6 py-2 text-sm text-right dark:text-gray-200",children:d(r.amount)})]},r.account)),t.revenues.length===0&&e.jsx("tr",{className:"border-b dark:border-gray-700",children:e.jsx("td",{className:"px-6 py-2 text-sm pl-10 text-gray-400 dark:text-gray-500",colSpan:2,children:"(データã
1ªã—)"})}),e.jsxs("tr",{className:"border-b dark:border-gray-700 bg-gray-50 dark:bg-gray-800",children:[e.jsx("td",{className:"px-6 py-2 text-sm font-medium pl-10 dark:text-gray-200",children:"経常収益計"}),e.jsx("td",{className:"px-6 py-2 text-sm text-right font-bold text-green-600 dark:text-green-400",children:d(t.revenueTotal)})]}),e.jsx("tr",{className:"bg-orange-50 dark:bg-orange-900/30 border-b dark:border-gray-700",children:e.jsx("td",{className:"px-6 py-2.5 text-sm font-bold dark:text-gray-100",colSpan:2,children:"II. 経常費用"})}),e.jsx("tr",{className:"border-b dark:border-gray-700",children:e.jsx("td",{className:"px-6 py-2 text-sm font-medium pl-6 dark:text-gray-200",colSpan:2,children:"(1) 事業費"})}),t.projectExpenses.map(r=>e.jsxs("tr",{className:"border-b dark:border-gray-700",children:[e.jsx("td",{className:"px-6 py-2 text-sm pl-14 dark:text-gray-200",children:r.account}),e.jsx("td",{className:"px-6 py-2 text-sm text-right dark:text-gray-200",children:d(r.amount)})]},`proj-${r.account}`)),t.projectExpenses.length===0&&e.jsx("tr",{className:"border-b dark:border-gray-700",children:e.jsx("td",{className:"px-6 py-2 text-sm pl-14 text-gray-400 dark:text-gray-500",colSpan:2,children:"(データなし)"})}),e.jsxs("tr",{className:"border-b dark:border-gray-700 bg-gray-50 dark:bg-gray-800",children:[e.jsx("td",{className:"px-6 py-2 text-sm font-medium pl-14 dark:text-gray-200",children:"事業費計"}),e.jsx("td",{className:"px-6 py-2 text-sm text-right font-medium dark:text-gray-200",children:d(t.projectExpenseTotal)})]}),e.jsx("tr",{className:"border-b dark:border-gray-700",children:e.jsx("td",{className:"px-6 py-2 text-sm font-medium pl-6 dark:text-gray-200",colSpan:2,children:"(2) 管理費"})}),t.adminExpenses.map(r=>e.jsxs("tr",{className:"border-b dark:border-gray-700",children:[e.jsx("td",{className:"px-6 py-2 text-sm pl-14 dark:text-gray-200",children:r.account}),e.jsx("td",{className:"px-6 py-2 text-sm text-right dark:text-gray-200",children:d(r.amount)})]},`admin-${r.account}`)),t.adminExpenses.length===0&&e.jsx("tr",{className:"border-b dark:border-gray-700",children:e.jsx("td",{className:"px-6 py-2 text-sm pl-14 text-gray-400 dark:text-gray-500",colSpan:2,children:"(データなし)"})}),e.jsxs("tr",{className:"border-b dark:border-gray-700 bg-gray-50 dark:bg-gray-800",children:[e.jsx("td",{className:"px-6 py-2 text-sm font-medium pl-14 dark:text-gray-200",children:"管理費計"}),e.jsx("td",{className:"px-6 py-2 text-sm text-right font-medium dark:text-gray-200",children:d(t.adminExpenseTotal)})]}),e.jsxs("tr",{className:"border-b dark:border-gray-700 bg-gray-50 dark:bg-gray-800",children:[e.jsx("td",{className:"px-6 py-2 text-sm font-bold pl-10 dark:text-gray-200",children:"経常費用計"}),e.jsx("td",{className:"px-6 py-2 text-sm text-right font-bold text-orange-600 dark:text-orange-400",children:d(t.expenseTotal)})]}),e.jsxs("tr",{className:"bg-teal-50 dark:bg-teal-900/30",children:[e.jsx("td",{className:"px-6 py-3 text-sm font-bold dark:text-gray-100",children:"当期正味財産増減額"}),e.jsx("td",{className:`px-6 py-3 text-right font-bold text-lg ${t.netResult>=0?"text-teal-600 dark:text-teal-400":"text-red-500 dark:text-red-400"}`,children:d(t.netResult)})]})]})]})})]})]})}export{ke as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.