|
|
@ -392,8 +392,11 @@ class Vendor_money_model extends CI_Model {
|
|
|
|
-- AND CGI_ArriveDate BETWEEN '$start_date' AND '$end_date')
|
|
|
|
-- AND CGI_ArriveDate BETWEEN '$start_date' AND '$end_date')
|
|
|
|
and exists (
|
|
|
|
and exists (
|
|
|
|
select 1 from BIZ_ConfirmLineInfo
|
|
|
|
select 1 from BIZ_ConfirmLineInfo
|
|
|
|
inner join BIZ_ConfirmLineDetail on COLI_SN=COLD_COLI_SN
|
|
|
|
inner join BIZ_ConfirmLineDetail d on COLI_SN=COLD_COLI_SN
|
|
|
|
where COLI_GRI_SN=GCI_GRI_SN
|
|
|
|
left join BIZ_PackageOrderInfo poi on poi.POI_COLD_SN=d.COLD_SN
|
|
|
|
|
|
|
|
where COLI_GRI_SN=GCI_GRI_SN and d.DeleteFlag=0
|
|
|
|
|
|
|
|
and isnull(poi_quotationType,0)<>4
|
|
|
|
|
|
|
|
and d.COLD_PlanVEI_SN in ($all_vendor)
|
|
|
|
and COLD_StartDate BETWEEN '$start_date' AND '$end_date'
|
|
|
|
and COLD_StartDate BETWEEN '$start_date' AND '$end_date'
|
|
|
|
)
|
|
|
|
)
|
|
|
|
) AS group_cost
|
|
|
|
) AS group_cost
|
|
|
@ -768,6 +771,63 @@ ORDER BY to_be_diff.GCI_VEI_SN
|
|
|
|
return $query->result_array();
|
|
|
|
return $query->result_array();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function agreement_diff($start_date, $end_date, $all_vendor)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
$sql = "SELECT *
|
|
|
|
|
|
|
|
,ROUND( dbo.GetSSJEFromSQJE(
|
|
|
|
|
|
|
|
(select top 1 GAI_Type from BIZ_GroupAccountInfo b where gai_coli_sn=coli_sn and b.DeleteFlag=0)
|
|
|
|
|
|
|
|
,COLI_Currency,com_sum_price),2) as com_Currency_CNY_price
|
|
|
|
|
|
|
|
,ROUND( dbo.GetSSJEFromSQJE(
|
|
|
|
|
|
|
|
(select top 1 GAI_Type from BIZ_GroupAccountInfo b where gai_coli_sn=coli_sn and b.DeleteFlag=0)
|
|
|
|
|
|
|
|
,COLI_Currency,not_com_sum_price),2) as not_com_Currency_CNY_price
|
|
|
|
|
|
|
|
--,ROUND( dbo.GetSSJEFromSQJE(
|
|
|
|
|
|
|
|
-- (select top 1 GAI_Type from BIZ_GroupAccountInfo b where gai_coli_sn=coli_sn and b.DeleteFlag=0)
|
|
|
|
|
|
|
|
-- ,'USD',com_sum_price),2) as USD_CNY_price
|
|
|
|
|
|
|
|
,(select SUM(GAI_SSJE) from BIZ_GroupAccountInfo gai where gai.GAI_COLI_SN=COLI_SN and gai.DeleteFlag=0) as total_income
|
|
|
|
|
|
|
|
from (
|
|
|
|
|
|
|
|
select
|
|
|
|
|
|
|
|
COLI_ID,COLI_GroupCode,COLI_SN,COLI_Currency,COLI_GRI_SN
|
|
|
|
|
|
|
|
,(
|
|
|
|
|
|
|
|
select SUM(cold.COLD_TotalPrice) from BIZ_ConfirmLineDetail cold
|
|
|
|
|
|
|
|
left join BIZ_PackageOrderInfo poi on poi.POI_COLD_SN=cold.COLD_SN
|
|
|
|
|
|
|
|
where cold.COLD_COLI_SN=coli.COLI_SN
|
|
|
|
|
|
|
|
and COLD_StartDate between '$start_date' and '$end_date'
|
|
|
|
|
|
|
|
and cold.DeleteFlag=0
|
|
|
|
|
|
|
|
and poi_quotationType=4
|
|
|
|
|
|
|
|
and COLD_PlanVEI_SN in ($all_vendor)
|
|
|
|
|
|
|
|
) as com_sum_price
|
|
|
|
|
|
|
|
,isnull((
|
|
|
|
|
|
|
|
select SUM(cold.COLD_TotalPrice) from BIZ_ConfirmLineDetail cold
|
|
|
|
|
|
|
|
left join BIZ_PackageOrderInfo poi on poi.POI_COLD_SN=cold.COLD_SN
|
|
|
|
|
|
|
|
where cold.COLD_COLI_SN=coli.COLI_SN
|
|
|
|
|
|
|
|
and COLD_StartDate between '$start_date' and '$end_date'
|
|
|
|
|
|
|
|
and cold.DeleteFlag=0
|
|
|
|
|
|
|
|
and isnull(poi_quotationType,0)<>4
|
|
|
|
|
|
|
|
and COLD_PlanVEI_SN in ($all_vendor)
|
|
|
|
|
|
|
|
),0) as not_com_sum_price
|
|
|
|
|
|
|
|
,isnull((
|
|
|
|
|
|
|
|
select SUM(CONVERT(decimal(10,2), isnull(GCI_priceCNY,0))) from GroupCombineInfo where GCI_GRI_SN=coli.COLI_GRI_SN
|
|
|
|
|
|
|
|
and isnull(GCI_combineNo,'') not in ('','cancel','forbidden')
|
|
|
|
|
|
|
|
),0) as in_gci
|
|
|
|
|
|
|
|
from
|
|
|
|
|
|
|
|
BIZ_ConfirmLineInfo coli
|
|
|
|
|
|
|
|
where exists (
|
|
|
|
|
|
|
|
select 1 from OperatorInfo where OPI_DEI_SN=30 and OPI_SN=COLI_OPI_ID
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
and exists (
|
|
|
|
|
|
|
|
select 1 from BIZ_ConfirmLineDetail cold
|
|
|
|
|
|
|
|
left join BIZ_PackageOrderInfo poi on poi.POI_COLD_SN=cold.COLD_SN
|
|
|
|
|
|
|
|
where cold.COLD_COLI_SN=coli.COLI_SN
|
|
|
|
|
|
|
|
and COLD_StartDate between '$start_date' and '$end_date'
|
|
|
|
|
|
|
|
and cold.DeleteFlag=0
|
|
|
|
|
|
|
|
and poi_quotationType=4
|
|
|
|
|
|
|
|
and COLD_PlanVEI_SN in ($all_vendor)
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
) as all_comprehensive";
|
|
|
|
|
|
|
|
$query = $this->HT->query($sql);
|
|
|
|
|
|
|
|
return $query->result_array();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* End of file vendor_money.php */
|
|
|
|
/* End of file vendor_money.php */
|
|
|
|