public BackRealize(DataSetTpos.productRow productRow, DataSetTpos.backfakturaRow faktRow) { prRow = productRow; fkRow = faktRow; InitializeComponent(); DataView dv = new DataView(DBclass.DS.provider); dv.RowFilter = "providerId = " + fkRow.providerId.ToString(); providerLbl.Text = dv[0]["orgName"].ToString(); tbxPack.isFloat = true; tbxName.Text = productRow.name; tbxPack.Text = 1.ToString(); pack = productRow.pack; tbxPricePrixod.Text = "0"; tbxShtrix.Text = productRow.barcode; if (productRow.barcode != null) { tbxShtrix.Text = productRow.barcode; } this.DialogResult = System.Windows.Forms.DialogResult.Cancel; if (productRow.pack == 0 || productRow.pack == 1) { tbxKol.Visible = false; lblKol.Visible = false; } }
public OrderForm(DataSetTpos.productRow prrow) { count = prrow.pack; if (prrow.measureId == 1) { kg = true; } prrow.price = getPrice(prrow.productId); InitializeComponent(); //lblOne.Visible = false; lblOne.Text = prrow.price.ToString(); lblCaption.Text = prrow.name; lblPrice.Text = (Math.Round(prrow.price * prrow.pack, 0)).ToString(); bal = getSold(prrow.productId); tbxCount1.Text = (count != 0 ? count : 1).ToString(); //float f = prrow.pack - (int)prrow.pack; //if (f > 0) prrow.pack = 1; if (Program.window_type == 2) { button1_Click(button1, new EventArgs()); } }
public AddRealize(DataSetTpos.realizeRow rlzRow, DataSetTpos.realizeviewRow rlvRow, DataSetTpos.productRow productRow) { prRow = productRow; //prRow = productRow; //fkRow = faktRow; isEdit = true; InitializeComponent(); string sum = "0"; if (DBclass.DS.balanceview.Rows.Count > 0) { DataRow[] blncs = DBclass.DS.balanceview.Select("prodId = " + rlvRow.productId); if (blncs.Length > 0) { sum = ((DataSetTpos.balanceviewRow)blncs[0]).endCount; } } btnAdd.Text = "Изменить"; lblSoldPrice.Visible = true; tbxSoldPrice.Visible = true; lblAllCount.Text = sum; DataView dv = new DataView(DBclass.DS.provider); dv.RowFilter = "providerId = " + rlvRow.providerId.ToString(); providerLbl.Text = dv[0]["orgName"].ToString(); tbxPack.isFloat = true; tbxName.Text = rlvRow.name; tbxPack.Text = 1.ToString(); pack = float.Parse(rlvRow.count); tbxPricePrixod.Text = rlzRow.price.ToString(); tbxShtrix.Text = rlvRow.barcode; //tbxSoldPrice.Text = productRow.price.ToString(); DataSetTposTableAdapters.realizeviewTableAdapter rlvda = new DataSetTposTableAdapters.realizeviewTableAdapter(); DataSetTpos.realizeviewDataTable tablerlv = new DataSetTpos.realizeviewDataTable(); rlvda.FillByID(tablerlv, rlvRow.productId); tbxPricePrixod.Text = (tablerlv.Rows.Count > 0 ? (tablerlv.Rows[0] as DataSetTpos.realizeviewRow).fakturaPrice.ToString() : "0"); if (rlvRow.barcode != null) { tbxShtrix.Text = rlvRow.barcode; } this.DialogResult = System.Windows.Forms.DialogResult.Cancel; tbxKol.Text = rlzRow.count.ToString(); tbxPack.Enabled = false; tbxPricePrixod.Enabled = false; rlviewRow = rlvRow; rlRow = rlzRow; }
public KolForm(DataSetTpos.productRow prrow) { InitializeComponent(); lblCaption.Text = prrow.name; if (prrow.measureId != 2) { tbxCount1.isFloat = true; kg = true; } }
public packing(DataSetTpos.productRow productRow) { InitializeComponent(); measure = productRow.measureId; tbxName.Text = productRow.name; tbxShtrix.Text = productRow.barcode; lblPrice.Text = productRow.price.ToString(); id = productRow.productId; Renderer = typeof(BitmapRenderer); tbxPack.Focus(); }
public AddForm(DataSetTpos.productRow productRow) { prRow = productRow; isAdd = false; InitializeComponent(); CheckRole(); providerTableAdapter1.Fill(DBclass.DS.provider); DataView dv = new DataView(DBclass.DS.provider); dv.RowFilter = ""; prCmbx.DataSource = DBclass.DS.provider; prCmbx.DisplayMember = "orgName"; prCmbx.ValueMember = "providerId"; if (!isAdd) { lblCaption.Text = "Редактировать товар"; btnAdd.Text = "Изменить"; button1.Visible = true; } if (productRow.measureId == 2) { measureRadio.Checked = true; } if (productRow.measureId == 1) { measureRadio2.Checked = true; } if (prCmbx.Items.Count > 0) { prCmbx.SelectedValue = productRow.providerId; } DataSetTposTableAdapters.realizeTableAdapter rda = new DataSetTposTableAdapters.realizeTableAdapter(); if (prCmbx.Items.Count > 0) { object providerID = rda.LastProvider(prRow.productId); if (providerID != null) { prCmbx.SelectedValue = providerID; } } tbxName.Text = productRow.name; tbxPack.Text = productRow.pack.ToString(); tbxPrice.Text = productRow.price.ToString(); tbxShtrix.Text = productRow.barcode; if (productRow.barcode != null) { tbxShtrix.Text = productRow.barcode; } this.DialogResult = System.Windows.Forms.DialogResult.Cancel; Renderer = typeof(BitmapRenderer); }
private void select_for_product(object sender, DataGridViewCellEventArgs e) { var dgv = sender as DataGridView; DataSetTpos.productRow dr = DBclass.DS.product.FindByproductId((int)dgv.Rows[e.RowIndex].Cells["productId"].Value); if (dr != null) { prodName = dr.name; id = dr.productId.ToString(); this.DialogResult = DialogResult.OK; } this.Close(); }
private void AddOrEdit(object sender, EventArgs e) { if (!string.IsNullOrEmpty(tbxName.Text)) { this.DialogResult = System.Windows.Forms.DialogResult.OK; DataSetTposTableAdapters.productTableAdapter daProduct = new DataSetTposTableAdapters.productTableAdapter(); if (isAdd) { DataSetTpos.productRow prRowN = DBclass.DS.product.NewproductRow(); prRowN.name = tbxName.Text; prRowN.barcode = tbxShtrix.Text; prRowN.measureId = 2; prRowN.pack = tbxPack.Text != "0" && tbxPack.Text != ""?Convert.ToInt32(tbxPack.Text):0; prRowN.status = 0; prRowN.price = Convert.ToInt32(tbxPrice.Text); DBclass.DS.product.AddproductRow(prRowN); daProduct.Update(prRowN); daProduct.Fill(DBclass.DS.product); int?lId = daProduct.LastID(); if (lId != null && tbxShtrix.Text == "") { int id = lId.Value; DataSetTpos.productRow pr = DBclass.DS.product.FindByproductId(id); string barcode = randNumbers(id); pr.barcode = barcode; pr.status = 1; daProduct.Update(pr); } } else { prRow.name = tbxName.Text; prRow.barcode = tbxShtrix.Text; prRow.measureId = 2; prRow.pack = tbxPack.Text != "0" && tbxPack.Text != "" ? Convert.ToInt32(tbxPack.Text) : 0;; prRow.price = Convert.ToInt32(tbxPrice.Text); daProduct.Update(DBclass.DS.product); daProduct.Fill(DBclass.DS.product); } } }
public AddForm(DataSetTpos.productRow productRow) { prRow = productRow; isAdd = false; InitializeComponent(); if (!isAdd) { lblCaption.Text = "Редактировать товар"; btnAdd.Text = "Изменить"; } tbxName.Text = productRow.name; tbxPack.Text = productRow.pack.ToString(); tbxPrice.Text = productRow.price.ToString(); tbxShtrix.Text = productRow.barcode; if (productRow.barcode != null) { tbxShtrix.Text = productRow.barcode; } this.DialogResult = System.Windows.Forms.DialogResult.Cancel; }
public AddRealize(DataSetTpos.productRow productRow, DataSetTpos.fakturaRow faktRow) { prRow = productRow; fkRow = faktRow; InitializeComponent(); tbxName.Text = productRow.name; tbxPack.Text = 1.ToString(); pack = productRow.pack; //tbxPricePrixod.Text = productRow.price.ToString(); tbxShtrix.Text = productRow.barcode; if (productRow.barcode != null) { tbxShtrix.Text = productRow.barcode; } this.DialogResult = System.Windows.Forms.DialogResult.Cancel; if (productRow.pack == 0 || productRow.pack == 1) { tbxKol.Visible = false; lblKol.Visible = false; } }
public bool AddProduct(DataRow[] dr, bool isBarcode, string barcode) { bool next = false; float kg = -1; if (isBarcode && dr.Length == 0) { //object[] obj = getProductWithMassa(barcode); //dr = (DataRow[])obj[0]; //kg = (float)obj[1]; dr = getProductWithMassa(barcode); } if (dr.Length != 0) { DataSetTpos.productRow drP = (DataSetTpos.productRow)dr[0]; DataRow[] existRows = DBclass.DS.orders.Select("expenseId=-1 and prodId = " + drP.productId); if (existRows.Length > 0) { DataSetTpos.ordersRow ordrow = (DataSetTpos.ordersRow)existRows[0]; ordrow.packCount = ordrow.packCount + (drP.pack == 0 ? 1 : drP.pack); DataRow drOrder = ordrow; drOrder["sumProduct"] = ordrow.packCount * drP.price / (drP.pack == 0 ? 1 : drP.pack);//ordrow.AcceptChanges(); } else { DataSetTpos.ordersRow ordrow = DBclass.DS.orders.NewordersRow(); ordrow.prodId = drP.productId; if (drP.pack == 0) { drP.pack = 1; } ordrow.expenseId = -1; int curPrice = drP.price; OrderForm oform = new OrderForm(drP); System.Windows.Forms.DialogResult result = oform.ShowDialog(); if (result == System.Windows.Forms.DialogResult.OK) { ordrow.packCount = (float)oform.count; DataRow drOrder = ordrow; drOrder["sumProduct"] = oform.sum;//ordrow.packCount * drP.price / (drP.pack == 0 ? 1 : drP.pack); ordrow.orderSumm = Convert.ToSingle(drOrder["sumProduct"]); //grid.Rows[e.RowIndex].Cells["sumProduct"].Value = (Convert.ToInt32(grid.Rows[e.RowIndex].Cells["packCount"].Value) * Convert.ToInt32(grid.Rows[e.RowIndex].Cells["productPrice"].Value)).ToString(); } else if (result == System.Windows.Forms.DialogResult.Cancel) { //ordrow.RejectChanges(); drP.RejectChanges(); return(false); } else { if (drP.price == 0) { System.Windows.Forms.MessageBox.Show("Товар на складе отсутствует"); drP.RejectChanges(); } return(false); } DBclass.DS.orders.AddordersRow(ordrow); if (curPrice != drP.price && drP.price != 0) { productTableAdapter prda = new productTableAdapter(); prda.Update(drP); return(true); } } if (isNewExpense) { //dgvExpense.Columns["productName"].Visible = true; //dgvExpense.Columns["productPrice"].Visible = true; isNewExpense = false; } //sumTable(); } else if (isBarcode && UserValues.role == "admin") { AddForm addForm = new AddForm(barcode); if (addForm.ShowDialog() == System.Windows.Forms.DialogResult.OK) { //productTableAdapter daProduct = new productTableAdapter(); //daProduct.Fill(DBclass.DS.product); } } next = true; return(true); }
private void AddOrEdit(object sender, EventArgs e) { if (!string.IsNullOrEmpty(tbxName.Text)) { this.DialogResult = System.Windows.Forms.DialogResult.OK; DataSetTposTableAdapters.productTableAdapter daProduct = new DataSetTposTableAdapters.productTableAdapter(); if (isAdd) { int rbtn = 2; DataSetTpos.productRow prRowN = DBclass.DS.product.NewproductRow(); prRowN.name = tbxName.Text; prRowN.barcode = tbxShtrix.Text; if (measureRadio.Checked) { rbtn = 2; } else if (measureRadio2.Checked) { rbtn = 1; } else { rbtn = 3; prRowN.extParam = tbxMwidth.Text + "x" + tbxMheight.Text; } prRowN.measureId = rbtn; prRowN.pack = tbxPack.Text != "0" && tbxPack.Text != "" ? Convert.ToInt32(tbxPack.Text) : 0; prRowN.status = 0; prRowN.priceRozn = Convert.ToInt32(tbxRozPrice.Text); if (prCmbx.Text == "") { prRowN.providerId = 1; } else { prRowN.providerId = prCmbx.FindStringExact(prCmbx.Text); } prRowN.price = Convert.ToInt32(tbxPrice.Text); DBclass.DS.product.AddproductRow(prRowN); daProduct.Update(prRowN); daProduct.Fill(DBclass.DS.product); int?lId = daProduct.LastID(); DataSetTposTableAdapters.balanceTableAdapter bAdapetr = new DataSetTposTableAdapters.balanceTableAdapter(); DataSetTpos.balanceRow bRow = DBclass.DS.balance.NewbalanceRow(); bRow.balanceDate = Convert.ToDateTime("2000-01-01"); bRow.prodId = Convert.ToInt32(lId); bRow.endCount = 0; bRow.curEndCount = 0; DBclass.DS.balance.AddbalanceRow(bRow); bAdapetr.Update(bRow); ///Change changeprice if (lId != null && tbxShtrix.Text == "") { int id = lId.Value; DataSetTpos.productRow pr = DBclass.DS.product.FindByproductId(id); string barcode = randNumbers(id); pr.barcode = barcode; pr.status = 1; daProduct.Update(pr); } } else { int rbtn = 2; prRow.name = tbxName.Text; prRow.barcode = tbxShtrix.Text; if (measureRadio.Checked) { rbtn = 2; } else if (measureRadio2.Checked) { rbtn = 1; } else { rbtn = 3; prRow.extParam = tbxMwidth.Text + "x" + tbxMheight.Text; } prRow.providerId = prCmbx.FindStringExact(prCmbx.Text); prRow.measureId = rbtn; prRow.pack = tbxPack.Text != "0" && tbxPack.Text != "" ? Convert.ToInt32(tbxPack.Text) : 0;; prRow.price = Convert.ToSingle(tbxPrice.Text); prRow.priceRozn = Convert.ToInt32(tbxRozPrice.Text); DataSetTposTableAdapters.realizeviewTableAdapter realzvwDa = new DataSetTposTableAdapters.realizeviewTableAdapter(); DataSetTpos.realizeviewDataTable realviewtable = new DataSetTpos.realizeviewDataTable(); realzvwDa.FillByID(realviewtable, prRow.productId); if (realviewtable.Rows.Count > 0) { DataSetTposTableAdapters.changepriceTableAdapter chDa = new DataSetTposTableAdapters.changepriceTableAdapter(); DataSetTpos.changepriceRow changepriceRow = DBclass.DS.changeprice.NewchangepriceRow(); changepriceRow.IDFaktura = (realviewtable.Rows[0] as DataSetTpos.realizeviewRow).fakturaId; changepriceRow.IDProduct = prRow.productId; changepriceRow.DateChange = DateTime.Now.Date; changepriceRow.Price = prRow.price; DBclass.DS.changeprice.AddchangepriceRow(changepriceRow); chDa.Update(changepriceRow); } daProduct.Update(DBclass.DS.product); daProduct.Fill(DBclass.DS.product); } } }
private void AddOrEdit(object sender, EventArgs e) { if (!string.IsNullOrEmpty(tbxName.Text)) { this.DialogResult = System.Windows.Forms.DialogResult.OK; DataSetTposTableAdapters.productTableAdapter daProduct = new DataSetTposTableAdapters.productTableAdapter(); if (isAdd) { int rbtn = 2; DataSetTpos.productRow prRowN = DBclass.DS.product.NewproductRow(); prRowN.name = tbxName.Text; prRowN.barcode = tbxShtrix.Text; if (measureRadio.Checked) { rbtn = 2; //ШТ } else if (measureRadio2.Checked) { rbtn = 1;//КГ } else if (measureRadio3.Checked) { rbtn = 3;//литр } else if (measureRadio4.Checked) { rbtn = 4; //кв.м } prRowN.measureId = rbtn; prRowN.pack = 0;// tbxPack.Text != "0" && tbxPack.Text != "" ? Convert.ToInt32(tbxPack.Text) : 0; prRowN.status = 0; if (prCmbx.Text == "") { prRowN.providerId = 1; } else { prRowN.providerId = prCmbx.FindStringExact(prCmbx.Text); } prRowN.price = Convert.ToInt32(tbxPrice.Text); DBclass.DS.product.AddproductRow(prRowN); if (daProduct.Connection.State == ConnectionState.Closed) { daProduct.Connection.Open(); } using (MySql.Data.MySqlClient.MySqlTransaction transaction = daProduct.Connection.BeginTransaction()) { daProduct.Transaction = transaction; daProduct.Update(prRowN); daProduct.Fill(DBclass.DS.product); int?lId = daProduct.LastID(); DataSetTposTableAdapters.balanceTableAdapter bAdapetr = new DataSetTposTableAdapters.balanceTableAdapter(); DataSetTpos.balanceRow bRow = DBclass.DS.balance.NewbalanceRow(); bRow.balanceDate = Convert.ToDateTime("2000-01-01"); bRow.prodId = Convert.ToInt32(lId); bRow.endCount = 0; bRow.curEndCount = 0; DBclass.DS.balance.AddbalanceRow(bRow); bAdapetr.Connection = daProduct.Connection; bAdapetr.Transaction = transaction; bAdapetr.Update(bRow); transaction.Commit(); if (lId != null && tbxShtrix.Text == "") { int id = lId.Value; DataSetTpos.productRow pr = DBclass.DS.product.FindByproductId(id); string barcode = Generator.barcode_generate(id, 1); pr.barcode = barcode; pr.status = 1; daProduct.Update(pr); } } ///Change changeprice } else { int rbtn = 2; prRow.name = tbxName.Text; prRow.barcode = tbxShtrix.Text; if (measureRadio.Checked) { rbtn = 2; //ШТ } else if (measureRadio2.Checked) { rbtn = 1;//КГ } else if (measureRadio3.Checked) { rbtn = 3;//литр } else if (measureRadio4.Checked) { rbtn = 4; //кв.м } if (prCmbx.Text == "") { prRow.providerId = 1; } else { prRow.providerId = prCmbx.FindStringExact(prCmbx.Text); } prRow.measureId = rbtn; prRow.pack = 0;// tbxPack.Text != "0" && tbxPack.Text != "" ? Convert.ToInt32(tbxPack.Text) : 0; ; prRow.price = Convert.ToInt32(tbxPrice.Text); DataSetTposTableAdapters.realizeviewTableAdapter realzvwDa = new DataSetTposTableAdapters.realizeviewTableAdapter(); DataSetTpos.realizeviewDataTable realviewtable = new DataSetTpos.realizeviewDataTable(); realzvwDa.FillByID(realviewtable, prRow.productId); if (realviewtable.Rows.Count > 0) { DataSetTposTableAdapters.changepriceTableAdapter chDa = new DataSetTposTableAdapters.changepriceTableAdapter(); DataSetTpos.changepriceRow changepriceRow = DBclass.DS.changeprice.NewchangepriceRow(); changepriceRow.IDFaktura = (realviewtable.Rows[0] as DataSetTpos.realizeviewRow).fakturaId; changepriceRow.IDProduct = prRow.productId; changepriceRow.DateChange = DateTime.Now.Date; changepriceRow.Price = prRow.price; DBclass.DS.changeprice.AddchangepriceRow(changepriceRow); chDa.Update(changepriceRow); } daProduct.Update(DBclass.DS.product); daProduct.Fill(DBclass.DS.product); } } }