aboutsummaryrefslogtreecommitdiff
path: root/src/PriceListTools/CombineTool.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/PriceListTools/CombineTool.cs')
-rw-r--r--src/PriceListTools/CombineTool.cs18
1 files changed, 6 insertions, 12 deletions
diff --git a/src/PriceListTools/CombineTool.cs b/src/PriceListTools/CombineTool.cs
index d285ab0..a9c02a9 100644
--- a/src/PriceListTools/CombineTool.cs
+++ b/src/PriceListTools/CombineTool.cs
@@ -7,16 +7,13 @@ namespace RehauSku.PriceListTools
{
public override void FillPriceList()
{
- PriceListSheet offer = NewPriceList.Sheet;
+ PriceList offer = NewPriceList;
offer.Sheet.Activate();
int exportedValues = 0;
- int exportedLists = 0;
- foreach (var priceList in sourcePriceLists)
+ foreach (var sheet in sourcePriceLists)
{
- PriceListSheet sheet = priceList.Sheet;
-
if (sheet.SkuAmount.Count == 0)
continue;
@@ -24,8 +21,6 @@ namespace RehauSku.PriceListTools
.EntireColumn
.Insert(XlInsertShiftDirection.xlShiftToRight, XlInsertFormatOrigin.xlFormatFromRightOrBelow);
- exportedLists++;
-
foreach (var kvp in sheet.SkuAmount)
{
Range cell = offer.Sheet.Columns[offer.skuCell.Column].Find(kvp.Key);
@@ -41,8 +36,8 @@ namespace RehauSku.PriceListTools
else
{
- offer.Sheet.Cells[cell.Row, offer.amountCell.Column].Value2 = kvp.Value;
- Range sumCell = offer.Sheet.Cells[cell.Row, offer.amountCell.Column + exportedLists];
+ offer.Sheet.Cells[cell.Row, offer.amountCell.Column - 1].Value2 = kvp.Value;
+ Range sumCell = offer.Sheet.Cells[cell.Row, offer.amountCell.Column];
if (sumCell.Value2 == null)
sumCell.Value2 = kvp.Value;
@@ -52,14 +47,13 @@ namespace RehauSku.PriceListTools
exportedValues++;
}
- offer.Sheet.Cells[offer.amountCell.Row, offer.amountCell.Column].Value2 = $"{priceList.Name}\n{sheet.Name}";
+ offer.Sheet.Cells[offer.amountCell.Row, offer.amountCell.Column - 1].Value2 = $"{sheet.Name}";
}
}
AutoFilter filter = offer.Sheet.AutoFilter;
- int firstFilterColumn = filter.Range.Column;
- filter.Range.AutoFilter(offer.amountCell.Column - firstFilterColumn + 1 + exportedLists, "<>");
+ filter.Range.AutoFilter(offer.amountCell.Column, "<>");
offer.Sheet.Range["A1"].Activate();
AddIn.Excel.StatusBar = $"Экспортировано {exportedValues} строк из {sourcePriceLists.Count} файлов";