Advertisement
gtiorgi

Untitled

Aug 2nd, 2016
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.72 KB | None | 0 0
  1. $scope.printTable = function () {
  2. var reportReq = {
  3. data: {
  4. month: $scope.month.getTime(),
  5. serviceObjectId: $scope.selectedServiceObject.id
  6. }
  7. };
  8. RequestHelper.processPOST("/api/cs/attendanceReport/exportNewPdf", reportReq, function (err, response) {
  9. var report = response[0];
  10.  
  11.  
  12. var statArr = new Array(report.attendanceStats.length + 2);
  13. statArr[0] = [
  14. {style: 'tableHeader', text: 'N'},
  15. {style: 'tableHeader', text: 'ოჯახის საიდენტ. კოდი'},
  16. {style: 'tableHeader', text: 'სახელი'},
  17. {style: 'tableHeader', text: 'გვარი'},
  18. {style: 'tableHeader', text: 'დაბადების თარიღი'},
  19. {style: 'tableHeader', text: 'პირადი ნომერი'},
  20. {style: 'tableHeader', text: 'მისამართი (სოც. დაუცველთა ბაზიდან)'},
  21. {style: 'tableHeader', text: 'სარეიტინგო ქულა'},
  22. {style: 'tableHeader', text: 'ჩატარებული გაკვ. რაოდ.'},
  23. {style: 'tableHeader', text: 'ასანაზღაურებელი გაკვ. რაოდ.'},
  24. {style: 'tableHeader', text: 'ანაზღაურებადი თანხა'}
  25. ];
  26. var sum1 = 0;
  27. var sum2 = 0;
  28. var sum3 = 0;
  29. var a;
  30. for (var i = 0; i < report.attendanceStats.length; i++) {
  31. a = report.attendanceStats[i];
  32. statArr[i + 1] = [
  33. i + 1 + "",
  34. a.socialFamilyNumber,
  35. a.firstName,
  36. a.lastName,
  37. $filter('date')(new Date(a.birthDate), 'shortDate'),
  38. a.pid,
  39. a.socialFamilyAddress,
  40. //a.guardPhone.toString());
  41. a.socialScore.toString(),
  42. a.visited + a.forgivenAbsence + "",
  43. a.paidServiceCount.toString(),
  44. a.totalPrice / 100 + ""
  45. ];
  46. sum1 = sum1 + a.visited + a.forgivenAbsence;
  47. sum2 = sum2 + a.paidServiceCount;
  48. sum3 = sum3 + a.totalPrice;
  49.  
  50. }
  51. statArr[statArr.length - 1] = [
  52. {style: 'sum', text: ''},
  53. {style: 'sum', text: ''},
  54. {style: 'sum', text: ''},
  55. {style: 'sum', text: ''},
  56. {style: 'sum', text: ''},
  57. {style: 'sum', text: ''},
  58. {style: 'sum', text: ''},
  59. {style: 'sum', text: ''},
  60. {style: 'sum', text: 'სულ: ' + sum1},
  61. {style: 'sum', text: 'სულ: ' + sum2},
  62. {style: 'sum', text: 'ჯამი: ' + ( sum3 / 100)}
  63. ];
  64.  
  65.  
  66. var printData = {
  67. pageOrientation: 'landscape',
  68. content: [
  69. {
  70. stack: [
  71. {
  72. text: [
  73. {text: 'დანართი № 2', style: ['topPdfProp']}
  74.  
  75. ]
  76.  
  77. }
  78. ],
  79. margin: [0, 0, 0, 0],
  80. alignment: 'right'
  81. },
  82. {
  83. stack: [
  84. {
  85. text: [
  86. {text: 'ბენეფიციართა რეესტრი: № ' + $filter('date')(new Date(), 'MM.yyyy'), style: ['topPdfProp']}
  87.  
  88. ]
  89.  
  90. }
  91. ],
  92. margin: [0, 20, 0, 0],
  93. alignment: 'justify'
  94. },
  95. {
  96. stack: [
  97. {
  98. text: [
  99. {text: 'ანგარიშგების პერიოდი 2016 წლის: ' + $filter('date')(new Date(), 'MMMM'), style: ['topPdfProp']}
  100.  
  101. ]
  102.  
  103. }
  104. ],
  105. margin: [0, 20, 0, 0],
  106. alignment: 'justify'
  107. },
  108. {
  109. stack: [
  110. {
  111. text: [
  112. {text: "დაწესებულების დასახელება: " + report.serviceObject.name, style: ['topPdfProp']}
  113.  
  114. ]
  115.  
  116. }
  117. ],
  118. margin: [0, 20, 0, 0],
  119. alignment: 'justify'
  120. },
  121. {
  122. stack: [
  123. {
  124. text: [
  125. {text: 'ქვეპროგრამის დასახელება: სოციალურად დაუცველი მოსახლეობის სერვისების მიწოდების დაფინანსება', style: ['topPdfProp']}
  126.  
  127. ]
  128.  
  129. }
  130. ],
  131. margin: [0, 20, 0, 0],
  132. alignment: 'justify'
  133. },
  134. {
  135. stack: [
  136. {
  137. text: [
  138. {text: 'კომპონენტის დასახელება, კოდი: __________________ უფასო სწავლება სპორტულ სკოლებში და საცურაო აუზებში, 06 02 06 03', style: ['topPdfProp']}
  139.  
  140. ]
  141.  
  142. }
  143. ],
  144. margin: [0, 20, 0, 0],
  145. alignment: 'justify'
  146. },
  147. {
  148. stack: [
  149. {
  150. text: [
  151. {text: 'დაფინანსების მეთოდი(სრული/არასრული): ' + (report.fullCompensation ? 'სრული' : 'არასრული'), style: ['topPdfProp']}
  152.  
  153. ]
  154.  
  155. }
  156. ],
  157. margin: [0, 20, 0, 0],
  158. alignment: 'justify'
  159. },
  160. {
  161. stack: [
  162. {
  163. text: [
  164. {text: 'დაწასებულების რეკვიზიტები:', style: ['topPdfProp']}
  165.  
  166. ]
  167.  
  168. }
  169. ],
  170. margin: [0, 20, 0, 0],
  171. alignment: 'justify'
  172. },
  173. {
  174. stack: [
  175. {
  176. text: [
  177. {text: 'საიდენთიფიკაციო კოდი: ______________________________', fontSize: 8, bold: false}
  178.  
  179. ]
  180.  
  181. }
  182. ],
  183. margin: [0, 20, 0, 0],
  184. alignment: 'justify'
  185. },
  186. {
  187. stack: [
  188. {
  189. text: [
  190. {text: 'სახაზინო/ბანკის კოდი: ______________________________', fontSize: 8, bold: false}
  191.  
  192. ]
  193.  
  194. }
  195. ],
  196. margin: [0, 20, 0, 0],
  197. alignment: 'justify'
  198. },
  199. {
  200. stack: [
  201. {
  202. text: [
  203. {text: 'ანგარიშის ნომერი: ______________________________', fontSize: 8, bold: false}
  204.  
  205. ]
  206.  
  207. }
  208. ],
  209. margin: [0, 20, 0, 0],
  210. alignment: 'justify'
  211. },
  212.  
  213.  
  214. {
  215. stack: [
  216. {
  217. style: 'table',
  218. table: {
  219. headerRows: 1,
  220. widths: [20, 60, 50, 80, 40, 50, 130, 50, 60, 70, 65, '*'],
  221. body: statArr,
  222. pageBreak: 'after'
  223. }
  224. }
  225. ],
  226. margin: [0, 20, 0, 0],
  227. alignment: 'justify'
  228. }
  229.  
  230. ],
  231. defaultStyle: {
  232. font: 'Geo',
  233. fontSize: 6
  234. },
  235. styles: {
  236. tableHeader: {
  237. font: 'GeoMtavruli',
  238. fontSize: 8,
  239. bold: true,
  240. pageBreak: 'after'
  241. },
  242. table: {
  243. fontSize: 7,
  244. bold: false
  245. },
  246. topPdfProp: {
  247. fontSize: 10,
  248. bold: true,
  249. margin: [0, 20, 0, 0]
  250. },
  251. sum: {
  252. font: 'GeoMtavruli',
  253. fontSize: 9,
  254. bold: true,
  255. margin: [5, 10, 5, 5]
  256.  
  257. }
  258. }
  259. };
  260. pdfMake.createPdf(printData).download();
  261.  
  262. });
  263.  
  264. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement