コード例 #1
0
        public MonthViewLastPrintPage(string month, IList <TotalSaleProduct> saleProducts, IList <TotalSaleProduct> allSaleProducts, Size pageSize, int pageNr)
        {
            this.saleProducts           = new ObservableCollection <TotalSaleProduct>(saleProducts);
            viewModel                   = new MonthStatisticViewModel();
            viewModel.TotalSaleProducts = new System.Collections.ObjectModel.ObservableCollection <TotalSaleProduct>(allSaleProducts);
            DataContext                 = this;

            InitializeComponent();
            this.pageNr     = pageNr + 1;
            this.Month      = month;
            this.RenderSize = pageSize;

            PageNumberTextBlock.Text = this.pageNr.ToString();
        }
コード例 #2
0
 public MonthPrintPaginator(MonthStatisticViewModel viewModel)
 {
     this.viewModel = viewModel;
     this.pageSize  = new Size(800, 1120);
     PaginateSaleProductItems();
 }
コード例 #3
0
        public MonthPrintFlowDocument(MonthStatisticViewModel monthViewModel)
        {
            InitializeComponent();
            this.PagePadding = new Thickness(50);

            Content.Blocks.Add(new Paragraph(new Run(string.Format("Monatsrapport: {0}", monthViewModel.Month))
            {
                FontWeight = FontWeights.Bold
            }));

            var table = new Table();

            table.Columns.Add(new TableColumn()
            {
                Width = new GridLength(30)
            });
            table.Columns.Add(new TableColumn()
            {
                Width = GridLength.Auto
            });
            table.Columns.Add(new TableColumn()
            {
                Width = new GridLength(80)
            });
            table.Columns.Add(new TableColumn()
            {
                Width = new GridLength(80)
            });
            table.Columns.Add(new TableColumn()
            {
                Width = new GridLength(80)
            });
            table.Columns.Add(new TableColumn()
            {
                Width = new GridLength(80)
            });
            table.Columns.Add(new TableColumn()
            {
                Width = new GridLength(80)
            });
            table.Columns.Add(new TableColumn()
            {
                Width = new GridLength(60)
            });
            table.Columns.Add(new TableColumn()
            {
                Width = new GridLength(60)
            });
            table.FontSize = 11;
            var tableRowGroup = new TableRowGroup();

            var row = new TableRow();

            row.Cells.Add(new TableCell(new Paragraph(new Run("Anz.")
            {
                FontWeight = FontWeights.Bold
            })));
            row.Cells.Add(new TableCell(new Paragraph(new Run("Name")
            {
                FontWeight = FontWeights.Bold
            })));
            row.Cells.Add(new TableCell(new Paragraph()));
            row.Cells.Add(new TableCell(new Paragraph()));
            row.Cells.Add(new TableCell(new Paragraph(new Run("Bargeld")
            {
                FontWeight = FontWeights.Bold
            })
            {
                TextAlignment = System.Windows.TextAlignment.Right
            }));
            row.Cells.Add(new TableCell(new Paragraph(new Run("Kreditk.")
            {
                FontWeight = FontWeights.Bold, Foreground = new SolidColorBrush(Colors.Blue)
            })
            {
                TextAlignment = System.Windows.TextAlignment.Right
            }));
            row.Cells.Add(new TableCell(new Paragraph(new Run("Total")
            {
                FontWeight = FontWeights.Bold
            })
            {
                TextAlignment = System.Windows.TextAlignment.Right
            }));
            row.Cells.Add(new TableCell(new Paragraph(new Run("Privat")
            {
                FontWeight = FontWeights.Bold, Foreground = new SolidColorBrush(Colors.Green)
            })
            {
                TextAlignment = System.Windows.TextAlignment.Right
            }));
            row.Cells.Add(new TableCell(new Paragraph(new Run("Für Gäste")
            {
                FontWeight = FontWeights.Bold, Foreground = new SolidColorBrush(Colors.Red)
            })
            {
                TextAlignment = System.Windows.TextAlignment.Right
            }));
            tableRowGroup.Rows.Add(row);

            foreach (var saleProduct in monthViewModel.TotalSaleProducts)
            {
                row = new TableRow();
                row.Cells.Add(new TableCell(new Paragraph(new Run(saleProduct.Count.ToString()))));
                row.Cells.Add(new TableCell(new Paragraph(new Run(saleProduct.Name))
                {
                    TextAlignment = System.Windows.TextAlignment.Left
                }));
                row.Cells.Add(new TableCell(new Paragraph(new Run(string.Format("({0:0.00} CHF)", saleProduct.Price)))
                {
                    TextAlignment = System.Windows.TextAlignment.Right
                }));
                row.Cells.Add(new TableCell(new Paragraph(new Run(string.Format("à {0:0.00} CHF", saleProduct.SellPrice)))
                {
                    TextAlignment = System.Windows.TextAlignment.Right
                }));
                row.Cells.Add(new TableCell(new Paragraph(new Run(string.Format("{0:0.00} CHF", saleProduct.TotalCash)))
                {
                    TextAlignment = System.Windows.TextAlignment.Right
                }));
                row.Cells.Add(new TableCell(new Paragraph(new Run(string.Format("{0:0.00} CHF", saleProduct.TotalCreditCard))
                {
                    Foreground = new SolidColorBrush(Colors.Blue)
                })
                {
                    TextAlignment = System.Windows.TextAlignment.Right
                }));
                row.Cells.Add(new TableCell(new Paragraph(new Run(string.Format("{0:0.00} CHF", saleProduct.Total))
                {
                    FontWeight = FontWeights.Bold
                })
                {
                    TextAlignment = System.Windows.TextAlignment.Right
                }));
                row.Cells.Add(new TableCell(new Paragraph(new Run(string.Format("{0:0.00} CHF", saleProduct.TotalPrivate))
                {
                    Foreground = new SolidColorBrush(Colors.Green)
                })
                {
                    TextAlignment = System.Windows.TextAlignment.Right
                }));
                row.Cells.Add(new TableCell(new Paragraph(new Run(string.Format("{0:0.00} CHF", saleProduct.TotalForGuest))
                {
                    Foreground = new SolidColorBrush(Colors.Red)
                })
                {
                    TextAlignment = System.Windows.TextAlignment.Right
                }));
                tableRowGroup.Rows.Add(row);
            }

            row = new TableRow();
            row.Cells.Add(new TableCell(new BlockUIContainer(new Separator()
            {
                HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch
            }))
            {
                ColumnSpan = 9
            });
            tableRowGroup.Rows.Add(row);

            table.RowGroups.Add(tableRowGroup);
            Content.Blocks.Add(table);

            table          = new Table();
            table.FontSize = 11;
            table.Columns.Add(new TableColumn()
            {
                Width = new GridLength(150)
            });
            table.Columns.Add(new TableColumn()
            {
                Width = new GridLength(150)
            });
            table.Columns.Add(new TableColumn()
            {
                Width = GridLength.Auto
            });
            table.Columns.Add(new TableColumn()
            {
                Width = new GridLength(150)
            });
            tableRowGroup = new TableRowGroup();

            row = new TableRow();
            row.Cells.Add(new TableCell(new Paragraph(new Run("Privatbezug:"))));
            row.Cells.Add(new TableCell(new Paragraph(new Run(string.Format("{0:0.00} CHF", monthViewModel.TotalPrivate)))));
            row.Cells.Add(new TableCell(new Paragraph(new Run("Bargeld:"))));
            row.Cells.Add(new TableCell(new Paragraph(new Run(string.Format("{0:0.00} CHF", monthViewModel.TotalCash)))
            {
                TextAlignment = System.Windows.TextAlignment.Right
            }));
            tableRowGroup.Rows.Add(row);

            row = new TableRow();
            row.Cells.Add(new TableCell(new Paragraph(new Run("Für Gäste:"))));
            row.Cells.Add(new TableCell(new Paragraph(new Run(string.Format("{0:0.00} CHF", monthViewModel.TotalForGuest)))));
            row.Cells.Add(new TableCell(new Paragraph(new Run("Kreditkarte:"))));
            row.Cells.Add(new TableCell(new Paragraph(new Run(string.Format("{0:0.00} CHF", monthViewModel.TotalCreditCard)))
            {
                TextAlignment = System.Windows.TextAlignment.Right
            }));
            tableRowGroup.Rows.Add(row);

            row = new TableRow();
            row.Cells.Add(new TableCell());
            row.Cells.Add(new TableCell());
            row.Cells.Add(new TableCell(new BlockUIContainer(new Separator()
            {
                HorizontalAlignment = HorizontalAlignment.Stretch
            }))
            {
                ColumnSpan = 2
            });
            tableRowGroup.Rows.Add(row);

            row = new TableRow();
            row.Cells.Add(new TableCell());
            row.Cells.Add(new TableCell());
            row.Cells.Add(new TableCell(new Paragraph(new Run(string.Format("Total vom {0}:", monthViewModel.Month))
            {
                FontWeight = FontWeights.Bold
            })
            {
                TextAlignment = System.Windows.TextAlignment.Left
            }));
            row.Cells.Add(new TableCell(new Paragraph(new Run(string.Format("{0:0.00} CHF", monthViewModel.Total))
            {
                FontWeight = FontWeights.Bold
            })
            {
                TextAlignment = System.Windows.TextAlignment.Right
            }));
            tableRowGroup.Rows.Add(row);

            row = new TableRow();
            row.Cells.Add(new TableCell()
            {
                LineHeight = 1
            });
            row.Cells.Add(new TableCell()
            {
                LineHeight = 1
            });
            row.Cells.Add(new TableCell(new BlockUIContainer(new Separator()
            {
                HorizontalAlignment = HorizontalAlignment.Stretch
            }))
            {
                ColumnSpan = 2, LineHeight = 1
            });
            tableRowGroup.Rows.Add(row);
            row = new TableRow();
            row.Cells.Add(new TableCell()
            {
                LineHeight = 1
            });
            row.Cells.Add(new TableCell()
            {
                LineHeight = 1
            });
            row.Cells.Add(new TableCell(new BlockUIContainer(new Separator()
            {
                HorizontalAlignment = HorizontalAlignment.Stretch
            }))
            {
                ColumnSpan = 2, LineHeight = 1
            });
            tableRowGroup.Rows.Add(row);

            table.RowGroups.Add(tableRowGroup);
            Content.Blocks.Add(table);
        }