Merge branch 'develop'
This commit is contained in:
commit
ae2b47a5c5
4 changed files with 28 additions and 22 deletions
|
|
@ -321,6 +321,7 @@ export class BranchController extends Controller {
|
||||||
district: true,
|
district: true,
|
||||||
subDistrict: true,
|
subDistrict: true,
|
||||||
},
|
},
|
||||||
|
orderBy: { code: "asc" },
|
||||||
}
|
}
|
||||||
: false,
|
: false,
|
||||||
bank: true,
|
bank: true,
|
||||||
|
|
@ -364,6 +365,7 @@ export class BranchController extends Controller {
|
||||||
bank: true,
|
bank: true,
|
||||||
contact: includeContact,
|
contact: includeContact,
|
||||||
},
|
},
|
||||||
|
orderBy: { code: "asc" },
|
||||||
},
|
},
|
||||||
bank: true,
|
bank: true,
|
||||||
contact: includeContact,
|
contact: includeContact,
|
||||||
|
|
|
||||||
|
|
@ -487,7 +487,9 @@ export class QuotationController extends Controller {
|
||||||
|
|
||||||
const price = finalPriceWithVat;
|
const price = finalPriceWithVat;
|
||||||
const pricePerUnit = price / (1 + VAT_DEFAULT);
|
const pricePerUnit = price / (1 + VAT_DEFAULT);
|
||||||
const vat = p.calcVat ? (pricePerUnit * v.amount - (v.discount || 0)) * VAT_DEFAULT : 0;
|
const vat = (body.agentPrice ? p.agentPriceCalcVat : p.calcVat)
|
||||||
|
? (pricePerUnit * v.amount - (v.discount || 0)) * VAT_DEFAULT
|
||||||
|
: 0;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
order: i + 1,
|
order: i + 1,
|
||||||
|
|
@ -754,7 +756,9 @@ export class QuotationController extends Controller {
|
||||||
|
|
||||||
const price = finalPriceWithVat;
|
const price = finalPriceWithVat;
|
||||||
const pricePerUnit = price / (1 + VAT_DEFAULT);
|
const pricePerUnit = price / (1 + VAT_DEFAULT);
|
||||||
const vat = p.calcVat ? (pricePerUnit * v.amount - (v.discount || 0)) * VAT_DEFAULT : 0;
|
const vat = (record.agentPrice ? p.agentPriceCalcVat : p.calcVat)
|
||||||
|
? (pricePerUnit * v.amount - (v.discount || 0)) * VAT_DEFAULT
|
||||||
|
: 0;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
order: i + 1,
|
order: i + 1,
|
||||||
|
|
@ -1047,7 +1051,7 @@ export class QuotationActionController extends Controller {
|
||||||
const data = await tx.employee.create({
|
const data = await tx.employee.create({
|
||||||
data: {
|
data: {
|
||||||
...v.workerData,
|
...v.workerData,
|
||||||
code: `${customerBranch.code}-${`${new Date().getFullYear()}`.slice(-2).padStart(2, "0")}${`${lastEmployee.value - nonExistEmployee.length + i + 1}`.padStart(7, "0")}`,
|
code: `${customerBranch.code}-${`${new Date().getFullYear()}`.slice(-2).padStart(2, "0")}${`${lastEmployee.value - newEmployee.length + i + 1}`.padStart(7, "0")}`,
|
||||||
customerBranchId: customerBranch.id,
|
customerBranchId: customerBranch.id,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -369,11 +369,13 @@ export class RequestListController extends Controller {
|
||||||
employee: true,
|
employee: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
stepStatus: {
|
stepStatus: cancelOnly
|
||||||
include: {
|
? true
|
||||||
task: { where: { taskStatus: TaskStatus.Complete } },
|
: {
|
||||||
},
|
include: {
|
||||||
},
|
task: { where: { taskStatus: TaskStatus.Complete } },
|
||||||
|
},
|
||||||
|
},
|
||||||
productService: {
|
productService: {
|
||||||
include: {
|
include: {
|
||||||
service: {
|
service: {
|
||||||
|
|
|
||||||
|
|
@ -323,16 +323,15 @@ export class CreditNoteController extends Controller {
|
||||||
(v) => v.workStatus === RequestWorkStatus.Completed,
|
(v) => v.workStatus === RequestWorkStatus.Completed,
|
||||||
).length;
|
).length;
|
||||||
|
|
||||||
const price = c.request.quotation.agentPrice ? "price" : "agentPrice";
|
const price =
|
||||||
|
c.productService.pricePerUnit -
|
||||||
|
c.productService.discount / c.productService.amount +
|
||||||
|
c.productService.vat / c.productService.amount;
|
||||||
|
|
||||||
if (serviceChargeStepCount && successCount) {
|
if (serviceChargeStepCount && successCount) {
|
||||||
return (
|
return a + price - c.productService.product.serviceCharge * successCount;
|
||||||
a +
|
|
||||||
c.productService.product[price] -
|
|
||||||
c.productService.product.serviceCharge * successCount
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
return a + c.productService.product.price;
|
return a + price;
|
||||||
}, 0);
|
}, 0);
|
||||||
|
|
||||||
this.setStatus(HttpStatus.CREATED);
|
this.setStatus(HttpStatus.CREATED);
|
||||||
|
|
@ -457,16 +456,15 @@ export class CreditNoteController extends Controller {
|
||||||
(v) => v.workStatus === RequestWorkStatus.Completed,
|
(v) => v.workStatus === RequestWorkStatus.Completed,
|
||||||
).length;
|
).length;
|
||||||
|
|
||||||
const price = c.request.quotation.agentPrice ? "price" : "agentPrice";
|
const price =
|
||||||
|
c.productService.pricePerUnit -
|
||||||
|
c.productService.discount / c.productService.amount +
|
||||||
|
c.productService.vat / c.productService.amount;
|
||||||
|
|
||||||
if (serviceChargeStepCount && successCount) {
|
if (serviceChargeStepCount && successCount) {
|
||||||
return (
|
return a + price - c.productService.product.serviceCharge * successCount;
|
||||||
a +
|
|
||||||
c.productService.product[price] -
|
|
||||||
c.productService.product.serviceCharge * successCount
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
return a + c.productService.product.price;
|
return a + price;
|
||||||
}, 0);
|
}, 0);
|
||||||
|
|
||||||
const record = await prisma.creditNote.update({
|
const record = await prisma.creditNote.update({
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue