TimeTrex/interface/html5/dist/payroll-pay_stub-PayStubViewController.bundle.js

1 line
286 KiB
JavaScript

"use strict";(self.webpackChunktimetrex=self.webpackChunktimetrex||[]).push([["payroll-pay_stub-PayStubViewController"],{3436:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"PayStubViewController\": () => (/* binding */ PayStubViewController)\n/* harmony export */ });\n/* harmony import */ var decimal_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(482);\n/* provided dependency */ var _ = __webpack_require__(9050);\n/* provided dependency */ var $ = __webpack_require__(9755);\n\n\nclass PayStubViewController extends BaseViewController {\n\tconstructor( options = {} ) {\n\t\t_.defaults( options, {\n\t\t\tel: '#pay_stub_view_container',\n\n\t\t\tfiltered_status_array: null,\n\t\t\tuser_status_array: null,\n\t\t\tuser_group_array: null,\n\t\t\tuser_destination_account_array: null,\n\t\t\tcurrency_array: null,\n\t\t\ttype_array: null,\n\n\t\t\tcountry_array: null,\n\t\t\tprovince_array: null,\n\n\t\t\te_province_array: null,\n\n\t\t\tuser_api: null,\n\t\t\tuser_group_api: null,\n\t\t\tcompany_api: null,\n\n\t\t\tpay_stub_entry_api: null,\n\n\t\t\tinclude_pay_stub_accounts: true,\n\t\t\ttransaction_status_array: false,\n\n\t\t\tnet_pay_amount: false,\n\n\t\t\tpseal_link: false,\n\n\t\t\toriginal_status_id: 10\n\t\t} );\n\n\t\tsuper( options );\n\t}\n\n\tinit( options ) {\n\t\t//this._super('initialize', options );\n\t\tthis.edit_view_tpl = 'PayStubEditView.html';\n\t\tthis.permission_id = 'pay_stub';\n\t\tthis.viewId = 'PayStub';\n\t\tthis.script_name = 'PayStubView';\n\t\tthis.table_name_key = 'pay_stub';\n\t\tthis.context_menu_name = $.i18n._( 'Pay Stub' );\n\t\tthis.navigation_label = $.i18n._( 'Pay Stubs' );\n\t\tthis.api = TTAPI.APIPayStub;\n\t\tthis.user_api = TTAPI.APIUser;\n\t\tthis.pay_stub_entry_api = TTAPI.APIPayStubEntry;\n\t\tthis.pay_stub_entry_account_link_api = TTAPI.APIPayStubEntryAccountLink;\n\t\tthis.user_group_api = TTAPI.APIUserGroup;\n\t\tthis.company_api = TTAPI.APICompany;\n\t\tthis.pay_period_api = TTAPI.APIPayPeriod;\n\t\tthis.pay_stub_transaction_api = TTAPI.APIPayStubTransaction;\n\t\tthis.remittance_destination_account_api = TTAPI.APIRemittanceDestinationAccount;\n\n\t\tvar $this = this;\n\t\t$.when(\n\t\t\tthis.preloadTransactionOptions( new $.Deferred() ),\n\t\t\tthis.preloadPayStubAccountLinks( new $.Deferred() )\n\t\t).done( function() {\n\t\t\t$this.completeInit();\n\t\t} );\n\t}\n\n\tisEditMode() {\n\t\tif ( this.is_add || ( this.is_edit && this.original_status_id == 25 ) ) {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tpreloadTransactionOptions( dfd ) {\n\t\tvar $this = this;\n\t\tthis.pay_stub_transaction_api.getOptions( 'status', false, false, {\n\t\t\tonResult: function( result ) {\n\t\t\t\t$this.transaction_status_array = result.getResult();\n\t\t\t\tdfd.resolve( true );\n\t\t\t}\n\t\t} );\n\n\t\treturn dfd.promise();\n\t}\n\n\tpreloadPayStubAccountLinks( dfd ) {\n\t\tvar $this = this;\n\t\tthis.pay_stub_entry_account_link_api.getPayStubEntryAccountLink( '', false, false, {\n\t\t\tonResult: function( result ) {\n\t\t\t\tvar data = result.getResult()[0];\n\t\t\t\tif ( data ) {\n\t\t\t\t\t$this.pseal_link = {\n\t\t\t\t\t\ttotal_gross_entry_account_id: false,\n\t\t\t\t\t\ttotal_deductions_entry_account_id: false,\n\t\t\t\t\t\tnet_pay_entry_account_id: false,\n\t\t\t\t\t\tcontributions_entry_account_id: false\n\t\t\t\t\t};\n\n\t\t\t\t\t$this.pseal_link.total_gross_entry_account_id = data.total_gross;\n\t\t\t\t\t$this.pseal_link.total_deductions_entry_account_id = data.total_employee_deduction;\n\t\t\t\t\t$this.pseal_link.net_pay_entry_account_id = data.total_net_pay;\n\t\t\t\t\t$this.pseal_link.contributions_entry_account_id = data.total_employer_deduction;\n\t\t\t\t}\n\t\t\t\tdfd.resolve( true );\n\t\t\t}\n\t\t} );\n\n\t\treturn dfd.promise();\n\t}\n\n\tcompleteInit() {\n\t\tthis.initPermission();\n\t\tthis.render();\n\t\tthis.buildContextMenu();\n\n\t\tthis.initData();\n\t}\n\n\tinitPermission() {\n\n\t\tsuper.initPermission();\n\n\t\tif ( PermissionManager.validate( this.permission_id, 'view' ) || PermissionManager.validate( this.permission_id, 'view_child' ) ) {\n\t\t\tthis.show_search_tab = true;\n\t\t} else {\n\t\t\tthis.show_search_tab = false;\n\t\t}\n\t\treturn {};\n\t}\n\n\tinitOptions() {\n\t\tvar $this = this;\n\n\t\tvar options = [\n\t\t\t{ option_name: 'filtered_status', field_name: 'status_id', api: this.api },\n\t\t\t{ option_name: 'type', field_name: 'type_id', api: this.api },\n\t\t\t{ option_name: 'status', field_name: 'user_status_id', api: this.user_api },\n\t\t\t{ option_name: 'country', field_name: 'country', api: this.company_api },\n\t\t];\n\n\t\tthis.initDropDownOptions( options );\n\n\t\tvar result = {};\n\t\tfor ( var i = 1; i <= 128; i++ ) {\n\t\t\tresult[i] = i;\n\t\t}\n\t\t$this.basic_search_field_ui_dic['run_id'].setSourceData( Global.buildRecordArray( result ) );\n\t\t$this.adv_search_field_ui_dic['run_id'].setSourceData( Global.buildRecordArray( result ) );\n\t\tthis.user_group_api.getUserGroup( '', false, false, {\n\t\t\tonResult: function( res ) {\n\t\t\t\tres = res.getResult();\n\n\t\t\t\tres = Global.buildTreeRecord( res );\n\t\t\t\t$this.user_group_array = res;\n\n\t\t\t\tif ( !$this.sub_view_mode && $this.basic_search_field_ui_dic['group_id'] ) {\n\t\t\t\t\t$this.basic_search_field_ui_dic['group_id'].setSourceData( res );\n\t\t\t\t\t$this.adv_search_field_ui_dic['group_id'].setSourceData( res );\n\t\t\t\t}\n\n\t\t\t}\n\t\t} );\n\t}\n\n\tgetCustomContextMenuModel() {\n\t\tvar context_menu_model = {\n\t\t\tgroups: {\n\t\t\t\tpay_stubs: {\n\t\t\t\t\tlabel: $.i18n._( 'Pay Stubs' ),\n\t\t\t\t\tid: this.script_name + 'Pay Stubs'\n\t\t\t\t}\n\t\t\t},\n\t\t\texclude: [\n\t\t\t\t'copy',\n\t\t\t\t'save_and_new',\n\t\t\t\t'save_and_copy',\n\t\t\t],\n\t\t\tinclude: [\n\t\t\t\t{\n\t\t\t\t\tlabel: $.i18n._( 'Jump To' ),\n\t\t\t\t\tid: 'jump_to_header',\n\t\t\t\t\tmenu_align: 'right',\n\t\t\t\t\taction_group: 'jump_to',\n\t\t\t\t\taction_group_header: true,\n\t\t\t\t\tpermission_result: false // to hide it in legacy context menu and avoid errors in legacy parsers.\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: $.i18n._( 'TimeSheet' ),\n\t\t\t\t\tid: 'timesheet',\n\t\t\t\t\tmenu_align: 'right',\n\t\t\t\t\taction_group: 'jump_to',\n\t\t\t\t\tgroup: 'navigation',\n\t\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: $.i18n._( 'Schedule' ),\n\t\t\t\t\tid: 'schedule',\n\t\t\t\t\tmenu_align: 'right',\n\t\t\t\t\taction_group: 'jump_to',\n\t\t\t\t\tgroup: 'navigation',\n\t\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: $.i18n._( 'Pay Stub Amendments' ),\n\t\t\t\t\tid: 'pay_stub_amendment',\n\t\t\t\t\tmenu_align: 'right',\n\t\t\t\t\taction_group: 'jump_to',\n\t\t\t\t\tgroup: 'navigation',\n\t\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: $.i18n._( 'Pay Stub Transactions' ),\n\t\t\t\t\tid: 'pay_stub_transaction',\n\t\t\t\t\tmenu_align: 'right',\n\t\t\t\t\taction_group: 'jump_to',\n\t\t\t\t\tgroup: 'navigation',\n\t\t\t\t\titems: [], // TODO: Is this still needed? It interferes with PrimeVue as it thinks its a submenu but wrong format, but I cant see anywhere this code is used, other than for Print menu.\n\t\t\t\t\tpermission_result: true,\n\t\t\t\t\tpermission: true,\n\t\t\t\t\tsort_order: null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: $.i18n._( 'Edit Employee' ),\n\t\t\t\t\tid: 'edit_employee',\n\t\t\t\t\tmenu_align: 'right',\n\t\t\t\t\taction_group: 'jump_to',\n\t\t\t\t\tgroup: 'navigation',\n\t\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: $.i18n._( 'Edit Pay Period' ),\n\t\t\t\t\tid: 'edit_pay_period',\n\t\t\t\t\tmenu_align: 'right',\n\t\t\t\t\taction_group: 'jump_to',\n\t\t\t\t\tgroup: 'navigation',\n\t\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: '', //Empty label. vue_icon is displayed instead of text.\n\t\t\t\t\tid: 'other_header',\n\t\t\t\t\tmenu_align: 'right',\n\t\t\t\t\taction_group: 'other',\n\t\t\t\t\taction_group_header: true,\n\t\t\t\t\tvue_icon: 'tticon tticon-more_vert_black_24dp',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: $.i18n._( 'View: Employee Pay Stubs' ),\n\t\t\t\t\tid: 'employee_pay_stubs',\n\t\t\t\t\tmenu_align: 'right',\n\t\t\t\t\taction_group: 'other',\n\t\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: $.i18n._( 'View: Employer Pay Stubs' ),\n\t\t\t\t\tid: 'employer_pay_stubs',\n\t\t\t\t\tmenu_align: 'right',\n\t\t\t\t\taction_group: 'other',\n\t\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: $.i18n._( 'Generate Pay Stub' ),\n\t\t\t\t\tid: 'generate_pay_stub',\n\t\t\t\t\tmenu_align: 'right',\n\t\t\t\t\taction_group: 'other',\n\t\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: $.i18n._( 'Process Transactions' ),\n\t\t\t\t\tid: 'direct_deposit',\n\t\t\t\t\tmenu_align: 'right',\n\t\t\t\t\taction_group: 'other',\n\t\t\t\t\ticon: 'direct_deposit-35x35.png',\n\t\t\t\t\titems: [],\n\t\t\t\t\tpermission_result: true,\n\t\t\t\t\tpermission: true\n\t\t\t\t},\n\t\t\t]\n\t\t};\n\n\t\treturn context_menu_model;\n\t}\n\n\tsetCustomDefaultMenuIcon( id, context_btn, grid_selected_length ) {\n\t\tswitch ( id ) {\n\t\t\tcase 'timesheet':\n\t\t\t\tthis.setDefaultMenuViewIcon( context_btn, grid_selected_length, 'punch' );\n\t\t\t\tbreak;\n\t\t\tcase 'schedule':\n\t\t\t\tthis.setDefaultMenuViewIcon( context_btn, grid_selected_length, 'schedule' );\n\t\t\t\tbreak;\n\t\t\tcase 'pay_stub_amendment':\n\t\t\t\tthis.setDefaultMenuViewIcon( context_btn, grid_selected_length, 'pay_stub_amendment' );\n\t\t\t\tbreak;\n\t\t\tcase 'pay_stub_transaction':\n\t\t\t\tthis.setDefaultMenuViewIcon( context_btn, grid_selected_length, 'pay_stub_transaction' );\n\t\t\t\tbreak;\n\t\t\tcase 'edit_employee':\n\t\t\t\tthis.setDefaultMenuEditEmployeeIcon( context_btn, grid_selected_length, 'user' );\n\t\t\t\tbreak;\n\t\t\tcase 'edit_pay_period':\n\t\t\t\tthis.setDefaultMenuEditPayPeriodIcon( context_btn, grid_selected_length );\n\t\t\t\tbreak;\n\t\t\tcase 'employee_pay_stubs':\n\t\t\tcase 'employer_pay_stubs':\n\t\t\tcase 'print_checks':\n\t\t\tcase 'direct_deposit':\n\t\t\t\tthis.setDefaultMenuReportRelatedIcons( context_btn, grid_selected_length );\n\t\t\t\tbreak;\n\t\t\tcase 'generate_pay_stub':\n\t\t\t\tthis.setDefaultMenuGeneratePayStubIcon( context_btn, grid_selected_length );\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\tsetDefaultMenuEditPayPeriodIcon( context_btn, grid_selected_length, pId ) {\n\t\tif ( !this.editPermissionValidate( 'pay_period_schedule' ) ) {\n\t\t\tContextMenuManager.hideMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, false )\n\t\t}\n\t\tif ( grid_selected_length === 1 ) {\n\t\t\tContextMenuManager.disableMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, true );\n\t\t} else {\n\t\t\tContextMenuManager.disableMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, false );\n\t\t}\n\t}\n\n\tsetDefaultMenuEditEmployeeIcon( context_btn, grid_selected_length ) {\n\t\tif ( !this.editChildPermissionValidate( 'user' ) ) {\n\t\t\tContextMenuManager.hideMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, false )\n\t\t}\n\n\t\tif ( grid_selected_length === 1 ) {\n\t\t\tContextMenuManager.disableMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, true );\n\t\t} else {\n\t\t\tContextMenuManager.disableMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, false );\n\t\t}\n\t}\n\n\tsetDefaultMenuViewIcon( context_btn, grid_selected_length, pId ) {\n\t\tif ( pId === 'punch' || pId === 'schedule' || pId === 'pay_stub_amendment' ) {\n\t\t\tsuper.setDefaultMenuViewIcon( context_btn, grid_selected_length, pId );\n\t\t} else if ( pId === 'pay_stub_transaction' ) {\n\t\t\tif ( PermissionManager.validate( 'pay_stub', 'enabled' )\n\t\t\t\t&& ( PermissionManager.validate( 'pay_stub', 'view' ) || PermissionManager.validate( 'pay_stub', 'view_child' ) ) ) {\n\t\t\t\tContextMenuManager.hideMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, true );\n\t\t\t} else {\n\t\t\t\tContextMenuManager.hideMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, false )\n\t\t\t}\n\t\t} else {\n\t\t\tif ( !this.viewPermissionValidate( pId ) || this.edit_only_mode ) {\n\t\t\t\tContextMenuManager.hideMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, false )\n\t\t\t}\n\n\t\t\tif ( grid_selected_length > 0 && this.viewOwnerOrChildPermissionValidate() ) {\n\t\t\t\tContextMenuManager.disableMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, true );\n\t\t\t} else {\n\t\t\t\tContextMenuManager.disableMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, false );\n\t\t\t}\n\t\t}\n\t}\n\n\tsetCustomEditMenuIcon( id, context_btn ) {\n\t\tswitch ( id ) {\n\t\t\tcase 'timesheet':\n\t\t\t\tthis.setEditMenuViewIcon( context_btn, 'punch' );\n\t\t\t\tbreak;\n\t\t\tcase 'schedule':\n\t\t\t\tthis.setEditMenuViewIcon( context_btn, 'schedule' );\n\t\t\t\tbreak;\n\t\t\tcase 'pay_stub_amendment':\n\t\t\t\tthis.setEditMenuViewIcon( context_btn, 'pay_stub_amendment' );\n\t\t\t\tbreak;\n\t\t\tcase 'pay_stub_transaction':\n\t\t\t\tthis.setEditMenuViewIcon( context_btn, 'pay_stub_transaction' );\n\t\t\t\tbreak;\n\t\t\tcase 'edit_employee':\n\t\t\t\tthis.setEditMenuViewIcon( context_btn, 'user' );\n\t\t\t\tbreak;\n\t\t\tcase 'edit_pay_period':\n\t\t\t\tthis.setEditMenuViewIcon( context_btn, 'pay_period_schedule' );\n\t\t\t\tbreak;\n\t\t\tcase 'view':\n\t\t\tcase 'employer_pay_stubs':\n\t\t\tcase 'employee_pay_stubs':\n\t\t\tcase 'print_checks':\n\t\t\tcase 'direct_deposit':\n\t\t\t\t//this.setEditMenuReportRelatedIcons( context_btn );\n\t\t\t\tthis.setEditMenuEditIcon( context_btn );\n\t\t\t\tbreak;\n\t\t\tcase 'generate_pay_stub':\n\t\t\t\tthis.setEditMenuGeneratePayStubIcon( context_btn );\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\tpayStubReportIconsValidate() {\n\t\tif ( !PermissionManager.validate( 'pay_stub', 'enabled' ) ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tvar selected_item = this.getSelectedItem();\n\n\t\tif ( PermissionManager.validate( 'pay_stub', 'view' ) || this.ownerOrChildPermissionValidate( 'pay_stub', 'view_child', selected_item ) ) {\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tsetDefaultMenuReportRelatedIcons( context_btn, grid_selected_length, pId ) {\n\t\tif ( !this.payStubReportIconsValidate() ) {\n\t\t\tContextMenuManager.hideMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, false )\n\t\t}\n\n\t\tif ( grid_selected_length > 0 && this.viewOwnerOrChildPermissionValidate() ) {\n\t\t\tContextMenuManager.disableMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, true );\n\t\t} else {\n\t\t\tContextMenuManager.disableMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, false );\n\t\t}\n\t}\n\n\tsetEditMenuReportRelatedIcons( context_btn, grid_selected_length, pId ) {\n\t\tif ( !this.payStubReportIconsValidate() ) {\n\t\t\tContextMenuManager.hideMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, false )\n\t\t}\n\n\t\tif ( this.current_edit_record.id && this.viewOwnerOrChildPermissionValidate() ) {\n\t\t\tContextMenuManager.disableMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, true );\n\t\t} else {\n\t\t\tContextMenuManager.disableMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, false );\n\t\t}\n\t}\n\n\tsetEditMenuGeneratePayStubIcon( context_btn, grid_selected_length, pId ) {\n\t\tif ( !PermissionManager.checkTopLevelPermission( 'GeneratePayStubs' ) ) {\n\t\t\tContextMenuManager.hideMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, false )\n\t\t}\n\t}\n\n\tsetDefaultMenuGeneratePayStubIcon( context_btn, grid_selected_length, pId ) {\n\t\tif ( !PermissionManager.checkTopLevelPermission( 'GeneratePayStubs' ) ) {\n\t\t\tContextMenuManager.hideMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, false )\n\t\t}\n\t}\n\n\tremoveEntryInsideEditorCover() {\n\t\tif ( this.cover && this.cover.length > 0 ) {\n\t\t\tthis.cover.remove();\n\t\t}\n\t\tthis.cover = null;\n\t}\n\n\tsetCurrentEditRecordData() {\n\t\tthis.include_pay_stub_accounts = true;\n\t\t//Set current edit record data to all widgets\n\t\tfor ( var key in this.current_edit_record ) {\n\t\t\tvar widget = this.edit_view_ui_dic[key];\n\t\t\tif ( Global.isSet( widget ) ) {\n\t\t\t\tswitch ( key ) {\n\t\t\t\t\tcase 'country':\n\t\t\t\t\t\tthis.setCountryValue( widget, key );\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'status_id':\n\t\t\t\t\t\tif ( this.current_edit_record[key] == 40 || this.current_edit_record[key] == 100 ) {\n\t\t\t\t\t\t\tthis.include_pay_stub_accounts = false;\n\t\t\t\t\t\t}\n\t\t\t\t\t\twidget.setValue( this.current_edit_record[key] );\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\twidget.setValue( this.current_edit_record[key] );\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\n\t\tthis.collectUIDataToCurrentEditRecord();\n\t\tthis.setEditViewDataDone();\n\t}\n\n\tsetEditViewDataDone() {\n\t\tsuper.setEditViewDataDone();\n\n\t\tif ( this.is_add ) {\n\t\t\tthis.edit_view_ui_dic.user_id.setEnabled( true );\n\t\t} else {\n\t\t\tthis.edit_view_ui_dic.user_id.setEnabled( false );\n\t\t}\n\n\t\tif ( !this.is_mass_editing ) {\n\t\t\tthis.initInsideEntryEditorData();\n\t\t}\n\t}\n\n\tgetPayStubTransactionDefaultData( callback, index ) {\n\t\tthis.pay_stub_transaction_api['get' + this.pay_stub_transaction_api.key_name + 'DefaultData']( {\n\t\t\tonResult: function( result ) {\n\t\t\t\tvar data = [];\n\t\t\t\tvar result_data = result.getResult();\n\t\t\t\tresult_data.id = false;\n\n\t\t\t\tdata.push( result_data );\n\n\t\t\t\tcallback( data, index );\n\t\t\t}\n\t\t} );\n\t}\n\n\tgetPayStubTransaction( callback ) {\n\t\tvar $this = this;\n\t\tvar args = {};\n\t\targs.filter_data = {};\n\t\targs.filter_data.pay_stub_id = TTUUID.isUUID( this.current_edit_record.id ) ? this.current_edit_record.id : ( TTUUID.isUUID( this.copied_record_id ) ? this.copied_record_id : '' );\n\t\tthis.pay_stub_transaction_api['getPayStubTransaction']( args, true, {\n\t\t\tonResult: function( res ) {\n\t\t\t\tif ( !$this.edit_view ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tvar result_data = res.getResult();\n\t\t\t\tif ( _.size( result_data ) == 0 ) {\n\t\t\t\t\tresult_data = [];\n\t\t\t\t}\n\n\t\t\t\tcallback( result_data );\n\t\t\t}\n\t\t} );\n\t}\n\n\tinitInsideTransactionEditorData() {\n\t\tvar $this = this;\n\n\t\tif ( ( !this.current_edit_record || TTUUID.isUUID( this.current_edit_record.id ) == false ) && !this.copied_record_id ) {\n\t\t\tthis.getPayStubTransactionDefaultData( function( data ) {\n\t\t\t\tif ( $this.isEditMode() == true || data.length > 0 ) {\n\t\t\t\t\t$this.editor.transaction_data = data;\n\t\t\t\t} else {\n\t\t\t\t\t$this.editor.transaction_data = false;\n\t\t\t\t}\n\t\t\t\t//Issue #2890 - Having a promise resolve after the API call for getting transaction data and storing that data\n\t\t\t\t//to be used later while building the HTML. This stops this API call from being delayed and causing unintended issues\n\t\t\t\t//with duplicating transactions, overlays and data sync issues.\n\t\t\t\tTTPromise.resolve( 'PayStubViewController', 'insideEditorDataLoaded' );\n\t\t\t} );\n\t\t} else {\n\t\t\tthis.getPayStubTransaction( function( data ) {\n\t\t\t\tif ( $this.isEditMode() == true || data.length > 0 ) {\n\t\t\t\t\t$this.editor.transaction_data = data;\n\t\t\t\t} else {\n\t\t\t\t\t$this.editor.transaction_data = false;\n\t\t\t\t}\n\t\t\t\t//Issue #2890 - Having a promise resolve after the API call for getting transaction data and storing that data\n\t\t\t\t//to be used later while building the HTML. This stops this API call from being delayed and causing unintended issues\n\t\t\t\t//with duplicating transactions, overlays and data sync issues.\n\t\t\t\tTTPromise.resolve( 'PayStubViewController', 'insideEditorDataLoaded' );\n\t\t\t} );\n\t\t}\n\t}\n\n\tinitInsideEntryEditorData() {\n\t\tTTPromise.add( 'PayStubViewController', 'insideEditorDataLoaded' );\n\t\tvar $this = this;\n\t\tvar args = {};\n\t\targs.filter_data = {};\n\n\t\tif ( this.copied_record_id || ( this.current_edit_record && this.current_edit_record.id ) ) {\n\t\t\targs.filter_data.pay_stub_id = TTUUID.isUUID( this.current_edit_record.id ) ? this.current_edit_record.id : this.copied_record_id;\n\t\t\tthis.pay_stub_entry_api['get' + this.pay_stub_entry_api.key_name]( args, {\n\t\t\t\tonResult: function( res ) {\n\t\t\t\t\tif ( !$this.edit_view ) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tvar data = $this.handlePayStubEntryData( res.getResult() );\n\t\t\t\t\tTTPromise.wait( 'PayStubViewController', 'insideEditorDataLoaded', function() {\n\t\t\t\t\t\t$this.editor.setValue( data );\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t} );\n\t\t} else {\n\t\t\tvar data = $this.handlePayStubEntryData();\n\t\t\tTTPromise.wait( 'PayStubViewController', 'insideEditorDataLoaded', function() {\n\t\t\t\t$this.editor.setValue( data );\n\t\t\t} );\n\t\t}\n\n\t\tthis.initInsideTransactionEditorData();\n\t}\n\n\thandlePayStubEntryData( data ) {\n\n\t\tvar total_rows = {};\n\t\tvar retval = {};\n\t\tif ( data ) {\n\t\t\tfor ( var n in data ) {\n\t\t\t\tvar type_id = data[n].type_id;\n\t\t\t\tif ( type_id == 40 ) {\n\t\t\t\t\tif ( data[n].pay_stub_entry_account_id ) {\n\t\t\t\t\t\tvar newrow = data[n];\n\t\t\t\t\t\tnewrow.total_row = true;\n\t\t\t\t\t\ttotal_rows[data[n].pay_stub_entry_account_id] = newrow[n];\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif ( typeof retval[type_id] == 'undefined' ) {\n\t\t\t\t\t\tretval[type_id] = [];\n\t\t\t\t\t}\n\t\t\t\t\tretval[type_id].push( data[n] );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t//set blanks where there are no records in any given sections\n\t\tvar type_ids = [10, 20, 30, 50, 80]; //no net pay default row\n\t\tfor ( var t = 0; t < type_ids.length; t++ ) {\n\t\t\tif ( typeof retval[type_ids[t]] == 'undefined' || retval[type_ids[t]].length == 0 ) {\n\t\t\t\tretval[type_ids[t]] = [];\n\t\t\t\tretval[type_ids[t]].push( { type_id: type_ids[t] } );\n\t\t\t}\n\t\t}\n\n\t\t//Fill up the missing total rows.\n\t\tvar gross_total = {};\n\t\tif ( total_rows[this.pseal_link.total_gross_entry_account_id] ) {\n\t\t\tgross_total = total_rows[this.pseal_link.total_gross_entry_account_id];\n\t\t} else {\n\t\t\tgross_total = {\n\t\t\t\ttotal_row: true,\n\t\t\t\ttype_id: 40,\n\t\t\t\tname: $.i18n._( 'Total Gross' ),\n\t\t\t\tpay_stub_entry_account_id: this.pseal_link.total_gross_entry_account_id\n\t\t\t};\n\t\t}\n\t\tretval[10].push( gross_total );\n\n\t\tvar employee_deduction_total = {};\n\t\tif ( total_rows[this.pseal_link.total_deductions_entry_account_id] ) {\n\t\t\temployee_deduction_total = total_rows[this.pseal_link.total_deductions_entry_account_id];\n\t\t} else {\n\t\t\temployee_deduction_total = {\n\t\t\t\ttotal_row: true,\n\t\t\t\ttype_id: 40,\n\t\t\t\tname: $.i18n._( 'Total Deductions' ),\n\t\t\t\tpay_stub_entry_account_id: this.pseal_link.total_deductions_entry_account_id\n\t\t\t};\n\t\t}\n\t\tretval[20].push( employee_deduction_total );\n\n\t\tvar net_pay_total = {};\n\t\tif ( total_rows[this.pseal_link.net_pay_entry_account_id] ) {\n\t\t\tnet_pay_total = total_rows[this.pseal_link.net_pay_entry_account_id];\n\t\t} else {\n\t\t\tnet_pay_total = {\n\t\t\t\t//total_row: true,\n\t\t\t\ttype_id: 40,\n\t\t\t\tname: $.i18n._( 'Net Pay' ),\n\t\t\t\tpay_stub_entry_account_id: this.pseal_link.net_pay_entry_account_id\n\t\t\t};\n\t\t}\n\t\t//Because we don't add empty rows to retval[40], and there should only ever be one row in net pay, we will need to initialize retval[40] here.\n\t\tretval[40] = net_pay_total;\n\n\t\tvar employer_deduction_total = {};\n\t\tif ( total_rows[this.pseal_link.contributions_entry_account_id] ) {\n\t\t\temployer_deduction_total = total_rows[this.pseal_link.contributions_entry_account_id];\n\t\t} else {\n\t\t\temployer_deduction_total = {\n\t\t\t\ttotal_row: true,\n\t\t\t\ttype_id: 40,\n\t\t\t\tname: $.i18n._( 'Employer Total Contributions' ),\n\t\t\t\tpay_stub_entry_account_id: this.pseal_link.contributions_entry_account_id\n\t\t\t};\n\t\t}\n\t\tretval[30].push( employer_deduction_total );\n\n\t\treturn retval;\n\t}\n\n\tinsideEntryEditorSetValue( val ) {\n\t\tvar $this = this;\n\t\tthis.removeAllRows( true );\n\t\tthis.removeCover();\n\n\t\tfunction setEarnings( data ) {\n\t\t\tvar render = $this.getRender(); //get render, should be a table\n\t\t\tvar headerRow = `\n\t\t\t<tr class=\"tblHeader\">\n\t\t\t\t<td align=\"left\" colspan=\"2\"><%= col1 %></td>\n\t\t\t\t<td> <%= col2 %></td>\n\t\t\t\t<td> <%= col3 %></td>\n\t\t\t\t<td> <%= col4 %></td>\n\t\t\t\t<td> <%= col5 %></td>\n\t\t\t\t<td> <%= col6 %></td>\n\t\t\t\t<td colspan=\"\" style=\"width:60px\"></td>\n\t\t\t</tr>`;\n\t\t\tvar args = {\n\t\t\t\tcol1: $.i18n._( 'Earnings' ),\n\t\t\t\tcol2: $.i18n._( 'Note' ),\n\t\t\t\tcol3: $.i18n._( 'Rate' ),\n\t\t\t\tcol4: $.i18n._( 'Hrs/Units' ),\n\t\t\t\tcol5: $.i18n._( 'Amount' ),\n\t\t\t\tcol6: $.i18n._( 'YTD Amount' )\n\t\t\t};\n\n\t\t\tvar template = _.template( headerRow );\n\t\t\t$( render ).append( template( args ) );\n\n\t\t\t$this.rows_widgets_array.push( true );\n\t\t\tfor ( var i = 0; i < _.size( data ); i++ ) {\n\t\t\t\tif ( Global.isSet( data[i] ) ) {\n\t\t\t\t\tvar row = data[i];\n\t\t\t\t\trow.type_id = 10;\n\t\t\t\t\t$this.addRow( row );\n\t\t\t\t}\n\t\t\t}\n\t\t\t$( render ).append( '<tr><td colspan=\"8\"><br></td></tr>' );\n\t\t\t$this.rows_widgets_array.push( true );\n\t\t}\n\n\t\tfunction getHeaderThreeColumn() {\n\t\t\treturn `\n\t\t\t<tr class=\"tblHeader\">\n\t\t\t\t<td align=\"left\" colspan=\"2\"><%= col1 %></td>\n\t\t\t\t<td colspan=\"3\"> <%= col2 %></td>\n\t\t\t\t<td> <%= col3 %></td>\n\t\t\t\t<td> <%= col4 %></td>\n\t\t\t\t<td colspan=\"\" style=\"width: 30px\"></td>\n\t\t\t</tr>`;\n\t\t}\n\t\tfunction setDeductions( data ) {\n\t\t\tvar render = $this.getRender(); //get render, should be a table\n\t\t\tvar headerRow = getHeaderThreeColumn();\n\t\t\tvar args = {\n\t\t\t\tcol1: $.i18n._( 'Deductions' ),\n\t\t\t\tcol2: $.i18n._( 'Note' ),\n\t\t\t\tcol3: $.i18n._( 'Amount' ),\n\t\t\t\tcol4: $.i18n._( 'YTD Amount' )\n\t\t\t};\n\n\t\t\tvar template = _.template( headerRow );\n\t\t\t$( render ).append( template( args ) );\n\n\t\t\t$this.rows_widgets_array.push( true );\n\t\t\tfor ( var i = 0; i < _.size( data ); i++ ) {\n\t\t\t\tif ( Global.isSet( data[i] ) ) {\n\t\t\t\t\tvar row = data[i];\n\t\t\t\t\trow.type_id = 20;\n\t\t\t\t\t$this.addRow( row );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t$( render ).append( '<tr><td colspan=\"8\"><br></td></tr>' );\n\t\t\t$this.rows_widgets_array.push( true );\n\n\t\t}\n\n\t\tfunction setNetPay( data ) {\n\t\t\tvar render = $this.getRender(); //get render, should be a table\n\t\t\tif ( data ) {\n\t\t\t\t// data.type_id = 40;\n\t\t\t\t$this.addRow( data );\n\t\t\t}\n\n\t\t\t$( render ).append( '<tr><td colspan=\"8\"><br></td></tr>' );\n\t\t\t$this.rows_widgets_array.push( true );\n\n\t\t}\n\n\t\tfunction setMiscellaneous( data ) {\n\t\t\tvar render = $this.getRender(); //get render, should be a table\n\t\t\tvar headerRow = getHeaderThreeColumn();\n\t\t\tvar args = {\n\t\t\t\tcol1: $.i18n._( 'Miscellaneous' ),\n\t\t\t\tcol2: $.i18n._( 'Note' ),\n\t\t\t\tcol3: $.i18n._( 'Amount' ),\n\t\t\t\tcol4: $.i18n._( 'YTD Amount' )\n\t\t\t};\n\n\t\t\tvar template = _.template( headerRow );\n\t\t\t$( render ).append( template( args ) );\n\n\t\t\t$this.rows_widgets_array.push( true );\n\t\t\tfor ( var i in data ) {\n\t\t\t\t$this.addRow( data[i] );\n\t\t\t}\n\t\t\t$( render ).append( '<tr><td colspan=\"8\"><br></td></tr>' );\n\t\t\t$this.rows_widgets_array.push( true );\n\t\t}\n\n\t\tfunction setEmployerContributions( data ) {\n\t\t\tvar render = $this.getRender(); //get render, should be a table\n\t\t\tvar headerRow = getHeaderThreeColumn();\n\t\t\tvar args = {\n\t\t\t\tcol1: $.i18n._( 'Employer Contributions' ),\n\t\t\t\tcol2: $.i18n._( 'Note' ),\n\t\t\t\tcol3: $.i18n._( 'Amount' ),\n\t\t\t\tcol4: $.i18n._( 'YTD Amount' )\n\t\t\t};\n\n\t\t\tvar template = _.template( headerRow );\n\t\t\t$( render ).append( template( args ) );\n\n\t\t\t$this.rows_widgets_array.push( true );\n\t\t\tfor ( var i = 0; i < _.size( data ); i++ ) {\n\t\t\t\tif ( Global.isSet( data[i] ) ) {\n\t\t\t\t\tvar row = data[i];\n\t\t\t\t\trow.type_id = 30;\n\t\t\t\t\t$this.addRow( row );\n\t\t\t\t}\n\t\t\t}\n\t\t\t$( render ).append( '<tr><td colspan=\"8\"><br></td></tr>' );\n\t\t\t$this.rows_widgets_array.push( true );\n\t\t}\n\n\t\tfunction setAccrual( data ) {\n\t\t\tvar render = $this.getRender(); //get render, should be a table\n\t\t\tvar headerRow = getHeaderThreeColumn();\n\t\t\tvar args = {\n\t\t\t\tcol1: $.i18n._( 'Accrual' ),\n\t\t\t\tcol2: $.i18n._( 'Note' ),\n\t\t\t\tcol3: $.i18n._( 'Amount' ),\n\t\t\t\tcol4: $.i18n._( 'Balance' )\n\t\t\t};\n\n\t\t\tvar template = _.template( headerRow );\n\t\t\t$( render ).append( template( args ) );\n\n\t\t\t$this.rows_widgets_array.push( true );\n\t\t\tfor ( var i = 0; i < _.size( data ); i++ ) {\n\t\t\t\tif ( Global.isSet( data[i] ) ) {\n\t\t\t\t\tvar row = data[i];\n\t\t\t\t\trow.type_id = 50;\n\t\t\t\t\t$this.addRow( row );\n\t\t\t\t}\n\t\t\t}\n\t\t\t$( render ).append( '<tr><td colspan=\"8\"><br></td></tr>' );\n\t\t\t$this.rows_widgets_array.push( true );\n\t\t}\n\n\t\tif ( this.parent_controller.isEditMode() == true || this.parent_controller.checkForNonHeaderData( val[10] ) ) {\n\t\t\tsetEarnings( val[10] );\n\t\t}\n\n\t\tif ( this.parent_controller.isEditMode() == true || this.parent_controller.checkForNonHeaderData( val[20] ) ) {\n\t\t\tsetDeductions( val[20] );\n\t\t}\n\n\t\tsetNetPay( val[40] );\n\n\t\tif ( this.parent_controller.isEditMode() == true || this.parent_controller.checkForNonHeaderData( val[80] ) ) {\n\t\t\tsetMiscellaneous( val[80] );\n\t\t}\n\n\t\tif ( this.parent_controller.isEditMode() == true || this.parent_controller.checkForNonHeaderData( val[30] ) ) {\n\t\t\tsetEmployerContributions( val[30] );\n\t\t}\n\n\t\tif ( this.parent_controller.isEditMode() == true || this.parent_controller.checkForNonHeaderData( val[50] ) ) {\n\t\t\tsetAccrual( val[50] );\n\t\t}\n\n\t\tif ( this.parent_controller.editor.transaction_data ) {\n\t\t\tthis.parent_controller.editor.insideTransactionEditorSetValue( this.parent_controller.editor.transaction_data );\n\t\t}\n\n\t\tif ( this.parent_controller.copied_record_id && TTUUID.isUUID( this.parent_controller.copied_record_id ) ) {\n\t\t\tthis.parent_controller.copied_record_id = '';\n\t\t}\n\n\t\tthis.calcTotal();\n\t}\n\n\tcheckForNonHeaderData( data ) {\n\t\tfor ( var n in data ) {\n\t\t\tif ( TTUUID.isUUID( data[n].id ) == true ) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tinsideEntryEditorAddRow( data, index ) {\n\t\tvar $this = this;\n\t\tif ( !data ) {\n\t\t\t$this.addRow( {}, index );\n\t\t} else {\n\t\t\tif ( typeof index != 'undefined' && typeof this.rows_widgets_array[index].ytd_amount != 'undefined' && !data['type_id'] ) {\n\t\t\t\tdata['type_id'] = this.rows_widgets_array[index].ytd_amount.attr( 'type_id' );\n\t\t\t}\n\n\t\t\tfunction renderColumns( data, type, index ) {\n\t\t\t\tvar render = $this.getRender(); //get render, should be a table\n\t\t\t\tvar widgets = {}; //Save each row's widgets\n\t\t\t\tvar row; //Get Row render\n\t\t\t\tvar widgetContainer = $( '<div class=\\'widget-h-box\\'></div>' );\n\t\t\t\tvar right_label;\n\t\t\t\tvar args = { filter_data: {} };\n\t\t\t\tvar pay_stub_amendment_id = '', user_expense_id = '';\n\t\t\t\tvar pay_stub_status_id = $this.parent_controller['current_edit_record']['status_id'];\n\n\t\t\t\tvar is_add = false;\n\n\t\t\t\tif ( ( !$this.parent_controller['current_edit_record']['id'] && !$this.parent_controller.copied_record_id ) || ( !data.id ) ) {\n\t\t\t\t\tis_add = true;\n\t\t\t\t}\n\n\t\t\t\tif ( pay_stub_status_id == 40 || pay_stub_status_id == 100 ) {\n\t\t\t\t\tis_add = false;\n\t\t\t\t}\n\n\t\t\t\tif ( TTUUID.isUUID( data['pay_stub_amendment_id'] ) && data['pay_stub_amendment_id'] != TTUUID.zero_id ) {\n\t\t\t\t\tpay_stub_amendment_id = data['pay_stub_amendment_id'];\n\t\t\t\t}\n\t\t\t\tif ( TTUUID.isUUID( data['user_expense_id'] ) && data['user_expense_id'] != TTUUID.zero_id ) {\n\t\t\t\t\tuser_expense_id = data['user_expense_id'];\n\t\t\t\t}\n\n\t\t\t\tif ( $this.parent_controller.copied_record_id ) {\n\t\t\t\t\tpay_stub_amendment_id = '';\n\t\t\t\t\tuser_expense_id = '';\n\t\t\t\t}\n\n\t\t\t\tvar row_enabled = true;\n\t\t\t\t// if the pay_stub_amendment_id and user_expense_id all >0 how to display the right label?\n\t\t\t\tif ( TTUUID.isUUID( pay_stub_amendment_id ) && pay_stub_amendment_id != TTUUID.zero_id ) {\n\t\t\t\t\tright_label = $( '<span class=\\'widget-right-label\\'> (' + $.i18n._( 'Amendment' ) + ')</span>' );\n\t\t\t\t\trow_enabled = false;\n\t\t\t\t} else if ( TTUUID.isUUID( user_expense_id ) && user_expense_id != TTUUID.zero_id ) {\n\t\t\t\t\tright_label = $( '<span class=\\'widget-right-label\\'> (' + $.i18n._( 'Expense' ) + ')</span>' );\n\t\t\t\t\trow_enabled = false;\n\t\t\t\t}\n\n\t\t\t\tif ( type == 10 ) {\n\t\t\t\t\trow = $( `<tr class=\"tblDataWhite\" align=\"right\">\n\t\t\t\t\t\t\t\t<td align=\"left\" colspan=\"2\"></td>\n\t\t\t\t\t\t\t\t<td class=\"\"></td>\n\t\t\t\t\t\t\t\t<td class=\"\"></td>\n\t\t\t\t\t\t\t\t<td class=\"\"></td>\n\t\t\t\t\t\t\t\t<td class=\"\"></td>\n\t\t\t\t\t\t\t\t<td class=\"\"></td>\n\t\t\t\t\t\t\t\t<td colspan=\"2\" class=\"cell control-icon\">\n\t\t\t\t\t\t\t\t\t<div>\n\t\t\t\t\t\t\t\t\t\t<button class=\"plus-icon\" onclick=\"\"></button>\n\t\t\t\t\t\t\t\t\t\t<button class=\"minus-icon \" onclick=\"\"></button>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t</tr>` );\n\t\t\t\t} else {\n\t\t\t\t\trow = $( `<tr class=\"tblDataWhite\" align=\"right\">\n\t\t\t\t\t\t<td align=\"left\" colspan=\"2\"></td>\n\t\t\t\t\t\t<td class=\"\" colspan=\"3\"></td>\n\t\t\t\t\t\t<td class=\"\"></td>\n\t\t\t\t\t\t<td class=\"\"></td>\n\t\t\t\t\t\t<td colspan=\"2\" class=\"cell control-icon\" style=\"width: 30px\">\n\t\t\t\t\t\t\t<button class=\"plus-icon\" onclick=\"\"></button>\n\t\t\t\t\t\t\t<button class=\"minus-icon \" onclick=\"\"></button>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t</tr>` );\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t// Pay Stub Account\n\t\t\t\tvar form_item_name_input = Global.loadWidgetByName( FormItemType.AWESOME_BOX );\n\t\t\t\tform_item_name_input.AComboBox( {\n\t\t\t\t\tapi_class: TTAPI.APIPayStubEntryAccount,\n\t\t\t\t\twidth: 132,\n\t\t\t\t\tis_static_width: 132,\n\t\t\t\t\tallow_multiple_selection: false,\n\t\t\t\t\tlayout_name: 'global_PayStubAccount',\n\t\t\t\t\tshow_search_inputs: true,\n\t\t\t\t\tset_empty: true,\n\t\t\t\t\tfield: 'pay_stub_entry_name_id'\n\t\t\t\t} );\n\t\t\t\tform_item_name_input.setValue( data.pay_stub_entry_name_id );\n\t\t\t\tform_item_name_input.setEnabled( row_enabled );\n\n\t\t\t\tform_item_name_input.unbind( 'formItemChange' ).bind( 'formItemChange', function( e, target ) {\n\t\t\t\t\t$this.onFormItemChange( target );\n\t\t\t\t} );\n\n\t\t\t\tvar form_item_name_text = Global.loadWidgetByName( FormItemType.TEXT );\n\t\t\t\tform_item_name_text.TText( { field: 'name' } );\n\t\t\t\tform_item_name_text.setValue( data.name ? ( ( data['type_id'] != 40 ) ? ' ' + data.name : data.name ) : '' );\n\n\t\t\t\t// Note(description)\n\t\t\t\tvar form_item_note_input = Global.loadWidgetByName( FormItemType.TEXT_INPUT );\n\t\t\t\tform_item_note_input.TTextInput( { field: 'description', width: 300, display_na: false } );\n\t\t\t\tform_item_note_input.setValue( data.description );\n\t\t\t\tform_item_note_input.attr( 'editable', true );\n\n\t\t\t\tvar form_item_note_text = Global.loadWidgetByName( FormItemType.TEXT );\n\t\t\t\tform_item_note_text.TText( { field: 'description', display_na: false } );\n\t\t\t\tform_item_note_text.setValue( data.description ? data.description : ' ' );\n\n\t\t\t\t// Rate\n\t\t\t\tvar form_item_rate_input = Global.loadWidgetByName( FormItemType.TEXT_INPUT );\n\t\t\t\tform_item_rate_input.TTextInput( { field: 'rate', width: 60, hasKeyEvent: true } );\n\t\t\t\tform_item_rate_input.setValue( Global.removeTrailingZeros( data.rate ) );\n\t\t\t\tform_item_rate_input.attr( 'editable', true );\n\t\t\t\tform_item_rate_input.unbind( 'formItemKeyUp' ).bind( 'formItemKeyUp', function( e, target ) {\n\t\t\t\t\t$this.onFormItemKeyUp( target );\n\t\t\t\t} );\n\n\t\t\t\tform_item_rate_input.unbind( 'formItemKeyDown' ).bind( 'formItemKeyDown', function( e, target ) {\n\t\t\t\t\t$this.onFormItemKeyDown( target );\n\t\t\t\t} );\n\n\t\t\t\tform_item_rate_input.unbind( 'formItemChange' ).bind( 'formItemChange', function( e, target ) {\n\t\t\t\t\t$this.onFormItemChange( target );\n\t\t\t\t} );\n\n\t\t\t\tvar form_item_rate_text = Global.loadWidgetByName( FormItemType.TEXT );\n\t\t\t\tform_item_rate_text.TText( { field: 'rate' } );\n\t\t\t\tform_item_rate_text.setValue( Global.removeTrailingZeros( data.rate ) );\n\n\t\t\t\t// Hrs/Units\n\t\t\t\tvar form_item_units_input = Global.loadWidgetByName( FormItemType.TEXT_INPUT );\n\t\t\t\tform_item_units_input.TTextInput( { field: 'units', width: 60, hasKeyEvent: true } );\n\t\t\t\tform_item_units_input.setValue( Global.removeTrailingZeros( data.units ) );\n\t\t\t\tform_item_units_input.attr( 'editable', true );\n\t\t\t\tform_item_units_input.unbind( 'formItemKeyUp' ).bind( 'formItemKeyUp', function( e, target ) {\n\t\t\t\t\t$this.onFormItemKeyUp( target );\n\t\t\t\t} );\n\n\t\t\t\tform_item_units_input.unbind( 'formItemKeyDown' ).bind( 'formItemKeyDown', function( e, target ) {\n\t\t\t\t\t$this.onFormItemKeyDown( target );\n\t\t\t\t} );\n\t\t\t\tform_item_units_input.unbind( 'formItemChange' ).bind( 'formItemChange', function( e, target ) {\n\t\t\t\t\t$this.onFormItemChange( target );\n\t\t\t\t} );\n\n\t\t\t\tvar form_item_units_text = Global.loadWidgetByName( FormItemType.TEXT );\n\t\t\t\tform_item_units_text.TText( { field: 'units' } );\n\t\t\t\tform_item_units_text.setValue( Global.removeTrailingZeros( data.units ) );\n\n\t\t\t\t// Amount\n\t\t\t\tvar form_item_amount_input = Global.loadWidgetByName( FormItemType.TEXT_INPUT );\n\t\t\t\tform_item_amount_input.TTextInput( { field: 'amount', width: 60 } );\n\t\t\t\tform_item_amount_input.setValue( Global.removeTrailingZeros( data.amount ) );\n\n\t\t\t\tform_item_amount_input.unbind( 'formItemKeyUp' ).bind( 'formItemKeyUp', function( e, target ) {\n\t\t\t\t\t$this.onFormItemKeyUp( target );\n\t\t\t\t} );\n\n\t\t\t\tform_item_amount_input.unbind( 'formItemKeyDown' ).bind( 'formItemKeyDown', function( e, target ) {\n\t\t\t\t\t$this.onFormItemKeyDown( target );\n\t\t\t\t} );\n\n\t\t\t\tform_item_amount_input.unbind( 'formItemChange' ).bind( 'formItemChange', function( e, target ) {\n\t\t\t\t\t$this.onFormItemChange( target );\n\t\t\t\t} );\n\n\t\t\t\tvar form_item_amount_text = Global.loadWidgetByName( FormItemType.TEXT );\n\t\t\t\tform_item_amount_text.TText( { field: 'amount' } );\n\t\t\t\tform_item_amount_text.setValue( Global.removeTrailingZeros( data.amount ) );\n\n\t\t\t\t// YTD Amount\n\t\t\t\tvar form_item_ytd_amount_text = Global.loadWidgetByName( FormItemType.TEXT );\n\t\t\t\tform_item_ytd_amount_text.TText( { field: 'ytd_amount' } );\n\t\t\t\tform_item_ytd_amount_text.setValue( Global.removeTrailingZeros( data.ytd_amount ) );\n\t\t\t\tform_item_ytd_amount_text.attr( {\n\t\t\t\t\t'pay_stub_entry_id': ( data.id && $this.parent_controller.current_edit_record.id ) ? data.id : '',\n\t\t\t\t\t'type_id': data['type_id'],\n\t\t\t\t\t'original_amount': data['amount'] ? data['amount'] : '0.00',\n\t\t\t\t\t'original_ytd_amount': data['ytd_amount'] ? data['ytd_amount'] : '0.00',\n\t\t\t\t\t'pay_stub_entry_name_id': data['pay_stub_entry_name_id'] ? data['pay_stub_entry_name_id'] : null\n\t\t\t\t} );\n\n//\t\t\t\tif ( !$this.parent_controller.copied_record_id ) {\n\t\t\t\tform_item_ytd_amount_text.attr( 'pay_stub_amendment_id', pay_stub_amendment_id );\n\t\t\t\tform_item_ytd_amount_text.attr( 'user_expense_id', user_expense_id );\n//\t\t\t\t}\n\n\t\t\t\tif ( parseFloat( data['ytd_amount'] ) != 0 ) {\n\n\t\t\t\t} else if ( pay_stub_status_id == 40 || pay_stub_status_id == 100 || data.total_row === true ) {\n\t\t\t\t\tform_item_ytd_amount_text.text( '-' );\n\t\t\t\t}\n\n\t\t\t\tif ( data.rate && parseFloat( data.rate ) != 0 && !$this.parent_controller.copied_record_id ) {\n\t\t\t\t\tform_item_amount_input.setReadOnly( true );\n\t\t\t\t} else if ( pay_stub_status_id == 40 || pay_stub_status_id == 100 || data.total_row === true ) {\n\t\t\t\t\tform_item_rate_text.text( '-' );\n\t\t\t\t}\n\n\t\t\t\tif ( data.units && parseFloat( data.units ) != 0 && !$this.parent_controller.copied_record_id ) {\n\t\t\t\t\tform_item_amount_input.setReadOnly( true );\n\t\t\t\t} else if ( pay_stub_status_id == 40 || pay_stub_status_id == 100 || data.total_row === true ) {\n\t\t\t\t\tform_item_units_text.text( '-' );\n\t\t\t\t}\n\n\t\t\t\t// name\n\t\t\t\tif ( type == 40 || data.total_row === true ) {\n\t\t\t\t\tif ( data['type_id'] == 40 || data.total_row === true ) {\n\t\t\t\t\t\tform_item_name_text.css( 'font-weight', 'bold' );\n\t\t\t\t\t}\n\t\t\t\t\twidgets[form_item_name_text.getField()] = form_item_name_text;\n\t\t\t\t\twidgetContainer.append( form_item_name_text );\n\t\t\t\t\twidgetContainer.append( right_label );\n\t\t\t\t\trow.children().eq( 0 ).append( widgetContainer );\n\n\t\t\t\t} else {\n\t\t\t\t\tif ( $this.parent_controller.isEditMode() == true || index ) {\n\n\t\t\t\t\t\tif ( data['type_id'] == 40 || data.total_row === true ) {\n\t\t\t\t\t\t\tform_item_name_text.css( 'font-weight', 'bold' );\n\t\t\t\t\t\t\twidgets[form_item_name_text.getField()] = form_item_name_text;\n\t\t\t\t\t\t\twidgetContainer.append( form_item_name_text );\n\t\t\t\t\t\t\twidgetContainer.append( right_label );\n\t\t\t\t\t\t\trow.children().eq( 0 ).append( widgetContainer );\n\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\targs['filter_data']['type_id'] = [type];\n\t\t\t\t\t\t\tform_item_name_input.setDefaultArgs( args );\n\t\t\t\t\t\t\twidgets[form_item_name_input.getField()] = form_item_name_input;\n\t\t\t\t\t\t\twidgetContainer.append( form_item_name_input );\n\t\t\t\t\t\t\twidgetContainer.append( right_label );\n\t\t\t\t\t\t\trow.children().eq( 0 ).append( widgetContainer );\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif ( data['type_id'] == 40 || data.total_row === true ) {\n\t\t\t\t\t\t\tform_item_name_text.css( 'font-weight', 'bold' );\n\t\t\t\t\t\t}\n\t\t\t\t\t\twidgets[form_item_name_text.getField()] = form_item_name_text;\n\t\t\t\t\t\twidgetContainer.append( form_item_name_text );\n\t\t\t\t\t\twidgetContainer.append( right_label );\n\t\t\t\t\t\trow.children().eq( 0 ).append( widgetContainer );\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Note\n\t\t\t\tif ( ( data['type_id'] == type.toString() || data['type_id'] === type ) && type != 40 && !data.total_row ) {\n\t\t\t\t\tif ( $this.parent_controller.isEditMode() == true ) {\n\t\t\t\t\t\tif ( ( ( TTUUID.isUUID( pay_stub_amendment_id ) && pay_stub_amendment_id != TTUUID.zero_id ) || ( TTUUID.isUUID( user_expense_id ) && user_expense_id != TTUUID.zero_id ) ) ) {\n\t\t\t\t\t\t\tform_item_note_input.setReadOnly( true );\n\t\t\t\t\t\t}\n\t\t\t\t\t\twidgets[form_item_note_input.getField()] = form_item_note_input;\n\t\t\t\t\t\trow.children().eq( 1 ).append( form_item_note_input );\n\n\t\t\t\t\t} else {\n\t\t\t\t\t\twidgets[form_item_note_text.getField()] = form_item_note_text;\n\t\t\t\t\t\trow.children().eq( 1 ).append( form_item_note_text );\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif ( Global.isSet( index ) || is_add || ( _.size( data ) === 1 && ( $this.parent_controller.isEditMode() == true ) ) ) {\n\t\t\t\t\t\tif ( ( data['type_id'] == 40 || data.total_row === true ) ) {\n\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\twidgets[form_item_note_input.getField()] = form_item_note_input;\n\t\t\t\t\t\t\trow.children().eq( 1 ).append( form_item_note_input );\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} else if ( type == 20 || type == 30 || type == 50 || type == 80 ) {\n\t\t\t\t\t\twidgets[form_item_note_text.getField()] = form_item_note_text;\n\t\t\t\t\t\trow.children().eq( 1 ).append( form_item_note_text );\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// amount\n\t\t\t\tif ( ( data['type_id'] === type.toString() || data['type_id'] === type ) && type != 40 && !data.total_row ) {\n\t\t\t\t\tif ( $this.parent_controller.isEditMode() == true ) {\n\t\t\t\t\t\tif ( ( TTUUID.isUUID( pay_stub_amendment_id ) && pay_stub_amendment_id != TTUUID.zero_id ) || ( TTUUID.isUUID( user_expense_id ) && user_expense_id != TTUUID.zero_id ) ) {\n\t\t\t\t\t\t\tform_item_amount_input.setReadOnly( true );\n\t\t\t\t\t\t}\n\t\t\t\t\t\twidgets[form_item_amount_input.getField()] = form_item_amount_input;\n\t\t\t\t\t\tif ( type == 10 ) {\n\t\t\t\t\t\t\trow.children().eq( 4 ).append( form_item_amount_input );\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\trow.children().eq( 2 ).append( form_item_amount_input );\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\twidgets[form_item_amount_text.getField()] = form_item_amount_text;\n\t\t\t\t\t\tif ( type == 10 ) {\n\t\t\t\t\t\t\trow.children().eq( 4 ).append( form_item_amount_text );\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\trow.children().eq( 2 ).append( form_item_amount_text );\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif ( ( Global.isSet( index ) || is_add || ( _.size( data ) === 1 && ( $this.parent_controller.isEditMode() == true ) ) ) && type != 40 && !data.total_row ) {\n\n\t\t\t\t\t\tif ( data['type_id'] == 40 ) {\n\t\t\t\t\t\t\tform_item_amount_text.css( 'font-weight', 'bold' );\n\t\t\t\t\t\t\twidgets[form_item_amount_text.getField()] = form_item_amount_text;\n\t\t\t\t\t\t\tif ( type == 10 ) {\n\t\t\t\t\t\t\t\trow.children().eq( 4 ).append( form_item_amount_text );\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\trow.children().eq( 2 ).append( form_item_amount_text );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\twidgets[form_item_amount_input.getField()] = form_item_amount_input;\n\t\t\t\t\t\t\tif ( type == 10 ) {\n\t\t\t\t\t\t\t\trow.children().eq( 4 ).append( form_item_amount_input );\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\trow.children().eq( 2 ).append( form_item_amount_input );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif ( ( data['type_id'] == 40 || data.total_row ) && type == 30 ) {\n\t\t\t\t\t\t\tform_item_amount_text.css( 'font-weight', 'bold' );\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tform_item_amount_text.css( 'font-weight', 'bold' );\n\t\t\t\t\t\t}\n\t\t\t\t\t\twidgets[form_item_amount_text.getField()] = form_item_amount_text;\n\t\t\t\t\t\tif ( type == 10 ) {\n\t\t\t\t\t\t\trow.children().eq( 4 ).append( form_item_amount_text );\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\trow.children().eq( 2 ).append( form_item_amount_text );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Ytd amount\n\t\t\t\tif ( data['type_id'] == 40 || data.total_row ) {\n\t\t\t\t\tform_item_ytd_amount_text.css( 'font-weight', 'bold' );\n\t\t\t\t}\n\t\t\t\tif ( ( Global.isSet( index ) || is_add || _.size( data ) === 1 ) && type != 40 ) {\n\t\t\t\t\tform_item_ytd_amount_text.text( '-' );\n\t\t\t\t}\n\t\t\t\twidgets[form_item_ytd_amount_text.getField()] = form_item_ytd_amount_text;\n\t\t\t\tif ( type == 10 ) {\n\t\t\t\t\trow.children().eq( 5 ).append( form_item_ytd_amount_text );\n\t\t\t\t} else {\n\t\t\t\t\trow.children().eq( 3 ).append( form_item_ytd_amount_text );\n\t\t\t\t}\n\n\t\t\t\tif ( type == 10 ) { // && !data.total_row ) {\n\n\t\t\t\t\t// rate\n\t\t\t\t\tif ( data['type_id'] == 10 && !data.total_row ) {\n\t\t\t\t\t\tif ( $this.parent_controller.isEditMode() == true ) {\n\t\t\t\t\t\t\tif ( ( TTUUID.isUUID( pay_stub_amendment_id ) && pay_stub_amendment_id != TTUUID.zero_id ) || ( TTUUID.isUUID( user_expense_id ) && user_expense_id != TTUUID.zero_id ) ) {\n\t\t\t\t\t\t\t\tform_item_rate_input.setReadOnly( true );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\twidgets[form_item_rate_input.getField()] = form_item_rate_input;\n\t\t\t\t\t\t\trow.children().eq( 2 ).append( form_item_rate_input );\n\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\twidgets[form_item_rate_text.getField()] = form_item_rate_text;\n\t\t\t\t\t\t\trow.children().eq( 2 ).append( form_item_rate_text );\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif ( Global.isSet( index ) || is_add ) {\n\t\t\t\t\t\t\tif ( data['type_id'] == 40 || data.total_row ) {\n\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\twidgets[form_item_rate_input.getField()] = form_item_rate_input;\n\t\t\t\t\t\t\t\trow.children().eq( 2 ).append( form_item_rate_input );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// units\n\t\t\t\t\tif ( data['type_id'] == 10 && !data.total_row ) {\n\t\t\t\t\t\tif ( $this.parent_controller.isEditMode() == true ) {\n\t\t\t\t\t\t\tif ( ( TTUUID.isUUID( pay_stub_amendment_id ) && pay_stub_amendment_id != TTUUID.zero_id ) || ( TTUUID.isUUID( user_expense_id ) && user_expense_id != TTUUID.zero_id ) ) {\n\t\t\t\t\t\t\t\tform_item_units_input.setReadOnly( true );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\twidgets[form_item_units_input.getField()] = form_item_units_input;\n\t\t\t\t\t\t\trow.children().eq( 3 ).append( form_item_units_input );\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\twidgets[form_item_units_text.getField()] = form_item_units_text;\n\t\t\t\t\t\t\trow.children().eq( 3 ).append( form_item_units_text );\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif ( Global.isSet( index ) || is_add ) {\n\n\t\t\t\t\t\t\tif ( data['type_id'] == 40 || data.total_row ) {\n\t\t\t\t\t\t\t\tform_item_units_text.css( 'font-weight', 'bold' );\n\t\t\t\t\t\t\t\twidgets[form_item_units_text.getField()] = form_item_units_text;\n\t\t\t\t\t\t\t\trow.children().eq( 3 ).append( form_item_units_text );\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\twidgets[form_item_units_input.getField()] = form_item_units_input;\n\t\t\t\t\t\t\t\trow.children().eq( 3 ).append( form_item_units_input );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tform_item_units_text.css( 'font-weight', 'bold' );\n\t\t\t\t\t\t\twidgets[form_item_units_text.getField()] = form_item_units_text;\n\t\t\t\t\t\t\trow.children().eq( 3 ).append( form_item_units_text );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\t//Build row widgets\n\t\t\t\tif ( ( TTUUID.isUUID( pay_stub_amendment_id ) && pay_stub_amendment_id != TTUUID.zero_id ) || ( TTUUID.isUUID( user_expense_id ) && user_expense_id != TTUUID.zero_id ) ) {\n\t\t\t\t\trow.children().last().find( '.minus-icon ' ).hide();\n\t\t\t\t}\n\n\t\t\t\tif ( data['total_row'] == true ) {\n\t\t\t\t\twidgets['total_row'] = true;\n\t\t\t\t}\n\n\t\t\t\tif ( typeof data['type_id'] != 'undefined' ) {\n\t\t\t\t\twidgets['type_id'] = data['type_id'];\n\t\t\t\t}\n\n\t\t\t\tif ( data['pay_stub_entry_account_id'] == $this.parent_controller.pseal_link.net_pay_entry_account_id ) {\n\t\t\t\t\twidgets['pay_stub_entry_account_id'] = $this.parent_controller.pseal_link.net_pay_entry_account_id;\n\t\t\t\t}\n\n\t\t\t\tif ( typeof index !== 'undefined' ) {\n\t\t\t\t\trow.insertAfter( $( render ).find( 'tr' ).eq( index ) );\n\t\t\t\t\t$this.rows_widgets_array.splice( ( index + 1 ), 0, widgets );\n\n\t\t\t\t} else {\n\t\t\t\t\t$( render ).append( row );\n\t\t\t\t\t$this.rows_widgets_array.push( widgets );\n\t\t\t\t}\n\n\t\t\t\tif ( $this.parent_controller.isEditMode() == true ) {\n\t\t\t\t\t$this.addIconsEvent( row ); //Bind event to add and minus icon\n\t\t\t\t} else {\n\t\t\t\t\trow.children().last().empty();\n\t\t\t\t}\n\n\t\t\t\tif ( data.total_row || data.type_id == 40 ) {\n\t\t\t\t\trow.find( '.plus-icon' ).remove();\n\t\t\t\t\trow.find( '.minus-icon' ).remove();\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( data['type_id'] == 10 ) {\n\t\t\t\trenderColumns( data, 10, index );\n\t\t\t} else if ( data['type_id'] == 20 ) {\n\t\t\t\trenderColumns( data, 20, index );\n\t\t\t} else if ( data['type_id'] == 30 ) {\n\t\t\t\trenderColumns( data, 30, index );\n\t\t\t} else if ( data['type_id'] == 40 ) {\n\t\t\t\trenderColumns( data, 40, index );\n\t\t\t} else if ( data['type_id'] == 50 ) {\n\t\t\t\trenderColumns( data, 50, index );\n\t\t\t} else if ( data['type_id'] == 80 ) {\n\t\t\t\trenderColumns( data, 80, index );\n\t\t\t}\n\n\t\t}\n\t}\n\n\tinsideEntryEditorRemoveRow( row ) {\n\t\tvar index = row[0].rowIndex;\n\t\tif ( this.rows_widgets_array[index].ytd_amount ) {\n\t\t\tvar remove_id = this.rows_widgets_array[index].ytd_amount.attr( 'pay_stub_entry_id' );\n\t\t\tvar type_id = this.rows_widgets_array[index].ytd_amount.attr( 'type_id' );\n\t\t\tif ( TTUUID.isUUID( remove_id ) ) {\n\t\t\t\tthis.delete_ids.push( remove_id );\n\t\t\t}\n\t\t\trow.remove();\n\t\t\tif ( this.rows_widgets_array[index - 1] === true && ( this.rows_widgets_array[index + 1]['total_row'] === true || this.rows_widgets_array[index + 1] === true ) ) {\n\t\t\t\tthis.addRow( { id: '', type_id: type_id }, index - 1 );\n\t\t\t\tthis.rows_widgets_array.splice( index + 1, 1 ); //Remove from the array used in calcTotal()\n\t\t\t} else {\n\t\t\t\tthis.rows_widgets_array.splice( index, 1 ); //Remove from the array used in calcTotal()\n\t\t\t}\n\n\t\t}\n\t\tthis.calcTotal();\n\t}\n\n\tsavePayStub( record, callbackFunction ) {\n\t\t// when the user create a new pay stub record have them can send entries to api.\n\t\tif ( this.include_pay_stub_accounts ) {\n\t\t\tvar entries = this.saveInsideEntryEditorData();\n\t\t\tvar transactions = this.saveInsideTransactionEditorData();\n\t\t\tif ( entries.length > 0 ) {\n\t\t\t\trecord['entries'] = entries;\n\t\t\t}\n\t\t\tif ( transactions.length > 0 ) {\n\t\t\t\trecord['transactions'] = transactions;\n\t\t\t}\n\t\t}\n\t\tcallbackFunction();\n\t}\n\n\tonSaveClick( ignoreWarning ) {\n\t\tif ( this.is_mass_editing ) {\n\t\t\tthis.include_pay_stub_accounts = false;\n\t\t}\n\t\tsuper.onSaveClick( ignoreWarning );\n\t}\n\n\tdoSaveAPICall( record, ignoreWarning, callback ) {\n\t\tthis.savePayStub( record, () => {\n\t\t\tsuper.doSaveAPICall( record, true, callback );\n\t\t} );\n\t}\n\n\tonSaveDone( result ) {\n\t\tthis.current_edit_record = null;\n\t\treturn true;\n\t}\n\n\tsaveInsideTransactionEditorData( callBack ) {\n\t\t//called by validation function\n\t\tvar $this = this;\n\t\tvar data = this.editor.insideTransactionEditorGetValue( $this.current_edit_record.id ? $this.current_edit_record.id : '' );\n\n\t\tif ( this.editor.delete_transaction_ids.length > 0 ) {\n\t\t\tfor ( var i = 0; i < this.editor.delete_transaction_ids.length; i++ ) {\n\t\t\t\tfor ( var n = 0; n < data.length; n++ ) {\n\t\t\t\t\tif ( this.editor.delete_transaction_ids[i] == data[n].id ) {\n\t\t\t\t\t\tdata[n].deleted = 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn data;\n\t}\n\n\tonCopyAsNewClick() {\n\t\tvar $this = this;\n\t\tvar reload_entries = false;\n\t\tthis.setCurrentEditViewState( 'new' );\n\t\tLocalCacheData.current_doing_context_action = 'copy_as_new';\n\t\tif ( Global.isSet( this.edit_view ) ) {\n//\t\t\tfor ( var i = 0; i < this.editor.rows_widgets_array.length; i++ ) {\n//\t\t\t\tif ( this.editor.rows_widgets_array[i] === true ) {\n//\t\t\t\t\tcontinue;\n//\t\t\t\t}\n//\t\t\t\tthis.editor.rows_widgets_array[i].ytd_amount.attr( 'pay_stub_entry_id', '' );\n//\t\t\t\tthis.editor.rows_widgets_array[i].ytd_amount.removeAttr( 'pay_stub_amendment_id' );\n//\t\t\t\tthis.editor.rows_widgets_array[i].ytd_amount.removeAttr( 'user_expense_id' );\n//\t\t\t}\n\t\t\tthis.copied_record_id = this.current_edit_record.id;\n\t\t\tthis.current_edit_record.id = '';\n\n\t\t\tthis.edit_view_ui_dic.user_id.setEnabled( true );\n\t\t\tif ( this.current_edit_record.status_id != 25 ) {\n\t\t\t\tthis.current_edit_record.status_id = 25;\n\t\t\t\tthis.edit_view_ui_dic.status_id.setValue( 25 );\n//\t\t\t\tthis.editor.show_cover = false;\n//\t\t\t\tthis.include_pay_stub_accounts = true;\n//\t\t\t\treload_entries = true;\n\t\t\t}\n\t\t\tthis.editor.show_cover = false;\n//\t\t\tthis.editor.removeCover();\n\n\t\t\tvar navigation_div = this.edit_view.find( '.navigation-div' );\n\t\t\tnavigation_div.css( 'display', 'none' );\n\t\t\tthis.setEditMenu();\n\t\t\tthis.setTabStatus();\n\t\t\tthis.is_changed = false;\n\t\t\t// reset the entries data.\n//\t\t\tif ( reload_entries ) {\n\t\t\tthis.editor.removeAllRows( true );\n\t\t\tthis.initInsideEntryEditorData();\n//\t\t\t}\n\n\t\t\tProgressBar.closeOverlay();\n\n\t\t} else {\n\n\t\t\tvar filter = {};\n\t\t\tvar grid_selected_id_array = this.getGridSelectIdArray();\n\t\t\tvar grid_selected_length = grid_selected_id_array.length;\n\t\t\tvar selectedId;\n\n\t\t\tif ( grid_selected_length > 0 ) {\n\t\t\t\tselectedId = grid_selected_id_array[0];\n\n\t\t\t\tfilter.filter_data = {};\n\t\t\t\tfilter.filter_data.id = [selectedId];\n\n\t\t\t\tthis.api['get' + this.api.key_name]( filter, {\n\t\t\t\t\tonResult: function( result ) {\n\t\t\t\t\t\t$this.onCopyAsNewResult( result );\n\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t} else {\n\t\t\t\tTAlertManager.showAlert( $.i18n._( 'No selected record' ) );\n\t\t\t}\n\n\t\t}\n\t}\n\n\tinitEditView() {\n\t\tthis.original_status_id = this.current_edit_record.status_id;\n\t\tsuper.initEditView();\n\t}\n\n\tonSubViewRemoved() {\n\t\tthis.search();\n\n\t\tif ( !this.edit_view ) {\n\t\t\tthis.setDefaultMenu();\n\t\t} else {\n\t\t\tthis.setEditMenu();\n\t\t}\n\t}\n\n\tonCopyAsNewResult( result ) {\n\t\tvar $this = this;\n\t\tvar result_data = result.getResult();\n\n\t\tif ( !result_data ) {\n\t\t\tTAlertManager.showAlert( $.i18n._( 'Record does not exist' ) );\n\t\t\t$this.onCancelClick();\n\t\t\treturn;\n\t\t}\n\n\t\t$this.openEditView(); // Put it here is to avoid if the selected one is not existed in data or have deleted by other pragram. in this case, the edit view should not be opend.\n\n\t\tresult_data = result_data[0];\n\t\tthis.copied_record_id = result_data.id;\n\t\tresult_data.id = '';\n\t\tif ( $this.sub_view_mode && $this.parent_key ) {\n\t\t\tresult_data[$this.parent_key] = $this.parent_value;\n\t\t}\n\t\tif ( result_data.status_id != 25 ) {\n\t\t\tresult_data.status_id = 25; // If its status is not open then set it to open status.\n\t\t}\n\n\t\t$this.current_edit_record = result_data;\n\t\t$this.editor.show_cover = false;\n\t\t$this.initEditView();\n\t}\n\n\tonSaveAndContinue( ignoreWarning ) {\n\t\tvar $this = this;\n\t\tif ( !Global.isSet( ignoreWarning ) ) {\n\t\t\tignoreWarning = false;\n\t\t}\n\t\tthis.is_changed = false;\n\t\tthis.is_add = false;\n\t\tLocalCacheData.current_doing_context_action = 'save_and_continue';\n\t\tvar record = this.current_edit_record;\n\t\tthis.original_status_id = record.status_id;\n\n\t\trecord = this.uniformVariable( record );\n\n\t\tthis.savePayStub( record, function() {\n\t\t\t$this.api['set' + $this.api.key_name]( record, false, ignoreWarning, {\n\t\t\t\tonResult: function( result ) {\n\t\t\t\t\t$this.onSaveAndContinueResult( result );\n\n\t\t\t\t}\n\t\t\t} );\n\t\t} );\n\t}\n\n\tonCancelClick() {\n\t\tTTPromise.reject( 'PayStubViewController', 'insideEditorDataLoaded' );\n\t\tsuper.onCancelClick();\n\t}\n\n\topenEditView() {\n\t\tif ( this.editor ) {\n\t\t\tthis.editor.transaction_data = false;\n\t\t}\n\t\tTTPromise.reject( 'PayStubViewController', 'insideEditorDataLoaded' );\n\t\tsuper.openEditView();\n\t}\n\n\tonMassEditClick() {\n\t\tvar $this = this;\n\t\t$this.is_add = false;\n\t\t$this.is_viewing = false;\n\t\t$this.is_mass_editing = true;\n\t\tLocalCacheData.current_doing_context_action = 'mass_edit';\n\t\t$this.openEditView();\n\t\tvar filter = {};\n\t\tvar grid_selected_id_array = this.getGridSelectIdArray();\n\t\tvar grid_selected_length = grid_selected_id_array.length;\n\t\tthis.mass_edit_record_ids = [];\n\n\t\t$.each( grid_selected_id_array, function( index, value ) {\n\t\t\t$this.mass_edit_record_ids.push( value );\n\t\t} );\n\n\t\tfilter.filter_data = {};\n\t\tfilter.filter_data.id = this.mass_edit_record_ids;\n\n\t\tthis.api['getCommon' + this.api.key_name + 'Data']( filter, {\n\t\t\tonResult: function( result ) {\n\t\t\t\tvar result_data = result.getResult();\n\n\t\t\t\tif ( !result_data ) {\n\t\t\t\t\tresult_data = [];\n\t\t\t\t}\n\n\t\t\t\t$this.api['getOptions']( 'unique_columns', {\n\t\t\t\t\tonResult: function( result ) {\n\t\t\t\t\t\t$this.unique_columns = result.getResult();\n\t\t\t\t\t\t$this.api['getOptions']( 'linked_columns', {\n\t\t\t\t\t\t\tonResult: function( result1 ) {\n\t\t\t\t\t\t\t\t$this.linked_columns = result1.getResult();\n\t\t\t\t\t\t\t\tif ( $this.sub_view_mode && $this.parent_key ) {\n\t\t\t\t\t\t\t\t\tresult_data[$this.parent_key] = $this.parent_value;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t$this.current_edit_record = result_data;\n\t\t\t\t\t\t\t\t$this.initEditView();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} );\n\n\t\t\t\t\t}\n\t\t\t\t} );\n\n\t\t\t}\n\t\t} );\n\t}\n\n\tonSaveAndContinueResult( result ) {\n\t\tvar $this = this;\n\t\tif ( result.isValid() ) {\n\t\t\tvar result_data = result.getResult();\n\t\t\tif ( result_data === true ) {\n\t\t\t\t$this.refresh_id = $this.current_edit_record.id;\n\n\t\t\t} else if ( TTUUID.isUUID( result_data ) && result_data != TTUUID.zero_id && result_data != TTUUID.not_exist_id ) {\n\t\t\t\t$this.refresh_id = result_data;\n\t\t\t}\n\t\t\t$this.search( false );\n\t\t\t$this.editor.show_cover = false;\n\t\t\t$this.onEditClick( $this.refresh_id, true );\n\n\t\t\t$this.onSaveAndContinueDone( result );\n\t\t} else {\n\t\t\t$this.setErrorTips( result );\n\t\t\t$this.setErrorMenu();\n\t\t}\n\t}\n\n\t// onSaveAndNextResult( result ) {\n\t// \tvar $this = this;\n\t// \tif ( result.isValid() ) {\n\t// \t\tvar result_data = result.getResult();\n\t// \t\tif ( result_data === true ) {\n\t// \t\t\t$this.refresh_id = $this.current_edit_record.id;\n\t// \t\t} else if ( TTUUID.isUUID( result_data ) && result_data != TTUUID.zero_id && result_data != TTUUID.not_exist_id ) {\n\t// \t\t\t$this.refresh_id = result_data;\n\t// \t\t}\n\t// \t\t$this.editor.show_cover = true;\n\t// \t\t$this.onRightArrowClick();\n\t// \t\t$this.search( false );\n\t// \t\t$this.onSaveAndNextDone( result );\n\t//\n\t// \t} else {\n\t// \t\t$this.setErrorTips( result );\n\t// \t\t$this.setErrorMenu();\n\t// \t}\n\t// },\n\n\tsaveInsideEntryEditorData( callBack ) {\n\t\t//called by validation function\n\t\tvar $this = this;\n\t\tvar data = this.editor.getValue( $this.current_edit_record.id ? $this.current_edit_record.id : '' );\n\n\t\tif ( this.editor.delete_ids.length > 0 ) {\n\t\t\tfor ( var i = 0; i < this.editor.delete_ids.length; i++ ) {\n\t\t\t\tfor ( var n = 0; n < data.length; n++ ) {\n\t\t\t\t\tif ( this.editor.delete_ids[i] == data[n].id ) {\n\t\t\t\t\t\tdata[n].deleted = 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif ( callBack && typeof callBack == 'function' ) {\n\t\t\tcallBack();\n\t\t}\n\t\treturn data;\n\t}\n\n\tinsideEntryEditorGetValue( current_edit_item_id ) {\n\t\tvar len = this.rows_widgets_array.length;\n\t\tvar result = [];\n\n\t\tif ( this.cover && this.cover.length > 0 ) {\n\t\t\treturn result;\n\t\t}\n\n\t\tfor ( var i = 0; i < len; i++ ) {\n\t\t\tvar row = this.rows_widgets_array[i];\n\t\t\tvar data = {};\n\n\t\t\tif ( row === true || _.isArray( row ) ) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n//\t\t\tvar pay_stub_amendment_id = row['ytd_amount'].attr( 'pay_stub_amendment_id' );\n//\t\t\tvar user_expense_id = row['ytd_amount'].attr( 'user_expense_id' );\n//\n//\t\t\tif ( pay_stub_amendment_id > 0 || user_expense_id > 0 ) {\n//\t\t\t\tcontinue;\n//\t\t\t}\n\n\t\t\tdata['id'] = row['ytd_amount'].attr( 'pay_stub_entry_id' );\n\n\t\t\tif ( row['ytd_amount'].attr( 'type_id' ) ) {\n\t\t\t\tdata['type'] = row['ytd_amount'].attr( 'type_id' );\n\t\t\t}\n\n\t\t\tdata['rate'] = row['rate'] ? row['rate'].getValue() : '';\n\t\t\tdata['units'] = row['units'] ? row['units'].getValue() : '';\n\t\t\tdata['amount'] = row['amount'] ? row['amount'].getValue() : '';\n\n\t\t\tif ( Global.isSet( row['ytd_amount'] ) ) {\n\t\t\t\tdata['ytd_amount'] = row['ytd_amount'].getValue();\n\t\t\t}\n\n\t\t\tdata['description'] = row['description'] ? row['description'].getValue() : '';\n\n\t\t\tif ( Global.isSet( row['pay_stub_entry_name_id'] ) ) {\n\t\t\t\tdata['pay_stub_entry_name_id'] = row['pay_stub_entry_name_id'].getValue();\n\t\t\t} else {\n\t\t\t\tdata['pay_stub_entry_name_id'] = row['ytd_amount'].attr( 'pay_stub_entry_name_id' );\n\t\t\t}\n\n\t\t\t// return back to the server with the same data get from API.\n\t\t\tdata['pay_stub_amendment_id'] = row['ytd_amount'].attr( 'pay_stub_amendment_id' );\n\t\t\tdata['user_expense_id'] = row['ytd_amount'].attr( 'user_expense_id' );\n\n\t\t\tdata['pay_stub_id'] = current_edit_item_id;\n\t\t\tif ( row['total_row'] != true && TTUUID.isUUID( data['pay_stub_entry_name_id'] )\n\t\t\t\t&& ( data['pay_stub_entry_name_id'] != TTUUID.zero_id\n\t\t\t\t\t|| ( data['description'] != undefined && data['description'].length > 0 )\n\t\t\t\t\t|| ( data['rate'] != undefined && data['rate'].length > 0 && parseFloat( data['rate'] ) != 0 )\n\t\t\t\t\t|| ( data['units'] != undefined && data['units'].length > 0 && parseFloat( data['units'] ) != 0 )\n\t\t\t\t\t|| ( data['amount'] != undefined && data['amount'].length > 0 && parseFloat( data['amount'] ) != 0 )\n\t\t\t\t) ) {\n\t\t\t\tresult.push( data );\n\t\t\t}\n\t\t}\n\n\t\treturn result;\n\t}\n\n\tgetFilterColumnsFromDisplayColumns() {\n\n\t\tvar column_filter = {};\n\t\tcolumn_filter.is_owner = true;\n\t\tcolumn_filter.id = true;\n\t\tcolumn_filter.user_id = true;\n\t\tcolumn_filter.is_child = true;\n\t\tcolumn_filter.in_use = true;\n\t\tcolumn_filter.first_name = true;\n\t\tcolumn_filter.last_name = true;\n\t\tcolumn_filter.start_date = true;\n\t\tcolumn_filter.end_date = true;\n\t\tcolumn_filter.pay_period_id = true;\n\n\t\t// Error: Unable to get property 'getGridParam' of undefined or null reference\n\t\tvar display_columns = [];\n\t\tif ( this.grid ) {\n\t\t\tdisplay_columns = this.grid.getGridParam( 'colModel' );\n\t\t}\n\n\t\tif ( display_columns ) {\n\t\t\tvar len = display_columns.length;\n\n\t\t\tfor ( var i = 0; i < len; i++ ) {\n\t\t\t\tvar column_info = display_columns[i];\n\t\t\t\tcolumn_filter[column_info.name] = true;\n\t\t\t}\n\t\t}\n\n\t\treturn column_filter;\n\t}\n\n\tonFormItemChange( target, doNotValidate ) {\n\t\tvar $this = this;\n\t\tthis.setIsChanged( target );\n\t\tthis.setMassEditingFieldsWhenFormChange( target );\n\t\tvar key = target.getField();\n\t\tvar c_value = target.getValue();\n\n\t\tthis.current_edit_record[key] = c_value;\n\t\tswitch ( key ) {\n//\t\t\tcase 'status_id':\n//\t\t\t\tif ( c_value == 40 || c_value == 100 ) {\n//\t\t\t\t\tthis.include_pay_stub_accounts = false;\n//\t\t\t\t}\n//\t\t\t\tbreak;\n\t\t\tcase 'user_id':\n\t\t\t\tif ( this.is_add ) {\n\t\t\t\t\tvar transaction_rows = $this.editor.rows_widgets_array[$this.editor.rows_widgets_array.length - 2];\n\t\t\t\t\tvar user_id = $this.edit_view_ui_dic.user_id.getValue();\n\t\t\t\t\tfor ( var t in transaction_rows ) {\n\t\t\t\t\t\tif ( Global.isArray( transaction_rows ) && transaction_rows[t].remittance_destination_account_id ) {\n\t\t\t\t\t\t\ttransaction_rows[t].remittance_destination_account_id.setDefaultArgs( { filter_data: { user_id: user_id } } );\n\t\t\t\t\t\t\ttransaction_rows[t].remittance_destination_account_id.setValue( TTUUID.zero_id );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'country':\n\t\t\t\tvar widget = this.edit_view_ui_dic['province'];\n\t\t\t\twidget.setValue( null );\n\t\t\t\tbreak;\n\t\t\tcase 'pay_period_id':\n\t\t\t\tvar filter = {};\n\t\t\t\tfilter.filter_data = {};\n\t\t\t\tfilter.filter_data.id = c_value;\n\t\t\t\tthis.pay_period_api['get' + this.pay_period_api.key_name]( filter, {\n\t\t\t\t\tonResult: function( res ) {\n\t\t\t\t\t\t//Error: Uncaught TypeError: Cannot read property 'start_date' of undefined in interface/html5/#!m=PayStub&a=new&tab=PayStub line 1836\n\t\t\t\t\t\tif ( res.isValid() && res.getResult()[0] ) {\n\t\t\t\t\t\t\tvar result = res.getResult()[0];\n\t\t\t\t\t\t\tvar start_date = Global.strToDate( result.start_date ).format();\n\t\t\t\t\t\t\tvar end_date = Global.strToDate( result.end_date ).format();\n\t\t\t\t\t\t\tvar transaction_date = Global.strToDate( result.transaction_date ).format();\n\n\t\t\t\t\t\t\t$this.current_edit_record['start_date'] = start_date;\n\t\t\t\t\t\t\t$this.current_edit_record['end_date'] = end_date;\n\t\t\t\t\t\t\t$this.current_edit_record['transaction_date'] = transaction_date;\n\n\t\t\t\t\t\t\t$this.edit_view_ui_dic['start_date'].setValue( start_date );\n\t\t\t\t\t\t\t$this.edit_view_ui_dic['end_date'].setValue( end_date );\n\t\t\t\t\t\t\t$this.edit_view_ui_dic['transaction_date'].setValue( transaction_date );\n\n\t\t\t\t\t\t\tif ( !doNotValidate ) {\n\t\t\t\t\t\t\t\t$this.validate();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tif ( !doNotValidate ) {\n\t\t\t\t\t$this.validate();\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t}\n\n\t\tif ( key === 'country' || key === 'pay_period_id' ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( !doNotValidate ) {\n\t\t\tthis.validate();\n\n\t\t}\n\t}\n\n\tonSetSearchFilterFinished() {\n\n\t\tif ( this.search_panel.getSelectTabIndex() === 1 ) {\n\t\t\tvar combo = this.adv_search_field_ui_dic['country'];\n\t\t\tvar select_value = combo.getValue();\n\t\t\tthis.setProvince( select_value );\n\t\t}\n\t}\n\n\tonBuildAdvUIFinished() {\n\n\t\tthis.adv_search_field_ui_dic['country'].change( $.proxy( function() {\n\t\t\tvar combo = this.adv_search_field_ui_dic['country'];\n\t\t\tvar selectVal = combo.getValue();\n\n\t\t\tthis.setProvince( selectVal );\n\n\t\t\tthis.adv_search_field_ui_dic['province'].setValue( null );\n\n\t\t}, this ) );\n\t}\n\n\tsetProvince( val, m ) {\n\t\tvar $this = this;\n\n\t\tif ( !val || val === '-1' || val === '0' ) {\n\t\t\t$this.province_array = [];\n\t\t\tthis.adv_search_field_ui_dic['province'].setSourceData( [] );\n\t\t} else {\n\n\t\t\tthis.company_api.getOptions( 'province', val, {\n\t\t\t\tonResult: function( res ) {\n\t\t\t\t\tres = res.getResult();\n\t\t\t\t\tif ( !res ) {\n\t\t\t\t\t\tres = [];\n\t\t\t\t\t}\n\n\t\t\t\t\t$this.province_array = Global.buildRecordArray( res );\n\t\t\t\t\t$this.adv_search_field_ui_dic['province'].setSourceData( $this.province_array );\n\n\t\t\t\t}\n\t\t\t} );\n\t\t}\n\t}\n\n\teSetProvince( val, refresh ) {\n\t\tvar $this = this;\n\t\tvar province_widget = $this.edit_view_ui_dic['province'];\n\n\t\tif ( !val || val === '-1' || val === '0' ) {\n\t\t\t$this.e_province_array = [];\n\t\t\tprovince_widget.setSourceData( [] );\n\t\t} else {\n\t\t\tthis.company_api.getOptions( 'province', val, {\n\t\t\t\tonResult: function( res ) {\n\t\t\t\t\tres = res.getResult();\n\t\t\t\t\tif ( !res ) {\n\t\t\t\t\t\tres = [];\n\t\t\t\t\t}\n\n\t\t\t\t\t$this.e_province_array = Global.buildRecordArray( res );\n\t\t\t\t\tif ( refresh && $this.e_province_array.length > 0 ) {\n\t\t\t\t\t\t$this.current_edit_record.province = $this.e_province_array[0].value;\n\t\t\t\t\t\tprovince_widget.setValue( $this.current_edit_record.province );\n\t\t\t\t\t}\n\t\t\t\t\tprovince_widget.setSourceData( $this.e_province_array );\n\n\t\t\t\t}\n\t\t\t} );\n\t\t}\n\t}\n\n\tvalidate() {\n\t\tvar $this = this;\n\n\t\tvar record = {};\n\t\tvar transaction_record = {};\n\n\t\tif ( this.is_mass_editing ) {\n\t\t\tfor ( var key in this.edit_view_ui_dic ) {\n\n\t\t\t\tif ( !this.edit_view_ui_dic.hasOwnProperty( key ) ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tvar widget = this.edit_view_ui_dic[key];\n\n\t\t\t\tif ( Global.isSet( widget.isChecked ) ) {\n\t\t\t\t\tif ( widget.isChecked() && widget.getEnabled() ) {\n\t\t\t\t\t\trecord[key] = widget.getValue();\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t}\n\n\t\t} else {\n\t\t\trecord = this.current_edit_record;\n\t\t}\n\n\t\trecord = this.uniformVariable( record );\n\n\t\tif ( this.include_pay_stub_accounts ) {\n\t\t\tvar entries = $this.saveInsideEntryEditorData();\n\t\t\tvar transactions = $this.saveInsideTransactionEditorData();\n\t\t\tif ( typeof entries == 'object' ) {\n\t\t\t\trecord['entries'] = entries;\n\t\t\t}\n\t\t\tif ( typeof transactions == 'object' ) {\n\t\t\t\trecord['transactions'] = transactions;\n\t\t\t}\n\t\t}\n\n\t\tthis.api['validate' + this.api.key_name]( record, {\n\t\t\tonResult: function( result ) {\n\t\t\t\t$this.validateResult( result );\n\t\t\t}\n\t\t} );\n\t}\n\n\tbuildEditViewUI() {\n\t\tsuper.buildEditViewUI();\n\n\t\tvar $this = this;\n\n\t\tvar tab_model = {\n\t\t\t'tab_pay_stub': {\n\t\t\t\t'label': $.i18n._( 'Pay Stub' ), 'is_multi_column': true,\n\t\t\t\t'html_template': this.getPayStubTabHtml()\n\t\t\t},\n\t\t\t'tab_audit': true,\n\t\t};\n\t\tthis.setTabModel( tab_model );\n\n\t\tthis.navigation.AComboBox( {\n\t\t\tapi_class: TTAPI.APIPayStub,\n\t\t\tid: this.script_name + '_navigation',\n\t\t\tallow_multiple_selection: false,\n\t\t\tlayout_name: 'global_pay_stub',\n\t\t\tnavigation_mode: true,\n\t\t\tshow_search_inputs: true\n\t\t} );\n\n\t\tthis.setNavigation();\n\n\t\t//Tab 0 start\n\n\t\tvar tab_pay_stub = this.edit_view_tab.find( '#tab_pay_stub' );\n\n\t\tvar tab_pay_stub_column1 = tab_pay_stub.find( '.first-column' );\n\t\tvar tab_pay_stub_column2 = tab_pay_stub.find( '.second-column' );\n//\t\tvar tab_pay_stub_column3 = tab_pay_stub.find( '.third-column' );\n\n\t\tvar form_item_input;\n\n\t\tthis.edit_view_tabs[0] = [];\n\n\t\tthis.edit_view_tabs[0].push( tab_pay_stub_column1 );\n\n\t\t// Employee\n\t\tform_item_input = Global.loadWidgetByName( FormItemType.AWESOME_BOX );\n\t\tform_item_input.AComboBox( {\n\t\t\tapi_class: TTAPI.APIUser,\n\t\t\tallow_multiple_selection: false,\n\t\t\tlayout_name: 'global_user',\n\t\t\tshow_search_inputs: true,\n\t\t\tset_empty: false,\n\t\t\tfield: 'user_id'\n\t\t} );\n\t\tthis.addEditFieldToColumn( $.i18n._( 'Employee' ), form_item_input, tab_pay_stub_column1 );\n\n\t\t// Status\n\t\tform_item_input = Global.loadWidgetByName( FormItemType.COMBO_BOX );\n\t\tform_item_input.TComboBox( { field: 'status_id', set_empty: false } );\n\t\tform_item_input.setSourceData( $this.filtered_status_array );\n\t\tthis.addEditFieldToColumn( $.i18n._( 'Status' ), form_item_input, tab_pay_stub_column1 );\n\n\t\t// Type\n\t\tform_item_input = Global.loadWidgetByName( FormItemType.COMBO_BOX );\n\t\tform_item_input.TComboBox( { field: 'type_id', set_empty: false } );\n\t\tform_item_input.setSourceData( $this.type_array );\n\t\tthis.addEditFieldToColumn( $.i18n._( 'Type' ), form_item_input, tab_pay_stub_column1 );\n\n\t\t// Currency\n\t\tform_item_input = Global.loadWidgetByName( FormItemType.AWESOME_BOX );\n\n\t\tform_item_input.AComboBox( {\n\t\t\tapi_class: TTAPI.APICurrency,\n\t\t\tallow_multiple_selection: false,\n\t\t\tlayout_name: 'global_currency',\n\t\t\tshow_search_inputs: true,\n\t\t\tset_empty: true,\n\t\t\tfield: 'currency_id'\n\t\t} );\n\t\tthis.addEditFieldToColumn( $.i18n._( 'Currency' ), form_item_input, tab_pay_stub_column1 );\n\n\t\t// Pay Period\n\t\tform_item_input = Global.loadWidgetByName( FormItemType.AWESOME_BOX );\n\n\t\tform_item_input.AComboBox( {\n\t\t\tapi_class: TTAPI.APIPayPeriod,\n\t\t\tallow_multiple_selection: false,\n\t\t\tlayout_name: 'global_Pay_period',\n\t\t\tshow_search_inputs: true,\n\t\t\tset_empty: true,\n\t\t\tfield: 'pay_period_id'\n\t\t} );\n\t\tthis.addEditFieldToColumn( $.i18n._( 'Pay Period' ), form_item_input, tab_pay_stub_column2 );\n\n\t\t// Payroll Run\n\t\tform_item_input = Global.loadWidgetByName( FormItemType.TEXT_INPUT );\n\t\tform_item_input.TTextInput( { field: 'run_id', width: 20 } );\n\t\tthis.addEditFieldToColumn( $.i18n._( 'Payroll Run' ), form_item_input, tab_pay_stub_column2 );\n\n\t\t// Pay Start Date\n\t\tform_item_input = Global.loadWidgetByName( FormItemType.DATE_PICKER );\n\n\t\tform_item_input.TDatePicker( { field: 'start_date' } );\n\t\tthis.addEditFieldToColumn( $.i18n._( 'Pay Start Date' ), form_item_input, tab_pay_stub_column2 );\n\n\t\t// Pay End Date\n\t\tform_item_input = Global.loadWidgetByName( FormItemType.DATE_PICKER );\n\n\t\tform_item_input.TDatePicker( { field: 'end_date' } );\n\t\tthis.addEditFieldToColumn( $.i18n._( 'Pay End Date' ), form_item_input, tab_pay_stub_column2 );\n\n\t\t// Payment Date\n\n\t\tform_item_input = Global.loadWidgetByName( FormItemType.DATE_PICKER );\n\n\t\tform_item_input.TDatePicker( { field: 'transaction_date' } );\n\t\tthis.addEditFieldToColumn( $.i18n._( 'Payment Date' ), form_item_input, tab_pay_stub_column2, '' );\n\n\t\t//Inside pay stub entries editor\n\n\t\tvar inside_pay_stub_entry_editor_div = tab_pay_stub.find( '.inside-pay-stub-entry-editor-div' );\n\n\t\tthis.editor = Global.loadWidgetByName( FormItemType.INSIDE_EDITOR );\n\n\t\tthis.editor.InsideEditor( {\n\t\t\taddRow: this.insideEntryEditorAddRow,\n\t\t\tremoveRow: this.insideEntryEditorRemoveRow,\n\t\t\tgetValue: this.insideEntryEditorGetValue,\n\t\t\tsetValue: this.insideEntryEditorSetValue,\n\t\t\tparent_controller: this,\n\t\t\tapi: this.pay_stub_entry_api,\n\t\t\trender: getRender(),\n\t\t\trender_args: {},\n\t\t\trender_inline_html: true,\n\t\t\trow_render: getRowRender()\n\n\t\t} );\n\n\t\tfunction getRender() {\n\t\t\treturn `\n\t\t\t<table class=\"inside-editor-render tblList\">\n\t\t\t</table>`;\n\t\t}\n\n\t\tfunction getRowRender() {\n\t\t\treturn `<div></div>`;\n\t\t}\n\n\t\tthis.editor.show_cover = true;\n\t\tthis.editor.delete_transaction_ids = [];\n\t\tthis.editor.removeCover = this.removeEntryInsideEditorCover;\n\t\tthis.editor.onEditClick = this.removeEntryInsideEditorCover;\n\t\tthis.editor.onFormItemKeyUp = function( target ) {\n\t\t\tvar index = target.parent().parent().index();\n\t\t\tvar $this = this;\n\t\t\tvar widget_rate = $this.rows_widgets_array[index]['rate'];\n\t\t\tvar widget_units = $this.rows_widgets_array[index]['units'];\n\t\t\tvar widget_amount = $this.rows_widgets_array[index]['amount'];\n\n\t\t\tif ( target.getValue().length === 0 ) {\n\t\t\t\twidget_amount.setReadOnly( false );\n\t\t\t}\n\t\t\tif ( widget_rate.getValue().length > 0 || widget_units.getValue().length > 0 ) {\n\t\t\t\twidget_amount.setReadOnly( true );\n\t\t\t}\n\n\t\t\tif ( widget_rate.getValue().length > 0 && widget_units.getValue().length > 0 ) {\n\t\t\t\t//widget_amount.setValue( ( parseFloat( widget_rate.getValue() ) * parseFloat( widget_units.getValue() ) ).toFixed( 2 ) );\n\t\t\t\t//var amount_value = Global.MoneyRound( parseFloat( widget_rate.getValue() ) * parseFloat( widget_units.getValue() ) );\n\t\t\t\tvar amount_value = Global.MoneyRound( (0,decimal_js__WEBPACK_IMPORTED_MODULE_0__/* .Decimal */ .t)( parseFloat( widget_rate.getValue() ) ).mul( parseFloat( widget_units.getValue() ) ).toFixed( 4 ) );\n\t\t\t\tif ( amount_value == 'NaN' || amount_value == 0 || amount_value == '' ) {\n\t\t\t\t\tamount_value = '0.00';\n\t\t\t\t}\n\t\t\t\twidget_amount.setValue( amount_value );\n\t\t\t\tthis.onFormItemChange( widget_amount, true );\n\t\t\t} else {\n\t\t\t\twidget_amount.setValue( '0.00' );\n\t\t\t\tthis.onFormItemChange( widget_amount, true );\n\t\t\t}\n\t\t};\n\t\tthis.editor.onFormItemKeyDown = function( target ) {\n\t\t\tvar index = target.parent().parent().index();\n\t\t\tvar $this = this;\n\t\t\tvar widget = $this.rows_widgets_array[index]['amount'];\n\t\t\tvar widget_rate = $this.rows_widgets_array[index]['rate'];\n\t\t\tvar widget_units = $this.rows_widgets_array[index]['units'];\n\t\t\tif ( widget_rate.getValue().length > 0 && widget_units.getValue().length > 0 ) {\n\n\t\t\t} else {\n\t\t\t\twidget.setValue( '0.00' );\n\t\t\t\tthis.onFormItemChange( widget, true );\n\t\t\t}\n\n\t\t\twidget.setReadOnly( true );\n\t\t};\n\t\tthis.editor.onFormItemChange = function( target, doNotValidate ) {\n\t\t\tvar key = target.getField();\n\t\t\tvar c_value = parseFloat( target.getValue() ? target.getValue() : 0 ); // new value\n\t\t\tvar index = target.parent().parent().index();\n\n\t\t\tif ( key === 'amount' ) {\n\t\t\t\tvar original_ytd_amount = parseFloat( this.rows_widgets_array[index]['ytd_amount'].attr( 'original_ytd_amount' ) );\n\t\t\t\tif ( isNaN( original_ytd_amount ) ) {\n\t\t\t\t\toriginal_ytd_amount = 0.00;\n\t\t\t\t}\n\n\t\t\t\tvar original_amount = parseFloat( this.rows_widgets_array[index]['ytd_amount'].attr( 'original_amount' ) );\n\t\t\t\tif ( isNaN( original_amount ) ) {\n\t\t\t\t\toriginal_amount = 0.00;\n\t\t\t\t}\n\n\t\t\t\tvar new_ytd_amount = Global.removeTrailingZeros( (0,decimal_js__WEBPACK_IMPORTED_MODULE_0__/* .Decimal */ .t)( original_ytd_amount ).sub( original_amount ).add( c_value ).toFixed( 4 ) );\n\t\t\t\tif ( isNaN( new_ytd_amount ) ) {\n\t\t\t\t\tnew_ytd_amount = 0.00;\n\t\t\t\t}\n\n\t\t\t\tthis.rows_widgets_array[index]['ytd_amount'].setValue( new_ytd_amount != 0 ? new_ytd_amount : '-' );\n\t\t\t\tthis.rows_widgets_array[index]['ytd_amount'].attr( 'original_ytd_amount', new_ytd_amount );\n\t\t\t\tthis.rows_widgets_array[index]['ytd_amount'].attr( 'original_amount', c_value );\n\t\t\t}\n\n\t\t\tif ( doNotValidate ) {\n\n\t\t\t} else {\n\t\t\t\tthis.parent_controller.validate();\n\t\t\t}\n\n\t\t\tthis.calcTotal();\n\t\t};\n\n\t\tthis.editor.calcTotal = function() {\n\t\t\tvar total_units = 0;\n\t\t\tvar total_amount = 0;\n\t\t\tvar total_ytd_amount = 0;\n\t\t\tvar net_pay_amount = 0;\n\t\t\tvar net_pay_ytd_amount = 0;\n\t\t\tvar total_units_blank = true;\n\n\t\t\tfor ( var i = 0; i < this.rows_widgets_array.length; i++ ) {\n\t\t\t\tvar row = this.rows_widgets_array[i];\n\t\t\t\tif ( row === true || _.isArray( row ) ) {\n\t\t\t\t\ttotal_units = 0;\n\t\t\t\t\ttotal_amount = 0;\n\t\t\t\t\ttotal_ytd_amount = 0;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tif ( row['total_row'] === true ) {\n\t\t\t\t\tif ( !Global.isNumeric( total_amount ) ) {\n\t\t\t\t\t\ttotal_amount = 0;\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( Global.isSet( row['units'] ) ) {\n\t\t\t\t\t\tif ( total_units_blank == false ) {\n\t\t\t\t\t\t\trow['units'].setValue( Global.MoneyRound( total_units ) );\n\t\t\t\t\t\t} else if ( total_units_blank ) {\n\t\t\t\t\t\t\trow['units'].setValue( '-' );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\trow['amount'].setValue( Global.MoneyRound( parseFloat( total_amount ) ) );\n\t\t\t\t\trow['ytd_amount'].setValue( Global.MoneyRound( parseFloat( total_ytd_amount ) ) );\n\n\t\t\t\t\tif ( row.type_id == 10 ) { // Start with total gross value\n\t\t\t\t\t\tnet_pay_amount = total_amount;\n\t\t\t\t\t\tnet_pay_ytd_amount = total_ytd_amount;\n\t\t\t\t\t} else if ( row.type_id == 20 ) { // Subtract deductions (only)\n\t\t\t\t\t\t//net_pay_amount = net_pay_amount - total_amount;\n\t\t\t\t\t\tnet_pay_amount = (0,decimal_js__WEBPACK_IMPORTED_MODULE_0__/* .Decimal */ .t)( net_pay_amount ).sub( total_amount ).toFixed( 4 );\n\n\t\t\t\t\t\t//net_pay_ytd_amount = net_pay_ytd_amount - total_ytd_amount;\n\t\t\t\t\t\tnet_pay_ytd_amount = (0,decimal_js__WEBPACK_IMPORTED_MODULE_0__/* .Decimal */ .t)( net_pay_ytd_amount ).sub( total_ytd_amount ).toFixed( 4 );\n\t\t\t\t\t}\n\n\t\t\t\t\tthis.parent_controller.net_pay_amount = net_pay_amount;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tif ( row['pay_stub_entry_account_id'] && row['pay_stub_entry_account_id'] == this.parent_controller.pseal_link.net_pay_entry_account_id ) {\n\t\t\t\t\trow['amount'].setValue( Global.MoneyRound( net_pay_amount ) );\n\t\t\t\t\trow['ytd_amount'].setValue( Global.MoneyRound( net_pay_ytd_amount ) );\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tvar current_units = 0;\n\t\t\t\tif ( Global.isSet( row['units'] ) && Global.isNumeric( row['units'].getValue() ) ) {\n\t\t\t\t\tcurrent_units = Global.MoneyRound( parseFloat( row['units'].getValue() ) );\n\t\t\t\t\ttotal_units_blank = false;\n\t\t\t\t}\n\n\t\t\t\tvar current_total_amount = 0;\n\t\t\t\tif ( Global.isSet( row['amount'] ) && Global.isNumeric( row['amount'].getValue() ) ) {\n\t\t\t\t\tcurrent_total_amount = parseFloat( row['amount'].getValue() );\n\t\t\t\t\ttotal_units_blank = false;\n\t\t\t\t}\n\n\t\t\t\tvar current_ytd_total = 0;\n\t\t\t\tif ( Global.isSet( row['ytd_amount'] ) && Global.isNumeric( row['ytd_amount'].getValue() ) ) {\n\t\t\t\t\tcurrent_ytd_total = parseFloat( row['ytd_amount'].getValue() );\n\t\t\t\t}\n\n\t\t\t\tif ( total_units_blank == false ) {\n\t\t\t\t\t// total_units = parseFloat( total_units ) + parseFloat( current_units );\n\t\t\t\t\ttotal_units = (0,decimal_js__WEBPACK_IMPORTED_MODULE_0__/* .Decimal */ .t)( parseFloat( total_units ) ).add( parseFloat( current_units ) ).toFixed( 4 );\n\t\t\t\t} else {\n\t\t\t\t\ttotal_units = '';\n\t\t\t\t}\n\n\t\t\t\tif ( Global.isNumeric( current_total_amount ) ) {\n\t\t\t\t\t// total_amount = total_amount + current_total_amount;\n\t\t\t\t\ttotal_amount = (0,decimal_js__WEBPACK_IMPORTED_MODULE_0__/* .Decimal */ .t)( total_amount ).add( current_total_amount ).toFixed( 4 );\n\t\t\t\t}\n\n\t\t\t\tif ( Global.isNumeric( current_ytd_total ) ) {\n\t\t\t\t\t// total_ytd_amount = total_ytd_amount + current_ytd_total;\n\t\t\t\t\ttotal_ytd_amount = (0,decimal_js__WEBPACK_IMPORTED_MODULE_0__/* .Decimal */ .t)( total_ytd_amount ).add( current_ytd_total ).toFixed( 4 );\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tthis.calcTransactionTotals();\n\n\t\t};\n\n\t\tthis.editor.insideTransactionEditorSetValue = function( data ) {\n\t\t\t$this = this;\n\t\t\tif ( !this.parent_controller.current_edit_record ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tvar pay_stub_status_id = this.parent_controller['current_edit_record']['status_id'];\n\t\t\tvar is_add = false;\n\t\t\tif ( !this.parent_controller['current_edit_record']['id'] && !this.parent_controller.copied_record_id ) {\n\t\t\t\tis_add = true;\n\t\t\t}\n\t\t\tif ( !is_add && ( pay_stub_status_id == 25 ) && this.show_cover ) {\n\t\t\t\tthis.cover = Global.loadWidgetByName( WidgetNamesDic.NO_RESULT_BOX );\n\t\t\t\tthis.cover.NoResultBox( {\n\t\t\t\t\trelated_view_controller: this,\n\t\t\t\t\tmessage: $.i18n._( 'Click the Edit icon below to override pay stub amounts' ),\n\t\t\t\t\tis_edit: true\n\t\t\t\t} );\n\t\t\t}\n\t\t\tvar render = this.getRender(); //get render, should be a table\n\t\t\tvar headerRow = `\n\t\t\t<tr class=\"tblHeader\">\n\t\t\t\t<td align=\"left\" colspan=\"2\"><%= col1 %></td>\n\t\t\t\t<td colspan=\"2\"> <%= col2 %></td>\n\t\t\t\t<td colspan=\"1\"> <%= col3 %></td>\n\t\t\t\t<td colspan=\"1\"> <%= col4 %></td>\n\t\t\t\t<td colspan=\"1\" style=\"width: 30px\"><%= col5 %></td>\n\t\t\t\t<td colspan=\"2\" style=\"width:60px\"></td>\n\t\t\t</tr>`;\n\t\t\tvar args = {\n\t\t\t\tcol1: $.i18n._( 'Payment Method' ),\n\t\t\t\tcol2: $.i18n._( 'Note' ),\n\t\t\t\tcol3: $.i18n._( 'Status' ),\n\t\t\t\tcol4: $.i18n._( 'Payment Date' ),\n\t\t\t\tcol5: $.i18n._( 'Amount' )\n\t\t\t};\n\t\t\t$( render ).append( '<tr class=\"tblSepHeader\"><td colspan=\"8\">' + $.i18n._( 'Transactions' ) + '</td></tr>' );\n\n\t\t\tvar template = _.template( headerRow );\n\t\t\t$( render ).append( template( args ) );\n\n\t\t\tthis.rows_widgets_array.push( true );\n\t\t\tif ( _.size( data ) > 0 ) {\n\t\t\t\tfor ( var i = 0; i < _.size( data ); i++ ) {\n\t\t\t\t\tif ( Global.isSet( data[i] ) ) {\n\t\t\t\t\t\tvar row = data[i];\n\t\t\t\t\t\tthis.insideTransactionEditorAddRow( row );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t//$( render ).append( '<tr><td colspan=\"8\"><br></td></tr>' );\n\t\t\t\tthis.rows_widgets_array.push( true );\n\t\t\t\tif ( this.cover && this.cover.length > 0 ) {\n\t\t\t\t\tthis.cover.css( { width: this.width(), height: this.height() + 30 } );\n\t\t\t\t\tthis.parent().append( this.cover );\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthis.parent_controller.getPayStubTransactionDefaultData( function( data ) {\n\t\t\t\t\t$this.insideTransactionEditorAddRow( data );\n\t\t\t\t\t//$( render ).append( '<tr><td colspan=\"8\"><br></td></tr>' );\n\t\t\t\t\t$this.rows_widgets_array.push( true );\n\t\t\t\t\tif ( $this.cover && $this.cover.length > 0 ) {\n\t\t\t\t\t\t$this.cover.css( { width: $this.width(), height: $this.height() } );\n\t\t\t\t\t\t$this.parent().append( $this.cover );\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\tthis.calcTransactionTotals();\n\t\t};\n\n\t\tthis.editor.insideTransactionEditorGetValue = function( parent_id ) {\n\t\t\tvar len = this.rows_widgets_array.length;\n\t\t\tvar result = [];\n\n\t\t\tif ( this.cover && this.cover.length > 0 ) {\n\t\t\t\treturn result;\n\t\t\t}\n\n\t\t\tfor ( var i = 0; i < len; i++ ) {\n\t\t\t\tvar data = {};\n\t\t\t\tif ( _.isArray( this.rows_widgets_array[i] ) ) {\n\t\t\t\t\tvar row = this.rows_widgets_array[i][0];\n\n\t\t\t\t\tif ( !Global.isSet( row['remittance_destination_account_id'] ) || !row['remittance_destination_account_id'].getValue() ) {\n\t\t\t\t\t\tcontinue; //row is not editable but is among those that are.\n\t\t\t\t\t}\n\t\t\t\t\tdata['id'] = row['form_item_record']['id'];\n\t\t\t\t\tdata['remittance_destination_account_id'] = row['remittance_destination_account_id'] ? row['remittance_destination_account_id'].getValue() : TTUUID.zero_id;\n\n\t\t\t\t\tif ( Global.isSet( row['status_id'] ) ) {\n\t\t\t\t\t\tdata['status_id'] = row['status_id'].getValue();\n\t\t\t\t\t}\n\n\t\t\t\t\tdata['transaction_date'] = row['transaction_date'] ? row['transaction_date'].getValue() : '';\n\n\t\t\t\t\tif ( Global.isSet( row['currency_id'] ) ) {\n\t\t\t\t\t\tdata['currency_id'] = row['currency_id'].getValue();\n\t\t\t\t\t}\n\n\t\t\t\t\tdata['note'] = row['note'] ? row['note'].getValue() : '';\n\n\t\t\t\t\tdata['amount'] = row['amount'] ? row['amount'].getValue() : '';\n\n\t\t\t\t\tif ( Global.isSet( row['deleted'] ) && row['deleted'] == 1 ) {\n\t\t\t\t\t\tdata['deleted'] = 1;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tdata['deleted'] = 0;\n\t\t\t\t\t}\n\n\t\t\t\t\tdata['pay_stub_id'] = parent_id;\n\n\t\t\t\t\tif ( row['total_row'] != true && TTUUID.isUUID( data['remittance_destination_account_id'] )\n\t\t\t\t\t\t&& ( data['remittance_destination_account_id'] != TTUUID.zero_id\n\t\t\t\t\t\t\t|| ( data['note'] != undefined && data['note'].length > 0 )\n\t\t\t\t\t\t\t|| ( data['amount'] != undefined && data['amount'].length > 0 && parseFloat( data['amount'] ) != 0 )\n\t\t\t\t\t\t) ) {\n\t\t\t\t\t\tresult.push( data );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn result;\n\t\t};\n\n\t\tthis.editor.insideTransactionEditorRemoveRow = function( row ) {\n\t\t\tvar index = row[0].rowIndex - 1;\n\n\t\t\tif ( this.rows_widgets_array[index][0] ) {\n\t\t\t\tthis.rows_widgets_array[index][0]['form_item_record']['deleted'] = 1;\n\t\t\t\tvar remove_id = this.rows_widgets_array[index][0]['form_item_record']['id'];\n\t\t\t}\n\n\t\t\tif ( TTUUID.isUUID( remove_id ) ) {\n\t\t\t\tthis.delete_transaction_ids.push( remove_id );\n\t\t\t} else {\n\t\t\t\t// only remove the row if it was a new row, existing rows (in db) must only be hidden, not removed.\n\t\t\t\tthis.rows_widgets_array.splice( index, 1 );\n\t\t\t}\n\n\t\t\t// hide the row from user view, so we can still query the data during the save operation (api still needs it to know what to delete).\n\t\t\trow.hide();\n\n\t\t\t//count transaction rows.\n\t\t\tvar trows = $( '.paystub_transaction_row:visible' ).length;\n\n\t\t\tif ( trows == 0 ) {\n\t\t\t\t// if all rows removed, make sure we add a blank row in again.\n\t\t\t\tthis.insideTransactionEditorAddRow( {}, index );\n\t\t\t}\n\n\t\t\tthis.parent_controller.validate();\n\t\t\t$this.calcTransactionTotals();\n\n\t\t};\n\n\t\tthis.editor.calcTransactionTotals = function() {\n\t\t\tvar total_amount = 0;\n\n\t\t\tfor ( var i = 0; i < this.rows_widgets_array.length; i++ ) {\n\t\t\t\tvar row = this.rows_widgets_array[i];\n\t\t\t\t//use transaction_date column existence as is transaction flag.\n\t\t\t\tif ( _.isObject( row ) //row is object\n\t\t\t\t\t&& Global.isSet( row[0] )\t//row's object is set.\n\t\t\t\t\t&& Global.isSet( row[0].remittance_destination_account_id ) //row is a pay stub transaction\n\t\t\t\t\t&& Global.isSet( row[0].form_item_record.deleted ) == false //row is not removed\n\t\t\t\t\t&& Global.isSet( row[0].status_id ) //row is not removed\n\t\t\t\t\t&& ( row[0].status_id.getValue() == 10 || row[0].status_id.getValue() == 20 ) //status is valid\n\t\t\t\t) {\n\t\t\t\t\tvar current = parseFloat( row[0].amount.getValue() );\n\t\t\t\t\tif ( isNaN( current ) ) {\n\t\t\t\t\t\tcurrent = 0;\n\t\t\t\t\t}\n\t\t\t\t\ttotal_amount += current;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\ttotal_amount = Global.MoneyRound( total_amount );\n\n\t\t\t//total_amount = Global.removeTrailingZeros(total_amount);\n\t\t\tvar render = this.getRender();\n\t\t\t$( '.transaction_total_rows' ).remove();\n\n\t\t\tif ( total_amount > 0 ) {\n\t\t\t\t// var difference = Global.removeTrailingZeros( parseFloat( total_amount ) - parseFloat( this.parent_controller.net_pay_amount ) );\n\t\t\t\tvar difference = Global.removeTrailingZeros( (0,decimal_js__WEBPACK_IMPORTED_MODULE_0__/* .Decimal */ .t)( parseFloat( total_amount ) ).sub( parseFloat( this.parent_controller.net_pay_amount ) ).toFixed( 4 ) );\n\n\t\t\t\tif ( isNaN( difference ) ) {\n\t\t\t\t\tdifference = 0;\n\t\t\t\t}\n\n\t\t\t\tvar color = 'green';\n\t\t\t\tif ( difference != 0 ) {\n\t\t\t\t\tcolor = 'red';\n\t\t\t\t}\n\n\t\t\t\tif ( difference != 0 ) {\n\t\t\t\t\tdifference = Global.MoneyRound( difference );\n\t\t\t\t\t$( render ).append( '<tr class=\"tblDataWhite transaction_total_rows\"><td colspan=\"2\" style=\"text-align:left\"><b>Transaction Total</b></td><td colspan=\"3\"><br></td><td style=\"text-align:right;\"><span>Difference: <i style=\"color:red;\">' + difference + '</i></b></td><td><b style=\"color:' + color + '\">' + Global.MoneyRound( total_amount ) + '</b></td><td></td></td></tr>' );\n\t\t\t\t} else {\n\t\t\t\t\t$( render ).append( '<tr class=\"tblDataWhite transaction_total_rows\"><td colspan=\"2\" style=\"text-align:left\"><b>Transaction Total</b></td><td colspan=\"4\"><br></td><td><b style=\"color:' + color + '\">' + total_amount + '</b></td><td></td></td></tr>' );\n\t\t\t\t}\n\n\t\t\t\tthis.rows_widgets_array.push( true );\n\t\t\t}\n\t\t};\n\n\t\tthis.editor.insideTransactionEditorAddRow = function( data, index ) {\n\t\t\tvar $this = this;\n\t\t\tif ( _.size( data ) == 0 ) {\n\t\t\t\tthis.parent_controller.getPayStubTransactionDefaultData( function( data ) {\n\t\t\t\t\t$this.insideTransactionEditorAddRow( data, index );\n\t\t\t\t}, index );\n\t\t\t} else {\n\t\t\t\tvar render = $this.getRender();\n\t\t\t\tvar widgets = [];\n\t\t\t\tvar transaction = {};\n\t\t\t\ttransaction.form_item_record = {};\n\t\t\t\tvar row = $( `<tr class=\"tblDataWhite paystub_transaction_row\" align=\"right\">\n\t\t\t\t\t\t\t\t<td align=\"left\" colspan=\"2\"></td>\n\t\t\t\t\t\t\t\t<td colspan=\"2\" class=\"\"></td>\n\t\t\t\t\t\t\t\t<td colspan=\"1\" class=\"\"></td>\n\t\t\t\t\t\t\t\t<td colspan=\"1\" class=\"\"></td>\n\t\t\t\t\t\t\t\t<td colspan=\"1\" class=\"cell control-icon\" style=\"width: 30px\"></td>\n\t\t\t\t\t\t\t\t<td colspan=\"1\" class=\"cell control-icon\">\n\t\t\t\t\t\t\t\t\t<div>\n\t\t\t\t\t\t\t\t\t\t<button class=\"plus-icon\" onclick=\"\"></button>\n\t\t\t\t\t\t\t\t\t\t<button class=\"minus-icon \" onclick=\"\"></button>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t</tr>` );\n\t\t\t\tdata = _.isArray( data ) ? data[0] : data;\n\t\t\t\ttransaction.form_item_record.id = ( data.id && $this.parent_controller.current_edit_record.id ) ? data.id : '';\n\t\t\t\tvar pay_stub_status_id = $this.parent_controller.current_edit_record.status_id;\n\t\t\t\tvar is_add = false;\n\t\t\t\tif ( !$this.parent_controller.current_edit_record.id && !$this.parent_controller.copied_record_id ) {\n\t\t\t\t\tis_add = true;\n\t\t\t\t\tdata.status_id = 10; //10=Pending == When using Copy as New force transaction statuses to pending.\n\t\t\t\t}\n\n\t\t\t\t// Destination Account - writable\n\t\t\t\tvar allowed_statuses = [10];\n\t\t\t\tif ( $this.parent_controller.is_add == false ) {\n\t\t\t\t\tallowed_statuses.push( 20 );\n\t\t\t\t}\n\t\t\t\tvar form_item_remittance_destination_account_input = Global.loadWidgetByName( FormItemType.AWESOME_BOX );\n\t\t\t\tform_item_remittance_destination_account_input.AComboBox( {\n\t\t\t\t\tapi_class: TTAPI.APIRemittanceDestinationAccount,\n\t\t\t\t\tallow_multiple_selection: false,\n\t\t\t\t\tlayout_name: 'global_remittance_destination_account',\n\t\t\t\t\tshow_search_inputs: true,\n\t\t\t\t\tset_empty: true,\n\t\t\t\t\tfield: 'remittance_destination_account_id',\n\t\t\t\t\tdefault_args: {\n\t\t\t\t\t\tfilter_data: {\n\t\t\t\t\t\t\tuser_id: $this.parent_controller.current_edit_record.user_id,\n\t\t\t\t\t\t\tstatus_id: allowed_statuses\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t\tform_item_remittance_destination_account_input.setValue( data.remittance_destination_account_id ? data.remittance_destination_account_id : '' );\n\t\t\t\tform_item_remittance_destination_account_input.unbind( 'formItemChange' ).bind( 'formItemChange', function( e, target ) {\n\t\t\t\t\t$this.parent_controller.validate();\n\t\t\t\t} );\n\n\t\t\t\t// readable\n\t\t\t\tvar form_item_remittance_destination_account_text = Global.loadWidgetByName( FormItemType.TEXT );\n\t\t\t\tform_item_remittance_destination_account_text.TText( { field: 'remittance_destination_account' } );\n\t\t\t\tform_item_remittance_destination_account_text.setValue( data.remittance_destination_account ? data.remittance_destination_account : '' );\n\n\t\t\t\t// Note - writable\n\t\t\t\tvar form_item_note_input = Global.loadWidgetByName( FormItemType.TEXT_INPUT );\n\t\t\t\tform_item_note_input.TTextInput( { field: 'note', width: 300, display_na: false } );\n\t\t\t\tform_item_note_input.setValue( data.note );\n\t\t\t\tform_item_note_input.attr( 'editable', true );\n\t\t\t\t//readable\n\t\t\t\tvar form_item_note_text = Global.loadWidgetByName( FormItemType.TEXT );\n\t\t\t\tform_item_note_text.TText( { field: 'description', display_na: false } );\n\t\t\t\tform_item_note_text.setValue( data.description );\n\n\t\t\t\t// Transaction Status - writable\n\t\t\t\tvar form_item_status_input = Global.loadWidgetByName( FormItemType.COMBO_BOX );\n\t\t\t\tform_item_status_input.TComboBox( { field: 'status_id', set_empty: false } );\n\t\t\t\tform_item_status_input.setSourceData( $this.parent_controller.transaction_status_array );\n\t\t\t\tform_item_status_input.setValue( data.status_id ? data.status_id : '' );\n\t\t\t\tform_item_status_input.setEnabled( ( LocalCacheData.current_doing_context_action == 'copy_as_new' ) );\n\t\t\t\tform_item_status_input.unbind( 'formItemChange' ).bind( 'formItemChange', function( e, target ) {\n\t\t\t\t\t$this.parent_controller.validate();\n\t\t\t\t} );\n\t\t\t\t// readable\n\t\t\t\tvar form_item_status_text = Global.loadWidgetByName( FormItemType.TEXT );\n\t\t\t\tform_item_status_text.TText( { field: 'status' } );\n\t\t\t\tform_item_status_text.setValue( data.status ? data.status : '' );\n\n\t\t\t\t// Transaction Date - writable\n\t\t\t\tvar form_item_transaction_date_input = Global.loadWidgetByName( FormItemType.DATE_PICKER );\n\t\t\t\tform_item_transaction_date_input.TDatePicker( { field: 'transaction_date' } );\n\t\t\t\tform_item_transaction_date_input.setValue( data.transaction_date ? data.transaction_date : '' );\n\t\t\t\tform_item_transaction_date_input.attr( 'editable', true );\n\n\t\t\t\tif ( !data['transaction_date'] ) {\n\t\t\t\t\tform_item_transaction_date_input.setValue( $this.parent_controller.edit_view_ui_dic.transaction_date.getValue() );\n\t\t\t\t}\n\n\t\t\t\tform_item_transaction_date_input.unbind( 'formItemChange' ).bind( 'formItemChange', function( e, target ) {\n\t\t\t\t\t$this.parent_controller.validate();\n\t\t\t\t} );\n\t\t\t\t// readable\n\t\t\t\tvar form_item_confirmation_number_text = Global.loadWidgetByName( FormItemType.TEXT );\n\t\t\t\tform_item_confirmation_number_text.TText( { field: 'transaction_date' } );\n\t\t\t\tform_item_confirmation_number_text.setValue( data.transaction_date ? data.transaction_date : '' );\n\n\t\t\t\t// Amount - writable\n\t\t\t\tvar form_item_amount_input = Global.loadWidgetByName( FormItemType.TEXT_INPUT );\n\t\t\t\tform_item_amount_input.TTextInput( { field: 'amount', width: 60 } );\n\t\t\t\tform_item_amount_input.setValue( data.amount ? Global.removeTrailingZeros( data.amount ) : '' );\n\t\t\t\tform_item_amount_input.unbind( 'formItemChange' ).bind( 'formItemChange', function( e, target ) {\n\t\t\t\t\t$this.parent_controller.validate();\n\t\t\t\t\t$this.calcTransactionTotals();\n\t\t\t\t} );\n\t\t\t\tform_item_amount_input.attr( 'editable', true );\n\t\t\t\t// readable\n\t\t\t\tvar form_item_amount_text = Global.loadWidgetByName( FormItemType.TEXT );\n\t\t\t\tform_item_amount_text.TText( { field: 'amount' } );\n\t\t\t\tform_item_amount_text.setValue( data.amount ? Global.removeTrailingZeros( data.amount ) : '' );\n\n\t\t\t\tif ( !data.status_id ) {\n\t\t\t\t\tdata.status_id = 10;\n\t\t\t\t}\n\n\t\t\t\tif ( $this.parent_controller.isEditMode() ) {\n\t\t\t\t\tform_item_remittance_destination_account_input.setEnabled( data.status_id == 10 );\n\t\t\t\t\tform_item_transaction_date_input.setEnabled( data.status_id == 10 );\n\t\t\t\t\tform_item_amount_input.setReadOnly( data.status_id != 10 );\n\t\t\t\t\tform_item_note_input.setReadOnly( data.status_id != 10 );\n\t\t\t\t\t//form_item_status_input.setValue( 10 ); //set to pending\n\t\t\t\t\tform_item_status_input.setEnabled( false );\n\t\t\t\t} else {\n\t\t\t\t\t//status is not pending. disable editing the row.\n\t\t\t\t\tform_item_remittance_destination_account_input.setEnabled( false );\n\t\t\t\t\tform_item_transaction_date_input.setEnabled( false );\n\t\t\t\t\tform_item_amount_input.setEnabled( false );\n\t\t\t\t\tform_item_note_input.setEnabled( false );\n\t\t\t\t\tform_item_status_input.setEnabled( false );\n\t\t\t\t\tform_item_input = form_item_note_text; //only way to hide the N/A is to swap in a Text Field in view mode.\n\t\t\t\t}\n\n\t\t\t\t//actually append the row to the DOM\n\t\t\t\ttransaction[form_item_remittance_destination_account_input.getField()] = form_item_remittance_destination_account_input;\n\t\t\t\trow.children().eq( 0 ).append( form_item_remittance_destination_account_input );\n\n\t\t\t\ttransaction[form_item_note_input.getField()] = form_item_note_input;\n\t\t\t\trow.children().eq( 1 ).append( form_item_note_input );\n\n\t\t\t\ttransaction[form_item_status_input.getField()] = form_item_status_input;\n\t\t\t\trow.children().eq( 2 ).append( form_item_status_input );\n\n\t\t\t\ttransaction[form_item_transaction_date_input.getField()] = form_item_transaction_date_input;\n\t\t\t\trow.children().eq( 3 ).append( form_item_transaction_date_input );\n\n\t\t\t\ttransaction[form_item_amount_input.getField()] = form_item_amount_input;\n\t\t\t\trow.children().eq( 4 ).append( form_item_amount_input );\n\n\t\t\t\twidgets.push( transaction );\n\t\t\t\tif ( typeof index !== 'undefined' ) {\n\t\t\t\t\trow.insertAfter( $( render ).find( 'tr' ).eq( index ) );\n\t\t\t\t\t$this.rows_widgets_array.splice( ( index ), 0, widgets );\n\t\t\t\t} else {\n\t\t\t\t\t$( render ).append( row );\n\t\t\t\t\t$this.rows_widgets_array.push( widgets );\n\t\t\t\t}\n\n\t\t\t\tif ( $this.parent_controller.isEditMode() == true ) {\n\t\t\t\t\tvar minus_icon = row.find( '.minus-icon' );\n\t\t\t\t\tif ( data.status_id != 10 ) {\n\t\t\t\t\t\tminus_icon.remove();\n\t\t\t\t\t} else {\n\t\t\t\t\t\tminus_icon.click( function() {\n\t\t\t\t\t\t\t$this.insideTransactionEditorRemoveRow( row );\n\t\t\t\t\t\t} );\n\t\t\t\t\t}\n\t\t\t\t\tvar plus_icon = row.find( '.plus-icon' );\n\t\t\t\t\tplus_icon.click( function() {\n\t\t\t\t\t\t$this.insideTransactionEditorAddRow( {}, $( this ).parents( 'tr' ).index() );\n\t\t\t\t\t} );\n\t\t\t\t} else {\n\t\t\t\t\t//#2548 - Do not show plus button in view mode (when paystub is marked paid)\n\t\t\t\t\trow.children().last().find( '.minus-icon' ).remove();\n\t\t\t\t\t//if ( data.status_id != 20 ) {\n\t\t\t\t\trow.children().last().find( '.plus-icon' ).remove();\n\t\t\t\t\t//}\n\t\t\t\t}\n\n\t\t\t}\n\t\t};\n\t\tinside_pay_stub_entry_editor_div.append( this.editor );\n\t}\n\n\tbuildSearchFields() {\n\t\tsuper.buildSearchFields();\n\t\tthis.search_fields = [\n\t\t\tnew SearchField( {\n\t\t\t\tlabel: $.i18n._( 'Pay Stub Status' ),\n\t\t\t\tin_column: 1,\n\t\t\t\tfield: 'status_id',\n\t\t\t\tmultiple: true,\n\t\t\t\tbasic_search: true,\n\t\t\t\tadv_search: true,\n\t\t\t\tlayout_name: 'global_option_column',\n\t\t\t\tform_item_type: FormItemType.AWESOME_BOX\n\t\t\t} ),\n\t\t\tnew SearchField( {\n\t\t\t\tlabel: $.i18n._( 'Pay Stub Type' ),\n\t\t\t\tin_column: 1,\n\t\t\t\tfield: 'type_id',\n\t\t\t\tmultiple: true,\n\t\t\t\tbasic_search: true,\n\t\t\t\tadv_search: true,\n\t\t\t\tlayout_name: 'global_option_column',\n\t\t\t\tform_item_type: FormItemType.AWESOME_BOX\n\t\t\t} ),\n\t\t\tnew SearchField( {\n\t\t\t\tlabel: $.i18n._( 'Employee Status' ),\n\t\t\t\tin_column: 1,\n\t\t\t\tfield: 'user_status_id',\n\t\t\t\tmultiple: true,\n\t\t\t\tbasic_search: false,\n\t\t\t\tadv_search: true,\n\t\t\t\tlayout_name: 'global_option_column',\n\t\t\t\tform_item_type: FormItemType.AWESOME_BOX\n\t\t\t} ),\n\t\t\tnew SearchField( {\n\t\t\t\tlabel: $.i18n._( 'Pay Period' ),\n\t\t\t\tin_column: 1,\n\t\t\t\tfield: 'pay_period_id',\n\t\t\t\tlayout_name: 'global_Pay_period',\n\t\t\t\tapi_class: TTAPI.APIPayPeriod,\n\t\t\t\tmultiple: true,\n\t\t\t\tbasic_search: true,\n\t\t\t\tadv_search: true,\n\t\t\t\tform_item_type: FormItemType.AWESOME_BOX\n\t\t\t} ),\n\t\t\tnew SearchField( {\n\t\t\t\tlabel: $.i18n._( 'Payroll Run' ),\n\t\t\t\tin_column: 1,\n\t\t\t\tfield: 'run_id',\n\t\t\t\tmultiple: true,\n\t\t\t\tbasic_search: true,\n\t\t\t\tadv_search: true,\n\t\t\t\tlayout_name: 'global_option_column',\n\t\t\t\tform_item_type: FormItemType.AWESOME_BOX\n\t\t\t} ),\n\t\t\tnew SearchField( {\n\t\t\t\tlabel: $.i18n._( 'Employee' ),\n\t\t\t\tin_column: 1,\n\t\t\t\tfield: 'user_id',\n\t\t\t\tlayout_name: 'global_user',\n\t\t\t\tapi_class: TTAPI.APIUser,\n\t\t\t\tmultiple: true,\n\t\t\t\tbasic_search: true,\n\t\t\t\tadv_search: true,\n\t\t\t\tform_item_type: FormItemType.AWESOME_BOX\n\t\t\t} ),\n\t\t\tnew SearchField( {\n\t\t\t\tlabel: $.i18n._( 'Title' ),\n\t\t\t\tfield: 'title_id',\n\t\t\t\tin_column: 1,\n\t\t\t\tlayout_name: 'global_job_title',\n\t\t\t\tapi_class: TTAPI.APIUserTitle,\n\t\t\t\tmultiple: true,\n\t\t\t\tbasic_search: false,\n\t\t\t\tadv_search: true,\n\t\t\t\tform_item_type: FormItemType.AWESOME_BOX\n\t\t\t} ),\n\t\t\tnew SearchField( {\n\t\t\t\tlabel: $.i18n._( 'Currency' ),\n\t\t\t\tfield: 'currency_id',\n\t\t\t\tin_column: 1,\n\t\t\t\tlayout_name: 'global_currency',\n\t\t\t\tapi_class: TTAPI.APICurrency,\n\t\t\t\tmultiple: true,\n\t\t\t\tbasic_search: false,\n\t\t\t\tadv_search: true,\n\t\t\t\tform_item_type: FormItemType.AWESOME_BOX\n\t\t\t} ),\n\t\t\tnew SearchField( {\n\t\t\t\tlabel: $.i18n._( 'Group' ),\n\t\t\t\tin_column: 2,\n\t\t\t\tmultiple: true,\n\t\t\t\tfield: 'group_id',\n\t\t\t\tlayout_name: 'global_tree_column',\n\t\t\t\ttree_mode: true,\n\t\t\t\tbasic_search: true,\n\t\t\t\tadv_search: true,\n\t\t\t\tform_item_type: FormItemType.AWESOME_BOX\n\t\t\t} ),\n\t\t\tnew SearchField( {\n\t\t\t\tlabel: $.i18n._( 'Default Branch' ),\n\t\t\t\tin_column: 2,\n\t\t\t\tfield: 'default_branch_id',\n\t\t\t\tlayout_name: 'global_branch',\n\t\t\t\tapi_class: TTAPI.APIBranch,\n\t\t\t\tmultiple: true,\n\t\t\t\tbasic_search: true,\n\t\t\t\tadv_search: true,\n\t\t\t\tform_item_type: FormItemType.AWESOME_BOX\n\t\t\t} ),\n\t\t\tnew SearchField( {\n\t\t\t\tlabel: $.i18n._( 'Default Department' ),\n\t\t\t\tfield: 'default_department_id',\n\t\t\t\tin_column: 2,\n\t\t\t\tlayout_name: 'global_department',\n\t\t\t\tapi_class: TTAPI.APIDepartment,\n\t\t\t\tmultiple: true,\n\t\t\t\tbasic_search: true,\n\t\t\t\tadv_search: true,\n\t\t\t\tform_item_type: FormItemType.AWESOME_BOX\n\t\t\t} ),\n\t\t\tnew SearchField( {\n\t\t\t\tlabel: $.i18n._( 'Country' ),\n\t\t\t\tin_column: 2,\n\t\t\t\tfield: 'country',\n\t\t\t\tmultiple: true,\n\t\t\t\tbasic_search: false,\n\t\t\t\tadv_search: true,\n\t\t\t\tlayout_name: 'global_option_column',\n\t\t\t\tform_item_type: FormItemType.COMBO_BOX\n\t\t\t} ),\n\t\t\tnew SearchField( {\n\t\t\t\tlabel: $.i18n._( 'Province/State' ),\n\t\t\t\tin_column: 2,\n\t\t\t\tfield: 'province',\n\t\t\t\tmultiple: true,\n\t\t\t\tbasic_search: false,\n\t\t\t\tadv_search: true,\n\t\t\t\tlayout_name: 'global_option_column',\n\t\t\t\tform_item_type: FormItemType.AWESOME_BOX\n\t\t\t} ),\n\t\t\tnew SearchField( {\n\t\t\t\tlabel: $.i18n._( 'City' ),\n\t\t\t\tfield: 'city',\n\t\t\t\tbasic_search: false,\n\t\t\t\tadv_search: true,\n\t\t\t\tin_column: 2,\n\t\t\t\tform_item_type: FormItemType.TEXT_INPUT\n\t\t\t} ),\n\n\t\t\tnew SearchField( {\n\t\t\t\tlabel: $.i18n._( 'Created By' ),\n\t\t\t\tin_column: 2,\n\t\t\t\tfield: 'created_by',\n\t\t\t\tlayout_name: 'global_user',\n\t\t\t\tapi_class: TTAPI.APIUser,\n\t\t\t\tmultiple: true,\n\t\t\t\tbasic_search: false,\n\t\t\t\tadv_search: true,\n\t\t\t\tform_item_type: FormItemType.AWESOME_BOX\n\t\t\t} ),\n\n\t\t\tnew SearchField( {\n\t\t\t\tlabel: $.i18n._( 'Updated By' ),\n\t\t\t\tin_column: 2,\n\t\t\t\tfield: 'updated_by',\n\t\t\t\tlayout_name: 'global_user',\n\t\t\t\tapi_class: TTAPI.APIUser,\n\t\t\t\tmultiple: true,\n\t\t\t\tbasic_search: false,\n\t\t\t\tadv_search: true,\n\t\t\t\tform_item_type: FormItemType.AWESOME_BOX\n\t\t\t} )\n\t\t];\n\t}\n\n\tonCustomContextClick( id ) {\n\t\tswitch ( id ) {\n\t\t\tcase 'timesheet':\n\t\t\tcase 'schedule':\n\t\t\tcase 'pay_stub_amendment':\n\t\t\tcase 'edit_employee':\n\t\t\tcase 'employee_pay_stubs':\n\t\t\tcase 'employer_pay_stubs':\n\t\t\tcase 'generate_pay_stub':\n\t\t\tcase 'edit_pay_period':\n\t\t\tcase 'export_excel':\n\t\t\tcase 'pay_stub_transaction':\n\t\t\tdefault:\n\t\t\t\tthis.onNavigationClick( id );\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\tonViewClick( edit_record, noRefreshUI ) {\n\t\tthis.onNavigationClick( 'view' );\n\t}\n\n\tonReportPrintClick( key ) {\n\t\tvar $this = this;\n\n\t\tvar grid_selected_id_array;\n\n\t\tvar filter = {};\n\n\t\tvar ids = [];\n\n\t\tvar user_ids = [];\n\n\t\tvar base_date;\n\n\t\tvar pay_period_ids = [];\n\n\t\tif ( $this.edit_view && $this.current_edit_record.id ) {\n\t\t\tids.push( $this.current_edit_record.id );\n\t\t\tuser_ids.push( $this.current_edit_record.user_id );\n\t\t\tpay_period_ids.push( $this.current_edit_record.pay_period_id );\n\t\t\tbase_date = $this.current_edit_record.start_date;\n\t\t} else {\n\t\t\tgrid_selected_id_array = this.getGridSelectIdArray();\n\t\t\t$.each( grid_selected_id_array, function( index, value ) {\n\t\t\t\tvar grid_selected_row = $this.getRecordFromGridById( value );\n\t\t\t\tids.push( grid_selected_row.id );\n\t\t\t\tuser_ids.push( grid_selected_row.user_id );\n\t\t\t\tpay_period_ids.push( grid_selected_row.pay_period_id );\n\t\t\t\tbase_date = grid_selected_row.start_date;\n\t\t\t} );\n\t\t}\n\n\t\tvar args = { filter_data: { id: ids } };\n\t\tvar post_data = { 0: args, 1: true, 2: key };\n\n\t\tthis.doFormIFrameCall( post_data );\n\t}\n\n\tonNavigationClick( iconName ) {\n\n\t\tvar $this = this;\n\n\t\tvar grid_selected_id_array;\n\n\t\tvar filter = {};\n\n\t\tvar ids = [];\n\n\t\tvar user_ids = [];\n\n\t\tvar base_date;\n\n\t\tvar pay_period_ids = [];\n\n\t\tif ( $this.edit_view && $this.current_edit_record.id ) {\n\t\t\tids.push( $this.current_edit_record.id );\n\t\t\tuser_ids.push( $this.current_edit_record.user_id );\n\t\t\tpay_period_ids.push( $this.current_edit_record.pay_period_id );\n\t\t\tbase_date = $this.current_edit_record.start_date;\n\t\t} else {\n\t\t\tgrid_selected_id_array = this.getGridSelectIdArray();\n\t\t\t$.each( grid_selected_id_array, function( index, value ) {\n\t\t\t\tvar grid_selected_row = $this.getRecordFromGridById( value );\n\t\t\t\tids.push( grid_selected_row.id );\n\t\t\t\tuser_ids.push( grid_selected_row.user_id );\n\t\t\t\tpay_period_ids.push( grid_selected_row.pay_period_id );\n\t\t\t\tbase_date = grid_selected_row.start_date;\n\t\t\t} );\n\t\t}\n\n\t\tvar args = { filter_data: { id: ids } };\n\n\t\tvar post_data;\n\n\t\tswitch ( iconName ) {\n\t\t\tcase 'edit_employee':\n\t\t\t\tif ( user_ids.length > 0 ) {\n\t\t\t\t\tIndexViewController.openEditView( this, 'Employee', user_ids[0] );\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'edit_pay_period':\n\t\t\t\tif ( pay_period_ids.length > 0 ) {\n\t\t\t\t\tIndexViewController.openEditView( this, 'PayPeriods', pay_period_ids[0] );\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'timesheet':\n\t\t\t\tif ( user_ids.length > 0 ) {\n\t\t\t\t\tfilter.user_id = user_ids[0];\n\t\t\t\t\tfilter.base_date = base_date;\n\t\t\t\t\tGlobal.addViewTab( $this.viewId, $.i18n._( 'Pay Stubs' ), window.location.href );\n\t\t\t\t\tIndexViewController.goToView( 'TimeSheet', filter );\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'schedule':\n\t\t\t\tfilter.filter_data = {};\n\t\t\t\tvar include_users = { value: user_ids };\n\t\t\t\tfilter.filter_data.include_user_ids = include_users;\n\t\t\t\tfilter.select_date = base_date;\n\t\t\t\tGlobal.addViewTab( this.viewId, $.i18n._( 'Pay Stubs' ), window.location.href );\n\t\t\t\tIndexViewController.goToView( 'Schedule', filter );\n\t\t\t\tbreak;\n\t\t\tcase 'pay_stub_amendment':\n\t\t\t\tfilter.filter_data = {};\n\t\t\t\tfilter.filter_data.user_id = user_ids[0];\n\t\t\t\tfilter.filter_data.pay_period_id = pay_period_ids[0];\n\t\t\t\tGlobal.addViewTab( this.viewId, $.i18n._( 'Pay Stubs' ), window.location.href );\n\t\t\t\tIndexViewController.goToView( 'PayStubAmendment', filter );\n\t\t\t\tbreak;\n\t\t\tcase 'generate_pay_stub':\n\n\t\t\t\tif ( user_ids.length === 1 ) {\n\t\t\t\t\tfilter.user_id = user_ids[0];\n\t\t\t\t} else if ( user_ids.length > 1 ) {\n\t\t\t\t\tfilter.user_id = user_ids;\n\t\t\t\t}\n\n\t\t\t\tif ( pay_period_ids.length === 1 ) {\n\t\t\t\t\tfilter.pay_period_id = [pay_period_ids[0]];\n\t\t\t\t} else if ( pay_period_ids.length > 1 ) {\n\t\t\t\t\tfilter.pay_period_id = pay_period_ids;\n\t\t\t\t} else {\n\t\t\t\t\tfilter.pay_period_id = [];\n\t\t\t\t}\n\n\t\t\t\tIndexViewController.openWizard( 'GeneratePayStubWizard', filter, function() {\n\t\t\t\t\t$this.search();\n\t\t\t\t} );\n\t\t\t\tbreak;\n\t\t\tcase 'view':\n\t\t\t\t//If its a payroll admin or higher, by default make the View button show employer pay stub.\n\t\t\t\tif ( ( PermissionManager.validate( 'pay_stub', 'view' ) || PermissionManager.validate( 'pay_stub', 'view_child' ) ) ) {\n\t\t\t\t\tpost_data = { 0: args, 1: false, 2: 'pdf', 3: false };\n\t\t\t\t} else {\n\t\t\t\t\tpost_data = { 0: args, 1: false, 2: 'pdf', 3: true };\n\t\t\t\t}\n\t\t\t\tthis.doFormIFrameCall( post_data );\n\t\t\t\t$().TFeedback( {\n\t\t\t\t\tsource: 'View', // viewId GovernmentDocument will be prepended in TFeedback functions.\n\t\t\t\t\tdelay: 5000\n\t\t\t\t} );\n\t\t\t\tbreak;\n\t\t\tcase 'employee_pay_stubs':\n\t\t\t\tpost_data = { 0: args, 1: false, 2: 'pdf', 3: true };\n\t\t\t\tthis.doFormIFrameCall( post_data );\n\t\t\t\tbreak;\n\t\t\tcase 'employer_pay_stubs':\n\t\t\t\tpost_data = { 0: args, 1: false, 2: 'pdf', 3: false };\n\t\t\t\tthis.doFormIFrameCall( post_data );\n\t\t\t\tbreak;\n\t\t\tcase 'pay_stub_transaction':\n\t\t\t\tfilter = {};\n\t\t\t\tfilter.filter_data = {};\n\n\t\t\t\tfilter.filter_data.user_id = { value: user_ids };\n\t\t\t\tfilter.filter_data.pay_period_id = { value: pay_period_ids };\n\n\t\t\t\tGlobal.addViewTab( this.viewId, $.i18n._( 'Pay Stubs' ), window.location.href );\n\t\t\t\tIndexViewController.goToView( 'PayStubTransaction', filter );\n\t\t\t\tbreak;\n\t\t\tcase 'export_excel':\n\t\t\t\tthis.onExportClick( 'export' + this.api.key_name );\n\t\t\t\tbreak;\n\t\t\tcase 'direct_deposit':\n\t\t\t\tvar data = {\n\t\t\t\t\tfilter_data: {\n\t\t\t\t\t\tpay_stub_id: this.getGridSelectIdArray()\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\tIndexViewController.openWizardController( 'ProcessTransactionsWizardController', data );\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\tonReportMenuClick( id ) {\n\t\tthis.onReportPrintClick( id );\n\t}\n\n\tdoFormIFrameCall( postData ) {\n\t\tGlobal.APIFileDownload( this.api.className, 'get' + this.api.key_name, postData );\n\t}\n\n\tgetPayStubTabHtml() {\n\t\treturn `<div id=\"tab_pay_stub\" class=\"edit-view-tab-outside\">\n\t\t\t\t\t<div class=\"edit-view-tab\" id=\"tab_pay_stub_content_div\">\n\t\t\t\t\t\t<div class=\"first-column\"></div>\n\t\t\t\t\t\t<div class=\"second-column\"></div>\n\t\t\t\t\t\t<div class=\"inside-pay-stub-entry-editor-div full-width-column\" style=\"float: left; position: relative\">\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>`;\n\t}\n\n}\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMzQzNi5qcyIsIm1hcHBpbmdzIjoiOzs7Ozs7O0FBQXFDOztBQUU5QjtBQUNQLDJCQUEyQjtBQUMzQixFQUFFLENBQUM7QUFDSDs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTs7QUFFQTs7QUFFQTtBQUNBO0FBQ0E7O0FBRUE7O0FBRUE7QUFDQTs7QUFFQTs7QUFFQTs7QUFFQTtBQUNBLElBQUk7O0FBRUo7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLDJCQUEyQixDQUFDO0FBQzVCLDBCQUEwQixDQUFDO0FBQzNCO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBLEVBQUUsQ0FBQztBQUNILHVDQUF1QyxDQUFDO0FBQ3hD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