Class VoucherServiceImpl
java.lang.Object
ch.tocco.nice2.optional.finance.impl.service.vouchercreation.VoucherServiceImpl
- All Implemented Interfaces:
VoucherService
-
Nested Class Summary
Nested classes/interfaces inherited from interface ch.tocco.nice2.optional.finance.api.service.vouchercreation.VoucherService
VoucherService.VoucherTotals
-
Constructor Summary
ConstructorDescriptionVoucherServiceImpl
(Context context, DefaultDisplayService defaultDisplayService, QueryBuilderFactory queryBuilderFactory, ActiveVatRateService activeVatRateService, VatCalculationService vatCalculationService, EntityDefaultValueService defaultValueService, SecurityManager securityManager) -
Method Summary
Modifier and TypeMethodDescriptionorg.joda.time.LocalDate
calculateDateForVoucher
(Entity entity) calculates the date of a voucher that is being created based on the already existing vouchers of this debitorvoid
finalizeIncomingPaymentVoucher
(Entity voucher) sets several fields and relations on voucher that are always calculated the same when creating the voucher is always made with no vatvoid
finalizeVoucher
(Entity voucher) sets several fields and relations on voucher that are always calculated the same when creatingvoid
finalizeVoucher
(Entity voucher, BigDecimal fixedBrutto) sets several fields and relations on voucher that are always calculated the same when creatinggetPostingText
(Entity voucher) Returns the posting text created according to the "postingtext" display that is configured on the Voucher entitygetVoucherTotals
(BigDecimal amount, org.joda.time.LocalDate voucherDate, BigDecimal rounding, @Nullable Entity vatCode) calculates the netto, brutto and vat valuesvoid
void
setFinancialYearIfAvailable
(Entity voucher) if there is a financial year for the given voucher present, set the year on it
-
Constructor Details
-
VoucherServiceImpl
public VoucherServiceImpl(Context context, DefaultDisplayService defaultDisplayService, QueryBuilderFactory queryBuilderFactory, ActiveVatRateService activeVatRateService, VatCalculationService vatCalculationService, EntityDefaultValueService defaultValueService, SecurityManager securityManager)
-
-
Method Details
-
getVoucherTotals
public VoucherService.VoucherTotals getVoucherTotals(BigDecimal amount, org.joda.time.LocalDate voucherDate, BigDecimal rounding, @Nullable @Nullable Entity vatCode) Description copied from interface:VoucherService
calculates the netto, brutto and vat values- Specified by:
getVoucherTotals
in interfaceVoucherService
- Parameters:
amount
- the amount to calculate withvoucherDate
- the date, for which the vat dates are pulledrounding
- how to round the valuesvatCode
- the used vatcode- Returns:
- a
VoucherService.VoucherTotals
-
finalizeVoucher
Description copied from interface:VoucherService
sets several fields and relations on voucher that are always calculated the same when creating- Specified by:
finalizeVoucher
in interfaceVoucherService
- Parameters:
voucher
- the voucher to finalize
-
finalizeIncomingPaymentVoucher
Description copied from interface:VoucherService
sets several fields and relations on voucher that are always calculated the same when creating the voucher is always made with no vat- Specified by:
finalizeIncomingPaymentVoucher
in interfaceVoucherService
- Parameters:
voucher
- the voucher to finalize
-
finalizeVoucher
Description copied from interface:VoucherService
sets several fields and relations on voucher that are always calculated the same when creating- Specified by:
finalizeVoucher
in interfaceVoucherService
- Parameters:
voucher
- the voucher to finalizefixedBrutto
- the desired nettoAmount, this will be enforced so that no rounding errors can happen all rounding differences will be corrected on the vat amount
-
setFinancialYearIfAvailable
Description copied from interface:VoucherService
if there is a financial year for the given voucher present, set the year on it- Specified by:
setFinancialYearIfAvailable
in interfaceVoucherService
- Parameters:
voucher
- the voucher to get the dates from
-
calculateDateForVoucher
Description copied from interface:VoucherService
calculates the date of a voucher that is being created based on the already existing vouchers of this debitor- Specified by:
calculateDateForVoucher
in interfaceVoucherService
- Parameters:
entity
- the debitor for whom a new voucher is being created
-
getPostingText
Description copied from interface:VoucherService
Returns the posting text created according to the "postingtext" display that is configured on the Voucher entity- Specified by:
getPostingText
in interfaceVoucherService
- Returns:
- the posting text
-
setFinalizeVoucherMethods
@Autowired(required=false) public void setFinalizeVoucherMethods(List<FinalizeVoucherMethod> methods)
-