Beispiel #1
0
        private void RevenueReport(object sender, EventArgs e)
        {
            string _askYear = "";

            using (AskYearForm ff = new AskYearForm())
            {
                ff.ShowDialog();
                _askYear = AskYearForm.ReturnValue;
            }

            if (_askYear is null)
            {
                _ = MessageBox.Show(
                    "Invalid input!",
                    "Info",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Information,
                    MessageBoxDefaultButton.Button1,
                    0);
            }
            else
            {
                sqlExpression =
                    $"SELECT FORMAT([Date], 'MMMM') AS [Month], SUM([Cost]) AS [Revenue] " +
                    $"FROM Applications " +
                    $"INNER JOIN [Services] ON Applications.ServiceID = [Services].ID " +
                    $"WHERE YEAR([Date]) = { _askYear } " +
                    $"AND [MasterID] = { masterSelectBox.SelectedValue } " +
                    $"GROUP BY FORMAT([Applications].[Date], 'MMMM');";

                ChartFormShow(xAxis: "Month",
                              title: $"Revenue report by { masterSelectBox.Text } at { _askYear }");
            }
        }
Beispiel #2
0
        private void TotalCostThisYearReport(object sender, EventArgs e)
        {
            string _askYear = "";

            using (AskYearForm ff = new AskYearForm())
            {
                ff.ShowDialog();
                _askYear = AskYearForm.ReturnValue;
            }

            if (_askYear is null)
            {
                _ = MessageBox.Show(
                    "Invalid input!",
                    "Info",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Information,
                    MessageBoxDefaultButton.Button1,
                    0);
            }
            else
            {
                sqlExpression = $"SELECT FORMAT([Applications].[Date], 'MMMM') "
                                + $"AS [Month of this year], SUM([Services].[Cost]) "
                                + $"AS [Total sold by service] FROM Applications "
                                + $"INNER JOIN Services "
                                + $"ON [Applications].[ServiceID] = [Services].[ID] "
                                + $"WHERE (YEAR([Applications].[Date]) = { _askYear } ) "
                                + $"GROUP BY FORMAT(Applications.Date, 'MMMM') ";
                ChartFormShow(xAxis: "Month of this year",
                              title: $"Total monthly revenue on { _askYear } year");
            }
        }