src/main/webapp/resources/js/retail-order.js
//Order data table code starts here
Order data table code starts here
Order data table code starts here
function OrderModel() {
	var self = this;
	self.rows = ko.observableArray();
	self.runningTotal = ko.observable(null);
	var rowLookup = {};
	self.loadOrders = function(orders) {
		var total = 0;
		for ( var i = 0; i < orders.length; i++) {
			var row = new OrderRow(orders[i]);
			self.rows.push(row);
			total += row.orderAmount;
			rowLookup[row.orderId] = row;
		}
		self.runningTotal(accounting.formatMoney(total));
	};
	self.reloadOrders = function(orders) {
		self.rows.removeAll();
		var total = 0;
		for ( var i = 0; i < orders.length; i++) {
			var row = new OrderRow(orders[i]);
			self.rows.push(row);
			total += row.orderAmount;
			rowLookup[row.orderId] = row;
		}
		self.runningTotal(accounting.formatMoney(total));
	};
}
function OrderModel ( ) { var self = this ; self . rows = ko . observableArray ( ) ; self . runningTotal = ko . observable ( null ) ; var rowLookup = { } ; self . loadOrders = function ( orders ) { var total = 0 ; for ( var i = 0 ; i < orders . length ; i ++ ) { var row = new OrderRow ( orders [ i ] ) ; self . rows . push ( row ) ; total += row . orderAmount ; rowLookup [ row . orderId ] = row ; } self . runningTotal ( accounting . formatMoney ( total ) ) ; } ; self . reloadOrders = function ( orders ) { self . rows . removeAll ( ) ; var total = 0 ; for ( var i = 0 ; i < orders . length ; i ++ ) { var row = new OrderRow ( orders [ i ] ) ; self . rows . push ( row ) ; total += row . orderAmount ; rowLookup [ row . orderId ] = row ; } self . runningTotal ( accounting . formatMoney ( total ) ) ; } ; }
Order data table code starts here
Order data table code starts here