import{b as f}from"./chunk-CPFCOPJN.js";import{b as r}from"./chunk-NMAI6SSY.js";import{a,b as P}from"./chunk-NUAVJ2U7.js";import{c as p,d as h}from"./chunk-E7BKRPHP.js";import{F as v,k as y,la as O}from"./chunk-PGS4AHIT.js";var g=function(c){return c.NotSerial="N",c}(g||{}),o=function(c){return c.K="K",c}(o||{}),u=function(c){return c.Move="M",c.Receive="P",c.Order="O",c}(u||{});P();h();O();var m=class{static documentTypeLabel(n){switch(n){case r.POS:case r.Wholesale:case r.ReceivedBills:return"ConnectionTypeTrafic";case r.IssuedAdvancePayment:case r.ReceivingAdvancePayment:case r.AdvancePayment:return"ConnectionTypeAdvPay";case r.BuyerOrder:case r.SupplierOrder:case r.Orders:return"ConnectionTypeOrder";case r.Documents:case r.Archive:return"ConnectionTypeDocument";case r.InventoryExcess:return"ConnectionTypeExcess";case r.InventoryShortage:return"ConnectionTypeShortage"}return""}static documentTypeColor(n){switch(n){case r.POS:case r.Wholesale:case r.ReceivedBills:return"yellow";case r.IssuedAdvancePayment:case r.ReceivingAdvancePayment:case r.AdvancePayment:return"orange";case r.BuyerOrder:case r.SupplierOrder:case r.Orders:return"red";case r.Documents:case r.Archive:return"green";case r.InventoryExcess:return"cyan";case r.InventoryShortage:return"dark-pink"}return"no-fill"}static documentTypeLink(n,e){switch(n){case r.POS:return`${a.backofficeUrl}CashRegister/Index?acKey=`+e;case r.Wholesale:return`${a.backofficeUrl}Wholesale/Edit?id=`+e;case r.ReceivedBills:return`${a.backofficeUrl}ReceivedBills/Edit?id=`+e;case r.IssuedAdvancePayment:return`${a.backofficeUrl}AdvancePayment/EditIssuedAdvancePayment?id=`+e;case r.ReceivingAdvancePayment:case r.AdvancePayment:return`${a.backofficeUrl}AdvancePayment/EditReceivingAdvancePayment?id=`+e;case r.Orders:case r.BuyerOrder:return`${a.backofficeUrl}Order/EditBuyerOrder?id=`+e;case r.SupplierOrder:return`${a.backofficeUrl}Order/EditSupplierOrder?id=`+e;case r.Documents:case r.Archive:return`${a.backofficeUrl}Documents/Edit?qId=`+e;case r.InventoryExcess:return`${a.backofficeUrl}Inventory/ExcessOrMissing?inventoryType=E&id=`+e;case r.InventoryShortage:return`${a.backofficeUrl}Inventory/ExcessOrMissing?inventoryType=S&id=`+e}return""}static checkForZeros(n,e,t,s){(n.quantity===0||n[e]===0)&&t.openTyped({type:"error",text:s.instant("InoicePositionQuantityOrPrice0Warning",{0:n.anNo+" - "+n.name}),confirmButtonLabel:"Ok",denyButtonLabel:null})}static openSerialNumbersDialog(n,e,t,s,i=()=>{},d=!0){!t||e.serialNo==="N"||e.serialNo===""||(s?n.serialNumbersAutoEdition({acKey:e.acKey,docType:t.docType,date:t.invoiceDate??new Date,anNo:e.anNo,ident:e.ident,issuer:t.issuerId||"",receiver:t.receiverId||"",quantityOld:0,quantityNew:e.quantity,type:o.K,invoiceType:u.Move},e,i):n.isDialogOpen()||n.openDialog(e,t.receiverId||"",o.K,u.Move,!1,t.date??new Date,t.issuerId,!0,null,i,d))}static getIdentRabate(n,e,t){return n>0?n:e>0?e:t}static displayUpdateErrors(n,e){e&&e&&p.isSet(e.error)&&e.error!==""&&n.openTyped({type:"error",text:e.error??"GeneralError",confirmButtonLabel:"Ok",denyButtonLabel:null})}static updateIdentDiscount(n,e,t,s){return y(this,null,function*(){let i=0;if(f.DiscountPercent===e.fieldId)i=e.discountPercent;else if(f.Discount===e.fieldId){let d=e.value+e.tax;i=e.discount/(d||1)*100}return yield v(s.updateIdentsDiscount({acKey:n,discount:Math.max(Math.min(i,100),0),author:t}))})}static getSpecPayments(){let n=[];return n.push({value:null,label:""},{value:l.TrafficFreeOfCharge,label:"TrafficFreeOfCharge"},{value:l.SinglePurposeVouchers,label:"SinglePurposeVouchers"}),n}static setSubjectLabel(n,e,t="Subject"){n&&(n.label=e&&e.trim()!==""?e:t)}},I=function(c){return c.Confimed="P",c.Unconfirmed="N",c}(I||{}),l=function(c){return c.SinglePurposeVouchers="V",c.TrafficFreeOfCharge="N",c}(l||{});export{g as a,o as b,u as c,m as d,I as e};
