<aside class="right-side">
    <section class="content-header">
        <div class="title_bar">
            <h1 class="major_txt_color">Inventory – Purchase Management View</h1>
            <div class="breadcrumb_container"><?php echo breadcrumb_links();?></div>
        </div>
    </section>
    
    <section class="content">
        <div class="row">
            <div class="col-xs-12">
                <div class="box box-danger">
                    <div class="box-body">
                        <div class="col-xs-12">
                            <div class="col-md-5">                                
                                <div class="form-group">
                                    <span class="first-coln">Supplier Name</span>
                                    <span class="seperator">:</span>
                                    <span class="second-coln">
                                        <?php echo text($purchase->supplier_name);?>
                                    </span>
                                </div>
                                
                                <div class="form-group">
                                    <span class="first-coln">Invoice No</span>
                                    <span class="seperator">:</span>
                                    <span class="second-coln">
                                        <?php echo text($purchase->invoice_no);?>
                                    </span>
                                </div>
                                
                                <div class="form-group">
                                    <span class="first-coln">Purchase for</span>
                                    <span class="seperator">:</span>
                                    <span class="second-coln">
                                        <?php echo text($purchase->purchase_for);?>
                                    </span>
                                </div>
                            </div>
                            
                            <div class="col-md-5">
                                <div class="form-group">
                                    <span class="first-coln">Purchase Ref No</span>
                                    <span class="seperator">:</span>
                                    <span class="second-coln">
                                        <?php echo text($purchase->purchase_ref_no);?>
                                    </span>
                                </div>
                                
                                <div class="form-group">
                                    <span class="first-coln">Invoice Date</span>
                                    <span class="seperator">:</span>
                                    <span class="second-coln"><?php echo text_date($purchase->invoice_date);?></span>
                                </div>
                                
                                <div class="form-group">
                                    <span class="first-coln">Receivable Date</span>
                                    <span class="seperator">:</span>
                                    <span class="second-coln"><?php echo text_date(($purchase->receivable_date != "0000-00-00") ? date('d-m-Y',strtotime($purchase->receivable_date)) : "");?></span>
                                </div>
                            </div>
                        </div>
                        
                        <div class="col-xs-12">
                            <h4 class="major_txt_color">Item Details</h4>
                        </div><!-- /.box-header -->
                        
                        <div class="col-xs-12">
                            <div class="box-body table-responsive no-padding">
                                <table class="table table-bordered">
                                    <tr>
                                        <th style="text-align: center;">S.No.</th>
                                        <th style="text-align: center;">Category Name</th>
                                        <th style="text-align: center;">Item Name / UOM</th>
                                        <th style="text-align: center;">Quantity</th>
                                        <th style="text-align: center;">Price $</th>
                                        <th style="text-align: center;">Amount $</th>
                                    </tr>
                                    <?php foreach($po_items as $key => $item) {?>
                                        <?php $item_details = $this->purchase_management_model->get_items_cat_id($item->category_id,$item->item_id); ?>
                                        <tr>
                                            <td align="center"><?php echo ++ $key;?></td>
                                            <td><?php echo $item_details->category_name;?></td>
                                            <td><?php echo $item_details->item_name . ((!empty($item->unit_name)) ? ' / '. $item->unit_name : '');?></td>
                                            <td align="center"><?php echo $item->quantity;?></td>
                                            <td align="right"><?php echo $item->unit_price;?></td>
                                            <td align="right"><?php echo $item->amount;?></td>
                                        </tr>
                                    <?php } ?>
                                </table>
                            </div><!-- /.box-body -->
                        </div>
                        
                        <div class="col-xs-12" style="margin-top:2%;">
                            <div class="col-md-4">
                                <div class="form-group">
                                    <span class="first-coln">Total Amount</span>
                                    <span class="seperator">:</span>
                                    <span class="second-coln"><?php echo '$ ' . $purchase->total_amount; ?></span>
                                </div>
                                <div class="form-group">
                                    <span class="first-coln">Payment Status</span>
                                    <span class="seperator">:</span>
                                    <span class="second-coln"><?php echo $purchase->payment_status; ?></span>
                                </div>
                            </div>
                            
                            <div class="col-md-4">
                                <div class="form-group">
                                    <span class="first-coln">Description</span>
                                    <span class="seperator">:</span>
                                    <span class="second-coln"><?php echo nl2br($purchase->desc); ?></span>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="box-footer"></div>
                </div><!-- /.box -->
            </div><!-- /.col-xs-12 -->
        </div><!-- /.row -->
    </section><!-- /.content -->
</aside>