Feature: Tax Regimes are added so that different bills with different series can be printed for Different regimes such as VAT and GST

Chore: Model relationships updated to make them simpler
Chore: Bill printing majorly refactored for it

Due to the sheer depth of the changes. There can be showstoppers. Please test it carefully
This commit is contained in:
2023-03-05 23:50:41 +05:30
parent 802eded568
commit e46fe7f90e
141 changed files with 2197 additions and 892 deletions

View File

@ -1,5 +1,5 @@
import { Component, OnInit } from '@angular/core';
import { UntypedFormBuilder, UntypedFormGroup } from '@angular/forms';
import { FormControl, FormGroup } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router';
import * as moment from 'moment';
@ -20,7 +20,11 @@ export class CashierReportComponent implements OnInit {
activeCashiers: User[] = [];
info: CashierReport = new CashierReport();
dataSource: CashierReportDataSource = new CashierReportDataSource(this.info.amounts);
form: UntypedFormGroup;
form: FormGroup<{
startDate: FormControl<Date>;
finishDate: FormControl<Date>;
cashier: FormControl<string | null>;
}>;
/** Columns displayed in the table. Columns IDs can be added, removed, or reordered. */
displayedColumns = ['name', 'amount'];
@ -28,16 +32,15 @@ export class CashierReportComponent implements OnInit {
constructor(
private route: ActivatedRoute,
private router: Router,
private fb: UntypedFormBuilder,
private toCsv: ToCsvService,
private toaster: ToasterService,
private ser: CashierReportService,
) {
// Create form
this.form = this.fb.group({
startDate: '',
finishDate: '',
cashier: '',
this.form = new FormGroup({
startDate: new FormControl(new Date(), { nonNullable: true }),
finishDate: new FormControl(new Date(), { nonNullable: true }),
cashier: new FormControl<string | null>(null),
});
}
@ -47,7 +50,7 @@ export class CashierReportComponent implements OnInit {
this.activeCashiers = data.cashiers;
this.info = data.info;
this.form.setValue({
cashier: this.info.cashier.id,
cashier: this.info.cashier.id ?? '',
startDate: moment(this.info.startDate, 'DD-MMM-YYYY').toDate(),
finishDate: moment(this.info.finishDate, 'DD-MMM-YYYY').toDate(),
});
@ -86,7 +89,7 @@ export class CashierReportComponent implements OnInit {
const formModel = this.form.value;
return new CashierReport({
cashier: new User({ id: formModel.cashier }),
cashier: new User({ id: formModel.cashier ?? undefined }),
cashiers: this.info.cashiers,
startDate: moment(formModel.startDate).format('DD-MMM-YYYY'),
finishDate: moment(formModel.finishDate).format('DD-MMM-YYYY'),