'' ) SELECT DISTINCT ref_order_id as ref_id FROM split_cte WHERE ref_order_id <> ''; "; $get_dist = mysqli_query($conn, $sql); $check_rows = mysqli_num_rows($get_dist); $ref_no='DE'.str_pad($set_deal['id'], 4, "0", STR_PAD_LEFT); $get_tot = mysqli_query($conn, "SELECT * FROM tbl_dealer_ef_sub where order_id = '$id'"); $check_tot_rows = mysqli_num_rows($get_tot); $sub_tot = 0; if($check_tot_rows > 0){ while($set_tot = mysqli_fetch_assoc($get_tot)){ $sub_tot+=$set_tot['tot_price']; } } $sql1="WITH RECURSIVE split_cte AS ( SELECT id, order_id, TRIM(SUBSTRING_INDEX(ref_order_id, ' ', 1)) AS ref_order_id, TRIM(SUBSTRING(ref_order_id, LENGTH(SUBSTRING_INDEX(ref_order_id, ' ', 1)) + 2)) AS remaining FROM tbl_dealer_ef_sub WHERE ref_order_id IS NOT NULL AND order_id = '$id' UNION ALL SELECT id, order_id, TRIM(SUBSTRING_INDEX(remaining, ' ', 1)) AS ref_order_id, TRIM(SUBSTRING(remaining, LENGTH(SUBSTRING_INDEX(remaining, ' ', 1)) + 2)) AS remaining FROM split_cte WHERE remaining IS NOT NULL AND remaining <> '' ) SELECT DISTINCT ref_order_id AS ref_order_id FROM split_cte WHERE ref_order_id <> ''; "; $get_sub_max = mysqli_query($conn, $sql1); while($set_sub_max = mysqli_fetch_assoc($get_sub_max)){ $get_tot = mysqli_query($conn, "SELECT SUM(totprice) as total_price from tbl_order where orderid='".$set_sub_max['ref_order_id']."'"); $set_tot = mysqli_fetch_assoc($get_tot); $totprice+=$set_tot['total_price']; } ?> 0) { while ($set_user = mysqli_fetch_assoc($get_user)){ array_push($disc_arr, $set_user['user_id']); } } $get_disc = mysqli_query($conn, "SELECT discount FROM shop_user where user_id='$dealer_id'"); $set_disc = mysqli_fetch_assoc($get_disc); $disc = $set_disc['discount']; $arr = array("11363"); if(in_array($dealer_id, $disc_arr)){ ?>




Contact:
Order Id :
Date :
REQUEST AMOUNT :
0){ while($set_dist=mysqli_fetch_assoc($get_dist)){ $get_ref = mysqli_query($conn, "SELECT * FROM tbl_confirmorder where orderid='".$set_dist['ref_id']."' and orderstatus not in (90)"); $mycheck = mysqli_num_rows($get_ref); if($mycheck > 0){ $set_ref = mysqli_fetch_assoc($get_ref); $get_tot = mysqli_query($conn, "SELECT sum(totprice) as totprice FROM tbl_order where orderid='".$set_dist['ref_id']."'"); $set_tot = mysqli_fetch_assoc($get_tot); $discount = $set_ref['offer']; $temp_disc = ($set_tot['totprice'] * $discount) / 100; $disc_amount = $set_tot['totprice'] - $temp_disc; echo $set_ref['refid'].' = '.round($disc_amount).' Dt: '.date('d-m-Y', strtotime($set_ref['order_date_time'])).'
'; } } echo '
'; echo 'BILLED AMOUNT: '.round($totprice).''; echo '
'; } ?>

Anbu Phaarmaa

> 0){ while($set_list = mysqli_fetch_assoc($get_list)){ $get_prod = mysqli_query($conn, "select * from shop_product where product_id='".$set_list['prod_id']."'"); $set_prod = mysqli_fetch_assoc($get_prod); if($set_prod['vstatus']==10 || $set_prod['vstatus']==11){ $str='class="strikethrough" style="color:red"'; ?> > 0){ while($set_list = mysqli_fetch_assoc($get_list)){ $get_prod = mysqli_query($conn, "select * from shop_product where product_id='".$set_list['prod_id']."'"); $set_prod = mysqli_fetch_assoc($get_prod); if($set_prod['vstatus']==10 || $set_prod['vstatus']==11){ $str='class="strikethrough" style="color:red"'; ?> > 0){ while($set_list = mysqli_fetch_assoc($get_list)){ $get_prod = mysqli_query($conn, "select * from shop_product where product_id='".$set_list['prod_id']."'"); $set_prod = mysqli_fetch_assoc($get_prod); if($set_prod['vstatus']==10 || $set_prod['vstatus']==11){ $str='class="strikethrough" style="color:red"'; ?> >
# Product Content Rate Request Amount Billed Amount
DELETED
NO STOCK
CANCELLED
DELETED
TOTAL: TOTAL:
% DISCOUNT: % DISCOUNT:
NET TOTAL: NET TOTAL:

Energy Foods

> 0){ while($set_list = mysqli_fetch_assoc($get_list)){ $get_prod = mysqli_query($conn, "select * from shop_product where product_id='".$set_list['prod_id']."'"); $set_prod = mysqli_fetch_assoc($get_prod); if($set_prod['vstatus']==2 || $set_prod['vstatus']==7){ $str='class="strikethrough" style="color:red"'; ?> > 0){ while($set_list = mysqli_fetch_assoc($get_list)){ $get_prod = mysqli_query($conn, "select * from shop_product where product_id='".$set_list['prod_id']."'"); $set_prod = mysqli_fetch_assoc($get_prod); if($set_prod['vstatus']==2 || $set_prod['vstatus']==7){ $str='class="strikethrough" style="color:red"'; ?> > 0){ while($set_list = mysqli_fetch_assoc($get_list)){ $get_prod = mysqli_query($conn, "select * from shop_product where product_id='".$set_list['prod_id']."'"); $set_prod = mysqli_fetch_assoc($get_prod); if($set_prod['vstatus']==2 || $set_prod['vstatus']==7){ $str='class="strikethrough" style="color:red"'; ?> >
# Product Content Rate Request Amount Billed Amount
DELETED
NO STOCK
CANCELLED
DELETED
TOTAL: TOTAL:
% DISCOUNT: % DISCOUNT:
NET TOTAL: NET TOTAL:
PRINT




Contact:
Order Id :
Date :
REQUEST AMOUNT :
0){ while($set_dist=mysqli_fetch_assoc($get_dist)){ $get_ref = mysqli_query($conn, "SELECT * FROM tbl_confirmorder where orderid='".$set_dist['ref_id']."' and orderstatus not in (90)"); $mygcheck = mysqli_num_rows($get_ref); if($mygcheck > 0){ $set_ref = mysqli_fetch_assoc($get_ref); $get_tot = mysqli_query($conn, "SELECT sum(totprice) as totprice FROM tbl_order where orderid='".$set_dist['ref_id']."'"); $set_tot = mysqli_fetch_assoc($get_tot); echo $set_ref['refid'].' = '.$set_tot['totprice'].' Dt: '.date('d-m-Y', strtotime($set_ref['order_date_time'])).'
'; } } echo '
'; echo 'BILLED AMOUNT: '.round($totprice).''; echo '
'; } ?>

Anbu Phaarmaa

> 0){ while($set_list = mysqli_fetch_assoc($get_list)){ $get_prod = mysqli_query($conn, "select * from shop_product where product_id='".$set_list['prod_id']."'"); $set_prod = mysqli_fetch_assoc($get_prod); if($set_prod['vstatus']==10 || $set_prod['vstatus']==11){ $amount+=$set_list['tot_price']; $str='class="strikethrough" style="color:red"'; ?> > 0){ while($set_list = mysqli_fetch_assoc($get_list)){ $get_prod = mysqli_query($conn, "select * from shop_product where product_id='".$set_list['prod_id']."'"); $set_prod = mysqli_fetch_assoc($get_prod); if($set_prod['vstatus']==10 || $set_prod['vstatus']==11){ $amount+=$set_list['tot_price']; $str='class="strikethrough" style="color:red"'; ?> > 0){ while($set_list = mysqli_fetch_assoc($get_list)){ $get_prod = mysqli_query($conn, "select * from shop_product where product_id='".$set_list['prod_id']."'"); $set_prod = mysqli_fetch_assoc($get_prod); if($set_prod['vstatus']==10 || $set_prod['vstatus']==11){ $amount+=$set_list['tot_price']; $str='class="strikethrough" style="color:red"'; ?> >
# Product Content Rate Request Amount Billed Amount
DELETED
NO STOCK
CANCELLED
DELETED
TOTAL: TOTAL:

Energy Foods

> 0){ while($set_list = mysqli_fetch_assoc($get_list)){ $get_prod = mysqli_query($conn, "select * from shop_product where product_id='".$set_list['prod_id']."'"); $set_prod = mysqli_fetch_assoc($get_prod); if($set_prod['vstatus']==2 || $set_prod['vstatus']==7){ $amount+=$set_list['tot_price']; $str='class="strikethrough" style="color:red"'; ?> > 0){ while($set_list = mysqli_fetch_assoc($get_list)){ $get_prod = mysqli_query($conn, "select * from shop_product where product_id='".$set_list['prod_id']."'"); $set_prod = mysqli_fetch_assoc($get_prod); if($set_prod['vstatus']==2 || $set_prod['vstatus']==7){ $amount+=$set_list['tot_price']; $str='class="strikethrough" style="color:red"'; ?> > 0){ while($set_list = mysqli_fetch_assoc($get_list)){ $get_prod = mysqli_query($conn, "select * from shop_product where product_id='".$set_list['prod_id']."'"); $set_prod = mysqli_fetch_assoc($get_prod); if($set_prod['vstatus']==2 || $set_prod['vstatus']==7){ $amount+=$set_list['tot_price']; $str='class="strikethrough" style="color:red"'; ?> >
# Product Content Rate Request Amount Billed Amount
DELETED
NO STOCK
CANCELLED
DELETED
TOTAL: TOTAL:
PRINT




Contact:
Order Id :
Date :
REQUEST AMOUNT :
0){ while($set_dist=mysqli_fetch_assoc($get_dist)){ $get_ref = mysqli_query($conn, "SELECT * FROM tbl_confirmorder where orderid='".$set_dist['ref_id']."' and orderstatus not in (90)"); $mycheck = mysqli_num_rows($get_ref); if($mycheck > 0){ $set_ref = mysqli_fetch_assoc($get_ref); $get_tot = mysqli_query($conn, "SELECT sum(totprice) as totprice FROM tbl_order where orderid='".$set_dist['ref_id']."'"); $set_tot = mysqli_fetch_assoc($get_tot); echo $set_ref['refid'].' = '.$set_tot['totprice'].' Dt: '.date('d-m-Y', strtotime($set_ref['order_date_time'])).'
'; } } echo '
'; echo 'BILLED AMOUNT: '.round($totprice).''; echo '
'; } ?>

Anbu Phaarmaa

> 0){ while($set_list = mysqli_fetch_assoc($get_list)){ $get_prod = mysqli_query($conn, "select * from shop_product where product_id='".$set_list['prod_id']."'"); $set_prod = mysqli_fetch_assoc($get_prod); if($set_prod['vstatus']==10 || $set_prod['vstatus']==11){ $amount+=$set_list['tot_price']; $str='class="strikethrough" style="color:red"'; ?> > 0){ while($set_list = mysqli_fetch_assoc($get_list)){ $get_prod = mysqli_query($conn, "select * from shop_product where product_id='".$set_list['prod_id']."'"); $set_prod = mysqli_fetch_assoc($get_prod); if($set_prod['vstatus']==10 || $set_prod['vstatus']==11){ $amount+=$set_list['tot_price']; $str='class="strikethrough" style="color:red"'; ?> > 0){ while($set_list = mysqli_fetch_assoc($get_list)){ $get_prod = mysqli_query($conn, "select * from shop_product where product_id='".$set_list['prod_id']."'"); $set_prod = mysqli_fetch_assoc($get_prod); if($set_prod['vstatus']==10 || $set_prod['vstatus']==11){ $amount+=$set_list['tot_price']; $str='class="strikethrough" style="color:red"'; ?> >
# Product Content Rate Request Amount Billed Amount
DELETED
NO STOCK
CANCELLED
DELETED
TOTAL: TOTAL:

Energy Foods

> 0){ while($set_list = mysqli_fetch_assoc($get_list)){ $get_prod = mysqli_query($conn, "select * from shop_product where product_id='".$set_list['prod_id']."'"); $set_prod = mysqli_fetch_assoc($get_prod); if($set_prod['vstatus']==2 || $set_prod['vstatus']==7){ $amount+=$set_list['tot_price']; $str='class="strikethrough" style="color:red"'; ?> > 0){ while($set_list = mysqli_fetch_assoc($get_list)){ $get_prod = mysqli_query($conn, "select * from shop_product where product_id='".$set_list['prod_id']."'"); $set_prod = mysqli_fetch_assoc($get_prod); if($set_prod['vstatus']==2 || $set_prod['vstatus']==7){ $amount+=$set_list['tot_price']; $str='class="strikethrough" style="color:red"'; ?> > 0){ while($set_list = mysqli_fetch_assoc($get_list)){ $get_prod = mysqli_query($conn, "select * from shop_product where product_id='".$set_list['prod_id']."'"); $set_prod = mysqli_fetch_assoc($get_prod); if($set_prod['vstatus']==2 || $set_prod['vstatus']==7){ $amount+=$set_list['tot_price']; $str='class="strikethrough" style="color:red"'; ?> >
# Product Content Rate Request Amount Billed Amount
DELETED
NO STOCK
CANCELLED
DELETED
TOTAL: TOTAL:
PRINT