自定义原理及应用"/>
NetSuite 固定资产报表自定义原理及应用
NetSuite固定资产模块一直处于功能迭代更新中,目前23.2的版本能够支持报表的局部自定义,比如增加原值或已折旧期间,甚至固定资产自定义字段等。但是当我们在实际项目中,会遇到一些挑战,例如:
- 固定资产原值字段是增加上了,但是“汇总行”为啥没有数值?
- 能否实现“期初、发生、结余”的固定资产报表,与资产负债表相呼应?
- 能否调整格式,因为目前的列都挤在了一起,太难看了。
这些问题都不是可以通过前台“报表定制”界面实现的。
当我们深入分析了代码后,发现可以通过UI之下的功能来回应上述的需求。
我们来描述一下固定资产报表客制的基本原理。
- 报表客制UI,也就是NetSuite的“Customize FAM Report Template”,可以进行客制字段的数据定义,这是客制报表数据集的来源。客制字段的命名特征为“_cfN_”。其中N为数字,代表不同的固定资产报表类型。
- 系统会生成“XML”格式的客制模板,保存在文件柜中。目录因系统设定不同,可以在固定资产System Setup中的Report参数“FOLDER TO USE FOR REPORTING (INTERNAL ID) ”中配置。
- 当生成报表时,系统会把相应数据按照“报表客制表”定义的数据源拉出,然后调用“高级PDF”功能,按照“XML客制模板”进行内容输出。“高级PDF”功能就是我们做各类“高级”打印模板的工具。这个工具支持Freemarker,所以能做出很多的变化,包括编程和格式定义。这对我们是至关重要的。
了解了上述架构,我们就可以着眼于XML格式的客制模板了。客制完成后,可以在固定资产的System Setup中报表模板中进行选择。
下面是一个“期初、发生、结余”的固定资产报表的模板,供参考。
<head><meta charset="utf-8" /><link name="NotoSansThai" type="font" subtype="opentype" src="NetSuiteFonts/NotoSansThai-Regular.ttf" src-bold="NetSuiteFonts/NotoSansThai-Bold.ttf" src-italic="NetSuiteFonts/NotoSansThai-Regular.ttf" src-bolditalic="NetSuiteFonts/NotoSansThai-Bold.ttf" bytes="2" /><style>body {font-family: Arial, Verdana, Helvetica, NotoSansThai, stsong, msung, mhei, heiseimin, heiseikakugo, hygothic, hysmyeongjo;font-size: 10px;}</style><macrolist><macro id="pagenum"><p align="right">Page <pagenumber/> of <totalpages/></p></macro></macrolist>
</head>
<body size="420mm 297mm" footer="pagenum"><#assign lineIndex = 0><#assign listSize = report.recmachcustrecord_assetregister_repparent?size><#list report.recmachcustrecord_assetregister_repparent as line><#assign lineIndex = lineIndex + 1><#assign lineType = line.custrecord_assetregister_linetype><#if lineType == "sub_header"><p style="font-size: 18px; color: #003399">Asset Register Report</p><table><tr><td colspan="20" style="font-weight: bold; font-size: 12px;"><p align="center">Fixed Assets Management <#if line.custrecord_assetregister_sub != "">- ${line.custrecord_assetregister_sub} <#if line.custrecord_assetregister_currency != "">${line.custrecord_assetregister_currency}</#if></#if></p></td></tr><tr><td colspan="20"><p align="center">${line.custrecord_assetregister_posting}<#if line.custrecord_assetregister_acctgbook != '0'> - ${line.custrecord_assetregister_acctgbook}</#if></p></td></tr><tr><td colspan="20"><p align="center">${line.custrecord_assetregister_altdep} - ${report.custrecord_assetregisterrep_selected}</p></td></tr><tr><td colspan="20"><p align="center">${report.custrecord_assetregisterrep_startdate?string["MMM d, yyyy"]} - ${report.custrecord_assetregisterrep_enddate?string["MMM d, yyyy"]}<br/></p></td></tr><tr><td style="font-weight: bold;" rowspan="2"><p align="left">Asset Type</p></td><td style="font-weight: bold;" rowspan="2"><p align="left">ID</p></td><td style="font-weight: bold;" rowspan="2"><p align="left">Name</p></td><td style="font-weight: bold;" rowspan="2"><p align="left">Depreciation Start Date</p></td><td style="font-weight: bold;" rowspan="2"><p align="left">AL</p></td><td style="font-weight: bold;" rowspan="2"><p align="left">RL</p></td><td style="font-weight: bold;" colspan="3"><p align="center">Beginning Balance</p></td><td style="font-weight: bold;" rowspan="2"><p align="right">Acquisitions</p></td><td style="font-weight: bold;" rowspan="2"><p align="right">Depreciation</p></td><td style="font-weight: bold;" rowspan="2"><p align="right">Transfers</p></td><td style="font-weight: bold;" rowspan="2"><p align="right">Revaluations</p></td><td style="font-weight: bold;" rowspan="2"><p align="right">Disposals</p></td><td style="font-weight: bold;" colspan="3"><p align="center">Ending Balance</p></td></tr><tr><td style="font-weight: bold;"><p align="center">Cost</p></td><td style="font-weight: bold;"><p align="center">Depreciation</p></td><td style="font-weight: bold;"><p align="center">Net Book Value</p></td><td style="font-weight: bold;"><p align="center">Cost</p></td><td style="font-weight: bold;"><p align="center">Depreciation</p></td><td style="font-weight: bold;"><p align="center">Net Book Value</p></td></tr><#elseif lineType == "horizontal_rule"><tr><td colspan="6"></td><td colspan="11" style="border-top-style: solid; border-top-width: 1px;" margin-bottom="1px"> </td></tr><#elseif lineType == "double_horizontal_rule"><tr><td colspan="6"></td><td colspan="11" style="border-top-style: solid; border-top-width: 1px;" margin-bottom="1px"> </td></tr><tr><td colspan="6"></td><td colspan="11" style="border-top-style: solid; border-top-width: 1px;" margin-bottom="4px"> </td></tr></table> <#if lineIndex lt listSize-1><pbr /><br /></#if><#else><tr><#if lineType == "type_header"><td colspan="20" ><br /></td><#else><#if lineType == "type_total"><td colspan="6"> </td><#else><td><p align="left">${line.custrecord_assetregister_assettype}</p></td><td><p align="left">${line.custrecord_assetregister_assetid}</p></td><td><p align="left">${line.custrecord_assetregister_assetname}</p></td><td><p align="left">${line.custrecord_assetregister_deprstartdate}</p></td><td><p align="left">${line.custrecord_assetregister_assetlife}</p></td><td><p align="left">${line.custrecord_assetregister_assetlife-line.custrecord_cf0_assetlifeunits}</p></td></#if><#assign additions = line.custrecord_assetregister_additions><#assign transfers = line.custrecord_assetregister_transfers><#assign revaluation = line.custrecord_assetregister_revaluation><#assign writedown = line.custrecord_assetregister_writedown><#assign sale = line.custrecord_assetregister_sale><#assign disposals = line.custrecord_assetregister_disposals><td><p align="right">${line.custrecord_assetregister_begincost?string["#,##0.00;(#,##0.00)"]}</p></td><td><p align="right">${line.custrecord_assetregister_begindepr?string["#,##0.00;(#,##0.00)"]}</p></td><td><p align="right">${line.custrecord_assetregister_beginbal?string["#,##0.00;(#,##0.00)"]}</p></td><td><p align="right">${line.custrecord_assetregister_additions?string["#,##0.00;(#,##0.00)"]}</p></td><td><p align="right">${line.custrecord_assetregister_depreciation?string["#,##0.00;(#,##0.00)"]}</p></td><td><p align="right">${line.custrecord_assetregister_transfers?string["#,##0.00;(#,##0.00)"]}</p></td><td><p align="right">${(revaluation+writedown)?string["#,##0.00;(#,##0.00)"]}</p></td><td><p align="right">${(line.custrecord_assetregister_sale+line.custrecord_assetregister_disposals)?string["#,##0.00;(#,##0.00)"]}</p></td><td><p align="right">${(line.custrecord_assetregister_begincost+additions-transfers-revaluation-writedown-sale-disposals)?string["#,##0.00;(#,##0.00)"]}</p></td><td><p align="right">${(line.custrecord_assetregister_begindepr+line.custrecord_assetregister_depreciation)?string["#,##0.00;(#,##0.00)"]}</p></td> <td><p align="right">${line.custrecord_assetregister_netbookvalue?string["#,##0.00;(#,##0.00)"]}</p></td></#if></tr></#if></#list><#if report.recmachcustrecord_assetregister_repparent_zerov?size gt 0><br /><p style="font-size: 10px; font-weight: bold">Subsidiaries with zero values</p><#list report.recmachcustrecord_assetregister_repparent_zerov as line><p style="font-size: 10px;">${line.custrecord_assetregister_sub}</p></#list></#if>
</body>
如果有任何关于NetSuite的问题,欢迎来谈。邮箱:service@truston.group
更多推荐
NetSuite 固定资产报表自定义原理及应用
发布评论