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