Esempio n. 1
0
        public DataTable GetReportPerMonth(int year, List <int> months)
        {
            DataTable w_table = new DataTable();

            //. Columns
            ModelProduct     w_products = new ModelProduct();
            IList <IProduct> w_prdList  = w_products.GetItemList();

            DataColumn w_col = w_table.Columns.Add("id", typeof(Int32));

            w_col.AllowDBNull = false;
            w_col.Unique      = true;

            w_col             = w_table.Columns.Add("Employee", typeof(string));
            w_col.AllowDBNull = false;
            w_col.Unique      = true;
            foreach (IProduct w_prdItem in w_prdList)
            {
                w_col         = w_table.Columns.Add(w_prdItem.id.ToString(), typeof(Int32));
                w_col.Caption = w_prdItem.name;
            }

            //. Rows.
            ModelEmployee     w_employees = new ModelEmployee();
            IList <IEmployee> w_manList   = w_employees.GetItemList();
            IList <IReport>   w_salesList = this.GetItemList(year, months);

            foreach (IEmployee w_empItem in w_manList)
            {
                DataRow w_row = w_table.NewRow();
                foreach (DataColumn w_col1 in w_table.Columns)
                {
                    if (w_col1.Ordinal == 0)
                    {
                        w_row[0] = w_empItem.id;
                        continue;
                    }

                    if (w_col1.Ordinal == 1)
                    {
                        w_row[1] = w_empItem.f_name + "." + w_empItem.g_name;
                        continue;
                    }

                    int w_prdId  = int.Parse(w_col1.ColumnName);
                    int w_amount = GetSalesCount(w_salesList, w_empItem.id, w_prdId);
                    w_row[w_col1.Ordinal] = w_amount;
                }

                w_table.Rows.Add(w_row);
            }

            return(w_table);
        }
Esempio n. 2
0
        public DataTable GetReportPerMan(int year, List <int> months, int man_id)
        {
            DataTable w_table = new DataTable();

            //. Columns

            DataColumn w_col = w_table.Columns.Add("id", typeof(Int32));

            w_col.AllowDBNull = false;
            w_col.Unique      = true;

            w_col             = w_table.Columns.Add("Item", typeof(string));
            w_col.AllowDBNull = false;
            w_col.Unique      = true;

            w_col             = w_table.Columns.Add("Amount", typeof(string));
            w_col.AllowDBNull = false;



            //. Rows.
            ModelProduct     w_employees = new ModelProduct();
            IList <IProduct> w_itemList  = w_employees.GetItemList();
            IList <IReport>  w_salesList = this.GetItemList(year, months);

            foreach (IProduct w_empItem in w_itemList)
            {
                DataRow w_row = w_table.NewRow();
                foreach (DataColumn w_col1 in w_table.Columns)
                {
                    if (w_col1.Ordinal == 0)
                    {
                        w_row[0] = w_empItem.id;
                        continue;
                    }

                    if (w_col1.Ordinal == 1)
                    {
                        w_row[1] = w_empItem.name;
                        continue;
                    }
                    int w_amount = GetSalesCount(w_salesList, man_id, w_empItem.id);
                    w_row[w_col1.Ordinal] = w_amount;
                }

                w_table.Rows.Add(w_row);
            }

            return(w_table);
        }