Navigation Menu

Skip to content

Commit

Permalink
fixing taxrates
Browse files Browse the repository at this point in the history
  • Loading branch information
Jordan Walsh committed Mar 7, 2017
1 parent 5918bb8 commit 03d0052
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 56 deletions.
99 changes: 46 additions & 53 deletions lib/entities/payitems.js
@@ -1,55 +1,55 @@
var _ = require('lodash')
, Entity = require('./entity')
, logger = require('../logger')
var _ = require('lodash'),
Entity = require('./entity'),
logger = require('../logger')

var EarningTypeSchema = new Entity.SchemaObject({
EarningsType: {type: String},
ExpenseAccountCode: {type: String},
EarningsCategory: {type: String},
RateType: {type: String},
TypeOfUnits: {type: String},
EarningRateID: {type: String},
Multiple: {type: Number},
DoNotAccrueTimeOff: { type: Boolean},
IsSupplemental: { type: Boolean},
Amount: { type: Number}
EarningsType: { type: String },
ExpenseAccountCode: { type: String },
EarningsCategory: { type: String },
RateType: { type: String },
TypeOfUnits: { type: String },
EarningRateID: { type: String },
Multiple: { type: Number },
DoNotAccrueTimeOff: { type: Boolean },
IsSupplemental: { type: Boolean },
Amount: { type: Number }
});

var BenefitTypeSchema = new Entity.SchemaObject({
BenefitType: {type: String},
BenefitCategory: {type: String},
LiabilityAccountCode: {type: String},
ExpenseAccountCode: {type: String},
BenefitTypeID: {type: String},
StandardAmount: {type: Number},
CompanyMax: { type: Number},
Percentage: { type: Number},
ShowBalanceOnPaystub: { type: Boolean}
BenefitType: { type: String },
BenefitCategory: { type: String },
LiabilityAccountCode: { type: String },
ExpenseAccountCode: { type: String },
BenefitTypeID: { type: String },
StandardAmount: { type: Number },
CompanyMax: { type: Number },
Percentage: { type: Number },
ShowBalanceOnPaystub: { type: Boolean }
});

var DeductionTypeSchema = new Entity.SchemaObject({
DeductionType: {type: String},
DeductionCategory: {type: String},
CalculationType: {type: String},
LiabilityAccountCode: {type: String},
DeductionTypeID: {type: String},
StandardAmount: {type: Number},
CompanyMax: { type: Number}
DeductionType: { type: String },
DeductionCategory: { type: String },
CalculationType: { type: String },
LiabilityAccountCode: { type: String },
DeductionTypeID: { type: String },
StandardAmount: { type: Number },
CompanyMax: { type: Number }
});

var ReimbursementTypeSchema = new Entity.SchemaObject({
DeductionType: {type: String},
ExpenseOfLiabilityAccountCode: {type: String},
ReimbursementTypeID: {type: String}
DeductionType: { type: String },
ExpenseOfLiabilityAccountCode: { type: String },
ReimbursementTypeID: { type: String }
});

var TimeOffTypeSchema = new Entity.SchemaObject({
TimeOffType: {type: String},
TimeOffCategory: {type: String},
LiabilityAccountCode: {type: String},
ExpenseAccountCode: {type: String},
TimeOffTypeID: {type: String},
ShowBalanceToEmployee: { type: Boolean}
TimeOffType: { type: String },
TimeOffCategory: { type: String },
LiabilityAccountCode: { type: String },
ExpenseAccountCode: { type: String },
TimeOffTypeID: { type: String },
ShowBalanceToEmployee: { type: Boolean }
});

var PayItemsSchema = new Entity.SchemaObject({
Expand All @@ -63,26 +63,20 @@ var PayItemsSchema = new Entity.SchemaObject({


var PayItems = Entity.extend(PayItemsSchema, {
constructor: function (application, data, options)
{
constructor: function(application, data, options) {
logger.debug('PayItems::constructor');
this.Entity.apply(this, arguments);
},
initialize: function (data, options)
{
},
changes: function (options)
{
initialize: function(data, options) {},
changes: function(options) {
return this._super(options);
},
_toObject: function (options)
{
_toObject: function(options) {
return this._super(options);
},
fromXmlObj: function (obj)
{
fromXmlObj: function(obj) {
var self = this;
_.extend(self, _.omit(obj, 'BenefitTypes','EarningsTypes', 'ReimbursementTypes', 'DeductionTypes','TimeOffTypes'));
_.extend(self, _.omit(obj, 'BenefitTypes', 'EarningsTypes', 'ReimbursementTypes', 'DeductionTypes', 'TimeOffTypes'));
if (obj.BenefitTypes) {
this.extractArray(obj.BenefitTypes.BenefitType, this.BenefitTypes);
}
Expand All @@ -102,11 +96,10 @@ var PayItems = Entity.extend(PayItemsSchema, {

return this;
},
toXml: function ()
{
toXml: function() {

}
});


module.exports = PayItems;
module.exports = PayItems;
6 changes: 5 additions & 1 deletion lib/entities/taxrate.js
Expand Up @@ -18,7 +18,7 @@ var TaxRateSchema = new Entity.SchemaObject({

var TaxComponentSchema = new Entity.SchemaObject({
Name: { type: String, toObject: 'always' },
Rate: { type: Number, toObject: 'always' },
Rate: { type: String, toObject: 'always' },
IsCompound: { type: Boolean, toObject: 'always' }
});

Expand All @@ -31,6 +31,10 @@ var TaxRate = Entity.extend(TaxRateSchema, {
fromXmlObj: function(obj) {
var self = this;
_.extend(self, _.omit(obj, 'TaxComponents'));
if (obj.TaxComponents) {
this.extractArray(obj.TaxComponents.TaxComponent, this.TaxComponents);
}

return this;
},
});
Expand Down
4 changes: 2 additions & 2 deletions test/accountingtests.js
Expand Up @@ -13,7 +13,7 @@ process.on('uncaughtException', function(err) {
var currentApp;
var organisationCountry = "";

var APPTYPE = "PARTNER";
var APPTYPE = "PRIVATE";
var privateConfigFile = "../private_app_config.json";
var publicConfigFile = "../public_app_config.json";
var partnerConfigFile = "../partner_app_config.json";
Expand Down Expand Up @@ -250,7 +250,7 @@ describe('regression tests', function() {
_.each(taxRate.TaxComponents, function(taxComponent) {
expect(taxComponent.Name).to.not.equal("");
expect(taxComponent.Name).to.not.equal(undefined);
expect(taxComponent.Rate).to.be.a('Number');
expect(taxComponent.Rate).to.be.a('String');
expect(taxComponent.IsCompound).to.be.oneOf([true, false]);
});
});
Expand Down

0 comments on commit 03d0052

Please sign in to comment.