Added downoad to Raw Material Cost and fixed quantity not showing
This commit is contained in:
@@ -78,4 +78,28 @@ export class RawMaterialCostComponent implements OnInit {
|
||||
finishDate: moment(formModel.finishDate).format('DD-MMM-YYYY'),
|
||||
};
|
||||
}
|
||||
|
||||
exportCsv() {
|
||||
const data: string[] = [];
|
||||
if (this.info.id) {
|
||||
data.push(
|
||||
'Name, Group, Quantity, Net, Gross',
|
||||
...this.dataSource.data.map(x => x.name + ', ' + x.group + ', ' + x.quantity + ', ' + x.net + ', ' + x.gross)
|
||||
);
|
||||
} else {
|
||||
data.push(
|
||||
'Name, Issue, Sale, RMC',
|
||||
...this.dataSource.data.map(x => x.name + ', ' + x.issue + ', ' + x.sale + ', ' + x.rmc),
|
||||
this.info.footer.name + ', ' + this.info.footer.issue + ', ' + this.info.footer.sale + ', ' + this.info.footer.rmc
|
||||
);
|
||||
}
|
||||
|
||||
const csvData = new Blob([data.join('\n')], {type: 'text/csv;charset=utf-8;'});
|
||||
const link = document.createElement('a');
|
||||
link.href = window.URL.createObjectURL(csvData);
|
||||
link.setAttribute('download', 'raw-material-cost.csv');
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
document.body.removeChild(link);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user