Feature: Product Sale Report printing.
This commit is contained in:
@@ -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 { ProductSaleReport } from './product-sale-report';
|
||||
import { ProductSaleReportDataSource } from './product-sale-report-datasource';
|
||||
import { ProductSaleReportService } from './product-sale-report.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-product-sale-report',
|
||||
@@ -26,6 +28,8 @@ export class ProductSaleReportComponent implements OnInit {
|
||||
private router: Router,
|
||||
private fb: FormBuilder,
|
||||
private toCsv: ToCsvService,
|
||||
private toaster: ToasterService,
|
||||
private ser: ProductSaleReportService,
|
||||
) {
|
||||
// Create form
|
||||
this.form = this.fb.group({
|
||||
@@ -65,6 +69,17 @@ export class ProductSaleReportComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
print() {
|
||||
this.ser.print(this.info.startDate, this.info.finishDate).subscribe(
|
||||
() => {
|
||||
this.toaster.show('', 'Successfully Printed');
|
||||
},
|
||||
(error) => {
|
||||
this.toaster.show('Error', error);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
exportCsv() {
|
||||
const headers = {
|
||||
Name: 'name',
|
||||
|
||||
Reference in New Issue
Block a user