Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $scope.printTable = function () {
- var reportReq = {
- data: {
- month: $scope.month.getTime(),
- serviceObjectId: $scope.selectedServiceObject.id
- }
- };
- RequestHelper.processPOST("/api/cs/attendanceReport/exportNewPdf", reportReq, function (err, response) {
- var report = response[0];
- var statArr = new Array(report.attendanceStats.length + 2);
- statArr[0] = [
- {style: 'tableHeader', text: 'N'},
- {style: 'tableHeader', text: 'ოჯახის საიდენტ. კოდი'},
- {style: 'tableHeader', text: 'სახელი'},
- {style: 'tableHeader', text: 'გვარი'},
- {style: 'tableHeader', text: 'დაბადების თარიღი'},
- {style: 'tableHeader', text: 'პირადი ნომერი'},
- {style: 'tableHeader', text: 'მისამართი (სოც. დაუცველთა ბაზიდან)'},
- {style: 'tableHeader', text: 'სარეიტინგო ქულა'},
- {style: 'tableHeader', text: 'ჩატარებული გაკვ. რაოდ.'},
- {style: 'tableHeader', text: 'ასანაზღაურებელი გაკვ. რაოდ.'},
- {style: 'tableHeader', text: 'ანაზღაურებადი თანხა'}
- ];
- var sum1 = 0;
- var sum2 = 0;
- var sum3 = 0;
- var a;
- for (var i = 0; i < report.attendanceStats.length; i++) {
- a = report.attendanceStats[i];
- statArr[i + 1] = [
- i + 1 + "",
- a.socialFamilyNumber,
- a.firstName,
- a.lastName,
- $filter('date')(new Date(a.birthDate), 'shortDate'),
- a.pid,
- a.socialFamilyAddress,
- //a.guardPhone.toString());
- a.socialScore.toString(),
- a.visited + a.forgivenAbsence + "",
- a.paidServiceCount.toString(),
- a.totalPrice / 100 + ""
- ];
- sum1 = sum1 + a.visited + a.forgivenAbsence;
- sum2 = sum2 + a.paidServiceCount;
- sum3 = sum3 + a.totalPrice;
- }
- statArr[statArr.length - 1] = [
- {style: 'sum', text: ''},
- {style: 'sum', text: ''},
- {style: 'sum', text: ''},
- {style: 'sum', text: ''},
- {style: 'sum', text: ''},
- {style: 'sum', text: ''},
- {style: 'sum', text: ''},
- {style: 'sum', text: ''},
- {style: 'sum', text: 'სულ: ' + sum1},
- {style: 'sum', text: 'სულ: ' + sum2},
- {style: 'sum', text: 'ჯამი: ' + ( sum3 / 100)}
- ];
- var printData = {
- pageOrientation: 'landscape',
- content: [
- {
- stack: [
- {
- text: [
- {text: 'დანართი № 2', style: ['topPdfProp']}
- ]
- }
- ],
- margin: [0, 0, 0, 0],
- alignment: 'right'
- },
- {
- stack: [
- {
- text: [
- {text: 'ბენეფიციართა რეესტრი: № ' + $filter('date')(new Date(), 'MM.yyyy'), style: ['topPdfProp']}
- ]
- }
- ],
- margin: [0, 20, 0, 0],
- alignment: 'justify'
- },
- {
- stack: [
- {
- text: [
- {text: 'ანგარიშგების პერიოდი 2016 წლის: ' + $filter('date')(new Date(), 'MMMM'), style: ['topPdfProp']}
- ]
- }
- ],
- margin: [0, 20, 0, 0],
- alignment: 'justify'
- },
- {
- stack: [
- {
- text: [
- {text: "დაწესებულების დასახელება: " + report.serviceObject.name, style: ['topPdfProp']}
- ]
- }
- ],
- margin: [0, 20, 0, 0],
- alignment: 'justify'
- },
- {
- stack: [
- {
- text: [
- {text: 'ქვეპროგრამის დასახელება: სოციალურად დაუცველი მოსახლეობის სერვისების მიწოდების დაფინანსება', style: ['topPdfProp']}
- ]
- }
- ],
- margin: [0, 20, 0, 0],
- alignment: 'justify'
- },
- {
- stack: [
- {
- text: [
- {text: 'კომპონენტის დასახელება, კოდი: __________________ უფასო სწავლება სპორტულ სკოლებში და საცურაო აუზებში, 06 02 06 03', style: ['topPdfProp']}
- ]
- }
- ],
- margin: [0, 20, 0, 0],
- alignment: 'justify'
- },
- {
- stack: [
- {
- text: [
- {text: 'დაფინანსების მეთოდი(სრული/არასრული): ' + (report.fullCompensation ? 'სრული' : 'არასრული'), style: ['topPdfProp']}
- ]
- }
- ],
- margin: [0, 20, 0, 0],
- alignment: 'justify'
- },
- {
- stack: [
- {
- text: [
- {text: 'დაწასებულების რეკვიზიტები:', style: ['topPdfProp']}
- ]
- }
- ],
- margin: [0, 20, 0, 0],
- alignment: 'justify'
- },
- {
- stack: [
- {
- text: [
- {text: 'საიდენთიფიკაციო კოდი: ______________________________', fontSize: 8, bold: false}
- ]
- }
- ],
- margin: [0, 20, 0, 0],
- alignment: 'justify'
- },
- {
- stack: [
- {
- text: [
- {text: 'სახაზინო/ბანკის კოდი: ______________________________', fontSize: 8, bold: false}
- ]
- }
- ],
- margin: [0, 20, 0, 0],
- alignment: 'justify'
- },
- {
- stack: [
- {
- text: [
- {text: 'ანგარიშის ნომერი: ______________________________', fontSize: 8, bold: false}
- ]
- }
- ],
- margin: [0, 20, 0, 0],
- alignment: 'justify'
- },
- {
- stack: [
- {
- style: 'table',
- table: {
- headerRows: 1,
- widths: [20, 60, 50, 80, 40, 50, 130, 50, 60, 70, 65, '*'],
- body: statArr,
- pageBreak: 'after'
- }
- }
- ],
- margin: [0, 20, 0, 0],
- alignment: 'justify'
- }
- ],
- defaultStyle: {
- font: 'Geo',
- fontSize: 6
- },
- styles: {
- tableHeader: {
- font: 'GeoMtavruli',
- fontSize: 8,
- bold: true,
- pageBreak: 'after'
- },
- table: {
- fontSize: 7,
- bold: false
- },
- topPdfProp: {
- fontSize: 10,
- bold: true,
- margin: [0, 20, 0, 0]
- },
- sum: {
- font: 'GeoMtavruli',
- fontSize: 9,
- bold: true,
- margin: [5, 10, 5, 5]
- }
- }
- };
- pdfMake.createPdf(printData).download();
- });
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement