Example #1
0
            ringPullDetails.forEach(function (doc) {
                if (_.isUndefined(itemObj[doc._id])) {
                    itemObj[doc._id] = {
                        itemId: doc.items.itemId,
                        itemDoc: doc.itemDoc,
                        items: doc.items,
                        type: doc.type,
                        name: doc.name,
                        exchangeRP: doc.exchangeRP,
                        cExchangeRP: doc.cExchangeRP,
                        transferRP: doc.transferRP,
                        receiveTransfer: doc.receiveTransfer,
                        itemData: doc.itemData
                    }
                } else {
                    itemObj[doc._id].exchangeRP += doc.exchangeRP;
                    itemObj[doc._id].cExchangeRP += doc.cExchangeRP;
                    itemObj[doc._id].transferRP += doc.transferRP;
                    itemObj[doc._id].receiveTransfer += doc.receiveTransfer;
                    doc.itemData.forEach(function (item) {
                        itemObj[doc._id].itemData.push(item);
                    });
                }

            });
Example #2
0
 transaction.items.forEach(function (item) {
     if (_.isUndefined(transactionObj[transaction.date])) {
         transactionObj[transaction.date] = {};
         transactionObj[transaction.date] = {
             date: transaction.date,
             items: [item]
         };
     } else {
         transactionObj[transaction.date].items.push(item)
     }
 });