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-ChE_eana.js";import{Fn as s,Fr as c,Gr as ee,Hr as l,In as u,Kr as d,Ln as f,Mn as p,Nr as m,Rn as h,Z as te,Zt as ne,et as re,fr as g,h as _,ii as v,ni as y,yr as ie,zn as b,zr as ae}from"./mui-vendor-K60S-ugg.js";import"./state-vendor-Cw2RdylD.js";import{ft as oe,k as x,r as se,s as ce,st as le,w as ue}from"./index-Cz-yne81.js";import{t as S}from"./html2canvas-DZsOdvuV.js";import{t as de}from"./jspdf.es.min-DMm5zjhQ.js";var C=e(v(),1),fe=e(S(),1),w=e(_(),1),T=y(),E=()=>{let{id:e}=n(),_=t(),v=i(e=>e.auth.user);ue(`Print Sales Order`);let y=a(),[S]=r(),E=S.get(`download`)===`pdf`,D=S.get(`print`)===`1`,O=x(v,`download_salesorder`),k=x(v,`print_salesorder`);(0,C.useEffect)(()=>{!O&&!k&&_(`/unauthorized`,{replace:!0})},[O,k,_]);let A=(0,C.useMemo)(()=>y.state?.from||`/sales/orders`,[y.state]),[j,pe]=(0,C.useState)(null),[M,me]=(0,C.useState)(!1),N=(0,C.useRef)(null),{success:P,error:F}=oe(),{data:I,isLoading:L}=o({queryKey:[`salesOrder`,e],queryFn:()=>ce.getById(e),enabled:!!e});(0,C.useEffect)(()=>{console.log(`ordere detaqils`,I)},[I]),(0,C.useEffect)(()=>{(async()=>{if(I?.company)try{pe((await le.get(`/api/masters/companies/${I.company}/`)).data)}catch{}})()},[I?.company]);let R=!!I?.items?.some(e=>e.hsn_code),z=(I?.applied_schemes||[]).reduce((e,t)=>e+Number(t.discount_amount||0),0),B=!!I?.items?.some(e=>Number(e.discount_amount||0)>0)||z>0,V=10+Number(R)+Number(B)+1,H=V>7?`landscape`:`portrait`,he=H===`landscape`?`297mm`:`210mm`,U=I?.items||[],W=e=>U.reduce((t,n)=>t+Number(n?.[e]||0),0),ge=U.reduce((e,t)=>e+Number(t?.rate||0)*Number(t?.quantity||0),0),_e=I?.base_amount===void 0?ge:Number(I.base_amount),G=W(`discount_amount`),ve=I?.discount_amount===void 0?G+z:Number(I.discount_amount),ye=I?.taxable_amount===void 0?Math.max(_e-ve,0):Number(I.taxable_amount),K=I&&I?.cgst_amount!==void 0?Number(I?.cgst_amount):W(`cgst_amount`),q=I&&I?.sgst_amount!==void 0?Number(I?.sgst_amount):W(`sgst_amount`),J=I&&I?.igst_amount!==void 0?Number(I?.igst_amount):W(`igst_amount`),Y=I&&I?.cess_amount!==void 0?Number(I?.cess_amount):W(`cess_amount`),be=K>0||q>0||J>0||Y>0?K+q+J+Y:Number(I?.tax_amount||0);I?.created_by_name||(I?.created_by_type&&I?.created_by_identifier?`${I.created_by_type}${I.created_by_identifier}`:I?.created_by_identifier);let X=j?.logo,Z=e=>`₹${Number(e||0).toLocaleString(`en-IN`,{minimumFractionDigits:2,maximumFractionDigits:2})}`,xe=e=>e?(0,w.default)(e).format(`DD-MM-YYYY`):`-`,Q=e=>e?e.replace(/_/g,` `):`-`,Se=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,C.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 ${H}; 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)}},[H]);let $=(0,C.useCallback)(()=>{_(A)},[A,_]),Ce=(0,C.useCallback)(()=>{window.print()},[]),we=(0,C.useCallback)(async()=>{if(!(!N.current||!I))try{me(!0);let e=await(0,fe.default)(N.current,{scale:2,useCORS:!0,backgroundColor:`#ffffff`}),t=e.toDataURL(`image/png`),n=new de(H===`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-${I.order_number||I.id||`print`}.pdf`),P(`PDF downloaded`)}catch{F(`Failed to download PDF`)}finally{me(!1)}},[I,H,F,P]),Te=(0,C.useRef)(!1);return(0,C.useEffect)(()=>{if(E&&!O){F(`You do not have permission to download Sales Order PDF`),$();return}if(D&&!k){F(`You do not have permission to print Sales Order`),$();return}if(!E||!I||L||M||Te.current)return;Te.current=!0;let e=setTimeout(()=>void we(),400);return()=>clearTimeout(e)},[E,I,L]),(0,C.useEffect)(()=>{if(D&&!k||!D||!I||L||M)return;let e=setTimeout(()=>{window.print()},500);return()=>clearTimeout(e)},[D,k,M,L,I]),L?(0,T.jsx)(c,{sx:{display:`flex`,alignItems:`center`,justifyContent:`center`,height:`100vh`},children:(0,T.jsx)(ee,{})}):I?(0,T.jsxs)(c,{sx:{minHeight:`100vh`,bgcolor:`#f5f6f8`,py:3,px:{xs:2,md:4}},children:[(0,T.jsxs)(c,{className:`no-print`,sx:{display:`flex`,justifyContent:`flex-end`,gap:1.5,mb:2},children:[(0,T.jsx)(m,{variant:`text`,color:`inherit`,startIcon:(0,T.jsx)(ne,{}),onClick:$,disabled:M,children:`Cancel`}),O&&(0,T.jsx)(m,{variant:`outlined`,startIcon:(0,T.jsx)(re,{}),onClick:()=>void we(),disabled:M,children:M?`Preparing PDF...`:`Download PDF`}),k&&(0,T.jsx)(m,{variant:`contained`,startIcon:(0,T.jsx)(te,{}),onClick:Ce,disabled:M,children:`Print`})]}),(0,T.jsxs)(d,{ref:N,className:`print-container`,sx:{maxWidth:he,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,T.jsxs)(c,{sx:{display:`flex`,alignItems:`flex-start`,gap:2,mb:2},children:[(0,T.jsx)(c,{sx:{height:72,width:72,borderRadius:`50%`,border:`1px solid #d6d8df`,display:`flex`,alignItems:`center`,justifyContent:`center`,overflow:`hidden`,bgcolor:`#f9fafb`,flexShrink:0},children:X?(0,T.jsx)(se,{src:X,alt:j?.name||`Company`,sx:{height:`100%`,width:`100%`,objectFit:`contain`}}):(0,T.jsx)(l,{variant:`subtitle2`,color:`text.secondary`,children:`Logo`})}),(0,T.jsxs)(c,{sx:{flex:1,textAlign:`center`},children:[(0,T.jsx)(l,{variant:`h6`,sx:{fontWeight:800,letterSpacing:.4,color:`#1f2d3d`},children:`SALES ORDER`}),(0,T.jsx)(l,{variant:`body2`,color:`text.secondary`,sx:{whiteSpace:`pre-wrap`,mt:.5},children:j?.address}),(j?.phone||j?.email)&&(0,T.jsxs)(l,{variant:`body2`,color:`text.secondary`,sx:{mt:.5},children:[j?.phone,` `,j?.phone&&j?.email?` | `:``,` `,j?.email]}),j?.gst_number&&(0,T.jsxs)(l,{variant:`body2`,color:`text.secondary`,sx:{mt:.5},children:[`GST: `,j.gst_number]})]}),(0,T.jsx)(c,{sx:{minWidth:130,display:`flex`,justifyContent:`flex-end`},children:(0,T.jsx)(ae,{label:Q(I.status),sx:{backgroundColor:`#e6f4ea`,color:`#0f5132`,fontWeight:700,fontSize:`0.95rem`,height:36,px:1.5,textTransform:`uppercase`,letterSpacing:.4}})})]}),(0,T.jsx)(ie,{sx:{my:2}}),(0,T.jsx)(l,{variant:`subtitle1`,sx:{textAlign:`center`,fontWeight:800,letterSpacing:1,color:`#263343`,mb:2,textTransform:`uppercase`},children:`Sales Order Summary`}),(0,T.jsx)(u,{component:d,elevation:0,sx:{border:`1px solid #e6e8f0`,mb:3},children:(0,T.jsx)(b,{size:`small`,children:(0,T.jsxs)(h,{children:[(0,T.jsxs)(p,{children:[(0,T.jsx)(f,{sx:{fontWeight:700,bgcolor:`#f6f7fb`,border:`1px solid #e6e8f0`},children:`Order Number`}),(0,T.jsx)(f,{sx:{border:`1px solid #e6e8f0`,fontWeight:600},children:I.order_number}),(0,T.jsx)(f,{sx:{fontWeight:700,bgcolor:`#f6f7fb`,border:`1px solid #e6e8f0`},children:`Order Date`}),(0,T.jsx)(f,{sx:{border:`1px solid #e6e8f0`,fontWeight:600},children:xe(I.order_date)})]}),(0,T.jsxs)(p,{children:[(0,T.jsx)(f,{sx:{fontWeight:700,bgcolor:`#f6f7fb`,border:`1px solid #e6e8f0`},children:`Customer`}),(0,T.jsx)(f,{sx:{border:`1px solid #e6e8f0`},children:I.customer_name||`-`}),(0,T.jsx)(f,{sx:{fontWeight:700,bgcolor:`#f6f7fb`,border:`1px solid #e6e8f0`},children:`Customer Type`}),(0,T.jsx)(f,{sx:{border:`1px solid #e6e8f0`},children:Q(I.customer_type)})]}),(0,T.jsxs)(p,{children:[(0,T.jsx)(f,{sx:{fontWeight:700,bgcolor:`#f6f7fb`,border:`1px solid #e6e8f0`},children:`Tax Type`}),(0,T.jsx)(f,{sx:{border:`1px solid #e6e8f0`},children:I.tax_type_display||Q(I.tax_type)}),(0,T.jsx)(f,{sx:{fontWeight:700,bgcolor:`#f6f7fb`,border:`1px solid #e6e8f0`},children:`Credit Days`}),(0,T.jsxs)(f,{sx:{border:`1px solid #e6e8f0`},children:[I.credit_days,` days`]})]}),(0,T.jsxs)(p,{children:[(0,T.jsx)(f,{sx:{fontWeight:700,bgcolor:`#f6f7fb`,border:`1px solid #e6e8f0`},children:`Billing State`}),(0,T.jsx)(f,{sx:{border:`1px solid #e6e8f0`},children:I.billing_state_name||I.billing_state||`-`}),(0,T.jsx)(f,{sx:{fontWeight:700,bgcolor:`#f6f7fb`,border:`1px solid #e6e8f0`},children:`Shipping State`}),(0,T.jsx)(f,{sx:{border:`1px solid #e6e8f0`},children:I.shipping_state_name||I.shipping_state||`-`})]})]})})}),(0,T.jsx)(l,{variant:`subtitle2`,sx:{textAlign:`center`,fontWeight:800,letterSpacing:1,color:`#263343`,mb:1,textTransform:`uppercase`},children:`Address Details`}),(0,T.jsx)(u,{component:d,elevation:0,sx:{border:`1px solid #e6e8f0`,mb:3},children:(0,T.jsxs)(b,{size:`small`,children:[(0,T.jsx)(s,{children:(0,T.jsxs)(p,{sx:{bgcolor:`#f6f7fb`},children:[(0,T.jsx)(f,{sx:{fontWeight:700,border:`1px solid #e6e8f0`},children:`Billing Address`}),(0,T.jsx)(f,{sx:{fontWeight:700,border:`1px solid #e6e8f0`},children:`Billing City`}),(0,T.jsx)(f,{sx:{fontWeight:700,border:`1px solid #e6e8f0`},children:`Shipping Address`}),(0,T.jsx)(f,{sx:{fontWeight:700,border:`1px solid #e6e8f0`},children:`Shipping City`}),(0,T.jsx)(f,{sx:{fontWeight:700,border:`1px solid #e6e8f0`,textAlign:`center`},children:`Same As Billing`})]})}),(0,T.jsx)(h,{children:(0,T.jsxs)(p,{children:[(0,T.jsxs)(f,{sx:{border:`1px solid #e6e8f0`},children:[(0,T.jsx)(l,{variant:`body2`,sx:{whiteSpace:`pre-line`},children:I.billing_address||`-`}),(0,T.jsxs)(l,{variant:`body2`,color:`text.secondary`,sx:{mt:.5},children:[`State: `,I.billing_state_name||I.billing_state||`-`]})]}),(0,T.jsxs)(f,{sx:{border:`1px solid #e6e8f0`},children:[I.billing_city_name||I.billing_city||`-`,I.billing_area_name&&`, ${I.billing_area_name}`]}),(0,T.jsxs)(f,{sx:{border:`1px solid #e6e8f0`},children:[(0,T.jsx)(l,{variant:`body2`,sx:{whiteSpace:`pre-line`},children:I.shipping_address||`-`}),(0,T.jsxs)(l,{variant:`body2`,color:`text.secondary`,sx:{mt:.5},children:[`State: `,I.shipping_state_name||I.shipping_state||`-`]})]}),(0,T.jsxs)(f,{sx:{border:`1px solid #e6e8f0`},children:[I.shipping_city_name||I.shipping_city||`-`,I.shipping_area_name&&`, ${I.shipping_area_name}`]}),(0,T.jsx)(f,{sx:{border:`1px solid #e6e8f0`,textAlign:`center`},children:I.same_as_billing?`Yes`:`No`})]})})]})}),(0,T.jsx)(l,{variant:`subtitle2`,sx:{textAlign:`center`,fontWeight:800,letterSpacing:1,color:`#263343`,mb:1,textTransform:`uppercase`},children:`Order Items`}),(0,T.jsx)(u,{component:d,elevation:0,sx:{border:`1px solid #e6e8f0`,mb:3,overflowX:`auto`},children:(0,T.jsxs)(b,{size:`small`,sx:{tableLayout:`auto`,minWidth:`100%`},children:[(0,T.jsx)(s,{children:(0,T.jsxs)(p,{sx:{backgroundColor:`#f5f7fb`},children:[(0,T.jsx)(f,{sx:{fontWeight:700,border:`1px solid #e6e8f0`,whiteSpace:`nowrap`},children:`S.No`}),(0,T.jsx)(f,{sx:{fontWeight:700,border:`1px solid #e6e8f0`,minWidth:100},children:`Category`}),(0,T.jsx)(f,{sx:{fontWeight:700,border:`1px solid #e6e8f0`,whiteSpace:`nowrap`},children:`Product Code`}),(0,T.jsx)(f,{sx:{fontWeight:700,border:`1px solid #e6e8f0`,minWidth:150},children:`Product Name`}),R&&(0,T.jsx)(f,{sx:{fontWeight:700,border:`1px solid #e6e8f0`,whiteSpace:`nowrap`},children:`HSN Code`}),(0,T.jsx)(f,{sx:{fontWeight:700,border:`1px solid #e6e8f0`,textAlign:`right`,whiteSpace:`nowrap`},children:`Quantity`}),(0,T.jsx)(f,{sx:{fontWeight:700,border:`1px solid #e6e8f0`,textAlign:`right`,whiteSpace:`nowrap`},children:`UOM`}),(0,T.jsx)(f,{sx:{fontWeight:700,border:`1px solid #e6e8f0`,textAlign:`right`,whiteSpace:`nowrap`},children:`Rate`}),B&&(0,T.jsx)(f,{sx:{fontWeight:700,border:`1px solid #e6e8f0`,textAlign:`right`,whiteSpace:`nowrap`},children:`Discount`}),(0,T.jsx)(f,{sx:{fontWeight:700,border:`1px solid #e6e8f0`,textAlign:`right`,whiteSpace:`nowrap`},children:`Taxable Value`}),(0,T.jsx)(f,{sx:{fontWeight:700,border:`1px solid #e6e8f0`,textAlign:`right`,whiteSpace:`nowrap`},children:`Tax Rate`}),(0,T.jsx)(f,{sx:{fontWeight:700,border:`1px solid #e6e8f0`,textAlign:`right`,whiteSpace:`nowrap`},children:`Tax Amount`}),(0,T.jsx)(f,{sx:{fontWeight:700,border:`1px solid #e6e8f0`,textAlign:`right`,whiteSpace:`nowrap`},children:`Line Total`})]})}),(0,T.jsxs)(h,{children:[I.items?.map((e,t)=>(0,T.jsxs)(p,{children:[(0,T.jsx)(f,{sx:{border:`1px solid #e6e8f0`},children:t+1}),(0,T.jsx)(f,{sx:{border:`1px solid #e6e8f0`},children:e.category_name||`-`}),(0,T.jsx)(f,{sx:{border:`1px solid #e6e8f0`,whiteSpace:`nowrap`},children:e.item_code}),(0,T.jsx)(f,{sx:{border:`1px solid #e6e8f0`,wordBreak:`break-word`},children:e.item_name}),R&&(0,T.jsx)(f,{sx:{border:`1px solid #e6e8f0`},children:e.hsn_code||`-`}),(0,T.jsx)(f,{sx:{border:`1px solid #e6e8f0`,textAlign:`right`,whiteSpace:`nowrap`},children:Number(e.quantity).toFixed(2)}),(0,T.jsx)(f,{sx:{border:`1px solid #e6e8f0`,textAlign:`right`,whiteSpace:`nowrap`},children:e.uom_name}),(0,T.jsx)(f,{sx:{border:`1px solid #e6e8f0`,textAlign:`right`,whiteSpace:`nowrap`},children:Z(e.rate)}),B&&(0,T.jsx)(f,{sx:{border:`1px solid #e6e8f0`,textAlign:`right`,whiteSpace:`nowrap`},children:Z(e.discount_amount)}),(0,T.jsx)(f,{sx:{border:`1px solid #e6e8f0`,textAlign:`right`,whiteSpace:`nowrap`},children:Z(e.taxable_amount)}),(0,T.jsx)(f,{sx:{border:`1px solid #e6e8f0`,textAlign:`right`,whiteSpace:`nowrap`},children:`${Number(e.tax_percentage||0).toFixed(2)}%`}),(0,T.jsx)(f,{sx:{border:`1px solid #e6e8f0`,textAlign:`right`,whiteSpace:`nowrap`},children:Z(e.tax_amount)}),(0,T.jsx)(f,{sx:{border:`1px solid #e6e8f0`,textAlign:`right`,fontWeight:700,whiteSpace:`nowrap`},children:Z(e.line_total)})]},t)),(0,T.jsxs)(p,{children:[(0,T.jsx)(f,{sx:{border:`1px solid #e6e8f0`,bgcolor:`#f9fafb`},colSpan:V-1,align:`right`,children:(0,T.jsx)(l,{variant:`body2`,sx:{fontWeight:700},children:`Subtotal`})}),(0,T.jsx)(f,{sx:{border:`1px solid #e6e8f0`,bgcolor:`#f9fafb`,textAlign:`right`,fontWeight:700},children:Z(I.subtotal)})]})]})]})}),(0,T.jsxs)(c,{sx:{display:`flex`,flexWrap:`wrap`,gap:2,justifyContent:I.remarks?`space-between`:`flex-end`,alignItems:`flex-start`,mb:3},children:[I.remarks&&(0,T.jsxs)(c,{sx:{flex:`1 1 300px`,maxWidth:{md:`45%`}},children:[(0,T.jsx)(l,{variant:`subtitle2`,sx:{fontWeight:700,color:`#263343`,mb:1},children:`Remarks`}),(0,T.jsx)(l,{variant:`body2`,sx:{whiteSpace:`pre-line`},children:I.remarks})]}),(0,T.jsxs)(c,{sx:{flex:`1 1 300px`,maxWidth:{md:`45%`}},children:[(0,T.jsx)(l,{variant:`subtitle2`,sx:{fontWeight:700,color:`#263343`,mb:1},children:`Amount in Words`}),(0,T.jsx)(l,{variant:`body2`,sx:{whiteSpace:`pre-line`},children:Se(I.grand_total)})]}),(0,T.jsx)(c,{sx:{flex:`0 1 360px`,maxWidth:{md:`50%`},ml:{md:`auto`},width:{xs:`100%`,md:`auto`},alignSelf:`flex-start`},children:(0,T.jsx)(b,{size:`small`,sx:{border:`1px solid #e6e8f0`},children:(0,T.jsxs)(h,{children:[I.base_amount!==void 0&&(0,T.jsxs)(p,{children:[(0,T.jsx)(f,{sx:{fontWeight:600,border:`1px solid #e6e8f0`},children:`Base Amount`}),(0,T.jsx)(f,{sx:{textAlign:`right`,border:`1px solid #e6e8f0`},children:Z(I.base_amount)})]}),G>0&&(0,T.jsxs)(p,{children:[(0,T.jsx)(f,{sx:{fontWeight:600,border:`1px solid #e6e8f0`},children:`Discount`}),(0,T.jsxs)(f,{sx:{textAlign:`right`,border:`1px solid #e6e8f0`,color:`error.main`,fontWeight:600},children:[`-`,Z(G)]})]}),z>0&&(0,T.jsxs)(p,{children:[(0,T.jsx)(f,{sx:{fontWeight:600,border:`1px solid #e6e8f0`},children:`Scheme Discount`}),(0,T.jsxs)(f,{sx:{textAlign:`right`,border:`1px solid #e6e8f0`,color:`error.main`,fontWeight:600},children:[`-`,Z(z)]})]}),(0,T.jsxs)(p,{children:[(0,T.jsx)(f,{sx:{fontWeight:600,border:`1px solid #e6e8f0`},children:`Taxable Amount`}),(0,T.jsx)(f,{sx:{textAlign:`right`,border:`1px solid #e6e8f0`},children:Z(ye)})]}),K>0&&(0,T.jsxs)(p,{children:[(0,T.jsx)(f,{sx:{fontWeight:600,border:`1px solid #e6e8f0`,pl:2},children:`CGST`}),(0,T.jsx)(f,{sx:{textAlign:`right`,border:`1px solid #e6e8f0`},children:Z(K)})]}),q>0&&(0,T.jsxs)(p,{children:[(0,T.jsx)(f,{sx:{fontWeight:600,border:`1px solid #e6e8f0`,pl:2},children:`SGST`}),(0,T.jsx)(f,{sx:{textAlign:`right`,border:`1px solid #e6e8f0`},children:Z(q)})]}),J>0&&(0,T.jsxs)(p,{children:[(0,T.jsx)(f,{sx:{fontWeight:600,border:`1px solid #e6e8f0`,pl:2},children:`IGST`}),(0,T.jsx)(f,{sx:{textAlign:`right`,border:`1px solid #e6e8f0`},children:Z(J)})]}),Y>0&&(0,T.jsxs)(p,{children:[(0,T.jsx)(f,{sx:{fontWeight:600,border:`1px solid #e6e8f0`,pl:2},children:`CESS`}),(0,T.jsx)(f,{sx:{textAlign:`right`,border:`1px solid #e6e8f0`},children:Z(Y)})]}),(0,T.jsxs)(p,{children:[(0,T.jsx)(f,{sx:{fontWeight:600,border:`1px solid #e6e8f0`},children:`Total Tax`}),(0,T.jsx)(f,{sx:{textAlign:`right`,border:`1px solid #e6e8f0`},children:Z(be)})]}),I.round_off!==void 0&&(0,T.jsxs)(p,{children:[(0,T.jsx)(f,{sx:{fontWeight:600,border:`1px solid #e6e8f0`},children:`Round Off`}),(0,T.jsx)(f,{sx:{textAlign:`right`,border:`1px solid #e6e8f0`},children:Z(I.round_off)})]}),(0,T.jsxs)(p,{children:[(0,T.jsx)(f,{sx:{fontWeight:700,border:`1px solid #e6e8f0`,backgroundColor:`#f6f7fb`},children:z>0?`Grand Total (After Schemes)`:`Grand Total`}),(0,T.jsx)(f,{sx:{textAlign:`right`,fontWeight:800,border:`1px solid #e6e8f0`,backgroundColor:`#f6f7fb`,color:`#1f2d3d`},children:Z(I.grand_total)})]})]})})})]}),(0,T.jsx)(ie,{sx:{mt:2,mb:1}}),(0,T.jsxs)(g,{container:!0,spacing:2,children:[(0,T.jsxs)(g,{size:{xs:6},children:[(0,T.jsxs)(l,{variant:`body2`,sx:{fontWeight:600,color:`#1f2d3d`},children:[`Created By: `,I?.created_by?.full_name||`-`]}),(0,T.jsx)(l,{variant:`body2`,color:`text.secondary`,children:I.created_on?(0,w.default)(I.created_on).format(`DD-MM-YYYY hh:mm A`):`-`})]}),(0,T.jsx)(g,{size:{xs:6},sx:{textAlign:`right`},children:(0,T.jsxs)(l,{variant:`body2`,color:`text.secondary`,children:[`Generated on: `,(0,w.default)().format(`DD/MM/YYYY HH:mm`)]})})]})]})]}):(0,T.jsx)(c,{sx:{display:`flex`,alignItems:`center`,justifyContent:`center`,height:`100vh`},children:(0,T.jsx)(l,{variant:`h6`,color:`error`,children:`Sales Order not found`})})};export{E as default};