I am getting the following error trying to build an android apk:
It runs ok in the developer and jshint doesn't show that there are syntax errors
here is the javascript class which is apparently causing the error:
pre
/* tax RefundReportCreator Class */
function TaxRefundReportCreator(
taxPeriod,
salary,
pension,
contractedOut,
netSalaryForTax,
taxCode,
age,
studentLoan,
earningsFromEmployment,
pensionContribution,
taxDue,
studentLoanRepayment,
nettPay,
businessMiles,
transportType,
ownTransport,
employerTransport,
claimableTransport,
uniformAndEquipment,
cleanOwnUniform,
cleanUniform,
subscriptionsAndUnionFees,
travelCosts,
homeWorkingWeeks,
homeWorking,
totalExpenseClaim,
potentialRefund,
claimBy
) {
// add properties
this.taxPeriod = taxPeriod;
this.salary = salary;
this.pension = pension;
this.contractedOut = contractedOut;
this.netSalaryForTax = netSalaryForTax;
this.taxCode = taxCode;
this.age = age;
this.studentLoan = studentLoan;
this.earningsFromEmployment = earningsFromEmployment;
this.pensionContribution = pensionContribution;
this.taxDue = taxDue;
this.studentLoanRepayment = studentLoanRepayment;
this.nettPay = nettPay;
this.businessMiles = businessMiles;
this.transportType = transportType;
this.ownTransport = ownTransport;
this.employerTransport = employerTransport;
this.claimableTransport = claimableTransport;
this.uniformAndEquipment = uniformAndEquipment;
this.cleanOwnUniform = cleanOwnUniform;
this.cleanUniform = cleanUniform;
this.subscriptionsAndUnionFees = subscriptionsAndUnionFees;
this.travelCosts = travelCosts;
this.homeWorkingWeeks = homeWorkingWeeks;
this.homeWorking = homeWorking;
this.totalExpenseClaim = totalExpenseClaim;
this.potentialRefund = potentialRefund;
this.claimBy = claimBy;
}
//add methods
//create pdf using jsPDF
TaxRefundReportCreator.prototype.createPDF = function() {
var doc = new jsPDF("portrait", "mm", "a4");
Code: Select all
//Employment SUmmary
doc.setFontSize(24);
doc.text("Employment Summary", 105, 10, "center");
doc.rect(5, 0, 200, 15);
doc.setFontSize(18);
doc.text("Tax Year:", 10, 25);
doc.text(this.taxPeriod, 140, 25);
doc.text("Salary:", 10, 33);
doc.text("£"+this.salary.toString(), 140, 33);
doc.text("Pension (%):", 10, 41);
doc.text(this.pension.toString(), 140, 41);
doc.text("Contracted Out:", 10, 49);
doc.text(this.contractedOut, 140, 49);
doc.text("Nett Salary For Tax:", 10, 57);
doc.text("£"+this.earningsFromEmployment.toString(), 140, 57);
if (this.taxCode === 0) {this.taxCode ="";}
doc.text("Tax Code:", 10, 65);
doc.text(this.taxCode.toString(), 140, 65);
if (this.age === 'under_66') {
this.age = "Under 66";
} else if (this.age === '66_to_75') {
this.age = "66 to 75";
} else {
this.age = "Over 75";
}
doc.text("Age:", 10, 73);
doc.text(this.age, 140, 73);
if (this.studentLoan === "type_1") {
this.studentLoan = "Type 1";
} else if (this.studentLoan === "type_2") {
this.studentLoan = "Type 2";
} else {
this.StudentLoan = "";
}
doc.text("Student Loan:", 10, 81);
doc.text(this.studentLoan, 140, 81);
//Tax Summary
doc.setFontSize(24);
doc.text("Tax Summary", 105, 95, "center");
doc.rect(5, 85, 200, 15);
doc.setFontSize(18);
doc.text("Earnings From Employment:", 10, 110);
doc.text("£"+this.earningsFromEmployment.toString(), 140, 110);
doc.text("Pension Contribution:", 10, 118);
doc.text("£"+this.pensionContribution.toString(), 140, 118);
doc.text("Tax Due:", 10, 126);
doc.text("£"+this.taxDue.toString(), 140, 126);
doc.text("Student Loan Payment:", 10, 134);
doc.text("£"+this.studentLoanRepayment.toString(), 140, 134);
doc.text("Nett Pay:", 10, 142);
doc.text("£"+this.nettPay.toString(), 140, 142);
//Business Expenses Claimed
doc.setFontSize(24);
doc.text("Business Expenses Claimed", 105, 160, "center");
doc.rect(5, 150, 200, 15);
doc.setFontSize(18);
doc.text("Business Mileage:", 10, 175);
doc.text(this.businessMiles.toString(), 140, 175);
doc.text("Type:", 10, 183);
doc.text(this.transportType, 140, 183);
doc.text("Own Transport Claim:", 10, 191);
doc.text("£"+this.ownTransport.toString(), 140, 191);
doc.text("Less Paid By Empoyer:", 10, 199);
doc.text("£"+this.employerTransport, 140, 199);
doc.text("Nett Transport Expenses:", 10, 207);
doc.text("£"+this.claimableTransport.toString(), 140, 207);
doc.text("Uniform and Equipment:", 10, 215);
doc.text("£"+this.uniformAndEquipment.toString(), 140, 215);
doc.text("Cleaning Costs:", 10, 223);
doc.text("£"+this.cleanUniform.toString(), 140, 223);
doc.text("Subscriptions and Union Fees:", 10, 231);
doc.text("£"+this.subscriptionsAndUnionFees.toString(), 140, 231);
doc.text("Travel Costs (Not Paid:", 10, 239);
doc.text("£"+this.travelCosts.toString(), 140, 239);
doc.text("Home Working Expenses:", 10, 247);
doc.text("£"+this.homeWorking.toString(), 140, 247);
doc.text("Total Expenses Claimed:", 10, 255);
doc.text("£"+this.totalExpenseClaim.toString(), 140, 255);
doc.text("Potential Tax Refund:", 10, 263);
doc.text("£"+this.potentialRefund.toString(), 140, 263);
doc.text("Claim Type:", 10, 271);
doc.text(this.claimBy, 140, 271);
return doc.output('datauristring');
};
//display pdf as jpg on device
TaxRefundReportCreator.prototype.displayAsJPG = function(uristring) {
Apperyio.storage.pdfuri.set(uristring);
uploadPDF.execute();
};
//create pdf and display jpg
TaxRefundReportCreator.prototype.createPDFAndDisplayAsJPG = function() {
var uristring = this.createPDF();
this.displayAsJPG(uristring);
};
TaxRefundReportCreator.prototype.emailReport = function() {
};
//create global variable
var taxRefundReportCreator;
/pre