PageSourceSearch

https://seodoon-church-admin.web.app/assets/DonationReceiptPage-Bt1QMPW6.js

js seodoon-church-admin.web.app collected 2026-10-03 12:37:31 UTC 17,756 bytes, 1 lines download raw bytes

1import{j as e,u as c,w as O}from"./vendor-data-Z5doMMu-.js";import{r}from"./vendor-react-zNM0AU50.js";import{u as ae}from"./index-D1K3lVhu.js";import{d as x}from"./donationReceiptService-CQSRXCTG.js";import{z as i,I as le,R as v,bR as re,x as Y,g as ne,A as z,aL as ce,ax as ie,ad as de,f as oe,D as H,U as xe}from"./vendor-ui-CW5bJ11U.js";import"./vendor-firebase-Da9KY1q_.js";import"./vendor-charts-08G1rM8P.js";function w(C){return new Intl.NumberFormat("ko-KR").format(C)}function fe({embedded:C=!1}){const{user:S}=ae(),o=(S==null?void 0:S.churchId)||"seodoon-church",[d,U]=r.useState(new Date().getFullYear().toString()),[M,R]=r.useState(!1),[A,B]=r.useState([]),[p,T]=r.useState([]),[m,G]=r.useState(""),[_,F]=r.useState(null),[D,$]=r.useState(null),[h,J]=r.useState(null),[b,L]=r.useState("consent"),[N,K]=r.useState("all"),[f,y]=r.useState(!1),P=`hometaxOrgInfo_${o}`,[n,X]=r.useState(()=>{try{const s=localStorage.getItem(`hometaxOrgInfo_${o}`);if(s)return JSON.parse(s)}catch{}return{businessNumber:"",orgName:"서둔교회",managerName:"",managerTel:"",orgCode:"405"}}),g=s=>{const t={...n,...s};X(t);try{localStorage.setItem(P,JSON.stringify(t))}catch{}},W=Array.from({length:5},(s,t)=>(new Date().getFullYear()-t).toString());r.useEffect(()=>{k()},[d]),r.useEffect(()=>{let s=A;if(N==="consented"?s=s.filter(t=>t.hasConsent&&t.hasResidentNumber):N==="notConsented"&&(s=s.filter(t=>!t.hasConsent||!t.hasResidentNumber)),m.trim()){const t=m.toLowerCase();s=s.filter(a=>a.memberName.toLowerCase().includes(t))}T(s)},[m,A,N]);const k=async()=>{try{R(!0);const[s,t]=await Promise.all([x.getDonorsWithConsentStatus(o,d),x.getConsentStats(o,d)]);B(s),T(s),J(t)}catch(s){console.error("데이터 로드 실패:",s),i.error("데이터를 불러올 수 없습니다")}finally{R(!1)}},q=async(s,t)=>{try{await x.updateDonationConsent(s,t),i.success(t?"동의 등록 완료":"동의 해제 완료"),await k()}catch(a){console.error("동의 업데이트 실패:",a),i.error("동의 등록에 실패했습니다")}},Q=async s=>{if(_===s){F(null),$(null);return}F(s);try{const t=await x.getAnnualDonationSummary(o,s,d);$(t)}catch(t){console.error("상세 내역 조회 실패:",t)}},V=async()=>{try{y(!0);const{data:s,excluded:t}=await x.generateHometaxData(o,d,n.orgCode||"405");if(s.length===0){i.error("내보낼 데이터가 없습니다. 동의 완료된 헌금자가 있는지 확인해주세요.");return}const a=c.book_new(),se=[["국세청 전자기부금영수증 일괄발급 - 기본정보"],[],["사업자등록번호(고유번호)",n.businessNumber],["발급기관명칭",n.orgName],["담당자 성명",n.managerName],["담당자 연락처",n.managerTel],["기부금단체코드",n.orgCode||"405"],[],["※ 홈택스 「전자기부금영수증 > 일괄발급」의 공식 엑셀서식을 내려받아,"],["   본 파일의 「41 종교단체일반(지정)」 시트 데이터를 붙여넣어 제출하세요."],["※ 주민등록번호·기부일자 셀은 반드시 텍스트(TEXT) 형식을 유지해야 합니다."]];c.book_append_sheet(a,c.aoa_to_sheet(se),"기본정보");const te=[["기부내용","41 : 종교단체일반(지정)기부금"],["신청구분코드","주민등록번호","성명","기부내용구분","관리번호","기부금단체코드","기부일자","기부금액합계","공제대상 기부금액","기부장려금 신청금액"],...s.map(l=>[l.신청구분코드,l.주민등록번호,l.성명,l.기부내용구분,l.관리번호,l.기부금단체코드,l.기부일자,l.기부금액합계,l.공제대상금액,l.기부장려금])],I=c.aoa_to_sheet(te);for(let l=0;l<s.length;l++){const u=l+3,j=I[`B${u}`];j&&(j.t="s",j.z="@");const E=I[`G${u}`];E&&(E.t="s",E.z="@")}if(c.book_append_sheet(a,I,"41 종교단체일반(지정)"),t.length>0){const l=c.json_to_sheet(t.map((u,j)=>({순번:j+1,성명:u.name,제외사유:u.reason})));c.book_append_sheet(a,l,"제외대상")}O(a,`홈택스_종교단체_기부금_${d}.xlsx`),i.success(`${s.length}건 내보내기 완료`),t.length>0&&i(`${t.length}명이 제외되었습니다 (제외대상 시트 참조)`,{icon:"⚠️"})}catch(s){console.error("엑셀 내보내기 실패:",s),i.error("엑셀 내보내기에 실패했습니다")}finally{y(!1)}},Z=async()=>{try{y(!0);const{data:s}=await x.generateAnnualSummaryData(o,d);if(s.length===0){i.error("내보낼 데이터가 없습니다");return}const t=c.json_to_sheet(s),a=c.book_new();c.book_append_sheet(a,t,"헌금현황"),O(a,`헌금현황_${d}.xlsx`),i.success("내보내기 완료")}catch(s){console.error("엑셀 내보내기 실패:",s),i.error("엑셀 내보내기에 실패했습니다")}finally{y(!1)}},ee=p.reduce((s,t)=>s+t.totalAmount,0);return e.jsxs("div",{className:"p-6",children:[!C&&e.jsxs("div",{className:"mb-6",children:[e.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:"전자기부금영수증"}),e.jsx("p",{className:"text-sm text-gray-500 mt-1",children:"개인정보제공동의 관리 및 홈택스 업로드 데이터 생성"})]}),e.jsx("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4 mb-6",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(le,{className:"w-5 h-5 text-blue-600 flex-shrink-0 mt-0.5"}),e.jsxs("div",{className:"text-sm text-blue-800",children:[e.jsx("p",{className:"font-medium mb-2",children:"2025년 전자기부금영수증 의무발급 안내"}),e.jsxs("ul",{className:"list-disc list-inside space-y-1 text-blue-700",children:[e.jsxs("li",{children:["2025년부터 모든 기부금영수증은 ",e.jsx("strong",{children:"홈택스를 통해 전자 발급"}),"됩니다"]}),e.jsxs("li",{children:[e.jsx("strong",{children:"개인정보제공동의서"}),"를 제출한 교인만 영수증이 발급됩니다"]}),e.jsx("li",{children:"1인 1신청서 필수, 14세 미만은 법정대리인 동의 필요"}),e.jsx("li",{children:"종이 영수증 발급 불가 - 홈택스에서 조회/인쇄 가능"})]})]})]})}),e.jsx("div",{className:"bg-white rounded-lg shadow-sm border p-4 mb-6",children:e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-gray-500 mb-1",children:"귀속연도"}),e.jsx("select",{value:d,onChange:s=>U(s.target.value),className:"px-3 py-2 border rounded-lg text-sm focus:ring-2 focus:ring-blue-500",children:W.map(s=>e.jsxs("option",{value:s,children:[s,"년"]},s))})]}),e.jsxs("button",{onClick:k,className:"px-3 py-2 text-sm text-gray-600 hover:bg-gray-100 rounded-lg flex items-center gap-1",children:[e.jsx(v,{className:"w-4 h-4"}),"새로고침"]})]}),h&&e.jsxs("div",{className:"flex items-center gap-6 text-sm",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"text-gray-500",children:"전체 헌금자"}),e.jsxs("div",{className:"text-xl font-bold text-gray-900",children:[h.total,"명"]})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"text-gray-500",children:"동의 완료"}),e.jsxs("div",{className:"text-xl font-bold text-green-600",children:[h.consented,"명"]})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"text-gray-500",children:"미동의"}),e.jsxs("div",{className:"text-xl font-bold text-red-600",children:[h.notConsented,"명"]})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"text-gray-500",children:"주민번호 미등록"}),e.jsxs("div",{className:"text-xl font-bold text-yellow-600",children:[h.noResidentNumber,"명"]})]})]})]})}),e.jsxs("div",{className:"flex border-b mb-4",children:[e.jsxs("button",{onClick:()=>L("consent"),className:`px-4 py-2 text-sm font-medium border-b-2 -mb-px ${b==="consent"?"border-blue-500 text-blue-600":"border-transparent text-gray-500 hover:text-gray-700"}`,children:[e.jsx(re,{className:"w-4 h-4 inline mr-1"}),"동의 관리"]}),e.jsxs("button",{onClick:()=>L("export"),className:`px-4 py-2 text-sm font-medium border-b-2 -mb-px ${b==="export"?"border-blue-500 text-blue-600":"border-transparent text-gray-500 hover:text-gray-700"}`,children:[e.jsx(Y,{className:"w-4 h-4 inline mr-1"}),"엑셀 내보내기"]})]}),b==="consent"&&e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border",children:[e.jsxs("div",{className:"p-4 border-b flex flex-wrap items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{className:"relative",children:[e.jsx(ne,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-gray-400 w-4 h-4"}),e.jsx("input",{type:"text",placeholder:"이름 검색...",value:m,onChange:s=>G(s.target.value),className:"w-64 pl-9 pr-4 py-2 border rounded-lg text-sm focus:ring-2 focus:ring-blue-500"})]}),e.jsxs("select",{value:N,onChange:s=>K(s.target.value),className:"px-3 py-2 border rounded-lg text-sm",children:[e.jsx("option",{value:"all",children:"전체"}),e.jsx("option",{value:"consented",children:"동의 완료"}),e.jsx("option",{value:"notConsented",children:"미동의/미등록"})]})]}),e.jsxs("div",{className:"text-sm text-gray-500",children:["총 ",p.length,"명 / 헌금액 ",e.jsx("span",{className:"fin-num",children:w(ee)}),"원"]})]}),M?e.jsxs("div",{className:"p-8 text-center text-gray-500",children:[e.jsx(v,{className:"w-6 h-6 animate-spin mx-auto mb-2"}),"로딩 중..."]}):p.length===0?e.jsxs("div",{className:"p-8 text-center text-gray-500",children:[e.jsx(z,{className:"w-8 h-8 mx-auto mb-2 text-gray-400"}
1),m?"검색 결과가 없습니다":"헌금 내역이 없습니다"]}):e.jsx("div",{className:"divide-y",children:p.map(s=>e.jsxs("div",{className:"hover:bg-gray-50",children:[e.jsxs("div",{className:"p-4 flex items-center gap-4",children:[e.jsx("div",{className:"flex-shrink-0",children:s.hasConsent&&s.hasResidentNumber?e.jsx("div",{className:"w-10 h-10 bg-green-100 rounded-full flex items-center justify-center",children:e.jsx(ce,{className:"w-5 h-5 text-green-600"})}):e.jsx("div",{className:"w-10 h-10 bg-red-100 rounded-full flex items-center justify-center",children:e.jsx(ie,{className:"w-5 h-5 text-red-500"})})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"font-medium text-gray-900",children:s.memberName}),e.jsxs("div",{className:"text-sm text-gray-500 flex items-center gap-2",children:[e.jsxs("span",{children:[s.donationCount,"회 헌금"]}),s.hasConsent?e.jsx("span",{className:"text-green-600",children:"동의완료"}):e.jsx("span",{className:"text-red-500",children:"미동의"}),s.hasConsent&&!s.hasResidentNumber&&e.jsx("span",{className:"text-yellow-600",children:"주민번호 미등록"})]})]}),e.jsxs("div",{className:"text-right",children:[e.jsxs("div",{className:"font-bold text-gray-900 fin-num",children:[w(s.totalAmount),"원"]}),s.consentDate&&e.jsxs("div",{className:"text-xs text-gray-500",children:["동의일: ",s.consentDate]})]}),e.jsx("button",{onClick:()=>q(s.memberId,!s.hasConsent),className:`px-3 py-1.5 text-xs rounded-lg ${s.hasConsent?"bg-gray-100 text-gray-600 hover:bg-gray-200":"bg-blue-600 text-white hover:bg-blue-700"}`,children:s.hasConsent?"동의해제":"동의등록"}),e.jsx("button",{onClick:()=>Q(s.memberId),className:"p-2 text-gray-400 hover:text-gray-600 rounded",children:_===s.memberId?e.jsx(de,{className:"w-5 h-5"}):e.jsx(oe,{className:"w-5 h-5"})})]}),_===s.memberId&&D&&e.jsx("div",{className:"px-4 pb-4 pt-0",children:e.jsxs("div",{className:"bg-gray-50 rounded-lg p-4",children:[e.jsxs("div",{className:"mb-4",children:[e.jsx("div",{className:"text-xs font-medium text-gray-500 mb-2",children:"헌금 유형별 합계"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:Object.entries(D.byType).map(([t,a])=>e.jsxs("span",{className:"px-2 py-1 bg-white rounded text-xs",children:[t,": ",e.jsx("span",{className:"fin-num",children:w(a)}),"원"]},t))})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs font-medium text-gray-500 mb-2",children:"월별 내역"}),e.jsx("div",{className:"grid grid-cols-4 md:grid-cols-6 gap-2 text-xs",children:Object.entries(D.byMonth).sort(([t],[a])=>t.localeCompare(a)).map(([t,a])=>e.jsxs("div",{className:"bg-white rounded p-2 text-center",children:[e.jsxs("div",{className:"text-gray-500",children:[t.substring(5),"월"]}),e.jsx("div",{className:"font-medium fin-num",children:w(a)})]},t))})]})]})})]},s.memberId))})]}),b==="export"&&e.jsx("div",{className:"bg-white rounded-lg shadow-sm border p-6",children:e.jsxs("div",{className:"grid md:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"border rounded-lg p-6",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsx("div",{className:"w-12 h-12 bg-green-100 rounded-lg flex items-center justify-center",children:e.jsx(Y,{className:"w-6 h-6 text-green-600"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-bold text-gray-900",children:"홈택스 업로드용"}),e.jsx("p",{className:"text-sm text-gray-500",children:"전자기부금영수증 일괄발급용"})]})]}),e.jsxs("div",{className:"text-sm text-gray-600 mb-4",children:[e.jsx("p",{className:"mb-2",children:"「41 종교단체일반(지정)」 시트 컬럼:"}),e.jsxs("ul",{className:"list-disc list-inside space-y-1 text-gray-500",children:[e.jsx("li",{children:"신청구분코드(01)·주민등록번호·성명"}),e.jsx("li",{children:"기부내용구분(1 금전)·관리번호"}),e.jsx("li",{children:"기부금단체코드·기부일자(YYYYMMDD)"}),e.jsx("li",{children:"기부금액합계·공제대상·기부장려금"})]})]}),e.jsxs("div",{className:"border rounded-lg p-3 mb-4 bg-gray-50 space-y-2",children:[e.jsx("p",{className:"text-xs font-semibold text-gray-700",children:"발급기관 단체정보 (기본정보 시트)"}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsx("input",{type:"text",value:n.businessNumber,onChange:s=>g({businessNumber:s.target.value}),placeholder:"사업자(고유)번호",className:"px-2 py-1.5 border rounded text-sm"}),e.jsx("input",{type:"text",value:n.orgName,onChange:s=>g({orgName:s.target.value}),placeholder:"발급기관명칭",className:"px-2 py-1.5 border rounded text-sm"}),e.jsx("input",{type:"text",value:n.managerName,onChange:s=>g({managerName:s.target.value}),placeholder:"담당자 성명",className:"px-2 py-1.5 border rounded text-sm"}),e.jsx("input",{type:"text",value:n.managerTel,onChange:s=>g({managerTel:s.target.value}),placeholder:"담당자 연락처",className:"px-2 py-1.5 border rounded text-sm"}),e.jsx("input",{type:"text",value:n.orgCode,onChange:s=>g({orgCode:s.target.value}),placeholder:"기부금단체코드(종교=405)",className:"px-2 py-1.5 border rounded text-sm col-span-2"})]})]}),e.jsxs("div",{className:"bg-yellow-50 rounded p-3 mb-4 text-sm text-yellow-800",children:[e.jsx("strong",{children:"주의:"}
1)," 개인정보동의 완료 + 주민등록번호 등록된 교인만 포함됩니다. 주민번호·기부일자는 텍스트 형식으로 생성됩니다."]}),e.jsx("button",{onClick:V,disabled:f,className:"w-full px-4 py-3 bg-green-600 text-white rounded-lg hover:bg-green-700 disabled:opacity-50 flex items-center justify-center gap-2",children:f?e.jsxs(e.Fragment,{children:[e.jsx(v,{className:"w-4 h-4 animate-spin"}),"내보내는 중..."]}):e.jsxs(e.Fragment,{children:[e.jsx(H,{className:"w-4 h-4"}),"홈택스용 엑셀 다운로드"]})})]}),e.jsxs("div",{className:"border rounded-lg p-6",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsx("div",{className:"w-12 h-12 bg-blue-100 rounded-lg flex items-center justify-center",children:e.jsx(xe,{className:"w-6 h-6 text-blue-600"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-bold text-gray-900",children:"전체 헌금 현황"}),e.jsx("p",{className:"text-sm text-gray-500",children:"동의 여부 포함 전체 목록"})]})]}),e.jsxs("div",{className:"text-sm text-gray-600 mb-4",children:[e.jsx("p",{className:"mb-2",children:"포함 항목:"}),e.jsxs("ul",{className:"list-disc list-inside space-y-1 text-gray-500",children:[e.jsx("li",{children:"기부자 성명"}),e.jsx("li",{children:"주민등록번호 (있는 경우)"}),e.jsx("li",{children:"연간 기부금액"}),e.jsx("li",{children:"기부 횟수"}),e.jsx("li",{children:"동의 여부"})]})]}),e.jsxs("div",{className:"bg-blue-50 rounded p-3 mb-4 text-sm text-blue-800",children:[e.jsx("strong",{children:"용도:"})," 내부 관리용, 동의 미완료자 확인용"]}),e.jsx("button",{onClick:Z,disabled:f,className:"w-full px-4 py-3 bg-blue-600 text-white rounded-lg hover:bg-blue-700 disabled:opacity-50 flex items-center justify-center gap-2",children:f?e.jsxs(e.Fragment,{children:[e.jsx(v,{className:"w-4 h-4 animate-spin"}),"내보내는 중..."]}):e.jsxs(e.Fragment,{children:[e.jsx(H,{className:"w-4 h-4"}),"전체 현황 엑셀 다운로드"]})})]})]})}),e.jsx("div",{className:"mt-6 p-4 bg-gray-50 border rounded-lg",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(z,{className:"w-5 h-5 text-gray-500 flex-shrink-0 mt-0.5"}),e.jsxs("div",{className:"text-sm text-gray-600",children:[e.jsx("p",{className:"font-medium mb-1",children:"업무 절차 안내"}),e.jsxs("ol",{className:"list-decimal list-inside space-y-1",children:[e.jsx("li",{children:"교인에게 개인정보제공동의서 수령"}),e.jsx("li",{children:"동의 관리 탭에서 동의 등록 (주민등록번호 별도 입력 필요)"}),e.jsx("li",{children:"연말 (12월)에 홈택스용 엑셀 다운로드"}),e.jsx("li",{children:"국세청 홈택스에서 전자기부금영수증 일괄 발급"}),e.jsx("li",{children:"연말정산간소화 서비스에 자동 반영 (1월 중순)"})]})]})]})})]})}export{fe as DonationReceiptPage};

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.