本文整理汇总了PHP中OrderDetail::getOrderDetailsByIDOrderForCalc方法的典型用法代码示例。如果您正苦于以下问题:PHP OrderDetail::getOrderDetailsByIDOrderForCalc方法的具体用法?PHP OrderDetail::getOrderDetailsByIDOrderForCalc怎么用?PHP OrderDetail::getOrderDetailsByIDOrderForCalc使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OrderDetail
的用法示例。
在下文中一共展示了OrderDetail::getOrderDetailsByIDOrderForCalc方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: calcRechnungAndSave
private function calcRechnungAndSave($id_restaurant, $id_order)
{
$order = new MasterOrderModel();
$order->getByID($id_order);
$objResto = User::getRestaurant($id_restaurant);
// pr($objResto );
$objOrder = MasterOrder::getOrder($id_order);
$arrOrderDetails = OrderDetail::getOrderDetailsByIDOrderForCalc($id_order);
$total = 0;
foreach ($arrOrderDetails as $orderDetails) {
// pr($orderDetails);
$total = $total + $orderDetails['price'];
}
$invoice['sub_total'] = strval($total);
$order->total_cost = $invoice['sub_total'];
if ($objResto['service_charge'] > 100) {
$invoice['service_charge'] = strval($objResto['service_charge']);
} else {
$invoice['service_charge'] = strval($objResto['service_charge'] / 100 * $total);
}
$order->service_charge = $invoice['service_charge'];
if ($objResto['other_charge'] > 100) {
$invoice['other_charge'] = strval($objResto['other_charge']);
} else {
$invoice['other_charge'] = strval($objResto['other_charge'] / 100 * $total);
}
$order->other_charge = $invoice['other_charge'];
if ($objResto['disc_mr'] > 100) {
$invoice['Discount_MR'] = strval($objResto['disc_mr']);
} else {
$invoice['Discount_MR'] = strval($objResto['disc_mr'] / 100 * $total);
}
$order->disc_mr = $invoice['Discount_MR'];
if ($objResto['disc_bank'] > 100) {
$invoice['Discount_Bank'] = strval($objResto['disc_bank']);
} else {
$invoice['Discount_Bank'] = strval($objResto['disc_bank'] / 100 * $total);
}
$order->disc_bank = $invoice['Discount_Bank'];
if ($objResto['disc_resto'] > 100) {
$invoice['Discount_Resto'] = strval($objResto['disc_resto']);
} else {
$invoice['Discount_Resto'] = strval($objResto['disc_resto'] / 100 * $total);
}
$order->disc_resto = $invoice['Discount_Resto'];
$invoice['Tax'] = strval($total * ($objResto['tax_pb_1'] / 100));
$order->tax_pb1 = $invoice['Discount_Resto'];
$invoice['Total'] = strval($total + $invoice['Tax'] + $invoice['service_charge'] + $invoice['other_charge'] - $invoice['Discount_MR'] - $invoice['Discount_Bank'] - $invoice['Discount_Resto']);
$order->grand_total = $invoice['Total'];
$order->save();
return $invoice;
}
示例2: calcRechnung
public static function calcRechnung($id_restaurant, $id_order, $save = false)
{
$objResto = User::getRestaurant($id_restaurant);
$objOrder = new MasterOrderModel();
$objOrder->getByID($id_order);
$arrOrderDetails = OrderDetail::getOrderDetailsByIDOrderForCalc($id_order);
$total = 0;
foreach ($arrOrderDetails as $orderDetails) {
// pr($orderDetails);
if ($orderDetails['status_progress'] != '9') {
$total = $total + $orderDetails['price'];
}
}
$invoice['sub_total'] = strval($total);
// $invoice['service_charge'] = $objResto['service_charge'];
// $invoice['other_charge'] = $objResto['other_charge'];
if ($objResto['service_charge'] > 100) {
$invoice['service_charge'] = strval($objResto['service_charge']);
} else {
$invoice['service_charge'] = strval($objResto['service_charge'] / 100 * $total);
}
if ($objResto['other_charge'] > 100) {
//
$invoice['other_charge'] = strval($objResto['other_charge']);
} else {
$invoice['other_charge'] = strval($objResto['other_charge'] / 100 * $total);
}
$disc_bank = self::getDiscountCreditCard($id_restaurant, $id_bank);
if ($objResto['disc_bank'] > 100) {
$invoice['Discount_Bank'] = strval($objResto['disc_bank']);
} else {
$invoice['Discount_Bank'] = strval($objResto['disc_bank'] / 100 * $total);
}
$discMR = self::getDiscountMR($id_restaurant);
if ($discMR > 100) {
//
$invoice['Discount_MR'] = strval($discMR);
} else {
$invoice['Discount_MR'] = strval($discMR / 100 * $total);
}
$feeMR = self::getFeeMR($id_restaurant);
$feeBank = self::getFeeCreditCard($id_restaurant, $id_bank);
// $total_2 = $total_2 - $invoice['Discount_Bank'];
if ($objResto['disc_resto'] > 100) {
//
$invoice['Discount_Resto'] = strval($objResto['disc_resto']);
} else {
$invoice['Discount_Resto'] = strval($objResto['disc_resto'] / 100 * $total);
}
// Fee
//
// $total_2 = $total_2 - $invoice['Discount_Resto'];
$invoice['Tax'] = strval($total * ($objResto['tax_pb_1'] / 100));
$invoice['Total'] = strval($total + $invoice['Tax'] + $invoice['service_charge'] + $invoice['other_charge'] - $invoice['Discount_MR'] - $invoice['Discount_Bank'] - $invoice['Discount_Resto']);
return $invoice;
}
示例3: getMenuRestoForExtra
public function getMenuRestoForExtra()
{
if (Efiwebsetting::getData('checkOAuth') == 'yes') {
IMBAuth::checkOAuth();
}
$json = array();
$json['status_code'] = 1;
$id_restaurant = isset($_GET['id_restaurant']) ? addslashes($_GET['id_restaurant']) : "";
if (!$id_restaurant) {
Generic::errorMsg("No Restaurant ID Found");
}
$id_order = isset($_GET['id_order']) ? addslashes($_GET['id_order']) : "";
if (!$id_restaurant) {
Generic::errorMsg("No ID Order Found");
}
$objRestaurant = new MasterRestaurantModel();
$arrResto = $objRestaurant->getWhere("id_restaurant={$id_restaurant}");
if (count($arrResto) == 0) {
Generic::errorMsg("Can't find Restaurant in the Database!");
}
$resto = User::getRestaurant($id_restaurant);
$json['results']['restaurant'][] = $resto;
global $db;
$objDish = new MasterDishModel();
$q = "SELECT id_category FROM {$objDish->table_name} WHERE availability=1 AND id_restaurant={$id_restaurant}";
$arrCat = $objDish->getWhere("id_restaurant='{$id_restaurant}'");
if (count($arrCat) == 0) {
$json['status_code'] = 0;
$json['status_message'] = "Can't find dish in the Restaurant!";
echo json_encode($json);
die;
}
$catIds = explode(",", $resto["id_categories"]);
$objCategory = new MasterCategoryModel();
$objDish = new MasterDishModel();
foreach ($catIds as $val) {
$cat = MasterCategory::getCategoryByID($val);
$arrDish = $objDish->getWhere("status!='0' AND id_category='{$val}' AND id_restaurant='{$id_restaurant}'");
if (count($arrDish) == 0) {
continue;
}
$dishHelp = array();
foreach ($arrDish as $val) {
// echo $val->id_dish;
$dishHelp[] = MasterDish::getDish($val->id_dish);
}
$cat['dishes'] = $dishHelp;
$json['results']['categories'][] = $cat;
}
$json['results']['order_details'][] = OrderDetail::getOrderDetailsByIDOrderForCalc($id_order);
echo json_encode($json);
die;
}