财务表: 产品备注增加报价/团款(RMB)

feature/trippest
lyt 7 years ago
parent 1233e312b8
commit 65172fa43f

@ -262,6 +262,16 @@ class Order_finance extends CI_Controller {
return null; return null;
} }
$ret->coli_sn = $coli_sn; $ret->coli_sn = $coli_sn;
$payment_currency = "USD";
$currency_rate = 1;
$order_payment = $this->OrderFinance_model->get_order_payment($coli_sn, TRUE);
foreach ($order_payment as $kp => $vp) {
if ($vp->GAI_SQJE > 0) {
$payment_currency = trim($vp->GAI_SQJECurrency);
$currency_rate = bcdiv($vp->GAI_SSJE, $vp->GAI_SQJE);
break;
}
}
$all_pags = array_map(function($ele){ return mb_strtoupper($ele->PAG_Code);}, $all_orders); $all_pags = array_map(function($ele){ return mb_strtoupper($ele->PAG_Code);}, $all_orders);
$all_pag = array_unique($all_pags); $all_pag = array_unique($all_pags);
$combine_pag_arr = array(); $combine_pag_arr = array();
@ -337,6 +347,7 @@ class Order_finance extends CI_Controller {
$ret->person_num = 0; $ret->person_num = 0;
$ret->PAG_Code = ""; $ret->PAG_Code = "";
$ret->order_cost = array(); $ret->order_cost = array();
$ret->totalPrice_RMB = 0;
$pag_sns = array(); $pag_sns = array();
$unique_coli = array(); $unique_coli = array();
foreach ($all_orders as $ko => $vo) { foreach ($all_orders as $ko => $vo) {
@ -363,6 +374,16 @@ class Order_finance extends CI_Controller {
$ret->order_cost[] = $tour_s; $ret->order_cost[] = $tour_s;
$ret->coli_id = $vo->coli_ID; $ret->coli_id = $vo->coli_ID;
} }
// 预定产品的团款转换人民币, 写入财务表产品的备注
// 补充的产品不算
if ( ! isset($vo->real_pag_sn) && $vo->COLI_SN == $coli_sn) {
$vo->COLD_TotalPrice = $vo->COLD_TotalPrice===NULL ? 0 : $vo->COLD_TotalPrice;
if ($payment_currency == "USD" ) {
$ret->totalPrice_RMB = bcadd($ret->totalPrice_RMB, bcmul($vo->COLD_TotalPrice, $currency_rate));
} else {
$ret->totalPrice_RMB = bcadd($ret->totalPrice_RMB, $this->OrderFinance_model->convert_to_RMB($vo->COLD_TotalPrice, 'USD'));
}
}
} }
} }
$this_order_real_pag_sns = array_map(function($ele) {return $ele->real_pag_sn;}, $ret->order_cost); $this_order_real_pag_sns = array_map(function($ele) {return $ele->real_pag_sn;}, $ret->order_cost);
@ -371,6 +392,7 @@ class Order_finance extends CI_Controller {
$ret->pag_name = implode(";\r\n", array_map(function($ele) {return $ele->PAG_Title;}, $pags_info)) ; $ret->pag_name = implode(";\r\n", array_map(function($ele) {return $ele->PAG_Title;}, $pags_info)) ;
$ret->PAG_Code = implode(",", $ret->combine_pags); $ret->PAG_Code = implode(",", $ret->combine_pags);
$ret->comment = "拼团" . $combineNo . ", 按" . $ret->person_num . "人等"; $ret->comment = "拼团" . $combineNo . ", 按" . $ret->person_num . "人等";
$ret->comment .= $ret->totalPrice_RMB>0 ? (", 报价RMB " . $ret->totalPrice_RMB) : "";
$combine_cost = $this->OrderFinance_model->get_combine_sumMoney($combineNo); $combine_cost = $this->OrderFinance_model->get_combine_sumMoney($combineNo);
$ret->cost_category = $combine_cost->cost_category; $ret->cost_category = $combine_cost->cost_category;
$ret->cost_sum = $combine_cost->cost_sum; $ret->cost_sum = $combine_cost->cost_sum;

@ -190,13 +190,16 @@ class OrderFinance_model extends CI_Model {
return $this->HT->query($sql)->result(); return $this->HT->query($sql)->result();
} }
public function get_order_payment($coli_sn=0) public function get_order_payment($coli_sn=0, $detail=false)
{ {
$ret = new stdClass(); $ret = new stdClass();
$sql = "SELECT gai.GAI_SSDate,gai.GAI_SSJE,gai.GAI_Type $sql = "SELECT gai.GAI_SSDate,gai.GAI_SQJE,gai.GAI_SSJE,gai.GAI_Type,gai.GAI_SQJECurrency
from BIZ_GroupAccountInfo gai from BIZ_GroupAccountInfo gai
where gai.GAI_COLI_SN=$coli_sn and gai.DeleteFlag=0"; where gai.GAI_COLI_SN=$coli_sn and gai.DeleteFlag=0";
$payment = $this->HT->query($sql)->result(); $payment = $this->HT->query($sql)->result();
if ($detail === TRUE) {
return $payment;
}
$ret->SSmoney = 0; $ret->SSmoney = 0;
$ret->patDate = ""; $ret->patDate = "";
$ret->payType = ""; $ret->payType = "";

Loading…
Cancel
Save