Exemple #1
0
        private void GenerateReport(DateTimeOffset from, DateTimeOffset to)
        {
            textbox_listitems.Text     = "";
            textbox_listquantity.Text  = "";
            textbox_listunitprice.Text = "";
            outputRevenue.Text         = "";
            outputTotalItems.Text      = "";

            SalesOrder salesOrder = new SalesOrder();

            salesOrderList = salesOrder.loadSalesOrders();
            List <SalesOrderInfo> tempList = new List <SalesOrderInfo>();
            DateTime temp;

            foreach (SalesOrderInfo so in salesOrderList)
            {
                temp = Convert.ToDateTime(so.date);
                if ((temp >= from) && (temp <= to))
                {
                    tempList.Add(so);
                }
            }

            List <Items> items = new List <Items>();

            foreach (SalesOrderInfo info in tempList)
            {
                foreach (Items i in info.items)
                {
                    Items tempItem = findItem(items, i);
                    if (tempItem == null)
                    {
                        items.Add(i);
                    }
                    else
                    {
                        tempItem.item_quantity += i.item_quantity;
                    }
                }
            }
            RetrieveItems stockListClass = new RetrieveItems();
            double        revenue        = 0;
            double        totalItems     = 0;

            foreach (Items a in items)
            {
                double quantity = a.item_quantity;
                double price    = stockListClass.ReturnPrice(a.item_name);
                textbox_listitems.Text     += a.item_name + "\n";
                textbox_listunitprice.Text += "$" + price + "\n";
                textbox_listquantity.Text  += quantity + "\n";
                totalItems += quantity;
                revenue    += (price * quantity);
            }
            outputRevenue.Text    = "$" + revenue.ToString();
            outputTotalItems.Text = totalItems.ToString();
        }
        public MainScreen()
        {
            this.InitializeComponent();
            textBlock1.Text = "Signed in as: " + Globals.currentUser;
            SalesOrder newSalesOrder = new SalesOrder();

            salesOrderList = newSalesOrder.loadSalesOrders();
            RetrieveItems getStockList = new RetrieveItems();

            stockItemsList = getStockList.getList();
        }
        private void GenerateReport(int quantity)
        {
            textbox_listitems.Text    = "";
            textbox_listquantity.Text = "";

            RetrieveItems     stock      = new RetrieveItems();
            List <StockItems> stockitems = stock.getList();

            foreach (StockItems so in stockitems)
            {
                if (so.item_stock <= quantity)
                {
                    textbox_listitems.Text    += so.item_name + "\n";
                    textbox_listquantity.Text += so.item_stock + "\n";
                }
            }
        }