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
82fbb887
Commit
82fbb887
authored
Jul 09, 2021
by
liudong1993
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
教育课时费制单
parent
aecd0673
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
96 additions
and
84 deletions
+96
-84
FinanceModule.cs
Edu.Module.Finance/FinanceModule.cs
+89
-82
RB_OrderRepository.cs
Edu.Repository/Course/RB_OrderRepository.cs
+5
-1
OrderController.cs
Edu.WebApi/Controllers/Course/OrderController.cs
+2
-1
No files found.
Edu.Module.Finance/FinanceModule.cs
View file @
82fbb887
...
...
@@ -3888,106 +3888,113 @@ namespace Edu.Module.Finance
string
EndTime
=
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd"
);
#
region
班级下老师的课时费
List
<
RB_Teaching_BonusDetail_ViewModel
>
TeacherHoursList
=
new
List
<
RB_Teaching_BonusDetail_ViewModel
>();
//根据学生签到表 查询
var
list
=
class_CheckRepository
.
GetTeacherConsumptionHoursDetialList
(
""
,
-
1
,
classId
,
StartTime
,
EndTime
,
userInfo
.
Group_Id
);
if
(
list
.
Any
())
var
TeacherAlist
=
class_CheckRepository
.
GetTeacherConsumptionHoursDetialList
(
""
,
-
1
,
classId
,
StartTime
,
EndTime
,
userInfo
.
Group_Id
);
if
(
TeacherAlist
.
Any
())
{
//班级类型查询
var
cTypeList
=
class_TypeRepository
.
GetClassTypeListRepository
(
new
RB_Class_Type_ViewModel
()
{
Group_Id
=
userInfo
.
Group_Id
});
//基础配置
var
configModel
=
class_ConfigRepository
.
GetClassConfigRepository
(
new
RB_Class_Config_ViewModel
()
{
Group_Id
=
userInfo
.
Group_Id
});
if
(
configModel
==
null
||
configModel
.
BasicHourFee
<=
0
||
configModel
.
BasicMinutes
<=
0
)
{
return
TeacherHoursList
;
}
foreach
(
var
item
in
list
)
//上这班的老师
string
teacherIds
=
string
.
Join
(
","
,
TeacherAlist
.
Select
(
x
=>
x
.
TeacherId
).
Distinct
());
//根据学生签到表 查询
var
list
=
class_CheckRepository
.
GetTeacherConsumptionHoursDetialList
(
teacherIds
,
-
1
,
0
,
StartTime
,
EndTime
,
userInfo
.
Group_Id
);
if
(
list
.
Any
())
{
int
Minutes
=
(
int
)(
Convert
.
ToDateTime
(
"2021-06-29 "
+
item
.
EndDate
)
-
Convert
.
ToDateTime
(
"2021-06-29 "
+
item
.
StartDate
)).
TotalMinutes
;
decimal
Hours
=
Math
.
Round
(
Convert
.
ToDecimal
(
Minutes
)
/
60
,
2
,
MidpointRounding
.
AwayFromZero
);
//小时
//上课课时
decimal
KSNum
=
item
.
CurrentDeductionHours
;
//签到课时长度
//班级类型查询
var
cTypeList
=
class_TypeRepository
.
GetClassTypeListRepository
(
new
RB_Class_Type_ViewModel
()
{
Group_Id
=
userInfo
.
Group_Id
});
//基础配置
var
configModel
=
class_ConfigRepository
.
GetClassConfigRepository
(
new
RB_Class_Config_ViewModel
()
{
Group_Id
=
userInfo
.
Group_Id
});
if
(
configModel
==
null
||
configModel
.
BasicHourFee
<=
0
||
configModel
.
BasicMinutes
<=
0
)
{
return
TeacherHoursList
;
}
var
typeModel
=
cTypeList
.
Where
(
x
=>
x
.
CTypeId
==
item
.
ClassType
).
FirstOrDefault
();
foreach
(
var
item
in
list
)
{
//上课课时
decimal
KSNum
=
item
.
CurrentDeductionHours
;
//签到课时长度
if
(
item
.
ClassId
==
18
)
{
KSNum
=
0
;
}
// 18班 特殊处理
decimal
unitPrice
=
configModel
.
BasicHourFee
+
(
typeModel
?.
AddHourFee
??
0
)
+
(
item
?.
BaseHourFee
??
0
);
//课时费 需要每个班级 单独计算 因为 班级有附加费用
decimal
KSMoney
=
KSNum
*
unitPrice
;
decimal
ClassHourMinute
=
configModel
.
BasicMinutes
;
//课时分钟数
//if (item.ClassHourMinute > 0) { ClassHourMinute = item.ClassHourMinute; }
decimal
Hours
=
Math
.
Round
(
KSNum
*
ClassHourMinute
/
60
,
2
,
MidpointRounding
.
AwayFromZero
);
//小时
decimal
ClassHourMinute
=
configModel
.
BasicMinutes
;
//课时分钟数
if
(
item
.
ClassHourMinute
>
0
)
{
ClassHourMinute
=
item
.
ClassHourMinute
;
}
decimal
HourMoney
=
Math
.
Round
(
unitPrice
/
ClassHourMinute
*
60
,
2
,
MidpointRounding
.
AwayFromZero
);
//每小时课时费
var
typeModel
=
cTypeList
.
Where
(
x
=>
x
.
CTypeId
==
item
.
ClassType
).
FirstOrDefault
();
decimal
unitPrice
=
configModel
.
BasicHourFee
+
(
typeModel
?.
AddHourFee
??
0
)
+
(
item
?.
BaseHourFee
??
0
);
//课时费 需要每个班级 单独计算 因为 班级有附加费用
decimal
KSMoney
=
KSNum
*
unitPrice
;
TeacherHoursList
.
Add
(
new
RB_Teaching_BonusDetail_ViewModel
{
Date
=
item
.
ClassDate
,
TimeBucket
=
item
.
StartDate
+
"~"
+
item
.
EndDate
,
TeacherId
=
item
.
TeacherId
,
TeacherName
=
item
.
TeacherName
,
ClassId
=
item
.
ClassId
,
ClassName
=
item
.
ClassName
,
ClassNo
=
item
.
ClassNo
,
CouseId
=
item
.
CouseId
,
CourseName
=
item
.
CourseName
,
KSNum
=
KSNum
,
Hours
=
Hours
,
HourMoney
=
HourMoney
,
UnitPrice
=
unitPrice
,
Money
=
KSMoney
,
BaseHoursEnabled
=
item
.
BaseHoursEnabled
,
EnableTime
=
item
.
EnableTime
});
}
decimal
HourMoney
=
Math
.
Round
(
unitPrice
/
ClassHourMinute
*
60
,
2
,
MidpointRounding
.
AwayFromZero
);
//每小时课时费
//初始化 基础课时
DateTime
STime
=
Convert
.
ToDateTime
(
Convert
.
ToDateTime
(
StartTime
).
ToString
(
"yyyy-MM"
)
+
"-01"
);
while
(
true
)
{
DateTime
ETime
=
STime
.
AddMonths
(
1
).
AddDays
(-
1
);
var
mlist
=
TeacherHoursList
.
Where
(
x
=>
x
.
Date
>=
STime
&&
x
.
Date
<=
ETime
&&
x
.
BaseHoursEnabled
==
1
&&
STime
>=
Convert
.
ToDateTime
(
x
.
EnableTime
)).
ToList
();
#
region
基础课时处理
decimal
DeductionMoney
=
0
;
if
(
configModel
.
BasicHours
>
0
&&
mlist
.
Any
())
TeacherHoursList
.
Add
(
new
RB_Teaching_BonusDetail_ViewModel
{
Date
=
item
.
ClassDate
,
TimeBucket
=
item
.
StartDate
+
"~"
+
item
.
EndDate
,
TeacherId
=
item
.
TeacherId
,
TeacherName
=
item
.
TeacherName
,
ClassId
=
item
.
ClassId
,
ClassName
=
item
.
ClassName
,
ClassNo
=
item
.
ClassNo
,
CouseId
=
item
.
CouseId
,
CourseName
=
item
.
CourseName
,
KSNum
=
KSNum
,
Hours
=
Hours
,
HourMoney
=
HourMoney
,
UnitPrice
=
unitPrice
,
Money
=
KSMoney
,
BaseHoursEnabled
=
item
.
BaseHoursEnabled
,
EnableTime
=
item
.
EnableTime
});
}
//初始化 基础课时
DateTime
STime
=
Convert
.
ToDateTime
(
Convert
.
ToDateTime
(
StartTime
).
ToString
(
"yyyy-MM"
)
+
"-01"
);
while
(
true
)
{
//遍历所有老师
List
<
int
>
TeacherIdList
=
mlist
.
Select
(
x
=>
x
.
TeacherId
).
Distinct
().
ToList
();
foreach
(
var
item
in
TeacherIdList
)
DateTime
ETime
=
STime
.
AddMonths
(
1
).
AddDays
(-
1
);
var
mlist
=
TeacherHoursList
.
Where
(
x
=>
x
.
Date
>=
STime
&&
x
.
Date
<=
ETime
&&
x
.
BaseHoursEnabled
==
1
&&
STime
>=
Convert
.
ToDateTime
(
x
.
EnableTime
)).
ToList
();
#
region
基础课时处理
decimal
DeductionMoney
=
0
;
if
(
configModel
.
BasicHours
>
0
&&
mlist
.
Any
())
{
var
qblist
=
mlist
.
Where
(
x
=>
x
.
TeacherId
==
item
).
OrderBy
(
x
=>
x
.
Date
).
ThenBy
(
x
=>
x
.
UnitPrice
).
ToList
();
decimal
BasicHours
=
(
decimal
)
configModel
.
BasicHours
;
foreach
(
var
qitem
in
qbl
ist
)
//遍历所有老师
List
<
int
>
TeacherIdList
=
mlist
.
Select
(
x
=>
x
.
TeacherId
).
Distinct
().
ToList
()
;
foreach
(
var
item
in
TeacherIdL
ist
)
{
decimal
CourseHour
=
0
,
DeductionHour
=
0
;
if
(
BasicHours
>
qitem
.
KSNum
)
{
DeductionHour
=
qitem
.
KSNum
;
BasicHours
-=
qitem
.
KSNum
;
DeductionMoney
+=
qitem
.
KSNum
*
qitem
.
UnitPrice
;
}
else
{
DeductionHour
=
BasicHours
;
CourseHour
=
qitem
.
KSNum
-
BasicHours
;
DeductionMoney
+=
BasicHours
*
qitem
.
UnitPrice
;
BasicHours
=
0
;
}
qitem
.
KSNum
=
CourseHour
;
qitem
.
DKNum
=
DeductionHour
;
qitem
.
Money
=
CourseHour
*
qitem
.
UnitPrice
;
if
(
BasicHours
<=
0
)
var
qblist
=
mlist
.
Where
(
x
=>
x
.
TeacherId
==
item
).
OrderBy
(
x
=>
x
.
Date
).
ThenBy
(
x
=>
x
.
UnitPrice
).
ToList
();
decimal
BasicHours
=
(
decimal
)
configModel
.
BasicHours
;
foreach
(
var
qitem
in
qblist
)
{
break
;
decimal
CourseHour
=
0
,
DeductionHour
=
0
;
if
(
BasicHours
>
qitem
.
KSNum
)
{
DeductionHour
=
qitem
.
KSNum
;
BasicHours
-=
qitem
.
KSNum
;
DeductionMoney
+=
qitem
.
KSNum
*
qitem
.
UnitPrice
;
}
else
{
DeductionHour
=
BasicHours
;
CourseHour
=
qitem
.
KSNum
-
BasicHours
;
DeductionMoney
+=
BasicHours
*
qitem
.
UnitPrice
;
BasicHours
=
0
;
}
qitem
.
KSNum
=
CourseHour
;
qitem
.
DKNum
=
DeductionHour
;
qitem
.
Money
=
CourseHour
*
qitem
.
UnitPrice
;
if
(
BasicHours
<=
0
)
{
break
;
}
}
}
}
}
#
endregion
#
endregion
if
(
STime
.
ToString
(
"yyyy-MM"
)
==
Convert
.
ToDateTime
(
EndTime
).
ToString
(
"yyyy-MM"
))
{
break
;
if
(
STime
.
ToString
(
"yyyy-MM"
)
==
Convert
.
ToDateTime
(
EndTime
).
ToString
(
"yyyy-MM"
))
{
break
;
}
STime
=
STime
.
AddMonths
(
1
);
}
STime
=
STime
.
AddMonths
(
1
);
}
TeacherHoursList
=
TeacherHoursList
.
Where
(
x
=>
x
.
ClassId
==
classId
).
ToList
();
}
#
endregion
...
...
Edu.Repository/Course/RB_OrderRepository.cs
View file @
82fbb887
...
...
@@ -195,7 +195,7 @@ ORDER BY {orderBy}
}
if
(!
string
.
IsNullOrEmpty
(
demodel
.
ClassNo
))
{
where
+=
$@" and c.
{
nameof
(
RB_Class
.
ClassNo
)}
=
{
demodel
.
ClassNo
}
"
;
where
+=
$@" and c.
{
nameof
(
RB_Class
.
ClassNo
)}
=
'
{
demodel
.
ClassNo
}
'
"
;
}
if
(!
string
.
IsNullOrEmpty
(
demodel
.
GuestName
))
{
...
...
@@ -310,6 +310,10 @@ where {where} order by {orderBy}
{
where
+=
$@" and c.
{
nameof
(
RB_Class
.
ClassName
)}
like '%
{
demodel
.
ClassName
}
%'"
;
}
if
(!
string
.
IsNullOrEmpty
(
demodel
.
ClassNo
))
{
where
+=
$@" and c.
{
nameof
(
RB_Class
.
ClassNo
)}
='
{
demodel
.
ClassNo
}
'"
;
}
if
(!
string
.
IsNullOrEmpty
(
demodel
.
GuestName
))
{
if
(
demodel
.
Group_Id
>
0
)
...
...
Edu.WebApi/Controllers/Course/OrderController.cs
View file @
82fbb887
...
...
@@ -1310,7 +1310,8 @@ namespace Edu.WebApi.Controllers.Course
Q_OrderBy
=
base
.
ParmJObj
.
GetInt
(
"Q_OrderBy"
),
PlatformTax
=
base
.
ParmJObj
.
GetDecimal
(
"PlatformTax"
),
EnterID
=
base
.
ParmJObj
.
GetInt
(
"EnterID"
),
HelpEnterId
=
base
.
ParmJObj
.
GetInt
(
"HelpEnterId"
,
0
)
HelpEnterId
=
base
.
ParmJObj
.
GetInt
(
"HelpEnterId"
,
0
),
ClassNo
=
base
.
ParmJObj
.
GetStringValue
(
"ClassNo"
),
};
demodel
.
Group_Id
=
userInfo
.
Group_Id
;
...
...
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