import{o as e}from"./rolldown-runtime-GyhWBpbT.js";import{F as t,I as n,L as r,O as i,P as a,s as o}from"./react-vendor-DoSylNpz.js";import{$ as s,Fn as c,Fr as l,Gr as ee,Hr as u,In as d,Kr as f,Ln as p,Mn as m,Nr as h,Rn as g,X as te,Xt as ne,fr as _,h as v,ii as y,ni as b,yr as re,zn as x,zr as ie}from"./mui-vendor-1IGyn9nW.js";import"./state-vendor-bhJgZEQG.js";import{dt as ae,k as S,ot as oe,r as se,s as ce,w as le}from"./index-BD_w4_v3.js";import{t as C}from"./html2canvas-DZsOdvuV.js";import{t as ue}from"./jspdf.es.min-lBH2rfpm.js";var w=e(y(),1),de=e(C(),1),T=e(v(),1),E=b(),D=()=>{let{id:e}=n(),v=t(),y=i(e=>e.auth.user);le(`Print Sales Order`);let b=a(),[C]=r(),D=C.get(`download`)===`pdf`,O=C.get(`print`)===`1`,k=S(y,`download_salesorder`),A=S(y,`print_salesorder`);(0,w.useEffect)(()=>{!k&&!A&&v(`/unauthorized`,{replace:!0})},[k,A,v]);let j=(0,w.useMemo)(()=>b.state?.from||`/sales/orders`,[b.state]),[M,fe]=(0,w.useState)(null),[N,P]=(0,w.useState)(!1),F=(0,w.useRef)(null),{success:I,error:L}=ae(),{data:R,isLoading:z}=o({queryKey:[`salesOrder`,e],queryFn:()=>ce.getById(e),enabled:!!e});(0,w.useEffect)(()=>{console.log(`ordere detaqils`,R)},[R]),(0,w.useEffect)(()=>{(async()=>{if(R?.company)try{fe((await oe.get(`/api/masters/companies/${R.company}/`)).data)}catch{}})()},[R?.company]);let B=!!R?.items?.some(e=>e.hsn_code),V=(R?.applied_schemes||[]).reduce((e,t)=>e+Number(t.discount_amount||0),0),H=!!R?.items?.some(e=>Number(e.discount_amount||0)>0)||V>0,pe=10+Number(B)+Number(H)+1,U=pe>7?`landscape`:`portrait`,me=U===`landscape`?`297mm`:`210mm`,he=R?.items||[],W=e=>he.reduce((t,n)=>t+Number(n?.[e]||0),0),ge=he.reduce((e,t)=>e+Number(t?.rate||0)*Number(t?.quantity||0),0),_e=R?.base_amount===void 0?ge:Number(R.base_amount),G=W(`discount_amount`),ve=R?.discount_amount===void 0?G+V:Number(R.discount_amount),ye=R?.taxable_amount===void 0?Math.max(_e-ve,0):Number(R.taxable_amount),K=R&&R?.cgst_amount!==void 0?Number(R?.cgst_amount):W(`cgst_amount`),q=R&&R?.sgst_amount!==void 0?Number(R?.sgst_amount):W(`sgst_amount`),J=R&&R?.igst_amount!==void 0?Number(R?.igst_amount):W(`igst_amount`),Y=R&&R?.cess_amount!==void 0?Number(R?.cess_amount):W(`cess_amount`),be=K>0||q>0||J>0||Y>0?K+q+J+Y:Number(R?.tax_amount||0);R?.created_by_name||(R?.created_by_type&&R?.created_by_identifier?`${R.created_by_type}${R.created_by_identifier}`:R?.created_by_identifier);let xe=M?.logo,X=e=>`₹${Number(e||0).toLocaleString(`en-IN`,{minimumFractionDigits:2,maximumFractionDigits:2})}`,Se=e=>e?(0,T.default)(e).format(`DD-MM-YYYY`):`-`,Z=e=>e?e.replace(/_/g,` `):`-`,Ce=e=>{let t=Number(e||0);if(!isFinite(t))return``;if(t===0)return`Zero Rupees`;let n=[``,`One`,`Two`,`Three`,`Four`,`Five`,`Six`,`Seven`,`Eight`,`Nine`,`Ten`,`Eleven`,`Twelve`,`Thirteen`,`Fourteen`,`Fifteen`,`Sixteen`,`Seventeen`,`Eighteen`,`Nineteen`],r=[``,``,`Twenty`,`Thirty`,`Forty`,`Fifty`,`Sixty`,`Seventy`,`Eighty`,`Ninety`],i=[{value:1e7,label:`Crore`},{value:1e5,label:`Lakh`},{value:1e3,label:`Thousand`},{value:100,label:`Hundred`}],a=e=>{if(e<20)return n[e];if(e<100)return`${r[Math.floor(e/10)]}${e%10?` ${n[e%10]}`:``}`;for(let t of i)if(e>=t.value){let n=Math.floor(e/t.value),r=e%t.value;return`${a(n)} ${t.label}${r?` ${a(r)}`:``}`}return``},o=Math.floor(t),s=Math.round((t-o)*100);return`${`${a(o)} Rupees`}${s?` and ${a(s)} Paise`:``} only`};(0,w.useEffect)(()=>{let e=document.createElement(`style`);return e.setAttribute(`data-print-style`,`sales-order-print`),e.innerHTML=`
      @media print {
        body { background: white; -webkit-print-color-adjust: exact; }
        body * { visibility: hidden !important; }
        .print-container, .print-container * { visibility: visible !important; }
        .print-container {
          position: absolute;
          left: 0;
          right: 0;
          margin: 0 auto !important;
          box-shadow: none !important;
          border: 0 !important;
          padding-top: 12mm !important;
          padding-bottom: 16mm !important;
          padding-left: 10mm !important;
          padding-right: 10mm !important;
        }
        .no-print { display: none !important; }
        @page { size: A4 ${U}; margin: 10mm; }
        .print-container table { border-collapse: collapse !important; }
        .print-container .MuiTableCell-root {
          padding: 6px 8px !important;
          font-size: 10px !important;
          white-space: normal !important;
          word-break: break-word !important;
          vertical-align: top !important;
        }
      }
    `,document.head.appendChild(e),()=>{document.head.removeChild(e)}},[U]);let Q=(0,w.useCallback)(()=>{v(j)},[j,v]),we=(0,w.useCallback)(()=>{window.print()},[]),Te=(0,w.useCallback)(async()=>{if(!(!F.current||!R))try{P(!0);let e=await(0,de.default)(F.current,{scale:2,useCORS:!0,backgroundColor:`#ffffff`}),t=e.toDataURL(`image/png`),n=new ue(U===`landscape`?`l`:`p`,`mm`,`a4`),r=n.internal.pageSize.getWidth(),i=n.internal.pageSize.getHeight(),a=e.height*r/e.width,o=i-12-16,s=a,c=12;for(n.addImage(t,`PNG`,0,c,r,a),s-=o;s>0;)c=s-a+12,n.addPage(),n.addImage(t,`PNG`,0,c,r,a),s-=o;n.save(`sales-order-${R.order_number||R.id||`print`}.pdf`),I(`PDF downloaded`)}catch{L(`Failed to download PDF`)}finally{P(!1)}},[R,U,L,I]),$=(0,w.useRef)(!1);return(0,w.useEffect)(()=>{if(D&&!k){L(`You do not have permission to download Sales Order PDF`),Q();return}if(O&&!A){L(`You do not have permission to print Sales Order`),Q();return}if(!D||!R||z||N||$.current)return;$.current=!0;let e=setTimeout(()=>void Te(),400);return()=>clearTimeout(e)},[D,R,z]),(0,w.useEffect)(()=>{if(O&&!A||!O||!R||z||N)return;let e=setTimeout(()=>{window.print()},500);return()=>clearTimeout(e)},[O,A,N,z,R]),z?(0,E.jsx)(l,{sx:{display:`flex`,alignItems:`center`,justifyContent:`center`,height:`100vh`},children:(0,E.jsx)(ee,{})}):R?(0,E.jsxs)(l,{sx:{minHeight:`100vh`,bgcolor:`#f5f6f8`,py:3,px:{xs:2,md:4}},children:[(0,E.jsxs)(l,{className:`no-print`,sx:{display:`flex`,justifyContent:`flex-end`,gap:1.5,mb:2},children:[(0,E.jsx)(h,{variant:`text`,color:`inherit`,startIcon:(0,E.jsx)(ne,{}),onClick:Q,disabled:N,children:`Cancel`}),k&&(0,E.jsx)(h,{variant:`outlined`,startIcon:(0,E.jsx)(s,{}),onClick:()=>void Te(),disabled:N,children:N?`Preparing PDF...`:`Download PDF`}),A&&(0,E.jsx)(h,{variant:`contained`,startIcon:(0,E.jsx)(te,{}),onClick:we,disabled:N,children:`Print`})]}),(0,E.jsxs)(f,{ref:F,className:`print-container`,sx:{maxWidth:me,width:`100%`,mx:`auto`,p:{xs:2.5,md:3.5},pt:{xs:4,md:5},pb:{xs:6,md:8},backgroundColor:`white`,boxShadow:`0 12px 30px rgba(0,0,0,0.12)`,borderRadius:2,"@media print":{boxShadow:`none`,borderRadius:0,maxWidth:`none`,width:`100%`,p:`12mm 10mm 18mm 10mm`,m:0}},children:[(0,E.jsxs)(l,{sx:{display:`flex`,alignItems:`flex-start`,gap:2,mb:2},children:[(0,E.jsx)(l,{sx:{height:72,width:72,borderRadius:`50%`,border:`1px solid #d6d8df`,display:`flex`,alignItems:`center`,justifyContent:`center`,overflow:`hidden`,bgcolor:`#f9fafb`,flexShrink:0},children:xe?(0,E.jsx)(se,{src:xe,alt:M?.name||`Company`,sx:{height:`100%`,width:`100%`,objectFit:`contain`}}):(0,E.jsx)(u,{variant:`subtitle2`,color:`text.secondary`,children:`Logo`})}),(0,E.jsxs)(l,{sx:{flex:1,textAlign:`center`},children:[(0,E.jsx)(u,{variant:`h6`,sx:{fontWeight:800,letterSpacing:.4,color:`#1f2d3d`},children:`SALES ORDER`}),(0,E.jsx)(u,{variant:`body2`,color:`text.secondary`,sx:{whiteSpace:`pre-wrap`,mt:.5},children:M?.address}),(M?.phone||M?.email)&&(0,E.jsxs)(u,{variant:`body2`,color:`text.secondary`,sx:{mt:.5},children:[M?.phone,` `,M?.phone&&M?.email?` | `:``,` `,M?.email]}),M?.gst_number&&(0,E.jsxs)(u,{variant:`body2`,color:`text.secondary`,sx:{mt:.5},children:[`GST: `,M.gst_number]})]}),(0,E.jsx)(l,{sx:{minWidth:130,display:`flex`,justifyContent:`flex-end`},children:(0,E.jsx)(ie,{label:Z(R.status),sx:{backgroundColor:`#e6f4ea`,color:`#0f5132`,fontWeight:700,fontSize:`0.95rem`,height:36,px:1.5,textTransform:`uppercase`,letterSpacing:.4}})})]}),(0,E.jsx)(re,{sx:{my:2}}),(0,E.jsx)(u,{variant:`subtitle1`,sx:{textAlign:`center`,fontWeight:800,letterSpacing:1,color:`#263343`,mb:2,textTransform:`uppercase`},children:`Sales Order Summary`}),(0,E.jsx)(d,{component:f,elevation:0,sx:{border:`1px solid #e6e8f0`,mb:3},children:(0,E.jsx)(x,{size:`small`,children:(0,E.jsxs)(g,{children:[(0,E.jsxs)(m,{children:[(0,E.jsx)(p,{sx:{fontWeight:700,bgcolor:`#f6f7fb`,border:`1px solid #e6e8f0`},children:`Order Number`}),(0,E.jsx)(p,{sx:{border:`1px solid #e6e8f0`,fontWeight:600},children:R.order_number}),(0,E.jsx)(p,{sx:{fontWeight:700,bgcolor:`#f6f7fb`,border:`1px solid #e6e8f0`},children:`Order Date`}),(0,E.jsx)(p,{sx:{border:`1px solid #e6e8f0`,fontWeight:600},children:Se(R.order_date)})]}),(0,E.jsxs)(m,{children:[(0,E.jsx)(p,{sx:{fontWeight:700,bgcolor:`#f6f7fb`,border:`1px solid #e6e8f0`},children:`Customer`}),(0,E.jsx)(p,{sx:{border:`1px solid #e6e8f0`},children:R.customer_name||`-`}),(0,E.jsx)(p,{sx:{fontWeight:700,bgcolor:`#f6f7fb`,border:`1px solid #e6e8f0`},children:`Customer Type`}),(0,E.jsx)(p,{sx:{border:`1px solid #e6e8f0`},children:Z(R.customer_type)})]}),(0,E.jsxs)(m,{children:[(0,E.jsx)(p,{sx:{fontWeight:700,bgcolor:`#f6f7fb`,border:`1px solid #e6e8f0`},children:`Tax Type`}),(0,E.jsx)(p,{sx:{border:`1px solid #e6e8f0`},children:R.tax_type_display||Z(R.tax_type)}),(0,E.jsx)(p,{sx:{fontWeight:700,bgcolor:`#f6f7fb`,border:`1px solid #e6e8f0`},children:`Credit Days`}),(0,E.jsxs)(p,{sx:{border:`1px solid #e6e8f0`},children:[R.credit_days,` days`]})]}),(0,E.jsxs)(m,{children:[(0,E.jsx)(p,{sx:{fontWeight:700,bgcolor:`#f6f7fb`,border:`1px solid #e6e8f0`},children:`Billing State`}),(0,E.jsx)(p,{sx:{border:`1px solid #e6e8f0`},children:R.billing_state_name||R.billing_state||`-`}),(0,E.jsx)(p,{sx:{fontWeight:700,bgcolor:`#f6f7fb`,border:`1px solid #e6e8f0`},children:`Shipping State`}),(0,E.jsx)(p,{sx:{border:`1px solid #e6e8f0`},children:R.shipping_state_name||R.shipping_state||`-`})]})]})})}),(0,E.jsx)(u,{variant:`subtitle2`,sx:{textAlign:`center`,fontWeight:800,letterSpacing:1,color:`#263343`,mb:1,textTransform:`uppercase`},children:`Address Details`}),(0,E.jsx)(d,{component:f,elevation:0,sx:{border:`1px solid #e6e8f0`,mb:3},children:(0,E.jsxs)(x,{size:`small`,children:[(0,E.jsx)(c,{children:(0,E.jsxs)(m,{sx:{bgcolor:`#f6f7fb`},children:[(0,E.jsx)(p,{sx:{fontWeight:700,border:`1px solid #e6e8f0`},children:`Billing Address`}),(0,E.jsx)(p,{sx:{fontWeight:700,border:`1px solid #e6e8f0`},children:`Billing City`}),(0,E.jsx)(p,{sx:{fontWeight:700,border:`1px solid #e6e8f0`},children:`Shipping Address`}),(0,E.jsx)(p,{sx:{fontWeight:700,border:`1px solid #e6e8f0`},children:`Shipping City`}),(0,E.jsx)(p,{sx:{fontWeight:700,border:`1px solid #e6e8f0`,textAlign:`center`},children:`Same As Billing`})]})}),(0,E.jsx)(g,{children:(0,E.jsxs)(m,{children:[(0,E.jsxs)(p,{sx:{border:`1px solid #e6e8f0`},children:[(0,E.jsx)(u,{variant:`body2`,sx:{whiteSpace:`pre-line`},children:R.billing_address||`-`}),(0,E.jsxs)(u,{variant:`body2`,color:`text.secondary`,sx:{mt:.5},children:[`State: `,R.billing_state_name||R.billing_state||`-`]})]}),(0,E.jsxs)(p,{sx:{border:`1px solid #e6e8f0`},children:[R.billing_city_name||R.billing_city||`-`,R.billing_area_name&&`, ${R.billing_area_name}`]}),(0,E.jsxs)(p,{sx:{border:`1px solid #e6e8f0`},children:[(0,E.jsx)(u,{variant:`body2`,sx:{whiteSpace:`pre-line`},children:R.shipping_address||`-`}),(0,E.jsxs)(u,{variant:`body2`,color:`text.secondary`,sx:{mt:.5},children:[`State: `,R.shipping_state_name||R.shipping_state||`-`]})]}),(0,E.jsxs)(p,{sx:{border:`1px solid #e6e8f0`},children:[R.shipping_city_name||R.shipping_city||`-`,R.shipping_area_name&&`, ${R.shipping_area_name}`]}),(0,E.jsx)(p,{sx:{border:`1px solid #e6e8f0`,textAlign:`center`},children:R.same_as_billing?`Yes`:`No`})]})})]})}),(0,E.jsx)(u,{variant:`subtitle2`,sx:{textAlign:`center`,fontWeight:800,letterSpacing:1,color:`#263343`,mb:1,textTransform:`uppercase`},children:`Order Items`}),(0,E.jsx)(d,{component:f,elevation:0,sx:{border:`1px solid #e6e8f0`,mb:3,overflowX:`auto`},children:(0,E.jsxs)(x,{size:`small`,sx:{tableLayout:`auto`,minWidth:`100%`},children:[(0,E.jsx)(c,{children:(0,E.jsxs)(m,{sx:{backgroundColor:`#f5f7fb`},children:[(0,E.jsx)(p,{sx:{fontWeight:700,border:`1px solid #e6e8f0`,whiteSpace:`nowrap`},children:`S.No`}),(0,E.jsx)(p,{sx:{fontWeight:700,border:`1px solid #e6e8f0`,minWidth:100},children:`Category`}),(0,E.jsx)(p,{sx:{fontWeight:700,border:`1px solid #e6e8f0`,whiteSpace:`nowrap`},children:`Product Code`}),(0,E.jsx)(p,{sx:{fontWeight:700,border:`1px solid #e6e8f0`,minWidth:150},children:`Product Name`}),B&&(0,E.jsx)(p,{sx:{fontWeight:700,border:`1px solid #e6e8f0`,whiteSpace:`nowrap`},children:`HSN Code`}),(0,E.jsx)(p,{sx:{fontWeight:700,border:`1px solid #e6e8f0`,textAlign:`right`,whiteSpace:`nowrap`},children:`Quantity`}),(0,E.jsx)(p,{sx:{fontWeight:700,border:`1px solid #e6e8f0`,textAlign:`right`,whiteSpace:`nowrap`},children:`UOM`}),(0,E.jsx)(p,{sx:{fontWeight:700,border:`1px solid #e6e8f0`,textAlign:`right`,whiteSpace:`nowrap`},children:`Rate`}),H&&(0,E.jsx)(p,{sx:{fontWeight:700,border:`1px solid #e6e8f0`,textAlign:`right`,whiteSpace:`nowrap`},children:`Discount`}),(0,E.jsx)(p,{sx:{fontWeight:700,border:`1px solid #e6e8f0`,textAlign:`right`,whiteSpace:`nowrap`},children:`Taxable Value`}),(0,E.jsx)(p,{sx:{fontWeight:700,border:`1px solid #e6e8f0`,textAlign:`right`,whiteSpace:`nowrap`},children:`Tax Rate`}),(0,E.jsx)(p,{sx:{fontWeight:700,border:`1px solid #e6e8f0`,textAlign:`right`,whiteSpace:`nowrap`},children:`Tax Amount`}),(0,E.jsx)(p,{sx:{fontWeight:700,border:`1px solid #e6e8f0`,textAlign:`right`,whiteSpace:`nowrap`},children:`Line Total`})]})}),(0,E.jsxs)(g,{children:[R.items?.map((e,t)=>(0,E.jsxs)(m,{children:[(0,E.jsx)(p,{sx:{border:`1px solid #e6e8f0`},children:t+1}),(0,E.jsx)(p,{sx:{border:`1px solid #e6e8f0`},children:e.category_name||`-`}),(0,E.jsx)(p,{sx:{border:`1px solid #e6e8f0`,whiteSpace:`nowrap`},children:e.item_code}),(0,E.jsx)(p,{sx:{border:`1px solid #e6e8f0`,wordBreak:`break-word`},children:e.item_name}),B&&(0,E.jsx)(p,{sx:{border:`1px solid #e6e8f0`},children:e.hsn_code||`-`}),(0,E.jsx)(p,{sx:{border:`1px solid #e6e8f0`,textAlign:`right`,whiteSpace:`nowrap`},children:Number(e.quantity).toFixed(2)}),(0,E.jsx)(p,{sx:{border:`1px solid #e6e8f0`,textAlign:`right`,whiteSpace:`nowrap`},children:e.uom_name}),(0,E.jsx)(p,{sx:{border:`1px solid #e6e8f0`,textAlign:`right`,whiteSpace:`nowrap`},children:X(e.rate)}),H&&(0,E.jsx)(p,{sx:{border:`1px solid #e6e8f0`,textAlign:`right`,whiteSpace:`nowrap`},children:X(e.discount_amount)}),(0,E.jsx)(p,{sx:{border:`1px solid #e6e8f0`,textAlign:`right`,whiteSpace:`nowrap`},children:X(e.taxable_amount)}),(0,E.jsx)(p,{sx:{border:`1px solid #e6e8f0`,textAlign:`right`,whiteSpace:`nowrap`},children:`${Number(e.tax_percentage||0).toFixed(2)}%`}),(0,E.jsx)(p,{sx:{border:`1px solid #e6e8f0`,textAlign:`right`,whiteSpace:`nowrap`},children:X(e.tax_amount)}),(0,E.jsx)(p,{sx:{border:`1px solid #e6e8f0`,textAlign:`right`,fontWeight:700,whiteSpace:`nowrap`},children:X(e.line_total)})]},t)),(0,E.jsxs)(m,{children:[(0,E.jsx)(p,{sx:{border:`1px solid #e6e8f0`,bgcolor:`#f9fafb`},colSpan:pe-1,align:`right`,children:(0,E.jsx)(u,{variant:`body2`,sx:{fontWeight:700},children:`Subtotal`})}),(0,E.jsx)(p,{sx:{border:`1px solid #e6e8f0`,bgcolor:`#f9fafb`,textAlign:`right`,fontWeight:700},children:X(R.subtotal)})]})]})]})}),(0,E.jsxs)(l,{sx:{display:`flex`,flexWrap:`wrap`,gap:2,justifyContent:R.remarks?`space-between`:`flex-end`,alignItems:`flex-start`,mb:3},children:[R.remarks&&(0,E.jsxs)(l,{sx:{flex:`1 1 300px`,maxWidth:{md:`45%`}},children:[(0,E.jsx)(u,{variant:`subtitle2`,sx:{fontWeight:700,color:`#263343`,mb:1},children:`Remarks`}),(0,E.jsx)(u,{variant:`body2`,sx:{whiteSpace:`pre-line`},children:R.remarks})]}),(0,E.jsxs)(l,{sx:{flex:`1 1 300px`,maxWidth:{md:`45%`}},children:[(0,E.jsx)(u,{variant:`subtitle2`,sx:{fontWeight:700,color:`#263343`,mb:1},children:`Amount in Words`}),(0,E.jsx)(u,{variant:`body2`,sx:{whiteSpace:`pre-line`},children:Ce(R.grand_total)})]}),(0,E.jsx)(l,{sx:{flex:`0 1 360px`,maxWidth:{md:`50%`},ml:{md:`auto`},width:{xs:`100%`,md:`auto`},alignSelf:`flex-start`},children:(0,E.jsx)(x,{size:`small`,sx:{border:`1px solid #e6e8f0`},children:(0,E.jsxs)(g,{children:[R.base_amount!==void 0&&(0,E.jsxs)(m,{children:[(0,E.jsx)(p,{sx:{fontWeight:600,border:`1px solid #e6e8f0`},children:`Base Amount`}),(0,E.jsx)(p,{sx:{textAlign:`right`,border:`1px solid #e6e8f0`},children:X(R.base_amount)})]}),G>0&&(0,E.jsxs)(m,{children:[(0,E.jsx)(p,{sx:{fontWeight:600,border:`1px solid #e6e8f0`},children:`Discount`}),(0,E.jsxs)(p,{sx:{textAlign:`right`,border:`1px solid #e6e8f0`,color:`error.main`,fontWeight:600},children:[`-`,X(G)]})]}),V>0&&(0,E.jsxs)(m,{children:[(0,E.jsx)(p,{sx:{fontWeight:600,border:`1px solid #e6e8f0`},children:`Scheme Discount`}),(0,E.jsxs)(p,{sx:{textAlign:`right`,border:`1px solid #e6e8f0`,color:`error.main`,fontWeight:600},children:[`-`,X(V)]})]}),(0,E.jsxs)(m,{children:[(0,E.jsx)(p,{sx:{fontWeight:600,border:`1px solid #e6e8f0`},children:`Taxable Amount`}),(0,E.jsx)(p,{sx:{textAlign:`right`,border:`1px solid #e6e8f0`},children:X(ye)})]}),K>0&&(0,E.jsxs)(m,{children:[(0,E.jsx)(p,{sx:{fontWeight:600,border:`1px solid #e6e8f0`,pl:2},children:`CGST`}),(0,E.jsx)(p,{sx:{textAlign:`right`,border:`1px solid #e6e8f0`},children:X(K)})]}),q>0&&(0,E.jsxs)(m,{children:[(0,E.jsx)(p,{sx:{fontWeight:600,border:`1px solid #e6e8f0`,pl:2},children:`SGST`}),(0,E.jsx)(p,{sx:{textAlign:`right`,border:`1px solid #e6e8f0`},children:X(q)})]}),J>0&&(0,E.jsxs)(m,{children:[(0,E.jsx)(p,{sx:{fontWeight:600,border:`1px solid #e6e8f0`,pl:2},children:`IGST`}),(0,E.jsx)(p,{sx:{textAlign:`right`,border:`1px solid #e6e8f0`},children:X(J)})]}),Y>0&&(0,E.jsxs)(m,{children:[(0,E.jsx)(p,{sx:{fontWeight:600,border:`1px solid #e6e8f0`,pl:2},children:`CESS`}),(0,E.jsx)(p,{sx:{textAlign:`right`,border:`1px solid #e6e8f0`},children:X(Y)})]}),(0,E.jsxs)(m,{children:[(0,E.jsx)(p,{sx:{fontWeight:600,border:`1px solid #e6e8f0`},children:`Total Tax`}),(0,E.jsx)(p,{sx:{textAlign:`right`,border:`1px solid #e6e8f0`},children:X(be)})]}),R.round_off!==void 0&&(0,E.jsxs)(m,{children:[(0,E.jsx)(p,{sx:{fontWeight:600,border:`1px solid #e6e8f0`},children:`Round Off`}),(0,E.jsx)(p,{sx:{textAlign:`right`,border:`1px solid #e6e8f0`},children:X(R.round_off)})]}),(0,E.jsxs)(m,{children:[(0,E.jsx)(p,{sx:{fontWeight:700,border:`1px solid #e6e8f0`,backgroundColor:`#f6f7fb`},children:V>0?`Grand Total (After Schemes)`:`Grand Total`}),(0,E.jsx)(p,{sx:{textAlign:`right`,fontWeight:800,border:`1px solid #e6e8f0`,backgroundColor:`#f6f7fb`,color:`#1f2d3d`},children:X(R.grand_total)})]})]})})})]}),(0,E.jsx)(re,{sx:{mt:2,mb:1}}),(0,E.jsxs)(_,{container:!0,spacing:2,children:[(0,E.jsxs)(_,{size:{xs:6},children:[(0,E.jsxs)(u,{variant:`body2`,sx:{fontWeight:600,color:`#1f2d3d`},children:[`Created By: `,R?.created_by?.full_name||`-`]}),(0,E.jsx)(u,{variant:`body2`,color:`text.secondary`,children:R.created_on?(0,T.default)(R.created_on).format(`DD-MM-YYYY hh:mm A`):`-`})]}),(0,E.jsx)(_,{size:{xs:6},sx:{textAlign:`right`},children:(0,E.jsxs)(u,{variant:`body2`,color:`text.secondary`,children:[`Generated on: `,(0,T.default)().format(`DD/MM/YYYY HH:mm`)]})})]})]})]}):(0,E.jsx)(l,{sx:{display:`flex`,alignItems:`center`,justifyContent:`center`,height:`100vh`},children:(0,E.jsx)(u,{variant:`h6`,color:`error`,children:`Sales Order not found`})})};export{D as default};