public void modifyEntryTest() { ConnectionManager c = new ConnectionManager(); MySqlConnection connection = c.connectDatabase("Database = proximoDB; Data Source = us-cdbr-azure-central-a.cloudapp.net; User Id = b5fb261919a40c; Password = aff5b96f"); DateTime dt1 = new DateTime(2015, 01, 01); DateTime dt2 = new DateTime(2017, 01, 01); c.openConnection(connection); List <object> l = c.retrieveEntry(connection, dt1, dt2, "orderEntry"); c.closeConnection(connection); c.openConnection(connection); ((DailySalesDetails)l[1]).setDate(DateTime.Now); SalesEntry se = new SalesEntry(); DailySalesDetails ds = new DailySalesDetails(); SalesReturn sr = new SalesReturn(); ReturnEntry re = new ReturnEntry(); sr.addReturnEntry(re); sr.ReturnerID = 750; ds.SubmitterID = 565; ds.addEntry(se); se.Quantity = 50; System.DateTime now = System.DateTime.Now; ds.setDate(now); //c.modifyEntry(connection, ds, l[1]); }
public void storeEntryTest() { ConnectionManager c = new ConnectionManager(); MySqlConnection connection = c.connectDatabase("Database = proximoDB; Data Source = us-cdbr-azure-central-a.cloudapp.net; User Id = b5fb261919a40c; Password = aff5b96f"); SalesEntry se = new SalesEntry(); DailySalesDetails ds = new DailySalesDetails(); SalesReturn sr = new SalesReturn(); ReturnEntry re = new ReturnEntry(); Order newOrder = new Order(); newOrder.OrderId = 4578; newOrder.OrderRequestedDate = System.DateTime.Now; sr.addReturnEntry(re); sr.ReturnerID = 750; ds.SubmitterID = 565; ds.addEntry(se); se.Quantity = 50; se.Product = new Product(); c.openConnection(connection); System.DateTime now = System.DateTime.Now; ds.setDate(now); bool b = c.storeEntry(connection, ds); c.closeConnection(connection); }
private void removeItem() { try { //refreshing the list in SalesEntry after the item was removed SalesEntry se = new SalesEntry(); int i = dataGridView1.CurrentCell.RowIndex; String itemName = dataGridView1[0, i].Value.ToString(); String uofm = dataGridView1[1, i].Value.ToString(); String price = dataGridView1[2, i].Value.ToString(); String quantity = dataGridView1[3, i].Value.ToString(); String total = dataGridView1[4, i].Value.ToString(); se.ItemName = itemName; se.UOFM = uofm; se.Price = Convert.ToDouble(price); se.Quantity = Convert.ToInt32(quantity); se.Total = Convert.ToDouble(total); Session.Cart.removeEntry(se); refreshDataGrid(); } catch { MessageBox.Show("What is your error"); } }
private static SalesEntry findItemInList(SalesEntry i) { foreach (SalesEntry item in sales) { if (item.Equals(i)) return item; } return null; }
private void salesReportentry() { SalesEntry se = new SalesEntry(); se.ItemCode = itemCode; se.Price = itemPrice; se.Quantity = quantity; FileData.saveToFile(SalesEntry.transId, se);//calling other function to save the file(transId, SalesEntry se) }
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; }
public static void saveToFile(String TransactionNumber, SalesEntry se) { int listCount = Session.Cart.getSalesList().Count; int counter = 0; while (counter < listCount) { foreach (SalesEntry se1 in Session.Cart.getSalesList()) { itemWriter = new StreamWriter("sales-" + DateTime.Now.ToString("MMMM") + "-" + DateTime.Now.Day.ToString() + ".txt", true); itemWriter.WriteLine(TransactionNumber.ToString() + "," + se1.ItemCode + "," + se1.Price + "," + se1.Quantity + "," + se1.UOFM); itemWriter.Close(); counter++; } } }
public async Task <ActionResult> Post(DtoSalesEntry entry) { try { var salesEntry = SalesEntry.FromDto(DateTime.UtcNow, entry); await _repository.AddSaleEntry(salesEntry); _logger.LogInformation($"Successfully added sales entry " + $"{salesEntry.TimeOfSale}: {salesEntry.ArticleNumber}:{salesEntry.Price}."); return(Ok()); } catch (Exception e) { _logger.LogError(e, "Adding sales entry failed."); throw; } }
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 { } }
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!!!"); } }
public void addEntry(SalesEntry s) { //Logic: If the entry exists (same UOFM, itemcode) then: //Store the current quantity of the entry with the same item code, UOFM //remove the existing entry //Add the two quantities together //Add back to saleslist //If it doesnt exist, just add //sales.Add(s); //found = s; int quantity = s.Quantity; double total = s.Total; int quantity2 = 0; double total2 = 0; //s.Quantity = 0; foreach (SalesEntry SE in sales) { if (SE.ItemCode.Equals(s.ItemCode) && SE.UOFM.Equals(s.UOFM)) { quantity2 = SE.Quantity; total2 = SE.Total; quantity = quantity + quantity2; total = total + total2; } else { } } sales.RemoveAll(delegate(SalesEntry he) { return he.ItemCode.Equals(s.ItemCode) && he.UOFM.Equals(s.UOFM); }); s.Quantity = quantity; s.Total = total; sales.Add(s); }
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 { } }
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; }
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!!!"); } }
public void removeEntry(SalesEntry s) { //To delete the proper salesentry sales.Remove(s); s.Price = 0; }