Chore: Just made it look nicer

This commit is contained in:
Amritanshu Agrawal 2023-08-05 08:05:14 +05:30
parent 7843acea28
commit 9ad411af65
5 changed files with 17 additions and 17 deletions

View File

@ -148,8 +148,8 @@ export class EmployeeBenefitsComponent implements OnInit, AfterViewInit {
if (formValue === undefined) { if (formValue === undefined) {
return; return;
} }
const grossSalary = +(formValue.grossSalary ?? '0'); const grossSalary = Number(formValue.grossSalary);
const daysWorked = +(formValue.daysWorked ?? '0'); const daysWorked = Number(formValue.daysWorked);
const date = this.form.value.date ?? new Date(); const date = this.form.value.date ?? new Date();
const daysInMonth = moment(date).daysInMonth(); const daysInMonth = moment(date).daysInMonth();
const esi = EmployeeBenefitsComponent.getEsi(grossSalary, daysWorked, daysInMonth); const esi = EmployeeBenefitsComponent.getEsi(grossSalary, daysWorked, daysInMonth);

View File

@ -129,8 +129,8 @@ export class EmployeeDetailComponent implements OnInit, AfterViewInit {
const formValue = this.form.value; const formValue = this.form.value;
this.item.name = formValue.name ?? ''; this.item.name = formValue.name ?? '';
this.item.designation = formValue.designation ?? ''; this.item.designation = formValue.designation ?? '';
this.item.salary = +(formValue.salary ?? '0'); this.item.salary = Number(formValue.salary);
this.item.points = +(formValue.points ?? '0'); this.item.points = Number(formValue.points);
this.item.isActive = formValue.isActive ?? true; this.item.isActive = formValue.isActive ?? true;
this.item.costCentre.id = formValue.costCentre ?? ''; this.item.costCentre.id = formValue.costCentre ?? '';
this.item.joiningDate = moment(formValue.joiningDate).format('DD-MMM-YYYY'); this.item.joiningDate = moment(formValue.joiningDate).format('DD-MMM-YYYY');

View File

@ -62,13 +62,13 @@ export class ProductLedgerDataSource extends DataSource<ProductLedgerItem> {
case 'date': case 'date':
return compare(a.date, b.date, isAsc); return compare(a.date, b.date, isAsc);
case 'debitQuantity': case 'debitQuantity':
return compare(Number(a.debitQuantity ?? '0'), Number(b.debitQuantity ?? '0'), isAsc); return compare(Number(a.debitQuantity), Number(b.debitQuantity), isAsc);
case 'debitAmount': case 'debitAmount':
return compare(Number(a.debitAmount ?? '0'), Number(b.debitAmount ?? '0'), isAsc); return compare(Number(a.debitAmount), Number(b.debitAmount), isAsc);
case 'creditQuantity': case 'creditQuantity':
return compare(Number(a.creditQuantity ?? '0'), Number(b.creditQuantity ?? '0'), isAsc); return compare(Number(a.creditQuantity), Number(b.creditQuantity), isAsc);
case 'creditAmount': case 'creditAmount':
return compare(Number(a.creditAmount ?? '0'), Number(b.creditAmount ?? '0'), isAsc); return compare(Number(a.creditAmount), Number(b.creditAmount), isAsc);
default: default:
return 0; return 0;
} }

View File

@ -113,12 +113,12 @@ export class ProductLedgerComponent implements OnInit, AfterViewInit {
this.runningAmount = 0; this.runningAmount = 0;
this.info.body.forEach((item) => { this.info.body.forEach((item) => {
if (item.type !== 'Opening Balance') { if (item.type !== 'Opening Balance') {
this.debitAmount += Number(item.debitAmount ?? '0'); this.debitAmount += Number(item.debitAmount);
this.creditQuantity += Number(item.creditQuantity ?? '0'); this.creditQuantity += Number(item.creditQuantity);
this.creditAmount += Number(item.creditAmount ?? '0'); this.creditAmount += Number(item.creditAmount);
} }
this.runningQuantity += Number(item.debitQuantity ?? '0') - Number(item.creditQuantity ?? '0'); this.runningQuantity += Number(item.debitQuantity) - Number(item.creditQuantity);
this.runningAmount += Number(item.debitAmount ?? '0') - Number(item.creditAmount ?? '0'); this.runningAmount += Number(item.debitAmount) - Number(item.creditAmount);
item.runningQuantity = this.runningQuantity; item.runningQuantity = this.runningQuantity;
item.runningAmount = this.runningAmount; item.runningAmount = this.runningAmount;
}); });

View File

@ -113,22 +113,22 @@ export class ProductDetailComponent implements OnInit, AfterViewInit {
if (formValue === undefined) { if (formValue === undefined) {
return; return;
} }
const fraction = +(formValue.fraction ?? '0'); const fraction = Number(formValue.fraction);
if (fraction < 1) { if (fraction < 1) {
this.toaster.show('Danger', 'Fraction has to be >= 1'); this.toaster.show('Danger', 'Fraction has to be >= 1');
return; return;
} }
const productYield = +(formValue.productYield ?? '0'); const productYield = Number(formValue.productYield);
if (productYield < 0 || productYield > 1) { if (productYield < 0 || productYield > 1) {
this.toaster.show('Danger', 'Product Yield has to be > 0 and <= 1'); this.toaster.show('Danger', 'Product Yield has to be > 0 and <= 1');
return; return;
} }
const costPrice = +(formValue.costPrice ?? '0'); const costPrice = Number(formValue.costPrice);
if (costPrice < 0) { if (costPrice < 0) {
this.toaster.show('Danger', 'Price has to be >= 0'); this.toaster.show('Danger', 'Price has to be >= 0');
return; return;
} }
const salePrice = +(formValue.salePrice ?? '0'); const salePrice = Number(formValue.salePrice);
if (salePrice < 0) { if (salePrice < 0) {
this.toaster.show('Danger', 'Sale Price has to be >= 0'); this.toaster.show('Danger', 'Sale Price has to be >= 0');
return; return;