Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
DataCenter_Core2.1_20190520
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
bltdc
DataCenter_Core2.1_20190520
Commits
d376f898
Commit
d376f898
authored
Dec 17, 2019
by
guanzhenshan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
管理成本改为从数据中心读取数据
parent
a22337fb
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
156 additions
and
25 deletions
+156
-25
dc_base_finance_managecost.cs
Bailun.DC.Models/dc_base_finance_managecost.cs
+93
-0
FinanceReportServices.cs
Bailun.DC.Services/FinanceReportServices.cs
+37
-0
FinanceController.cs
Bailun.DC.Web/Areas/Reports/Controllers/FinanceController.cs
+26
-25
No files found.
Bailun.DC.Models/dc_base_finance_managecost.cs
0 → 100644
View file @
d376f898
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Bailun.DC.Models
{
/// <summary>
/// 管理成本
/// </summary>
public
class
dc_base_finance_managecost
{
/// <summary>
///
/// </summary>
public
int
id
{
get
;
set
;
}
/// <summary>
/// 费用单号
/// </summary>
public
string
no
{
get
;
set
;
}
/// <summary>
/// 收款/付款单位
/// </summary>
public
string
receive_unit
{
get
;
set
;
}
/// <summary>
/// 付款理由
/// </summary>
public
string
reason
{
get
;
set
;
}
/// <summary>
/// 支付时间
/// </summary>
public
DateTime
?
pay_time
{
get
;
set
;
}
/// <summary>
/// 费用类 -1耗材 1付款 2收款 3借支/借还
/// </summary>
public
int
manage_cost_type
{
get
;
set
;
}
/// <summary>
/// 部门
/// </summary>
public
string
department_name
{
get
;
set
;
}
/// <summary>
/// 公司主体value
/// </summary>
public
int
company_value
{
get
;
set
;
}
/// <summary>
/// 主体名称
/// </summary>
public
string
company_name
{
get
;
set
;
}
/// <summary>
/// 原管理成本表分类名
/// </summary>
public
string
fee_super_type
{
get
;
set
;
}
/// <summary>
/// 费用小类
/// </summary>
public
string
fee_sub_type
{
get
;
set
;
}
/// <summary>
/// 金额(原币)
/// </summary>
public
decimal
amount
{
get
;
set
;
}
/// <summary>
/// 币种
/// </summary>
public
string
currency
{
get
;
set
;
}
/// <summary>
/// 金额(人民币)
/// </summary>
public
decimal
amount_rmb
{
get
;
set
;
}
/// <summary>
///
/// </summary>
public
DateTime
gmt_create_time
{
get
;
set
;
}
/// <summary>
///
/// </summary>
public
DateTime
gmt_modify_time
{
get
;
set
;
}
}
}
Bailun.DC.Services/FinanceReportServices.cs
View file @
d376f898
...
@@ -247,6 +247,43 @@ namespace Bailun.DC.Services
...
@@ -247,6 +247,43 @@ namespace Bailun.DC.Services
}
}
/// <summary>
/// 管理成本列表(从数据中心表获取数据)
/// </summary>
/// <param name="start">付款开始时间</param>
/// <param name="end">付款结束时间</param>
/// <returns></returns>
public
List
<
Models
.
dc_base_finance_managecost
>
ListFinanceManageCost
(
DateTime
start
,
DateTime
end
,
string
feesupertype
,
int
?
paycompanyid
)
{
var
sqlparam
=
new
DynamicParameters
();
var
list
=
new
List
<
Models
.
dc_base_finance_managecost
>();
var
sql
=
$"select * from dc_base_finance_managecost where pay_time>='
{
start
.
ToString
(
"yyyy-MM-dd"
)}
' and pay_time<'
{
end
.
AddDays
(
1
).
ToString
(
"yyyy-MM-dd"
)}
'"
;
if
(!
string
.
IsNullOrEmpty
(
feesupertype
))
{
sql
+=
" and fee_super_type=@type"
;
sqlparam
.
Add
(
"type"
,
feesupertype
);
}
if
(
paycompanyid
.
HasValue
&&
paycompanyid
.
Value
>
0
)
{
sql
+=
" and company_value="
+
paycompanyid
.
Value
;
}
using
(
var
cn
=
new
MySqlConnection
(
Common
.
GlobalConfig
.
ConnectionString
))
{
if
(
cn
.
State
==
ConnectionState
.
Closed
)
{
cn
.
Open
();
}
list
=
cn
.
Query
<
dc_base_finance_managecost
>(
sql
,
sqlparam
,
null
,
true
,
2
*
60
).
ToList
();
return
list
.
ToList
();
}
}
#
endregion
#
endregion
#
region
平台余额
#
region
平台余额
...
...
Bailun.DC.Web/Areas/Reports/Controllers/FinanceController.cs
View file @
d376f898
...
@@ -391,7 +391,8 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
...
@@ -391,7 +391,8 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
//利息支出
//利息支出
var
listInterest
=
new
Services
.
FinanceReportServices
().
ListInterestExpense
(
cwurl
);
var
listInterest
=
new
Services
.
FinanceReportServices
().
ListInterestExpense
(
cwurl
);
var
list
=
new
Services
.
FinanceReportServices
().
ListOtherCost
(
url
);
//Edit by Allan at 20191217 for 更改数据源
var
list
=
new
Services
.
FinanceReportServices
().
ListFinanceManageCost
(
start
,
end
,
""
,
paycompanyid
);
//new Services.FinanceReportServices().ListOtherCost(url);
var
listValue
=
new
List
<
Tuple
<
string
,
List
<
decimal
>>>();
var
listValue
=
new
List
<
Tuple
<
string
,
List
<
decimal
>>>();
var
listCol
=
new
List
<
string
>();
var
listCol
=
new
List
<
string
>();
var
listColVal
=
new
List
<
int
>();
var
listColVal
=
new
List
<
int
>();
...
@@ -400,12 +401,12 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
...
@@ -400,12 +401,12 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
{
{
if
(
t
==
2
)
//按付款主体
if
(
t
==
2
)
//按付款主体
{
{
listCol
=
list
.
GroupBy
(
a
=>
a
.
company
N
ame
).
Select
(
p
=>
p
.
Key
).
OrderBy
(
a
=>
a
).
ToList
();
listCol
=
list
.
GroupBy
(
a
=>
a
.
company
_n
ame
).
Select
(
p
=>
p
.
Key
).
OrderBy
(
a
=>
a
).
ToList
();
}
}
else
//按部门
else
//按部门
{
{
listCol
=
list
.
GroupBy
(
a
=>
a
.
departmentN
ame
).
Select
(
p
=>
p
.
Key
).
ToList
();
listCol
=
list
.
GroupBy
(
a
=>
a
.
company_n
ame
).
Select
(
p
=>
p
.
Key
).
ToList
();
}
}
for
(
var
i
=
0
;
i
<
listCol
.
Count
;
i
++)
for
(
var
i
=
0
;
i
<
listCol
.
Count
;
i
++)
...
@@ -414,9 +415,9 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
...
@@ -414,9 +415,9 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
{
{
if
(
t
==
2
)
//按付款主体
if
(
t
==
2
)
//按付款主体
{
{
if
(
item
.
company
N
ame
==
listCol
[
i
])
if
(
item
.
company
_n
ame
==
listCol
[
i
])
{
{
var
obj
=
listValue
.
Where
(
a
=>
a
.
Item1
==
item
.
fee
SuperT
ype
).
FirstOrDefault
();
var
obj
=
listValue
.
Where
(
a
=>
a
.
Item1
==
item
.
fee
_super_t
ype
).
FirstOrDefault
();
if
(
obj
==
null
)
if
(
obj
==
null
)
{
{
...
@@ -426,20 +427,20 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
...
@@ -426,20 +427,20 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
listItems
.
Add
(
0.00
M
);
listItems
.
Add
(
0.00
M
);
}
}
listItems
[
i
]
=
item
.
amount
R
mb
;
listItems
[
i
]
=
item
.
amount
_r
mb
;
listValue
.
Add
(
new
Tuple
<
string
,
List
<
decimal
>>(
item
.
fee
SuperT
ype
,
listItems
));
listValue
.
Add
(
new
Tuple
<
string
,
List
<
decimal
>>(
item
.
fee
_super_t
ype
,
listItems
));
}
}
else
else
{
{
obj
.
Item2
[
i
]
+=
item
.
amount
R
mb
;
obj
.
Item2
[
i
]
+=
item
.
amount
_r
mb
;
}
}
}
}
}
}
else
else
{
{
if
(
item
.
department
N
ame
==
listCol
[
i
])
if
(
item
.
department
_n
ame
==
listCol
[
i
])
{
{
var
obj
=
listValue
.
Where
(
a
=>
a
.
Item1
==
item
.
fee
SuperT
ype
).
FirstOrDefault
();
var
obj
=
listValue
.
Where
(
a
=>
a
.
Item1
==
item
.
fee
_super_t
ype
).
FirstOrDefault
();
if
(
obj
==
null
)
if
(
obj
==
null
)
{
{
...
@@ -449,12 +450,12 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
...
@@ -449,12 +450,12 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
listItems
.
Add
(
0.00
M
);
listItems
.
Add
(
0.00
M
);
}
}
listItems
[
i
]
=
item
.
amount
R
mb
;
listItems
[
i
]
=
item
.
amount
_r
mb
;
listValue
.
Add
(
new
Tuple
<
string
,
List
<
decimal
>>(
item
.
fee
SuperT
ype
,
listItems
));
listValue
.
Add
(
new
Tuple
<
string
,
List
<
decimal
>>(
item
.
fee
_super_t
ype
,
listItems
));
}
}
else
else
{
{
obj
.
Item2
[
i
]
+=
item
.
amount
R
mb
;
obj
.
Item2
[
i
]
+=
item
.
amount
_r
mb
;
}
}
}
}
}
}
...
@@ -706,7 +707,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
...
@@ -706,7 +707,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
msg
=
list
.
Count
>
0
?
""
:
"成本接口返回了空记录。"
,
msg
=
list
.
Count
>
0
?
""
:
"成本接口返回了空记录。"
,
col
=
listCol
,
col
=
listCol
,
list
=
listValue
,
list
=
listValue
,
amount
=
Math
.
Round
(
list
.
Sum
(
a
=>
a
.
amount
R
mb
)+
listInterest
.
Sum
(
a
=>
a
.
RepayInterestRMB
),
2
)
amount
=
Math
.
Round
(
list
.
Sum
(
a
=>
a
.
amount
_r
mb
)+
listInterest
.
Sum
(
a
=>
a
.
RepayInterestRMB
),
2
)
});
});
}
}
...
@@ -727,7 +728,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
...
@@ -727,7 +728,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
url
+=
"&feeSuperType="
+
categoryname
;
url
+=
"&feeSuperType="
+
categoryname
;
}
}
var
list
=
new
Services
.
FinanceReportServices
().
ListOtherCost
(
url
);
var
list
=
new
Services
.
FinanceReportServices
().
List
FinanceManageCost
(
start
,
end
,
categoryname
,
paycompanyid
);
//new Services.FinanceReportServices().List
OtherCost(url);
var
listValue
=
new
List
<
Tuple
<
string
,
List
<
decimal
>>>();
var
listValue
=
new
List
<
Tuple
<
string
,
List
<
decimal
>>>();
var
listCol
=
heads
.
Split
(
"|"
).
ToList
();
var
listCol
=
heads
.
Split
(
"|"
).
ToList
();
...
@@ -740,9 +741,9 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
...
@@ -740,9 +741,9 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
{
{
if
(
t
==
2
)
//按付款主体
if
(
t
==
2
)
//按付款主体
{
{
if
(
item
.
company
N
ame
==
listCol
[
i
])
if
(
item
.
company
_n
ame
==
listCol
[
i
])
{
{
var
obj
=
listValue
.
Where
(
a
=>
a
.
Item1
==
item
.
fee
SubT
ype
).
FirstOrDefault
();
var
obj
=
listValue
.
Where
(
a
=>
a
.
Item1
==
item
.
fee
_sub_t
ype
).
FirstOrDefault
();
if
(
obj
==
null
)
if
(
obj
==
null
)
{
{
...
@@ -752,20 +753,20 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
...
@@ -752,20 +753,20 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
listItems
.
Add
(
0.00
M
);
listItems
.
Add
(
0.00
M
);
}
}
listItems
[
i
]
=
item
.
amount
R
mb
;
listItems
[
i
]
=
item
.
amount
_r
mb
;
listValue
.
Add
(
new
Tuple
<
string
,
List
<
decimal
>>(
item
.
fee
SubT
ype
,
listItems
));
listValue
.
Add
(
new
Tuple
<
string
,
List
<
decimal
>>(
item
.
fee
_sub_t
ype
,
listItems
));
}
}
else
else
{
{
obj
.
Item2
[
i
]
+=
item
.
amount
R
mb
;
obj
.
Item2
[
i
]
+=
item
.
amount
_r
mb
;
}
}
}
}
}
}
else
else
{
{
if
(
item
.
department
N
ame
==
listCol
[
i
])
if
(
item
.
department
_n
ame
==
listCol
[
i
])
{
{
var
obj
=
listValue
.
Where
(
a
=>
a
.
Item1
==
item
.
fee
SubT
ype
).
FirstOrDefault
();
var
obj
=
listValue
.
Where
(
a
=>
a
.
Item1
==
item
.
fee
_sub_t
ype
).
FirstOrDefault
();
if
(
obj
==
null
)
if
(
obj
==
null
)
{
{
...
@@ -775,12 +776,12 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
...
@@ -775,12 +776,12 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
listItems
.
Add
(
0.00
M
);
listItems
.
Add
(
0.00
M
);
}
}
listItems
[
i
]
=
item
.
amount
R
mb
;
listItems
[
i
]
=
item
.
amount
_r
mb
;
listValue
.
Add
(
new
Tuple
<
string
,
List
<
decimal
>>(
item
.
fee
SubT
ype
,
listItems
));
listValue
.
Add
(
new
Tuple
<
string
,
List
<
decimal
>>(
item
.
fee
_sub_t
ype
,
listItems
));
}
}
else
else
{
{
obj
.
Item2
[
i
]
+=
item
.
amount
R
mb
;
obj
.
Item2
[
i
]
+=
item
.
amount
_r
mb
;
}
}
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment