1import{j as e}from"./react-core-ZGhOPDd5.js";import{p as f,D as y,P as u,V as a,T as i,S as h}from"./react-pdf.browser-C8ZhObPp.js";import{t as p}from"./download-BHJoYDNy.js";import{f as m}from"./format-B-QH9N9f.js";import{p as g}from"./earnings-statement-BwbYuhRZ.js";import"./shared-helpers-D8lIdaSv.js";import"./vendor-shims-ByMe_QYM.js";import"./index-jnvzK_7p.js";import"./index-BgRTQ_eR.js";import"./tslib.es6-DjMk01cD.js";import"./index-CZ36gMAR.js";import"./tanstack-dB9xAWBZ.js";import"./AppShell-B8I90HAH.js";import"./input-DBMgEmbF.js";import"./index-DqWgkrFD.js";import"./dialog-D4Fq1OA3.js";import"./scroll-area-BTJ_7iS_.js";import"./LanguageToggle-9018_v7W.js";import"./JANAVAIDYA_new_final_Logo_1779194409565-Doc7Imxs.js";import"./search-B563jJHb.js";import"./chevron-down-CZsbgAZw.js";import"./phone-D3p2G-rs.js";import"./card-k1bLNfyd.js";import"./skeleton-CHS8OfYw.js";import"./arrow-left-C1nz5QsC.js";import"./file-text-CP3ZBUPB.js";function c(o){return`â¹${o.toLocaleString("en-IN")}`}function s(o){if(!o)return"â";try{return m(g(o),"dd MMM yyyy")}catch{return o}}function x(o){switch(o){case"sent":return"Sent";case"processing":return"Processing";case"awaiting_bank_details":return"Awaiting Bank Details";case"failed":return"Failed";default:return o}}const t=h.create({page:{fontFamily:"Helvetica",fontSize:9,padding:36,color:"#1a1a1a"},header:{marginBottom:20},brand:{fontSize:18,fontFamily:"Helvetica-Bold",color:"#de435c",marginBottom:2},subtitle:{fontSize:10,color:"#6b7280",marginBottom:4},periodLabel:{fontSize:13,fontFamily:"Helvetica-Bold",marginBottom:2},dateRange:{fontSize:9,color:"#6b7280"},divider:{borderBottomWidth:1,borderColor:"#e5e7eb",marginVertical:12},summaryRow:{flexDirection:"row",gap:12,marginBottom:16},summaryCard:{flex:1,backgroundColor:"#f9fafb",borderRadius:6,padding:10},summaryLabel:{fontSize:8,color:"#6b7280",marginBottom:3,textTransform:"uppercase"},summaryValue:{fontSize:13,fontFamily:"Helvetica-Bold"},sectionTitle:{fontSize:10,fontFamily:"Helvetica-Bold",marginBottom:8,color:"#374151"},tableHeader:{flexDirection:"row",backgroundColor:"#f3f4f6",borderRadius:4,padding:"6 8",marginBottom:2},tableRow:{flexDirection:"row",padding:"5 8",borderBottomWidth:1,borderColor:"#f3f4f6"},tableRowAlt:{flexDirection:"row",padding:"5 8",backgroundColor:"#fafafa",borderBottomWidth:1,borderColor:"#f3f4f6"},colDate:{width:"11%",fontSize:8},colRef:{width:"10%",fontSize:8},colPatient:{width:"16%",fontSize:8},colFee:{width:"10%",fontSize:8,textAlign:"right"},colExtras:{width:"10%",fontSize:8,textAlign:"right"},colTotal:{width:"11%",fontSize:8,textAlign:"right"},colDiscount:{width:"10%",fontSize:8,textAlign:"right",color:"#b8791c"},colPF:{width:"11%",fontSize:8,textAlign:"right"},colGst:{width:"10%",fontSize:8,textAlign:"right"},colNet:{width:"12%",fontSize:8,textAlign:"right",fontFamily:"Helvetica-Bold"},payoutCard:{backgroundColor:"#f0fdf4",borderRadius:6,padding:10,marginTop:16},payoutRow:{flexDirection:"row",padding:"4 0",borderBottomWidth:1,borderColor:"#d1fae5"},note:{fontSize:7.5,color:"#9ca3af",marginTop:20},bold:{fontFamily:"Helvetica-Bold"}});function b({detail:o,doctorName:d,isOrgEmployed:l=!1}){return e.jsx(y,{children:e.jsxs(u,{size:"A4",orientation:"landscape",style:t.page,children:[e.jsxs(a,{style:t.header,children:[e.jsx(i,{style:t.brand,children:"JanaVaidya"}),e.jsxs(i,{style:t.subtitle,children:["Earnings Statement · ",d]}),e.jsx(i,{style:t.periodLabel,children:o.period_label}),o.date_range&&e.jsxs(i,{style:t.dateRange,children:[s(o.date_range.from)," â ",s(o.date_range.to)]})]}),e.jsx(a,{style:t.summaryRow,children:[{label:"Total Visits",value:String(o.summary.visits)},{label:l?"Total Billed":"Total Earnings",value:c(o.summary.gross)},...o.summary.discount_total>0?[{label:"Discounts Given",value:c(o.summary.discount_total)}]:[]].map(r=>e.jsxs(a,{style:t.summaryCard,children:[e.jsx(i,{style:t.summaryLabel,children:r.label}),e.jsx(i,{style:t.summaryValue,children:r.value})]},r.label))}),e.jsx(a,{style:t.divider}),e.jsx(i,{style:t.sectionTitle,children:"Visit Breakdown"}),e.jsx(a,{style:t.tableHeader,children:[[t.colDate,"Date"],[t.colRef,"Ref"],[t.colPatient,"Patient"],[t.colFee,"Consult (â¹)"],[t.colExtras,"Extras (â¹)"],[t.colDiscount,"Discount (â¹)"],[t.colNet,l?"Billed (â¹)":"You Kept (â¹)"]].map(([r,n])=>e.jsx(i,{style:[r,{fontFamily:"Helvetica-Bold",fontSize:7.5,color:"#374151"}],children:n},n))}),o.visits.length===0&&e.jsx(i,{style:{fontSize:8,color:"#9ca3af",padding:"8 8"},children:"No completed visits in this period."}),o.visits.map((r,n)=>e.jsxs(a,{style:n%2===0?t.tableRow:t.tableRowAlt,children:[e.jsx(i,{style:t.colDate,children:s(r.date)}),e.jsx(i,{style:t.colRef,children:r.booking_ref??"â"}),e.jsx(i,{style:t.colPatient,children:r.patient_name}),e.jsx(i,{style:t.colFee,children:r.consultation_fee}),e.jsx(i,{style:t.colExtras,children:r.extras_total+(r.surcharge_total??0)||"â"}),e.jsx(i,{style:t.colDiscount,children:r.discount_amount>0?`-${r.discount_amount}`:"â"}),e.jsx(i,{style:[t.colNet,t.bold],children:l?r.total_billed:r.net_earned})]},n)),o.payouts.length>0&&e.jsxs(a,{style:t.payoutCard,children:[e.jsx(i,{style:[t.sectionTitle,{marginBottom:6}],children:"Payouts in This Period"}),o.payouts.map((r,n)=>e.jsxs(a,{style:t.payoutRow,children:[e.jsx(i,{style:{width:"18%",fontSize:8},children:s(r.date)||"â"}),e.jsx(i,{style:{width:"20%",fontSize:8,fontFamily:"Helvetica-Bold"},children:c(r.amount)}),e.jsx(i,{style:{width:"25%",fontSize:8,color:"#6b7280"},children:r.reference??"â"}),e.jsx(i,{style:{width:"15%",fontSize:8},children:x(r.status)}),e.jsx(i,{style:{width:"22%",fontSize:7.5,color:"#6b7280"},children:r.cycle_period??""})]},n))]}),e.jsxs(i,{style:t.note,children:[l?"* Patient payments for your visits are settled by your organisation, which also covers your JanaVaidya subscription.":"* You keep 100% of every patient visit. JanaVaidya only charges a flat monthly subscription (shown on your Finance page).",` 2`,"Generated by JanaVaidya on ",m(new Date,"dd MMM yyyy, hh:mm a")]})]})})}async function $(o){const d=await f(e.jsx(b,{detail:o.detail,doctorName:o.doctorName,isOrgEmployed:o.isOrgEmployed})).toBlob();await p(d,o.filename)}export{$ as downloadEarningsStatementPdf};
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.