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);
        }
Example #2
0
 private void loadModels()
 {
     OvenController.instance();
     DetailsController.instance();
     RecipientsController.instance();
     SupplyController.instance();
     SupplyDetailsController.instance();
     WriteoffController.instance();
     WriteoffDetailsController.instance();
     ReportsSettingController.instance();
 }
 protected override IController controller()
 {
     return(WriteoffDetailsController.instance());
 }
 private int getWriteoffForPeriod(Details detail, List <Writeoff> writeoffs)
 {
     return(WriteoffDetailsController.instance().getCountByIdDetailAndWriteoffList(detail.Id, writeoffs));
 }
Example #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());
        }