<?php

include("../../pidbco/pidbjoin.php");

if(isset($_POST['btn_view_data']))
{
    $ord = strip_tags(trim(base64_decode($_POST['ord'])));

    $qr1 = mysqli_query($con,"SELECT o.`id`, o.`ord_date`, o.`cust_id`, o.`bdo_id`, p.`cat_name`, o.`domain_nm`, o.`qtn_num`, o.`source`, o.`est_date`, o.`ord_amt`, o.`advance`, o.`order_details`, o.`amt_type`, o.`chq_date`, o.`chq_num`, o.`status` ,
ct.`company_name`, ct.`contact_person`, ct.`addline1`, ct.`addline2`, ct.`designation`, ct.`mob1`, ct.`mob2`, ct.`country`, ct.`state`, ct.`district`, ct.`loc`, ct.`email`
FROM `order_det` as o
LEFT JOIN `customers_det` as ct
ON o.`cust_id` =  ct.`id`
LEFT JOIN `category_det`  as p
ON o.`pro_cat_id` =  p.`id`
WHERE o.`id` = '{$ord}'");
    while($re1 = mysqli_fetch_object($qr1))
    {
       $sin_ord =  array(
                        'id'                => $re1->id,
                         'ord_date'         => $re1->ord_date,
                         'cust_id'          => $re1->cust_id,
                         'bdo_id'           => $re1->bdo_id,
                         'cat_name'         => $re1->cat_name,
                         'domain_nm'        => $re1->domain_nm,
                         'qtn_num'          => $re1->qtn_num,
                         'source'           => $re1->source,
                         'est_date'         => $re1->est_date,
                         'ord_amt'          => $re1->ord_amt,
                         'advance'          => $re1->advance,
                         'order_details'    => $re1->order_details,
                         'amt_type'         => $re1->amt_type,
                         'chq_date'         => $re1->chq_date,
                         'chq_num'          => $re1->chq_num,
                         'status'           => $re1->status,
                         'company_name'     => $re1->company_name,
                         'contact_person'   => $re1->contact_person,
                         'addline1'         => $re1->addline1,
                         'addline2'         => $re1->addline2,
                         'designation'      => $re1->designation,
                         'mob1'             => $re1->mob1,
                         'mob2'             => $re1->mob2,
                         'country'          => $re1->country,
                         'state'            => $re1->state,
                         'district'         => $re1->district,
                         'loc'              => $re1->loc,
                         'email'            => $re1->email
                    );

    }

?>
    <div class="col-md-12 col-sm-12 col-xs-12">
       <!-- <div class="x_panel">
            <div class="x_title">
                <h2>Order<small>Details</small></h2>
                <ul class="nav navbar-right panel_toolbox">
                    <li>
                        <a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
                    </li>
                    <li>
                        <a class="close-link"><i class="fa fa-close"></i></a>
                    </li>
                </ul>
                <div class="clearfix"></div>
            </div>
            <div class="x_content" >-->

                <div class="" role="tabpanel" data-example-id="togglable-tabs">
                    <ul id="myTab" class="nav nav-tabs bar_tabs" role="tablist">
                        <li role="presentation" class="active">
                            <a href="#tab_content1" id="home-tab" role="tab" data-toggle="tab" aria-expanded="true">Company</a>
                        </li>
                        <li role="presentation" class="">
                            <a href="#tab_content2" role="tab" id="profile-tab" data-toggle="tab"  aria-expanded="false">Order</a>
                        </li>
                        <li role="presentation" class="">
                            <a href="#tab_content3" role="tab" id="profile-tab2" data-toggle="tab" aria-expanded="false">Description</a>
                        </li>
                        <li>
                            <!--<button class="btn btn-default pull-right btn-sm" ><span class="fa fa-backward"></span></button>-->
                            <a href="Marketing-Order-Details" id="home-tab" ><i class="fa fa-mail-reply">Back</i></a>
                        </li>
                    </ul>
                    <div id="myTabContent" class="tab-content">
                        <div role="tabpanel" class="tab-pane fade active in" id="tab_content1" aria-labelledby="home-tab">

                            <div class="col-md-12">

                                <table class="table table-bordered">

                                    <tbody>
                                    <tr>
                                        <td>Company Name</td>
                                        <td><?php echo $sin_ord['company_name']; ?></td>
                                    </tr>
                                    <tr>
                                        <td>Contact Person</td>
                                        <td><?php echo $sin_ord['contact_person']; ?></td>
                                    </tr>
                                    <tr>
                                        <td>Address Line 1</td>
                                        <td><?php echo $sin_ord['addline1']; ?></td>
                                    </tr>
                                    <tr>
                                        <td>Address Line 2</td>
                                        <td><?php echo $sin_ord['addline2']; ?></td>
                                    </tr>
                                    <tr>
                                        <td>Designation</td>
                                        <td><?php echo $sin_ord['designation']; ?></td>
                                    </tr>
                                    <tr>
                                        <td>Phone 1</td>
                                        <td><?php echo $sin_ord['mob1']; ?></td>
                                    </tr>
                                    <tr>
                                        <td>Phone 2</td>
                                        <td><?php echo $sin_ord['mob2']; ?></td>
                                    </tr>
                                    <tr>
                                        <td>Country</td>
                                        <td><?php echo $sin_ord['country']; ?></td>
                                    </tr>
                                    <tr>
                                        <td>State</td>
                                        <td><?php echo $sin_ord['state']; ?></td>
                                    </tr>
                                    <tr>
                                        <td>District</td>
                                        <td><?php echo $sin_ord['district']; ?></td>
                                    </tr>
                                    <tr>
                                        <td>Location</td>
                                        <td><?php echo $sin_ord['loc']; ?></td>
                                    </tr>
                                    <tr>
                                        <td>Email</td>
                                        <td><?php echo $sin_ord['email']; ?></td>
                                    </tr>
                                    </tbody>
                                </table>


                            </div>

                        </div>
                        <div role="tabpanel" class="tab-pane fade" id="tab_content2" aria-labelledby="profile-tab">

                            <div class="col-md-12">

                                <table class="table table-bordered">

                                    <tbody>
                                    <tr>
                                        <td>Order Date</td>
                                        <td><?php echo $sin_ord['ord_date']; ?></td>
                                    </tr>
                                    <tr>
                                        <td>Category</td>
                                        <td><?php echo $sin_ord['cat_name']; ?></td>
                                    </tr>
                                    <tr>
                                        <td>Domain Preference</td>
                                        <td><?php echo $sin_ord['domain_nm']; ?></td>
                                    </tr>
                                    <tr>
                                        <td>Qtn Number</td>
                                        <td><?php echo $sin_ord['qtn_num']; ?></td>
                                    </tr>
                                    <tr>
                                        <td>Source</td>
                                        <td><?php echo $sin_ord['source']; ?></td>
                                    </tr>
                                    <tr>
                                        <td>Estimate Date</td>
                                        <td><?php echo $sin_ord['est_date']; ?></td>
                                    </tr>
                                    <tr>
                                        <td>Order Amount</td>
                                        <td><?php echo $sin_ord['ord_amt']; ?></td>
                                    </tr>
                                    <tr>
                                        <td>Advance</td>
                                        <td><?php echo $sin_ord['advance']; ?></td>
                                    </tr>
                                    <tr>
                                        <td>Amount Type</td>
                                        <td><?php if($sin_ord['amt_type'] == '1') { echo 'Cash'; }else{ echo 'Cheque'; } ?></td>
                                    </tr>
                                    <tr>
                                        <td>Chq. Number</td>
                                        <td><?php echo $sin_ord['chq_num']; ?></td>
                                    </tr>
                                    <tr>
                                        <td>Chq. Date</td>
                                        <td><?php echo $sin_ord['amt_date']; ?></td>
                                    </tr>
                                    </tbody>
                                </table>

                            </div>

                        </div>
                        <div role="tabpanel" class="tab-pane fade" id="tab_content3" aria-labelledby="profile-tab">

                            <div class="col-md-12">

                                <div class="panel panel-default">
                                    <div class="panel-heading">Description</div>
                                    <div class="panel-body">
                                        <?php echo $sin_ord['order_details']; ?>
                                    </div>
                                </div>

                            </div>

                        </div>
                    </div>
                </div>

            <!--</div>
        </div>-->
    </div>

<?php
}
?>
