js.blade.php 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418
  1. <script src="http://code.highcharts.com/highcharts.js"></script>
  2. <script src="http://code.highcharts.com/maps/modules/map.js"></script>
  3. <script src="http://code.highcharts.com/maps/modules/exporting.js"></script>
  4. <script src="http://code.highcharts.com/mapdata/countries/us/us-all.js"></script>
  5. <?php
  6. $myTime = Carbon\Carbon::now();
  7. $fixYears = '20'.$myTime->format('y');
  8. $getStatus = \App\Model\Privillage\Role::where('id',Auth::user()->role_id)->value('akses');
  9. ?>
  10. @if($getStatus == 'administrator')
  11. <script>
  12. Highcharts.chart('sppRT-admin', {
  13. chart: {
  14. type: 'bar'
  15. },
  16. title:false,
  17. xAxis: {
  18. categories: [
  19. @foreach(\App\Model\Date\ListMonth::all() as $key => $value)
  20. '{{$value->nama}}',
  21. @endforeach
  22. ],
  23. title: {
  24. text: null
  25. }
  26. },
  27. yAxis: {
  28. min: 0,
  29. title: {
  30. text: 'UPT',
  31. align: 'high'
  32. },
  33. labels: {
  34. overflow: 'justify'
  35. }
  36. },
  37. tooltip: {
  38. valueSuffix: ' Jumlah'
  39. },
  40. plotOptions: {
  41. bar: {
  42. dataLabels: {
  43. enabled: true
  44. }
  45. }
  46. },
  47. legend: {
  48. layout: 'vertical',
  49. align: 'right',
  50. verticalAlign: 'top',
  51. x: -40,
  52. y: 80,
  53. floating: true,
  54. borderWidth: 1,
  55. backgroundColor:
  56. Highcharts.defaultOptions.legend.backgroundColor || '#FFFFFF',
  57. shadow: true
  58. },
  59. credits: {
  60. enabled: false
  61. },
  62. series: [
  63. {
  64. name: 'Total RT Terbit Diterbitkan',
  65. data: [
  66. @foreach(\App\Model\Date\ListMonth::all() as $key => $value)
  67. <?php
  68. if ($value->id_bulan == 1) {
  69. $minMonth = 12;
  70. $minYears = $fixYears - 1;
  71. }
  72. else{
  73. $minMonth = $value->id_bulan - 1;
  74. $minYears = $fixYears;
  75. }
  76. $pay_rt = \App\Model\SPP\RincianTagihan::whereMonth('bi_begin',$minMonth)->whereYear('bi_begin',$minYears)->where('status','paid')->where('status_izin','Perpanjangan')->where('bi_type',8)->count();
  77. $not_pay_rt = \App\Model\SPP\RincianTagihan::whereMonth('bi_begin',$minMonth)->whereYear('bi_begin',$minYears)->where('status','not paid')->where('status_izin','Perpanjangan')->where('bi_type',0)->count();
  78. $total_rt = $pay_rt + $not_pay_rt;
  79. ?>
  80. {{$total_rt}},
  81. @endforeach
  82. ]
  83. },
  84. {
  85. name: 'RT Terbayar ( H-60 s.d H-30 )',
  86. data: [
  87. @foreach(\App\Model\Date\ListMonth::all() as $key => $value)
  88. <?php
  89. if ($value->id_bulan == 1) {
  90. $minMonth = 12;
  91. $minYears = $fixYears - 1;
  92. }
  93. else{
  94. $minMonth = $value->id_bulan - 1;
  95. $minYears = $fixYears;
  96. }
  97. ?>
  98. {{\App\Model\SPP\RincianTagihan::whereMonth('bi_begin',$minMonth)->whereYear('bi_begin',$minYears)->where('status','paid')->where('status_izin','Perpanjangan')->where('bi_type',8)->count()}},
  99. @endforeach
  100. ]
  101. },
  102. {
  103. name: 'RT Terbayar ( H-30 s.d H ) Hasil TL UPT',
  104. data: [
  105. @foreach(\App\Model\Date\ListMonth::all() as $key => $value)
  106. <?php
  107. if ($value->id_bulan == 1) {
  108. $minMonth = 12;
  109. $minYears = $fixYears - 1;
  110. }
  111. else{
  112. $minMonth = $value->id_bulan - 1;
  113. $minYears = $fixYears;
  114. }
  115. ?>
  116. @if(\App\Model\SPP\RincianTagihan::where('status','paid')->get() == null)
  117. 0,
  118. @else
  119. {{\App\Model\SPP\RincianTagihan::where('status','paid')->whereMonth('bi_begin',$minMonth)->whereYear('bi_begin',$minYears)->where('status_izin','Perpanjangan')->where('katagori_spp','Pokok')->where('active',1)->count()}},
  120. @endif
  121. @endforeach
  122. ]
  123. },
  124. {
  125. name: 'RT Belum Terbayar ( Belum Jatuh Tempo )',
  126. data: [
  127. @foreach(\App\Model\Date\ListMonth::all() as $key => $value)
  128. <?php
  129. if ($value->id_bulan == 1) {
  130. $minMonth = 12;
  131. $minYears = $fixYears - 1;
  132. }
  133. else{
  134. $minMonth = $value->id_bulan - 1;
  135. $minYears = $fixYears;
  136. }
  137. ?>
  138. {{\App\Model\SPP\RincianTagihan::whereMonth('bi_begin',$minMonth)->whereYear('bi_begin',$minYears)->where('status_remainder',null)->where('status_izin','Perpanjangan')->where('bi_type',0)->where('status','not paid')->count()}},
  139. @endforeach
  140. ]
  141. },
  142. {
  143. name: 'RT Tidak Membayar ( Menjadi Reminder )',
  144. data: [
  145. @foreach(\App\Model\Date\ListMonth::all() as $key => $value)
  146. <?php
  147. if ($value->id_bulan == 1) {
  148. $minMonth = 12;
  149. $minYears = $fixYears - 1;
  150. }
  151. else{
  152. $minMonth = $value->id_bulan - 1;
  153. $minYears = $fixYears;
  154. }
  155. ?>
  156. {{\App\Model\SPP\RincianTagihan::whereMonth('bi_begin',$minMonth)->whereYear('bi_begin',$minYears)->where('status','not paid')->where('status_izin','Perpanjangan')->where('bi_type',0)->count()}},
  157. @endforeach
  158. ]
  159. },
  160. ]
  161. });
  162. </script>
  163. @endif
  164. <script>
  165. Highcharts.chart('sppRT', {
  166. chart: {
  167. type: 'bar'
  168. },
  169. title:false,
  170. xAxis: {
  171. categories: [
  172. @foreach(\App\Model\Date\ListMonth::all() as $key => $value)
  173. '{{$value->nama}}',
  174. @endforeach
  175. ],
  176. title: {
  177. text: null
  178. }
  179. },
  180. yAxis: {
  181. min: 0,
  182. title: {
  183. text: 'UPT',
  184. align: 'high'
  185. },
  186. labels: {
  187. overflow: 'justify'
  188. }
  189. },
  190. tooltip: {
  191. valueSuffix: ' Jumlah'
  192. },
  193. plotOptions: {
  194. bar: {
  195. dataLabels: {
  196. enabled: true
  197. }
  198. }
  199. },
  200. legend: {
  201. layout: 'vertical',
  202. align: 'right',
  203. verticalAlign: 'top',
  204. x: -40,
  205. y: 80,
  206. floating: true,
  207. borderWidth: 1,
  208. backgroundColor:
  209. Highcharts.defaultOptions.legend.backgroundColor || '#FFFFFF',
  210. shadow: true
  211. },
  212. credits: {
  213. enabled: false
  214. },
  215. series: [
  216. {
  217. name: 'Total RT Terbit Diterbitkan',
  218. data: [
  219. @foreach(\App\Model\Date\ListMonth::all() as $key => $value)
  220. <?php
  221. if ($value->id_bulan == 1) {
  222. $minMonth = 12;
  223. $minYears = $fixYears - 1;
  224. }
  225. else{
  226. $minMonth = $value->id_bulan - 1;
  227. $minYears = $fixYears;
  228. }
  229. $pay_rt = \App\Model\SPP\RincianTagihan::whereMonth('bi_begin',$minMonth)->whereYear('bi_begin',$minYears)->where('status','paid')->where('upt',$getUptName)->where('status_izin','Perpanjangan')->where('bi_type',8)->count();
  230. $not_pay_rt = \App\Model\SPP\RincianTagihan::whereMonth('bi_begin',$minMonth)->whereYear('bi_begin',$minYears)->where('status','not paid')->where('upt',$getUptName)->where('status_izin','Perpanjangan')->where('bi_type',0)->count();
  231. ?>
  232. {{$pay_rt + $not_pay_rt}},
  233. @endforeach
  234. ]
  235. },
  236. {
  237. name: 'RT Terbayar ( H-60 s.d H-30 )',
  238. data: [
  239. @foreach(\App\Model\Date\ListMonth::all() as $key => $value)
  240. <?php
  241. if ($value->id_bulan == 1) {
  242. $minMonth = 12;
  243. $minYears = $fixYears - 1;
  244. }
  245. else{
  246. $minMonth = $value->id_bulan - 1;
  247. $minYears = $fixYears;
  248. }
  249. ?>
  250. {{\App\Model\SPP\RincianTagihan::whereMonth('bi_begin',$minMonth)->whereYear('bi_begin',$minYears)->where('status','paid')->where('upt',$getUptName)->where('status_izin','Perpanjangan')->where('bi_type',8)->count()}},
  251. @endforeach
  252. ]
  253. },
  254. {
  255. name: 'RT Terbayar ( H-30 s.d H ) Hasil TL UPT',
  256. data: [
  257. @foreach(\App\Model\Date\ListMonth::all() as $key => $value)
  258. <?php
  259. if ($value->id_bulan == 1) {
  260. $minMonth = 12;
  261. $minYears = $fixYears - 1;
  262. }
  263. else{
  264. $minMonth = $value->id_bulan - 1;
  265. $minYears = $fixYears;
  266. }
  267. ?>
  268. @if(\App\Model\SPP\RincianTagihan::where('active',1)->where('status_izin','Perpanjangan')->where('katagori_spp','Pokok')->where('upt',$getUptName)->whereMonth('bi_begin',$minMonth)->whereYear('bi_begin',$minYears)->get() == null)
  269. 0,
  270. @else
  271. {{\App\Model\SPP\RincianTagihan::where('active',1)->whereMonth('bi_begin',$minMonth)->whereYear('bi_begin',$minYears)->where('upt',$getUptName)->where('status_izin','Perpanjangan')->where('katagori_spp','Pokok')->count()}},
  272. @endif
  273. @endforeach
  274. ]
  275. },
  276. {
  277. name: 'RT Belum Terbayar ( Belum Jatuh Tempo )',
  278. data: [
  279. @foreach(\App\Model\Date\ListMonth::all() as $key => $value)
  280. <?php
  281. if ($value->id_bulan == 1) {
  282. $minMonth = 12;
  283. $minYears = $fixYears - 1;
  284. }
  285. else{
  286. $minMonth = $value->id_bulan - 1;
  287. $minYears = $fixYears;
  288. }
  289. ?>
  290. {{\App\Model\SPP\RincianTagihan::whereMonth('bi_begin',$minMonth)->whereYear('bi_begin',$minYears)->where('status_remainder','null')->where('upt',$getUptName)->where('status_izin','Perpanjangan')->where('bi_type',0)->count()}},
  291. @endforeach
  292. ]
  293. },
  294. {
  295. name: 'RT Tidak Membayar ( Menjadi Reminder )',
  296. data: [
  297. @foreach(\App\Model\Date\ListMonth::all() as $key => $value)
  298. <?php
  299. if ($value->id_bulan == 1) {
  300. $minMonth = 12;
  301. $minYears = $fixYears - 1;
  302. }
  303. else{
  304. $minMonth = $value->id_bulan - 1;
  305. $minYears = $fixYears;
  306. }
  307. ?>
  308. {{\App\Model\SPP\RincianTagihan::whereMonth('bi_begin',$minMonth)->whereYear('bi_begin',$minYears)->where('status','not paid')->where('upt',$getUptName)->where('status_izin','Perpanjangan')->where('bi_type',0)->count()}},
  309. @endforeach
  310. ]
  311. },
  312. ]
  313. });
  314. </script>
  315. <script type="text/javascript">
  316. var map = am4core.create("chartdiv", am4maps.MapChart);
  317. </script>
  318. <script type="text/javascript" src="https://cdn.datatables.net/1.10.20/js/jquery.dataTables.min.js"></script>
  319. <script type="text/javascript">
  320. var j = jQuery.noConflict();
  321. var table = j('#server-side').DataTable({
  322. "lengthChange": true,
  323. orderCellsTop: true,
  324. fixedHeader: true,
  325. "processing": true,
  326. "serverSide": true,
  327. "ajax": {
  328. "type": "GET",
  329. "url": "{{ url()->current() }}",
  330. "data": function (d) {
  331. console.log(d);
  332. return j.extend({}, d, {
  333. "type": "WEB",
  334. <?php
  335. foreach ($_GET as $key => $value) {
  336. ?>
  337. "{{ $key }}": "{{ $value }}",
  338. <?php
  339. }
  340. ?>
  341. });
  342. },
  343. },
  344. "columns": [
  345. {
  346. "data": "no_spp",
  347. },
  348. {
  349. "data": "no_klien",
  350. },
  351. {
  352. "data": "nama_perusahaan",
  353. },
  354. {
  355. "data": "upt",
  356. },
  357. {
  358. "data": "bhp",
  359. },
  360. {
  361. "data": "bi_date",
  362. },
  363. {
  364. "data": null,
  365. "render": function (data, type, row, meta) {
  366. return '<center><a class="btn btn-success btn-sm text-white">Telah Bayar</a></center>';
  367. }
  368. },
  369. {
  370. "data": "due_date",
  371. },
  372. {
  373. "data": "pay_date",
  374. },
  375. {
  376. "data": "service_name",
  377. },
  378. {
  379. "data": null,
  380. "render": function (data, type, row, meta) {
  381. if (data.active == 1) {
  382. return 'Sudah Disetujui';
  383. }
  384. else if(data.active == null) {
  385. return 'Terbayarkan';
  386. }
  387. else {
  388. return 'Belum disetujui';
  389. }
  390. }
  391. },
  392. {
  393. "data": "method",
  394. },
  395. {
  396. "data": "tanggal_upaya",
  397. },
  398. {
  399. "data": null,
  400. "render": function (data, type, row, meta) {
  401. if(data.bukti_dukung != null) {
  402. return '<a href="{{url("spp/rt/lampiran")}}' + '/' + data.bukti_dukung + '" class="btn btn-info btn-sm"><i class="fa fa-download"></i></a>';
  403. }
  404. else {
  405. return '-';
  406. }
  407. }
  408. },
  409. {
  410. "data": "keterangan",
  411. }
  412. ],
  413. "ordering": true
  414. });
  415. </script>