"; $replaceWith = " "; error_reporting(-1); ini_set('display_errors', 1); } if (isset($_POST['order_id']) && $_POST['order_id'] != "") { $dcharge = "0.00"; $offercharge = "0.00"; $orderid = $_POST["order_id"]; $success_arr = array(); $execute = array(':orderid' => $orderid); $orderDetails = find("first", ORDER, "*", "where orderid =:orderid", $execute); $restaurantInfo = find("first", RESTAURANT, "restaurant_phone, restaurant_website, restaurant_streetaddress, restaurant_city, restaurant_state, restaurant_zip, restaurant_contact_name, restaurant_contact_phone, restaurant_contact_email", "where restaurant_id =:restaurant_id", array(":restaurant_id"=>$orderDetails["restaurant_id"])); // pr($restaurantInfo);exit; /*Update the appview status*/ if (isset($orderDetails['is_order_viewed_ora']) && $orderDetails['is_order_viewed_ora'] == '0') { $fields_appview = "is_order_viewed_ora=:is_order_viewed_ora"; $values_appview = "where orderid=:orderid"; $execute_appview = array(':is_order_viewed_ora' => '1', ':orderid' => $orderid); $update_appview = update(ORDER, $fields_appview, $values_appview, $execute_appview); } /**/ if ($orderDetails) { $execute1 = array(':restaurant_id' => $orderDetails['restaurant_id']); $res_detsils = find("first", RESTAURANT, "restaurant_delivery_charge, restaurant_name, preparation_time", "where restaurant_id =:restaurant_id", $execute1); if ($orderDetails['deliverytype'] == 'delivery') { $dcharge = $res_detsils['restaurant_delivery_charge']; } if ($orderDetails['offervalue'] != '') { $offercharge = ($orderDetails['ordersubtotal'] * $orderDetails['offervalue'] / 100); } if($orderDetails['preparation_time_minutes'] > 0) { $preparation_time_minutes = $orderDetails['preparation_time_minutes']; } else { $preparation_time_minutes = $res_detsils['preparation_time']; } $order_place_time = date('H:i', strtotime($orderDetails['orderdate'])); $order_ready_time = date('H:i', strtotime(date($order_place_time)." +".$preparation_time_minutes." minutes")); $time_pic_del = $order_ready_time; if (strtolower($orderDetails['payment_type']) == 'cc') { $payment_type = "Paid"; } else { $payment_type = "Not Paid "; } $deliverydoornumber = $orderDetails['deliverydoornumber']; $deliveryStreet = $orderDetails['deliverystreet']; $deliveryarea = $orderDetails['deliveryarea']; $deliverycity = $orderDetails['deliverycity']; $deliveryState = $orderDetails['deliverystate']; $deliveryzip = $orderDetails['deliveryzip']; $cust_address = ''; if ($deliveryStreet != '') $cust_address .= urldecode($deliveryStreet) . ' '; if ($deliverycity != '') $cust_address .= urldecode($deliverycity) . ' '; if ($deliveryState != '') $cust_address .= urldecode($deliveryState) . ' '; if ($deliveryzip != '') $cust_address .= $deliveryzip; $success_arr['value'] = $orderDetails; $success_arr['val'] = "OK"; $success_arr['order_date'] = date("d M. H:i", strtotime($orderDetails['orderdate'])); $success_arr['server_time'] = date("Y m d H:i:s"); $success_arr['time_pic_del'] = $time_pic_del; $success_arr['special_instration_id'] = $orderDetails['instructions']; $dibdetails = ''; $execute1 = array(':orderid' => $orderid); $or = find("all", RESTAURANT_CART, "*", "where orderid =:orderid", $execute1); $success_arr['OrderDetail'] = $dibdetails; $tax = ($orderDetails['ordersubtotal'] * $orderDetails['taxvalue'] / 100); $success_arr['taxvalue1'] = $tax; $success_arr['restaurant_delivery_charge'] = $dcharge; $success_arr['offercharge'] = $offercharge; $lineSeparator = str_repeat("-", $lineCount); $printable .= 'TXT_FONT_B'; $printable .= 'TXT_SIZE_30'; $printable .= 'ESC_ALIGN_CENTER'; $printable .= 'TXT_BOLD_ON'; $printable .= "#".$orderDetails["ordergenerateid"]; $printable .= 'TXT_FONT_A'; $printable .= 'TXT_BOLD_OFF'; $printable .= 'TXT_SIZE_01'; $printable .= $newLine; $printable .= $lineSeparator; $printable .= $newLine; $printable .= 'TXT_BOLD_OFF'; $printable .= 'TXT_SIZE_01'; $printable .= $success_arr['order_date']; $printable .= $newLine; $printable .= $lineSeparator; $printable .= $newLine; $printable .= 'TXT_FONT_A'; $printable .= 'TXT_SIZE_10'; $printable .= 'TXT_BOLD_ON'; $printable .= $payment_type; $printable .= 'TXT_BOLD_OFF'; $printable .= $newLine; $printable .= $lineSeparator; $printable .= $newLine; $printable .= 'TXT_FONT_A'; $printable .= 'TXT_SIZE_10'; $printable .= 'TXT_BOLD_ON'; $printable .= strtoupper($orderDetails['deliverytype']); $printable .= 'TXT_BOLD_OFF'; $printable .= $newLine; $printable .= 'Deliver by '.$order_ready_time; $printable .= 'TXT_BOLD_OFF'; $printable .= $newLine; $printable .= 'TXT_SIZE_01'; $printable .= 'ESC_ALIGN_LEFT'; if($success_arr['special_instration_id']!=''){ $printable .= $lineSeparator; $printable .= $newLine; $printable .= $_lang["Order Instructions"]; $printable .= $newLine; $printable .= 'TXT_SIZE_01'; $printable .= $success_arr['special_instration_id']; $printable .= 'TXT_SIZE_01'; $printable .= $newLine; } $printable .= 'TXT_SIZE_01'; $printable .= 'ESC_ALIGN_LEFT'; $printable .= $orderDetails["customername"]." ".$orderDetails["customerlastname"]; $printable .= $newLine; $printable .= $lineSeparator; $printable .= $newLine; $printable .= 'TXT_BOLD_OFF'; $printable .= 'TXT_SIZE_01'; $printable .= 'ESC_ALIGN_LEFT'; $printable .= wordwrap(($cust_address), 27); $printable .= $newLine; $printable .= $lineSeparator; $printable .= $newLine; $printable .= 'TXT_SIZE_01'; $printable .= 'ESC_ALIGN_LEFT'; $printable .= $orderDetails["customercellphone"]; $printable .= $newLine; $printable .= $lineSeparator; $printable .= $newLine; if ($or) { foreach ($or as $list) { $instruction = !empty($list['specialinstruction']) ? $_lang['instruction'].":"." TXT_SIZE_01" . $list['specialinstruction']."TXT_SIZE_01".$newLine : ""; $test1 = str_replace(";","; ",$list['menuname']); $test2 = str_replace("amp;","","$test1"); $test3 = str_replace("quot;",""","$test2"); $printable .= $list['quantity']." x ".(utf8_encode($test3)); //$printable .= $list['quantity']." x ".($list['menuname']); //$printable .= $list['quantity']." x ".(utf8_encode($list['menuname'])); $printable .= $newLine; $printable .= str_pad($list['tot_menuprice'], $lineCount, $padWith, STR_PAD_LEFT); $printable .= $newLine; if (!empty($list['addonsname'])) { $printable .= 'TXT_BOLD_ON'; $printable .= $list['main_menuaddons_addonsname']; $printable .= $newLine; $printable .= 'TXT_BOLD_OFF'; $printable .= '-- '.str_replace("£", "",implode($newLine."--", explode(",",$list['addonsname']))); $printable .= $newLine; } if($list['item_meta'] !=""){ $menuAddonsHtml = ''; $metaAddonsName = ""; foreach(json_decode($list['item_meta']) as $key=>$metaKey){ $menuAddonsHtml.="Size (".$key.") || "; foreach ($metaKey as $key=>$menutDetails){ $addons_group_name = find("first", "rt_restaurant_menuaddons", "menuaddons_addonsname", "WHERE menuaddons_id='".$key."'", array()); $addons_group_name = $addons_group_name['menuaddons_addonsname']." || "; $addons_group_name .= $metaAddonsName; $menuAddonsHtml .=$addons_group_name; foreach($menutDetails as $addonsDetails){ $menuAddonsHtml.=$addonsDetails->addon_name; } } } $topping = $menuAddonsHtml; $printable .= wordwrap(($topping), 27); } $printable .= $instruction; $printable .= $newLine; } } $printable .= $lineSeparator; $printable .= $newLine; $printable .= str_pad($_lang["Item-total"].": ".str_pad($orderDetails["menuprice_total"], 10,$padWith,STR_PAD_LEFT), $lineCount, $padWith, STR_PAD_LEFT); $printable .= $newLine; if($orderDetails["offervalue"] != ""){ $printable .= str_pad($_lang["Discount"].": ".str_pad(number_format($orderDetails["offervalue"],2), 10,$padWith,STR_PAD_LEFT), $lineCount, $padWith, STR_PAD_LEFT); $printable .= $newLine; } if($orderDetails["delivery_charged"] > 0 && strtolower($orderDetails["deliverytype"]) == "delivery"){ $printable .= str_pad($_lang['Delivery Fee'].": ".str_pad($orderDetails["delivery_charged"], 10,$padWith,STR_PAD_LEFT), $lineCount, $padWith, STR_PAD_LEFT); $printable .= $newLine; } if($orderDetails["tip"] != "" ){ $printable .= str_pad($_lang["Tip"].": ".str_pad(number_format($orderDetails["tip"],2), 10,$padWith,STR_PAD_LEFT), $lineCount, $padWith, STR_PAD_LEFT); $printable .= $newLine; } if($orderDetails["point_amount"] > 0 ){ $printable .= str_pad($_lang["Used Point Amount"].": ".str_pad($orderDetails["point_amount"], 10,$padWith,STR_PAD_LEFT), $lineCount, $padWith, STR_PAD_LEFT); $printable .= $newLine; } $printable .= $lineSeparator; $printable .= $newLine; $printable .= 'TXT_BOLD_ON'; $printable .= str_pad($_lang["Total"].": ".str_pad($orderDetails["ordertotalprice"], 10,$padWith,STR_PAD_LEFT), $lineCount, $padWith, STR_PAD_LEFT); $printable .= $newLine; $printable .= $lineSeparator; $printable .= $newLine; $printable .= 'TXT_SIZE_10'; $printable .= 'TXT_BOLD_OFF'; $printable .= $newLine; $printable .="\n\n\n\n"; $printable .="CUT_PAPER"; $success_arr['type'] = '1'; }else{ $success_arr['type'] = '0'; $success_arr['message'] = 'api_error'; } } else { $success_arr['type'] = '0'; $success_arr['message'] = 'api_error'; } echo str_replace($padWith, $replaceWith, $printable); exit; ?>