Bump to version 3.0.0

Printing done on:
 Cashier Report
 Discount Report
 Sale Report
This commit is contained in:
2020-10-27 12:13:17 +05:30
parent 00fe2410b7
commit cbc2f29e29
32 changed files with 690 additions and 110 deletions

View File

@ -2,3 +2,7 @@
display: flex;
justify-content: flex-end;
}
.spacer {
flex: 1 1 auto;
}

View File

@ -1,9 +1,13 @@
<mat-card>
<mat-card-title-group>
<mat-card-title>Discount Report</mat-card-title>
<span class="spacer"></span>
<button mat-button mat-icon-button (click)="exportCsv()">
<mat-icon>save_alt</mat-icon>
</button>
<button mat-button mat-icon-button (click)="print()">
<mat-icon>print</mat-icon>
</button>
</mat-card-title-group>
<mat-card-content>
<form [formGroup]="form" fxLayout="column">

View File

@ -3,10 +3,12 @@ import { FormBuilder, FormGroup } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router';
import * as moment from 'moment';
import { ToasterService } from '../core/toaster.service';
import { ToCsvService } from '../shared/to-csv.service';
import { DiscountReport } from './discount-report';
import { DiscountReportDataSource } from './discount-report-datasource';
import { DiscountReportService } from './discount-report.service';
@Component({
selector: 'app-discount-report',
@ -26,6 +28,8 @@ export class DiscountReportComponent implements OnInit {
private router: Router,
private fb: FormBuilder,
private toCsv: ToCsvService,
private toaster: ToasterService,
private ser: DiscountReportService,
) {
this.createForm();
}
@ -67,6 +71,17 @@ export class DiscountReportComponent implements OnInit {
};
}
print() {
this.ser.print(this.info.startDate, this.info.finishDate).subscribe(
() => {
this.toaster.show('', 'Successfully Printed');
},
(error) => {
this.toaster.show('Error', error.error);
},
);
}
exportCsv() {
const headers = {
Name: 'name',

View File

@ -30,4 +30,20 @@ export class DiscountReportService {
.pipe(catchError(this.log.handleError(serviceName, 'get')))
);
}
print(startDate: string, finishDate): Observable<boolean> {
const printUrl = `${url}/print`;
const options = { params: new HttpParams() };
if (startDate !== null) {
options.params = options.params.set('s', startDate);
}
if (finishDate !== null) {
options.params = options.params.set('f', finishDate);
}
return <Observable<boolean>>(
this.http
.get<boolean>(printUrl, options)
.pipe(catchError(this.log.handleError(serviceName, 'print')))
);
}
}