Expense report fixes
This commit is contained in:
parent
c02f6401ad
commit
78173a5d71
@ -1,6 +1,6 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
/*** controller***/
|
/*** controller***/
|
||||||
app.controller('report_expenseCtrl', ["$scope", "API_POINTS", "$http", "SweetAlert", "$state", 'md5', 'ipCookie', '$window',"dateListDescService",
|
app.controller('report_expenseCtrl', ["$scope", "API_POINTS", "$http", "SweetAlert", "$state", 'md5', 'ipCookie', '$window', "dateListDescService",
|
||||||
function ($scope, apiPoint, $http, SweetAlert, $state, md5, ipCookie, $window, dateListDescService) {
|
function ($scope, apiPoint, $http, SweetAlert, $state, md5, ipCookie, $window, dateListDescService) {
|
||||||
|
|
||||||
// DataTables configurable options
|
// DataTables configurable options
|
||||||
@ -15,12 +15,12 @@ app.controller('report_expenseCtrl', ["$scope", "API_POINTS", "$http", "SweetAle
|
|||||||
|
|
||||||
$scope.date = new Date();
|
$scope.date = new Date();
|
||||||
|
|
||||||
var localDetail = JSON.parse(localStorage.getItem('localObj'));
|
var localDetail = JSON.parse(localStorage.getItem('localObj'));
|
||||||
const LOCALTYPE = localDetail.localType;
|
const LOCALTYPE = localDetail.localType;
|
||||||
//console.log(LOCALTYPE)
|
//console.log(LOCALTYPE)
|
||||||
if (localDetail != null && (LOCALTYPE == 'R003' || LOCALTYPE == 'R004' )) {
|
if (localDetail != null && (LOCALTYPE == 'R003' || LOCALTYPE == 'R004')) {
|
||||||
}else {
|
} else {
|
||||||
if((localDetail != null) && (LOCALTYPE !='R001')) {
|
if ((localDetail != null) && (LOCALTYPE != 'R001')) {
|
||||||
$state.go('app.dashboard');
|
$state.go('app.dashboard');
|
||||||
} else {
|
} else {
|
||||||
//ipCookie.remove('cookiechk');
|
//ipCookie.remove('cookiechk');
|
||||||
@ -37,45 +37,49 @@ app.controller('report_expenseCtrl', ["$scope", "API_POINTS", "$http", "SweetAle
|
|||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json'
|
||||||
},
|
},
|
||||||
data: {
|
data: {
|
||||||
branch : JSON.parse(localStorage.getItem('localObj')).localBranchID
|
branch: JSON.parse(localStorage.getItem('localObj')).localBranchID
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
$http(filterlist).then(function (response) {
|
$http(filterlist).then(function (response) {
|
||||||
if (response.data) {
|
if (response.data) {
|
||||||
$scope.batch=[];
|
$scope.batch = [];
|
||||||
$scope.batchlist = response.data.batch;
|
$scope.batchlist = response.data.batch;
|
||||||
$scope.university = response.data.university;
|
$scope.university = response.data.university;
|
||||||
//Desc order Batchlist
|
//Desc order Batchlist
|
||||||
angular.forEach($scope.batchlist,function (values,key) {
|
angular.forEach($scope.batchlist, function (values, key) {
|
||||||
var parts = values.BatchDate.split("-");
|
var parts = values.BatchDate.split("-");
|
||||||
$scope.batch.push({
|
$scope.batch.push({
|
||||||
"batchcode":values.batchcode,
|
"batchcode": values.batchcode,
|
||||||
"batch":values.batch + '('+ values.batchcode + ')',
|
"batch": values.batch + '(' + values.batchcode + ')',
|
||||||
"BatchDate":values.BatchDate,
|
"BatchDate": values.BatchDate,
|
||||||
"givenDateObject":new Date(parts[2], parts[1] - 1, parts[0])
|
"givenDateObject": new Date(parts[2], parts[1] - 1, parts[0])
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
// call service for make a list in desc order based on date
|
// call service for make a list in desc order based on date
|
||||||
$scope.batch=dateListDescService.getOrderByList($scope.batch);
|
$scope.batch = dateListDescService.getOrderByList($scope.batch);
|
||||||
//console.log($scope.branch);
|
//console.log($scope.branch);
|
||||||
} else {
|
} else {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
$scope.expense_data = '';
|
||||||
|
$scope.expense = '';
|
||||||
|
$scope.totArray = '';
|
||||||
$scope.show = false;
|
$scope.show = false;
|
||||||
|
$scope.Total = 0;
|
||||||
|
|
||||||
$scope.onSubmit = function (form) {
|
$scope.onSubmit = function (form) {
|
||||||
var firstError = null;
|
var firstError = null;
|
||||||
if (form.$invalid) {
|
if (form.$invalid) {
|
||||||
var field = null, firstError = null;
|
var field = null, firstError = null;
|
||||||
$scope.show = true;
|
$scope.show = true;
|
||||||
for (field in form) {
|
for (field in form) {
|
||||||
if (field[0] != '$') {
|
if (field[0] != '$') {
|
||||||
if (firstError === null && !form[field].$valid) {
|
if (firstError === null && !form[field].$valid) {
|
||||||
firstError = form[field].$addDate;
|
firstError = form[field].$addDate;
|
||||||
firstError = form[field].$toDate;
|
firstError = form[field].$toDate;
|
||||||
}
|
}
|
||||||
if (form[field].$pristine) {
|
if (form[field].$pristine) {
|
||||||
form[field].$dirty = true;
|
form[field].$dirty = true;
|
||||||
@ -83,262 +87,285 @@ app.controller('report_expenseCtrl', ["$scope", "API_POINTS", "$http", "SweetAle
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
angular.element('.ng-invalid[toDate=' + firstError + ']').focus();
|
angular.element('.ng-invalid[toDate=' + firstError + ']').focus();
|
||||||
}else {
|
} else {
|
||||||
//alert($scope.batch.name);
|
//alert($scope.batch.name);
|
||||||
$scope.expense_data = '';
|
|
||||||
$scope.message = '';
|
$scope.message = '';
|
||||||
var response_data = {
|
var response_data = {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
url: apiPoint.url + 'report_expense/',
|
url: apiPoint.url + 'report_expense/',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json'
|
||||||
},
|
},
|
||||||
data: {
|
data: {
|
||||||
branch: JSON.parse(localStorage.getItem('localObj')).localBranchID,
|
branch: JSON.parse(localStorage.getItem('localObj')).localBranchID,
|
||||||
from : $scope.filters.from_date,
|
from: $scope.filters.from_date,
|
||||||
to : $scope.filters.to_date
|
to: $scope.filters.to_date
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
$http(response_data).then(function (response) {
|
||||||
|
if (response.data.expenseList == true) {
|
||||||
|
$scope.expense_data = response.data.expense_data;
|
||||||
|
for (var i = 0; i < $scope.expense_data.length; i++)
|
||||||
|
$scope.expense_data[i].SL_NO = i + 1;
|
||||||
|
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$scope.message = response.data.message;
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$scope.getTotal = function () {
|
||||||
|
var total = 0;
|
||||||
|
for (var i = 0; i < $scope.expense_data.length; i++) {
|
||||||
|
var item = $scope.expense_data[i];
|
||||||
|
total += parseFloat(item.total);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
$scope.Total = total;
|
||||||
|
$scope.totArray = {
|
||||||
|
|
||||||
|
Expense_name:"Grand Total",
|
||||||
|
total: $scope.Total
|
||||||
|
}
|
||||||
|
|
||||||
|
// console.log($scope.Total);
|
||||||
|
$scope.expense = $scope.expense_data.concat($scope.totArray);
|
||||||
|
// console.log($scope.expense_data);
|
||||||
|
// console.log($scope.totArray);
|
||||||
|
// console.log($scope.expense);
|
||||||
|
return total;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
$http(response_data).then(function (response) {
|
|
||||||
if (response.data.expenseList == true) {
|
|
||||||
$scope.expense_data = response.data.expense_data;
|
|
||||||
for(var i=0;i<$scope.expense_data.length;i++)
|
|
||||||
$scope.expense_data[i].SL_NO = i+1;
|
|
||||||
|
|
||||||
|
|
||||||
} else {
|
};
|
||||||
$scope.message = response.data.message;
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
$scope.getTotal = function(){
|
|
||||||
var total = 0;
|
|
||||||
for(var i = 0; i < $scope.expense_data.length; i++){
|
|
||||||
var item = $scope.expense_data[i];
|
|
||||||
total += parseFloat(item.total);
|
|
||||||
}
|
|
||||||
return total; }
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
var mystyle = {
|
var mystyle = {
|
||||||
sheetid: 'EXPENSE REPORT',
|
sheetid: 'EXPENSE REPORT',
|
||||||
headers: true,
|
headers: true,
|
||||||
caption: {
|
caption: {
|
||||||
title:'EXPENSE REPORT',
|
title: 'EXPENSE REPORT',
|
||||||
width: '300px',
|
width: '300px',
|
||||||
style:'font-size:50px;'
|
style: 'font-size:50px;'
|
||||||
},
|
},
|
||||||
// style:'background:#00FF00',
|
// style:'background:#00FF00',
|
||||||
column: {
|
column: {
|
||||||
style:'font-size:10px'
|
style: 'font-size:10px'
|
||||||
},
|
},
|
||||||
|
|
||||||
};
|
};
|
||||||
|
$scope.exportData = function () {
|
||||||
|
alasql('SELECT CAST(SL_NO AS NUMBER) as SLNO,Expense_name as ExpenseName,CAST(January as NUMBER) as January,CAST(February as NUMBER) as February,CAST(March as NUMBER) as March,CAST(April as NUMBER) as April,CAST(May as NUMBER) as May,CAST(June as NUMBER) as June,CAST(July as NUMBER) as July,CAST(August as NUMBER) as August,CAST(September as NUMBER) as September,CAST(October as NUMBER) as October,CAST(November as NUMBER) as November,CAST(December as NUMBER) as December,CAST(total as NUMBER) as Amount INTO XLS("Expense_report.xls",?) FROM ?',[mystyle,$scope.expense]);
|
||||||
|
};
|
||||||
//pdf
|
//pdf
|
||||||
|
var rows1 = 0;
|
||||||
$scope.generatePFD = function (datas) {
|
$scope.generatePFD = function (datas) {
|
||||||
$scope.loadStaring = true;
|
$scope.loadStaring = true;
|
||||||
|
|
||||||
var o = {};
|
var o = {};
|
||||||
var intDataSNo = 1;
|
var intDataSNo = 1;
|
||||||
var intDate = 0;
|
var intDate = 0;
|
||||||
|
|
||||||
for(var i = 0 ; i <= datas.length-1; ++i){
|
for (var i = 0; i <= datas.length - 1; ++i) {
|
||||||
var element = datas[i];
|
var element = datas[i];
|
||||||
//var element = datas[i-1];
|
//var element = datas[i-1];
|
||||||
console.log('staff or trainee');
|
console.log(datas);
|
||||||
var value = {};
|
var value = {};
|
||||||
|
|
||||||
value['SL_NO'] = element.ORDER_ID;
|
value['SL_NO'] = element.SL_NO || '';
|
||||||
value['Expense_name'] = element.VoucherNumber;
|
value['Expense_name'] = element.Expense_name || '-';
|
||||||
value['January'] = element.PaidTo;
|
value['January'] = element.January || '';
|
||||||
value['February'] = University;
|
value['February'] =element. February || '';
|
||||||
value['March'] = element.Ty;
|
value['March'] = element.March || '';
|
||||||
value['April'] = element.ReceiptNo || '-';
|
value['April'] = element.April || '';
|
||||||
value['May'] = element.ReceiptNoComments || '-';
|
value['May'] = element.May || '';
|
||||||
value['June'] = element.ModeOfPayment || '-';
|
value['June'] = element.June || '';
|
||||||
value['July'] = element.Status || '-';
|
value['July'] = element.July || '';
|
||||||
value['August'] = element.Status;
|
value['August'] = element.August || '';
|
||||||
value['September'] = element.Balance || '-';
|
value['September'] = element.September || '';
|
||||||
value['October'] = element.Balance || '-';
|
value['October'] = element.October || '';
|
||||||
value['November'] = element.Balance || '-';
|
value['November'] = element.November || '';
|
||||||
value['December'] = element.Balance || '-';
|
value['December'] = element.December || '';
|
||||||
value['total'] = element.Balance || '-';
|
value['total'] = element.total || 0;
|
||||||
o[intDate] = value;
|
o[intDate] = value;
|
||||||
intDate++;
|
intDate++;
|
||||||
intDataSNo++;
|
intDataSNo++;
|
||||||
}
|
}
|
||||||
|
|
||||||
rows1 = o;
|
rows1 = o;
|
||||||
var headers = {
|
var headers = {
|
||||||
fila_1: {
|
fila_1: {
|
||||||
col_1: { text: 'SLNO', style: 'tableHeader', alignment: 'center', bold: true },
|
col_1: { text: 'SLNO', style: 'tableHeader', alignment: 'center', bold: true },
|
||||||
col_2: { text: 'Description', style: 'tableHeader', alignment: 'center', bold: true },
|
col_2: { text: 'Description', style: 'tableHeader', alignment: 'center', bold: true },
|
||||||
col_3: { text: 'January', style: 'tableHeader', alignment: 'center', bold: true },
|
col_3: { text: 'January', style: 'tableHeader', alignment: 'center', bold: true },
|
||||||
col_4: { text: 'February', style: 'tableHeader', alignment: 'center', bold: true },
|
col_4: { text: 'February', style: 'tableHeader', alignment: 'center', bold: true },
|
||||||
col_5: { text: 'March', style: 'tableHeader', alignment: 'center', bold: true },
|
col_5: { text: 'March', style: 'tableHeader', alignment: 'center', bold: true },
|
||||||
col_6: { text: 'April', style: 'tableHeader', alignment: 'center', bold: true },
|
col_6: { text: 'April', style: 'tableHeader', alignment: 'center', bold: true },
|
||||||
col_7: { text: 'May', style: 'tableHeader', alignment: 'center', bold: true },
|
col_7: { text: 'May', style: 'tableHeader', alignment: 'center', bold: true },
|
||||||
col_8: { text: 'June', style: 'tableHeader', alignment: 'center', bold: true },
|
col_8: { text: 'June', style: 'tableHeader', alignment: 'center', bold: true },
|
||||||
col_9: { text: 'July', style: 'tableHeader', alignment: 'center', bold: true },
|
col_9: { text: 'July', style: 'tableHeader', alignment: 'center', bold: true },
|
||||||
col_10: { text: 'August', style: 'tableHeader', alignment: 'center', bold: true },
|
col_10: { text: 'August', style: 'tableHeader', alignment: 'center', bold: true },
|
||||||
col_11: { text: 'September', style: 'tableHeader', alignment: 'center', bold: true },
|
col_11: { text: 'September', style: 'tableHeader', alignment: 'center', bold: true },
|
||||||
col_12: { text: 'October', style: 'tableHeader', alignment: 'center', bold: true },
|
col_12: { text: 'October', style: 'tableHeader', alignment: 'center', bold: true },
|
||||||
col_13: { text: 'November', style: 'tableHeader', alignment: 'center', bold: true },
|
col_13: { text: 'November', style: 'tableHeader', alignment: 'center', bold: true },
|
||||||
col_14: { text: 'December', style: 'tableHeader', alignment: 'center', bold: true },
|
col_14: { text: 'December', style: 'tableHeader', alignment: 'center', bold: true },
|
||||||
col_15: { text: 'Total Amount', style: 'tableHeader', alignment: 'center', bold: true },
|
col_15: { text: 'Total Amount', style: 'tableHeader', alignment: 'center', bold: true },
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var body = [];
|
var body = [];
|
||||||
for (var key in headers) {
|
for (var key in headers) {
|
||||||
if (headers.hasOwnProperty(key)) {
|
if (headers.hasOwnProperty(key)) {
|
||||||
var header = headers[key];
|
var header = headers[key];
|
||||||
var row = new Array();
|
var row = new Array();
|
||||||
row.push(header.col_1);
|
row.push(header.col_1);
|
||||||
row.push(header.col_2);
|
row.push(header.col_2);
|
||||||
row.push(header.col_3);
|
row.push(header.col_3);
|
||||||
row.push(header.col_4);
|
row.push(header.col_4);
|
||||||
row.push(header.col_5);
|
row.push(header.col_5);
|
||||||
row.push(header.col_6);
|
row.push(header.col_6);
|
||||||
row.push(header.col_7);
|
row.push(header.col_7);
|
||||||
row.push(header.col_8);
|
row.push(header.col_8);
|
||||||
row.push(header.col_9);
|
row.push(header.col_9);
|
||||||
row.push(header.col_10);
|
row.push(header.col_10);
|
||||||
row.push(header.col_11);
|
row.push(header.col_11);
|
||||||
row.push(header.col_12);
|
row.push(header.col_12);
|
||||||
row.push(header.col_13);
|
row.push(header.col_13);
|
||||||
row.push(header.col_14);
|
row.push(header.col_14);
|
||||||
row.push(header.col_15);
|
row.push(header.col_15);
|
||||||
|
|
||||||
body.push(row);
|
body.push(row);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (var key in rows1) {
|
console.log(rows1);
|
||||||
if (rows1.hasOwnProperty(key)) {
|
for (var key in rows1) {
|
||||||
var data = rows1[key];
|
if (rows1.hasOwnProperty(key)) {
|
||||||
var row = new Array();
|
var data = rows1[key];
|
||||||
row.push(data.SL_NO.toString());
|
|
||||||
row.push(data.Expense_name.toString());
|
var row = new Array();
|
||||||
row.push(data.January.toString());
|
row.push(data.SL_NO.toString());
|
||||||
row.push(data.February.toString());
|
row.push(data.Expense_name.toString());
|
||||||
row.push(data.March.toString());
|
row.push(data.January.toString());
|
||||||
row.push(data.April.toString());
|
row.push(data.February.toString());
|
||||||
row.push(data.May.toString());
|
row.push(data.March.toString());
|
||||||
row.push(data.June.toString());
|
row.push(data.April.toString());
|
||||||
row.push(data.July.toString());
|
row.push(data.May.toString());
|
||||||
row.push(data.August.toString());
|
row.push(data.June.toString());
|
||||||
row.push(data.September.toString());
|
row.push(data.July.toString());
|
||||||
row.push(data.October.toString());
|
row.push(data.August.toString());
|
||||||
row.push(data.November.toString());
|
row.push(data.September.toString());
|
||||||
row.push(data.December.toString());
|
row.push(data.October.toString());
|
||||||
row.push(data.total.toString());
|
row.push(data.November.toString());
|
||||||
body.push(row);
|
row.push(data.December.toString());
|
||||||
}
|
row.push(data.total.toString());
|
||||||
}
|
body.push(row);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
var docDefinition = {
|
var docDefinition = {
|
||||||
pageMargins: [20, 85, 20, 50],
|
pageMargins: [20, 85, 20, 50],
|
||||||
pageOrientation: 'landscape',
|
pageOrientation: 'landscape',
|
||||||
header: function () {
|
header: function () {
|
||||||
return {
|
return {
|
||||||
margin: 0,
|
margin: 0,
|
||||||
columns: [
|
columns: [
|
||||||
{
|
{
|
||||||
text: ['Expense Report' ],
|
text: ['Expense Report'],
|
||||||
alignment: 'left', bold: true, margin: [20, 30, 0, 0], fontSize: 18
|
alignment: 'left', bold: true, margin: [20, 30, 0, 0], fontSize: 18
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
footer: function (currentPage, pageCount) {
|
footer: function (currentPage, pageCount) {
|
||||||
if (currentPage === pageCount) {
|
if (currentPage === pageCount) {
|
||||||
return {
|
return {
|
||||||
columns: [
|
columns: [
|
||||||
{
|
{
|
||||||
text: ['Note'],
|
text: [''],
|
||||||
alignment: 'left', margin: [10, 0, 0, 0], fontSize: 8
|
alignment: 'left', margin: [10, 0, 0, 0], fontSize: 8
|
||||||
},
|
},
|
||||||
{ text: ['\n Page ' + currentPage.toString() + ' of ' + pageCount], alignment: 'right', margin: [0, 10, 10, 0], fontSize: 10 }
|
{ text: ['\n Page ' + currentPage.toString() + ' of ' + pageCount], alignment: 'right', margin: [0, 10, 10, 0], fontSize: 10 }
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: 'Page ' + currentPage.toString() + ' of ' + pageCount, alignment: 'right', margin: [0, 10, 10, 0], fontSize: 10
|
text: 'Page ' + currentPage.toString() + ' of ' + pageCount, alignment: 'right', margin: [0, 10, 10, 0], fontSize: 10
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
content: [
|
content: [
|
||||||
{
|
{
|
||||||
// layout: 'lightHorizontalLines', // optional
|
// layout: 'lightHorizontalLines', // optional
|
||||||
table: {
|
table: {
|
||||||
|
|
||||||
headerRows: 1,
|
headerRows: 1,
|
||||||
keepWithHeaderRows: 0,
|
keepWithHeaderRows: 0,
|
||||||
body: body
|
body: body
|
||||||
},
|
},
|
||||||
layout: {
|
layout: {
|
||||||
hLineWidth: function (i, node) {
|
hLineWidth: function (i, node) {
|
||||||
return 0.5;
|
return 0.5;
|
||||||
},
|
},
|
||||||
vLineWidth: function (i, node) {
|
vLineWidth: function (i, node) {
|
||||||
// return (i === 0 || i === node.table.widths.length) ? 0 : 40;
|
// return (i === 0 || i === node.table.widths.length) ? 0 : 40;
|
||||||
return 0.5;
|
return 0.5;
|
||||||
},
|
},
|
||||||
hLineColor: function (i, node) {
|
hLineColor: function (i, node) {
|
||||||
return '#2D4D81';
|
return '#2D4D81';
|
||||||
},
|
},
|
||||||
vLineColor: function (i, node) {
|
vLineColor: function (i, node) {
|
||||||
return '#2D4D81';
|
return '#2D4D81';
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
styles: {
|
styles: {
|
||||||
header: {
|
header: {
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
bold: true
|
bold: true
|
||||||
},
|
},
|
||||||
subheader: {
|
subheader: {
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
bold: true
|
bold: true
|
||||||
},
|
},
|
||||||
quote: {
|
quote: {
|
||||||
italics: true
|
italics: true
|
||||||
},
|
},
|
||||||
small: {
|
small: {
|
||||||
fontSize: 6
|
fontSize: 6
|
||||||
},
|
},
|
||||||
sta: {
|
sta: {
|
||||||
fontSize: 8,
|
fontSize: 8,
|
||||||
bold: false,
|
bold: false,
|
||||||
alignment: 'justify'
|
alignment: 'justify'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
pdfMake.createPdf(docDefinition).download('Expense Report).pdf', function(res) {
|
pdfMake.createPdf(docDefinition).download('Expense Report).pdf', function (res) {
|
||||||
if(res === 'success'){
|
if (res === 'success') {
|
||||||
$scope.$apply(function(){
|
$scope.$apply(function () {
|
||||||
$scope.loadStaring = false;
|
$scope.loadStaring = false;
|
||||||
});
|
});
|
||||||
}else{
|
} else {
|
||||||
$scope.$apply(function(){
|
$scope.$apply(function () {
|
||||||
$scope.loadStaring = false;
|
$scope.loadStaring = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
//end of pdf
|
//end of pdf
|
||||||
|
|
||||||
$scope.exportData = function () {
|
|
||||||
alasql('SELECT CAST(SL_NO AS NUMBER) as SLNO,Expense_name as ExpenseName,CAST(January as NUMBER) as January,CAST(February as NUMBER) as February,CAST(March as NUMBER) as March,CAST(April as NUMBER) as April,CAST(May as NUMBER) as May,CAST(June as NUMBER) as June,CAST(July as NUMBER) as July,CAST(August as NUMBER) as August,CAST(September as NUMBER) as September,CAST(October as NUMBER) as October,CAST(November as NUMBER) as November,CAST(December as NUMBER) as December,CAST(total as NUMBER) as Amount INTO XLS("Expense_report.xls",?) FROM ?',[mystyle,$scope.expense_data]);
|
|
||||||
};
|
|
||||||
}]);
|
}]);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -81,11 +81,11 @@
|
|||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
<input class="form-control" type="text" ng-model="search" id="searchIn" autofocus tabindex="2" placeholder="Search" />
|
<input class="form-control" type="text" ng-model="search" id="searchIn" autofocus tabindex="2" placeholder="Search" />
|
||||||
</div>
|
</div>
|
||||||
<!--<button pdf-save-button="getpdf" pdf-name="Expense_Report.pdf" class="btn btn-success btn-o">PDF</button>-->
|
<!-- <button pdf-save-button="getpdf" pdf-name="Expense_Report.pdf" class="btn btn-success btn-o">PDF</button> -->
|
||||||
<button class="btn btn-success btn-o" ng-click="exportData()">Export to Excel</button>
|
<button class="btn btn-success btn-o" ng-click="exportData()">Export to Excel</button>
|
||||||
<!--<button ng-disabled="loadStaring" ng-click="generatePFD(datas)" class="btn btn-sm btn-default">
|
<button ng-disabled="loadStaring" ng-click="generatePFD(expense)" class="btn btn-success btn-o">
|
||||||
Export As PDF
|
Export As PDF
|
||||||
</button>-->
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div pdf-save-content="getpdf" class="table-responsive" style="margin-top: 20px;">
|
<div pdf-save-content="getpdf" class="table-responsive" style="margin-top: 20px;">
|
||||||
<h4 style="text-align:center;">Apollo Distance Education College - {{expense_data[0].branch}}</h4>
|
<h4 style="text-align:center;">Apollo Distance Education College - {{expense_data[0].branch}}</h4>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user