
            <div class="row">
                <div class="col-md-12">
                    <div class="portlet box grey-cascade">
                        <div class="portlet-title">
                            <div class="caption">
                                <i class="fa fa-gift"></i>Do Purchase
                            </div>
                        </div>
                        
                        <div class="portlet-body form">
                            <!-- BEGIN FORM-->
                            <form id="save_do_purchase" class="form-horizontal" method="POST" enctype="multipart/form-data">
                                <div class="alert alert-info"><strong>Info! </strong>Please Press add item button before submitting the invoice</div>
                                <div class="form-body">
                                    <div class="form-group">
                                        <label class="control-label col-md-3">Date</label>
                                        <div class="col-md-3">
                                            <input class="form-control form-control-inline input-medium date-picker" size="16" type="text" data-date-format=dd-mm-yyyy name="invoice_date" value="<?php echo date('d-m-Y') ?>"/>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="control-label col-md-3">Invoice Number</label>
                                        <div class="col-md-3">
                                            <input type="text" class="form-control input-medium" name="invoice_number"/>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="control-label col-md-3">22K Stock Type</label>
                                        <div class="col-md-3">
                                            <select class="form-control input-medium select2me" data-placeholder="Select..." name="k_stock_type">
                                                <option value="">Select a Stock type</option>
                                                <option value="DXB 22K">DXB 22K Stock</option>
                                                <option value="BOX 22K">BOX 22K Stock</option>
                                            </select>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="control-label col-md-3">Carrier Name</label>
                                        <div class="col-md-3">
                                            <select class="form-control input-medium select2me" data-placeholder="Select..." id="purchases_add_carrier" name="select_carrier">
                                                <option value="">Select Carrier</option>
                                                <option value="Add New Carrier">Add New Carrier</option>
                                                <?php
                                                    $carriers = $this->admin_db->get_carriers_to_do_purchases();
                                                    foreach ($carriers as $carrier) {
                                                        $sel = '';
                                                ?>

                                                <option value="<?php echo $carrier['id']; ?>" <?php echo $sel; ?> item_id="<?php echo $carrier['contact_number']; ?>"><?php echo $carrier['carrier_name']; ?></option>

                                                <?php } ?>
                                            </select>
                                        </div>
                                    </div>
                                    <div id="div_carrier_details" class="hidden">
                                        <div class="form-group">
                                            <label class="control-label col-md-3">Mobile Number</label>
                                            <div class="col-md-3">
                                                <input class="form-control" size="16" type="text" id="txt_car_contact_num" disabled="disabled"/>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="control-label col-md-3">Telephone Number</label>
                                            <div class="col-md-3">
                                                <input class="form-control" size="16" type="text" id="txt_car_tel_num" disabled="disabled"/>
                                            </div>
                                        </div>
                                    </div>
                                    <div id="add_new_carrier" class="hidden">
                                        <div class="form-group">
                                            <label class="control-label col-md-3">Carrier Name</label>
                                            <div class="col-md-3">
                                                <input type="text" name="carrier_name" id="carrier_name" placeholder="Type Here.." class="form-control"/>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="control-label col-md-3">Mobile Number</label>
                                            <div class="col-md-3">
                                                <input type="number" name="contact_num" id="contact_num" placeholder="Type Here.." class="form-control"/>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="control-label col-md-3">Telephone Number</label>
                                            <div class="col-md-3">
                                                <input type="number" name="tel_number" id="tel_number" placeholder="Type Here.." class="form-control"/>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="control-label col-md-3">Calculation</label>
                                        <div class="col-md-3">
                                            <table class="table table-striped table-bordered table-hover">
                                                <thead>
                                                    <tr>
                                                        <th><strong>Quantity - 22K</strong></th>
                                                        <th><strong>Carrier Charges Rate</strong></th>
                                                        <th><strong>Amount</strong></th>
                                                    </tr>
                                                </thead>
                                                <tbody>
                                                    <tr>
                                                        <th>
                                                            <div class="input-group input-small">
                                                                <input type="number" class="form-control input-small" name="quantity_1" id="quantity_1">
                                                                <span class="input-group-addon">
                                                                    g
                                                                </span>
                                                            </div>
                                                        </th>
                                                        <th>
                                                            <div class="input-group input-small">
                                                                <span class="input-group-addon">
                                                                    Rs.
                                                                </span>
                                                                <input type="number" class="form-control input-small" name="rate_1" id="rate_1">
                                                            </div>
                                                        </th>
                                                        <th>
                                                            <div id="div_amount_1">Rs. 0.00</div>
                                                            <input type="hidden" class="form-control input-small" name="amount_1" id="txt_amount_1">
                                                        </th>
                                                    </tr>
                                                    <tr>
                                                        <th>
                                                            <div class="input-group input-small">
                                                                <input type="number" class="form-control input-small" name="quantity_2" id="quantity_2">
                                                                <span class="input-group-addon">
                                                                    g
                                                                </span>
                                                            </div>
                                                        </th>
                                                        <th>
                                                            <div class="input-group input-small">
                                                                <span class="input-group-addon">
                                                                    Rs.
                                                                </span>
                                                                <input type="number" class="form-control input-small" name="rate_2" id="rate_2">
                                                            </div>
                                                        </th>
                                                        <th>
                                                            <div id="div_amount_2">Rs. 0.00</div>
                                                            <input type="hidden" class="form-control input-small" name="amount_2" id="txt_amount_2">
                                                        </th>
                                                    </tr>
                                                    <tr>
                                                        <th>
                                                            <div class="input-group input-small">
                                                                <input type="number" class="form-control input-small" name="quantity_3" id="quantity_3">
                                                                <span class="input-group-addon">
                                                                    g
                                                                </span>
                                                            </div>
                                                        </th>
                                                        <th>
                                                            <div class="input-group input-small">
                                                                <span class="input-group-addon">
                                                                    Rs.
                                                                </span>
                                                                <input type="number" class="form-control input-small" name="rate_3" id="rate_3">
                                                            </div>
                                                        </th>
                                                        <th>
                                                            <div id="div_amount_3">Rs. 0.00</div>
                                                            <input type="hidden" class="form-control input-small" name="amount_3" id="txt_amount_3">
                                                        </th>
                                                    </tr>
                                                    <tr>
                                                        <th>
                                                            <div class="input-group input-small">
                                                                <input type="number" class="form-control input-small" name="quantity_4" id="quantity_4">
                                                                <span class="input-group-addon">
                                                                    g
                                                                </span>
                                                            </div>
                                                        </th>
                                                        <th>
                                                            <div class="input-group input-small">
                                                                <span class="input-group-addon">
                                                                    Rs.
                                                                </span>
                                                                <input type="number" class="form-control input-small" name="rate_4" id="rate_4">
                                                            </div>
                                                        </th>
                                                        <th>
                                                            <div id="div_amount_4">Rs. 0.00</div>
                                                            <input type="hidden" class="form-control input-small" name="amount_4" id="txt_amount_4">
                                                        </th>
                                                    </tr>
                                                    <tr>
                                                        <th>
                                                            <div class="input-group input-small">
                                                                <input type="number" class="form-control input-small" name="quantity_5" id="quantity_5">
                                                                <span class="input-group-addon">
                                                                    g
                                                                </span>
                                                            </div>
                                                        </th>
                                                        <th>
                                                            <div class="input-group input-small">
                                                                <span class="input-group-addon">
                                                                    Rs.
                                                                </span>
                                                                <input type="number" class="form-control input-small" name="rate_5" id="rate_5">
                                                            </div>
                                                        </th>
                                                        <th>
                                                            <div id="div_amount_5">Rs. 0.00</div>
                                                            <input type="hidden" class="form-control input-small" name="amount_5" id="txt_amount_5">
                                                        </th>
                                                    </tr>
                                                </tbody>
                                            </table>
                                        </div>
                                    </div>
                                    <!-- BEGIN CREDIT BILLS PORTLET-->
                                    <div class="form-body">
                                        <div class="portlet-body">
                                            <div class="table-scrollable">    
                                                <table class="table table-striped table-bordered table-hover" id="">
                                                    <thead>
                                                        <tr>
                                                            <th style=""><strong>Supplier Name</strong></th>
                                                            <th style=""><strong>Invoice Number</strong></th>
                                                            <th style=""><strong>Invoice Weight</strong></th>
                                                            <th style=""><strong>Actual Weight</strong></th>
                                                            <th style=""><strong>Pending Weight</strong></th>
                                                            <th style=""><strong>Received Weight</strong></th>
                                                            <th style="width: 3%"><strong></strong></th>
                                                        </tr>
                                                    </thead>
                                                    <tbody id="purchase_supplier_table">

                                                    </tbody>
                                                        <tr>
                                                            <td>
                                                                <select class="form-control select2me input-medium" name="purchase_supplier" id="purchase_supplier">
                                                                    <option value="" itemid="">Please Select a Carrier</option>
                                                                    <?php
                                                                        $suppliers = $this->admin_db->get_suppliers_to_do_purchase();                       
                                                                        foreach ($suppliers as $supplier) {
                                                                    ?>

                                                                    <option value="<?php echo $supplier['supplier_name']; ?>" itemid="<?php echo $supplier['id']; ?>"><?php echo $supplier['supplier_name']; ?></option>

                                                                    <?php } ?>
                                                                </select>
                                                            </td>
                                                            <td>
                                                                <select class="form-control input-small select2me" name="purchase_invoice" id="purchase_invoice">
                                                                    <option value="Add New Invoice" itemid="">Add New Invoice</option>
                                                                </select>
                                                                <input type="text" class="form-control input-small" id="new_purchase_invoice" value="">
                                                            </td>
                                                            <td>
                                                                <div class="input-group input-small">
                                                                    <input type="text" class="form-control input-xsmall" id="invoice_weight" value="">
                                                                    <span class="input-group-addon">
                                                                        g
                                                                    </span>
                                                                </div>
                                                            </td>
                                                            <td>
                                                                <div class="input-group input-small">
                                                                    <input type="text" class="form-control input-xsmall" id="actual_weight" value="">
                                                                    <span class="input-group-addon">
                                                                        g
                                                                    </span>
                                                                </div>
                                                            </td>
                                                            <td>
                                                                <div class="input-group input-small">
                                                                    <input type="text" class="form-control input-xsmall" id="pending_weight" value="">
                                                                    <span class="input-group-addon">
                                                                        g
                                                                    </span>
                                                                </div>
                                                            </td>
                                                            <td>
                                                                <div class="input-group input-small">
                                                                    <input type="text" class="form-control input-xsmall" id="received_weight" value="">
                                                                    <span class="input-group-addon">
                                                                        g
                                                                    </span>
                                                                </div>
                                                            </td>
                                                            <td></td>
                                                        </tr>
                                                        <tr>
                                                            <th colspan="2"><strong>Total Weight</strong></th>
                                                            <th style="text-align: right;"><strong id="tot_invoice_weight">0.000 g</strong></th>
                                                            <th style="text-align: right;"><strong id="tot_actual_weight">0.000 g</strong></th>
                                                            <th style="text-align: right;"><strong id="tot_pending_weight">0.000 g</strong></th>
                                                            <th style="text-align: right;"><strong id="tot_received_weight">0.000 g</strong></th>
                                                        </tr>                                                  
                                                </table>
                                            </div>
                                            <div id="error" style="display: none; color: red; text-align: right; font-weight: 500"></div>
                                            <div style="text-align: right;" id="btn_append_purchase_supplier">
                                                <a class="btn default btn-xs purple" id="append_purchase_supplier">
                                                <i class="fa fa-edit"></i> Add Item </a>
                                            </div>
                                        </div>
                                    </div>
                                    <!-- END CREDIT BILLS PORTLET-->
                                    
                                    <div id="response_msg"></div>
                                
                                    <div class="invoice">
                                        <div class="row">
                                            <div class="col-xs-4"> </div>
                                            <div class="col-xs-8 invoice-block" align="right">
                                                <button type="submit" class="btn btn-lg green hidden-print margin-bottom-5">
                                                Submit Your Invoice <i class="fa fa-check"></i>
                                                </button>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                </div> 
            </div>
            <!-- END DASHBOARD STATS -->
        </div>
    </div>
    <!-- END CONTENT -->
</div>
<!-- END CONTAINER -->
