예제 #1
0
        private DailyInOut ComputeDailyInOut(DaySection section, long itemId)
        {
            DailyInOut dInOut            = new DailyInOut();
            TemporaryHistoryStorage temp =
                _tempHistories.FirstOrDefault(t => t.DaySection.DateId == section.DateId);

            List <ItemHistory> historiesOfItem = temp.Histories.Where(h => h.Item_Id == itemId).ToList();

            List <ItemHistory> inHistories = historiesOfItem.Where(h => h.InOrOut == InOrOut.In).ToList();
            double             inQty       = 0;

            foreach (var h in inHistories)
            {
                inQty = inQty + h.AppopriateQty;
            }

            List <ItemHistory> outHistories = historiesOfItem.Where(h => h.InOrOut == InOrOut.Out).ToList();
            double             outQty       = 0;

            foreach (var h in outHistories)
            {
                outQty = outQty + h.AppopriateQty;
            }

            dInOut.DaySection = section;
            dInOut.InQty      = inQty;
            dInOut.OutQty     = outQty;

            return(dInOut);
        }
예제 #2
0
        private void ComputeOutQuantityForEachItems()
        {
            _items = _itemService.AllActiveItems();

            foreach (var item in _items)
            {
                ItemRow row = new ItemRow();
                row.Id       = item.Id;
                row.ItemName = item.Name;

                foreach (var daySection in _range)
                {
                    DailyInOut dInOut = ComputeDailyInOut(daySection, item.Id);
                    row.DailyInOuts.Add(dInOut);
                }

                _itemRows.Add(row);
            }
        }
예제 #3
0
        private void DisplayQty(DaySection d, ItemRow row)
        {
            IXLWorksheet tempSheet = _currentSheet == InOrOut.In ? _sheetForIn : _sheetForOut;

            double     qty    = 0;
            DailyInOut dInOut = row.DailyInOuts.FirstOrDefault(o => o.DaySection.DateId == d.DateId);

            if (dInOut != null)
            {
                if (_currentSheet == InOrOut.In)
                {
                    qty = dInOut.InQty;
                }
                else if (_currentSheet == InOrOut.Out)
                {
                    qty = dInOut.OutQty;
                }
            }

            var qtyCell = tempSheet.Cell(_rowIndex, d.ColumnIndex);

            qtyCell.Value = qty;
        }