浏览代码

Note - "force" pro to ack cancellation before creating new bill

Vijayakrishnan 3 年之前
父节点
当前提交
acdb9de749
共有 2 个文件被更改,包括 18 次插入1 次删除
  1. 9 0
      app/Models/Note.php
  2. 9 1
      resources/views/app/patient/note/_create-bill.blade.php

+ 9 - 0
app/Models/Note.php

@@ -197,4 +197,13 @@ class Note extends Model
             ->orderBy('position_index', 'asc');
     }
 
+    public function hasUnacknowledgedCancelledBillsByPro(Pro $pro) {
+        return Bill::where('note_id', $this->id)
+            ->where('hcp_pro_id', $pro->id)
+            ->where('bill_service_type', '<>', 'GENERIC')
+            ->where('is_cancelled', true)
+            ->where('is_cancelled_by_administrator', true)
+            ->where('is_cancellation_acknowledged', false)
+            ->count();
+    }
 }

+ 9 - 1
resources/views/app/patient/note/_create-bill.blade.php

@@ -1,5 +1,11 @@
 <?php $noteRates = $note->hcpPro->noteRates(); ?>
 @if(!$note->is_bill_closed && !$note->is_billing_marked_done)
+    @if($note->hasUnacknowledgedCancelledBillsByPro($pro))
+        <b class="ml-3 text-warning-dark">
+            <i class="fa fa-exclamation-triangle"></i>
+            There are unacknowledged cancelled bills in this note!
+        </b>
+    @else
     <span class="mx-2 text-secondary">|</span>
     <div moe relative wide bottom class="">
         <a class="" href="" show start>Create Bill</a>
@@ -107,6 +113,7 @@
             <input type="hidden" name="numberOfUnits" value="1">
         </div>
     </div>
+    @endif
 @endif
 @if($note->is_bill_closed)
     <b class="ml-2 text-info">[BILLING CLOSED]</b>
@@ -140,6 +147,7 @@
         </span>
     @endif
 @endif
+@if(!$note->hasUnacknowledgedCancelledBillsByPro($pro))
 @if(!$note->is_billing_marked_done)
     <span class="mx-2 text-secondary">|</span>
     <span class="d-block" moe wide relative bottom>
@@ -168,7 +176,7 @@
         </form>
     </span>
 @endif
-
+@endif
 
 <script>
     (function() {