private void button_load_Click(object sender, EventArgs e) { var data = db.bills.Where(o => o.id > 0); if (!rangeSelector.valid) { Comformation.show(Text, "Please select a Duration", 1); return; } var r = rangeSelector.Range; var r1 = r[0]; var r2 = r[1]; var d = rangeSelector.DurationType; if (d == 1) { if (!rangeSelector.fyvalid) { Comformation.show(Text, "Please select a Fiscalyear", 1); return; } var fyid = rangeSelector.fy.id; data = data.Where(o => o.fiscalyear_id == fyid); } else if (d == 5) { data = data.Where(o => o.date == r1); } else { data = data.Where(o => o.date >= r1 && o.date <= r2); } betterListView1.Clear(); if (comboBox_grouping.SelectedIndex == 1) { GroupByBill(data); } else if (comboBox_grouping.SelectedIndex == 2) { GroupByItem(data.Select(o => o.id).ToList()); } else if (comboBox_grouping.SelectedIndex == 3) { GroupByCategory(data.Select(o => o.id).ToList()); } //else if (comboBox_grouping.SelectedIndex == 4) //{ // GroupByCounter(data); //} }
private void button_load_Click(object sender, EventArgs e) { var data = db.wastagepurchaseitems.Where(o => o.id > 0); if (!rangeSelector.valid) { Comformation.show(Text, "Please select a Duration", 1); return; } var r = rangeSelector.Range; var r1 = r[0]; var r2 = r[1]; var d = rangeSelector.DurationType; if (d == 1) { if (!rangeSelector.fyvalid) { Comformation.show(Text, "Please select a Fiscalyear", 1); return; } var fyid = rangeSelector.fy.id; data = data.Where(o => o.fiscalyear_id == fyid); } else if (d == 5) { data = data.Where(o => o.date == r1); } else { data = data.Where(o => o.date >= r1 && o.date <= r2); } betterListView1.Clear(); if (comboBox_grouping.SelectedIndex == 1) { Getbyitem(data); } }
private void vendors_nsme_Click(object sender, EventArgs e) { if (itemname.Text.Trim() == "") { notificationMAnager1.show("please enter the item name", 1000); itemname.Focus(); return; } if (pricce_fltb.value == 0) { notificationMAnager1.show("please enter the item price", 1000); pricce_fltb.Focus(); return; } if (textBox_barcode.Text.Trim() == "") { notificationMAnager1.show("Point Barcode Reader properly to the product or, if product has no Barcode then, type 'Na' in barcode field", 2000); textBox_barcode.Focus(); return; } if (comboBox_category.SelectedIndex < 0) { notificationMAnager1.show("Please Select a Category", 1000); return; } if (floattb_cost.value > pricce_fltb.value) { if (Comformation.ShowModal("Please Confirm Your Selling Rate", ", Your selling price is less then cost price please check and confirm", true) == DialogResult.OK) { ; } } if (floattb_wholesaleprice.value > pricce_fltb.value) { if (Comformation.ShowModal("Please Confirm Your wholesale Rate", ", are you sure your selling price is less then wholesale ?", true) == DialogResult.OK) { ; } } if (floattb_wholesaleprice.value == 0) { floattb_wholesaleprice.value = pricce_fltb.value; } else { floattb_wholesaleprice.value = floattb_wholesaleprice.value; } try { item i = new item(); i.name = itemname.Text; i.stock = qty_fltb.value; i.rate = pricce_fltb.value; i.buyrate = floattb_cost.value; i.barcode = textBox_barcode.Text; i.wholesaleprice = floattb_wholesaleprice.value; i.category_id = (comboBox_category.SelectedItem as category).id; i.created_at = DateTime.Now; i.updated_at = DateTime.Now; db.items.Add(i); db.SaveChanges(); if (onDataSaved != null) { onDataSaved(this, new DataSaveargs() { data = i }); } notificationMAnager1.show("Successfully Data are Saved......", 10000); this.Close(); } catch (Exception ex) { notificationMAnager1.show("data is not save Please Try Again" + ex.Message, 10000); } }
private void label2_Click(object sender, EventArgs e) { if (itemeditname_txt.Text.Trim() == "") { notificationMAnager1.show("please enter your item name", 1000); return; } if (comboBox_category.SelectedItem == null) { notificationMAnager1.show("please select catrgory", 1000); return; } if (bettertextbox_barcode.Text.Trim() == "") { notificationMAnager1.show("Point Barcode Reader properly to the product or, if product has no Barcode then, type 'Na' in barcode field", 2000); bettertextbox_barcode.Focus(); return; } if (floattb_cost.value > price_fltb.value) { if (Comformation.ShowModal("Please Confirm Your Selling Rate", ", Your selling price is less then cost price please check and confirm", true) == DialogResult.OK) { ; } } if (floattb_wholesaleprice.value > price_fltb.value) { if (Comformation.ShowModal("Please Confirm Your wholesale Rate", ", are you sure your selling price is less then wholesale ?", true) == DialogResult.OK) { ; } } if (floattb_wholesaleprice.value == 0) { floattb_wholesaleprice.value = price_fltb.value; } else { floattb_wholesaleprice.value = floattb_wholesaleprice.value; } try { item a = db.items.Where(o => o.id == id).First(); a.name = itemeditname_txt.Text; a.category_id = (comboBox_category.SelectedItem as Models.category).id; a.stock = stock_fltb.value; a.rate = price_fltb.value; a.buyrate = floattb_cost.value; a.barcode = bettertextbox_barcode.Text; a.wholesaleprice = floattb_wholesaleprice.value; a.created_at = DateTime.Now; a.updated_at = DateTime.Now; db.Entry(a).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); if (onDataEdited != null) { onDataEdited(this, new DataSaveargs() { data = a }); } } catch (Exception) { notificationMAnager1.show("data can not be saved", 1000); } this.Close(); }