UDBR script example, calculate the depreciation of an asset
The following sample script calculates 20% of
depreciation on the goodwill account and books the result in an automatic
journal in the depreciation goodwill account.
#Account goodwill
main = Creator.createSource()
main.setAccount('1070')
main.loadData()
# Account depreciation goodwill (20pc)
maindepreciation = Creator.createTarget()
maindepreciation.setAccount('1079')
maindepreciation.setEType('DG')
maindepreciation.setCompanyStructure(currentStructure) to
get the field ktypkonc filled in
maindepreciation.setJournalNumber(1)
maindepreciation.addDataWithFactor(main, 0.20)
maindepreciation.saveDataWithJournalHeaders()
# account depreciation goodwill in Profit and loss
PandLdepreciation =Creator.createTarget()
PandLdepreciation.setAccount('7800')
PandLdepreciation.setEType('DG')
PandLdepreciation.setCompanyStructure(currentStructure)
PandLdepreciation.setJournalNumber(1)
PandLdepreciation.addDataWithFactor(main, 0.20)
PandLdepreciation.saveDataWithJournalHeaders()
# Update of the account net income in balance sheet
NettIncomebalsh =Creator.createTarget()
NettIncomebalsh.setAccount('2099')
NettIncomebalsh.setEType('DG')
NettIncomebalsh.setCompanyStructure(currentStructure)
NettIncomebalsh.setJournalNumber(1)
NettIncomebalsh.addDataWithFactor(main, -0.20)
NettIncomebalsh.saveDataWithJournalHeaders()
# Update of the specification of net income in balance sheet
NettIncomeMovem =Creator.createTarget()
NettIncomeMovem.setAccount('209965')
NettIncomeMovem.setEType('DG')
NettIncomeMovem.setCompanyStructure(currentStructure)
NettIncomeMovem.setJournalNumber(1)
NettIncomeMovem.addDataWithFactor(main, -0.20)
NettIncomeMovem.saveDataWithJournalHeaders()
print "End of booking of depreciation on goodwill for
company/group: " + currentCompany.getCode()