|
@@ -62,8 +62,26 @@ module.exports = app => {
|
|
|
return cols.indexOf(c.field) > -1;
|
|
|
});
|
|
|
}
|
|
|
+ function setColFormat(cols, field, formatter) {
|
|
|
+ const filterCols = cols.filter(function (c) {
|
|
|
+ return c.field.search(field) !== -1;
|
|
|
+ });
|
|
|
+ for (const col of filterCols) {
|
|
|
+ col.formatter = formatter;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ const qtyFormatter = this.ctx.helper.getNumberFormatter(this.ctx.tender.info.decimal.qty);
|
|
|
+ const tpFormatter = this.ctx.helper.getNumberFormatter(this.ctx.tender.info.decimal.tp);
|
|
|
+ const upFormatter = this.ctx.helper.getNumberFormatter(2);
|
|
|
const ledger = JSON.parse(JSON.stringify(spreadConst.stage.ledger));
|
|
|
+ setColFormat(ledger.cols, 'quantity', qtyFormatter);
|
|
|
+ setColFormat(ledger.cols, 'qty', qtyFormatter);
|
|
|
+ setColFormat(ledger.cols, 'unit_price', upFormatter);
|
|
|
+ setColFormat(ledger.cols, 'total_price', tpFormatter);
|
|
|
+ setColFormat(ledger.cols, 'tp', tpFormatter);
|
|
|
const pos = JSON.parse(JSON.stringify(spreadConst.stage.pos));
|
|
|
+ setColFormat(pos.cols, 'quantity', qtyFormatter);
|
|
|
+ setColFormat(pos.cols, 'qty', qtyFormatter);
|
|
|
const tender = this.ctx.tender, stage = this.ctx.stage;
|
|
|
if (this._stageReadOnly(stage)) {
|
|
|
ledger.readOnly = true;
|