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,
|
||||
subDistrict: true,
|
||||
},
|
||||
orderBy: { code: "asc" },
|
||||
}
|
||||
: false,
|
||||
bank: true,
|
||||
|
|
@ -364,6 +365,7 @@ export class BranchController extends Controller {
|
|||
bank: true,
|
||||
contact: includeContact,
|
||||
},
|
||||
orderBy: { code: "asc" },
|
||||
},
|
||||
bank: true,
|
||||
contact: includeContact,
|
||||
|
|
|
|||
|
|
@ -487,7 +487,9 @@ export class QuotationController extends Controller {
|
|||
|
||||
const price = finalPriceWithVat;
|
||||
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 {
|
||||
order: i + 1,
|
||||
|
|
@ -754,7 +756,9 @@ export class QuotationController extends Controller {
|
|||
|
||||
const price = finalPriceWithVat;
|
||||
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 {
|
||||
order: i + 1,
|
||||
|
|
@ -1047,7 +1051,7 @@ export class QuotationActionController extends Controller {
|
|||
const data = await tx.employee.create({
|
||||
data: {
|
||||
...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,
|
||||
},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -369,11 +369,13 @@ export class RequestListController extends Controller {
|
|||
employee: true,
|
||||
},
|
||||
},
|
||||
stepStatus: {
|
||||
include: {
|
||||
task: { where: { taskStatus: TaskStatus.Complete } },
|
||||
},
|
||||
},
|
||||
stepStatus: cancelOnly
|
||||
? true
|
||||
: {
|
||||
include: {
|
||||
task: { where: { taskStatus: TaskStatus.Complete } },
|
||||
},
|
||||
},
|
||||
productService: {
|
||||
include: {
|
||||
service: {
|
||||
|
|
|
|||
|
|
@ -323,16 +323,15 @@ export class CreditNoteController extends Controller {
|
|||
(v) => v.workStatus === RequestWorkStatus.Completed,
|
||||
).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) {
|
||||
return (
|
||||
a +
|
||||
c.productService.product[price] -
|
||||
c.productService.product.serviceCharge * successCount
|
||||
);
|
||||
return a + price - c.productService.product.serviceCharge * successCount;
|
||||
}
|
||||
return a + c.productService.product.price;
|
||||
return a + price;
|
||||
}, 0);
|
||||
|
||||
this.setStatus(HttpStatus.CREATED);
|
||||
|
|
@ -457,16 +456,15 @@ export class CreditNoteController extends Controller {
|
|||
(v) => v.workStatus === RequestWorkStatus.Completed,
|
||||
).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) {
|
||||
return (
|
||||
a +
|
||||
c.productService.product[price] -
|
||||
c.productService.product.serviceCharge * successCount
|
||||
);
|
||||
return a + price - c.productService.product.serviceCharge * successCount;
|
||||
}
|
||||
return a + c.productService.product.price;
|
||||
return a + price;
|
||||
}, 0);
|
||||
|
||||
const record = await prisma.creditNote.update({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue