private void btnaction_Click(object sender, EventArgs e) { string baracode = "0"; double bupric = 0, clpric = 0, businessclientPrice = 0; string nme = ""; try { TheUnito = (TheUnito)Enum.Parse(typeof(TheUnito), Globals.Globals.gram.ToString()); bupric = double.Parse(txtBusinessPrice.Text); clpric = double.Parse(txtClientPrice.Text); businessclientPrice = double.Parse(txtprcln.Text); nme = txtname.Text; baracode = (string.IsNullOrEmpty(baraCode128vewier1.Text) ? "0" : baraCode128vewier1.Text); int baraisher = 0; List <Types> allbracodr = new List <Types>(); allbracodr = BLL.Types.GetTypeByBaraCode(baracode, false); baraisher = allbracodr.Count; if (id > 0) { if ((baraisher > 0)) { if (allbracodr[0].BaraCode != BLL.Types.GetTypeByID(id).BaraCode) { MessageBox.Show("هذا الباركود خاص بصنف اخر "); return; } } if ((nme != BLL.Types.GetTypeByID(id).Name)) { Store.UpdateTypNamesinstore(id, nme); } BLL.Types.UpdateType(id, nme, bupric, clpric, businessclientPrice, TheUnito, baracode); } else { if (BLL.Types.GetTypeByName(nme) != null) { MessageBox.Show(" الاسم موجود مسبقا الرجاء ادخال اسم اخر", "خطأ مدخلات"); return; } if (baraisher > 0) { MessageBox.Show("هذا الباركود متوفر مسبقا"); return; } BLL.Types.InsertType(0, nme, bupric, clpric, businessclientPrice, TheUnito, baracode); } alltyps = BLL.Types.GetAllTypes(); dataGridView1_DataSourceChanged(sender, e); btnnew_Click(sender, e); txtname.Focus(); BllGlobal.UpdateAllType(); WeightsOrganizer.Controls.Righto.GetDataAgainToTypes(); BllGlobal.UpdateAllStore(); } catch {; MessageBox.Show(" الرجاء التأكد من المدخلات", "خطأ مدخلات"); SelectTheEmptyText(groupBox1); } }
private void Del(int p, TheUnito theUnito) { ALlPrice = 0; List <BLL.ClientDeal> allz = new List <WeightsOrganizer.BLL.ClientDeal>(); foreach (BLL.ClientDeal cl in alloo) { allz.Add(cl); } alloo = new List <WeightsOrganizer.BLL.ClientDeal>(); foreach (BLL.ClientDeal cl in allz) { if (cl.TheUnit == theUnito && (cl.TypeId == p)) { } else { alloo.Add(cl); ALlPrice += cl.ToTalPrice; } } dataGridView1.DataSource = alloo; numbertextbox1.Text = ALlPrice.ToString(); numbertextbox2.Text = ALlPrice.ToString(); }
private void addtype_Click(object sender, EventArgs e) { if (combotypes.SelectedIndex != -1 || combocompany.SelectedIndex != -1) { int typeid = 0, manid = 0; double price = 0; int amnt = 1; BLL.Types tppp = null; try { try { amnt = int.Parse(numbertextbox1.Text); } catch { amnt = 1; } tppp = (BLL.Types)combotypes.SelectedItem; if (!BLL.SalePoint.ISinStore(tppp.ID, amnt)) { DefaultState(true); return; } typeid = int.Parse(combotypes.SelectedValue.ToString()); manid = int.Parse(combocompany.SelectedValue.ToString()); price = ((SaledProcrdere == "M") ? tppp.ClientPrice : tppp.BusinessClientPrice); tppp = (BLL.Types)combotypes.SelectedItem; TheUnito TheUnito = TheUnito.Kilo; TheUnito = (TheUnito)Enum.Parse(typeof(TheUnito), Globals.Globals.gram.ToString()); BLL.ClientDeal cl = new WeightsOrganizer.BLL.ClientDeal(0, typeid, manid, amnt, price, price, "", new MyDateTime(dateTimePicker1.Value), TheUnito, tppp.BusinessPrice, combocompany.Text, combotypes.Text); dataGridView1.DataSource = new object(); dataGridView1.DataSource = BLL.SalePoint.Add(cl); DefaultState(true); BLL.SalePoint.WriteSerolizeMe(); } catch { } } else { MessageBox.Show("معلومات مطلوبة", "الحساب و المادة", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
public ClientDealDetails(int id, int typeid, int clientid, double amount, double price, double paidmoney, string details, MyDateTime addeddate, TheUnito theUnit, double businessPrice, string clientname, string typename) : base(id, typeid, amount, details, addeddate) { this.ClientId = clientid; this.BusinessPrice = businessPrice; this.PaidMoney = paidmoney; this.Price = price; this.TheUnit = theUnit; this.ClientName = clientname; this.TypeName = typename; }
internal void Refresh2(TheUnito theUnito) { switch (theUnito) { case TheUnito.Piece: { radioButton3.Checked = true; break; } case TheUnito.Kilo: { radioButton2.Checked = true; break; } case TheUnito.Gram: { radioButton1.Checked = true; break; } } }
private static void MyDelete(int idtype, TheUnito unet) { List <BLL.ClientDeal> allz = new List <WeightsOrganizer.BLL.ClientDeal>(); foreach (BLL.ClientDeal bd in all) { if ((bd.TypeId == idtype) && (bd.TheUnit == unet)) { } else { allz.Add(bd); } } all = allz; }
private void btnaction_Click(object sender, EventArgs e) { int typeid = 0, manid = 0; double amnt = 0, clprc = 0, PaidMoney = 0; string det = ""; BLL.Types tppp = null; try { typeid = int.Parse(combotypes.SelectedValue.ToString()); manid = int.Parse(combocompany.SelectedValue.ToString()); amnt = double.Parse(txtamount.Text); clprc = double.Parse(txtclntprice.Text); PaidMoney = double.Parse(txtpaidmny.Text); det = txtdet.Text; tppp = (BLL.Types)combotypes.SelectedItem; TheUnito TheUnito = TheUnito.Kilo; TheUnito = (TheUnito)Enum.Parse(typeof(TheUnito), Globals.Globals.gram.ToString()); if (id > 0) { // MessageBox.Show(string.Format("{0} {1} {2} {3} {4} {5} {6}",id.ToString(), typeid.ToString(), manid.ToString(), amnt.ToString(), clprc.ToString(), PaidMoney.ToString(), det)); BLL.SalesReturns.UpdateClientDeal(id, typeid, manid, amnt, clprc, PaidMoney, det, 0, combocompany.Text, combotypes.Text); dataGridView1.DataSource = BLL.SalesReturns.GetAllClientDeal(); } else { double stramnt = amnt; if (Globals.Globals.gram == 0) { stramnt = amnt / 1000; } BLL.Store.InsertStoreFromClient(typeid, stramnt, DateTime.Now, combotypes.Text, true); BLL.SalesReturns.InsertClientDeal(0, typeid, manid, amnt, clprc, amnt * clprc, det, TheUnito, tppp.BusinessPrice, combocompany.Text, combotypes.Text); BLL.Client clo = BLL.Client.GetClientByID(manid); if (clo.ID != Globals.Globals.UnknownClient) { clo.Balance -= ((amnt * clprc)); clo.UpdateClient(); BLL.BllGlobal.UpdateAllClients(); } dataGridView1.DataSource = BLL.SalesReturns.GetAllClientDeal(); } btnnew_Click(sender, e); } catch { SelectTheEmptyText(this.groupBox1); } }
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) { try { if (int.Parse(dataGridView1.Rows[e.RowIndex].Cells["TypeId"].Value.ToString()) > 0) { ///deltype.Text = "حذف الـ " + dataGridView1.Rows[e.RowIndex].Cells["TypeName"].Value.ToString(); eRowIndex = e.RowIndex; _idtype = int.Parse(dataGridView1.Rows[e.RowIndex].Cells["TypeId"].Value.ToString()); _clnprice = double.Parse(dataGridView1.Rows[e.RowIndex].Cells["ToTalPrice"].Value.ToString()); unittodel = (TheUnito)Enum.Parse(typeof(TheUnito), dataGridView1.Rows[e.RowIndex].Cells["TheUnit"].Value.ToString()); deltype.Enabled = true; btnaddfast.Enabled = true; btnsubfast.Enabled = true; if (e.ColumnIndex == 1) { int rid = int.Parse(dataGridView1.Rows[e.RowIndex].Cells[8].Value.ToString()); new FrmDetails(rid, "أصناف").ShowDialog(); } } } catch { } }
public static int InsertType(int id, string name, double businessprice, double clientprice, double businessclientprice, TheUnito theUnit, string baracode) { MyDateTime xx = new MyDateTime(DateTime.Now); TypeDetails tb1 = new TypeDetails(id, name, businessprice, clientprice, businessclientprice, xx, "", theUnit, baracode); int x = myRealProvider.InsertType(tb1); return(x); }
private void btnaction_Click(object sender, EventArgs e) { int typeid = 0, manid = 0; double amnt = 0, clprc = 0, PaidMoney = 0; string det = ""; BLL.Types tppp = null; try { typeid = int.Parse(combotypes.SelectedValue.ToString()); manid = int.Parse(combocompany.SelectedValue.ToString()); amnt = double.Parse(txtamount.Text); clprc = double.Parse(txtclntprice.Text); PaidMoney = double.Parse(txtpaidmny.Text); det = txtdet.Text; tppp = (BLL.Types)combotypes.SelectedItem; TheUnito TheUnito = TheUnito.Kilo; TheUnito = (TheUnito)Enum.Parse(typeof(TheUnito), Globals.Globals.gram.ToString()); if (id > 0) { // MessageBox.Show(string.Format("{0} {1} {2} {3} {4} {5} {6}",id.ToString(), typeid.ToString(), manid.ToString(), amnt.ToString(), clprc.ToString(), PaidMoney.ToString(), det)); BLL.ClientDeal.UpdateClientDeal(id, typeid, manid, amnt, clprc, PaidMoney, det, 0, combocompany.Text, combotypes.Text); dataGridView1.DataSource = BLL.ClientDeal.GetAllClientDeal(); } else { double stramnt = amnt; if (Globals.Globals.gram == 0) { stramnt = amnt / 1000; } if (BLL.Store.InsertStoreFromClient(typeid, stramnt, DateTime.Now, combotypes.Text) == 0) { return; } BLL.ClientDeal.InsertClientDeal(0, typeid, manid, amnt, clprc, amnt * clprc, det, TheUnito, tppp.BusinessPrice, combocompany.Text, combotypes.Text); BLL.Client clo = BLL.Client.GetClientByID(manid); clo.Balance += ((amnt * clprc) - PaidMoney); clo.UpdateClient(); //print if (Globals.Globals.PrintWhenSell) { try { List <BLL.ClientDeal> curclnoo = new List <BLL.ClientDeal>(); BLL.ClientDeal cr = new ClientDeal(0, typeid, manid, amnt, clprc, amnt * clprc, det, MyDateTime.Now, TheUnito, tppp.BusinessPrice, combocompany.Text, combotypes.Text); curclnoo.Add(cr); dataGridView1.DataSource = curclnoo; if ((int)combocompany.SelectedValue != Globals.Globals.UnknownClient) { Globals.Globals.PrintNow(dataGridView1, @"السيد المحترم " + combocompany.Text, " المدفوع " + PaidMoney.ToString() + " ل.س " + Environment.NewLine + " الباقي " + ((amnt * clprc) - PaidMoney).ToString() + " ل.س " + Environment.NewLine + string.Format("المجموع {0} ل.س ", (amnt * clprc).ToString()), true); } else { Globals.Globals.PrintNow(dataGridView1, @"بتوقيت:", string.Format("المجموع {0} ل.س ", ((amnt * clprc).ToString())), true); } } catch { } } //end print BLL.BllGlobal.UpdateAllClients(); if (txtpaidmny.Text.Length > 0) { if (double.Parse(handclnt.Text) > PaidMoney) { MessageBox.Show(" الباقي للزبون " + (double.Parse(handclnt.Text) - PaidMoney).ToString() + " ل.س "); } } dataGridView1.DataSource = BLL.ClientDeal.GetAllClientDeal(); } btnnew_Click(sender, e); } catch { SelectTheEmptyText(this.groupBox1); } }
public static bool UpdateType(int id, string name, double businessprice, double clientprice, double businessclientprice, TheUnito theUnit, string baracode) { TypeDetails tb1 = new TypeDetails(id, name, businessprice, clientprice, businessclientprice, MyDateTime.Now, "", theUnit, baracode); bool x = myRealProvider.UpdateType(tb1); BllGlobal.UpdateAllType(); return(x); }
public Types(int id, string name, double businessprice, double clientprice, double businessclientPrice, MyDateTime addedDate, TheUnito theUnit, string baracode) : base(id, name, businessprice, clientprice, businessclientPrice, addedDate, "", theUnit, baracode) { }
public static bool UpdateType(int id, string name, double businessprice, double clientprice, double businessclientprice, string allCompanyId, TheUnito theUnit, string baracode) { TypeDetails tb1 = new TypeDetails(id, name, businessprice, clientprice, businessclientprice, MyDateTime.Now, allCompanyId, theUnit, baracode); bool x = myRealProvider.UpdateTypebyallcomp(tb1); return(x); }
public static int InsertClientDeal(int id, int typeid, int clid, double amount, double price, double paidmoney, string details, TheUnito theUnit, double busprice, string clname, string typename, bool opencon) { ClientDealDetails tb1 = new ClientDealDetails(id, typeid, clid, amount, price, paidmoney, details, new MyDateTime(DateTime.Now), theUnit, busprice, clname, typename); return(myRealProvider.InsertClientDeal(tb1, opencon)); }
public static int InsertClientDeal(int id, int typeid, int clid, double amount, double price, double paidmoney, string details, MyDateTime dayandtime, TheUnito theUnit, double busprice, string clname, string typename) { ClientDealDetails tb1 = new ClientDealDetails(id, typeid, clid, amount, price, paidmoney, details, dayandtime, theUnit, busprice, clname, typename); return(myRealProvider.InsertClientDeal(tb1)); }
internal static object Delete(int idtype, TheUnito unet, double clpric) { _Price -= clpric; MyDelete(idtype, unet); return(all); }
public ClientDeal(int id, int typeid, int clientid, double amount, double price, double paidmoney, string details, MyDateTime addeddate, TheUnito theUnit, double businessprice, string clientname, string typename) : base(id, typeid, clientid, amount, price, paidmoney, details, addeddate, theUnit, businessprice, clientname, typename) { }
private void btnaction_Click(object sender, EventArgs e) { if (combotypes.SelectedIndex == -1 || combocompany.SelectedIndex == -1) { MessageBox.Show("الرجاء تحديد الزبون و الصنف", "خطأ ادخال بيانات", MessageBoxButtons.OK); return; } if (txtamount.Text == "0" || (string.IsNullOrEmpty(txtamount.Text))) { MessageBox.Show("الرجاء تحديد الكمية ", "خطأ ادخال بيانات", MessageBoxButtons.OK); return; } TheUnito TheUnito = TheUnito.Kilo; TheUnito = (TheUnito)Enum.Parse(typeof(TheUnito), Globals.Globals.gram.ToString()); BLL.Types tp = (BLL.Types)combotypes.SelectedItem; // double stramnt = 0; stramnt = double.Parse(txtamount.Text); if (tp.TheUnit == TheUnito.Gram) { stramnt = double.Parse(txtamount.Text) / 1000; } BLL.Store teststore = BLL.Store.GetStoreByTypeID(tp.ID); if (teststore != null) { ///MessageBox.Show(teststore.Amount.ToString() + " " + stramnt.ToString()); if ((teststore.Amount < stramnt)) { MessageBox.Show(" لا تتوفر هذه الكمية من الصنف " + tp.Name, "الكميات المتوفرة-المخزن", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } else { MessageBox.Show(" صنف غير موجود بالمخزن" + tp.Name, "الكميات المتوفرة-المخزن", MessageBoxButtons.OK, MessageBoxIcon.Information); } // TheUnito = (TheUnito)Enum.Parse(typeof(TheUnito), Globals.Globals.gram.ToString()); BLL.ClientDeal cl = new WeightsOrganizer.BLL.ClientDeal(0, (int)combotypes.SelectedValue, (int)combocompany.SelectedValue, double.Parse(txtamount.Text), (radioButton2.Checked ? tp.ClientPrice : tp.BusinessClientPrice), 0, "مجموعة", MyDateTime.Now, TheUnito, tp.BusinessPrice, combocompany.Text, combotypes.Text); List <BLL.ClientDeal> allz = new List <WeightsOrganizer.BLL.ClientDeal>(); allz = alloo; bool s = false; if (allz.Count > 0) { foreach (BLL.ClientDeal bd in allz) { if ((bd.TypeId == cl.TypeId) && (bd.TheUnit == cl.TheUnit)) { bd.Amount += cl.Amount; s = false; break; } else { s = true; } } if (s) { alloo.Add(cl); } } else { alloo.Add(cl); } ALlPrice += cl.ToTalPrice; numbertextbox1.Text = ALlPrice.ToString(); numbertextbox2.Text = ALlPrice.ToString(); txtamount.Text = ""; combotypes.SelectedIndex = -1; combotypes.Text = "اختر صنف.. "; combotypes.SelectAll(); txtamount.Text = "1"; dataGridView1.DataSource = new object(); dataGridView1.DataSource = alloo; combocompany.Enabled = false; checkBox1.Enabled = false; groupBox3.Enabled = false; label2.Text = "السعر"; }
public TypeDetails(int id, string name, double businessprice, double clientprice, double businessclientprice, MyDateTime addeddate, string allCompanyId, TheUnito theUnit, string baracode) : base(id, name, "type", addeddate) { this.BusinessPrice = businessprice; this.ClientPrice = clientprice; this.BusinessClientPrice = businessclientprice; this.AllCompanyId = allCompanyId; this.TheUnit = theUnit; this.BaraCode = baracode; }