https://plataforma-v3.vercel.app/_next/static/chunks/pages/compras/pedido-compra-076077e3742df0e0.js
1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8359],{76718:function(e,r,a){(window.__NEXT_P=window.__NEXT_P||[]).push(["/compras/pedido-compra",function(){return a(88815)}])},38521:function(e,r,a){"use strict";var s=a(85893),l=a(67294),c=a(38787);r.Z=e=>{let{icon:r,expandedText:a,isLoading:d,onClick:t}=e,[o,i]=(0,l.useState)(!1);return(0,s.jsxs)(c.A,{isIconOnly:!0,onClick:t,isLoading:d,className:"relative p-5 ".concat(o?"w-auto p-3 mx-4 bg-gray-600":"w-16"," hover:scale-125"),onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),children:[r,o&&(0,s.jsx)("span",{className:"p-2",children:a})]})}},48089:function(e,r,a){"use strict";async function s(e,r){try{let a=await fetch("/api/pedido/gravar-log?pedidov=".concat(e,"&descricao=").concat(r)),s=await a.json();if(!a.ok)throw Error("Erro na requisi\xe7\xe3o: ".concat(a.statusText));if(s.error)throw Error("Erro ao salvar log do pedido: ".concat(e));return s}catch(r){throw Error("Erro ao salvar log para o pedido ".concat(e,": ").concat(r.message))}}a.d(r,{c:function(){return s}})},88815:function(e,r,a){"use strict";a.r(r),a.d(r,{default:function(){return S}});var s=a(85893),l=a(67294),c=a(33299),d=a(47451),t=a(83865),o=a(9008),i=a.n(o),n=a(45837),x=a(19314),p=a(67957),b=a(38787),h=a(97350),m=a(93218),u=a(44877),j=a(42967),N=a(34863),g=a(47168),f=a(78148),v=a(69047),y=a(75968),k=a(9383),w=a(46289),_=a(81856);a(38521);var E=a(48089);let P=e=>{let{data:r,clearData:a}=e,[d,t]=(0,l.useState)(!1),{data:o}=(0,c.useSession)(),{accessToken:i}=o,{permissoes:n}=i,{isOpen:x,onOpen:h,onOpenChange:m}=(0,p.q)(),{isOpen:u,onOpen:j,onOpenChange:N}=(0,p.q)(),[g,f]=(0,l.useState)(!1),v=e=>n.some(r=>r.href===e);async function y(e,r,a,s,l,c){t(!0);try{let d=await fetch(r),t=await d.json();t.error?(0,w.Z9)(t.errMsg||s):((0,w.Z9)(a,l),console.log(c),c&&await (0,E.c)(e,c))}catch(e){console.error(s,e),(0,w.Z9)(s)}finally{t(!1)}}async function k(){if(!await (0,w.Z9)("Tem certeza que deseja quitar esse Pedido?","",!0))return;let e="Pedido quitado na V3 pelo usu\xe1rio ".concat(i.erpUser);await y(r.pedidoc,"/api/compras/quitar-compra?pedidov=".concat(r.pedidoc,"&motivo=").concat(encodeURIComponent(e)),"Pedido quitado com sucesso!","Ocorreu um erro ao quitar esse pedido","","".concat(i.erpUser," QUITOU ESSE PEDIDO NA V3"))}async function _(){await (0,w.Z9)("Tem certeza que deseja marcar este pedido como Efetuado?","",!0)&&(i.erpUser,await y(r.pedidoc,"/api/compras/marcar-efetuado-compra?pedidoc=".concat(r.pedidoc,"&efetuado=T"),"Pedido efetuado com sucesso!","Ocorreu um erro ao efetuar esse pedido","","".concat(i.erpUser," EFETUOU ESSE PEDIDO NA V3")))}async function P(){await (0,w.Z9)("Tem certeza que deseja aprovar esse Pedido?","",!0)&&await y(r.pedidoc,"/api/compras/alterar-pedido-compra?pedidov=".concat(r.pedidoc,"&status=").concat(2),"Pedido aprovado com sucesso!","Ocorreu um erro ao aprovar esse pedido","","".concat(i.erpUser," APROVOU ESSE PEDIDO NA V3"))}return(0,s.jsx)(s.Fragment,{children:(0,s.jsxs)("div",{className:"flex gap-3 ocult-print",children:[v("/api/pedido/suspender-pedido")&&(0,s.jsx)(b.A,{expandedText:"Alterar data limite",isLoading:d,className:"bi-calendar-event",children:"Alterar data limite"}),v("/api/compras/quitar-compra")&&(0,s.jsx)(b.A,{isLoading:d,className:"bi-bag-x",onClick:k,children:"Quitar pedido"}),v("/api/compras/efetuar-compra")&&(0,s.jsx)(b.A,{expandedText:"Efetuar pedido",isLoading:d,className:"bi bi-check-circle",onClick:_,children:"Efetuar pedido"}),(0,s.jsx)(b.A,{expandedText:"Imprimir Pedido de Compra",isLoading:d,className:"bi bi-printer",onClick:function(){window.print()},children:"Imprimir PC"}),v("/api/compras/aprovar-compra")&&(0,s.jsx)(b.A,{expandedText:"Aprovar pedido",isLoading:d,onClick:P,className:"print:hidden bi-check2-circle",children:"Aprovar Pedido"})]})})},C=e=>{let{produtos:r,isLoading:a}=e,c=l.useCallback((e,r)=>{let a=e[r],l=(0,s.jsx)("span",{className:"preco-componente",children:a});switch(r){case"preco_un":case"preco_total":if(e.cod_item.includes("."))return l;return a;default:return a}},[]),d="";0===r.length&&(d="Sem produtos"),a&&(d="-");let t=[];for(let e=0;e<r.length;e++){let a=r[e],s={key:e,cod_item:a.item,cod_produto:a.cod_produto,desc:a.descricao1,qtd:a.quantidade,preco_un:(0,_.xG)(a.preco),preco_total:(0,_.xG)(a.quantidade*a.preco)};t.push(s)}return(0,s.jsx)(s.Fragment,{children:(0,s.jsxs)(h.b,{isHeaderSticky:!0,"aria-label":"Tabela de produtos",classNames:{base:"div-produtos-table h-[350px]",wrapper:"wrapper-produtos-table",th:"header-column-produtos-table",table:r.length>3?"min-h-[350px]":""},children:[(0,s.jsx)(m.J,{columns:[{key:"cod_item",label:"ITEM"},{key:"cod_produto",label:"C\xd3DIGO"},{key:"desc",label:"DESCRI\xc7\xc3O"},{key:"qtd",label:"QTD"},{key:"preco_un",label:"PRE\xc7O UN"},{key:"preco_total",label:"PRE\xc7O TOTAL"}],children:e=>
1(0,s.jsx)(u.j,{children:e.label},e.key)}),(0,s.jsx)(j.y,{items:t,emptyContent:d,isLoading:a,loadingContent:(0,s.jsx)(N.c,{label:"Carregando..."}),children:e=>(0,s.jsx)(g.g,{children:r=>(0,s.jsx)(f.X,{children:c(e,r)})},e.key)})]})})},O=e=>{let{}=e,[r,a]=(0,l.useState)(""),[c,d]=(0,l.useState)("COD_PEDIDO"),[o,i]=(0,l.useState)(!1),[p,h]=(0,l.useState)(null),m=new Date,[u,j]=(0,l.useState)("green"),[N,g]=(0,l.useState)(""),f=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return e.reduce((e,r)=>e+(r.preco||0)*(r.quantidade||0)*((r.al_ipi||0)/100),0)},E=e=>{let{icon:r,label:a,value:l}=e;return(0,s.jsxs)("div",{className:"flex items-start gap-2 py-2",children:[r&&(0,s.jsx)("i",{className:"bi bi-".concat(r," text-primary mt-0.5")}),(0,s.jsxs)("div",{className:"flex-1",children:[(0,s.jsx)("span",{className:"text-default-500 text-xs",children:a}),(0,s.jsx)("p",{className:"font-medium",children:null!=l?l:"-"})]})]})};async function O(){h(null)}function S(e){return e.split(" ")[0]}async function D(e){i(!0),await O();let a=e||r,l=a=a.trim();if(l.length<3)return(0,w.Z9)("Verifique o n\xfamero do pedido e tente novamente");let c=new URL(window.location.href);c.searchParams.set("pedidoc",l),window.history.replaceState({},"",c.toString());let d=await fetch("/api/compras/listar-pedido-compra?pedidoc=".concat(l)).then(e=>e.json());if(null==d?void 0:d.error)return(console.log(d),i(!1),"NOT_FOUND"==d.error)?(0,w.Z9)(d.errMsg,(0,s.jsx)(s.Fragment,{children:(0,s.jsx)("p",{children:"Por favor verifique se o codigo est\xe1 correto!"})})):(0,w.Z9)("Ocorreu um erro ao realizar a consulta do pedido");-2e9==d.filial?(j("orange"),g("/logo-sun21-vcard.png")):(j("green"),g("/logo-mcs.png")),h(d),i(!1)}return(0,l.useEffect)(()=>{let e=new URLSearchParams(window.location.search).get("pedidoc");e&&(a(e),D(e))},[]),(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"print-area-root h-full w-full flex flex-col p-4 mt-[10vh] lg:mt-0",children:[(0,s.jsxs)("div",{className:" div-pedido bg-zinc-950 w-full min-h-[100px] text-lg rounded flex items-center justify-center mb-8 flex-col xl:flex-row p-2",children:[(0,s.jsx)("div",{className:"flex w-full flex-wrap md:flex-nowrap gap-4 print:hidden",children:(0,s.jsx)(v.Y,{type:"text",label:"Buscar pedido",placeholder:"Insira o par\xe2metro de busca",value:r,onKeyDown:e=>{"Enter"===e.key?D():13===e.keyCode&&document.querySelector("#search-ped").click()},id:"pedido",onChange:e=>a(e.target.value)})}),(0,s.jsx)("div",{className:"mt-5 xl:mt-0 xl:ml-3",children:(0,s.jsx)(b.A,{onPress:()=>D(),className:"bg-zinc-800 px-3 py-1 rounded",id:"search-ped",isLoading:o,isDisabled:o,children:o?"Buscando...":"Buscar"})})]}),(0,s.jsx)("div",{className:"div-info-geral bg-zinc-950 w-full text-lg rounded flex flex-col gap-[15px] p-4 min-h-[350px] text-sm print:hidden",children:p?(0,s.jsx)("div",{className:"print:hidden",children:(0,s.jsx)("div",{className:"flex flex-col md:flex-row justify-between gap-3",children:(0,s.jsxs)(n.w,{className:"bg-default-100 w-full",children:[(0,s.jsxs)(x.G,{children:[(0,s.jsxs)("div",{className:"flex justify-between",children:[(0,s.jsxs)("h3",{className:"text-lg font-semibold mb-3 flex items-center gap-2",children:[(0,s.jsx)("i",{className:"bi bi-person"}),"Informa\xe7\xf5es gerais ","(".concat(p.cod_pedidoc,")")||0,p.status_atual?(0,s.jsx)("div",{className:"flex gap-2 flex-wrap",children:(0,s.jsx)(y.z,{color:"primary",children:p.status_atual})}):null]}),(0,s.jsx)(P,{data:p,setIsLoading:i,clearData:O})]}),(0,s.jsxs)("div",{className:"grid grid-cols-2 p-2",children:[(0,s.jsx)(E,{icon:"calendar-check",label:"Data de Emiss\xe3o:",value:S(p.data_emissao)}),(0,s.jsx)(E,{icon:"calendar-event",label:"Data de Entrega:",value:S(p.data_entrega)}),(0,s.jsx)(E,{icon:"calendar-x",label:"Data Limite",value:S(p.data_limite)}),(0,s.jsx)(E,{icon:"archive",label:"Fornecedor",value:p.desc_fornecedor}),(0,s.jsx)(E,{icon:"house",label:"Filial",value:p.desc_filial}),(0,s.jsx)(E,{icon:"currency-dollar",label:"Total",value:(0,_.xG)(p.total+p.v_frete+f(p.produtos))})]}),(0,s.jsxs)("div",{className:"grid grid-cols-2 p-3 gap-3",children:[(0,s.jsxs)("div",{className:"grid grid-cols-2 border-2 border-".concat(u,"-500 rounded-lg p-4"),children:[(0,s.jsxs)("h3",{className:"text-lg font-semibold mb-3 flex items-center gap-2 col-span-2",children:[(0,s.jsx)("i",{className:"bi bi-truck"}),"Fornecedor"]}),(0,s.jsx)(E,{icon:"person",label:"Nome",value:p.desc_fornecedor}),(0,s.jsx)(E,{icon:"building",label:"CNPJ",value:p.cnpj}),(0,s.jsx)(E,{icon:"calendar-x",label:"Ie",value:p.ie}),(0,s.jsx)(E,{icon:"house",label:"Rua",value:p.logradouro}),(0,s.jsx)(E,{icon:"map",label:"Bairro",value:p.bairro}),(0,s.jsx)(E,{icon:"pin-map",label:"Cidade",value:"".concat(p.cidade,"/").concat(p.estado)}),(0,s.jsx)(E,{icon:"geo-alt",label:"CEP",value:p.cep})]}),(0,s.jsxs)("div",{className:"grid grid-cols-2 border-2 border-".concat(u,"-500 rounded-lg p-4"),children:[(0,s.jsxs)("h3",{className:"text-lg font-semibold mb-3 flex items-center gap-2 col-span-2 ",children:[(0,s.jsx)("i",{className:"bi bi-receipt"}),"Pedido"]}),(0,s.jsx)(E,{icon:"currency-dollar",label:"Total",value:(0,_.xG)(p.total+p.v_frete+f(p.produtos))}),(0,s.jsx)(E,{icon:"cash",label:"Valor s/frete s/IPI",value:(0,_.xG)(p.total)}),(0,s.jsx)(E,{icon:"truck",label:"Valor do Frete",value:(0,_.xG)(p.v_frete)}),(0,s.jsx)(E,{icon:"coin",label:"Valor do IPI",value:(0,_.xG)(f(p.produtos))}),(0,s.jsx)(E,{icon:"percent",label:"Desconto (%)",value:(e=>{let r=Number(e||0);
1return"".concat(r.toLocaleString("pt-BR",{minimumFractionDigits:2,maximumFractionDigits:2}),"%")})(p.acerto)}),(0,s.jsx)(E,{icon:"cash-coin",label:"Valor do Desconto",value:(0,_.xG)(p.v_acerto)}),(0,s.jsx)(E,{icon:"wallet",label:"Forma de Pagamento",value:p.condicao_pgto})]})]})]}),(0,s.jsx)("div",{className:"w-full p-3",children:(0,s.jsx)(C,{produtos:p.produtos,isLoading:!1})})]})})}):(0,s.jsx)(s.Fragment,{children:o?(0,s.jsx)("div",{className:"flex flex-col h-full justify-center",children:(0,s.jsx)(t.z,{})}):(0,s.jsx)("div",{className:"text-center text-2xl mt-2",children:"Realize uma busca"})})})]}),p?(0,s.jsx)("div",{className:"w-full h-full pt-[25px] hidden print:block",children:(0,s.jsxs)("div",{className:"bg-white text-black",children:[(0,s.jsxs)("div",{className:"flex justify-between p-2 border-black border-b-2 font-bold",children:[(0,s.jsx)("div",{className:"text-xl font-bold",children:"PEDIDO DE COMPRA"}),(0,s.jsx)(k.J,{src:N,alt:"Minha Casa Solar Logo",draggable:"false",width:150,priority:!0}),(0,s.jsxs)("div",{className:"text-xl font-bold",children:[m.toLocaleDateString("pt-BR")," ",m.toLocaleTimeString("pt-BR",{hour:"2-digit",minute:"2-digit"})]})]}),(0,s.jsx)("div",{className:"w-full flex justify-center mt-4"}),(0,s.jsxs)("div",{className:"flex gap-4 p-3 items-stretch",children:[(0,s.jsxs)("table",{className:"table-auto w-[75%] h-full border-collapse border border-black",children:[(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{className:"bg-".concat(u,"-500 text-white"),children:[(0,s.jsx)("th",{className:"border border-black px-4 py-2",children:"Empresa"}),(0,s.jsx)("th",{className:"border border-black px-4 py-2",children:"CNPJ"}),(0,s.jsx)("th",{className:"border border-black px-4 py-2",children:"Ie"})]})}),(0,s.jsx)("tbody",{children:(0,s.jsxs)("tr",{className:"text-lg",children:[(0,s.jsx)("td",{className:"border border-black px-4 py-2 text-sm",children:p.desc_filial}),(0,s.jsx)("td",{className:"border border-black px-4 py-2 text-sm",children:p.cnpj_filial}),(0,s.jsx)("td",{className:"border border-black px-4 py-2 text-sm",children:p.ie_filial})]})})]}),(0,s.jsxs)("table",{className:"border-collapse border border-black w-[30%]",children:[(0,s.jsx)("thead",{children:(0,s.jsx)("tr",{className:"bg-".concat(u,"-500 text-white"),children:(0,s.jsx)("th",{className:"border border-black px-4 py-2",colSpan:"2",children:"N\xfamero do Pedido"})})}),(0,s.jsxs)("tbody",{children:[(0,s.jsx)("tr",{children:(0,s.jsx)("td",{className:"border border-black px-4 py-2 w-full text-4xl font-bold text-center",colSpan:"2",children:p.cod_pedidoc})}),(0,s.jsxs)("tr",{className:"bg-".concat(u,"-500 text-white"),children:[(0,s.jsx)("th",{className:"border border-black px-4 py-2",children:"Data do Pedido"}),(0,s.jsx)("th",{className:"border border-black px-4 py-2",children:"Data de Entrega"})]}),(0,s.jsxs)("tr",{children:[(0,s.jsx)("td",{className:"border border-black px-4 py-2 text-center text-lg",children:S(p.data_emissao)}),(0,s.jsx)("td",{className:"border border-black px-4 py-2 text-center text-lg",children:S(p.data_entrega)})]})]})]})]}),(0,s.jsx)("div",{className:"flex gap-4 p-3 items-stretch",children:(0,s.jsxs)("table",{className:"table-auto w-full h-full border-collapse border border-black text-sm",children:[(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{className:"bg-".concat(u,"-500 text-white"),children:[(0,s.jsx)("th",{className:"border border-black px-4 py-2",children:"Fornecedor"}),(0,s.jsx)("th",{className:"border border-black px-4 py-2",children:"CNPJ"}),(0,s.jsx)("th",{className:"border border-black px-4 py-2",children:"Ie"})]})}),(0,s.jsx)("tbody",{children:(0,s.jsxs)("tr",{className:"",children:[(0,s.jsx)("td",{className:"border border-black px-4 py-2",children:p.desc_fornecedor}),(0,s.jsx)("td",{className:"border border-black px-4 py-2",children:p.cnpj||"-"}),(0,s.jsx)("td",{className:"border border-black px-4 py-2",children:p.ie||"-"})]})})]})}),(0,s.jsx)("div",{className:"flex gap-4 p-3 items-stretch",children:(0,s.jsxs)("table",{className:"table-auto w-full h-full border-collapse border border-black text-sm",children:[(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{className:"bg-".concat(u,"-500 text-white"),children:[(0,s.jsx)("th",{className:"border border-black px-4 py-2",children:"Endere\xe7o"}),(0,s.jsx)("th",{className:"border border-black px-4 py-2",children:"Bairro"}),(0,s.jsx)("th",{className:"border border-black px-4 py-2",children:"CEP"}),(0,s.jsx)("th",{className:"border border-black px-4 py-2",children:"Cidade"}),(0,s.jsx)("th",{className:"border border-black px-4 py-2",children:"Estado"})]})}),(0,s.jsx)("tbody",{children:(0,s.jsxs)("tr",{className:"text-sm",children:[(0,s.jsx)("td",{className:"border border-black px-4 py-2",children:p.logradouro}),(0,s.jsx)("td",{className:"border border-black px-4 py-2",children:p.bairro}),(0,s.jsx)("td",{className:"border border-black px-4 py-2",children:p.cep}),(0,s.jsx)("td",{className:"border border-black px-4 py-2",children:p.cidade}),(0,s.jsx)("td",{className:"border border-black px-4 py-2",children:p.estado})]})})]})}),(0,s.jsxs)("div",{className:"m-6 border-5 border-".concat(u,"-500 rounded-lg p-4 print-break-inside-avoid"),children:[(0,s.jsx)("h1",{className:"w-full text-center font-bold text-2xl padding-b-2",children:"Observa\xe7\xf5es Gerais"}),(0,s.jsxs)("ul",{className:"text-lg space-y-2 whitespace-pre-line text-sm",children:[(0,s.jsx)("li",{children:"- Endere\xe7o de Cobran\xe7a: R. Um, 891 - Bairro do Com\xe9rcio, Contagem - MG, 32152-002"}),(0,s.jsx)("li",{children:"- Endere\xe7o de Entrega: R. Um, 891 - Bairro do Com\xe9rcio, Contagem - MG, 32152-002"}),(0,s.jsx)("li",{children:"- A NF-e e o XML dever\xe3o ser encaminhados para o email: [email protected]; [email protected]"}),(0,s.jsx)("li",{children:"- Os Boletos Banc\xe1rios dever\xe3o ser encaminhados para o email: [email protected]"}),(0,s.jsx)("li",{children:"- O hor\xe1rio de recebimento das mercadorias \xe9 de Segunda \xe0 Sexta de 8:00 \xe0s 17:00Hs;"}),(0,s.jsx)("li",{children:"- Uma c\xf3pia deste pedido dever\xe1 estar anexada na Nota Fiscal, caso contr\xe1rio, correr\xe1 o risco da mercadoria ser recusada no ato da entrega."})]})]}),(0,s.jsxs)("div",{className:"print:break-inside-avoid",children:[(0,s.jsx)("h1",{className:"w-full text-center font-bold text-3xl",children:"Itens do Pedido"}),(0,s.jsx)("div",{className:"flex gap-4 p-3 m-1 print:px-3",children:(0,s.jsxs)("table",{className:"table-auto w-full mx-auto border-collapse border border-black text-sm",children:[(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{className:"bg-".concat(u,"-500 text-white text-base"),children:[(0,s.jsx)("th",{className:"border border-black px-3 py-2 text-left",children:"C\xf3digo"}),(0,s.jsx)("th",{className:"border border-black px-3 py-2 text-left",colSpan:2,children:"Descri\xe7\xe3o do produto"}),(0,s.jsx)("th",{className:"border border-black px-3 py-2",children:"NCM"}),(0,s.jsx)("th",{className:"border border-black px-3 py-2",children:"Peso Total"}),(0,s.jsx)("th",{className:"border border-black px-3 py-2",children:"Qtd"}),(0,s.jsx)("th",{className:"border border-black px-3 py-2",children:"Valor Unit. s/IPI"}),(0,s.jsx)("th",{className:"border border-black px-3 py-2",children:"Valor Total"})]})}),(0,s.jsx)("tbody",{children:p.produtos.map((e,r)=>(0,s.jsxs)("tr",{className:"align-top odd:bg-gray-50 print:break-inside-avoid",children:[(0,s.jsx)("td",{className:"border border-black px-3 py-2 text-left",children:e.cod_produto}),(0,s.jsx)("td",{className:"border border-black px-3 py-2 text-left",colSpan:2,children:(0,s.jsxs)("div",{className:"flex gap-3",children:[(0,s.jsx)("div",{children:(0,s.jsx)("img",{src:"https://app2.vendedor.sun2
11.com.br/products/product-".concat(e.produto,".webp"),draggable:"false",width:100,onError:e=>{var r;(r=e.target).onerror="",r.src="/sun-icon.svg",r.srcset="/sun-icon.svg"}})}),(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"font-medium",children:e.descricao1}),(0,s.jsxs)("div",{className:"text-xs text-gray-700 mt-1 space-y-0.5",children:[(0,s.jsxs)("div",{children:["Largura: ",e.largura,"cm"]}),(0,s.jsxs)("div",{children:["Altura: ",e.altura,"cm"]}),(0,s.jsxs)("div",{children:["Comprimento: ",e.comprimento,"cm"]}),(0,s.jsxs)("div",{children:["Peso: ",e.peso,"kg"]}),(0,s.jsxs)("div",{children:["Valor Unit\xe1rio: ",(0,_.xG)(e.preco)]})]})]})]})}),(0,s.jsx)("td",{className:"border border-black px-3 py-2 text-center",children:e.cod_ncm}),(0,s.jsx)("td",{className:"border border-black px-3 py-2 text-right",children:"".concat(e.peso*e.quantidade," Kg")}),(0,s.jsx)("td",{className:"border border-black px-3 py-2 text-center",children:e.quantidade}),(0,s.jsx)("td",{className:"border border-black px-3 py-2 text-right",children:(0,_.xG)(e.preco-e.preco*(e.al_ipi/100))}),(0,s.jsx)("td",{className:"border border-black px-3 py-2 text-right font-semibold",children:(0,_.xG)(e.preco*e.quantidade)})]},r))})]})})]}),(0,s.jsxs)("div",{className:"flex gap-4 p-3 items-stretch",children:[(0,s.jsxs)("table",{className:"table-auto w-[25%] h-full border-collapse border border-black",children:[(0,s.jsx)("thead",{children:(0,s.jsx)("tr",{className:"bg-".concat(u,"-500 text-white"),children:(0,s.jsx)("th",{className:"border border-black px-4 py-2",children:"Valor Total de IPI"})})}),(0,s.jsx)("tbody",{children:(0,s.jsx)("tr",{className:"text-lg",children:(0,s.jsx)("td",{className:"border border-black px-4 py-2",children:(0,_.xG)(f(p.produtos))})})})]}),(0,s.jsxs)("table",{className:"table-auto w-[25%] h-full border-collapse border border-black",children:[(0,s.jsx)("thead",{children:(0,s.jsx)("tr",{className:"bg-".concat(u,"-500 text-white"),children:(0,s.jsx)("th",{className:"border border-black px-4 py-2",children:"Valor do Frete"})})}),(0,s.jsx)("tbody",{children:(0,s.jsx)("tr",{className:"text-lg",children:(0,s.jsx)("td",{className:"border border-black px-4 py-2",children:(0,_.xG)(p.v_frete)})})})]}),(0,s.jsxs)("table",{className:"table-auto w-[25%] h-full border-collapse border border-black",children:[(0,s.jsx)("thead",{children:(0,s.jsx)("tr",{className:"bg-".concat(u,"-500 text-white"),children:(0,s.jsx)("th",{className:"border border-black px-4 py-2",children:"Valor Desconto"})})}),(0,s.jsx)("tbody",{children:(0,s.jsx)("tr",{className:"text-lg",children:(0,s.jsx)("td",{className:"border border-black px-4 py-2",children:(0,_.xG)(p.v_acerto+function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return e.reduce((e,r)=>e+(r.desconto||0)*(r.quantidade||0),0)}(p.produtos))})})})]}),(0,s.jsxs)("table",{className:"table-auto w-[25%] h-full border-collapse border border-black",children:[(0,s.jsx)("thead",{children:(0,s.jsx)("tr",{className:"bg-".concat(u,"-500 text-white"),children:(0,s.jsx)("th",{className:"border border-black px-4 py-2",children:"Peso Total"})})}),(0,s.jsx)("tbody",{children:(0,s.jsx)("tr",{className:"text-lg",children:(0,s.jsx)("td",{className:"border border-black px-4 py-2",children:"".concat(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return e.reduce((e,r)=>Number((e+(r.peso||0)*(r.quantidade||0)).toFixed(2)),0)}(p.produtos),"kg")})})})]})]}),(0,s.jsx)("div",{className:"flex gap-4 p-3 items-stretch",children:(0,s.jsxs)("table",{className:"table-auto w-full h-full border-collapse border border-black",children:[(0,s.jsx)("thead",{children:(0,s.jsx)("tr",{className:"bg-".concat(u,"-500 text-white"),children:(0,s.jsx)("th",{className:"border border-black px-4 py-2 ",children:"Total do pedido"})})}),(0,s.jsx)("tbody",{children:(0,s.jsx)("tr",{className:"text-lg",children:(0,s.jsx)("td",{className:"border border-black px-4 py-2",children:(0,_.xG)(p.total+p.v_frete+f(p.produtos))})})})]})}),(0,s.jsx)("div",{className:"flex gap-4 p-3 items-stretch",children:(0,s.jsxs)("table",{className:"table-auto w-full h-full border-collapse border border-black",children:[(0,s.jsx)("thead",{children:(0,s.jsx)("tr",{className:"bg-".concat(u,"-500 text-white"),children:(0,s.jsx)("th",{className:"border border-black px-4 py-2 text-left",children:"Observa\xe7\xf5es do Pedido"})})}),(0,s.jsx)("tbody",{children:(0,s.jsx)("tr",{className:"text-lg",children:(0,s.jsx)("td",{className:"border border-black px-4 py-2",children:p.obs||"-"})})})]})}),(0,s.jsxs)("div",{className:"[&_*]:print-break-inside-avoid break-inside-avoid print:block",children:[(0,s.jsx)("h1",{className:"w-full text-center font-bold text-3xl",children:"Condi\xe7\xf5es de Pagamento"}),(0,s.jsx)("div",{className:"flex gap-4 p-3 items-stretch ",children:(0,s.jsxs)("table",{className:"table-auto w-full h-full border-collapse border border-black",children:[(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{className:"bg-".concat(u,"-500 text-white "),children:[(0,s.jsx)("th",{className:"border border-black px-4 py-2 text-left ",children:"Data de Vencimento"}),(0,s.jsx)("th",{className:"border border-black px-4 py-2 text-left ",children:"Valor do T\xedtulo"}),(0,s.jsx)("th",{className:"border border-black px-4 py-2 text-left ",children:"Tipo de Pagamentos"})]})}),(0,s.jsx)("tbody",{children:p.titulos&&p.titulos.filter(e=>null!=e.doc_origem).length>0?p.titulos.filter(e=>null!=e.doc_origem).map((e,r)=>(0,s.jsxs)("tr",{className:"text-lg ",children:[(0,s.jsx)("td",{className:"border border-black px-4 py-2",children:S(e.data_vencimento)}),(0,s.jsx)("td",{className:"border border-black px-4 py-2",children:(0,_.xG)(-((0===r?e.valor_original<0?e.valor_original-p.v_frete:e.valor_original+p.v_frete:e.valor_original)*1))}),(0,s.jsx)("td",{className:"border border-black px-4 py-2",children:p.condicao_pgto})]},r)):(0,s.jsxs)("tr",{className:"text-lg",children:[(0,s.jsx)("td",{className:"border border-black px-4 py-2",children:S(p.data_limite)}),(0,s.jsx)("td",{className:"border border-black px-4 py-2",children:(0,_.xG)(p.total+p.v_frete)}),(0,s.jsx)("td",{className:"border border-black px-4 py-2",children:p.condicao_pgto})]})})]})})]})]})}):(0,s.jsx)(s.Fragment,{})]})};function S(){let{data:e,status:r}=(0,c.useSession)();return"loading"===r?(0,s.jsx)(t.e,{session:e}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(i(),{children:[(0,s.jsx)("title",{children:"Listar Pedido de Compra"}),(0,s.jsx)("style",{children:"\n @media print {\n @page {\n size: landscape;\n margin: 20mm;\n }\n }\n "})]}),(0,s.jsx)(d.Z,{session:e,newUI:!0,children:(0,s.jsx)(O,{session:e})})]})}}},function(e){e.O(0,[9047,8443,5675,8628,9643,3858,6319,4640,2319,2142,2888,9774,179],function(){return e(e.s=76718)}),_N_E=e.O()}]);
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.