diff --git a/Apollo/api/application/config/routes.php b/Apollo/api/application/config/routes.php index 470ac90b..31af1786 100755 --- a/Apollo/api/application/config/routes.php +++ b/Apollo/api/application/config/routes.php @@ -342,6 +342,7 @@ $route['promoteBatchInfomation'] = 'Reregister_Controller/promoteBatchInfomation //Reports $route['report_status'] = 'Report/status'; $route['report_filters'] = 'Report/filters'; +$route['report_filter'] = 'Report/filter'; $route['report_markcard'] = 'Report/markcard'; $route['report_certificate'] = 'Report/certificate'; $route['report_markcard_certificate'] = 'Report/mark_cert'; diff --git a/Apollo/api/application/controllers/Report.php b/Apollo/api/application/controllers/Report.php index b5eadac7..d75c01ae 100755 --- a/Apollo/api/application/controllers/Report.php +++ b/Apollo/api/application/controllers/Report.php @@ -368,6 +368,28 @@ class Report extends REST_Controller { } public function filters_post() + { + $br = $this->post('branch'); + $getStatus = $this->report_model->getUniversity($br); + //print_r($getStatus); + if ($getStatus) + { + $getStatus['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($getStatus, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code + } + else + { + // Set the response and exit + $this->response([ + 'message' => 'No records found!', + 'status' => REST_Controller::HTTP_NOT_FOUND + ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code + } + + + } + public function filter_post() { $br = $this->post('branch'); $getStatus['Univ'] = $this->report_model->getUniv($br); diff --git a/Apollo/assets/js/controllers/report_expenseCtrl.js b/Apollo/assets/js/controllers/report_expenseCtrl.js index 95cbace2..35ef9eb6 100755 --- a/Apollo/assets/js/controllers/report_expenseCtrl.js +++ b/Apollo/assets/js/controllers/report_expenseCtrl.js @@ -140,7 +140,201 @@ app.controller('report_expenseCtrl', ["$scope", "API_POINTS", "$http", "SweetAle }; //pdf - + $scope.generatePFD = function (datas) { + $scope.loadStaring = true; + + var o = {}; + var intDataSNo = 1; + var intDate = 0; + + for(var i = 0 ; i <= datas.length-1; ++i){ + var element = datas[i]; + //var element = datas[i-1]; + console.log('staff or trainee'); + var value = {}; + + value['SLNo'] = element.ORDER_ID; + value['Description'] = element.VoucherNumber; + value['January'] = element.PaidTo; + value['February'] = University; + value['March'] = element.Ty; + value['April'] = element.ReceiptNo || '-'; + value['May'] = element.ReceiptNoComments || '-'; + value['June'] = element.ModeOfPayment || '-'; + value['July'] = element.Status || '-'; + value['August'] = element.Status; + value['September'] = element.Balance || '-'; + value['Balance'] = element.Balance || '-'; + value['Balance'] = element.Balance || '-'; + value['Balance'] = element.Balance || '-'; + value['Balance'] = element.Balance || '-'; + o[intDate] = value; + intDate++; + intDataSNo++; + } + + rows1 = o; + var headers = { + fila_1: { + col_1: { text: 'SNo', style: 'tableHeader', alignment: 'center', bold: true }, + col_2: { text: 'Voucher Number Bill Number / DATE', style: 'tableHeader', alignment: 'center', bold: true }, + col_3: { text: 'Paid To Received From', style: 'tableHeader', alignment: 'center', bold: true }, + col_4: { text: 'University / Course/ Sem', style: 'tableHeader', alignment: 'center', bold: true }, + col_5: { text: 'Type', style: 'tableHeader', alignment: 'center', bold: true }, + col_6: { text: 'Receipt No', style: 'tableHeader', alignment: 'center', bold: true }, + //col_7: { text: 'Comments', style: 'tableHeader', alignment: 'center', bold: true }, + col_7: { text: 'Mode of Payment', style: 'tableHeader', alignment: 'center', bold: true }, + col_8: { text: 'Status', style: 'tableHeader', alignment: 'center', bold: true }, + col_9: { text: 'Amount', style: 'tableHeader', alignment: 'center', bold: true }, + col_10: { text: 'Balance', style: 'tableHeader', alignment: 'center', bold: true }, + col_11: { text: 'Comments', style: 'tableHeader', alignment: 'center', bold: true }, + col_12: { text: 'Comments', style: 'tableHeader', alignment: 'center', bold: true }, + col_13: { text: 'Comments', style: 'tableHeader', alignment: 'center', bold: true }, + col_14: { text: 'Comments', style: 'tableHeader', alignment: 'center', bold: true }, + col_15: { text: 'Comments', style: 'tableHeader', alignment: 'center', bold: true }, + } + } + var body = []; + for (var key in headers) { + if (headers.hasOwnProperty(key)) { + var header = headers[key]; + var row = new Array(); + row.push(header.col_1); + row.push(header.col_2); + row.push(header.col_3); + row.push(header.col_4); + row.push(header.col_5); + row.push(header.col_6); + row.push(header.col_7); + row.push(header.col_8); + row.push(header.col_9); + row.push(header.col_10); + row.push(header.col_11); + row.push(header.col_12); + row.push(header.col_13); + row.push(header.col_14); + row.push(header.col_15); + + body.push(row); + } + } + for (var key in rows1) { + if (rows1.hasOwnProperty(key)) { + var data = rows1[key]; + var row = new Array(); + row.push(data.SNo.toString()); + row.push(data.Date.toString()); + row.push(data.PaidReceivedToFrom.toString()); + row.push(data.UnivCourseSem.toString()); + row.push(data.Type.toString()); + row.push(data.ReceiptNo.toString()); + row.push(data.ModeofPayment.toString()); + row.push(data.Status.toString()); + row.push(data.Amount.toString()); + row.push(data.Balance.toString()); + row.push(data.Comments.toString()); + row.push(data.Comments.toString()); + row.push(data.Comments.toString()); + row.push(data.Comments.toString()); + row.push(data.Comments.toString()); + body.push(row); + } + } + + + var docDefinition = { + pageMargins: [20, 85, 20, 50], + pageOrientation: 'landscape', + header: function () { + return { + margin: 0, + columns: [ + { + text: ['Expense Report' ], + alignment: 'left', bold: true, margin: [20, 30, 0, 0], fontSize: 18 + } + ] + } + }, + footer: function (currentPage, pageCount) { + if (currentPage === pageCount) { + return { + columns: [ + { + text: ['Note'], + 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 } + ] + }; + } else { + return { + text: 'Page ' + currentPage.toString() + ' of ' + pageCount, alignment: 'right', margin: [0, 10, 10, 0], fontSize: 10 + }; + } + }, + content: [ + { + // layout: 'lightHorizontalLines', // optional + table: { + + headerRows: 1, + keepWithHeaderRows: 0, + body: body + }, + layout: { + hLineWidth: function (i, node) { + return 0.5; + }, + vLineWidth: function (i, node) { + // return (i === 0 || i === node.table.widths.length) ? 0 : 40; + return 0.5; + }, + hLineColor: function (i, node) { + return '#2D4D81'; + }, + vLineColor: function (i, node) { + return '#2D4D81'; + }, + } + } + ], + styles: { + header: { + fontSize: 12, + bold: true + }, + subheader: { + fontSize: 12, + bold: true + }, + quote: { + italics: true + }, + small: { + fontSize: 6 + }, + sta: { + fontSize: 8, + bold: false, + alignment: 'justify' + } + } + }; + + + pdfMake.createPdf(docDefinition).download('Expense Report).pdf', function(res) { + if(res === 'success'){ + $scope.$apply(function(){ + $scope.loadStaring = false; + }); + }else{ + $scope.$apply(function(){ + $scope.loadStaring = false; + }); + } + }); + } //end of pdf $scope.exportData = function () { diff --git a/Apollo/assets/js/controllers/report_leadCtrl.js b/Apollo/assets/js/controllers/report_leadCtrl.js index 9a747096..41fb1c89 100644 --- a/Apollo/assets/js/controllers/report_leadCtrl.js +++ b/Apollo/assets/js/controllers/report_leadCtrl.js @@ -71,7 +71,7 @@ app.controller('report_leadCtrl', ["$scope", "$filter","$rootScope","$modal", "A $scope.filters = function () { var filterlist = { method: 'POST', - url: apiPoint.url + 'report_filters/', + url: apiPoint.url + 'report_filter/', headers: { 'Content-Type': 'application/json' }, diff --git a/Apollo/assets/views/report_expense.html b/Apollo/assets/views/report_expense.html index 8ebba350..abdac786 100755 --- a/Apollo/assets/views/report_expense.html +++ b/Apollo/assets/views/report_expense.html @@ -83,7 +83,9 @@ - +

Apollo Distance Education College - {{expense_data[0].branch}}