Merge branch 'trippest' into plan-auto-send

feature/pay
lyt 7 years ago
commit aaad101d01

@ -381,6 +381,7 @@ class TulanduoApi extends CI_Controller
$old_detail = mb_strstr($coli_orderdetailtext, " operations", true)!==false ? mb_strstr($coli_orderdetailtext, " operations", true) : $coli_orderdetailtext;
$new_detail = trim($allDetails_to_HT)=="" ? $old_detail : $old_detail . " operations\r\n" . $allDetails_to_HT . "\r\n";
// 团款总金额
// 渠道实收
$travel_fee = 0;
$travel_fee_currency = 'RMB';
if (isset($detail_jsonResp->orderDetail->travelFees) ) {
@ -389,6 +390,22 @@ class TulanduoApi extends CI_Controller
}
unset($vtf);
}
// 渠道价
$pag_info = $this->analysis_productcode($detail_jsonResp->orderDetail->routeName, $detail_jsonResp->orderDetail->orderId);
$total_num = $detail_jsonResp->orderDetail->adultNum+$detail_jsonResp->orderDetail->childNum;
$partner_price = $this->Orders_model->get_partner_price($pag_info->PAG_Code, $total_num, $detail_jsonResp->orderDetail->travelDate);
if ( ! empty($partner_price)) {
$travel_fee_currency = $partner_price->PKP_Currency ? $partner_price->PKP_Currency : "RMB";
if (strval($partner_price->PKP_PriceType) === "1") {
// 每团
$travel_fee = $partner_price->PKP_AdultCost;
} else {
// 每人
$adult_price = bcmul($detail_jsonResp->orderDetail->adultNum, $partner_price->PKP_AdultCost);
$child_price = bcmul($detail_jsonResp->orderDetail->childNum, $partner_price->PKP_ChildCost);
$travel_fee = bcadd($adult_price, $child_price);
}
}
$coli_update_column = array(
"COLI_Memo" => substr($new_memo, 0, 400)
,"COLI_OrderDetailText" => $new_detail
@ -406,7 +423,6 @@ class TulanduoApi extends CI_Controller
* insert BIZ_BookPeople,BIZ_PackageOrderInfo
*/
/** BIZ_ConfirmLineDetail */
$pag_info = $this->analysis_productcode($detail_jsonResp->orderDetail->routeName, $detail_jsonResp->orderDetail->orderId);
$COLD_MemoText = raw_json_encode(array("Pick up"=>$detail_jsonResp->orderDetail->toTraffic, "Drop off"=>$detail_jsonResp->orderDetail->backTraffic));
$new_memotext = trim($cold_memotext)===""||(json_decode($cold_memotext)!==null&&!is_numeric(json_decode($cold_memotext))) ? $COLD_MemoText : $cold_memotext;
$cold_update_column = array(

@ -24,10 +24,13 @@ class Api extends CI_Controller {
public function operation_detail($find=null)
{
($find===null) ? $find = $this->input->get_post('q') : null;
$find = (mb_strlen($find)<9) ? null : $this->input->get_post('q');
$find = (mb_strlen($find)<9) ? null : $find;
preg_match('/[\d]+\-?[\w]*/', characet($find, "UTF-8"), $temp_array);
$find = $temp_array[0];
$order_plan = $this->Orders_model->get_order_vendorplan($find);
$find = isset($temp_array[0]) ? $temp_array[0] : null;
$order_plan = null;
if ($find !== null) {
$order_plan = $this->Orders_model->get_order_vendorplan($find);
}
if ($find===null || $order_plan == null) {
$ret['status'] = 0;
$ret['msg'] = "Not Found.";

@ -93,6 +93,7 @@ class Send_operation extends CI_Controller {
$guide_name = strstr($order->eva, "@", true);
$guide_tel = substr(strstr($order->eva, "@"), 1);
}
$guide_name = mb_ereg_replace('[^a-zA-Z]', '', $guide_name);
$send_body = array(
"one" => trim($order->guest_name)
,"two" => substr($order->COLD_StartDate, 0, 10)

@ -209,14 +209,16 @@ class OrderFinance_model extends CI_Model {
/** 判断各种项目的报表是否已存在 */
public function report_tour_exists($coli_id=null, $tourCode=null, $tourBz=null)
{
$sql = "SELECT top 10 ordernumber from report_tour where ordernumber=? and tourCode=? ";
$sql = "SELECT top 10 ordernumber from report_tour where ordernumber=? ";
if ($tourBz) {
$tourBz = mb_ereg_replace('[^a-zA-Z0-9\-\[\]]', '', strstr($tourBz, ",", true));
$tourBz = str_replace("[", "[[]", $tourBz);
$sql .= " and (tourBz like '%" . $this->HT->escape_like_str($tourBz) . "%'
OR tourBz='') ";
} else {
$sql .= " AND tourCode='" . $tourCode . "' ";
}
$num_rows = $this->HT->query($sql, array($coli_id, $tourCode))->num_rows();
$num_rows = $this->HT->query($sql, array($coli_id))->num_rows();
return $num_rows>0;
}
public function report_train_exists($coli_id=null, $TrainNo=null)
@ -244,7 +246,7 @@ class OrderFinance_model extends CI_Model {
foreach ($report_tour_arr as $krt => $vrt) {
$tourBz_tmp = "";
if ($this->report_tour_exists($vrt['ordernumber'], $vrt['tourCode'], $vrt['tourBZ']) === TRUE) {
$where = " ordernumber='" . $vrt['ordernumber'] . "' AND tourCode='" . $vrt['tourCode'] . "' ";
$where = " ordernumber='" . $vrt['ordernumber'] . "' "; //AND tourCode='" . $vrt['tourCode'] . "' ";
$tourBz_tmp = mb_ereg_replace('[^a-zA-Z0-9\-\[\]]', '', strstr($vrt['tourBZ'], ",", true));
$tourBz_tmp = str_replace("[", "[[]", $tourBz_tmp);
$where .= " AND (tourBZ like '%" . $this->HT->escape_like_str($tourBz_tmp) . "%'

@ -1754,6 +1754,24 @@ class Orders_model extends CI_Model {
);
}
/** 获取产品的渠道价格 */
public function get_partner_price($code="", $person_num=0, $price_date="")
{
$sql = "SELECT TOP 1 PKP_Currency,
PKP_PriceGrade,PKP_ValidDate,PKP_InvalidDate,
PKP_AdultCost,PKP_ChildCost,PKP_BabyCost,
PKP_PriceType --0每人 1每团
,p.*
from BIZ_PackageInfo pag
left join BIZ_PackagePrice p on p.PKP_PAG_SN=PAG_SN
where PAG_Code=? and PAG_DEI_SN=30
and ? between PKP_PersonStart and PKP_PersonStop
and ? between PKP_ValidDate and PKP_InvalidDate
and PKP_VEI_SN in (1343,29188,30548)
order by p.Checked desc, PKP_PriceGrade asc,PKP_ValidDate desc"; // 重复日期的取新的
return $this->HT->query($sql, array($code, $person_num, $price_date))->row();
}
//来源终端 tablet mobile desktop
public function check_device() {
if (isset($_SERVER['HTTP_USER_AGENT'])) {

Loading…
Cancel
Save