Ejemplo n.º 1
0
        private void CreateInventoryPriceExcelAction(IWorkbook wb, ISheet ws, ICellStyle positionStyle, ref int rowIndex, StoreSearchData <InventoryPrice> storeData)
        {
            XSSFRow rowTextile = (XSSFRow)ws.CreateRow(rowIndex);

            ExcelHelper.CreateCell(rowTextile, 0, storeData.TextileName, positionStyle);
            int countInventoryTotal = 0;

            foreach (var item in storeData.StoreSearchColorDetails)
            {
                countInventoryTotal += item.CountInventory;
            }
            var textile = FabricList.Where(w => w.FabricName == storeData.TextileName).FirstOrDefault();

            //未匯入Sql的布種不予計算
            if (textile != null)
            {
                ExcelHelper.CreateCell(rowTextile, 1, countInventoryTotal.ToString(), positionStyle);
                ExcelHelper.CreateCell(rowTextile, 2, (countInventoryTotal * 20 * textile.AverageUnitPrice).ToString(), positionStyle);
                ExcelHelper.CreateCell(rowTextile, 3, (countInventoryTotal * 20 * textile.AverageCost).ToString(), positionStyle);
            }
            rowIndex++;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 建立檢查時間點盤點清單
        /// </summary>
        /// <param name="wb"></param>
        /// <param name="ws"></param>
        /// <param name="positionStyle"></param>
        /// <param name="rowIndex"></param>
        /// <param name="storeData"></param>
        /// <returns></returns>
        private void CreateCheckDateExcelAction(IWorkbook wb, ISheet ws, ICellStyle positionStyle, ref int rowIndex, StoreSearchData <InventoryCheck> storeData)
        {
            XSSFRow rowTextile = (XSSFRow)ws.CreateRow(rowIndex);

            ExcelHelper.CreateCell(rowTextile, 0, storeData.TextileName, positionStyle);
            ws.AddMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 2));
            ws.AddMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 5, 7));

            foreach (var item in storeData.StoreSearchColorDetails.OrderBy(o => o.CheckDate))
            {
                rowIndex++;
                XSSFRow rowColor = (XSSFRow)ws.CreateRow(rowIndex);
                ExcelHelper.CreateCell(rowColor, 0, item.ColorName, positionStyle);
                ExcelHelper.CreateCell(rowColor, 1, item.StorageSpaces, ExcelHelper.GetColorByStorageSpaces(wb, item.StorageSpaces));
                ExcelHelper.CreateCell(rowColor, 2, item.CountInventory, positionStyle);
                ExcelHelper.CreateCell(rowColor, 3, item.CheckDate?.ToString("MM/dd"), positionStyle);
            }
            rowIndex++;
        }