Пример #1
0
 private void UOFMlist_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         itemPriceLabel.Text = "";
         quantityPanel.Enabled = true;
         int index = itemList.SelectedIndex;
         Item i = GPData.items[index];
         Price p = new Price();
         SalesEntry se = new SalesEntry();//new SalesEntry method
         se.UOFM = UOFMlist.SelectedItem.ToString();
         p = i.priceList.prices.Find(delegate(Price er) { return er.uofm.Equals(se.UOFM); });//searching uofm from prices in i.priceList.prices list entries
         itemPriceLabel.Text = p.Uomprice.ToString();
     }
     catch
     {
     }
 }
Пример #2
0
 private void inserttable()
 {
     try
     {
         Item i = new Item();
         string temp = itemList.Items[itemList.SelectedIndex].ToString();
         i = GPData.getItem(temp);
         getTotal(i);
         refreshDataGrid();
         SalesEntry se = new SalesEntry();
         se.UOFM = UOFMlist.SelectedItem.ToString();
         Price p = new Price();
         p = i.priceList.prices.Find(delegate(Price er) { return er.uofm.Equals(se.UOFM); });
         quantityPanel.Enabled = false;
         confirmbtn.Enabled = true;
     }
     catch
     {
         Console.Write("Quantity should be a positive integer", "Ooops!!!");
     }
 }
Пример #3
0
        public static void refreshData()
        {
            items.Clear();
            int index = 0;
            try
            {
                SqlCommand cmd = new SqlCommand("SELECT * FROM dbo.IV00101 ORDER BY ITEMNMBR", connection);
                SqlDataReader reader = null;
                reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    Item i = new Item();
                    i.itemcode = reader["ITEMNMBR"].ToString().Trim();
                    i.itemname = reader["ITEMDESC"].ToString().Trim();
                    i.pricegroup = reader["PriceGroup"].ToString().Trim();
                    string temp = reader["STNDCOST"].ToString();
                    i.cost = Convert.ToDouble(temp);
                    items.Add(i);
                    table.Add(i.ToString(), index);
                    index++;

                }
                reader.Close();
            }
            catch (Exception e)
            {
                Console.WriteLine("Oops! " + e.ToString());
            }

            try
            {
                SqlCommand cmd2 = new SqlCommand("SELECT * FROM dbo.IV00108 WHERE PRCLEVEL = 'RETAIL' ORDER BY ITEMNMBR", connection);
                SqlDataReader reader2 = null;
                reader2 = cmd2.ExecuteReader();

                while (reader2.Read())
                {
                    Price p = new Price();
                    String tempItemNumber = "";
                    tempItemNumber = reader2["ITEMNMBR"].ToString().Trim();
                    p.uofm = reader2["UOFM"].ToString().Trim();
                    p.Toqty = Convert.ToDouble(reader2["TOQTY"].ToString().Trim());
                    p.Fromqty = Convert.ToDouble(reader2["FROMQTY"].ToString().Trim());
                    p.Uomprice = Convert.ToDouble(reader2["UOMPRICE"].ToString().Trim());
                    p.Qtybsoum = Convert.ToDouble(reader2["QTYBSUOM"].ToString().Trim());
                    Item found = items.Find(delegate(Item it) { return it.itemcode.Equals(tempItemNumber); });
                    found.priceList.prices.Add(p);

                }
                reader2.Close();
            }
            catch (Exception e)
            {
                Console.WriteLine("Oops! " + e.ToString());
            }
        }
Пример #4
0
        private void getTotal(Item i)
        {
            Price p = new Price();
            SalesEntry se = new SalesEntry();
            SalesEntry se2 = new SalesEntry();
            foreach (SalesEntry br in Session.Cart.getSalesList())
            {
                if (br.ItemCode == i.itemcode)
                {
                    se2 = br;
                }
            }
            se.ItemCode = i.itemcode;
            se.ItemName = i.itemname;
            se.UOFM = UOFMlist.SelectedItem.ToString();
            se.Quantity = int.Parse(quantityTb.Text);
            se.Price = 0;
            if (UOFMlist.SelectedItem.ToString() == "N/A")
            {
                if (se2.Price == 0)
                {
                    pricepanel.Visible = true;
                }
                se.Price = double.Parse(prctb.Text);
                se.Total = se.Price * Convert.ToDouble(se.Quantity);
                Session.Cart.addEntry(se);
            }
            else
            {
                p = i.priceList.prices.Find(delegate(Price er) { return er.uofm.Equals(se.UOFM); });
                se.Price = p.Uomprice;
                se.Total = se.Price * Convert.ToDouble(se.Quantity) * p.Qtybsoum;
                Session.Cart.addEntry(se);
            }
            grandTotal = 0;

            foreach (SalesEntry se1 in Session.Cart.getSalesList())
            {
                grandTotal += se1.Total;
                foreach (Price pr in i.priceList.prices)
                {
                    if (pr.uofm == se1.UOFM && se1.Quantity >= pr.Fromqty && se1.Quantity < pr.Toqty)
                    {
                        se1.Price = pr.Uomprice;
                    }

                }

            }
            totalLbl.Text = grandTotal.ToString("0.00");
            Item it = new Item();
            it.Gtotal = grandTotal;
        }
Пример #5
0
 public void add(Price p)
 {
 }