TimeTrex Community Edition v16.2.0
This commit is contained in:
@ -0,0 +1,290 @@
|
||||
import { Wizard } from '@/global/widgets/wizard/Wizard';
|
||||
|
||||
export class PayrollRemittanceAgencyEventWizard extends Wizard {
|
||||
constructor( options = {} ) {
|
||||
_.defaults( options, {
|
||||
current_step: false,
|
||||
wizard_name: $.i18n._( 'Tax Wizard' ),
|
||||
|
||||
selected_remittance_agency_event: null,
|
||||
selected_remittance_agency_event_id: null,
|
||||
payroll_remittance_agency_event_block: null,
|
||||
|
||||
wizard_id: 'PayrollRemittanceAgencyEventWizardController',
|
||||
_step_map: {
|
||||
'home': { // TODO: Webpack: Investigate how this works/does not work with Webpack
|
||||
script_path: 'views/payroll/remittance_wizard/PayrollRemittanceAgencyEventWizardStepHome.js',
|
||||
object_name: 'PayrollRemittanceAgencyEventWizardStepHome'
|
||||
},
|
||||
'review': {
|
||||
script_path: 'views/payroll/remittance_wizard/PayrollRemittanceAgencyEventWizardStepReview.js',
|
||||
object_name: 'PayrollRemittanceAgencyEventWizardStepReview'
|
||||
},
|
||||
'submit': {
|
||||
script_path: 'views/payroll/remittance_wizard/PayrollRemittanceAgencyEventWizardStepSubmit.js',
|
||||
object_name: 'PayrollRemittanceAgencyEventWizardStepSubmit'
|
||||
},
|
||||
'publish': {
|
||||
script_path: 'views/payroll/remittance_wizard/PayrollRemittanceAgencyEventWizardStepPublish.js',
|
||||
object_name: 'PayrollRemittanceAgencyEventWizardStepPublish'
|
||||
}
|
||||
}
|
||||
|
||||
} );
|
||||
|
||||
super( options );
|
||||
}
|
||||
|
||||
init() {
|
||||
var $this = this;
|
||||
}
|
||||
|
||||
render() {
|
||||
//do render stuff
|
||||
}
|
||||
|
||||
onNextClick( e ) {
|
||||
//Get selected row data so we can determine the time period.
|
||||
if ( this.getStepObject().grid ) {
|
||||
var row_data = this.getStepObject().grid.getRowData( this.getStepObject().grid.getSelectedRow() );
|
||||
|
||||
if ( row_data['in_time_period'] && row_data['in_time_period'] == true ) {
|
||||
TAlertManager.showConfirmAlert( $.i18n._( 'Time period for this event has not ended yet, are you sure you want to process this event early?' ), null, ( flag ) => {
|
||||
if ( flag === true ) {
|
||||
super.onNextClick( e );
|
||||
}
|
||||
} );
|
||||
} else {
|
||||
super.onNextClick( e );
|
||||
}
|
||||
} else {
|
||||
super.onNextClick( e );
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* builds the event data block used on several steps in this wizard.
|
||||
* @param container_id
|
||||
* @param data
|
||||
*/
|
||||
buildEventDataBlock( container_id, data ) {
|
||||
$( '#' + container_id ).remove(); //never allow this to duplicate on the wizard.
|
||||
var div = $( '<div id=\'' + container_id + '\' class=\'payroll_remittance_agency_event_wizard_event_details\'><table></table></div>' );
|
||||
var step_obj = this.getStepObject( this.getCurrentStepName() );
|
||||
step_obj.append( div );
|
||||
|
||||
var even = false;
|
||||
var td_label, td_value;
|
||||
|
||||
if ( this.payroll_remittance_agency_event_block == null ) {
|
||||
|
||||
var column_one_keys = [
|
||||
{ key: 'legal_entity_legal_name', title: $.i18n._( 'Legal Entity' ) },
|
||||
{ key: 'payroll_remittance_agency_name', title: $.i18n._( 'Agency' ) },
|
||||
{ key: 'type', title: $.i18n._( 'Event' ) }
|
||||
];
|
||||
|
||||
var column_two_keys = [
|
||||
{ key: 'frequency', title: $.i18n._( 'Frequency' ) },
|
||||
{ key: 'time_period', title: $.i18n._( 'Time Period' ) },
|
||||
{ key: 'due_date_display', title: $.i18n._( 'Due Date' ) }
|
||||
];
|
||||
|
||||
var upper_bound = ( column_one_keys.length > column_two_keys.length ) ? column_one_keys.length : column_two_keys.length;
|
||||
|
||||
for ( var i = 0; i < upper_bound; i++ ) {
|
||||
var tr = $( '<tr></tr>' );
|
||||
|
||||
if ( column_one_keys.length > i ) {
|
||||
var label = $( '<td class="label col1"></td>' );
|
||||
label.text( column_one_keys[i].title );
|
||||
|
||||
var value = $( '<td class="value"></td>' );
|
||||
value.text( data[column_one_keys[i].key] );
|
||||
|
||||
tr.append( label );
|
||||
tr.append( value );
|
||||
} else {
|
||||
tr.append( $( '<td></td>' ) );
|
||||
tr.append( $( '<td></td>' ) );
|
||||
}
|
||||
|
||||
if ( column_two_keys.length > i ) {
|
||||
var label = $( '<td class="label col2"></td>' );
|
||||
label.text( column_two_keys[i].title );
|
||||
|
||||
var value = $( '<td class="value"></td>' );
|
||||
if ( column_two_keys[i].key == 'time_period' ) {
|
||||
value.text( data.start_date_display + ' - ' + data.end_date_display );
|
||||
} else {
|
||||
value.text( data[column_two_keys[i].key] );
|
||||
}
|
||||
|
||||
tr.append( label );
|
||||
tr.append( value );
|
||||
} else {
|
||||
|
||||
tr.append( $( '<td></td>' ) );
|
||||
tr.append( $( '<td></td>' ) );
|
||||
}
|
||||
|
||||
$( '#' + container_id + ' table' ).append( tr );
|
||||
}
|
||||
|
||||
//Show warning if still inside time period.
|
||||
if ( data['in_time_period'] && data['in_time_period'] == true ) {
|
||||
var tr = $( '<tr></tr>' );
|
||||
|
||||
var row_contents = $( '<td align="center" style="font-weight: bold; color: red;" colspan="4"></td>' );
|
||||
row_contents.html( $.i18n._( 'WARNING: Time period has not ended yet, you may be processing early.' ) );
|
||||
|
||||
tr.append( row_contents );
|
||||
|
||||
$( '#' + container_id + ' table' ).append( tr );
|
||||
}
|
||||
|
||||
//Show warning if still inside time period.
|
||||
if ( data['is_split_time_period'] && data['is_split_time_period'] == true ) {
|
||||
var tr = $( '<tr></tr>' );
|
||||
|
||||
var row_contents = $( '<td align="center" style="font-weight: bold; color: red;" colspan="4"></td>' );
|
||||
row_contents.html( $.i18n._( 'NOTICE: Time Period has been split into two, due to crossing into a new quarter.<br>This event will now need to be processed twice, once for each part of the time period.' ) );
|
||||
|
||||
tr.append( row_contents );
|
||||
|
||||
$( '#' + container_id + ' table' ).append( tr );
|
||||
}
|
||||
|
||||
this.payroll_remittance_agency_event_block = $( '#' + container_id + ' table' ).html();
|
||||
} else {
|
||||
$( '#' + container_id + ' table' ).html( this.payroll_remittance_agency_event_block );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* both args required.
|
||||
* @param id
|
||||
* @param callback
|
||||
*/
|
||||
getPayrollRemittanceAgencyEventById( id, columns, callback ) {
|
||||
//Stright to the callback if nothing has changed. if ( this.selected_remittance_agency_event.id != id) {
|
||||
if ( typeof callback == 'function' && this.selected_remittance_agency_event && this.selected_remittance_agency_event.id == id ) {
|
||||
callback( this.selected_remittance_agency_event );
|
||||
} else {
|
||||
var filter = {
|
||||
filter_data: {
|
||||
id: this.selected_remittance_agency_event_id
|
||||
}
|
||||
};
|
||||
|
||||
if ( columns == null || typeof columns == 'undefined' ) {
|
||||
filter.filter_columns = {
|
||||
'payroll_remittance_agency_id': true,
|
||||
'legal_entity_legal_name': true,
|
||||
'payroll_remittance_agency_name': true,
|
||||
'user_report_data_id': true,
|
||||
'status': true,
|
||||
'status_id': true,
|
||||
'type': true,
|
||||
'type_id': true,
|
||||
'frequency': true,
|
||||
'start_date_display': true,
|
||||
'end_date_display': true,
|
||||
'due_date_display': true,
|
||||
'in_time_period': true,
|
||||
'is_split_time_period': true,
|
||||
'event_data': true,
|
||||
};
|
||||
} else {
|
||||
filter.columns = columns;
|
||||
}
|
||||
var $this = this;
|
||||
var api_payroll_remittance_agency_event = TTAPI.APIPayrollRemittanceAgencyEvent;
|
||||
api_payroll_remittance_agency_event.getPayrollRemittanceAgencyEvent( filter, {
|
||||
onResult: function( event_result ) {
|
||||
var event_result = event_result.getResult()[0];
|
||||
|
||||
var api_payroll_remittance_agency = TTAPI.APIPayrollRemittanceAgency;
|
||||
api_payroll_remittance_agency.getPayrollRemittanceAgency( { filter_data: { id: event_result.payroll_remittance_agency_id } }, {
|
||||
onResult: function( agency_result ) {
|
||||
event_result.payroll_remittance_agency_obj = agency_result.getResult()[0]; //Merge Event and Agency data together.
|
||||
|
||||
if ( typeof callback == 'function' ) {
|
||||
callback( event_result );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
} );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows us to open reports to give us access to their context menu code from within wizards.
|
||||
*
|
||||
* @param report_type
|
||||
* @param report_obj
|
||||
* @param callback
|
||||
*/
|
||||
getReport( render_type, post_data ) {
|
||||
if ( !post_data ) {
|
||||
post_data = {
|
||||
0: this.selected_remittance_agency_event_id,
|
||||
1: render_type
|
||||
};
|
||||
}
|
||||
Global.APIFileDownload( 'APIPayrollRemittanceAgencyEvent', 'getReportData', post_data );
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays html report. Does not close wizard, but leaves it up in the background.
|
||||
* @param report_name
|
||||
* @param post_data
|
||||
*/
|
||||
showHTMLReport( report_name, new_window ) {
|
||||
ProgressBar.showOverlay();
|
||||
var api = TTAPI.APIPayrollRemittanceAgencyEvent;
|
||||
api['getReportData']( this.selected_remittance_agency_event_id, 'html', {
|
||||
onResult: function( res ) {
|
||||
ProgressBar.closeOverlay();
|
||||
|
||||
if ( res.isValid() ) {
|
||||
var result = res.getResult();
|
||||
if ( new_window ) {
|
||||
var w = window.open();
|
||||
w.document.writeln( result.api_retval );
|
||||
w.document.close();
|
||||
} else if ( result ) {
|
||||
IndexViewController.openWizard( 'ReportViewWizard', result.api_retval );
|
||||
}
|
||||
} else {
|
||||
TAlertManager.showErrorAlert( res );
|
||||
}
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param e
|
||||
*/
|
||||
onDoneComplete( e ) {
|
||||
var $this = this;
|
||||
this.getPayrollRemittanceAgencyEventById( this.selected_remittance_agency_event_id, {}, function( result ) {
|
||||
if ( result ) {
|
||||
result.enable_recalculate_dates = 1;
|
||||
result.last_due_date = result.due_date;
|
||||
|
||||
var api_payroll_remittance_agency_event = TTAPI.APIPayrollRemittanceAgencyEvent;
|
||||
api_payroll_remittance_agency_event.setPayrollRemittanceAgencyEvent( result, false, true, {
|
||||
onResult: function( result ) {
|
||||
$this.cleanUp();
|
||||
}
|
||||
} );
|
||||
}
|
||||
} );
|
||||
}
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
<script>
|
||||
var payroll_remittance_agency_event_wizard_controller = new PayrollRemittanceAgencyEventWizardController();
|
||||
</script>
|
||||
<div class="wizard-bg tax_wizard">
|
||||
<div class="wizard-overlay"></div>
|
||||
<div class="wizard">
|
||||
<span class="title">Tax Wizard</span>
|
||||
<div class="progress-bar">
|
||||
<div class="title-1-div">
|
||||
<div class="logo"></div>
|
||||
<span class="title-1">Tax Wizard</span>
|
||||
</div>
|
||||
<div class="clear-both-div"></div>
|
||||
<!--
|
||||
<progress class="progress" max="10" value="0">
|
||||
</progress>
|
||||
<span class="steps"></span>
|
||||
-->
|
||||
</div>
|
||||
<div class="content">
|
||||
</div>
|
||||
<div class="bottom-actions" id="cards">
|
||||
</div>
|
||||
<div class="bottom-actions">
|
||||
<div class="move-buttons-div">
|
||||
<button class="back-btn disable-image" id="wizard-back-button"></button>
|
||||
<button class="forward-btn disable-image" id="wizard-forward-button"></button>
|
||||
</div>
|
||||
<div class="confirm-buttons-div">
|
||||
<button class="done-btn disable-image" id="wizard-done-button"></button>
|
||||
<button class="close-btn" id="wizard-close-button"></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@ -0,0 +1,34 @@
|
||||
import { PayrollRemittanceAgencyEventWizard } from './PayrollRemittanceAgencyEventWizard';
|
||||
|
||||
export class PayrollRemittanceAgencyEventWizardController extends BaseWindowController {
|
||||
constructor( options = {} ) {
|
||||
_.defaults( options, {
|
||||
el: '.wizard-bg',
|
||||
|
||||
wizard_obj: null
|
||||
} );
|
||||
|
||||
super( options );
|
||||
}
|
||||
|
||||
init() {
|
||||
var wizard_id = 'PayrollRemittanceAgencyEventWizardController';
|
||||
//LocalCacheData[this.wizard_id] is set when the wizard is minimized due to external navigation
|
||||
if ( !this.wizard_obj && LocalCacheData[wizard_id] ) {
|
||||
this.wizard_obj = LocalCacheData[wizard_id];
|
||||
this.wizard_obj.remove();
|
||||
this.wizard_obj.getStepObject().initialize( this.wizard_obj );
|
||||
this.wizard_obj.init();
|
||||
this.wizard_obj.setElement( $( '.tax_wizard' ) );
|
||||
delete LocalCacheData[wizard_id];
|
||||
} else {
|
||||
//this.wizard_obj = new ( window[wizard_id] )( { el: $( '.tax_wizard' ) } );
|
||||
this.wizard_obj = new PayrollRemittanceAgencyEventWizard( { el: $( '.tax_wizard' ) } );
|
||||
}
|
||||
}
|
||||
|
||||
// getRequiredFiles() {
|
||||
// return ['Wizard', 'WizardStep', 'views/payroll/remittance_wizard/PayrollRemittanceAgencyEventWizard.js'];
|
||||
// }
|
||||
|
||||
}
|
@ -0,0 +1,209 @@
|
||||
import { WizardStep } from '@/global/widgets/wizard/WizardStep';
|
||||
|
||||
export class PayrollRemittanceAgencyEventWizardStepHome extends WizardStep {
|
||||
constructor( options = {} ) {
|
||||
_.defaults( options, {
|
||||
name: 'home',
|
||||
|
||||
prae_grid_source_data: null,
|
||||
grid: null,
|
||||
|
||||
el: $( '.wizard.process_transactions_wizard' )
|
||||
} );
|
||||
|
||||
super( options );
|
||||
}
|
||||
|
||||
init() {
|
||||
var filter_data = {
|
||||
filter_data: {
|
||||
'status_id': [10, 15], //10=Enabled (Self Service) 15=Enabled (Full Service)
|
||||
'payroll_remittance_agency_status_id': 10, //Enabled
|
||||
'start_date': ( ( new Date() / 1000 ) + ( 86400 * 14 ) ) //Move start date into the future by 14 days so per Pay Period frequencies will still appear well in advance.
|
||||
},
|
||||
filter_columns: {
|
||||
'id': true,
|
||||
'payroll_remittance_agency_id': true,
|
||||
'legal_entity_legal_name': true,
|
||||
'payroll_remittance_agency_name': true,
|
||||
'type': true,
|
||||
'type_id': true,
|
||||
'start_date_display': true,
|
||||
'end_date_display': true,
|
||||
'due_date_display': true,
|
||||
'in_time_period': true,
|
||||
'is_split_time_period': true,
|
||||
},
|
||||
'filter_sort': {
|
||||
'status_id': 'desc',
|
||||
'due_date': 'asc',
|
||||
'legal_entity_id': 'asc',
|
||||
'payroll_remittance_agency_id': 'asc',
|
||||
'type_id': 'asc'
|
||||
}
|
||||
};
|
||||
|
||||
var $this = this;
|
||||
|
||||
var api_payroll_remittance_agency_event = TTAPI.APIPayrollRemittanceAgencyEvent;
|
||||
|
||||
api_payroll_remittance_agency_event.getPayrollRemittanceAgencyEvent( filter_data, {
|
||||
onResult: function( result ) {
|
||||
$this.prae_grid_source_data = result.getResult();
|
||||
$this.render();
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
getNextStepName() {
|
||||
//Must have a selected row in home step grid to enable the next button.
|
||||
if ( TTUUID.isUUID( this.getWizardObject().selected_remittance_agency_event_id ) ) {
|
||||
return 'review';
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
_render() {
|
||||
this.setTitle( this.getWizardObject().wizard_name );
|
||||
if ( this.prae_grid_source_data.length > 0 ) {
|
||||
var $this = this;
|
||||
this.setInstructions( $.i18n._( 'Select one of the event(s) below to process' ) + ': ', function() {
|
||||
var grid_id = 'payroll_remittance_agency_events';
|
||||
var grid_div = $( '<div class=\'grid-div wizard-grid-div\'></div>' );
|
||||
var grid_table = $( '<table id=\'' + grid_id + '\'></table>' );
|
||||
grid_div.append( grid_table );
|
||||
|
||||
if ( !$this.grid ) {
|
||||
$this.grid = $this.setGrid( grid_id, grid_div );
|
||||
$this.grid.setData( $this.prae_grid_source_data );
|
||||
}
|
||||
$this.colorGrid();
|
||||
|
||||
$this.setGridAutoHeight( $this.grid, $this.prae_grid_source_data.length );
|
||||
|
||||
if ( TTUUID.isUUID( $this.getWizardObject().selected_remittance_agency_event_id ) ) {
|
||||
$this.grid.grid.setSelection( $this.getWizardObject().selected_remittance_agency_event_id );
|
||||
} else {
|
||||
//select the first row on load.
|
||||
$this.grid.grid.setSelection( $this.grid.grid.find( 'tbody:first-child tr:nth-child(2)' ).attr( 'id' ) );
|
||||
$this.getWizardObject().selected_remittance_agency_event_id = $this.grid.grid.find( 'tbody:first-child tr:nth-child(2)' ).attr( 'id' );
|
||||
}
|
||||
|
||||
$this.addButton( 'PayrollRemittanceAgency',
|
||||
'view_detail-35x35.png',
|
||||
$.i18n._( 'Edit Remittance Agency' ),
|
||||
$.i18n._( 'In the event of incorrect dates, edit the selected remittance agency and its events to make corrections.' )
|
||||
);
|
||||
} );
|
||||
|
||||
} else {
|
||||
var message = $( '<div></div>' );
|
||||
message.html( $.i18n._( 'There are no outstanding tax events at this time.' ) );
|
||||
this.append( message );
|
||||
}
|
||||
|
||||
//If the wizard is closed, it reopens to the home step and must be told what the current step is.
|
||||
this.getWizardObject().setCurrentStepName( 'home' );
|
||||
}
|
||||
|
||||
colorGrid() {
|
||||
var data = this.grid.getData();
|
||||
//Error: TypeError: data is undefined in /interface/html5/framework/jquery.min.js?v=7.4.6-20141027-074127 line 2 > eval line 70
|
||||
if ( !data ) {
|
||||
return;
|
||||
}
|
||||
|
||||
var len = data.length;
|
||||
|
||||
for ( var i = 0; i < len; i++ ) {
|
||||
var item = data[i];
|
||||
|
||||
if ( item.in_time_period == true ) {
|
||||
$( '#' + this.grid.ui_id ).find( 'tr[id=\'' + item.id + '\']' ).css( 'color', '#ccc' );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
_onNavigationClick( icon ) {
|
||||
switch ( icon ) {
|
||||
case 'PayrollRemittanceAgency':
|
||||
this.getWizardObject().minimize();
|
||||
|
||||
var grid_data = this.grid.getData();
|
||||
var grid_indecies = this.grid.grid.jqGrid( 'getGridParam', '_index' );
|
||||
var remittance_agency_event = grid_data[grid_indecies [this.getWizardObject().selected_remittance_agency_event_id]];
|
||||
|
||||
IndexViewController.openEditView( LocalCacheData.current_open_primary_controller, 'PayrollRemittanceAgency', remittance_agency_event.payroll_remittance_agency_id );
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
getGridColumns( gridId, callBack ) {
|
||||
var column_info_array = [
|
||||
{
|
||||
name: 'legal_entity_legal_name',
|
||||
index: 'legal_entity_legal_name',
|
||||
label: $.i18n._( 'Legal Entity' ),
|
||||
width: 90,
|
||||
sortable: true,
|
||||
title: false
|
||||
},
|
||||
{
|
||||
name: 'payroll_remittance_agency_name',
|
||||
index: 'payroll_remittance_agency_name',
|
||||
label: $.i18n._( 'Agency' ),
|
||||
width: 200,
|
||||
sortable: true,
|
||||
title: false
|
||||
},
|
||||
{
|
||||
name: 'type',
|
||||
index: 'type',
|
||||
label: $.i18n._( 'Event' ),
|
||||
width: 100,
|
||||
sortable: true,
|
||||
title: false
|
||||
},
|
||||
{
|
||||
name: 'start_date_display',
|
||||
index: 'start_date_display',
|
||||
label: $.i18n._( 'Start Date' ),
|
||||
width: 60,
|
||||
sortable: true,
|
||||
title: false
|
||||
},
|
||||
{
|
||||
name: 'end_date_display',
|
||||
index: 'end_date_display',
|
||||
label: $.i18n._( 'End Date' ),
|
||||
width: 60,
|
||||
sortable: true,
|
||||
title: false
|
||||
},
|
||||
{
|
||||
name: 'due_date_display',
|
||||
index: 'due_date_display',
|
||||
label: $.i18n._( 'Due Date' ),
|
||||
width: 60,
|
||||
sortable: true,
|
||||
title: false
|
||||
}
|
||||
];
|
||||
|
||||
return column_info_array;
|
||||
}
|
||||
|
||||
onGridSelectRow( selected_id ) {
|
||||
if ( this.getWizardObject().selected_remittance_agency_event_id != selected_id ) {
|
||||
this.getWizardObject().selected_remittance_agency_event_id = selected_id;
|
||||
|
||||
this.getWizardObject().reload();
|
||||
this.getWizardObject().payroll_remittance_agency_event_block = null;
|
||||
|
||||
}
|
||||
this.getWizardObject().enableButtons();
|
||||
}
|
||||
}
|
@ -0,0 +1,183 @@
|
||||
import { WizardStep } from '@/global/widgets/wizard/WizardStep';
|
||||
|
||||
export class PayrollRemittanceAgencyEventWizardStepPublish extends WizardStep {
|
||||
constructor( options = {} ) {
|
||||
_.defaults( options, {
|
||||
name: 'publish',
|
||||
api: null,
|
||||
el: $( '.wizard.process_transactions_wizard' )
|
||||
} );
|
||||
|
||||
super( options );
|
||||
}
|
||||
|
||||
init() {
|
||||
this.api = TTAPI.APIPayrollRemittanceAgencyEvent;
|
||||
this.render();
|
||||
}
|
||||
|
||||
getPreviousStepName() {
|
||||
return 'submit';
|
||||
}
|
||||
|
||||
_render() {
|
||||
this.setTitle( $.i18n._( 'Publish Information for Employees' ) );
|
||||
this.setInstructions( $.i18n._( 'Publish forms for employees to access online' ) + ': ' );
|
||||
|
||||
var $this = this;
|
||||
this.getWizardObject().getPayrollRemittanceAgencyEventById( this.getWizardObject().selected_remittance_agency_event_id, null, function( result ) {
|
||||
$this.getWizardObject().selected_remittance_agency_event = result;
|
||||
$this.getWizardObject().buildEventDataBlock( 'payroll_remittance_agency_event_wizard-publish-event_details', result );
|
||||
$this.initCardsBlock();
|
||||
|
||||
switch ( $this.getWizardObject().selected_remittance_agency_event.type_id ) {
|
||||
//Canada
|
||||
case 'T4':
|
||||
$this.addButton( 'printIcon',
|
||||
'payroll_remittance_agency-35x35.png',
|
||||
$.i18n._( 'Publish' ),
|
||||
$.i18n._( 'Publish T4 forms for employees to access online with their own login under Payroll -> Government Documents.' )
|
||||
);
|
||||
|
||||
$this.addButton( 'EmployeeT4',
|
||||
'print-35x35.png',
|
||||
$.i18n._( 'Employee T4 Forms' ),
|
||||
$.i18n._( 'Print employee T4 forms for distribution to employees by hand or mail.' )
|
||||
);
|
||||
break;
|
||||
case 'T4A':
|
||||
$this.addButton( 'printIcon',
|
||||
'payroll_remittance_agency-35x35.png',
|
||||
$.i18n._( 'Publish' ),
|
||||
$.i18n._( 'Publish T4A forms for employees to access online with their own login under Payroll -> Government Documents.' )
|
||||
);
|
||||
|
||||
$this.addButton( 'EmployeeT4A',
|
||||
'print-35x35.png',
|
||||
$.i18n._( 'Employee T4A Forms' ),
|
||||
$.i18n._( 'Print employee T4A forms for distribution to employees by hand or mail.' )
|
||||
);
|
||||
break;
|
||||
|
||||
//US
|
||||
case 'FW2':
|
||||
$this.addButton( 'printIcon',
|
||||
'payroll_remittance_agency-35x35.png',
|
||||
$.i18n._( 'Publish' ),
|
||||
$.i18n._( 'Publish W2 forms for employees to access online with their own login under Payroll -> Government Documents.' )
|
||||
);
|
||||
|
||||
$this.addButton( 'EmployeeW2',
|
||||
'print-35x35.png',
|
||||
$.i18n._( 'Print employee W2 Forms' ) + ' (' + $.i18n._( 'Optional' ) + ') ',
|
||||
$.i18n._( 'Print employee W2 forms for distribution to employees by hand or mail.' )
|
||||
);
|
||||
break;
|
||||
case 'F1099NEC':
|
||||
$this.addButton( 'printIcon',
|
||||
'payroll_remittance_agency-35x35.png',
|
||||
$.i18n._( 'Publish' ),
|
||||
$.i18n._( 'Publish 1099-NEC forms for recipients to access online with their own login under Payroll -> Government Documents.' )
|
||||
);
|
||||
|
||||
$this.addButton( 'Employee1099Nec',
|
||||
'print-35x35.png',
|
||||
$.i18n._( 'Print employee 1099-NEC Forms' ) + ' (' + $.i18n._( 'Optional' ) + ') ',
|
||||
$.i18n._( 'Print employee 1099-NEC forms for distribution to recipients by hand or mail.' )
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
||||
$this.getWizardObject().enableButtons();
|
||||
} );
|
||||
}
|
||||
|
||||
_onNavigationClick( icon ) {
|
||||
var $this = this;
|
||||
switch ( this.getWizardObject().selected_remittance_agency_event.type_id ) {
|
||||
//Canada
|
||||
case 'T4':
|
||||
switch ( icon ) {
|
||||
case 'printIcon':
|
||||
this.getWizardObject().disableForCommunity( function() {
|
||||
$this.publishReportToEmployee();
|
||||
} );
|
||||
break;
|
||||
case 'EmployeeT4':
|
||||
Global.loadScript( 'views/reports/t4_summary/T4SummaryReportViewController', function() {
|
||||
$this.getWizardObject().getReport( 'pdf_form' );
|
||||
} );
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'T4A':
|
||||
switch ( icon ) {
|
||||
case 'printIcon':
|
||||
this.getWizardObject().disableForCommunity( function() {
|
||||
$this.publishReportToEmployee();
|
||||
} );
|
||||
break;
|
||||
case 'EmployeeT4A':
|
||||
Global.loadScript( 'views/reports/t4a_summary/T4ASummaryReportViewController', function() {
|
||||
$this.getWizardObject().getReport( 'pdf_form' );
|
||||
} );
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
//US
|
||||
case 'FW2':
|
||||
switch ( icon ) {
|
||||
case 'printIcon':
|
||||
this.getWizardObject().disableForCommunity( function() {
|
||||
$this.publishReportToEmployee();
|
||||
} );
|
||||
break;
|
||||
case 'EmployeeW2':
|
||||
Global.loadScript( 'views/reports/formw2/FormW2ReportViewController', function() {
|
||||
$this.getWizardObject().getReport( 'pdf_form' );
|
||||
} );
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'F1099NEC':
|
||||
switch ( icon ) {
|
||||
case 'printIcon':
|
||||
this.getWizardObject().disableForCommunity( function() {
|
||||
$this.publishReportToEmployee();
|
||||
} );
|
||||
|
||||
break;
|
||||
case 'Employee1099Nec':
|
||||
Global.loadScript( 'views/reports/form1099/Form1099NecReportViewController', function() {
|
||||
$this.getWizardObject().getReport( 'pdf_form' );
|
||||
} );
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
publishReportToEmployee() {
|
||||
this.api.getReportData( this.getWizardObject().selected_remittance_agency_event_id, 'pdf_form_publish_employee', {
|
||||
onResult: function( result ) {
|
||||
var retval = result.getResult();
|
||||
|
||||
if ( retval.api_retval ) {
|
||||
UserGenericStatusWindowController.open( retval.api_retval, LocalCacheData.getLoginUser().id, function() {
|
||||
} );
|
||||
} else {
|
||||
TAlertManager.showAlert( $.i18n._( 'No results found.' ), $.i18n._( 'Warning' ), function() {
|
||||
} );
|
||||
}
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
getPDFForm( scriptPath ) {
|
||||
Global.loadScript( scriptPath, function() {
|
||||
$this.getWizardObject().getReport( 'pdf_form' );
|
||||
} );
|
||||
}
|
||||
}
|
@ -0,0 +1,428 @@
|
||||
import { WizardStep } from '@/global/widgets/wizard/WizardStep';
|
||||
|
||||
export class PayrollRemittanceAgencyEventWizardStepReview extends WizardStep {
|
||||
constructor( options = {} ) {
|
||||
_.defaults( options, {
|
||||
name: 'review',
|
||||
api: null,
|
||||
|
||||
el: $( '.wizard.process_transactions_wizard' )
|
||||
} );
|
||||
|
||||
super( options );
|
||||
}
|
||||
|
||||
init() {
|
||||
this.api = TTAPI.APIPayrollRemittanceAgencyEvent;
|
||||
this.render();
|
||||
}
|
||||
|
||||
getPreviousStepName() {
|
||||
return 'home';
|
||||
}
|
||||
|
||||
getNextStepName() {
|
||||
return 'submit';
|
||||
}
|
||||
|
||||
_render() {
|
||||
this.setTitle( $.i18n._( 'Review and Verify Information' ) );
|
||||
this.setInstructions( $.i18n._( 'Review and verify all necessary information' ) + ': ' );
|
||||
|
||||
var $this = this;
|
||||
this.getWizardObject().getPayrollRemittanceAgencyEventById( this.getWizardObject().selected_remittance_agency_event_id, null, function( result ) {
|
||||
$this.getWizardObject().selected_remittance_agency_event = result;
|
||||
|
||||
$this.getWizardObject().buildEventDataBlock( 'payroll_remittance_agency_event_wizard-review-event_details', result );
|
||||
$this.initCardsBlock();
|
||||
|
||||
Debug.Text( 'Selected tax report type: ' + $this.getWizardObject().selected_remittance_agency_event.type_id, null, null, null, 10 );
|
||||
var tax_button = false;
|
||||
|
||||
switch ( $this.getWizardObject().selected_remittance_agency_event.type_id ) {
|
||||
//Canada
|
||||
case 'T4':
|
||||
tax_button = $this.addButton( 'taxReportsIcon',
|
||||
'tax_reports-35x35.png',
|
||||
$.i18n._( 'Summary Report' ),
|
||||
$.i18n._( 'View a summary report to quickly review and verify information for each employee.' )
|
||||
);
|
||||
|
||||
$this.addButton( 'GovernmentT4',
|
||||
'view_detail-35x35.png',
|
||||
$.i18n._( 'T4 Forms' ),
|
||||
$.i18n._( 'Generate T4 forms to review and verify that all necessary boxes are properly filled out.' )
|
||||
);
|
||||
|
||||
$this.addButton( 'T4FormSetup',
|
||||
'save_setup-35x35.png',
|
||||
$.i18n._( 'Form Setup' ) + ' (' + $.i18n._( 'Optional' ) + ')',
|
||||
$.i18n._( 'In the event that the T4 report or forms are not showing the correct information, use this Form Setup icon to make adjustments and try again.' )
|
||||
);
|
||||
break;
|
||||
case 'T4A':
|
||||
tax_button = $this.addButton( 'taxReportsIcon',
|
||||
'tax_reports-35x35.png',
|
||||
$.i18n._( 'Summary Report' ),
|
||||
$.i18n._( 'View a summary report to quickly review and verify information for each employee.' )
|
||||
);
|
||||
|
||||
$this.addButton( 'GovernmentT4A',
|
||||
'view_detail-35x35.png',
|
||||
$.i18n._( 'T4A Forms' ),
|
||||
$.i18n._( 'Generate T4A forms to review and verify that all necessary boxes are properly filled out.' )
|
||||
);
|
||||
|
||||
$this.addButton( 'T4AFormSetup',
|
||||
'save_setup-35x35.png',
|
||||
$.i18n._( 'Form Setup' ) + ' (' + $.i18n._( 'Optional' ) + ')',
|
||||
$.i18n._( 'In the event that the T4A report or forms are not showing the correct information, use this Form Setup icon to make adjustments and try again.' )
|
||||
);
|
||||
break;
|
||||
|
||||
//US
|
||||
case 'FW2':
|
||||
tax_button = $this.addButton( 'taxReportsIcon',
|
||||
'tax_reports-35x35.png',
|
||||
$.i18n._( 'Summary Report' ),
|
||||
$.i18n._( 'View a summary report to quickly review and verify information for each employee.' )
|
||||
);
|
||||
|
||||
$this.addButton( 'GovernmentW2',
|
||||
'view_detail-35x35.png',
|
||||
$.i18n._( 'W2 Forms' ),
|
||||
$.i18n._( 'Generate W2 forms to review and verify that all necessary boxes are properly filled out.' )
|
||||
);
|
||||
|
||||
$this.addButton( 'W2FormSetup',
|
||||
'save_setup-35x35.png',
|
||||
$.i18n._( 'Form Setup' ) + ' (' + $.i18n._( 'Optional' ) + ')',
|
||||
$.i18n._( 'In the event that the W2 report or forms are not showing the correct information, use this Form Setup icon to make adjustments and try again.' )
|
||||
);
|
||||
break;
|
||||
case 'F1099NEC':
|
||||
tax_button = $this.addButton( 'taxReportsIcon',
|
||||
'tax_reports-35x35.png',
|
||||
$.i18n._( 'Summary Report' ),
|
||||
$.i18n._( 'View a summary report to quickly review and verify information for each employee.' )
|
||||
);
|
||||
|
||||
$this.addButton( 'Government1099Nec',
|
||||
'view_detail-35x35.png',
|
||||
$.i18n._( '1099-NEC Forms' ),
|
||||
$.i18n._( 'Generate 1099-NEC forms to review and verify that all necessary boxes are properly filled out.' )
|
||||
);
|
||||
|
||||
$this.addButton( '1099NecFormSetup',
|
||||
'save_setup-35x35.png',
|
||||
$.i18n._( 'Form Setup' ) + ' (' + $.i18n._( 'Optional' ) + ')',
|
||||
$.i18n._( 'In the event that the 1099-NEC report or forms are not showing the correct information, use this Form Setup icon to make adjustments and try again.' )
|
||||
);
|
||||
break;
|
||||
case 'F940':
|
||||
tax_button = $this.addButton( 'taxReportsIcon',
|
||||
'tax_reports-35x35.png',
|
||||
$.i18n._( 'Summary Report' ),
|
||||
$.i18n._( 'View a summary report to quickly review and verify information for each employee.' )
|
||||
);
|
||||
|
||||
$this.addButton( 'Government940',
|
||||
'view_detail-35x35.png',
|
||||
$.i18n._( '940 Form' ),
|
||||
$.i18n._( 'Generate the 940 form to review and verify that all necessary boxes are properly filled out.' )
|
||||
);
|
||||
|
||||
$this.addButton( '940FormSetup',
|
||||
'save_setup-35x35.png',
|
||||
$.i18n._( 'Form Setup' ) + ' (' + $.i18n._( 'Optional' ) + ')',
|
||||
$.i18n._( 'In the event that the 940 report or forms are not showing the correct information, use this Form Setup icon to make adjustments and try again.' )
|
||||
);
|
||||
break;
|
||||
case 'F941':
|
||||
tax_button = $this.addButton( 'taxReportsIcon',
|
||||
'tax_reports-35x35.png',
|
||||
$.i18n._( 'Summary Report' ),
|
||||
$.i18n._( 'View a summary report to quickly review and verify information for each employee.' )
|
||||
);
|
||||
|
||||
$this.addButton( 'Government941',
|
||||
'view_detail-35x35.png',
|
||||
$.i18n._( '941 Form' ),
|
||||
$.i18n._( 'Generate the 941 form to review and verify that all necessary boxes are properly filled out.' )
|
||||
);
|
||||
|
||||
$this.addButton( '941FormSetup',
|
||||
'save_setup-35x35.png',
|
||||
$.i18n._( 'Form Setup' ) + ' (' + $.i18n._( 'Optional' ) + ')',
|
||||
$.i18n._( 'In the event that the 941 report or forms are not showing the correct information, use this Form Setup icon to make adjustments and try again.' )
|
||||
);
|
||||
break;
|
||||
case 'PBJ':
|
||||
tax_button = $this.addButton( 'taxReportsIcon',
|
||||
'tax_reports-35x35.png',
|
||||
$.i18n._( 'Summary Report' ),
|
||||
$.i18n._( 'View a summary report to quickly review and verify information for each employee.' )
|
||||
);
|
||||
|
||||
$this.addButton( 'PBJExportSetup',
|
||||
'save_setup-35x35.png',
|
||||
$.i18n._( 'Export Setup' ),
|
||||
$.i18n._( 'In the event that the export format is not showing the correct information, use this icon to make adjustments and try again.' )
|
||||
);
|
||||
break;
|
||||
case 'ROE':
|
||||
tax_button = $this.addButton( 'taxReportsIcon',
|
||||
'view-35x35.png',
|
||||
$.i18n._( 'ROE Forms' ),
|
||||
$.i18n._( 'View ROE forms to review and verify that all necessary boxes are properly filled out.' )
|
||||
);
|
||||
break;
|
||||
default:
|
||||
tax_button = $this.addButton( 'taxReportsIcon',
|
||||
'tax_reports-35x35.png',
|
||||
$.i18n._( 'Summary Report' ),
|
||||
$.i18n._( 'View a summary report to quickly review and verify information for each employee.' )
|
||||
);
|
||||
}
|
||||
|
||||
if ( tax_button != false ) {
|
||||
$this.initRightClickMenuForTaxReportViewButton();
|
||||
}
|
||||
|
||||
$this.getWizardObject().enableButtons();
|
||||
} );
|
||||
}
|
||||
|
||||
_onNavigationClick( icon ) {
|
||||
//When navigating away, link the wizard.
|
||||
var $this = this;
|
||||
switch ( $this.getWizardObject().selected_remittance_agency_event.type_id ) {
|
||||
//Canada
|
||||
case 'T4':
|
||||
switch ( icon ) {
|
||||
case 'GovernmentT4':
|
||||
Global.loadScript( 'views/reports/t4_summary/T4SummaryReportViewController', function() {
|
||||
$this.getWizardObject().getReport( 'pdf_form_government' );
|
||||
} );
|
||||
break;
|
||||
case 'taxReportsIcon_new_window':
|
||||
this.getWizardObject().showHTMLReport( 'T4Summary', true );
|
||||
break;
|
||||
case 'taxReportsIcon':
|
||||
this.getWizardObject().showHTMLReport( 'T4Summary' );
|
||||
break;
|
||||
case 'T4FormSetup':
|
||||
this.getWizardObject().minimize();
|
||||
IndexViewController.openReport( LocalCacheData.current_open_primary_controller, 'T4SummaryReport', null, 'FormSetup' );
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'T4A':
|
||||
switch ( icon ) {
|
||||
case 'GovernmentT4A':
|
||||
Global.loadScript( 'views/reports/t4a_summary/T4ASummaryReportViewController', function() {
|
||||
$this.getWizardObject().getReport( 'pdf_form_government' );
|
||||
} );
|
||||
break;
|
||||
case 'taxReportsIcon_new_window':
|
||||
this.getWizardObject().showHTMLReport( 'T4ASummary', true );
|
||||
break;
|
||||
case 'taxReportsIcon':
|
||||
this.getWizardObject().showHTMLReport( 'T4ASummary' );
|
||||
break;
|
||||
case 'T4AFormSetup':
|
||||
this.getWizardObject().minimize();
|
||||
IndexViewController.openReport( LocalCacheData.current_open_primary_controller, 'T4ASummaryReport', null, 'FormSetup' );
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
//US
|
||||
case 'FW2':
|
||||
switch ( icon ) {
|
||||
case 'GovernmentW2':
|
||||
Global.loadScript( 'views/reports/formw2/FormW2ReportViewController', function() {
|
||||
$this.getWizardObject().getReport( 'pdf_form_government' );
|
||||
} );
|
||||
break;
|
||||
case 'taxReportsIcon_new_window':
|
||||
this.getWizardObject().showHTMLReport( 'FormW2Report', true );
|
||||
break;
|
||||
case 'taxReportsIcon':
|
||||
this.getWizardObject().showHTMLReport( 'FormW2Report' );
|
||||
break;
|
||||
case 'W2FormSetup':
|
||||
this.getWizardObject().minimize();
|
||||
IndexViewController.openReport( LocalCacheData.current_open_primary_controller, 'FormW2Report', null, 'FormSetup' );
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'F1099NEC':
|
||||
switch ( icon ) {
|
||||
case 'Government1099Nec':
|
||||
Global.loadScript( 'views/reports/form1099/Form1099NecReportViewController', function() {
|
||||
$this.getWizardObject().getReport( 'pdf_form_government' );
|
||||
} );
|
||||
break;
|
||||
case 'taxReportsIcon_new_window':
|
||||
this.getWizardObject().showHTMLReport( 'Form1099NecReport', true );
|
||||
break;
|
||||
case 'taxReportsIcon':
|
||||
this.getWizardObject().showHTMLReport( 'Form1099NecReport' );
|
||||
break;
|
||||
case '1099NecFormSetup':
|
||||
this.getWizardObject().minimize();
|
||||
IndexViewController.openReport( LocalCacheData.current_open_primary_controller, 'Form1099NecReport', null, 'FormSetup' );
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'F940':
|
||||
switch ( icon ) {
|
||||
case 'Government940':
|
||||
Global.loadScript( 'views/reports/form940/Form940ReportViewController', function() {
|
||||
$this.getWizardObject().getReport( 'pdf_form' );
|
||||
} );
|
||||
break;
|
||||
case 'taxReportsIcon_new_window':
|
||||
this.getWizardObject().showHTMLReport( 'Form940', true );
|
||||
break;
|
||||
case 'taxReportsIcon':
|
||||
this.getWizardObject().showHTMLReport( 'Form940' );
|
||||
break;
|
||||
case '940FormSetup':
|
||||
this.getWizardObject().minimize();
|
||||
IndexViewController.openReport( LocalCacheData.current_open_primary_controller, 'Form940Report', null, 'FormSetup' );
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'F941':
|
||||
switch ( icon ) {
|
||||
case 'Government941':
|
||||
Global.loadScript( 'views/reports/form941/Form941ReportViewController', function() {
|
||||
$this.getWizardObject().getReport( 'pdf_form' );
|
||||
} );
|
||||
break;
|
||||
case 'taxReportsIcon_new_window':
|
||||
this.getWizardObject().showHTMLReport( 'Form941', true );
|
||||
break;
|
||||
case 'taxReportsIcon':
|
||||
this.getWizardObject().showHTMLReport( 'Form941' );
|
||||
break;
|
||||
case '941FormSetup':
|
||||
this.getWizardObject().minimize();
|
||||
IndexViewController.openReport( LocalCacheData.current_open_primary_controller, 'Form941Report', null, 'FormSetup' );
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'PBJ':
|
||||
switch ( icon ) {
|
||||
case 'taxReportsIcon_new_window':
|
||||
this.getWizardObject().showHTMLReport( 'PayrollExportReport', true );
|
||||
break;
|
||||
case 'taxReportsIcon':
|
||||
this.getWizardObject().showHTMLReport( 'PayrollExportReport' );
|
||||
break;
|
||||
case 'PBJExportSetup':
|
||||
this.getWizardObject().minimize();
|
||||
IndexViewController.openReport( LocalCacheData.current_open_primary_controller, 'PayrollExportReport', null, 'ExportSetup' );
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'ROE':
|
||||
switch ( icon ) {
|
||||
case 'taxReportsIcon':
|
||||
$this.getWizardObject().getReport( 'pdf_form' );
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'NEWHIRE':
|
||||
switch ( icon ) {
|
||||
case 'taxReportsIcon':
|
||||
this.getWizardObject().showHTMLReport( 'UserSummaryReport' );
|
||||
break;
|
||||
case 'taxReportsIcon_new_window':
|
||||
this.getWizardObject().showHTMLReport( 'UserSummaryReport', true );
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if ( $this.getWizardObject().selected_remittance_agency_event.payroll_remittance_agency_obj.type_id == 20 ) {
|
||||
//US State Unemployment
|
||||
switch ( icon ) {
|
||||
case 'taxReportsIcon_new_window':
|
||||
this.getWizardObject().showHTMLReport( 'USStateUnemployment', true );
|
||||
break;
|
||||
case 'taxReportsIcon':
|
||||
this.getWizardObject().showHTMLReport( 'USStateUnemployment' );
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
switch ( icon ) {
|
||||
case 'taxReportsIcon_new_window':
|
||||
this.getWizardObject().showHTMLReport( 'TaxSummary', true );
|
||||
break;
|
||||
case 'taxReportsIcon':
|
||||
this.getWizardObject().showHTMLReport( 'TaxSummary' );
|
||||
break;
|
||||
case 'TaxSummaryFormSetup':
|
||||
this.getWizardObject().minimize();
|
||||
IndexViewController.openReport( LocalCacheData.current_open_primary_controller, 'TaxSummaryReport' );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
initRightClickMenuForTaxReportViewButton() {
|
||||
var $this = this;
|
||||
var selector = '#taxReportsIcon';
|
||||
if ( $( selector ).length == 0 ) {
|
||||
return;
|
||||
}
|
||||
var items = this.getViewButtonRightClickItems();
|
||||
|
||||
if ( !items || $.isEmptyObject( items ) ) {
|
||||
return;
|
||||
}
|
||||
$.contextMenu( 'destroy', selector );
|
||||
$.contextMenu( {
|
||||
selector: selector,
|
||||
callback: function( key, options ) {
|
||||
$this.onNavigationClick( null, key );
|
||||
},
|
||||
|
||||
onContextMenu: function() {
|
||||
return false;
|
||||
},
|
||||
items: items,
|
||||
zIndex: 50
|
||||
} );
|
||||
}
|
||||
|
||||
getViewButtonRightClickItems() {
|
||||
var $this = this;
|
||||
var items = {};
|
||||
|
||||
items['taxReportsIcon'] = {
|
||||
name: $.i18n._( 'View' ), icon: 'viewIcon', disabled: function() {
|
||||
return isDisabled();
|
||||
}
|
||||
};
|
||||
|
||||
items['taxReportsIcon_new_window'] = {
|
||||
name: $.i18n._( 'View in New Window' ), icon: 'viewIcon', disabled: function() {
|
||||
return isDisabled();
|
||||
}
|
||||
};
|
||||
|
||||
function isDisabled() {
|
||||
if ( $( '#taxReportsIcon' ).parent().hasClass( 'disable-image' ) ) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return items;
|
||||
}
|
||||
}
|
@ -0,0 +1,512 @@
|
||||
import { WizardStep } from '@/global/widgets/wizard/WizardStep';
|
||||
|
||||
export class PayrollRemittanceAgencyEventWizardStepSubmit extends WizardStep {
|
||||
constructor( options = {} ) {
|
||||
_.defaults( options, {
|
||||
name: 'summary',
|
||||
api: null,
|
||||
el: $( '.wizard.process_transactions_wizard' ),
|
||||
|
||||
report_paths: {
|
||||
'FormW2ReportViewController': 'views/reports/formw2/FormW2ReportViewController'
|
||||
}
|
||||
|
||||
} );
|
||||
|
||||
super( options );
|
||||
}
|
||||
|
||||
init() {
|
||||
this.render();
|
||||
|
||||
this.api = TTAPI.APIPayrollRemittanceAgencyEvent;
|
||||
}
|
||||
|
||||
getPreviousStepName() {
|
||||
return 'review';
|
||||
}
|
||||
|
||||
getNextStepName() {
|
||||
var retval = false;
|
||||
switch ( this.getWizardObject().selected_remittance_agency_event.type_id ) {
|
||||
//Canada
|
||||
case 'T4':
|
||||
case 'T4A':
|
||||
retval = 'publish';
|
||||
break;
|
||||
|
||||
//US
|
||||
case 'FW2':
|
||||
//Only have a publish step when its a federal W2, since it includes copies of the W2s for State/Local.
|
||||
if ( this.getWizardObject().selected_remittance_agency_event.payroll_remittance_agency_obj.type_id == 10 ) { //10=Federal
|
||||
retval = 'publish';
|
||||
} else {
|
||||
retval = false;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'F1099NEC':
|
||||
retval = 'publish';
|
||||
break;
|
||||
|
||||
default:
|
||||
retval = false;
|
||||
break;
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
isRequiredButtonsClicked() {
|
||||
//Check to see if every button on this step has been clicked.
|
||||
//$this.getWizardObject().selected_remittance_agency_event.type_id
|
||||
if ( Object.keys( this.clicked_buttons ).length >= Object.keys( this.buttons ).length ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
_render() {
|
||||
this.setTitle( $.i18n._( 'Submit Verified Information' ) );
|
||||
this.setInstructions( $.i18n._( 'Submit verified information to the agency' ) + ': ' );
|
||||
|
||||
var $this = this;
|
||||
this.getWizardObject().getPayrollRemittanceAgencyEventById( this.getWizardObject().selected_remittance_agency_event_id, null, function( result ) {
|
||||
$this.getWizardObject().selected_remittance_agency_event = result;
|
||||
$this.getWizardObject().buildEventDataBlock( 'payroll_remittance_agency_event_wizard-review-event_details', result );
|
||||
$this.initCardsBlock();
|
||||
|
||||
if ( $this.getWizardObject().selected_remittance_agency_event.status_id == 15 ) { //15=Full Service
|
||||
switch ( $this.getWizardObject().selected_remittance_agency_event.type_id ) {
|
||||
//Canada
|
||||
case 'T4SD':
|
||||
$this.addButton( 'paymentMethodIcon',
|
||||
'payment_methods-35x35.png',
|
||||
$.i18n._( 'Make Payment' ),
|
||||
$.i18n._( 'Transmit payment with TimeTrex Payment Services automatically.' )
|
||||
);
|
||||
break;
|
||||
case 'T4':
|
||||
case 'T4A':
|
||||
$this.addButton( 'eFileIcon',
|
||||
'export_to_efile-35x35.png',
|
||||
$.i18n._( 'eFile' ),
|
||||
$.i18n._( 'Transmit forms to the CRA with TimeTrex Payment Services automatically.' )
|
||||
);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
switch ( $this.getWizardObject().selected_remittance_agency_event.type_id ) {
|
||||
//Canada
|
||||
case 'T4':
|
||||
case 'T4A':
|
||||
$this.addButton( 'efileDownload',
|
||||
'export_to_efile-35x35.png',
|
||||
$.i18n._( 'Download eFile' ),
|
||||
$.i18n._( 'Download the file to your computer for eFiling in the below step.' )
|
||||
);
|
||||
$this.addButton( 'eFileIcon',
|
||||
'export_to_efile-35x35.png',
|
||||
$.i18n._( 'Upload eFile' ),
|
||||
$.i18n._( 'Navigate to the agency\'s website and upload the eFile downloaded in the above step.' )
|
||||
);
|
||||
break;
|
||||
case 'ROE':
|
||||
$this.addButton( 'efileDownload',
|
||||
'export-35x35.png',
|
||||
$.i18n._( 'Download eFile' ),
|
||||
$.i18n._( 'Download the file to your computer for eFiling in the below step.' )
|
||||
);
|
||||
$this.addButton( 'eFileIcon',
|
||||
'export_to_efile-35x35.png',
|
||||
$.i18n._( 'Upload eFile' ),
|
||||
$.i18n._( 'Navigate to the agency\'s website and upload the eFile downloaded in the above step.' )
|
||||
);
|
||||
break;
|
||||
|
||||
//US
|
||||
case 'FW2':
|
||||
$this.addButton( 'efileDownload',
|
||||
'export_to_efile-35x35.png',
|
||||
$.i18n._( 'Download eFile' ),
|
||||
$.i18n._( 'Download the file to your computer for eFiling in the below step.' )
|
||||
);
|
||||
$this.addButton( 'eFileIcon',
|
||||
'export_to_efile-35x35.png',
|
||||
$.i18n._( 'Upload eFile' ),
|
||||
$.i18n._( 'Navigate to the agency\'s website and upload the eFile downloaded in the above step.' )
|
||||
);
|
||||
break;
|
||||
case 'F1099NEC':
|
||||
$this.addButton( 'Government1099Nec',
|
||||
'print-35x35.png',
|
||||
$.i18n._( '1099-NEC Forms' ),
|
||||
$.i18n._( 'Generate the government 1099-NEC forms to print and file manually.' )
|
||||
);
|
||||
break;
|
||||
case 'F940':
|
||||
$this.addButton( 'Government940',
|
||||
'view_detail-35x35.png',
|
||||
$.i18n._( '940 Form' ),
|
||||
$.i18n._( 'Generate the 940 form to print and file manually.' )
|
||||
);
|
||||
$this.addButton( 'paymentMethodIcon',
|
||||
'payment_methods-35x35.png',
|
||||
$.i18n._( 'Make Payment' ),
|
||||
$.i18n._( 'Navigate to the agency\'s website to make a payment if necessary.' )
|
||||
);
|
||||
break;
|
||||
case 'F941':
|
||||
$this.addButton( 'Government941',
|
||||
'view_detail-35x35.png',
|
||||
$.i18n._( '941 Form' ),
|
||||
$.i18n._( 'Generate the 941 form to print and file manually.' )
|
||||
);
|
||||
$this.addButton( 'paymentMethodIcon',
|
||||
'payment_methods-35x35.png',
|
||||
$.i18n._( 'Make Payment' ),
|
||||
$.i18n._( 'Navigate to the agency\'s website to make a payment if necessary.' )
|
||||
);
|
||||
break;
|
||||
case 'PBJ':
|
||||
$this.addButton( 'efileDownload',
|
||||
'export-35x35.png',
|
||||
$.i18n._( 'Download eFile' ),
|
||||
$.i18n._( 'Download the file to your computer for eFiling in the below step.' )
|
||||
);
|
||||
$this.addButton( 'eFileIcon',
|
||||
'export_to_efile-35x35.png',
|
||||
$.i18n._( 'Upload eFile' ),
|
||||
$.i18n._( 'Navigate to the agency\'s website and upload the eFile downloaded in the above step.' )
|
||||
);
|
||||
break;
|
||||
case 'NEWHIRE':
|
||||
$this.addButton( 'taxReportsIcon',
|
||||
'tax_reports-35x35.png',
|
||||
$.i18n._( 'Report' ),
|
||||
$.i18n._( 'Generate the report to file manually.' )
|
||||
);
|
||||
$this.addButton( 'efileDownload',
|
||||
'export-35x35.png',
|
||||
$.i18n._( 'Download Excel/CSV File (Optional)' ),
|
||||
$.i18n._( 'Download the Excel/CSV file to your computer for eFiling in the below step.' )
|
||||
);
|
||||
$this.addButton( 'eFileIcon',
|
||||
'export_to_efile-35x35.png',
|
||||
$.i18n._( 'File with Agency' ),
|
||||
$.i18n._( 'Navigate to the agency\'s website to file the necessary information.' )
|
||||
);
|
||||
break;
|
||||
|
||||
//Generic
|
||||
case 'AUDIT':
|
||||
case 'REPORT':
|
||||
// $this.addButton( 'taxReportsIcon',
|
||||
// 'tax_reports-35x35.png',
|
||||
// $.i18n._( 'Report' ),
|
||||
// $.i18n._( 'Generate the report to file manually.' )
|
||||
// );
|
||||
|
||||
$this.addButton( 'printIcon',
|
||||
'print-35x35.png',
|
||||
$.i18n._( 'Report' ),
|
||||
$.i18n._( 'Generate the report in PDF format to file manually.' )
|
||||
);
|
||||
|
||||
$this.addButton( 'exportExcelIcon',
|
||||
'export_to_excel-35x35.png',
|
||||
$.i18n._( 'Excel Report' ),
|
||||
$.i18n._( 'Generate the report in Excel/CSV format to file manually.' )
|
||||
);
|
||||
|
||||
$this.addButton( 'paymentMethodIcon',
|
||||
'payment_methods-35x35.png',
|
||||
$.i18n._( 'File Report' ),
|
||||
$.i18n._( 'Navigate to the agency\'s website to file the report manually.' )
|
||||
);
|
||||
break;
|
||||
case 'PAYMENT':
|
||||
case 'PAYMENT+REPORT':
|
||||
// $this.addButton( 'taxReportsIcon',
|
||||
// 'tax_reports-35x35.png',
|
||||
// $.i18n._( 'Report' ),
|
||||
// $.i18n._( 'Generate the report to file manually.' )
|
||||
// );
|
||||
|
||||
$this.addButton( 'printIcon',
|
||||
'print-35x35.png',
|
||||
$.i18n._( 'Report' ),
|
||||
$.i18n._( 'Generate the report in PDF format to file manually.' )
|
||||
);
|
||||
|
||||
$this.addButton( 'exportExcelIcon',
|
||||
'export_to_excel-35x35.png',
|
||||
$.i18n._( 'Excel Report' ),
|
||||
$.i18n._( 'Generate the report in Excel/CSV format to file manually.' )
|
||||
);
|
||||
|
||||
$this.addButton( 'paymentMethodIcon',
|
||||
'payment_methods-35x35.png',
|
||||
$.i18n._( 'Make Payment' ),
|
||||
$.i18n._( 'Navigate to the agency\'s website to make a payment if necessary.' )
|
||||
);
|
||||
break;
|
||||
default:
|
||||
if ( $this.getWizardObject().selected_remittance_agency_event.payroll_remittance_agency_obj.country == 'US' &&
|
||||
(
|
||||
( $this.getWizardObject().selected_remittance_agency_event.payroll_remittance_agency_obj.type_id == 20 && $this.getWizardObject().selected_remittance_agency_event.payroll_remittance_agency_obj.parsed_agency_id.id == 20 ) //Type: 20=State, Agency ID: 20=Unemployment
|
||||
||
|
||||
$.inArray( 'UI', $this.getWizardObject().selected_remittance_agency_event.event_data.tax_codes ) !== -1 //CA, LA, NH, NY, MN combine UI with State tax filing.
|
||||
)
|
||||
) {
|
||||
$this.addButton( 'efileDownload',
|
||||
'export_to_efile-35x35.png',
|
||||
$.i18n._( 'Download eFile' ),
|
||||
$.i18n._( 'Download the file to your computer for eFiling in the below step.' )
|
||||
);
|
||||
$this.addButton( 'eFileIcon',
|
||||
'export_to_efile-35x35.png',
|
||||
$.i18n._( 'Upload eFile' ),
|
||||
$.i18n._( 'Navigate to the agency\'s website and upload the eFile downloaded in the above step.' )
|
||||
);
|
||||
} else {
|
||||
// $this.addButton( 'taxReportsIcon',
|
||||
// 'tax_reports-35x35.png',
|
||||
// $.i18n._( 'Report' ),
|
||||
// $.i18n._( 'Generate the report to file manually.' )
|
||||
// );
|
||||
|
||||
$this.addButton( 'printIcon',
|
||||
'print-35x35.png',
|
||||
$.i18n._( 'Report' ),
|
||||
$.i18n._( 'Generate the report in PDF format to file manually.' )
|
||||
);
|
||||
|
||||
$this.addButton( 'exportExcelIcon',
|
||||
'export_to_excel-35x35.png',
|
||||
$.i18n._( 'Excel Report' ),
|
||||
$.i18n._( 'Generate the report in Excel/CSV format to file manually.' )
|
||||
);
|
||||
|
||||
$this.addButton( 'paymentMethodIcon',
|
||||
'payment_methods-35x35.png',
|
||||
$.i18n._( 'Make Payment' ),
|
||||
$.i18n._( 'Navigate to the agency\'s website to make a payment if necessary.' )
|
||||
);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$this.getWizardObject().enableButtons();
|
||||
} );
|
||||
}
|
||||
|
||||
_onNavigationClick( icon ) {
|
||||
//When navigating away, link the wizard.
|
||||
var $this = this;
|
||||
if ( $this.getWizardObject().selected_remittance_agency_event.status_id == 15 ) { //15=Full Service
|
||||
switch ( this.getWizardObject().selected_remittance_agency_event.type_id ) {
|
||||
//Canada
|
||||
case 'T4SD':
|
||||
switch ( icon ) {
|
||||
case 'paymentMethodIcon':
|
||||
this.paymentServicesClick( 'payment' );
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'T4':
|
||||
case 'T4A':
|
||||
switch ( icon ) {
|
||||
case 'eFileIcon':
|
||||
this.paymentServicesClick( 'efile_xml' );
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
switch ( this.getWizardObject().selected_remittance_agency_event.type_id ) {
|
||||
//Canada
|
||||
case 'T4':
|
||||
switch ( icon ) {
|
||||
case 'efileDownload':
|
||||
Global.loadScript( 'views/reports/t4_summary/T4SummaryReportViewController', function() {
|
||||
$this.getWizardObject().getReport( 'efile_xml' );
|
||||
} );
|
||||
break;
|
||||
case 'eFileIcon':
|
||||
//show report.
|
||||
this.urlClick( 'file' );
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'T4A':
|
||||
switch ( icon ) {
|
||||
case 'efileDownload':
|
||||
Global.loadScript( 'views/reports/t4a_summary/T4ASummaryReportViewController', function() {
|
||||
$this.getWizardObject().getReport( 'efile_xml' );
|
||||
} );
|
||||
break;
|
||||
case 'eFileIcon':
|
||||
//show report.
|
||||
this.urlClick( 'file' );
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'ROE':
|
||||
switch ( icon ) {
|
||||
case 'efileDownload':
|
||||
$this.getWizardObject().getReport( 'efile_xml' );
|
||||
break;
|
||||
case 'eFileIcon':
|
||||
//show report.
|
||||
this.urlClick( 'file' );
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
//US
|
||||
case 'FW2':
|
||||
switch ( icon ) {
|
||||
case 'efileDownload':
|
||||
Global.loadScript( 'views/reports/formw2/FormW2ReportViewController', function() {
|
||||
$this.getWizardObject().getReport( 'efile' );
|
||||
} );
|
||||
break;
|
||||
case 'eFileIcon':
|
||||
//show report.
|
||||
this.urlClick( 'file' );
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'F1099NEC':
|
||||
switch ( icon ) {
|
||||
case 'Government1099Nec':
|
||||
Global.loadScript( 'views/reports/form1099/Form1099NecReportViewController', function() {
|
||||
$this.getWizardObject().getReport( 'pdf_form_government' );
|
||||
} );
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'F940':
|
||||
switch ( icon ) {
|
||||
case 'Government940':
|
||||
Global.loadScript( 'views/reports/form940/Form940ReportViewController', function() {
|
||||
$this.getWizardObject().getReport( 'pdf_form' );
|
||||
} );
|
||||
break;
|
||||
case 'paymentMethodIcon':
|
||||
//show report.
|
||||
this.urlClick( 'payment' );
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'F941':
|
||||
switch ( icon ) {
|
||||
case 'Government941':
|
||||
Global.loadScript( 'views/reports/form941/Form941ReportViewController', function() {
|
||||
$this.getWizardObject().getReport( 'pdf_form' );
|
||||
} );
|
||||
break;
|
||||
case 'paymentMethodIcon':
|
||||
//show report.
|
||||
this.urlClick( 'payment' );
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'PBJ':
|
||||
switch ( icon ) {
|
||||
case 'efileDownload':
|
||||
Global.loadScript( 'views/reports/payroll_export/PayrollExportReportViewController', function() {
|
||||
$this.getWizardObject().getReport( 'payroll_export' );
|
||||
} );
|
||||
break;
|
||||
case 'eFileIcon':
|
||||
//show report.
|
||||
this.urlClick( 'file' );
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'NEWHIRE':
|
||||
switch ( icon ) {
|
||||
case 'taxReportsIcon_new_window':
|
||||
this.getWizardObject().showHTMLReport( 'TaxSummary', true );
|
||||
break;
|
||||
case 'taxReportsIcon':
|
||||
this.getWizardObject().showHTMLReport( 'TaxSummary' );
|
||||
break;
|
||||
case 'efileDownload':
|
||||
$this.getWizardObject().getReport( 'csv' ); //Use CSV until we get full eFile support.
|
||||
break;
|
||||
case 'eFileIcon':
|
||||
//show report.
|
||||
this.urlClick( 'file' );
|
||||
break;
|
||||
}
|
||||
break;
|
||||
//Generic
|
||||
default:
|
||||
if ( $this.getWizardObject().selected_remittance_agency_event.payroll_remittance_agency_obj.type_id == 20 ) {
|
||||
//US State Unemployment
|
||||
switch ( icon ) {
|
||||
case 'taxReportsIcon_new_window': //Show HTML report in new window
|
||||
this.getWizardObject().showHTMLReport( 'USStateUnemployment', true );
|
||||
break;
|
||||
case 'taxReportsIcon': //Show HTML report
|
||||
this.getWizardObject().showHTMLReport( 'USStateUnemployment' );
|
||||
break;
|
||||
case 'exportExcelIcon': //Show Excel Report
|
||||
$this.getWizardObject().getReport( 'csv' ); //Use CSV until we get full eFile support.
|
||||
break;
|
||||
case 'printIcon': //Show PDF Report
|
||||
$this.getWizardObject().getReport( 'pdf' ); //Use CSV until we get full eFile support.
|
||||
break;
|
||||
case 'efileDownload':
|
||||
Global.loadScript( 'views/reports/us_state_unemployment/USStateUnemploymentReportViewController', function() {
|
||||
$this.getWizardObject().getReport( 'efile' );
|
||||
} );
|
||||
break;
|
||||
case 'eFileIcon':
|
||||
this.urlClick( 'file' ); //Redirect to 3rd party page.
|
||||
break;
|
||||
case 'paymentMethodIcon':
|
||||
this.urlClick( 'payment' ); //Redirect to 3rd party page.
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
switch ( icon ) {
|
||||
case 'taxReportsIcon_new_window': //Show HTML report in new window
|
||||
this.getWizardObject().showHTMLReport( 'TaxSummary', true );
|
||||
break;
|
||||
case 'taxReportsIcon': //Show HTML report
|
||||
this.getWizardObject().showHTMLReport( 'TaxSummary' );
|
||||
break;
|
||||
case 'exportExcelIcon': //Show Excel Report
|
||||
$this.getWizardObject().getReport( 'csv' ); //Use CSV until we get full eFile support.
|
||||
break;
|
||||
case 'printIcon': //Show PDF Report
|
||||
$this.getWizardObject().getReport( 'pdf' ); //Use CSV until we get full eFile support.
|
||||
break;
|
||||
case 'efileDownload':
|
||||
Global.loadScript( 'views/reports/tax_summary/TaxSummaryReportViewController', function() {
|
||||
$this.getWizardObject().getReport( 'efile' );
|
||||
} );
|
||||
break;
|
||||
case 'eFileIcon':
|
||||
this.urlClick( 'file' ); //Redirect to 3rd party page.
|
||||
break;
|
||||
case 'paymentMethodIcon':
|
||||
this.urlClick( 'payment' ); //Redirect to 3rd party page.
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user