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