Refactor code structure for improved readability and maintainability
This commit is contained in:
+1
@@ -4,6 +4,7 @@
|
||||
<field-mobile-number [control]="form.controls.mobile_number" />
|
||||
<field-national-id [control]="form.controls.national_id" />
|
||||
<field-economic-code [control]="form.controls.economic_code" />
|
||||
<field-postal-code [control]="form.controls.postal_code" />
|
||||
|
||||
<app-form-footer-actions submitLabel="ثبت مشتری و ادامه" (onCancel)="close()" (onSubmit)="submit()" />
|
||||
</form>
|
||||
|
||||
@@ -5,6 +5,7 @@ import {
|
||||
LastNameComponent,
|
||||
MobileNumberComponent,
|
||||
NationalIdComponent,
|
||||
PostalCodeComponent,
|
||||
} from '@/shared/components';
|
||||
import { FormFooterActionsComponent } from '@/shared/components/formFooterActions/form-footer-actions.component';
|
||||
import { fieldControl } from '@/shared/constants';
|
||||
@@ -26,6 +27,7 @@ import { PosLandingStore } from '../../../store/main.store';
|
||||
NationalIdComponent,
|
||||
EconomicCodeComponent,
|
||||
MobileNumberComponent,
|
||||
PostalCodeComponent,
|
||||
],
|
||||
})
|
||||
export class CustomerIndividualFormComponent extends AbstractForm<
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@
|
||||
}
|
||||
</div>
|
||||
<div class="flex justify-between items-center">
|
||||
<span>مالیات (۱۰٪)</span>
|
||||
<span>ارزش افزوده</span>
|
||||
<span [appPriceMask]="taxAmount"></span>
|
||||
</div>
|
||||
<hr />
|
||||
|
||||
@@ -132,9 +132,14 @@ export class PosGoldPayloadFormComponent extends AbstractForm<
|
||||
const totalAmountBeforeProfit = unitWithQuantity + wageAmount + commissionAmount;
|
||||
const baseTotalAmount = totalAmountBeforeProfit + profitAmount;
|
||||
const baseAmountForDiscountCalculation =
|
||||
this.discountType() === 1 ? profitAmount : baseTotalAmount;
|
||||
this.discountType() === 1 ? profitAmount : unitWithQuantity;
|
||||
|
||||
const taxAmount = (profitAmount + commissionAmount + wageAmount - discountAmount) * 0.1;
|
||||
const taxAmount =
|
||||
(profitAmount +
|
||||
commissionAmount +
|
||||
wageAmount -
|
||||
(this.discountType() === 1 ? discountAmount : 0)) *
|
||||
0.1;
|
||||
const totalAmount = baseTotalAmount - discountAmount + taxAmount;
|
||||
|
||||
this.unitWithQuantity.set(unitWithQuantity);
|
||||
|
||||
Reference in New Issue
Block a user