<#-- @ftlvariable name="data" type="com.dantek.dl.template.model.balancestatement.BalanceStatementTemplateDataModel" --> <#assign inEnglish = data.loaner?? && data.loaner.preferredLanguage?? && data.loaner.preferredLanguage == "en"> <#if inEnglish> Statement <#else> Saldoopgørelse <#setting number_format=",##0.00"> <#if inEnglish> <#setting locale="en_GB"> <#else> <#setting locale="da_DK"> <#assign numberOfDays= 90> <#-- This variable decides when a material is so old it needs to be shown in the lowest part. --> <#assign timeLimitDK = "90 dage"> <#-- This variable is the DK text corresponding to the numberOfDays. --> <#assign timeLimitEN = "90 days"> <#-- This variable is the EN text corresponding to the numberOfDays. --> <#assign todaysDayMinusNumberOfDays = .now?long - (1000 * 60 * 60 * 24 * numberOfDays)> <#assign newBalanceDayLimit= todaysDayMinusNumberOfDays?number_to_date> <#assign anyOldFees=false /> <#assign anyOldCompensations=false /> <#assign oldFees = []/> <#assign oldCompensations = []/> <#assign sumOfOldFees = 0> <#assign sumOfOldCompensations = 0> <#assign sumOfOldMaterials = 0> <#assign anyNewFees=false /> <#assign anyNewCompensations=false /> <#assign newFees = []/> <#assign newCompensations = []/> <#assign sumOfNewFees = 0> <#assign sumOfNewCompensations = 0> <#assign sumOfNewMaterials = 0> <#assign anyFeesSentToCollection=false /> <#assign anyCompensationsSentToCollection=false /> <#assign feesSentToCollection = []/> <#assign compensationsSentToCollection = []/> <#assign sumOfFeesSentToCollection = 0> <#assign sumOfCompensationsSentToCollection = 0> <#assign sumOfBalancesSentToCollection = 0> <#assign totalSumOfBalancesNotSentToCollection = 0> <#assign totalSumOfAllBalances = 0> <#if (data.fees?has_content)> <#list data.fees as fee> <#if (fee.balanceDate?date < newBalanceDayLimit?date && fee.state='CREATED')> <#assign anyOldFees=true /> <#assign oldFees = oldFees + [fee]/> <#assign sumOfOldFees = sumOfOldFees + fee.amount/> <#assign sumOfOldMaterials = sumOfOldMaterials + fee.amount/> <#assign totalSumOfBalancesNotSentToCollection = totalSumOfBalancesNotSentToCollection + fee.amount/> <#elseif fee.state='CREATED'> <#assign anyNewFees=true /> <#assign newFees = newFees + [fee]/> <#assign sumOfNewFees = sumOfNewFees + fee.amount/> <#assign sumOfNewMaterials = sumOfNewMaterials + fee.amount/> <#assign totalSumOfBalancesNotSentToCollection = totalSumOfBalancesNotSentToCollection + fee.amount/> <#elseif fee.state='SENT_TO_COLLECTION'> <#assign anyFeesSentToCollection=true /> <#assign feesSentToCollection = feesSentToCollection + [fee]/> <#assign sumOfFeesSentToCollection = sumOfFeesSentToCollection + fee.amount/> <#assign sumOfBalancesSentToCollection = sumOfBalancesSentToCollection + fee.amount/> <#assign totalSumOfAllBalances = totalSumOfAllBalances + fee.amount/> <#if (data.compensations?has_content)> <#list data.compensations as compensation> <#if (compensation.balanceDate?date < newBalanceDayLimit?date) && compensation.state='CREATED'> <#assign anyOldCompensations=true /> <#assign oldCompensations = oldCompensations + [compensation]/> <#assign sumOfOldCompensations = sumOfOldCompensations + compensation.amount/> <#assign sumOfOldMaterials = sumOfOldMaterials + compensation.amount/> <#assign totalSumOfBalancesNotSentToCollection = totalSumOfBalancesNotSentToCollection + compensation.amount/> <#elseif compensation.state='CREATED'> <#assign anyNewCompensations=true /> <#assign newCompensations = newCompensations + [compensation]/> <#assign sumOfNewCompensations = sumOfNewCompensations + compensation.amount/> <#assign sumOfNewMaterials = sumOfNewMaterials + compensation.amount/> <#assign totalSumOfBalancesNotSentToCollection = totalSumOfBalancesNotSentToCollection + compensation.amount/> <#elseif compensation.state='SENT_TO_COLLECTION'> <#assign anyCompensationsSentToCollection=true /> <#assign compensationsSentToCollection = compensationsSentToCollection + [compensation]/> <#assign sumOfCompensationsSentToCollection = sumOfCompensationsSentToCollection + compensation.amount/> <#assign sumOfBalancesSentToCollection = sumOfBalancesSentToCollection + compensation.amount/> <#assign totalSumOfAllBalances = totalSumOfAllBalances + compensation.amount/> <#if inEnglish> <#else>

<#if (data.loaner.coName?has_content)>${data.loaner.coName}

${data.agency.name}
${data.loaner.name} Balance statementSaldoopgørelse
<#if (data.loaner.addressStreet?has_content)>${data.loaner.addressStreet}
<#if (data.loaner.zipCode?has_content||data.loaner.addressCity?has_content)>${(data.loaner.zipCode )!""} ${(data.loaner.addressCity)!""}
<#if inEnglish> Patron number: ${data.loaner.loanerNumber} <#else> Lånernr.: ${data.loaner.loanerNumber} <#if inEnglish> Print Date ${.now?string("dd/MM-yyyy")} <#else> Udskrevet den ${.now?string("dd/MM-yyyy")}

<#if inEnglish> Dear ${data.loaner.name}

We can see that you have an outstanding balance with the library. Therefore, we have sent you a balance statement. <#if data.compensations?has_content> If materials are handed in in good condition, you only have to pay fees. <#else> Kære ${data.loaner.name}

Vi kan se, at du har udestående med biblioteket. Vi har derfor sendt dig en saldoopgørelse. <#if data.compensations?has_content> Afleveres materialer i god stand, kan du nøjes med at betale gebyrer.

<#if anyNewFees || anyNewCompensations>

<#if inEnglish> The following statements are created within the last ${timeLimitEN}: <#else> Mellemværender oprettet indenfor de seneste ${timeLimitDK}:

<#if anyNewFees>

<#if inEnglish> Fees <#else> Gebyrer

<#list newFees as fee> <#if inEnglish> <#else> <#if (fee.materialLoans?has_content)> <#list fee.materialLoans as materialLoan> <#if (fee_has_next)>
${fee.billNumber} <#if (fee.text?has_content)>${(fee.text)[0..*30]}<#if (fee.text?has_content && fee.loanDate?has_content)>, <#if inEnglish> Loan time: <#else> Udlånt: ${(fee.loanDate?string("dd/MM-yyyy"))!""} ${fee.amount} kr.${fee.amount} kr.
${materialLoan.materialNumber!""}, <#if (materialLoan.author?has_content)>${(materialLoan.author)[0..*30]}, <#if (materialLoan.title?has_content)> ${(materialLoan.title)[0..*30]} <#if (materialLoan.periodicalName)??>(${(materialLoan.periodicalName)})
<#if inEnglish> <#if fee.returnDate?has_content>Hand-in deadline: ${fee.returnDate?string["dd/MM-yyyy"]}
Fee created: ${(fee.balanceDate?date?string["dd/MM-yyyy"])!""}<#if fee.dueDate?has_content>. Payment deadline: ${fee.dueDate?string["dd/MM-yyyy"]} <#else> <#if fee.returnDate?has_content>Afleveringsfrist: ${fee.returnDate?string["dd/MM-yyyy"]}
Gebyr oprettet: ${(fee.balanceDate?date?string["dd/MM-yyyy"])!""}<#if fee.dueDate?has_content>. Betalingsfrist: ${fee.dueDate?string["dd/MM-yyyy"]}
Sum   ${sumOfNewFees} kr.

<#if anyNewCompensations>

<#if inEnglish> Compensations <#else> Erstatninger

<#list newCompensations as compensation> <#if inEnglish> <#else> <#if (compensation.materialLoan?has_content)> <#if (compensation_has_next)>
${compensation.billNumber}<#if compensation.migratedBillNumber??> (${compensation.migratedBillNumber}) <#if (compensation.text?has_content)>${(compensation.text)[0..*30]}<#if (compensation.materialLoan?has_content && compensation.materialLoan.loanDate?has_content)><#if (compensation.text?has_content)>, <#if inEnglish> Loan time: <#else> Udlånt: ${(compensation.materialLoan.loanDate?string("dd/MM-yyyy"))} ${compensation.amount} kr.${compensation.amount} kr.
${compensation.materialLoan.materialNumber!""}, <#if (compensation.materialLoan.author?has_content)> ${(compensation.materialLoan.author)[0..*30]}, <#if (compensation.materialLoan.title?has_content)> ${(compensation.materialLoan.title)[0..*30]} <#if (compensation.materialLoan.periodicalName)??>(${(compensation.materialLoan.periodicalName)})
<#if inEnglish> <#if compensation.returnDate?has_content>Hand-in deadline: ${compensation.returnDate?string["dd/MM-yyyy"]}
Compensation created: ${(compensation.balanceDate?date?string["dd/MM-yyyy"])!""}<#if compensation.dueDate?has_content>. Payment deadline: ${compensation.dueDate?string["dd/MM-yyyy"]} <#else> <#if compensation.returnDate?has_content>Afleveringsfrist: ${compensation.returnDate?string["dd/MM-yyyy"]}
Erstatning oprettet: ${(compensation.balanceDate?date?string["dd/MM-yyyy"])!""}<#if compensation.dueDate?has_content>. Betalingsfrist: ${compensation.dueDate?string["dd/MM-yyyy"]}
Sum   ${sumOfNewCompensations} kr.
<#if inEnglish> <#else>
Total sum of balances created in the last ${timeLimitEN}   ${sumOfNewMaterials} kr.
Samlet sum af mellemværende oprettet indenfor de seneste ${timeLimitDK}   ${sumOfNewMaterials} kr.
<#if anyOldFees || anyOldCompensations>

<#if inEnglish> Balances older than ${timeLimitEN}.
Note: These will soon be sent to collection. You can avoid this by paying them before the due date. <#else> Mellemværender ældre end ${timeLimitDK}.
Bemærk: Disse vil snart overgå til inkasso. Du kan undgå dette, hvis du betaler inden betalingsfristen.

<#if anyOldFees>

<#if inEnglish> Fees <#else> Gebyrer

<#list oldFees as fee> <#if inEnglish> <#else> <#if (fee.materialLoans?has_content)> <#list fee.materialLoans as materialLoan> <#if (fee_has_next)>
${fee.billNumber} <#if (fee.text?has_content)>${(fee.text)[0..*30]}<#if (fee.text?has_content && fee.loanDate?has_content)>, <#if inEnglish> Loan time: <#else> Udlånt: ${(fee.loanDate?string("dd/MM-yyyy"))!""} ${fee.amount} kr.${fee.amount} kr.
${materialLoan.materialNumber!""}, <#if (materialLoan.author?has_content)>${(materialLoan.author)[0..*30]}, <#if (materialLoan.title?has_content)> ${(materialLoan.title)[0..*30]} <#if (materialLoan.periodicalName)??>(${(materialLoan.periodicalName)})
<#if inEnglish> <#if fee.returnDate?has_content>Hand-in deadline: ${fee.returnDate?string["dd/MM-yyyy"]}
Fee created: ${(fee.balanceDate?date?string["dd/MM-yyyy"])!""}<#if fee.dueDate?has_content>. Payment deadline: ${fee.dueDate?string["dd/MM-yyyy"]} <#else> <#if fee.returnDate?has_content>Afleveringsfrist: ${fee.returnDate?string["dd/MM-yyyy"]}
Gebyr oprettet: ${(fee.balanceDate?date?string["dd/MM-yyyy"])!""}<#if fee.dueDate?has_content>. Betalingsfrist: ${fee.dueDate?string["dd/MM-yyyy"]}
Sum   ${sumOfOldFees} kr.

<#if anyOldCompensations>

<#if inEnglish> Compensations <#else> Erstatninger

<#list oldCompensations as compensation> <#if inEnglish> <#else> <#if (compensation.materialLoan?has_content)> <#if (compensation_has_next)>
${compensation.billNumber}<#if compensation.migratedBillNumber??> (${compensation.migratedBillNumber}) <#if (compensation.text?has_content)>${(compensation.text)[0..*30]} <#if (compensation.materialLoan?has_content && compensation.materialLoan.loanDate?has_content)> <#if (compensation.text?has_content)>, <#if inEnglish> Loan time: <#else> Udlånt: ${(compensation.materialLoan.loanDate?string("dd/MM-yyyy"))} ${compensation.amount} kr.${compensation.amount} kr.
${compensation.materialLoan.materialNumber!""}, <#if (compensation.materialLoan.author?has_content)> ${(compensation.materialLoan.author)[0..*30]}, <#if (compensation.materialLoan.title?has_content)> ${(compensation.materialLoan.title)[0..*30]} <#if (compensation.materialLoan.periodicalName)??>(${(compensation.materialLoan.periodicalName)})
<#if inEnglish> <#if compensation.returnDate?has_content>Hand-in deadline: ${compensation.returnDate?string["dd/MM-yyyy"]}
Compensation created: ${(compensation.balanceDate?date?string["dd/MM-yyyy"])!""}<#if compensation.dueDate?has_content>. Payment deadline: ${compensation.dueDate?string["dd/MM-yyyy"]} <#else> <#if compensation.returnDate?has_content>Afleveringsfrist: ${compensation.returnDate?string["dd/MM-yyyy"]}
Erstatning oprettet: ${(compensation.balanceDate?date?string["dd/MM-yyyy"])!""}<#if compensation.dueDate?has_content>. Betalingsfrist: ${compensation.dueDate?string["dd/MM-yyyy"]}
Sum   ${sumOfOldCompensations} kr.
<#else> Samlet sum af mellemværende ældre end ${timeLimitDK}   ${sumOfOldMaterials} kr.
<#if inEnglish> Total sum of balances created in the last ${timeLimitEN}   ${sumOfOldMaterials} kr.
<#if (totalSumOfBalancesNotSentToCollection > 0) >

<#if inEnglish> Total amount owed to the library   ${totalSumOfBalancesNotSentToCollection} kr. <#else> Dit samlede mellemværende med biblioteket   ${totalSumOfBalancesNotSentToCollection} kr.
<#if anyFeesSentToCollection || anyCompensationsSentToCollection >

<#if inEnglish> You have the following balances that have been sent to collection. These cannot be paid at the library, but must be paid at the municipality. <#else> Du har følgende mellemværender, der er sendt til inddrivelse. Disse kan ikke betales på biblioteket, men skal betales ved henvendelse til kommunen. <#if anyFeesSentToCollection>

<#if inEnglish> Fees <#else> Gebyrer

<#list feesSentToCollection as fee> <#if inEnglish> <#else> <#if (fee.materialLoans?has_content)> <#list fee.materialLoans as materialLoan> <#if (fee_has_next)>
${fee.billNumber} <#if (fee.text?has_content)>${(fee.text)[0..*30]}<#if (fee.text?has_content && fee.loanDate?has_content)>, <#if inEnglish> Loan time: <#else> Udlånt: ${(fee.loanDate?string("dd/MM-yyyy"))!""} ${fee.amount} kr.${fee.amount} kr.
${materialLoan.materialNumber!""}, <#if (materialLoan.author?has_content)>${(materialLoan.author)[0..*30]}, <#if (materialLoan.title?has_content)> <#if (materialLoan.author?has_content)> ${(materialLoan.title)[0..*30]} <#if (materialLoan.periodicalName)??>(${(materialLoan.periodicalName)})
<#if inEnglish> <#if fee.returnDate?has_content>Hand-in deadline: ${fee.returnDate?string["dd/MM-yyyy"]}
Fee created: ${(fee.balanceDate?date?string["dd/MM-yyyy"])!""}<#if fee.dueDate?has_content>. Payment deadline: ${fee.dueDate?string["dd/MM-yyyy"]} <#else> <#if fee.returnDate?has_content>Afleveringsfrist: ${fee.returnDate?string["dd/MM-yyyy"]}
Gebyr oprettet: ${(fee.balanceDate?date?string["dd/MM-yyyy"])!""}<#if fee.dueDate?has_content>. Betalingsfrist: ${fee.dueDate?string["dd/MM-yyyy"]}
Sum   ${sumOfFeesSentToCollection} kr.

<#if anyCompensationsSentToCollection>

<#if inEnglish> Compensations <#else> Erstatninger

<#list compensationsSentToCollection as compensation> <#if inEnglish> <#else> <#if (compensation.materialLoan?has_content)> <#if (compensation_has_next)>
${compensation.billNumber}<#if compensation.migratedBillNumber??> (${compensation.migratedBillNumber}) <#if (compensation.text?has_content)>${(compensation.text)[0..*30]}<#if (compensation.materialLoan?has_content && compensation.materialLoan.loanDate?has_content)><#if (compensation.text?has_content)>, <#if inEnglish> Loan time: <#else> Udlånt: ${(compensation.materialLoan.loanDate?string("dd/MM-yyyy"))} ${compensation.amount} kr.${compensation.amount} kr.
${compensation.materialLoan.materialNumber!""}, <#if (compensation.materialLoan.author?has_content)> ${(compensation.materialLoan.author)[0..*15]}, <#if (compensation.materialLoan.title?has_content)> <#if (compensation.materialLoan.author?has_content)> ${(compensation.materialLoan.title)[0..*30]} <#if (compensation.materialLoan.periodicalName)??>(${(compensation.materialLoan.periodicalName)})
<#if inEnglish> <#if compensation.returnDate?has_content>Hand-in deadline: ${compensation.returnDate?string["dd/MM-yyyy"]}
Compensation created: ${(compensation.balanceDate?date?string["dd/MM-yyyy"])!""}<#if compensation.dueDate?has_content>. Payment deadline: ${compensation.dueDate?string["dd/MM-yyyy"]} <#else> <#if compensation.returnDate?has_content>Afleveringsfrist: ${compensation.returnDate?string["dd/MM-yyyy"]}
Erstatning oprettet: ${(compensation.balanceDate?date?string["dd/MM-yyyy"])!""}<#if compensation.dueDate?has_content>. Betalingsfrist: ${compensation.dueDate?string["dd/MM-yyyy"]}
Sum   ${sumOfCompensationsSentToCollection} kr.
<#if anyFeesSentToCollection || anyCompensationsSentToCollection >
<#if inEnglish> Total sum of balances sent to collection   ${sumOfBalancesSentToCollection} kr. <#else> Samlet sum af mellemværende sendt til inddrivelse   ${sumOfBalancesSentToCollection} kr.

<#if inEnglish> Total amount owed   ${totalSumOfAllBalances} kr. <#else> Dit samlede mellemværende   ${totalSumOfAllBalances} kr.