Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
Education
Project
Project
Details
Activity
Releases
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
黄奎
Education
Commits
ddece21f
Commit
ddece21f
authored
Jul 16, 2021
by
liudong1993
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
学生有效课时
parent
778796c4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
137 additions
and
0 deletions
+137
-0
RB_Education_Contract_ViewModel.cs
...Model/ViewModel/Course/RB_Education_Contract_ViewModel.cs
+5
-0
OrderModule.cs
Edu.Module.Course/OrderModule.cs
+103
-0
FinanceController.cs
Edu.WebApi/Controllers/Finance/FinanceController.cs
+29
-0
No files found.
Edu.Model/ViewModel/Course/RB_Education_Contract_ViewModel.cs
View file @
ddece21f
...
...
@@ -11,6 +11,11 @@ namespace Edu.Model.ViewModel.Course
{
#
region
财务相关
/// <summary>
/// 查询正常合同 1是
/// </summary>
public
int
IsSelectNormal
{
get
;
set
;
}
/// <summary>
/// 财务单据
/// </summary>
...
...
Edu.Module.Course/OrderModule.cs
View file @
ddece21f
...
...
@@ -2414,6 +2414,109 @@ namespace Edu.Module.Course
})
>
0
;
}
}
/// <summary>
/// 更新学生的有效课时
/// </summary>
/// <param name="guestId"></param>
/// <param name="money"></param>
/// <returns></returns>
public
bool
UpdateStudentValidClassHours
(
int
guestId
,
decimal
money
)
{
var
gmodel
=
order_GuestRepository
.
GetEntity
(
guestId
);
if
(
gmodel
==
null
)
{
return
false
;
}
var
cmodel
=
education_ContractRepository
.
GetList
(
new
RB_Education_Contract_ViewModel
()
{
Group_Id
=
gmodel
.
Group_Id
,
GuestId
=
gmodel
.
Id
}).
Where
(
x
=>
x
.
Status
!=
4
).
FirstOrDefault
();
if
(
cmodel
!=
null
)
{
//有合同
cmodel
.
Income
=
money
>=
0
?
money
:
0
;
cmodel
.
Unit_Price
=
0
;
if
(
cmodel
.
TotalClassHours
>
0
)
{
if
(
cmodel
.
TotalDiscountMoney
>
0
)
{
cmodel
.
Unit_Price
=
Math
.
Round
((
cmodel
.
TotalCourseFee
-
(
cmodel
.
TotalDiscountMoney
/
cmodel
.
TotalSub
)
*
cmodel
.
TotalCourseFee
)
/
cmodel
.
TotalClassHours
,
6
,
MidpointRounding
.
AwayFromZero
);
//根据合同计算
}
else
{
cmodel
.
Unit_Price
=
Math
.
Round
(
cmodel
.
TotalCourseFee
/
cmodel
.
TotalClassHours
,
6
,
MidpointRounding
.
AwayFromZero
);
//根据合同计算
}
}
decimal
validClassHours
=
cmodel
.
Unit_Price
>
0
?
Math
.
Round
(
cmodel
.
Income
/
cmodel
.
Unit_Price
,
2
,
MidpointRounding
.
AwayFromZero
)
:
0
;
Dictionary
<
string
,
object
>
keyValues
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Order_Guest
.
ValidClassHours
),
validClassHours
}
};
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Order_Guest
.
Id
),
FiledValue
=
guestId
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
order_GuestRepository
.
Update
(
keyValues
,
wheres
);
}
return
true
;
}
/// <summary>
/// 初始化所有学生的课时
/// </summary>
/// <returns></returns>
public
bool
UpdateALLStudentValidClassHours
()
{
RB_Education_Contract_ViewModel
dmodel
=
new
RB_Education_Contract_ViewModel
()
{
Group_Id
=
100000
};
string
datebaseStr
=
Config
.
ReadConfigKey
(
"FinanceDateBase"
);
//财务数据库
var
list
=
education_ContractRepository
.
GetContractPageListForFinance
(
1
,
10000
,
out
long
count
,
dmodel
,
datebaseStr
);
if
(
list
.
Any
())
{
string
orderIds
=
string
.
Join
(
","
,
list
.
Select
(
x
=>
x
.
OrderId
).
Distinct
());
string
guestIds
=
string
.
Join
(
","
,
list
.
Select
(
x
=>
x
.
GuestId
).
Distinct
());
//查询所有的财务单据
var
flist
=
financeRepository
.
GetListSingle
(
new
Model
.
ViewModel
.
Finance
.
RB_Finance_Extend
()
{
RB_Group_Id
=
dmodel
.
Group_Id
,
FinanceType
=
2
,
IsSelectNormal
=
1
,
OrderIdStr
=
orderIds
,
GuestIdStr
=
guestIds
});
if
(
flist
.
Any
())
{
string
frIds
=
string
.
Join
(
","
,
flist
.
Select
(
x
=>
x
.
FrID
));
//查询单据明细
var
fdlist
=
financeDetailRepository
.
GetList
(
new
Model
.
ViewModel
.
Finance
.
RB_FinanceDetail_Extend
()
{
GroupId
=
dmodel
.
Group_Id
,
FrIds
=
frIds
});
}
foreach
(
var
item
in
list
)
{
#
region
财务单据
item
.
FinanceList
=
flist
.
Where
(
x
=>
x
.
GuestId
==
item
.
GuestId
).
ToList
();
item
.
Income
=
item
.
FinanceList
.
Where
(
x
=>
x
.
Type
==
Common
.
Enum
.
Finance
.
WFTempLateClassEnum
.
IN
&&
x
.
Is_Cashier
==
1
).
Sum
(
x
=>
(
x
.
Money
??
0
)
+
(
x
.
Fee
??
0
));
//出纳审核算有效金额
item
.
Expend
=
item
.
FinanceList
.
Where
(
x
=>
x
.
Type
==
Common
.
Enum
.
Finance
.
WFTempLateClassEnum
.
OUT
).
Sum
(
x
=>
(
x
.
Money
??
0
)
+
(
x
.
Fee
??
0
));
//制单就算
#
endregion
item
.
Unit_Price
=
0
;
if
(
item
.
TotalClassHours
>
0
)
{
if
(
item
.
TotalDiscountMoney
>
0
)
{
item
.
Unit_Price
=
Math
.
Round
((
item
.
TotalCourseFee
-
(
item
.
TotalDiscountMoney
/
item
.
TotalSub
)
*
item
.
TotalCourseFee
)
/
item
.
TotalClassHours
,
6
,
MidpointRounding
.
AwayFromZero
);
//根据合同计算(包含优惠, 需减去课件费等)
}
else
{
item
.
Unit_Price
=
Math
.
Round
(
item
.
TotalCourseFee
/
item
.
TotalClassHours
,
6
,
MidpointRounding
.
AwayFromZero
);
//根据合同计算(包含优惠, 需减去课件费等)
}
}
decimal
Income
=
item
.
Income
-
item
.
Expend
;
Income
=
Income
>=
0
?
Income
:
0
;
decimal
validClassHours
=
item
.
Unit_Price
>
0
?
Math
.
Round
(
Income
/
item
.
Unit_Price
,
2
,
MidpointRounding
.
AwayFromZero
)
:
0
;
//更新学生的有效课时
Dictionary
<
string
,
object
>
keyValues
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Order_Guest
.
ValidClassHours
),
validClassHours
}
};
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Order_Guest
.
Id
),
FiledValue
=
item
.
GuestId
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
order_GuestRepository
.
Update
(
keyValues
,
wheres
);
}
}
return
true
;
}
#
endregion
...
...
Edu.WebApi/Controllers/Finance/FinanceController.cs
View file @
ddece21f
...
...
@@ -11,8 +11,10 @@ using Edu.Module.Course;
using
Edu.Module.Finance
;
using
Edu.Module.StudyAbroad
;
using
Edu.WebApi.Filter
;
using
Microsoft.AspNetCore.Authorization
;
using
Microsoft.AspNetCore.Cors
;
using
Microsoft.AspNetCore.Mvc
;
using
Newtonsoft.Json.Linq
;
namespace
Edu.WebApi.Controllers.Finance
{
...
...
@@ -1385,6 +1387,33 @@ namespace Edu.WebApi.Controllers.Finance
}
}
/// <summary>
/// 更新学生的有效课时
/// </summary>
/// <returns></returns>
[
AllowAnonymous
]
[
HttpPost
]
public
ApiResult
UpdateStudentValidClassHours
()
{
JObject
jObj
=
JObject
.
Parse
(
RequestParm
.
Msg
.
ToString
());
int
GuestId
=
jObj
.
GetInt
(
"GuestId"
,
0
);
decimal
Money
=
jObj
.
GetDecimal
(
"Money"
);
bool
flag
=
orderModule
.
UpdateStudentValidClassHours
(
GuestId
,
Money
);
return
flag
?
ApiResult
.
Success
()
:
ApiResult
.
Failed
();
}
/// <summary>
/// 初始化学生的有效课时
/// </summary>
/// <returns></returns>
[
AllowAnonymous
]
[
HttpPost
]
public
ApiResult
UpdateALLStudentValidClassHours
()
{
bool
flag
=
orderModule
.
UpdateALLStudentValidClassHours
();
return
flag
?
ApiResult
.
Success
()
:
ApiResult
.
Failed
();
}
#
endregion
#
region
月结窗口
...
...
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