TimeTrex/interface/html5/views/reports/t4_summary/T4SummaryReportViewController.js

1083 lines
36 KiB
JavaScript
Raw Permalink Normal View History

2022-12-13 07:10:06 +01:00
export class T4SummaryReportViewController extends ReportBaseViewController {
constructor( options = {} ) {
_.defaults( options, {
type_array: null
} );
super( options );
}
initReport( options ) {
this.script_name = 'T4SummaryReport';
this.viewId = 'T4SummaryReport';
this.context_menu_name = $.i18n._( 'T4 Summary' );
this.navigation_label = $.i18n._( 'Saved Report' );
this.view_file = 'T4SummaryReportView.html';
this.api = TTAPI.APIT4SummaryReport;
this.api_paystub = TTAPI.APIPayStubEntryAccount;
this.include_form_setup = true;
}
getCustomContextMenuModel() {
var context_menu_model = {
groups: {
form: {
label: $.i18n._( 'Form' ),
id: this.viewId + 'Form'
}
},
exclude: [],
include: [
{
label: $.i18n._( 'Form' ),
id: 'view_print',
action_group_header: true,
action_group: 'view_form',
group: 'form',
menu_align: 'right',
icon: 'view-35x35.png',
type: 2
},
{
label: $.i18n._( 'View: Government (Multiple Employees/Page)' ),
id: 'pdf_form_government',
action_group: 'view_form',
group: 'form',
menu_align: 'right',
icon: 'view-35x35.png',
type: 2,
sort_order: 10100
},
{
label: $.i18n._( 'View: Employee (One Employee/Page)' ),
id: 'pdf_form',
action_group: 'view_form',
group: 'form',
menu_align: 'right',
icon: 'view-35x35.png',
type: 2,
sort_order: 10200
},
{
label: $.i18n._( 'eFile' ),
id: 'e_file_xml',
action_group: 'view_form',
group: 'form',
menu_align: 'right',
sort_order: 10300
},
{
label: $.i18n._( 'Save Setup' ),
id: 'save_setup',
action_group: 'view_form',
group: 'form',
menu_align: 'right',
sort_order: 10400
},
]
};
if ( ( Global.getProductEdition() >= 15 ) ) {
context_menu_model.include.push( {
label: $.i18n._( 'Publish Employee Forms' ),
id: 'pdf_form_publish_employee',
action_group: 'view_form',
menu_align: 'right',
sort_order: 10250
} );
}
return context_menu_model;
}
initOptions( callBack ) {
var $this = this;
var options = [
{ option_name: 'page_orientation' },
{ option_name: 'font_size' },
{ option_name: 'chart_display_mode' },
{ option_name: 'chart_type' },
{ option_name: 'templates' },
{ option_name: 'setup_fields' },
{ option_name: 'type' },
{ option_name: 'auto_refresh' }
];
this.initDropDownOptions( options, function( result ) {
TTAPI.APICompany.getOptions( 'province', 'CA', {
onResult: function( provinceResult ) {
$this.province_array = Global.buildRecordArray( provinceResult.getResult() );
callBack( result ); // First to initialize drop down options, and then to initialize edit view UI.
}
} );
} );
}
onCustomContextClick( id ) {
switch ( id ) {
case 'e_file_xml': //All report view
this.onReportMenuClick( 'efile_xml' );
break;
case 'pdf_form':
case 'pdf_form_government':
case 'pdf_form_publish_employee':
this.onReportMenuClick( id );
break;
default:
return false; //FALSE tells onContextMenuClick() to keep processing.
}
return true;
}
onReportMenuClick( id ) {
this.onViewClick( id );
}
buildFormSetupUI() {
var $this = this;
var tab3 = this.edit_view_tab.find( '#tab_form_setup' );
var tab3_column1 = tab3.find( '.first-column' );
this.edit_view_tabs[3] = [];
this.edit_view_tabs[3].push( tab3_column1 );
//Status
var form_item_input = Global.loadWidgetByName( FormItemType.COMBO_BOX );
form_item_input.TComboBox( { field: 'status_id', set_empty: false } );
form_item_input.setSourceData( $this.type_array );
this.addEditFieldToColumn( $.i18n._( 'Status' ), form_item_input, tab3_column1 );
//Employment Income (Box 14)
var v_box = $( '<div class=\'v-box\'></div>' );
//Include
form_item_input = Global.loadWidgetByName( FormItemType.AWESOME_BOX );
form_item_input.AComboBox( {
api_class: TTAPI.APIPayStubEntryAccount,
allow_multiple_selection: true,
layout_name: 'global_PayStubAccount',
show_search_inputs: true,
set_empty: true,
field: 'income_include_pay_stub_entry_account'
} );
var form_item = this.putInputToInsideFormItem( form_item_input, $.i18n._( 'Include' ) );
v_box.append( form_item );
v_box.append( '<div class=\'clear-both-div\'></div>' );
//Exclude
var form_item_input_1 = Global.loadWidgetByName( FormItemType.AWESOME_BOX );
form_item_input_1.AComboBox( {
api_class: TTAPI.APIPayStubEntryAccount,
allow_multiple_selection: true,
layout_name: 'global_PayStubAccount',
show_search_inputs: true,
set_empty: true,
field: 'income_exclude_pay_stub_entry_account'
} );
form_item = this.putInputToInsideFormItem( form_item_input_1, $.i18n._( 'Exclude' ) );
v_box.append( form_item );
this.addEditFieldToColumn( $.i18n._( 'Employment Income (Box 14)' ) + '\n*' + $.i18n._( 'Must Match Remittance \nSummary Gross Payroll' ), [form_item_input, form_item_input_1], tab3_column1, '', v_box, false, true );
//Tax Income (Box 22)
v_box = $( '<div class=\'v-box\'></div>' );
//Include
form_item_input = Global.loadWidgetByName( FormItemType.AWESOME_BOX );
form_item_input.AComboBox( {
api_class: TTAPI.APIPayStubEntryAccount,
allow_multiple_selection: true,
layout_name: 'global_PayStubAccount',
show_search_inputs: true,
set_empty: true,
field: 'tax_include_pay_stub_entry_account'
} );
form_item = this.putInputToInsideFormItem( form_item_input, $.i18n._( 'Include' ) );
v_box.append( form_item );
v_box.append( '<div class=\'clear-both-div\'></div>' );
//Exclude
form_item_input_1 = Global.loadWidgetByName( FormItemType.AWESOME_BOX );
form_item_input_1.AComboBox( {
api_class: TTAPI.APIPayStubEntryAccount,
allow_multiple_selection: true,
layout_name: 'global_PayStubAccount',
show_search_inputs: true,
set_empty: true,
field: 'tax_exclude_pay_stub_entry_account'
} );
form_item = this.putInputToInsideFormItem( form_item_input_1, $.i18n._( 'Exclude' ) );
v_box.append( form_item );
this.addEditFieldToColumn( $.i18n._( 'Income Tax (Box 22)' ), [form_item_input, form_item_input_1], tab3_column1, '', v_box, false, true );
//Employee CPP(Box 16)
v_box = $( '<div class=\'v-box\'></div>' );
//Include
form_item_input = Global.loadWidgetByName( FormItemType.AWESOME_BOX );
form_item_input.AComboBox( {
api_class: TTAPI.APIPayStubEntryAccount,
allow_multiple_selection: true,
layout_name: 'global_PayStubAccount',
show_search_inputs: true,
set_empty: true,
field: 'employee_cpp_include_pay_stub_entry_account'
} );
form_item = this.putInputToInsideFormItem( form_item_input, $.i18n._( 'Include' ) );
v_box.append( form_item );
v_box.append( '<div class=\'clear-both-div\'></div>' );
//Exclude
form_item_input_1 = Global.loadWidgetByName( FormItemType.AWESOME_BOX );
form_item_input_1.AComboBox( {
api_class: TTAPI.APIPayStubEntryAccount,
allow_multiple_selection: true,
layout_name: 'global_PayStubAccount',
show_search_inputs: true,
set_empty: true,
field: 'employee_cpp_exclude_pay_stub_entry_account'
} );
form_item = this.putInputToInsideFormItem( form_item_input_1, $.i18n._( 'Exclude' ) );
v_box.append( form_item );
this.addEditFieldToColumn( $.i18n._( 'Employee CPP (Box 16)' ), [form_item_input, form_item_input_1], tab3_column1, '', v_box, false, true );
//Employer CPP
v_box = $( '<div class=\'v-box\'></div>' );
//Include
form_item_input = Global.loadWidgetByName( FormItemType.AWESOME_BOX );
form_item_input.AComboBox( {
api_class: TTAPI.APIPayStubEntryAccount,
allow_multiple_selection: true,
layout_name: 'global_PayStubAccount',
show_search_inputs: true,
set_empty: true,
field: 'employer_cpp_include_pay_stub_entry_account'
} );
form_item = this.putInputToInsideFormItem( form_item_input, $.i18n._( 'Include' ) );
v_box.append( form_item );
v_box.append( '<div class=\'clear-both-div\'></div>' );
//Exclude
form_item_input_1 = Global.loadWidgetByName( FormItemType.AWESOME_BOX );
form_item_input_1.AComboBox( {
api_class: TTAPI.APIPayStubEntryAccount,
allow_multiple_selection: true,
layout_name: 'global_PayStubAccount',
show_search_inputs: true,
set_empty: true,
field: 'employer_cpp_exclude_pay_stub_entry_account'
} );
form_item = this.putInputToInsideFormItem( form_item_input_1, $.i18n._( 'Exclude' ) );
v_box.append( form_item );
this.addEditFieldToColumn( $.i18n._( 'Employer CPP' ), [form_item_input, form_item_input_1], tab3_column1, '', v_box, false, true );
//Employee EI (Box 18)
v_box = $( '<div class=\'v-box\'></div>' );
//Include
form_item_input = Global.loadWidgetByName( FormItemType.AWESOME_BOX );
form_item_input.AComboBox( {
api_class: TTAPI.APIPayStubEntryAccount,
allow_multiple_selection: true,
layout_name: 'global_PayStubAccount',
show_search_inputs: true,
set_empty: true,
field: 'employee_ei_include_pay_stub_entry_account'
} );
form_item = this.putInputToInsideFormItem( form_item_input, $.i18n._( 'Include' ) );
v_box.append( form_item );
v_box.append( '<div class=\'clear-both-div\'></div>' );
//Exclude
form_item_input_1 = Global.loadWidgetByName( FormItemType.AWESOME_BOX );
form_item_input_1.AComboBox( {
api_class: TTAPI.APIPayStubEntryAccount,
allow_multiple_selection: true,
layout_name: 'global_PayStubAccount',
show_search_inputs: true,
set_empty: true,
field: 'employee_ei_exclude_pay_stub_entry_account'
} );
form_item = this.putInputToInsideFormItem( form_item_input_1, $.i18n._( 'Exclude' ) );
v_box.append( form_item );
this.addEditFieldToColumn( $.i18n._( 'Employee EI (Box 18)' ), [form_item_input, form_item_input_1], tab3_column1, '', v_box, false, true );
//Employer EI
v_box = $( '<div class=\'v-box\'></div>' );
//Include
form_item_input = Global.loadWidgetByName( FormItemType.AWESOME_BOX );
form_item_input.AComboBox( {
api_class: TTAPI.APIPayStubEntryAccount,
allow_multiple_selection: true,
layout_name: 'global_PayStubAccount',
show_search_inputs: true,
set_empty: true,
field: 'employer_ei_include_pay_stub_entry_account'
} );
form_item = this.putInputToInsideFormItem( form_item_input, $.i18n._( 'Include' ) );
v_box.append( form_item );
v_box.append( '<div class=\'clear-both-div\'></div>' );
//Exclude
form_item_input_1 = Global.loadWidgetByName( FormItemType.AWESOME_BOX );
form_item_input_1.AComboBox( {
api_class: TTAPI.APIPayStubEntryAccount,
allow_multiple_selection: true,
layout_name: 'global_PayStubAccount',
show_search_inputs: true,
set_empty: true,
field: 'employer_ei_exclude_pay_stub_entry_account'
} );
form_item = this.putInputToInsideFormItem( form_item_input_1, $.i18n._( 'Exclude' ) );
v_box.append( form_item );
this.addEditFieldToColumn( $.i18n._( 'Employer EI' ), [form_item_input, form_item_input_1], tab3_column1, '', v_box, false, true );
//EI Insurable Earnings (Box: 24)
v_box = $( '<div class=\'v-box\'></div>' );
//Include
form_item_input = Global.loadWidgetByName( FormItemType.AWESOME_BOX );
form_item_input.AComboBox( {
api_class: TTAPI.APIPayStubEntryAccount,
allow_multiple_selection: true,
layout_name: 'global_PayStubAccount',
show_search_inputs: true,
set_empty: true,
field: 'ei_earnings_include_pay_stub_entry_account'
} );
form_item = this.putInputToInsideFormItem( form_item_input, $.i18n._( 'Include' ) );
v_box.append( form_item );
v_box.append( '<div class=\'clear-both-div\'></div>' );
//Exclude
form_item_input_1 = Global.loadWidgetByName( FormItemType.AWESOME_BOX );
form_item_input_1.AComboBox( {
api_class: TTAPI.APIPayStubEntryAccount,
allow_multiple_selection: true,
layout_name: 'global_PayStubAccount',
show_search_inputs: true,
set_empty: true,
field: 'ei_earnings_exclude_pay_stub_entry_account'
} );
form_item = this.putInputToInsideFormItem( form_item_input_1, $.i18n._( 'Exclude' ) );
v_box.append( form_item );
this.addEditFieldToColumn( $.i18n._( 'EI Insurable Earnings (Box: 24)' ), [form_item_input, form_item_input_1], tab3_column1, '', v_box, false, true );
//CPP Pensionable Earnings (Box: 26)
v_box = $( '<div class=\'v-box\'></div>' );
//Include
form_item_input = Global.loadWidgetByName( FormItemType.AWESOME_BOX );
form_item_input.AComboBox( {
api_class: TTAPI.APIPayStubEntryAccount,
allow_multiple_selection: true,
layout_name: 'global_PayStubAccount',
show_search_inputs: true,
set_empty: true,
field: 'cpp_earnings_include_pay_stub_entry_account'
} );
form_item = this.putInputToInsideFormItem( form_item_input, $.i18n._( 'Include' ) );
v_box.append( form_item );
v_box.append( '<div class=\'clear-both-div\'></div>' );
//Exclude
form_item_input_1 = Global.loadWidgetByName( FormItemType.AWESOME_BOX );
form_item_input_1.AComboBox( {
api_class: TTAPI.APIPayStubEntryAccount,
allow_multiple_selection: true,
layout_name: 'global_PayStubAccount',
show_search_inputs: true,
set_empty: true,
field: 'cpp_earnings_exclude_pay_stub_entry_account'
} );
form_item = this.putInputToInsideFormItem( form_item_input_1, $.i18n._( 'Exclude' ) );
v_box.append( form_item );
this.addEditFieldToColumn( $.i18n._( 'CPP Pensionable Earnings (Box: 26)' ), [form_item_input, form_item_input_1], tab3_column1, '', v_box, false, true );
//Union Dues (Box: 44)
v_box = $( '<div class=\'v-box\'></div>' );
//Include
form_item_input = Global.loadWidgetByName( FormItemType.AWESOME_BOX );
form_item_input.AComboBox( {
api_class: TTAPI.APIPayStubEntryAccount,
allow_multiple_selection: true,
layout_name: 'global_PayStubAccount',
show_search_inputs: true,
set_empty: true,
field: 'union_dues_include_pay_stub_entry_account'
} );
form_item = this.putInputToInsideFormItem( form_item_input, $.i18n._( 'Include' ) );
v_box.append( form_item );
v_box.append( '<div class=\'clear-both-div\'></div>' );
//Exclude
form_item_input_1 = Global.loadWidgetByName( FormItemType.AWESOME_BOX );
form_item_input_1.AComboBox( {
api_class: TTAPI.APIPayStubEntryAccount,
allow_multiple_selection: true,
layout_name: 'global_PayStubAccount',
show_search_inputs: true,
set_empty: true,
field: 'union_dues_exclude_pay_stub_entry_account'
} );
form_item = this.putInputToInsideFormItem( form_item_input_1, $.i18n._( 'Exclude' ) );
v_box.append( form_item );
this.addEditFieldToColumn( $.i18n._( 'Union Dues (Box: 44)' ), [form_item_input, form_item_input_1], tab3_column1, '', v_box, false, true );
//RPP Contributions (Box: 20)
v_box = $( '<div class=\'v-box\'></div>' );
//Include
form_item_input = Global.loadWidgetByName( FormItemType.AWESOME_BOX );
form_item_input.AComboBox( {
api_class: TTAPI.APIPayStubEntryAccount,
allow_multiple_selection: true,
layout_name: 'global_PayStubAccount',
show_search_inputs: true,
set_empty: true,
field: 'rpp_include_pay_stub_entry_account'
} );
form_item = this.putInputToInsideFormItem( form_item_input, $.i18n._( 'Include' ) );
v_box.append( form_item );
v_box.append( '<div class=\'clear-both-div\'></div>' );
//Exclude
form_item_input_1 = Global.loadWidgetByName( FormItemType.AWESOME_BOX );
form_item_input_1.AComboBox( {
api_class: TTAPI.APIPayStubEntryAccount,
allow_multiple_selection: true,
layout_name: 'global_PayStubAccount',
show_search_inputs: true,
set_empty: true,
field: 'rpp_exclude_pay_stub_entry_account'
} );
form_item = this.putInputToInsideFormItem( form_item_input_1, $.i18n._( 'Exclude' ) );
v_box.append( form_item );
this.addEditFieldToColumn( $.i18n._( 'RPP Contributions (Box: 20)' ), [form_item_input, form_item_input_1], tab3_column1, '', v_box, false, true );
//Charitable Contributions (Box: 46)
v_box = $( '<div class=\'v-box\'></div>' );
//Include
form_item_input = Global.loadWidgetByName( FormItemType.AWESOME_BOX );
form_item_input.AComboBox( {
api_class: TTAPI.APIPayStubEntryAccount,
allow_multiple_selection: true,
layout_name: 'global_PayStubAccount',
show_search_inputs: true,
set_empty: true,
field: 'charity_include_pay_stub_entry_account'
} );
form_item = this.putInputToInsideFormItem( form_item_input, $.i18n._( 'Include' ) );
v_box.append( form_item );
v_box.append( '<div class=\'clear-both-div\'></div>' );
//Exclude
form_item_input_1 = Global.loadWidgetByName( FormItemType.AWESOME_BOX );
form_item_input_1.AComboBox( {
api_class: TTAPI.APIPayStubEntryAccount,
allow_multiple_selection: true,
layout_name: 'global_PayStubAccount',
show_search_inputs: true,
set_empty: true,
field: 'charity_exclude_pay_stub_entry_account'
} );
form_item = this.putInputToInsideFormItem( form_item_input_1, $.i18n._( 'Exclude' ) );
v_box.append( form_item );
this.addEditFieldToColumn( $.i18n._( 'Charitable Contributions (Box: 46)' ), [form_item_input, form_item_input_1], tab3_column1, '', v_box, false, true );
//Pension Adjustment (Box: 52)
v_box = $( '<div class=\'v-box\'></div>' );
//Include
form_item_input = Global.loadWidgetByName( FormItemType.AWESOME_BOX );
form_item_input.AComboBox( {
api_class: TTAPI.APIPayStubEntryAccount,
allow_multiple_selection: true,
layout_name: 'global_PayStubAccount',
show_search_inputs: true,
set_empty: true,
field: 'pension_adjustment_include_pay_stub_entry_account'
} );
form_item = this.putInputToInsideFormItem( form_item_input, $.i18n._( 'Include' ) );
v_box.append( form_item );
v_box.append( '<div class=\'clear-both-div\'></div>' );
//Exclude
form_item_input_1 = Global.loadWidgetByName( FormItemType.AWESOME_BOX );
form_item_input_1.AComboBox( {
api_class: TTAPI.APIPayStubEntryAccount,
allow_multiple_selection: true,
layout_name: 'global_PayStubAccount',
show_search_inputs: true,
set_empty: true,
field: 'pension_adjustment_exclude_pay_stub_entry_account'
} );
form_item = this.putInputToInsideFormItem( form_item_input_1, $.i18n._( 'Exclude' ) );
v_box.append( form_item );
this.addEditFieldToColumn( $.i18n._( 'Pension Adjustment (Box: 52)' ), [form_item_input, form_item_input_1], tab3_column1, '', v_box, false, true );
//RPP or DPSP Number (Box: 50)
form_item_input = Global.loadWidgetByName( FormItemType.TEXT_INPUT );
form_item_input.TTextInput( { field: 'rpp_number' } );
this.addEditFieldToColumn( $.i18n._( 'RPP or DPSP Number (Box: 50)' ), form_item_input, tab3_column1 );
//Box [0]
v_box = $( '<div class=\'v-box\'></div>' );
//Include
form_item_input = Global.loadWidgetByName( FormItemType.AWESOME_BOX );
form_item_input.AComboBox( {
api_class: TTAPI.APIPayStubEntryAccount,
allow_multiple_selection: true,
layout_name: 'global_PayStubAccount',
show_search_inputs: true,
set_empty: true,
field: 'box_0_include_pay_stub_entry_account'
} );
form_item = this.putInputToInsideFormItem( form_item_input, $.i18n._( 'Include' ) );
v_box.append( form_item );
v_box.append( '<div class=\'clear-both-div\'></div>' );
//Exclude
form_item_input_1 = Global.loadWidgetByName( FormItemType.AWESOME_BOX );
form_item_input_1.AComboBox( {
api_class: TTAPI.APIPayStubEntryAccount,
allow_multiple_selection: true,
layout_name: 'global_PayStubAccount',
show_search_inputs: true,
set_empty: true,
field: 'box_0_exclude_pay_stub_entry_account'
} );
form_item = this.putInputToInsideFormItem( form_item_input_1, $.i18n._( 'Exclude' ) );
v_box.append( form_item );
var custom_label_widget = $( '<div class=\'h-box\'></div>' );
var label = $( '<span class="edit-view-form-item-label"></span>' );
var box = Global.loadWidgetByName( FormItemType.TEXT_INPUT );
box.TTextInput( { field: 'box_0_box', width: 50 } );
box.css( 'float', 'right' );
box.bind( 'formItemChange', function( e, target ) {
$this.onFormItemChange( target );
} );
label.text( $.i18n._( 'Box' ) );
this.edit_view_ui_dic[box.getField()] = box;
custom_label_widget.append( box );
custom_label_widget.append( label );
this.addEditFieldToColumn( $.i18n._( 'Box' ), [form_item_input, form_item_input_1], tab3_column1, '', v_box, false, true, false, false, custom_label_widget );
//Box [1]
v_box = $( '<div class=\'v-box\'></div>' );
//Include
form_item_input = Global.loadWidgetByName( FormItemType.AWESOME_BOX );
form_item_input.AComboBox( {
api_class: TTAPI.APIPayStubEntryAccount,
allow_multiple_selection: true,
layout_name: 'global_PayStubAccount',
show_search_inputs: true,
set_empty: true,
field: 'box_1_include_pay_stub_entry_account'
} );
form_item = this.putInputToInsideFormItem( form_item_input, $.i18n._( 'Include' ) );
v_box.append( form_item );
v_box.append( '<div class=\'clear-both-div\'></div>' );
//Exclude
form_item_input_1 = Global.loadWidgetByName( FormItemType.AWESOME_BOX );
form_item_input_1.AComboBox( {
api_class: TTAPI.APIPayStubEntryAccount,
allow_multiple_selection: true,
layout_name: 'global_PayStubAccount',
show_search_inputs: true,
set_empty: true,
field: 'box_1_exclude_pay_stub_entry_account'
} );
form_item = this.putInputToInsideFormItem( form_item_input_1, $.i18n._( 'Exclude' ) );
v_box.append( form_item );
custom_label_widget = $( '<div class=\'h-box\'></div>' );
label = $( '<span class="edit-view-form-item-label"></span>' );
box = Global.loadWidgetByName( FormItemType.TEXT_INPUT );
box.TTextInput( { field: 'box_1_box', width: 50 } );
box.css( 'float', 'right' );
box.bind( 'formItemChange', function( e, target ) {
$this.onFormItemChange( target );
} );
label.text( $.i18n._( 'Box' ) );
this.edit_view_ui_dic[box.getField()] = box;
custom_label_widget.append( box );
custom_label_widget.append( label );
this.addEditFieldToColumn( $.i18n._( 'Box' ), [form_item_input, form_item_input_1], tab3_column1, '', v_box, false, true, false, false, custom_label_widget );
//Box [2]
v_box = $( '<div class=\'v-box\'></div>' );
//Include
form_item_input = Global.loadWidgetByName( FormItemType.AWESOME_BOX );
form_item_input.AComboBox( {
api_class: TTAPI.APIPayStubEntryAccount,
allow_multiple_selection: true,
layout_name: 'global_PayStubAccount',
show_search_inputs: true,
set_empty: true,
field: 'box_2_include_pay_stub_entry_account'
} );
form_item = this.putInputToInsideFormItem( form_item_input, $.i18n._( 'Include' ) );
v_box.append( form_item );
v_box.append( '<div class=\'clear-both-div\'></div>' );
//Exclude
form_item_input_1 = Global.loadWidgetByName( FormItemType.AWESOME_BOX );
form_item_input_1.AComboBox( {
api_class: TTAPI.APIPayStubEntryAccount,
allow_multiple_selection: true,
layout_name: 'global_PayStubAccount',
show_search_inputs: true,
set_empty: true,
field: 'box_2_exclude_pay_stub_entry_account'
} );
form_item = this.putInputToInsideFormItem( form_item_input_1, $.i18n._( 'Exclude' ) );
v_box.append( form_item );
custom_label_widget = $( '<div class=\'h-box\'></div>' );
label = $( '<span class="edit-view-form-item-label"></span>' );
box = Global.loadWidgetByName( FormItemType.TEXT_INPUT );
box.TTextInput( { field: 'box_2_box', width: 50 } );
box.css( 'float', 'right' );
box.bind( 'formItemChange', function( e, target ) {
$this.onFormItemChange( target );
} );
label.text( $.i18n._( 'Box' ) );
this.edit_view_ui_dic[box.getField()] = box;
custom_label_widget.append( box );
custom_label_widget.append( label );
this.addEditFieldToColumn( $.i18n._( 'Box' ), [form_item_input, form_item_input_1], tab3_column1, '', v_box, false, true, false, false, custom_label_widget );
//Box [3]
v_box = $( '<div class=\'v-box\'></div>' );
//Include
form_item_input = Global.loadWidgetByName( FormItemType.AWESOME_BOX );
form_item_input.AComboBox( {
api_class: TTAPI.APIPayStubEntryAccount,
allow_multiple_selection: true,
layout_name: 'global_PayStubAccount',
show_search_inputs: true,
set_empty: true,
field: 'box_3_include_pay_stub_entry_account'
} );
form_item = this.putInputToInsideFormItem( form_item_input, $.i18n._( 'Include' ) );
v_box.append( form_item );
v_box.append( '<div class=\'clear-both-div\'></div>' );
//Exclude
form_item_input_1 = Global.loadWidgetByName( FormItemType.AWESOME_BOX );
form_item_input_1.AComboBox( {
api_class: TTAPI.APIPayStubEntryAccount,
allow_multiple_selection: true,
layout_name: 'global_PayStubAccount',
show_search_inputs: true,
set_empty: true,
field: 'box_3_exclude_pay_stub_entry_account'
} );
form_item = this.putInputToInsideFormItem( form_item_input_1, $.i18n._( 'Exclude' ) );
v_box.append( form_item );
custom_label_widget = $( '<div class=\'h-box\'></div>' );
label = $( '<span class="edit-view-form-item-label"></span>' );
box = Global.loadWidgetByName( FormItemType.TEXT_INPUT );
box.TTextInput( { field: 'box_3_box', width: 50 } );
box.css( 'float', 'right' );
box.bind( 'formItemChange', function( e, target ) {
$this.onFormItemChange( target );
} );
label.text( $.i18n._( 'Box' ) );
this.edit_view_ui_dic[box.getField()] = box;
custom_label_widget.append( box );
custom_label_widget.append( label );
this.addEditFieldToColumn( $.i18n._( 'Box' ), [form_item_input, form_item_input_1], tab3_column1, '', v_box, false, true, false, false, custom_label_widget );
//Box [4]
v_box = $( '<div class=\'v-box\'></div>' );
//Include
form_item_input = Global.loadWidgetByName( FormItemType.AWESOME_BOX );
form_item_input.AComboBox( {
api_class: TTAPI.APIPayStubEntryAccount,
allow_multiple_selection: true,
layout_name: 'global_PayStubAccount',
show_search_inputs: true,
set_empty: true,
field: 'box_4_include_pay_stub_entry_account'
} );
form_item = this.putInputToInsideFormItem( form_item_input, $.i18n._( 'Include' ) );
v_box.append( form_item );
v_box.append( '<div class=\'clear-both-div\'></div>' );
//Exclude
form_item_input_1 = Global.loadWidgetByName( FormItemType.AWESOME_BOX );
form_item_input_1.AComboBox( {
api_class: TTAPI.APIPayStubEntryAccount,
allow_multiple_selection: true,
layout_name: 'global_PayStubAccount',
show_search_inputs: true,
set_empty: true,
field: 'box_4_exclude_pay_stub_entry_account'
} );
form_item = this.putInputToInsideFormItem( form_item_input_1, $.i18n._( 'Exclude' ) );
v_box.append( form_item );
custom_label_widget = $( '<div class=\'h-box\'></div>' );
label = $( '<span class="edit-view-form-item-label"></span>' );
box = Global.loadWidgetByName( FormItemType.TEXT_INPUT );
box.TTextInput( { field: 'box_4_box', width: 50 } );
box.css( 'float', 'right' );
box.bind( 'formItemChange', function( e, target ) {
$this.onFormItemChange( target );
} );
label.text( $.i18n._( 'Box' ) );
this.edit_view_ui_dic[box.getField()] = box;
custom_label_widget.append( box );
custom_label_widget.append( label );
this.addEditFieldToColumn( $.i18n._( 'Box' ), [form_item_input, form_item_input_1], tab3_column1, '', v_box, false, true, false, false, custom_label_widget );
//Box [5]
v_box = $( '<div class=\'v-box\'></div>' );
//Include
form_item_input = Global.loadWidgetByName( FormItemType.AWESOME_BOX );
form_item_input.AComboBox( {
api_class: TTAPI.APIPayStubEntryAccount,
allow_multiple_selection: true,
layout_name: 'global_PayStubAccount',
show_search_inputs: true,
set_empty: true,
field: 'box_5_include_pay_stub_entry_account'
} );
form_item = this.putInputToInsideFormItem( form_item_input, $.i18n._( 'Include' ) );
v_box.append( form_item );
v_box.append( '<div class=\'clear-both-div\'></div>' );
//Exclude
form_item_input_1 = Global.loadWidgetByName( FormItemType.AWESOME_BOX );
form_item_input_1.AComboBox( {
api_class: TTAPI.APIPayStubEntryAccount,
allow_multiple_selection: true,
layout_name: 'global_PayStubAccount',
show_search_inputs: true,
set_empty: true,
field: 'box_5_exclude_pay_stub_entry_account'
} );
form_item = this.putInputToInsideFormItem( form_item_input_1, $.i18n._( 'Exclude' ) );
v_box.append( form_item );
custom_label_widget = $( '<div class=\'h-box\'></div>' );
label = $( '<span class="edit-view-form-item-label"></span>' );
box = Global.loadWidgetByName( FormItemType.TEXT_INPUT );
box.TTextInput( { field: 'box_5_box', width: 50 } );
box.css( 'float', 'right' );
box.bind( 'formItemChange', function( e, target ) {
$this.onFormItemChange( target );
} );
label.text( $.i18n._( 'Box' ) );
this.edit_view_ui_dic[box.getField()] = box;
custom_label_widget.append( box );
custom_label_widget.append( label );
this.addEditFieldToColumn( $.i18n._( 'Box' ), [form_item_input, form_item_input_1], tab3_column1, '', v_box, false, true, false, false, custom_label_widget );
//Remittances Paid in Year
form_item_input = Global.loadWidgetByName( FormItemType.TEXT_INPUT );
form_item_input.TTextInput( { field: 'remittances_paid', width: 120 } );
this.addEditFieldToColumn( $.i18n._( 'Remittances Paid in Year' ), form_item_input, tab3_column1 );
}
getFormSetupData() {
var other = {};
other.income = {
include_pay_stub_entry_account: this.current_edit_record.income_include_pay_stub_entry_account,
exclude_pay_stub_entry_account: this.current_edit_record.income_exclude_pay_stub_entry_account
};
other.tax = {
include_pay_stub_entry_account: this.current_edit_record.tax_include_pay_stub_entry_account,
exclude_pay_stub_entry_account: this.current_edit_record.tax_exclude_pay_stub_entry_account
};
other.employee_cpp = {
include_pay_stub_entry_account: this.current_edit_record.employee_cpp_include_pay_stub_entry_account,
exclude_pay_stub_entry_account: this.current_edit_record.employee_cpp_exclude_pay_stub_entry_account
};
other.employer_cpp = {
include_pay_stub_entry_account: this.current_edit_record.employer_cpp_include_pay_stub_entry_account,
exclude_pay_stub_entry_account: this.current_edit_record.employer_cpp_exclude_pay_stub_entry_account
};
other.employee_ei = {
include_pay_stub_entry_account: this.current_edit_record.employee_ei_include_pay_stub_entry_account,
exclude_pay_stub_entry_account: this.current_edit_record.employee_ei_exclude_pay_stub_entry_account
};
other.employer_ei = {
include_pay_stub_entry_account: this.current_edit_record.employer_ei_include_pay_stub_entry_account,
exclude_pay_stub_entry_account: this.current_edit_record.employer_ei_exclude_pay_stub_entry_account
};
other.ei_earnings = {
include_pay_stub_entry_account: this.current_edit_record.ei_earnings_include_pay_stub_entry_account,
exclude_pay_stub_entry_account: this.current_edit_record.ei_earnings_exclude_pay_stub_entry_account
};
other.cpp_earnings = {
include_pay_stub_entry_account: this.current_edit_record.cpp_earnings_include_pay_stub_entry_account,
exclude_pay_stub_entry_account: this.current_edit_record.cpp_earnings_exclude_pay_stub_entry_account
};
other.union_dues = {
include_pay_stub_entry_account: this.current_edit_record.union_dues_include_pay_stub_entry_account,
exclude_pay_stub_entry_account: this.current_edit_record.union_dues_exclude_pay_stub_entry_account
};
other.rpp = {
include_pay_stub_entry_account: this.current_edit_record.rpp_include_pay_stub_entry_account,
exclude_pay_stub_entry_account: this.current_edit_record.rpp_exclude_pay_stub_entry_account
};
other.charity = {
include_pay_stub_entry_account: this.current_edit_record.charity_include_pay_stub_entry_account,
exclude_pay_stub_entry_account: this.current_edit_record.charity_exclude_pay_stub_entry_account
};
other.pension_adjustment = {
include_pay_stub_entry_account: this.current_edit_record.pension_adjustment_include_pay_stub_entry_account,
exclude_pay_stub_entry_account: this.current_edit_record.pension_adjustment_exclude_pay_stub_entry_account
};
other.other_box = [];
other.other_box.push( {
box: this.current_edit_record.box_0_box,
include_pay_stub_entry_account: this.current_edit_record.box_0_include_pay_stub_entry_account,
exclude_pay_stub_entry_account: this.current_edit_record.box_0_exclude_pay_stub_entry_account
} );
other.other_box.push( {
box: this.current_edit_record.box_1_box,
include_pay_stub_entry_account: this.current_edit_record.box_1_include_pay_stub_entry_account,
exclude_pay_stub_entry_account: this.current_edit_record.box_1_exclude_pay_stub_entry_account
} );
other.other_box.push( {
box: this.current_edit_record.box_2_box,
include_pay_stub_entry_account: this.current_edit_record.box_2_include_pay_stub_entry_account,
exclude_pay_stub_entry_account: this.current_edit_record.box_2_exclude_pay_stub_entry_account
} );
other.other_box.push( {
box: this.current_edit_record.box_3_box,
include_pay_stub_entry_account: this.current_edit_record.box_3_include_pay_stub_entry_account,
exclude_pay_stub_entry_account: this.current_edit_record.box_3_exclude_pay_stub_entry_account
} );
other.other_box.push( {
box: this.current_edit_record.box_4_box,
include_pay_stub_entry_account: this.current_edit_record.box_4_include_pay_stub_entry_account,
exclude_pay_stub_entry_account: this.current_edit_record.box_4_exclude_pay_stub_entry_account
} );
other.other_box.push( {
box: this.current_edit_record.box_5_box,
include_pay_stub_entry_account: this.current_edit_record.box_5_include_pay_stub_entry_account,
exclude_pay_stub_entry_account: this.current_edit_record.box_5_exclude_pay_stub_entry_account
} );
other.rpp_number = this.current_edit_record.rpp_number;
other.status_id = this.current_edit_record.status_id;
other.remittances_paid = this.current_edit_record.remittances_paid;
return other;
}
/* jshint ignore:start */
setFormSetupData( res_data ) {
if ( !res_data ) {
this.show_empty_message = true;
} else {
let batch_get_real_data = this.processFormSetupDataAndAddToBatch( res_data, [
{ data: _.get(res_data, 'income'), field_key: 'income', api: this.api_paystub, api_method: 'getPayStubEntryAccount' },
{ data: _.get(res_data, 'tax'), field_key: 'tax', nested: true, api: this.api_paystub, api_method: 'getPayStubEntryAccount' },
{ data: _.get(res_data, 'employee_cpp'), field_key:'employee_cpp', api: this.api_paystub, api_method: 'getPayStubEntryAccount' },
{ data: _.get(res_data, 'employer_cpp'), field_key:'employer_cpp', api: this.api_paystub, api_method: 'getPayStubEntryAccount' },
{ data: _.get(res_data, 'employee_ei'), field_key:'employee_ei', api: this.api_paystub, api_method: 'getPayStubEntryAccount' },
{ data: _.get(res_data, 'employer_ei'), field_key:'employer_ei', api: this.api_paystub, api_method: 'getPayStubEntryAccount' },
{ data: _.get(res_data, 'ei_earnings'), field_key:'ei_earnings', api: this.api_paystub, api_method: 'getPayStubEntryAccount' },
{ data: _.get(res_data, 'cpp_earnings'), field_key:'cpp_earnings', api: this.api_paystub, api_method: 'getPayStubEntryAccount' },
{ data: _.get(res_data, 'union_dues'), field_key:'union_dues', api: this.api_paystub, api_method: 'getPayStubEntryAccount' },
{ data: _.get(res_data, 'rpp'), field_key:'rpp', api: this.api_paystub, api_method: 'getPayStubEntryAccount' },
{ data: _.get(res_data, 'charity'), field_key:'charity', api: this.api_paystub, api_method: 'getPayStubEntryAccount' },
{ data: _.get(res_data, 'pension_adjustment'), field_key:'pension_adjustment', api: this.api_paystub, api_method: 'getPayStubEntryAccount' },
{ data: _.get(res_data, 'rpp_number'), field_key:'rpp_number', api: null },
{ data: _.get(res_data, 'status_id'), field_key:'status_id', api: null },
{ data: _.get(res_data, 'remittances_paid'), field_key:'remittances_paid', api: null },
{ data: _.get(res_data, ['other_box', 0 ]), field_key: 'box_0', api: this.api_paystub, api_method: 'getPayStubEntryAccount' },
{ data: _.get(res_data, ['other_box', 1 ]), field_key: 'box_1', api: this.api_paystub, api_method: 'getPayStubEntryAccount' },
{ data: _.get(res_data, ['other_box', 2 ]), field_key: 'box_2', api: this.api_paystub, api_method: 'getPayStubEntryAccount' },
{ data: _.get(res_data, ['other_box', 3 ]), field_key: 'box_3', api: this.api_paystub, api_method: 'getPayStubEntryAccount' },
{ data: _.get(res_data, ['other_box', 4 ]), field_key: 'box_4', api: this.api_paystub, api_method: 'getPayStubEntryAccount' },
{ data: _.get(res_data, ['other_box', 5 ]), field_key: 'box_5', api: this.api_paystub, api_method: 'getPayStubEntryAccount' },
] );
this.getBatchedRealFormDataFromAPI( batch_get_real_data );
}
}
/* jshint ignore:end */
}