แก้บันทึกstepเงินเดือน
This commit is contained in:
parent
596efe624a
commit
64f9cd9421
2 changed files with 44 additions and 30 deletions
|
|
@ -185,7 +185,8 @@ export class SalaryPeriodController extends Controller {
|
|||
salaryProfile.salaryOrg.sixPercentAmount -
|
||||
sumAmountUse.totalAmount -
|
||||
salaryProfile.salaryOrg.spentAmount;
|
||||
salaryProfile.salaryOrg.useAmount = sumAmountUse.totalAmount;
|
||||
salaryProfile.salaryOrg.useAmount =
|
||||
sumAmountUse == null || sumAmountUse.totalAmount == null ? 0 : sumAmountUse.totalAmount;
|
||||
salaryProfile.salaryOrg.remainingAmount = calRemainAmount;
|
||||
await this.salaryOrgRepository.save(salaryProfile?.salaryOrg);
|
||||
}
|
||||
|
|
@ -414,7 +415,8 @@ export class SalaryPeriodController extends Controller {
|
|||
salaryProfile.salaryOrg.sixPercentAmount -
|
||||
sumAmountUse.totalAmount -
|
||||
salaryProfile.salaryOrg.spentAmount;
|
||||
salaryProfile.salaryOrg.useAmount = sumAmountUse.totalAmount;
|
||||
salaryProfile.salaryOrg.useAmount =
|
||||
sumAmountUse == null || sumAmountUse.totalAmount == null ? 0 : sumAmountUse.totalAmount;
|
||||
salaryProfile.salaryOrg.remainingAmount = calRemainAmount;
|
||||
await this.salaryOrgRepository.save(salaryProfile?.salaryOrg);
|
||||
}
|
||||
|
|
@ -476,7 +478,8 @@ export class SalaryPeriodController extends Controller {
|
|||
.getRawOne();
|
||||
const calRemainAmount =
|
||||
salaryOrg.sixPercentAmount - sumAmountUse.totalAmount - salaryOrg.spentAmount;
|
||||
salaryOrg.useAmount = sumAmountUse.totalAmount;
|
||||
salaryOrg.useAmount =
|
||||
sumAmountUse == null || sumAmountUse.totalAmount == null ? 0 : sumAmountUse.totalAmount;
|
||||
salaryOrg.remainingAmount = calRemainAmount;
|
||||
await this.salaryOrgRepository.save(salaryOrg);
|
||||
}
|
||||
|
|
@ -734,7 +737,8 @@ export class SalaryPeriodController extends Controller {
|
|||
salaryProfile.salaryOrg.sixPercentAmount -
|
||||
sumAmountUse.totalAmount -
|
||||
salaryProfile.salaryOrg.spentAmount;
|
||||
salaryProfile.salaryOrg.useAmount = sumAmountUse.totalAmount;
|
||||
salaryProfile.salaryOrg.useAmount =
|
||||
sumAmountUse == null || sumAmountUse.totalAmount == null ? 0 : sumAmountUse.totalAmount;
|
||||
salaryProfile.salaryOrg.remainingAmount = calRemainAmount;
|
||||
await this.salaryOrgRepository.save(salaryProfile.salaryOrg);
|
||||
}
|
||||
|
|
@ -1122,7 +1126,8 @@ export class SalaryPeriodController extends Controller {
|
|||
.getRawOne();
|
||||
const calRemainAmount =
|
||||
salaryOrg.sixPercentAmount - sumAmountUse.totalAmount - salaryOrg.spentAmount;
|
||||
_salaryOrg.useAmount = sumAmountUse.totalAmount;
|
||||
_salaryOrg.useAmount =
|
||||
sumAmountUse == null || sumAmountUse.totalAmount == null ? 0 : sumAmountUse.totalAmount;
|
||||
_salaryOrg.remainingAmount = calRemainAmount;
|
||||
await this.salaryOrgRepository.save(_salaryOrg);
|
||||
}
|
||||
|
|
@ -2360,10 +2365,12 @@ export class SalaryPeriodController extends Controller {
|
|||
if (!salaryPeriod)
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลรอบผังเงินเดือนนี้");
|
||||
await Promise.all(
|
||||
salaryPeriod.salaryOrgs.map(async (x) => {
|
||||
x.status = "WAITHEAD1";
|
||||
await this.salaryPeriodRepository.save(salaryPeriod);
|
||||
}),
|
||||
salaryPeriod.salaryOrgs
|
||||
.filter((x) => x.rootId == rootId)
|
||||
.map(async (x) => {
|
||||
x.status = "WAITHEAD1";
|
||||
await this.salaryOrgRepository.save(x);
|
||||
}),
|
||||
);
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
|
@ -2389,7 +2396,7 @@ export class SalaryPeriodController extends Controller {
|
|||
.filter((x) => x.rootId == rootId)
|
||||
.map(async (x) => {
|
||||
x.status = "WAITOWNER1";
|
||||
await this.salaryPeriodRepository.save(salaryPeriod);
|
||||
await this.salaryOrgRepository.save(x);
|
||||
}),
|
||||
);
|
||||
return new HttpSuccess();
|
||||
|
|
@ -2416,7 +2423,7 @@ export class SalaryPeriodController extends Controller {
|
|||
.filter((x) => x.rootId == rootId)
|
||||
.map(async (x) => {
|
||||
x.status = "REPORT";
|
||||
await this.salaryPeriodRepository.save(salaryPeriod);
|
||||
await this.salaryOrgRepository.save(x);
|
||||
}),
|
||||
);
|
||||
return new HttpSuccess();
|
||||
|
|
@ -2451,7 +2458,7 @@ export class SalaryPeriodController extends Controller {
|
|||
.map(async (x) => {
|
||||
x.status = "WAITHEAD2";
|
||||
x.ownerRecommend = body.titleRecommend;
|
||||
await this.salaryPeriodRepository.save(salaryPeriod);
|
||||
await this.salaryOrgRepository.save(x);
|
||||
}),
|
||||
);
|
||||
return new HttpSuccess();
|
||||
|
|
@ -2486,7 +2493,7 @@ export class SalaryPeriodController extends Controller {
|
|||
.map(async (x) => {
|
||||
x.status = "REPORT";
|
||||
x.ownerRecommend = body.titleRecommend;
|
||||
await this.salaryPeriodRepository.save(salaryPeriod);
|
||||
await this.salaryOrgRepository.save(x);
|
||||
}),
|
||||
);
|
||||
return new HttpSuccess();
|
||||
|
|
|
|||
|
|
@ -184,7 +184,8 @@ export class SalaryPeriodEmployeeController extends Controller {
|
|||
salaryProfile.salaryOrg.sixPercentAmount -
|
||||
sumAmountUse.totalAmount -
|
||||
salaryProfile.salaryOrg.spentAmount;
|
||||
salaryProfile.salaryOrg.useAmount = sumAmountUse.totalAmount;
|
||||
salaryProfile.salaryOrg.useAmount =
|
||||
sumAmountUse == null || sumAmountUse.totalAmount == null ? 0 : sumAmountUse.totalAmount;
|
||||
salaryProfile.salaryOrg.remainingAmount = calRemainAmount;
|
||||
await this.salaryOrgRepository.save(salaryProfile?.salaryOrg);
|
||||
}
|
||||
|
|
@ -415,7 +416,8 @@ export class SalaryPeriodEmployeeController extends Controller {
|
|||
salaryProfile.salaryOrg.sixPercentAmount -
|
||||
sumAmountUse.totalAmount -
|
||||
salaryProfile.salaryOrg.spentAmount;
|
||||
salaryProfile.salaryOrg.useAmount = sumAmountUse.totalAmount;
|
||||
salaryProfile.salaryOrg.useAmount =
|
||||
sumAmountUse == null || sumAmountUse.totalAmount == null ? 0 : sumAmountUse.totalAmount;
|
||||
salaryProfile.salaryOrg.remainingAmount = calRemainAmount;
|
||||
await this.salaryOrgRepository.save(salaryProfile?.salaryOrg);
|
||||
}
|
||||
|
|
@ -477,7 +479,8 @@ export class SalaryPeriodEmployeeController extends Controller {
|
|||
.getRawOne();
|
||||
const calRemainAmount =
|
||||
salaryOrg.sixPercentAmount - sumAmountUse.totalAmount - salaryOrg.spentAmount;
|
||||
salaryOrg.useAmount = sumAmountUse.totalAmount;
|
||||
salaryOrg.useAmount =
|
||||
sumAmountUse == null || sumAmountUse.totalAmount == null ? 0 : sumAmountUse.totalAmount;
|
||||
salaryOrg.remainingAmount = calRemainAmount;
|
||||
await this.salaryOrgRepository.save(salaryOrg);
|
||||
}
|
||||
|
|
@ -737,7 +740,8 @@ export class SalaryPeriodEmployeeController extends Controller {
|
|||
salaryProfile.salaryOrg.sixPercentAmount -
|
||||
sumAmountUse.totalAmount -
|
||||
salaryProfile.salaryOrg.spentAmount;
|
||||
salaryProfile.salaryOrg.useAmount = sumAmountUse.totalAmount;
|
||||
salaryProfile.salaryOrg.useAmount =
|
||||
sumAmountUse == null || sumAmountUse.totalAmount == null ? 0 : sumAmountUse.totalAmount;
|
||||
salaryProfile.salaryOrg.remainingAmount = calRemainAmount;
|
||||
await this.salaryOrgRepository.save(salaryProfile.salaryOrg);
|
||||
}
|
||||
|
|
@ -1125,7 +1129,8 @@ export class SalaryPeriodEmployeeController extends Controller {
|
|||
.getRawOne();
|
||||
const calRemainAmount =
|
||||
salaryOrg.sixPercentAmount - sumAmountUse.totalAmount - salaryOrg.spentAmount;
|
||||
_salaryOrg.useAmount = sumAmountUse.totalAmount;
|
||||
_salaryOrg.useAmount =
|
||||
sumAmountUse == null || sumAmountUse.totalAmount == null ? 0 : sumAmountUse.totalAmount;
|
||||
_salaryOrg.remainingAmount = calRemainAmount;
|
||||
await this.salaryOrgRepository.save(_salaryOrg);
|
||||
}
|
||||
|
|
@ -1461,10 +1466,12 @@ export class SalaryPeriodEmployeeController extends Controller {
|
|||
if (!salaryPeriod)
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลรอบผังเงินเดือนนี้");
|
||||
await Promise.all(
|
||||
salaryPeriod.salaryOrgs.map(async (x) => {
|
||||
x.status = "WAITHEAD1";
|
||||
await this.salaryPeriodRepository.save(salaryPeriod);
|
||||
}),
|
||||
salaryPeriod.salaryOrgs
|
||||
.filter((x) => x.rootId == rootId)
|
||||
.map(async (x: any) => {
|
||||
x.status = "WAITHEAD1";
|
||||
await this.salaryOrgRepository.save(x);
|
||||
}),
|
||||
);
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
|
@ -1488,9 +1495,9 @@ export class SalaryPeriodEmployeeController extends Controller {
|
|||
await Promise.all(
|
||||
salaryPeriod.salaryOrgs
|
||||
.filter((x) => x.rootId == rootId)
|
||||
.map(async (x) => {
|
||||
.map(async (x: any) => {
|
||||
x.status = "WAITOWNER1";
|
||||
await this.salaryPeriodRepository.save(salaryPeriod);
|
||||
await this.salaryOrgRepository.save(x);
|
||||
}),
|
||||
);
|
||||
return new HttpSuccess();
|
||||
|
|
@ -1515,9 +1522,9 @@ export class SalaryPeriodEmployeeController extends Controller {
|
|||
await Promise.all(
|
||||
salaryPeriod.salaryOrgs
|
||||
.filter((x) => x.rootId == rootId)
|
||||
.map(async (x) => {
|
||||
.map(async (x: any) => {
|
||||
x.status = "REPORT";
|
||||
await this.salaryPeriodRepository.save(salaryPeriod);
|
||||
await this.salaryOrgRepository.save(x);
|
||||
}),
|
||||
);
|
||||
return new HttpSuccess();
|
||||
|
|
@ -1549,10 +1556,10 @@ export class SalaryPeriodEmployeeController extends Controller {
|
|||
await Promise.all(
|
||||
salaryPeriod.salaryOrgs
|
||||
.filter((x) => x.rootId == rootId)
|
||||
.map(async (x) => {
|
||||
.map(async (x: any) => {
|
||||
x.status = "WAITHEAD2";
|
||||
x.ownerRecommend = body.titleRecommend;
|
||||
await this.salaryPeriodRepository.save(salaryPeriod);
|
||||
await this.salaryOrgRepository.save(x);
|
||||
}),
|
||||
);
|
||||
return new HttpSuccess();
|
||||
|
|
@ -1584,10 +1591,10 @@ export class SalaryPeriodEmployeeController extends Controller {
|
|||
await Promise.all(
|
||||
salaryPeriod.salaryOrgs
|
||||
.filter((x) => x.rootId == rootId)
|
||||
.map(async (x) => {
|
||||
.map(async (x: any) => {
|
||||
x.status = "REPORT";
|
||||
x.ownerRecommend = body.titleRecommend;
|
||||
await this.salaryPeriodRepository.save(salaryPeriod);
|
||||
await this.salaryOrgRepository.save(x);
|
||||
}),
|
||||
);
|
||||
return new HttpSuccess();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue