Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
code
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
solho
code
Commits
56e3218f
Commit
56e3218f
authored
Aug 26, 2021
by
solho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
關帳日期邏輯調整
parent
95806702
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
9 deletions
+22
-9
WebAPI/Controllers/Esn_Subitem/Esn_todos_SettleController.cs
WebAPI/Controllers/Esn_Subitem/Esn_todos_SettleController.cs
+22
-9
No files found.
WebAPI/Controllers/Esn_Subitem/Esn_todos_SettleController.cs
View file @
56e3218f
...
...
@@ -26,7 +26,7 @@ namespace WebAPI.Controllers
connString
=
ConfigurationManager
.
ConnectionStrings
[
"eflow_cur"
].
ConnectionString
;
}
/// <summary>
/// 取得關帳最
後
日期
/// 取得關帳最
早
日期
/// </summary>
/// <para ></param>
/// <returns></returns>
...
...
@@ -45,32 +45,45 @@ namespace WebAPI.Controllers
using
(
SqlConnection
Conn
=
new
SqlConnection
(
connString
))
{
;
String
@wherecase1
=
""
,
@wherecase2
=
""
;
SqlCommand
cmd
=
new
SqlCommand
(
""
,
Conn
);
String
strsql
=
""
;
strsql
+=
@"
SELECT top 1 CONVERT(varchar(7),Settle_Date,126) Settle_Month from [esn_todos_Settle] a
SELECT top 1 CONVERT(varchar(7),Settle_Date,126) Settle_Month,(
SELECT top 1 CONVERT(varchar(7),Settle_Date,126) Settle_Month from [esn_todos_Settle] a
left join [evw_qResult_EmpDS] b on a.DSNum=b.Emp_DSNum
left join [evw_qResult_Dept] c on a.DeptNum=c.targetID
left join [evw_qResult_EmpItem] d on a.ItemNum=d.Emp_ItemNum
where 1=1 @wherecase1
order by Settle_Date
) as minSettle_Month from [esn_todos_Settle] a
left join [evw_qResult_EmpDS] b on a.DSNum=b.Emp_DSNum
left join [evw_qResult_Dept] c on a.DeptNum=c.targetID
left join [evw_qResult_EmpItem] d on a.ItemNum=d.Emp_ItemNum
where 1=1
where 1=1
@wherecase2
"
;
JObject
objPermission_furtherSql
=
JObject
.
Parse
(
obj_input
[
"Permission_furtherSql"
].
ToString
());
if
(
obj_input
[
"Settle_Date"
]
!=
null
)
{
{
@wherecase2
+=
" and Settle_Date between @Settle_Date and @Settle_Date "
;
strsql
+=
" and Settle_Date between @Settle_Date and @Settle_Date "
;
cmd
.
Parameters
.
Add
(
"@Settle_Date"
,
obj_input
[
"Settle_Date"
].
ToString
());
}
if
(
obj_input
[
"isClosed"
]
!=
null
)
{
strsql
+=
" and isClosed=@isClosed "
;
{
@wherecase2
+=
" and isClosed=@isClosed "
;
cmd
.
Parameters
.
Add
(
"@isClosed"
,
(
obj_input
[
"isClosed"
].
ToString
()
==
"1"
?
true
:
false
));
}
if
(
objPermission_furtherSql
[
"firmID"
]
!=
null
)
if
(
objPermission_furtherSql
[
"firmID"
]
!=
null
&&
!
String
.
IsNullOrEmpty
(
objPermission_furtherSql
[
"firmID"
].
ToString
())
)
{
strsql
+=
" and b.ID in(@DSid)"
;
strsql
=
strsql
.
Replace
(
"@DSid"
,
objPermission_furtherSql
[
"firmID"
].
ToString
());
@wherecase1
+=
" and b.ID in(@DSid)"
;
@wherecase2
+=
" and b.ID in(@DSid)"
;
@wherecase1
=
@wherecase1
.
Replace
(
"@DSid"
,
objPermission_furtherSql
[
"firmID"
].
ToString
());
@wherecase2
=
@wherecase2
.
Replace
(
"@DSid"
,
objPermission_furtherSql
[
"firmID"
].
ToString
());
//cmd.Parameters.Add("@DSid", objPermission_furtherSql["firmID"].ToString());
}
strsql
=
strsql
.
Replace
(
"@wherecase1"
,
@wherecase1
).
Replace
(
"@wherecase2"
,
@wherecase2
);
strsql
+=
" order by a.Settle_Date"
;
response
.
Code
=
"1"
;
cmd
.
CommandText
=
strsql
;
...
...
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