Exemplo n.º 1
0
        //
        // Monthly report
        private void ItemIncome_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            frmPickDateTime frm = new frmPickDateTime();

            frm.myState = EnumPickDateTime.PickYear;
            if (frm.ShowDialog() == DialogResult.OK)
            {
                waitForm.ShowWaitForm();
                clearText();
                ChartTitle title = new ChartTitle();
                title.Text = "Monthly Report";
                chartControl.Titles.Add(title);
                System.Threading.Thread.Sleep(1000);
                table = MyConnect.getTable("execute ShowMothlyReports @y = " + frm.year);
                chartControl.DataSource = table;

                Series s2 = new Series("Purchase", ViewType.Bar);
                s2.View.Color = Color.Blue;
                chartControl.Series.Add(s2);
                s2.ArgumentDataMember = "Month";
                s2.ValueDataMembers.AddRange(new string[] { "TotalPurchase" });

                Series s1 = new Series("Sale", ViewType.Bar);
                s1.View.Color = Color.PaleVioletRed;
                chartControl.Series.Add(s1);
                s1.ArgumentDataMember = "Month";
                s1.ValueDataMembers.AddRange(new string[] { "TotalSale" });

                waitForm.CloseWaitForm();
                this.State = EnumReportState.RevenueOfMonth;
            }
        }
Exemplo n.º 2
0
        //
        // Days Report
        private void navBarItem1_LinkClicked_1(object sender, NavBarLinkEventArgs e)
        {
            frmPickDateTime frm = new frmPickDateTime();

            frm.myState = EnumPickDateTime.PickDays;
            if (frm.ShowDialog() == DialogResult.OK)
            {
                waitForm.ShowWaitForm();
                clearText();
                ChartTitle title = new ChartTitle();
                title.Text = "Days Report From : " + frm.startDate.ToShortDateString() + " To " + frm.endDate.ToShortDateString();
                chartControl.Titles.Add(title);
                System.Threading.Thread.Sleep(1000);

                table = MyConnect.getTable("execute DaysReport @start ='" + frm.startDate.ToString("yyyy-MM-dd") + "',@end = '" + frm.endDate.ToString("yyyy-MM-dd") + "'");

                Series s1 = new Series("Total", ViewType.Line);
                s1.View.Color = Color.Orange;
                chartControl.Series.Add(s1);
                int i = 0, j = 0;
                foreach (DateTime date in MyAction.GetAllDates(frm.startDate, frm.endDate))
                {
                    if (j < table.Rows.Count)
                    {
                        DateTime temp = DateTime.Parse(table.Rows[j][0].ToString());
                        if (temp.Equals(date))
                        {
                            s1.Points.Add(new SeriesPoint(temp.ToString("dd-MM-yyyy"), long.Parse(table.Rows[j][1].ToString())));
                            j++;
                        }
                        else
                        {
                            s1.Points.Add(new SeriesPoint(date.ToString("dd-MM-yyyy"), 0));
                        }
                    }
                    else
                    {
                        s1.Points.Add(new SeriesPoint(date.ToString("dd-MM-yyyy"), 0));
                    }
                    i++;
                }
                chartControl.Series.Add(s1);
                //MessageBox.Show(table.Rows[0][1].ToString());
                waitForm.CloseWaitForm();
                this.State = EnumReportState.RevenueOfDays;
            }
        }