#1451,#1452

This commit is contained in:
AdisakKanthawilang 2025-04-28 10:48:58 +07:00
parent 2f0d86ed58
commit f456c0821b
3 changed files with 58 additions and 0 deletions

View file

@ -1554,6 +1554,7 @@ export class SalaryPeriodController extends Controller {
},
) {
await new permission().PermissionList(request, "SYS_SALARY_OFFICER");
const _data = await new permission().PermissionOrgList(request, "SYS_SALARY_OFFICER");
const salaryOrg = await this.salaryOrgRepository.findOne({
where: {
id: id,
@ -1626,6 +1627,56 @@ export class SalaryPeriodController extends Controller {
);
}),
)
.andWhere(
_data.root != undefined && _data.root != null
? _data.root[0] != null
? `rootId IN (:...root)`
: `rootId is null`
: "1=1",
{
root: ["4b574414-5faa-438c-829a-3c6444582cfd"],
},
)
.andWhere(
_data.child1 != undefined && _data.child1 != null
? _data.child1[0] != null
? `child1Id IN (:...child1)`
: `child1Id is null`
: "1=1",
{
child1: _data.child1,
},
)
.andWhere(
_data.child2 != undefined && _data.child2 != null
? _data.child2[0] != null
? `child2Id IN (:...child2)`
: `child2Id is null`
: "1=1",
{
child2: _data.child2,
},
)
.andWhere(
_data.child3 != undefined && _data.child3 != null
? _data.child3[0] != null
? `child3Id IN (:...child3)`
: `child3Id is null`
: "1=1",
{
child3: _data.child3,
},
)
.andWhere(
_data.child4 != undefined && _data.child4 != null
? _data.child4[0] != null
? `child4Id IN (:...child4)`
: `child4Id is null`
: "1=1",
{
child4: _data.child4,
},
)
.orderBy("profile.rootOrder", "ASC")
.addOrderBy("profile.child1Order", "ASC")
.addOrderBy("profile.child2Order", "ASC")
@ -2738,6 +2789,7 @@ export class SalaryPeriodController extends Controller {
});
salaryProfileNew.type = salaryOld == null ? 0 : salaryOld.type;
salaryProfileNew.salaryLevel = salaryOld && salaryOld.salaryLevelNew ? salaryOld.salaryLevelNew : salaryOld?.salaryLevel;
salaryProfileNew.group = salaryOld && salaryOld.groupNew ? salaryOld.groupNew : salaryOld?.group;
salaryProfileNew.amount = salaryOld == null ? 0 : salaryOld.amount;
salaryProfileNew.amountSpecial = salaryOld == null ? 0 : salaryOld.amountSpecial;
salaryProfileNew.amountUse = salaryOld == null ? 0 : salaryOld.amountUse;