    <?php
        $change_cost_price = getMenuPermission('Change Cost Price');
    ?>
    
    <div class="row">
                 <?php
                $query_claim = "select * from purchase_order_details where purchase_order_no='$purchase_id' order by id desc;";
                $rsclaim = mysql_query($query_claim, $courier) or die(mysql_error());
                $row_rsclaim = mysql_fetch_assoc($rsclaim);
                $totalRows_rsclaim = mysql_num_rows($rsclaim);


                $query_claim_total = "select sum(qty_expected*cost_price_before_tax) as totalprice from purchase_order_details where purchase_order_no='$purchase_id';";
                $rsclaim_total = mysql_query($query_claim_total, $courier) or die(mysql_error());
                $row_rsclaim_total = mysql_fetch_assoc($rsclaim_total);
                $totalRows_rsclaim_total = mysql_num_rows($rsclaim_total);
                ?>
                
                
                <div class="portlet light">
                <div class="portlet-title">
                    <div class="caption">
                        <span class="caption-subject bold uppercase font-dark"> LIST OF ITEMS </span>
                    </div>
                    <div class="actions uppercase bold" style="color: blue;">
                        <b style="color:<?php if($patient_row['order_status']=='Not Saved'){echo 'red';}else{echo 'green';} ?>"> [ Status: <?php echo $patient_row['order_status']; ?> ]</b> &nbsp;|&nbsp;Expected Total Cost Price: GHS <?php echo number_format($row_rsclaim_total['totalprice'],2); ?>
                    </div>
                </div>
                <div class="portlet-body form">
                    <div class="row" style="height: 315px;overflow-y: scroll;overflow-x: hidden;">
                        <div class="col-lg-12 col-md-12 col-xs-12 col-sm-12">
                            <table width="100%" border="0" align="center" cellpadding="1" cellspacing="1" class="table table-bordered">
                                <thead>
                                    <tr>
                                        <th class="count">Item</th>
                                        <th>Price</th>
                                        <th>Qty</th>
                                        <th> Cost</th>
                                        <th> Action </th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <?php if ($totalRows_rsclaim > 0) { ?>   
                                        <?php
                                        do {
                                            $i = $i + 1;
                                            ?>
                                              <tr>
                                                          <td><?php echo strtoupper($row_rsclaim['item']); ?></td>
                    <td>
                         <input type="<?php if($change_cost_price == true){ echo 'text'; }else{ echo 'hidden';} ?>" id="itemprice<?php echo $row_rsclaim['id']; ?>" name="itemprice<?php echo $row_rsclaim['id']; ?>" style="width:50px; text-align:right" min="1" value="<?php echo $row_rsclaim['cost_price_before_tax']; ?>" onChange="searchItemsName('updateprice_purchase_order_details','#view_items_response_wrapper_2',<?php echo $row_rsclaim['id']; ?>,'no_field',this.value);">
                    </td>
                    <td><input type="number" id="itemqty<?php echo $row_rsclaim['id']; ?>" name="itemqty<?php echo $row_rsclaim['id']; ?>" style="width:50px;" min="1" value="<?php echo $row_rsclaim['qty_expected']; ?>" onChange="searchItemsName('updateqty_purchase_order_details','#view_items_response_wrapper_2',<?php echo $row_rsclaim['id']; ?>,'no_field',this.value);"></td>
                    <td><?php if($change_cost_price == true){ echo $row_rsclaim['qty_expected']*$row_rsclaim['cost_price_before_tax'];}else{ echo '-';} ?></td>
                    <td><span style="font-weight:bold;"> 
                            <a style="color:blue" href="#" onclick="searchItemsName('up_purchase_order_details','#view_items_response_wrapper_2',<?php echo $row_rsclaim['id']; ?>,'no_field');"><i class="fa fa-plus"></i></a>
                            | <a style="color:blue" href="#" onclick="searchItemsName('down_purchase_order_details','#view_items_response_wrapper_2',<?php echo $row_rsclaim['id']; ?>,'no_field');"><i class="fa fa-minus"></i></a>
                            | <a style="color:red;" href="#" onclick="delInformtion('del_purchase_order_details', '#view_items_response_wrapper_2', '<?php echo $row_rsclaim['id']; ?>', '<?php echo strtoupper($row_rsclaim['item']); ?> ?', 'You are about to Delete <?php echo strtoupper($row_rsclaim['item']); ?> from this Purchase Order.', '<?php echo strtoupper($row_rsclaim['item']); ?> Deleted Successfully !');"> <i id="trash_<?php echo $row_rsclaim['id']; ?>" class="icon-trash"></i> <i style="display: none;" id="spin_refresh_<?php echo $row_rsclaim['id']; ?>" class="fa fa-refresh fa-spin fa-fw"></i>  </a>
                        </span>
                    </td>
                    </tr>
                                        <?php } while ($row_rsclaim = mysql_fetch_assoc($rsclaim)); ?>
                                    <?php } else {
                                        echo '<tr><td colspan="7" style="background: linen"><div class="none">No Items Found. Search Items to Add to Purchase Order.</div></td></tr>';
                                    } ?>
                                </tbody>
                            </table> 
                        </div>
                    </div>
                </div>
            </div>
        </div>