        @php
            $count_index = 0;
        @endphp
        @if ($status != 'actual' )
            @foreach($data_Details as $key => $value)
            @php
                $count_index = $key+1;
            @endphp
            <tr>
                <td width="5%">
                    <span>{{ $key+1 }}</span>
                </td>
                <td >
                    <input type="text" class="form-control" name="boq_work_type[]" placeholder=" Work Type"  value="{{ $value->name }}" readonly >
                </td>
                <td  >
                    <input type="text" class="form-control number-only boq" name="boq_labour[]" placeholder="Labour" data-value = "{{ $value->boq_labour }}"  value="${{ number_format($value->boq_labour,2) }}" readonly >
                </td>
                <td  >
                    <input type="text" class="form-control number-only boq" name="boq_material[]" placeholder="Material" data-value = "{{ $value->boq_material }}" value="${{ number_format($value->boq_material,2) }}" readonly >
                </td>
                <td  >
                    <input type="text" class="form-control number-only  " name="boq_total[]" placeholder="Total" readonly data-value = "{{ $value->boq_total }}" value="${{ number_format($value->boq_total,2) }}"  >
                </td>
            </tr>
            @endforeach 
            @if(!empty(@$data_other_epxenses))
                @foreach ($data_other_epxenses as $count_e=> $expense)
                    <tr>
                        <td width="5%">
                            <span>{{ $count_index + $count_e + 1 }}</span>
                        </td>
                        <td >
                            <input type="text" class="form-control" name="boq_work_type[]" placeholder=" Work Type"  value="{{ $expense->expense_description }}" readonly >
                        </td>
                        <td  >
                            <input type="text" class="form-control number-only boq" name="boq_labour[]" placeholder="Labour" data-value = "0"  value="${{ number_format(0,2) }}" readonly >
                        </td>
                        <td  >
                            <input type="text" class="form-control number-only boq" name="boq_material[]" placeholder="Material" data-value = "0" value="${{ number_format(0,2) }}" readonly >
                        </td>
                        <td  >
                            <input type="text" class="form-control number-only  " name="boq_total[]" placeholder="Total" readonly data-value = "0" value="${{ number_format(0,2) }}"  >
                        </td>
                    </tr>
                    @endforeach
            @endif
        @endif
        @if ($status == 'actual' )
            @foreach($data_Details as $key => $value)
                @php
                    $actual_material = 0;

                    $actual_material_po = DB::table("nso007_request_warehouse_detail_construction")
                        ->join("nso007_request_warehouse_construction","nso007_request_warehouse_detail_construction.request_warehouse_id","nso007_request_warehouse_construction.id")
                        ->where("project_id",$data->project_id)
                        ->where("nso007_request_warehouse_detail_construction.zone",$data->zone_id)
                        ->where("nso007_request_warehouse_construction.work_group_type_id",$value->boq_work_type)
                        ->select("nso007_request_warehouse_detail_construction.*")
                        ->get();

                    foreach($actual_material_po as $material_po){
                        $actual_material += $material_po->amount;
                    }

                    $actual_materials_contract = DB::table("nso007_task_contractor_work_construction")
                        ->join('nso007_construction_table','nso007_task_contractor_work_construction.construction_id','nso007_construction_table.id')
                        ->where("nso007_construction_table.project_id",$data->project_id)
                        ->where("nso007_construction_table.zone_name",$data->zone_id)
                        ->where("nso007_construction_table.work_group_type_id",$value->boq_work_type)
                        ->where("nso007_task_contractor_work_construction.task_type",2)
                        ->select("nso007_task_contractor_work_construction.*")
                        ->get();

                    foreach($actual_materials_contract as $material){
                        $actual_material += $material->paid_amount;
                    }

                    $actual_labour = 0;
                    $actual_labour_contract = DB::table("nso007_task_contractor_work_construction")
                        ->join('nso007_construction_table','nso007_task_contractor_work_construction.construction_id','nso007_construction_table.id')
                        ->where("nso007_construction_table.project_id",$data->project_id)
                        ->where("nso007_construction_table.zone_name",$data->zone_id)
                        ->where("nso007_construction_table.work_group_type_id",$value->boq_work_type)
                        ->where("nso007_task_contractor_work_construction.task_type",1)
                        ->select("nso007_task_contractor_work_construction.*")
                        ->get();

                    foreach($actual_labour_contract as $labour_contract){
                        $actual_labour += $labour_contract->paid_amount;
                    }

                @endphp
                <tr> 
                    <td >
                        <input type="text" class="form-control number-only actual" placeholder="Labour" data-value = "{{ $actual_labour }}"  value="${{ number_format($actual_labour,2) }}" name="actual_labour[]" readonly >
                    </td>
                    <td >
                        <input type="text" class="form-control number-only actual" placeholder="Material" data-value = "{{ $actual_material }}" value="${{ number_format($actual_material,2) }}" name="actual_material[]"  readonly >
                    <td >
                        <input type="text" class="form-control number-only" placeholder="Total" data-value = "{{ ($actual_labour + $actual_material) }}" value="${{ number_format(($actual_labour + $actual_material),2)  }}" name="actual_total[]" readonly>
                    </td> 
                    <td >
                        <input type="text" class="form-control number-only" placeholder="Total" data-value = "{{ ($value->boq_total - ($actual_labour + $actual_material)) }}" value="${{ number_format(($value->boq_total - ($actual_labour + $actual_material)),2)  }}" name="actual_total[]" readonly>
                    </td> 
                </tr>
            @endforeach
            @if(!empty(@$data_other_epxenses))
                @foreach ($data_other_epxenses as $count_e=> $expense)
                <tr> 
                    <td >
                        @if($expense->type==2)
                            <input type="text" class="form-control number-only actual" placeholder="Labour" data-value = "{{ $expense->amount }}"  value="${{ number_format($expense->amount,2) }}" name="actual_labour[]" readonly >
                        @else
                            <input type="text" class="form-control number-only actual" placeholder="Labour" data-value = "0"  value="${{ number_format(0,2) }}" name="actual_labour[]" readonly >
                        @endif
                    </td>
                    <td >
                        @if($expense->type==1)
                            <input type="text" class="form-control number-only actual" placeholder="Material" data-value = "{{ $expense->amount }}" value="${{ number_format($expense->amount,2) }}" name="actual_material[]"  readonly >
                        @else
                            <input type="text" class="form-control number-only actual" placeholder="Material" data-value = "{{ 0 }}" value="${{ number_format(0,2) }}" name="actual_material[]"  readonly >
                        @endif
                    <td >
                        <input type="text" class="form-control number-only expense-by-zone" placeholder="Total" data-value = "{{ ($expense->amount) }}" value="${{ number_format((0-$expense->amount),2)  }}" name="actual_total[]" readonly>
                    </td> 
                    <td >
                        <input type="text" class="form-control number-only total-expense-by-zone" placeholder="Total" data-value = "{{ (0 - $expense->amount) }}" value="${{ number_format(0-$expense->amount,2)  }}" name="actual_total[]" readonly>
                    </td> 
                </tr>
                @endforeach
        @endif
        @endif
        
