0){
$set_sub = mysqli_fetch_assoc($get_sub);
$insert_sub = "INSERT INTO tbl_order
(price, totprice, orderdate, ordertime, user_id, res_id, `type`, productid, session_id, orderid, qty, batchno, freeqty, need_shipping, custom_charge)
VALUES('".$set_sub['price']."', '".$set_sub['tot_price']."', '$dt2', '$time', '".$set_main['dealer_id']."', 0, '', '$option', '$browsessionid', '$attachmentfileid', '".$set_sub['qty']."', 'va', '".$set_sub['free_qty']."', '', '');";
mysqli_query($conn, $insert_sub);
$update_sub = "UPDATE tbl_dealer_ef_sub set ref_order_id = '$attachmentfileid' where prod_id = '$option' and order_id='$bill_id'";
mysqli_query($conn, $update_sub);
}
}
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://drganbuganapathi.com/superadmin/order-admin/phpaction/test_ajax_api.php',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 3,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'{
"refid" : "'.$orderid_new_s.'"
}',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json'
),
));
curl_exec($curl);
curl_close($curl);
echo '
Energy Food Cash order placed successfully with refid '.$orderid_new_s.'
';
}else{
echo '
Energy Food Cash order not created, contact contact Tech Team.
';
}
}
if(!empty($option_ap)){
$browsessionid = session_id();
$objcorderid = mysqli_query($conn, "SELECT * from tbl_confirmorder ");
$nosnewcid=mysqli_num_rows($objcorderid);
$Fetcorderid = mysqlI_fetch_array($objcorderid, MYSQLI_ASSOC);
$objcorderid_new = mysqli_query($conn, "SELECT * FROM `tbl_confirmorder` WHERE varstatus='Cash' and `orderid` in (select orderid from tbl_order)");
$nosnewcid_new=mysqli_num_rows($objcorderid_new) + 4;
$orderid_new_s='CO'.($nosnewcid_new);
$dt2=date('Y-m-d H:i:s' );
$time = date('H:i:s', strtotime($dt2));
$address = mysqli_real_escape_string($conn, $set_user['address']);
$Insert_memberord = "INSERT INTO tbl_confirmorder
(userid, res_id, intsessionid, `type`, refid, deliverydate, deliverytime, delivery_date1, delivery_time1, varstatus, order_tc_id, orderstatus, order_date_time, order_afterdate_time, contry, city, state, address, pin, couriername, courier_no, refund_time, d_stat, paypalamount, company_name, offer, country_id, dif_name, dif_phone, packing, packing_date, no_note, returned_reason, need_shipping, custom_charge, courier_amount, passport_file)
VALUES('".$set_main['dealer_id']."', 14, '$browsessionid', '', '$orderid_new_s', '', '', '', '', 'Cash', '1', 0, '$dt2', '', '".$set_user['country']."', '".$set_user['city']."', '".$set_user['state']."', '$address', '".$set_user['postcode']."', '', '', '', 0, 0, 'Anbu Phaarmaa', '$discount', 0, '".$set_user['name']."', '".$set_user['phone']."', 0, '0000-00-00 00:00:00', 'nonote', '', NULL, NULL, '', '');";
if(mysqli_query($conn, $Insert_memberord)){
$attachmentfileid = mysqli_insert_id($conn);
$Updatecart = mysqli_query($conn, "UPDATE tbl_confirmorder SET `orderid`='$attachmentfileid' where orid='$attachmentfileid'");
foreach($option_ap as $option){
$get_sub = mysqli_query($conn, "SELECT * FROM tbl_dealer_ef_sub where prod_id = '$option' and order_id='$bill_id'");
$check_rows = mysqli_num_rows($get_sub);
if($check_rows > 0){
$set_sub = mysqli_fetch_assoc($get_sub);
$insert_sub = "INSERT INTO tbl_order
(price, totprice, orderdate, ordertime, user_id, res_id, `type`, productid, session_id, orderid, qty, batchno, freeqty, need_shipping, custom_charge)
VALUES('".$set_sub['price']."', '".$set_sub['tot_price']."', '$dt2', '$time', '".$set_main['dealer_id']."', 0, '', '$option', '$browsessionid', '$attachmentfileid', '".$set_sub['qty']."', 'va', '".$set_sub['free_qty']."', '', '');";
mysqli_query($conn, $insert_sub);
$update_sub = "UPDATE tbl_dealer_ef_sub set ref_order_id = '$attachmentfileid' where prod_id = '$option' and order_id='$bill_id'";
mysqli_query($conn, $update_sub);
}
}
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://drganbuganapathi.com/superadmin/order-admin/phpaction/test_ajax_api.php',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 3,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'{
"refid" : "'.$orderid_new_s.'"
}',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json'
),
));
curl_exec($curl);
curl_close($curl);
echo '
Anbu Phaarmaa Cash order placed successfully with refid '.$orderid_new_s.'
';
}else{
echo '
Anbu Phaarmaa Cash order not created, contact contact Tech Team.
';
}
}
exit;
}else{
echo '
Bill Id not set to create bill, contact Tech Team.
';
}
?>