Ejemplo n.º 1
0
 private void loadModels()
 {
     OvenController.instance();
     DetailsController.instance();
     RecipientsController.instance();
     SupplyController.instance();
     SupplyDetailsController.instance();
     WriteoffController.instance();
     WriteoffDetailsController.instance();
     ReportsSettingController.instance();
 }
        private SWCollection()
        {
            //Добавление в соответствующих контроллерах
            SupplyController.instance().Collection.ToList().ForEach(x => add(SWHelper.Create(x)));
            WriteoffController.instance().Collection.ToList().ForEach(x => add(SWHelper.Create(x)));
            ViewSource        = new CollectionViewSource();
            ViewSource.Source = _collection;


            SupplyController.instance().Collection.CollectionChanged += SupplyCollectionChanged;
            WriteoffController.instance().Collection.CollectionChanged += WriteoffCollectionChanged;
        }
Ejemplo n.º 3
0
        public override bool Save(DateTime startDate, DateTime endDate)
        {
            ColumnCount = 7;
            columnsWidth.Add(1, 2.57);
            columnsWidth.Add(2, 8.14);
            columnsWidth.Add(3, 8.29);
            columnsWidth.Add(4, 34.29);
            columnsWidth.Add(5, 11.71);
            columnsWidth.Add(6, 9);
            columnsWidth.Add(7, 7.43);



            HeaderRow = new string[] { "№", "Печь", "Артикул", "Наименование", "Поступление", "Списание", "Остаток" };

            List <Details> details = DetailsController.instance().getSortedByOrderSetting();

            if (startDate == null)
            {
                int currentDay = DateTime.Now.Day;
                startDate = DateTime.Now.AddDays(-(currentDay - 1));
            }
            if (endDate == null)
            {
                endDate = DateTime.Now;
            }
            List <Supply>   supplysForPeriod   = SupplyController.instance().getByPeriod(startDate, endDate);
            List <Writeoff> writeoffsForPeriod = WriteoffController.instance().getByPeriod(startDate, endDate);

            List <ReportRow> reportData = new List <ReportRow>();

            for (int i = 0; i < details.Count; i++)
            {
                Details   detail    = details[i];
                ReportRow reportRow = new ReportRow();

                reportRow.Row.Add(detail.RowIndex.ToString());
                reportRow.Row.Add(detail.OvenName);
                reportRow.Row.Add(detail.VendorCode);
                reportRow.Row.Add(detail.Name);
                reportRow.Row.Add(getSupplyForPeriod(detail, supplysForPeriod).ToString());
                reportRow.Row.Add(getWriteoffForPeriod(detail, writeoffsForPeriod).ToString());
                reportRow.Row.Add(detail.CurrentCount.ToString());

                reportRow.Style.Add(ReportRow.RowStyle.Border);

                reportData.Add(reportRow);
            }
            Data = reportData;
            return(Create());
        }
Ejemplo n.º 4
0
 protected override IController controller()
 {
     return(WriteoffController.instance());
 }
Ejemplo n.º 5
0
        public override bool Save(DateTime startDate, DateTime endDate)
        {
            setLandscapeOrientation();

            ColumnCount = 9;

            columnsWidth.Add(1, 14);
            columnsWidth.Add(2, 9.29);
            columnsWidth.Add(3, 11.29);
            columnsWidth.Add(4, 14.29);
            columnsWidth.Add(5, 10.86);

            columnsWidth.Add(6, 5.29);
            columnsWidth.Add(7, 11);
            columnsWidth.Add(8, 29.86);
            columnsWidth.Add(9, 16.86);

            List <Writeoff>  writeoffForPeriod = WriteoffController.instance().getByPeriod(startDate, endDate);
            List <ReportRow> reportData        = new List <ReportRow>();

            int currentRowIndex = 3;

            merge(1, 2, 1, 9);

            foreach (Writeoff writeoff in writeoffForPeriod)
            {
                ReportRow emptyRow = new ReportRow();
                emptyRow.Row.Add("");
                emptyRow.Row.Add("");
                emptyRow.Row.Add("");
                emptyRow.Row.Add("");
                emptyRow.Row.Add("");
                reportData.Add(emptyRow);
                currentRowIndex++;

                ReportRow reportRow = new ReportRow();

                reportRow.Row.Add("№ накладной");
                reportRow.Row.Add(writeoff.Id.ToString());
                reportRow.Row.Add("Дата");
                reportRow.Row.Add(writeoff.WriteoffDate.ToString("dd.MM.yyyy"));
                reportRow.Row.Add("№ заявки");
                reportRow.Row.Add(writeoff.AppNumber);
                reportRow.Row.Add("Получатель");
                reportRow.Row.Add(RecipientsController.instance().getById(writeoff.IdRecipient).FullName);

                selection(currentRowIndex, currentRowIndex, 1, 9);

                reportData.Add(reportRow);
                currentRowIndex++;

                reportRow.Style.Add(ReportRow.RowStyle.Bold);
                reportRow.Style.Add(ReportRow.RowStyle.TextAlignCenter);


                ReportRow reportRowHead = new ReportRow();

                reportRowHead.Row.Add("№");
                reportRowHead.Row.Add("Печь");
                reportRowHead.Row.Add("Артикул");
                reportRowHead.Row.Add("Наименование");
                reportRowHead.Row.Add("");
                reportRowHead.Row.Add("");
                reportRowHead.Row.Add("");
                reportRowHead.Row.Add("");
                reportRowHead.Row.Add("Количество");

                merge(currentRowIndex, currentRowIndex, 4, 8);
                border(currentRowIndex, currentRowIndex, 1, 9);
                reportRowHead.Style.Add(ReportRow.RowStyle.Bold);
                reportRowHead.Style.Add(ReportRow.RowStyle.TextAlignCenter);

                reportData.Add(reportRowHead);
                currentRowIndex++;

                List <WriteoffDetails> writeoffDetails = WriteoffDetailsController.instance().getByIdWriteoff(writeoff.Id);
                for (int i = 0; i < writeoffDetails.Count; i++)
                {
                    Details currentDetail = DetailsController.instance().getById(writeoffDetails[i].IdDetails);
                    if (currentDetail == null)
                    {
                        continue;
                    }

                    ReportRow detailRow = new ReportRow();

                    detailRow.Row.Add((i + 1).ToString());
                    detailRow.Row.Add(currentDetail.OvenName);
                    detailRow.Row.Add(currentDetail.VendorCode);
                    detailRow.Row.Add(currentDetail.Name);

                    detailRow.Row.Add("");
                    detailRow.Row.Add("");
                    detailRow.Row.Add("");
                    detailRow.Row.Add("");

                    detailRow.Row.Add(writeoffDetails[i].DetailsCount.ToString());

                    merge(currentRowIndex, currentRowIndex, 4, 8);
                    border(currentRowIndex, currentRowIndex, 1, 9);

                    reportData.Add(detailRow);
                    currentRowIndex++;
                }
            }

            Data = reportData;
            return(Create());
        }