public static List <SWDetailsHelper> GetListByEntity(Writeoff writeoff)
        {
            List <WriteoffDetails> writeoffDetails =
                WriteoffDetailsController.instance().Collection.Where(x => x.IdWriteoff == writeoff.Id).ToList();

            List <SWDetailsHelper> swdHelperList = new List <SWDetailsHelper>();

            for (int i = 0; i < writeoffDetails.Count; i++)
            {
                SWDetailsHelper swdHelper = new SWDetailsHelper();
                swdHelper.Count = writeoffDetails[i].DetailsCount;

                Details detail = DetailsController.instance().getById(writeoffDetails[i].IdDetails);
                if (detail == null)
                {
                    continue;
                }
                swdHelper.Name       = detail.Name;
                swdHelper.VendorCode = detail.VendorCode;
                swdHelper.OvenName   = detail.OvenName;
                swdHelperList.Add(swdHelper);
            }

            return(swdHelperList);
        }
Esempio n. 2
0
        public AvailabilityPage()
        {
            InitializeComponent();

            DataContext = new
            {
                Collection = DetailsController.instance().ViewSource.View
            };
            cbxOvenFilter.ItemsSource = OvenController.instance().Collection;

            cbxOvenFilter.SelectionChanged += delegate
            {
                int selectedValue = (cbxOvenFilter.SelectedIndex != -1) ? (int)cbxOvenFilter.SelectedValue : 0;
                DetailsController.instance().showFromOvenId(selectedValue);
            };
            btnClearOvenFilter.Click += delegate
            {
                cbxOvenFilter.SelectedIndex = -1;
            };
            tbxFastFilter.TextChanged += delegate
            {
                DetailsController.instance().showFromText(tbxFastFilter.Text);
            };
            btnClearFastFilter.Click += delegate
            {
                tbxFastFilter.Text = "";
            };

            btnCreateAvailabilityReport.Click += delegate
            {
                createAvailabilityReport();
            };
        }
        public static List <SWDetailsHelper> GetListByEntity(Supply supply)
        {
            List <SupplyDetails> supplyDetails =
                SupplyDetailsController.instance().Collection.Where(x => x.IdSupply == supply.Id).ToList();

            List <SWDetailsHelper> swdHelperList = new List <SWDetailsHelper>();

            for (int i = 0; i < supplyDetails.Count; i++)
            {
                SWDetailsHelper swdHelper = new SWDetailsHelper();
                swdHelper.Count = supplyDetails[i].DetailsCount;

                Details detail = DetailsController.instance().getById(supplyDetails[i].IdDetails);
                if (detail == null)
                {
                    continue;
                }
                swdHelper.Name       = detail.Name;
                swdHelper.VendorCode = detail.VendorCode;
                swdHelper.OvenName   = detail.OvenName;
                swdHelperList.Add(swdHelper);
            }

            return(swdHelperList);
        }
        public override bool Save()
        {
            ColumnCount = 5;

            columnsWidth.Add(1, 2.57);
            columnsWidth.Add(2, 8.29);
            columnsWidth.Add(3, 8.29);
            columnsWidth.Add(4, 53);
            columnsWidth.Add(5, 11.57);

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

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

            for (int i = 0; i < details.Count; i++)
            {
                ReportRow reportRow = new ReportRow();
                Details   detail    = details[i];
                reportRow.Row.Add(detail.RowIndex.ToString());
                reportRow.Row.Add(detail.OvenName);
                reportRow.Row.Add(detail.VendorCode);
                reportRow.Row.Add(detail.Name);
                reportRow.Row.Add(detail.CurrentCount.ToString());
                reportData.Add(reportRow);

                reportRow.Style.Add(ReportRow.RowStyle.Border);
            }
            Data = reportData;
            return(Create());
        }
Esempio n. 5
0
 private void loadModels()
 {
     OvenController.instance();
     DetailsController.instance();
     RecipientsController.instance();
     SupplyController.instance();
     SupplyDetailsController.instance();
     WriteoffController.instance();
     WriteoffDetailsController.instance();
     ReportsSettingController.instance();
 }
        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());
        }
Esempio n. 7
0
        public bool down()
        {
            int index = DetailsController.instance().nextRowOrderIndex(RowOrder);

            if (index == 0)
            {
                return(true);
            }
            Details detail = DetailsController.instance().getByOrderIndex(index);

            if (orderChange(detail))
            {
                DetailsController.instance().ViewSource.View.Refresh();
                return(true);
            }
            return(false);
        }
Esempio n. 8
0
 public static int GetNewRowOrder()
 {
     return(DetailsController.instance().maxRowOrderIndex() + 1);
 }
Esempio n. 9
0
 protected override IController controller()
 {
     return(DetailsController.instance());
 }
Esempio n. 10
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());
        }
        public DetailsPage()
        {
            InitializeComponent();

            DataContext = new
            {
                Collection = DetailsController.instance().ViewSource.View
            };

            DetailsController.instance().ViewSource.SortDescriptions.Add(new SortDescription(OrderSettings.DetailsSortColumn, OrderSettings.DetailsSortDirection));

            btnAdd.Click += delegate
            {
                DetailsSaveWindow detailsSaveWindow = new DetailsSaveWindow();
                detailsSaveWindow.ShowDialog();
            };

            btnEdit.Click += delegate
            {
                Details selectedDetails = (Details)dgDetails.SelectedItem;
                if (selectedDetails == null)
                {
                    MessageBox.Show("Выберите редактируемую запись!");
                    return;
                }
                DetailsSaveWindow detailsSaveWindow = new DetailsSaveWindow(selectedDetails);
                detailsSaveWindow.ShowDialog();
            };

            btnDelete.Click += delegate
            {
                Details selectedDetails = (Details)dgDetails.SelectedItem;
                if (selectedDetails == null)
                {
                    MessageBox.Show("Выберите удаляемую запись!");
                    return;
                }
                if (MessageBox.Show("Подтвердите удаление!", "Подтвердите удаление!", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
                {
                    selectedDetails.remove();
                }
            };

            btnUp.Click += delegate
            {
                Details details = dgDetails.SelectedItem as Details;
                if (details == null)
                {
                    return;
                }
                up(details);
            };

            btnDown.Click += delegate
            {
                Details details = dgDetails.SelectedItem as Details;
                if (details == null)
                {
                    return;
                }
                down(details);
            };
        }
        public override bool Save(DateTime startDate, DateTime endDate)
        {
            ColumnCount = 5;

            columnsWidth.Add(1, 13.14);
            columnsWidth.Add(2, 8.29);
            columnsWidth.Add(3, 8.29);
            columnsWidth.Add(4, 42.57);
            columnsWidth.Add(5, 10.86);

            List <Supply>    supplysForPeriod = SupplyController.instance().getByPeriod(startDate, endDate);
            List <ReportRow> reportData       = new List <ReportRow>();

            foreach (Supply supply in supplysForPeriod)
            {
                ReportRow emptyRow = new ReportRow();
                emptyRow.Row.Add("");
                emptyRow.Row.Add("");
                emptyRow.Row.Add("");
                emptyRow.Row.Add("");
                emptyRow.Row.Add("");
                reportData.Add(emptyRow);

                ReportRow reportRow = new ReportRow();

                reportRow.Row.Add("№ накладной");
                reportRow.Row.Add(supply.Id.ToString());
                reportRow.Row.Add("Дата");
                reportRow.Row.Add(supply.SupplyDate.ToString("dd.MM.yyyy"));

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

                ReportRow reportRowHead = new ReportRow();

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

                reportData.Add(reportRowHead);
                reportRowHead.Style.Add(ReportRow.RowStyle.Bold);
                reportRowHead.Style.Add(ReportRow.RowStyle.TextAlignCenter);
                reportRowHead.Style.Add(ReportRow.RowStyle.Border);

                List <SupplyDetails> supplyDetails = SupplyDetailsController.instance().getByIdSupply(supply.Id);
                for (int i = 0; i < supplyDetails.Count; i++)
                {
                    Details currentDetail = DetailsController.instance().getById(supplyDetails[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(supplyDetails[i].DetailsCount.ToString());

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

                    reportData.Add(detailRow);
                }
            }

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