print-upt-bulan-tahun-not-paid.blade.php 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <!DOCTYPE html>
  2. <?php
  3. $getStatus = \App\Model\Privillage\Role::where('id',Auth::user()->role_id)->value('akses');
  4. if($getStatus == 'administrator'){
  5. $listUpt = \App\Model\Setting\UPT::select('office_id','office_name','province_name')->distinct()->get();
  6. }else{
  7. $listUpt = \App\Model\Setting\UPT::where('office_id', Auth::user()->upt)->select('office_id','office_name','province_name')->distinct()->get();
  8. }
  9. if($month == 1){
  10. $fixMonth = 12;
  11. $fixYear = $year - 1;
  12. } else{
  13. $fixMonth = $month - 1;
  14. $fixYear = $year;
  15. }
  16. ?>
  17. <html>
  18. <head>
  19. <style>
  20. .table-bordered {
  21. border-collapse: collapse;
  22. width: 100%;
  23. }
  24. .table-bordered td, .table-bordered th {
  25. border: 1px solid black;
  26. padding: 8px;
  27. }
  28. .thead-light{
  29. background-color: #E9ECEF;
  30. }
  31. .table-bordered th {
  32. padding-top: 12px;
  33. padding-bottom: 12px;
  34. text-align: left;
  35. }
  36. </style>
  37. </head>
  38. <body>
  39. <center>
  40. <div>
  41. <hr>
  42. <h2 class="font-weight-bolder">REKAP PENGIRIMAN LAPORAN</h2>
  43. <hr>
  44. <table id="example" class="table table-bordered align-items-center">
  45. <thead class="thead-light">
  46. <tr>
  47. <th class="tg-0pky" colspan="3"></th>
  48. <th class="tg-0lax" colspan="4" style="background-color: #63a53a; color: #fff; text-align: center;">RT BELUM TERBAYAR (H-30 s.d H)</th>
  49. <th class="tg-0lax" colspan="3" style="background-color: #ff1228; color: #fff;">RT TIDAK TERBAYAR (MENJADI REMINDER)</th>
  50. </tr>
  51. <tr>
  52. <td class="tg-0lax">UPT</td>
  53. <td class="tg-0lax">TOTAL RT TERBIT</td>
  54. <td class="tg-0lax">RT TERBAYAR</td>
  55. <td class="tg-0lax">% RT TERBAYAR</td>
  56. <td class="tg-0lax">JUMLAH RT YANG AKAN DI TL</td>
  57. <td class="tg-0lax">SUDAH DI-TL UPT</td>
  58. <td class="tg-0lax">BELUM DI-TL UPT</td>
  59. <td class="tg-0lax">% RT YANG DI TL</td>
  60. <td class="tg-0lax">Tanggal Upload</td>
  61. </tr>
  62. </thead>
  63. @foreach($listUpt as $key => $value)
  64. <tr>
  65. <td class="tg-0lax">{{$value->office_name}}</td>
  66. <?php
  67. $paid_rts = \App\Model\SPP\RincianTagihan::whereMonth('bi_begin',$fixMonth)->whereYear('bi_begin',$fixYear)->where('status','paid')->where('status_izin','Perpanjangan')->where('katagori_spp','Pokok')->where('upt',$value->office_name)->count();
  68. $nopaid_rts = \App\Model\SPP\RincianTagihan::whereMonth('bi_begin',$fixMonth)->whereYear('bi_begin',$fixYear)->where('status','not paid')->where('status_izin','Perpanjangan')->where('katagori_spp','Pokok')->where('upt',$value->office_name)->count();
  69. $total_rts = $paid_rts + $nopaid_rts;
  70. if ($paid_rts == 0) {
  71. $rt_terbayar = 0;
  72. }else{
  73. $rt_terbayar = $paid_rts / $total_rts * 100;
  74. }
  75. $sudah_tl = \App\Model\SPP\RincianTagihan::whereMonth('bi_begin',$fixMonth)->whereYear('bi_begin',$fixYear)->where('upt',$value->office_name)->where('status_izin','Perpanjangan')->where('katagori_spp','Pokok')->where('status','not paid')->where('active',1)->count();
  76. $belum_tl = $nopaid_rts - $sudah_tl;
  77. if ($sudah_tl == 0) {
  78. $rt_yang_tl = 0;
  79. }else{
  80. $rt_yang_tl = $sudah_tl / $nopaid_rts * 100;
  81. }
  82. $tanggal_upload = \App\Model\SPP\RincianTagihan::whereMonth('bi_begin',$fixMonth)->whereYear('bi_begin',$fixYear)->where('upt',$value->office_name)->where('active',1)->where('status_izin','Perpanjangan')->where('katagori_spp','Pokok')->select('updated_at')->distinct()->value('updated_at');
  83. $jumlah_rt = \App\Model\SPP\RincianTagihan::whereMonth('bi_begin',$fixMonth)->whereYear('bi_begin',$fixYear)->where('status','not paid')->where('status_izin','Perpanjangan')->where('katagori_spp','Pokok')->where('upt',$value->office_name)->count();
  84. ?>
  85. <td>{{$total_rts}}</td>
  86. <td>{{$paid_rts}}</td>
  87. <td>{{number_format($rt_terbayar, 2)}} %</td>
  88. <td>{{$nopaid_rts}}</td>
  89. <td>{{$sudah_tl}}</td>
  90. <td>{{$belum_tl}}</td>
  91. <td>{{number_format($rt_yang_tl, 2)}} &</td>
  92. <td>
  93. @if($tanggal_upload)
  94. {{\Carbon\Carbon::parse($tanggal_upload)
  95. ->format('d, M Y')}}
  96. @else
  97. Belum Mengirim
  98. @endif
  99. </td>
  100. </tr>
  101. @endforeach
  102. </table>
  103. <hr>
  104. </div>
  105. </center>
  106. </body>
  107. </html>