Ejemplo n.º 1
0
        public SalesReportPage()
        {
            InitializeComponent ();
            ListView checkView = new ListView();
            User user = App.user;
            ListView categoryView = new ListView();
            Label mainLabel = new Label ();
            mainLabel.Text = "Отчет продаж";
            mainLabel.HorizontalOptions = LayoutOptions.Center;
            mainLabel.TextColor = Color.FromHex ("FFFFFF");

            var menuCheck = new Image ();
            menuCheck.Source = "menuCheck.png";

            var menuUser = new Image ();
            menuUser.Source = "menuUser.png";

            var sellsLabel = new Label{ TextColor = Color.FromHex("838282"), FontSize = 10, Text = "общая касса", HorizontalOptions = LayoutOptions.EndAndExpand };
            var checkLabel = new Label{ TextColor = Color.FromHex("838282"), FontSize = 10, Text = "средний чек", HorizontalOptions = LayoutOptions.EndAndExpand  };
            var guestLabel = new Label{ TextColor = Color.FromHex("838282"), FontSize = 10, Text = "посетители", HorizontalOptions = LayoutOptions.EndAndExpand  };
            var timeLabel = new Label{ TextColor = Color.FromHex("838282"), FontSize = 10, Text = "время смены", HorizontalOptions = LayoutOptions.EndAndExpand  };
            var sellsCountLabel = new Label{ TextColor = Color.White, Text = "0.00", HorizontalOptions = LayoutOptions.Start  };
            var checkCountLabel = new Label{ TextColor = Color.White, Text = "0", HorizontalOptions = LayoutOptions.Start };
            var guestCountLabel = new Label{ TextColor = Color.White, Text = "0", HorizontalOptions = LayoutOptions.Start };
            var timeCountLabel = new Label{ TextColor = Color.White, Text = "00:00" , HorizontalOptions = LayoutOptions.Start};

            Label middleCheck = new Label ();
            middleCheck.Text = "Средний чек: 0 грн";
            middleCheck.TextColor = Color.FromHex ("FFFFFF");
            Label totalGuests = new Label ();
            totalGuests.TextColor = Color.FromHex ("FFFFFF");
            totalGuests.Text = "Количество гостей: 0 Человек";
            Api api = new Api ();

            Series lineSeries = new Series
            {
                Color = Color.FromHex("FFC944"),
                Type = ChartType.Line
            };
            lineSeries.Points.Add(new DataPoint() { Label = "Jan1",   Value = 0 });
            lineSeries.Points.Add(new DataPoint() { Label = "Jan2",   Value = 5 });
            lineSeries.Points.Add(new DataPoint() { Label = "Jan3",   Value = 1 });
            lineSeries.Points.Add(new DataPoint() { Label = "Jan4",   Value = 0 });
            lineSeries.Points.Add(new DataPoint() { Label = "March", Value = 0 });
            Chart reportChart = new Chart {
                //Color = Color.White,
                WidthRequest = 321,
                HeightRequest = 247,
                Spacing = 10,
                Grid = true,
                BackgroundColor = Color.FromHex("666666"),
                Color = Color.FromHex("777"),
            };
            reportChart.Series.Add (lineSeries);

            DatePicker dateStartPicker = new DatePicker
            {
                Format = "d MMMM yyyy",
                VerticalOptions = LayoutOptions.CenterAndExpand,
                BackgroundColor = Color.FromHex("666666"),
            };
            DatePicker dateEndPicker = new DatePicker
            {
                Format = "d MMMM yyyy",
                BackgroundColor = Color.FromHex("666666"),
                VerticalOptions = LayoutOptions.CenterAndExpand
            };
            categoryView.BeginRefresh ();

            categoryView.ItemTemplate = new DataTemplate (typeof(CategoryReportCell));
            if (user != null) {
                var categories = api.getCategories (user);
                categoryView.ItemsSource = categories;
            }
            categoryView.EndRefresh ();

            checkView.ItemsSource = new string[]{
                "Чеков без оплаты 0 >",
                "Чеков со скидкой 0 >"
            };

            var line = new BoxView{
                Color = Color.FromHex("838282"),
                WidthRequest = 100,
                HeightRequest = 1
            };

            this.Padding = new Thickness (0, Device.OnPlatform (0, 0, 0), 0, 5);
            var headerLayout = new StackLayout{
                Children = {
                    mainLabel,
                    reportChart,
                    new StackLayout{
                        Padding = new Thickness(10,0,10,0),
                        Spacing = 5,
                        Orientation = StackOrientation.Horizontal,
                        Children = {
                            menuCheck,
                            checkCountLabel,
                            checkLabel
                        }
                    },
                    line,
                    new StackLayout{
                        Padding = new Thickness(10,0,10,0),
                        Spacing = 5,
                        Orientation = StackOrientation.Horizontal,
                        Children = {
                            menuUser,
                            guestCountLabel,
                            guestLabel
                        }
                    },
                    dateStartPicker,
                    dateEndPicker,
                },
                BackgroundColor = Color.FromHex("666666"),
                Padding = new Thickness(10,20,10,0),

            };
            var contentLayout = new StackLayout{
                Padding = new Thickness(10,0,10,0),
                Children = {
                    checkView,
                    categoryView
                }
            };
            // Set the content for the page.
            this.Content = new ScrollView{
                Content = new StackLayout {
                Children = {
                    headerLayout,
                    contentLayout
                    }
                },
            };
        }
Ejemplo n.º 2
0
        public CategoryListEditPage()
        {
            NavigationPage.SetHasNavigationBar (this, false);
            App.MasterDetailPage.IsPresented = false;
            InitializeComponent ();
            var user = App.user;
            var categoryView = new ListView();
            var api = new Api ();
            categoryView.SeparatorColor = Color.FromHex ("E6E2DB");
            categoryView.BeginRefresh ();
            categoryView.ItemTemplate = new DataTemplate (typeof(CategoryEditCell));
            if (user != null) {
                var categories = api.getCategories (user);
                categoryView.ItemsSource = categories;
            }
            categoryView.ItemTapped += (sender, e) => {
                categoryView.SelectedItem = null;
                App.MasterDetailPage.Detail = new CategoryEditPage(e.Item as Category);

            };
            categoryView.EndRefresh ();

            //this.Padding = new Thickness (10, 30, 10, 5);

            // Set the content for the page.
            this.Content = new StackLayout {
                BackgroundColor = Color.FromHex("E6E2DB"),
                Children = {
                    new StackLayout{
                        Padding = new Thickness (10, 40, 10, 15),
                        BackgroundColor = Color.FromHex("525151"),
                        HorizontalOptions = LayoutOptions.FillAndExpand,
                        VerticalOptions = LayoutOptions.FillAndExpand,
                        Orientation = StackOrientation.Horizontal,
                        Children = {
                            new Label {
                                HorizontalOptions = LayoutOptions.CenterAndExpand,
                                Text = "Управление товаром",
                                TextColor = Color.White
                            }
                        }
                    },

                    new StackLayout{
                        Padding = new Thickness (0, 40, 0, 0),
                        BackgroundColor = Color.FromHex("E6E2DB"),
                        HorizontalOptions = LayoutOptions.FillAndExpand,
                        VerticalOptions = LayoutOptions.FillAndExpand,
                        Children = {
                            new Label {
                                HorizontalOptions = LayoutOptions.StartAndExpand,
                                VerticalOptions = LayoutOptions.End,
                                Text = "Категории",
                                TextColor = Color.FromHex("666")
                            },
                            categoryView

                            }
                        }
                    },

            };
        }