示例#1
0
        private Grid GetReportModal(DateTime date)
        {
            Grid gridPanel = new Grid
            {
                HorizontalAlignment = HorizontalAlignment.Stretch,
                VerticalAlignment   = VerticalAlignment.Stretch
            };

            //row's definition
            RowDefinition row = new RowDefinition();

            row.Height = GridLength.Auto;
            gridPanel.RowDefinitions.Add(row);

            RowDefinition row2 = new RowDefinition();

            row2.Height = GridLength.Auto;
            gridPanel.RowDefinitions.Add(row2);

            RowDefinition row3 = new RowDefinition();

            row3.Height = GridLength.Auto;
            gridPanel.RowDefinitions.Add(row3);

            RowDefinition row4 = new RowDefinition();

            row4.Height = GridLength.Auto;
            gridPanel.RowDefinitions.Add(row4);

            RowDefinition row5 = new RowDefinition();

            row5.Height = GridLength.Auto;
            gridPanel.RowDefinitions.Add(row5);

            RowDefinition row6 = new RowDefinition();

            row6.Height = GridLength.Auto;
            gridPanel.RowDefinitions.Add(row6);

            RowDefinition row7 = new RowDefinition();

            row7.Height = GridLength.Auto;
            gridPanel.RowDefinitions.Add(row7);

            RowDefinition row8 = new RowDefinition();

            row8.Height = GridLength.Auto;
            gridPanel.RowDefinitions.Add(row8);

            RowDefinition row9 = new RowDefinition();

            row9.Height = GridLength.Auto;
            gridPanel.RowDefinitions.Add(row9);

            //colunms definition
            ColumnDefinition col = new ColumnDefinition();

            col.Width = new GridLength(150, GridUnitType.Pixel);
            gridPanel.ColumnDefinitions.Add(col);

            ColumnDefinition col2 = new ColumnDefinition();

            col2.Width = new GridLength(150, GridUnitType.Pixel);
            gridPanel.ColumnDefinitions.Add(col2);

            //Label's definition
            Label labelReceita = new Label();

            labelReceita.Content = "Total receita:";
            Grid.SetRow(labelReceita, 0);
            Grid.SetColumn(labelReceita, 0);

            Label labelReceitaTotal = new Label();

            labelReceitaTotal.Content = String.Format("{0:0.00}", Receita.GetTotal(date));
            Grid.SetRow(labelReceitaTotal, 0);
            Grid.SetColumn(labelReceitaTotal, 1);

            Label labelDespesaFactura = new Label();

            labelDespesaFactura.Content = "Despesa C/Factura:";
            Grid.SetRow(labelDespesaFactura, 1);
            Grid.SetColumn(labelDespesaFactura, 0);

            Label labelDespesaFacturaRetalho = new Label();

            labelDespesaFacturaRetalho.Content = "Retalho:";
            Grid.SetRow(labelDespesaFacturaRetalho, 2);
            Grid.SetColumn(labelDespesaFacturaRetalho, 0);

            Label labelDespesaFacturaRetalhoTotal = new Label();

            labelDespesaFacturaRetalhoTotal.Content = String.Format("{0:0.00}", Despesa.GetTotal(date)[0]);
            Grid.SetRow(labelDespesaFacturaRetalhoTotal, 2);
            Grid.SetColumn(labelDespesaFacturaRetalhoTotal, 1);

            Label labelDespesaFacturaSRetalho = new Label();

            labelDespesaFacturaSRetalho.Content = "S/Retalho:";
            Grid.SetRow(labelDespesaFacturaSRetalho, 3);
            Grid.SetColumn(labelDespesaFacturaSRetalho, 0);

            Label labelDespesaFacturaSRetalhoTotal = new Label();

            labelDespesaFacturaSRetalhoTotal.Content = String.Format("{0:0.00}", Despesa.GetTotal(date)[1]);
            Grid.SetRow(labelDespesaFacturaSRetalhoTotal, 3);
            Grid.SetColumn(labelDespesaFacturaSRetalhoTotal, 1);

            Label labelDespesaSFactura = new Label();

            labelDespesaSFactura.Content = "Despesa S/Factura:";
            Grid.SetRow(labelDespesaSFactura, 4);
            Grid.SetColumn(labelDespesaSFactura, 0);

            Label labelDespesaSFacturaRetalho = new Label();

            labelDespesaSFacturaRetalho.Content = "Retalho:";
            Grid.SetRow(labelDespesaSFacturaRetalho, 5);
            Grid.SetColumn(labelDespesaSFacturaRetalho, 0);

            Label labelDespesaSFacturaRetalhoTotal = new Label();

            labelDespesaSFacturaRetalhoTotal.Content = String.Format("{0:0.00}", Despesa.GetTotal(date)[2]);
            Grid.SetRow(labelDespesaSFacturaRetalhoTotal, 5);
            Grid.SetColumn(labelDespesaSFacturaRetalhoTotal, 1);

            Label labelDespesaSFacturaSRetalho = new Label();

            labelDespesaSFacturaSRetalho.Content = "S/Retalho:";
            Grid.SetRow(labelDespesaSFacturaSRetalho, 6);
            Grid.SetColumn(labelDespesaSFacturaSRetalho, 0);

            Label labelDespesaSFacturaSRetalhoTotal = new Label();

            labelDespesaSFacturaSRetalhoTotal.Content = String.Format("{0:0.00}", Despesa.GetTotal(date)[3]);
            Grid.SetRow(labelDespesaSFacturaSRetalhoTotal, 6);
            Grid.SetColumn(labelDespesaSFacturaSRetalhoTotal, 1);

            Label labelDespesas = new Label();

            labelDespesas.Content = "Total Despesa:";
            Grid.SetRow(labelDespesas, 7);
            Grid.SetColumn(labelDespesas, 0);

            Label labelDespesasTotal = new Label();

            labelDespesasTotal.Content = String.Format("{0:0.00}", Despesa.GetTotal(date)[4]);
            Grid.SetRow(labelDespesasTotal, 7);
            Grid.SetColumn(labelDespesasTotal, 1);

            //button's definition
            Button closeButton = new Button();

            closeButton.Content = "OK";
            closeButton.Click  += (sender, e) =>
            {
                Grid   tempGrid   = (Grid)gridPanel.Parent;
                Window tempWindow = (Window)tempGrid.Parent;
                tempWindow.Close();
            };
            Grid.SetRow(closeButton, 8);
            Grid.SetColumn(closeButton, 0);

            //grid's append
            gridPanel.Children.Add(labelReceita);
            gridPanel.Children.Add(labelReceitaTotal);
            gridPanel.Children.Add(labelDespesaFactura);
            gridPanel.Children.Add(labelDespesaFacturaRetalho);
            gridPanel.Children.Add(labelDespesaFacturaRetalhoTotal);
            gridPanel.Children.Add(labelDespesaFacturaSRetalho);
            gridPanel.Children.Add(labelDespesaFacturaSRetalhoTotal);
            gridPanel.Children.Add(labelDespesaSFactura);
            gridPanel.Children.Add(labelDespesaSFacturaRetalho);
            gridPanel.Children.Add(labelDespesaSFacturaRetalhoTotal);
            gridPanel.Children.Add(labelDespesaSFacturaSRetalho);
            gridPanel.Children.Add(labelDespesaSFacturaSRetalhoTotal);
            gridPanel.Children.Add(labelDespesas);
            gridPanel.Children.Add(labelDespesasTotal);
            gridPanel.Children.Add(closeButton);

            return(gridPanel);
        }