Beispiel #1
0
        public override bool Save()
        {
            ReportRow headerRow = new ReportRow();

            headerRow.Add(new ReportCell("Отгружено оборудования c " + start.ToString("dd.MM.yyyy") + " по " + end.ToString("dd.MM.yyyy"))
            {
                ColumnSpan = 2
            });
            headerRow.Add(new ReportCell());
            headerRow.Add(new ReportCell()
            {
                HorizontalAlignment = HorizontalAlignment.Center
            });
            Rows.Add(headerRow);

            ReportRow titleRow = new ReportRow();

            titleRow.Add(new ReportCell("Оборудование")
            {
                Width = 20.86
            });
            titleRow.Add(new ReportCell("Модификация")
            {
                Width = 21.71
            });
            titleRow.Add(new ReportCell("Количество")
            {
                Width = 18.71
            });
            Rows.Add(titleRow);

            PrepareEquipmentBid();

            return(Create());
        }
Beispiel #2
0
        //Статистика по клиентам
        private void BuyerStatistic()
        {
            Dictionary <int, int> buyerDict
                = new Dictionary <int, int>();

            for (int i = 0; i < archiveBid.Count; i++)
            {
                if (!buyerDict.ContainsKey(archiveBid[i].Id_buyer))
                {
                    buyerDict.Add(archiveBid[i].Id_buyer, 1);
                }
                else
                {
                    buyerDict[archiveBid[i].Id_buyer]++;
                }
            }
            if (buyerDict.Count == 0)
            {
                return;
            }

            ReportRow rowH = new ReportRow();

            rowH.Add(new ReportCell("Статистика по клиентам:"));
            Rows.Add(rowH);

            ReportRow rowT = new ReportRow();

            rowT.Add(new ReportCell("Покупатель")
            {
                BorderColor = System.Drawing.Color.Black, ColumnSpan = 1
            });
            rowT.Add(null);
            rowT.Add(new ReportCell("Кол-во заявок")
            {
                ColumnSpan = 1, BorderColor = System.Drawing.Color.Black
            });
            Rows.Add(rowT);

            foreach (KeyValuePair <int, int> kv in buyerDict.OrderByDescending(x => x.Value))
            {
                Buyer buyer = BuyerViewModel.instance().getById(kv.Key);
                if (buyer == null)
                {
                    continue;
                }

                ReportRow row = new ReportRow();
                row.Add(new ReportCell(buyer.Name)
                {
                    ColumnSpan = 1, BorderColor = System.Drawing.Color.Black
                });
                row.Add(null);
                row.Add(new ReportCell(kv.Value.ToString())
                {
                    ColumnSpan = 1, BorderColor = System.Drawing.Color.Black
                });
                Rows.Add(row);
            }
        }
Beispiel #3
0
 private void CreateRows(List <EquipmentBidGroup> ebGroup)
 {
     for (int i = 0; i < ebGroup.Count; i++)
     {
         EquipmentBid equipmentBid = ebGroup[i].EquipmentBid;
         ReportRow    row          = new ReportRow();
         row.Add(new ReportCell(equipmentBid.EquipmentName)
         {
             VerticalAlignment = VerticalAlignment.Bottom,
             BorderColor       = System.Drawing.Color.Black
         });
         string modificationName = "";
         if (equipmentBid.Id_modification != null)
         {
             modificationName = equipmentBid.ModificationName;
         }
         row.Add(new ReportCell(modificationName)
         {
             VerticalAlignment = VerticalAlignment.Bottom,
             BorderColor       = System.Drawing.Color.Black
         });
         row.Add(new ReportCell(ebGroup[i].Count.ToString())
         {
             VerticalAlignment = VerticalAlignment.Bottom,
             BorderColor       = System.Drawing.Color.Black
         });
         Rows.Add(row);
     }
 }
Beispiel #4
0
        //распределение между продавцами
        private void SellerDistribution()
        {
            Dictionary <int, double> sellerDict
                = new Dictionary <int, double>();

            for (int i = 0; i < archiveBid.Count; i++)
            {
                if (!sellerDict.ContainsKey(archiveBid[i].Id_seller))
                {
                    sellerDict.Add(archiveBid[i].Id_seller, archiveBid[i].Amount);
                }
                else
                {
                    sellerDict[archiveBid[i].Id_seller] += archiveBid[i].Amount;
                }
            }
            if (sellerDict.Count == 0)
            {
                return;
            }

            ReportRow rowH = new ReportRow();

            rowH.Add(new ReportCell("Распределение между продавцами:"));
            Rows.Add(rowH);

            ReportRow rowT = new ReportRow();

            rowT.Add(new ReportCell("Продавец")
            {
                BorderColor = System.Drawing.Color.Black, ColumnSpan = 1
            });
            rowT.Add(null);
            rowT.Add(new ReportCell("Сумма")
            {
                ColumnSpan = 1, BorderColor = System.Drawing.Color.Black
            });
            Rows.Add(rowT);

            foreach (KeyValuePair <int, double> kv in sellerDict.OrderByDescending(x => x.Value))
            {
                Seller seller = SellerViewModel.instance().getById(kv.Key);
                if (seller == null)
                {
                    continue;
                }

                ReportRow row = new ReportRow();
                row.Add(new ReportCell(seller.Name)
                {
                    ColumnSpan = 1, BorderColor = System.Drawing.Color.Black
                });
                row.Add(null);
                row.Add(new ReportCell(kv.Value.ToString().Replace(',', '.'))
                {
                    ColumnSpan = 1, BorderColor = System.Drawing.Color.Black
                });
                Rows.Add(row);
            }
        }
Beispiel #5
0
        public override bool Save()
        {
            ReportRow row        = new ReportRow();
            string    headerText = "Показатели за период " + year.ToString() + " г.";

            if (month != 0)
            {
                headerText += ", " + Classes.Months.getRuMonthNameByNumber(month);
            }
            row.Add(new ReportCell(headerText)
            {
                ColumnSpan = 3,
                Height     = 18.75,
                Width      = 18.86,
                TextStyle  = new List <TextStyle>()
                {
                    TextStyle.Bold
                }
            });
            row.Add(new ReportCell()
            {
                Width = 35.43
            });
            row.Add(new ReportCell()
            {
                Width = 15.43
            });
            row.Add(new ReportCell()
            {
                Width = 15,
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment   = VerticalAlignment.Bottom
            });
            Rows.Add(row);
            Rows.Add(new ReportRow());

            CreateBidsInfo();
            Rows.Add(new ReportRow());
            SellerDistribution();
            Rows.Add(new ReportRow());
            ManagerSales();
            Rows.Add(new ReportRow());
            TransportCompanyDistribution();
            Rows.Add(new ReportRow());
            IsShipped();
            Rows.Add(new ReportRow());
            BuyerStatistic();
            Rows.Add(new ReportRow());
            MiddlePositionCountInBid();
            Rows.Add(new ReportRow());
            ComplectationStatistic();

            AllDocumentFontSize = 14;

            return(Create());
        }
Beispiel #6
0
        //Среднее количество позиций в заявке
        private void MiddlePositionCountInBid()
        {
            int equipmentBidCount = archiveBid.Sum(x => x.EquipmentBidCollection.Count);
            //Кол-во переданных в архив заявок
            ReportRow row = new ReportRow();

            row.Add(new ReportCell("Среднее количество позиций в заявке:")
            {
                ColumnSpan = 1, BorderColor = System.Drawing.Color.Black
            });
            row.Add(new ReportCell());
            row.Add(new ReportCell((equipmentBidCount / archiveBid.Count).ToString())
            {
                ColumnSpan = 1, BorderColor = System.Drawing.Color.Black
            });
            Rows.Add(row);
        }
        public void createData()
        {
            double sum = 0;

            for (int i = 0; i < sellers.Count; i++)
            {
                double currentSellerSum = getSumBySeller(sellers[i]);
                sum += currentSellerSum;

                ReportRow row = new ReportRow();
                row.Cells.Add(new ReportCell((i + 1).ToString())
                {
                    HorizontalAlignment = HorizontalAlignment.Center,
                    BorderColor         = System.Drawing.Color.Black
                });
                row.Cells.Add(new ReportCell(sellers[i].Name)
                {
                    BorderColor = System.Drawing.Color.Black
                });
                row.Cells.Add(new ReportCell(currentSellerSum.ToString().Replace(',', '.'))
                {
                    BorderColor = System.Drawing.Color.Black, HorizontalAlignment = HorizontalAlignment.Right, Format = Format.Money
                });
                Rows.Add(row);
            }

            ReportRow sumRow = new ReportRow();

            sumRow.Add(new ReportCell());
            sumRow.Add(new ReportCell("Итого:")
            {
                HorizontalAlignment = HorizontalAlignment.Right, BorderColor = System.Drawing.Color.Black
            });
            sumRow.Add(new ReportCell(sum.ToString().Replace(',', '.'))
            {
                HorizontalAlignment = HorizontalAlignment.Right, BorderColor = System.Drawing.Color.Black, Format = Format.Money
            });
            Rows.Add(sumRow);
        }
Beispiel #8
0
        private void CreateBidList(Bid bid)
        {
            ReportRow row1 = new ReportRow();

            row1.Add(new ReportCell("Код заявки:")
            {
                HorizontalAlignment = HorizontalAlignment.Right,
                VerticalAlignment   = VerticalAlignment.Bottom,
                TextStyle           = new List <TextStyle>()
                {
                    TextStyle.Bold
                }
            });
            row1.Add(new ReportCell(bid.Id.ToString())
            {
                BorderColor       = System.Drawing.Color.Black,
                VerticalAlignment = VerticalAlignment.Bottom
            });

            row1.Add(new ReportCell("Сумма:")
            {
                HorizontalAlignment = HorizontalAlignment.Right,
                VerticalAlignment   = VerticalAlignment.Bottom,
                TextStyle           = new List <TextStyle>()
                {
                    TextStyle.Bold
                }
            });
            row1.Add(new ReportCell(bid.Amount.ToString())
            {
                BorderColor       = System.Drawing.Color.Black,
                VerticalAlignment = VerticalAlignment.Bottom
            });

            row1.Add(new ReportCell("Дата отгрузки:")
            {
                HorizontalAlignment = HorizontalAlignment.Right,
                VerticalAlignment   = VerticalAlignment.Bottom,
                TextStyle           = new List <TextStyle>()
                {
                    TextStyle.Bold
                }
            });
            if (bid.Planned_shipment_date != null)
            {
                row1.Add(new ReportCell(((DateTime)bid.Planned_shipment_date).ToString("dd.MM.yyyy"))
                {
                    BorderColor       = System.Drawing.Color.Black,
                    VerticalAlignment = VerticalAlignment.Bottom
                });
            }
            else
            {
                row1.Add(new ReportCell()
                {
                    VerticalAlignment = VerticalAlignment.Bottom
                });
            }

            ReportRow row2 = new ReportRow();

            row2.Add(new ReportCell("Продавец:")
            {
                HorizontalAlignment = HorizontalAlignment.Right,
                VerticalAlignment   = VerticalAlignment.Bottom,
                TextStyle           = new List <TextStyle>()
                {
                    TextStyle.Bold
                }
            });
            Seller seller = SellerViewModel.instance().getById(bid.Id_seller);

            row2.Add(new ReportCell(seller.Name)
            {
                BorderColor       = System.Drawing.Color.Black,
                VerticalAlignment = VerticalAlignment.Bottom
            });

            row2.Add(new ReportCell("Счет:")
            {
                HorizontalAlignment = HorizontalAlignment.Right,
                VerticalAlignment   = VerticalAlignment.Bottom,
                TextStyle           = new List <TextStyle>()
                {
                    TextStyle.Bold
                }
            });
            row2.Add(new ReportCell(bid.Account)
            {
                BorderColor       = System.Drawing.Color.Black,
                VerticalAlignment = VerticalAlignment.Bottom
            });

            row2.Add(new ReportCell("Дата заявки:")
            {
                HorizontalAlignment = HorizontalAlignment.Right,
                VerticalAlignment   = VerticalAlignment.Bottom,
                TextStyle           = new List <TextStyle>()
                {
                    TextStyle.Bold
                }
            });

            row2.Add(new ReportCell(bid.Date_created.ToString("dd.MM.yyyy"))
            {
                BorderColor       = System.Drawing.Color.Black,
                VerticalAlignment = VerticalAlignment.Bottom
            });

            Rows.Add(row1);
            Rows.Add(row2);
            Rows.Add(new ReportRow());

            CreateEquipmentList(bid);
        }
Beispiel #9
0
        public override bool Save()
        {
            ReportRow headerRow = new ReportRow();

            headerRow.Add(new ReportCell("Анализ покупателя " + buyer.NameWithCity + " c " + start.ToString("dd.MM.yyyy") + " по " + end.ToString("dd.MM.yyyy"))
            {
                Width      = 10.86,
                Height     = 30,
                ColumnSpan = 5
            });
            headerRow.Add(new ReportCell()
            {
                Width = 22.29
            });
            headerRow.Add(new ReportCell()
            {
                Width = 8.57
            });
            headerRow.Add(new ReportCell()
            {
                Width = 14.71
            });
            headerRow.Add(new ReportCell()
            {
                Width = 13.14
            });
            headerRow.Add(new ReportCell()
            {
                Width = 13.00, HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Top
            });
            Rows.Add(headerRow);
            double sum = 0;

            for (int i = 0; i < bid.Count; i++)
            {
                CreateBidList(bid[i]);
                sum += bid[i].Amount;
                Rows.Add(new ReportRow());
            }
            Rows.Add(new ReportRow());

            ReportRow bottomRow = new ReportRow();

            bottomRow.Add(new ReportCell());
            bottomRow.Add(new ReportCell());
            bottomRow.Add(new ReportCell());
            bottomRow.Add(new ReportCell("Итоговая сумма:")
            {
                ColumnSpan = 1
            });
            bottomRow.Add(new ReportCell()
            {
                HorizontalAlignment = HorizontalAlignment.Right
            });
            bottomRow.Add(new ReportCell(sum.ToString().Replace(',', '.'))
            {
                BorderColor = System.Drawing.Color.Black, Format = Format.Money
            });

            Rows.Add(bottomRow);

            return(Create());
        }
Beispiel #10
0
        private void CreateEquipmentList(Bid bid)
        {
            ReportRow titleRow = new ReportRow();

            titleRow.Add(new ReportCell("Оборудование")
            {
                ColumnSpan  = 1,
                BorderColor = System.Drawing.Color.Black,
                TextStyle   = new List <TextStyle>()
                {
                    TextStyle.Bold
                },
            });
            titleRow.Add(new ReportCell()
            {
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment   = VerticalAlignment.Bottom
            });
            titleRow.Add(new ReportCell("Модификация")
            {
                ColumnSpan  = 1,
                BorderColor = System.Drawing.Color.Black,
                TextStyle   = new List <TextStyle>()
                {
                    TextStyle.Bold
                },
            });
            titleRow.Add(new ReportCell()
            {
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment   = VerticalAlignment.Bottom
            });
            titleRow.Add(new ReportCell("Серийный номер")
            {
                ColumnSpan  = 1,
                BorderColor = System.Drawing.Color.Black,
                TextStyle   = new List <TextStyle>()
                {
                    TextStyle.Bold
                },
            });
            titleRow.Add(new ReportCell()
            {
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment   = VerticalAlignment.Bottom
            });

            Rows.Add(titleRow);

            List <EquipmentBid> equipmentBid = bid.EquipmentBidCollection.ToList();

            for (int i = 0; i < equipmentBid.Count; i++)
            {
                ReportRow row = new ReportRow();
                row.Add(new ReportCell(equipmentBid[i].EquipmentName)
                {
                    BorderColor = System.Drawing.Color.Black,
                    ColumnSpan  = 1
                });
                row.Add(new ReportCell()
                {
                    HorizontalAlignment = HorizontalAlignment.Center,
                    VerticalAlignment   = VerticalAlignment.Bottom
                });
                string modificationName = "";
                if (equipmentBid[i].Id_modification != null)
                {
                    modificationName = equipmentBid[i].ModificationName;
                }
                row.Add(new ReportCell(modificationName)
                {
                    BorderColor = System.Drawing.Color.Black,
                    ColumnSpan  = 1
                });
                row.Add(new ReportCell()
                {
                    HorizontalAlignment = HorizontalAlignment.Center,
                    VerticalAlignment   = VerticalAlignment.Bottom
                });
                row.Add(new ReportCell(equipmentBid[i].Serial_number.ToString())
                {
                    BorderColor = System.Drawing.Color.Black,
                    ColumnSpan  = 1
                });
                row.Add(new ReportCell()
                {
                    HorizontalAlignment = HorizontalAlignment.Center,
                    VerticalAlignment   = VerticalAlignment.Bottom
                });
                Rows.Add(row);
            }
        }
Beispiel #11
0
        private void CreateBidsInfo()
        {
            //Кол-во переданных в архив заявок
            ReportRow rowInArchive = new ReportRow();

            rowInArchive.Add(new ReportCell("Передано заявок в архив:")
            {
                ColumnSpan = 1, BorderColor = System.Drawing.Color.Black
            });
            rowInArchive.Add(new ReportCell());
            rowInArchive.Add(new ReportCell(archiveBid.Count.ToString())
            {
                ColumnSpan = 1, BorderColor = System.Drawing.Color.Black
            });
            Rows.Add(rowInArchive);

            //Кол-во удаленных заявок
            ReportRow rowDeleted = new ReportRow();

            rowDeleted.Add(new ReportCell("Удалено заявок:")
            {
                ColumnSpan = 1, BorderColor = System.Drawing.Color.Black
            });
            rowDeleted.Add(new ReportCell());

            int minId        = bid.Min(x => x.Id);
            int maxId        = bid.Max(x => x.Id);
            int deletedCount = (maxId - minId) - bid.Count;

            rowDeleted.Add(new ReportCell((deletedCount).ToString())
            {
                ColumnSpan = 1, BorderColor = System.Drawing.Color.Black
            });
            Rows.Add(rowDeleted);

            //Пустая строка
            Rows.Add(new ReportRow());

            //Сумма заявок
            ReportRow closedSumRow = new ReportRow();

            closedSumRow.Add(new ReportCell("Закрыто заявок на сумму:")
            {
                ColumnSpan = 1, BorderColor = System.Drawing.Color.Black
            });
            closedSumRow.Add(new ReportCell());
            double sum = archiveBid.Sum(x => x.Amount);

            closedSumRow.Add(new ReportCell(sum.ToString())
            {
                ColumnSpan  = 1,
                BorderColor = System.Drawing.Color.Black
            });

            Rows.Add(closedSumRow);

            //Пустая строка
            Rows.Add(new ReportRow());

            //Средняя сумма заявок
            ReportRow midSumRow = new ReportRow();

            midSumRow.Add(new ReportCell("Средняя сумма заявки:")
            {
                ColumnSpan = 1, BorderColor = System.Drawing.Color.Black
            });
            midSumRow.Add(new ReportCell());
            midSumRow.Add(new ReportCell(((int)(sum / archiveBid.Count)).ToString())
            {
                ColumnSpan  = 1,
                BorderColor = System.Drawing.Color.Black
            });

            Rows.Add(midSumRow);

            //Пустая строка
            Rows.Add(new ReportRow());

            //Средний счет от срока заявки до отгрузки
            ReportRow midPeriodShipmentRow = new ReportRow();

            midPeriodShipmentRow.Add(new ReportCell("Средний срок от счета до отгрузки:")
            {
                ColumnSpan = 1, BorderColor = System.Drawing.Color.Black
            });
            midPeriodShipmentRow.Add(new ReportCell());
            int daySum = archiveBid.Sum(x => (((DateTime)x.Shipment_date).Subtract(x.Date_created)).Days);

            midPeriodShipmentRow.Add(new ReportCell((daySum / archiveBid.Count).ToString())
            {
                ColumnSpan  = 1,
                BorderColor = System.Drawing.Color.Black
            });

            Rows.Add(midPeriodShipmentRow);

            //Пустая строка
            Rows.Add(new ReportRow());
        }
Beispiel #12
0
        //Статистика комплектаций
        private void ComplectationStatistic()
        {
            Dictionary <int, int> complectationDict
                = new Dictionary <int, int>();

            for (int i = 0; i < archiveBid.Count; i++)
            {
                for (int j = 0; j < archiveBid[i].EquipmentBidCollection.Count; j++)
                {
                    for (int k = 0; k < archiveBid[i].EquipmentBidCollection[j].ComplectationCollection.Count; k++)
                    {
                        Complectation complectation = archiveBid[i].EquipmentBidCollection[j].ComplectationCollection[k];
                        if (!complectationDict.ContainsKey(complectation.Id_complectation_item))
                        {
                            complectationDict.Add(complectation.Id_complectation_item, 1);
                        }
                        else
                        {
                            complectationDict[complectation.Id_complectation_item]++;
                        }
                    }
                }
            }
            if (complectationDict.Count == 0)
            {
                return;
            }

            ReportRow rowH = new ReportRow();

            rowH.Add(new ReportCell("Статистика комплектаций:"));
            Rows.Add(rowH);

            ReportRow rowT = new ReportRow();

            rowT.Add(new ReportCell("Наименование")
            {
                BorderColor = System.Drawing.Color.Black, ColumnSpan = 1
            });
            rowT.Add(null);
            rowT.Add(new ReportCell("Кол-во комплектаций")
            {
                ColumnSpan = 1, BorderColor = System.Drawing.Color.Black
            });
            Rows.Add(rowT);

            foreach (KeyValuePair <int, int> kv in complectationDict.OrderByDescending(x => x.Value))
            {
                ComplectationItem citem = ComplectationItemViewModel.instance().getById(kv.Key);
                if (citem == null)
                {
                    continue;
                }

                ReportRow row = new ReportRow();
                row.Add(new ReportCell(citem.Name)
                {
                    ColumnSpan = 1, BorderColor = System.Drawing.Color.Black
                });
                row.Add(null);
                row.Add(new ReportCell(kv.Value.ToString())
                {
                    ColumnSpan = 1, BorderColor = System.Drawing.Color.Black
                });
                Rows.Add(row);
            }
        }
Beispiel #13
0
        //Отгружено
        private void IsShipped()
        {
            List <EquipmentBid> equipmentBids = new List <EquipmentBid>();

            for (int i = 0; i < archiveBid.Count; i++)
            {
                equipmentBids.AddRange(archiveBid[i].EquipmentBidCollection.ToList());
            }
            List <EquipmentBidGroup> ebGroup = new List <EquipmentBidGroup>();

            for (int i = 0; i < equipmentBids.Count; i++)
            {
                EquipmentBidGroup equipmentBidGroup = ebGroup.Where(x => (x.IdEquipment == equipmentBids[i].Id_equipment) &&
                                                                    (x.IdModification == equipmentBids[i].Id_modification)).FirstOrDefault();
                if (equipmentBidGroup == null)
                {
                    ebGroup.Add(new EquipmentBidGroup()
                    {
                        EquipmentBid = equipmentBids[i], Count = 1
                    });
                }
                else
                {
                    equipmentBidGroup.Count++;
                }
            }
            if (equipmentBids.Count == 0)
            {
                return;
            }

            ReportRow rowH = new ReportRow();

            rowH.Add(new ReportCell("Отгружено:"));
            Rows.Add(rowH);

            ReportRow rowT = new ReportRow();

            rowT.Add(new ReportCell("Оборудование")
            {
                BorderColor = System.Drawing.Color.Black
            });
            rowT.Add(new ReportCell("Модификация")
            {
                BorderColor = System.Drawing.Color.Black
            });
            rowT.Add(new ReportCell("Количество")
            {
                ColumnSpan = 1, BorderColor = System.Drawing.Color.Black
            });
            Rows.Add(rowT);

            ebGroup = ebGroup.OrderByDescending(x => x.Count).ToList();

            for (int i = 0; i < ebGroup.Count; i++)
            {
                EquipmentBid equipmentBid = ebGroup[i].EquipmentBid;
                ReportRow    row          = new ReportRow();
                row.Add(new ReportCell(equipmentBid.EquipmentName)
                {
                    VerticalAlignment = VerticalAlignment.Bottom,
                    BorderColor       = System.Drawing.Color.Black
                });
                string modificationName = "";
                if (equipmentBid.Id_modification != null)
                {
                    modificationName = equipmentBid.ModificationName;
                }
                row.Add(new ReportCell(modificationName)
                {
                    VerticalAlignment = VerticalAlignment.Bottom,
                    BorderColor       = System.Drawing.Color.Black
                });
                row.Add(new ReportCell(ebGroup[i].Count.ToString())
                {
                    ColumnSpan        = 1,
                    VerticalAlignment = VerticalAlignment.Bottom,
                    BorderColor       = System.Drawing.Color.Black
                });
                Rows.Add(row);
            }
        }
Beispiel #14
0
        //распределние между транспортными компаниями
        private void TransportCompanyDistribution()
        {
            Dictionary <int, int> transportCompanyDict
                = new Dictionary <int, int>();

            for (int i = 0; i < archiveBid.Count; i++)
            {
                if (archiveBid[i].Id_transport_company == null)
                {
                    continue;
                }

                if (!transportCompanyDict.ContainsKey((int)archiveBid[i].Id_transport_company))
                {
                    transportCompanyDict.Add((int)archiveBid[i].Id_transport_company, 1);
                }
                else
                {
                    transportCompanyDict[(int)archiveBid[i].Id_transport_company]++;
                }
            }
            if (transportCompanyDict.Count == 0)
            {
                return;
            }

            ReportRow rowH = new ReportRow();

            rowH.Add(new ReportCell("Выбор транспортной компании:"));
            Rows.Add(rowH);

            ReportRow rowT = new ReportRow();

            rowT.Add(new ReportCell("Наименование")
            {
                BorderColor = System.Drawing.Color.Black, ColumnSpan = 1
            });
            rowT.Add(null);
            rowT.Add(new ReportCell("Кол-во раз")
            {
                ColumnSpan = 1, BorderColor = System.Drawing.Color.Black
            });
            Rows.Add(rowT);

            foreach (KeyValuePair <int, int> kv in transportCompanyDict.OrderByDescending(x => x.Value))
            {
                TransportCompany transportCompany = TransportCompanyViewModel.instance().getById(kv.Key);
                if (transportCompany == null)
                {
                    continue;
                }

                ReportRow row = new ReportRow();
                row.Add(new ReportCell(transportCompany.Name)
                {
                    ColumnSpan = 1, BorderColor = System.Drawing.Color.Black
                });
                row.Add(null);
                row.Add(new ReportCell(kv.Value.ToString())
                {
                    ColumnSpan = 1, BorderColor = System.Drawing.Color.Black
                });
                Rows.Add(row);
            }
        }
Beispiel #15
0
        //продажи менеджеров
        private void ManagerSales()
        {
            //Словарь сумм по менеджерам
            Dictionary <int, double> managerDict
                = new Dictionary <int, double>();
            //Словарь количества по менеджерам
            Dictionary <int, int> managerBidsCountDict
                = new Dictionary <int, int>();

            for (int i = 0; i < archiveBid.Count; i++)
            {
                //Подсчет суммы заявок менеджера ---->
                if (!managerDict.ContainsKey(archiveBid[i].Id_manager))
                {
                    managerDict.Add(archiveBid[i].Id_manager, archiveBid[i].Amount);
                }
                else
                {
                    managerDict[archiveBid[i].Id_manager] += archiveBid[i].Amount;
                }
                //<----/

                //Подсчет количества заявок менеджера ---->
                if (!managerBidsCountDict.ContainsKey(archiveBid[i].Id_manager))
                {
                    managerBidsCountDict.Add(archiveBid[i].Id_manager, 1);
                }
                else
                {
                    managerBidsCountDict[archiveBid[i].Id_manager]++;
                }
                //<----/
            }
            if (managerDict.Count == 0)
            {
                return;
            }

            ReportRow rowH = new ReportRow();

            rowH.Add(new ReportCell("Продажи менеджеров:"));
            Rows.Add(rowH);

            ReportRow rowT = new ReportRow();

            rowT.Add(new ReportCell("Менеджер")
            {
                BorderColor = System.Drawing.Color.Black, ColumnSpan = 1
            });
            rowT.Add(null);
            rowT.Add(new ReportCell("Сумма")
            {
                BorderColor = System.Drawing.Color.Black
            });
            rowT.Add(new ReportCell("Кол-во")
            {
                BorderColor = System.Drawing.Color.Black
            });
            Rows.Add(rowT);

            foreach (KeyValuePair <int, double> kv in managerDict.OrderByDescending(x => x.Value))
            {
                Manager manager = ManagerViewModel.instance().getById(kv.Key);
                if (manager == null)
                {
                    continue;
                }

                ReportRow row = new ReportRow();
                row.Add(new ReportCell(manager.Name)
                {
                    ColumnSpan = 1, BorderColor = System.Drawing.Color.Black
                });
                row.Add(null);
                row.Add(new ReportCell(kv.Value.ToString().Replace(',', '.'))
                {
                    BorderColor = System.Drawing.Color.Black
                });
                int managerBidsCount = 0;
                if (managerBidsCountDict.ContainsKey(kv.Key))
                {
                    managerBidsCount = managerBidsCountDict[kv.Key];
                }
                row.Add(new ReportCell(managerBidsCount.ToString())
                {
                    BorderColor = System.Drawing.Color.Black
                });
                Rows.Add(row);
            }
        }
Beispiel #16
0
        public void createData()
        {
            double sum = 0;

            for (int i = 0; i < payment.Count; i++)
            {
                Bid bid = BidViewModel.instance().getById(payment[i].Id_bid);
                if (bid == null || bid.Id_seller != seller.Id)
                {
                    continue;
                }

                Buyer buyer = BuyerViewModel.instance().getById(bid.Id_buyer);

                ReportRow row = new ReportRow();
                row.Cells.Add(new ReportCell(bid.Id.ToString())
                {
                    HorizontalAlignment = HorizontalAlignment.Center,
                    BorderColor         = System.Drawing.Color.Black
                });

                row.Cells.Add(new ReportCell(bid.Account)
                {
                    BorderColor = System.Drawing.Color.Black
                });

                row.Cells.Add(new ReportCell(payment[i].Payment_date.ToString("dd.MM.yyyy"))
                {
                    BorderColor = System.Drawing.Color.Black
                });

                row.Cells.Add(new ReportCell(buyer.Name)
                {
                    BorderColor = System.Drawing.Color.Black
                });

                row.Cells.Add(new ReportCell(payment[i].Paying.ToString())
                {
                    BorderColor = System.Drawing.Color.Black, HorizontalAlignment = HorizontalAlignment.Right, Format = Format.Money
                });

                Rows.Add(row);

                sum += payment[i].Paying;
            }

            ReportRow sumRow = new ReportRow();

            sumRow.Add(new ReportCell());
            sumRow.Add(new ReportCell());
            sumRow.Add(new ReportCell());
            sumRow.Add(new ReportCell("Итого:")
            {
                HorizontalAlignment = HorizontalAlignment.Right
            });
            sumRow.Add(new ReportCell(sum.ToString().Replace(',', '.'))
            {
                HorizontalAlignment = HorizontalAlignment.Right, BorderColor = System.Drawing.Color.Black, Format = Format.Money
            });
            Rows.Add(sumRow);
        }