<th rowspan="2"><div align="center">ราคา</div></th>
                                        </tr>

                                        <tr>
                                            <th><div align="center">วันที่ส่ง</div></th>
                                        <th><div align="center">ชื่อ/เล่มที่/เลขที่</div></th>
                                        <th><div align="center">ค่าส่ง</div></th>
                                        <th><div align="center">ราคาเปิด</div></th>
                                        <th><div align="center">ขายลด</div></th>
                                        <th><div align="center">ราคาขาย</div></th>
                                        </tr>
                                        </thead>
                                        <tbody>
                                            <?php 
//มีเงื่อนไข การกำหนดช่วงเวลาที่สั่ง
$getProductDocketByID = getProductDocketByID($idshop, $idshipment_period);
$i = 0;
$n = 0;
$sum_cost = 0;
$sum_price_transport = 0;
$price_order_total = 0;
foreach ($getProductDocketByID as $value) {
    $i++;
    $val_idfactory = $value['idfactory'];
    $val_name_factory = $value['name_factory'];
    $val_name_product = $value['name_product'];
    $val_price_unit = $value['price_unit'];
    $val_amount_product_order = $value['amount_product_order'];
    $val_name_unit = $value['name_unit'];
    $val_date_transport = $value['date_transport'];
    $date_transport = date_create($val_date_transport);
                        <?php 
            $getPayByID_check_add_payshop = getPayByIDcheckStatus($idshop, $val_idshipment_period);
            $val_status_check_add_payshop = $getPayByID_check_add_payshop['status_process'];
            $Beforeid2 = getBeforeid($val_idshipment_period);
            //ได้ค่าidรอบถัดไป --> อัพเดทรอบนี้ด้วย
            $val_before_idshipment_period_check = $Beforeid2['idshipment_period'];
            $getPayByID_check_finish_payshop = getPayByIDcheckStatus($idshop, $val_before_idshipment_period_check);
            $val_status_check_finish_payshop = $getPayByID_check_finish_payshop['status_process'];
            ?>

                        <?php 
            $n = 0;
            $sum_cost = 0;
            $sum_price_transport = 0;
            $getProductDocketByID = getProductDocketByID($idshop, $val_before_idshipment_period_check);
            foreach ($getProductDocketByID as $value) {
                $val_idfactory = $value['idfactory'];
                $val_name_factory = $value['name_factory'];
                $val_name_product = $value['name_product'];
                $val_price_unit = $value['price_unit'];
                $val_amount_product_order = $value['amount_product_order'];
                $val_name_unit = $value['name_unit'];
                $val_date_transport = $value['date_transport'];
                $date_transport = date_create($val_date_transport);
                $date_transport->add(new DateInterval('P543Y0M0DT0H0M0S'));
                $val_name_transport = $value['name_transport'];
                $val_volume = $value['volume'];
                if ($val_volume == NULL) {
                    $val_volume = "-";
                }