public PanelProductos_NuevaBodega() { this.InitializeComponent(); this.ShowInTaskbar = false; this.editing = false; this.depot = null; }
public Panel_productos_Transferir_Inventario_entre_bodegas(Producto product) { this.InitializeComponent(); this.DialogResult = DialogResult.Cancel; this.transferCount = 0; this.altered = false; this.product = product; this.ReceiverDepotIDs = new List <int>(); this.DonatingComboDepotsIds = new List <int>(); foreach (DataRow row in Bodega.GetDepots().Rows) { this.receiverCombo.Items.Add(row["Nombre"]); this.ReceiverDepotIDs.Add(Convert.ToInt32(row["ID_Bodega"])); } this.receiverCombo.SelectedItem = new Bodega(product.defaultDepotID).name; this.receiverDepot = new Bodega(product.defaultDepotID); this.setReceiverDepotCard(); ProductTxt.Select(); }
private void showDatagridViewMenu(object sender, DataGridViewCellMouseEventArgs e) { if (e.Button != MouseButtons.Right || e.ColumnIndex <= 2) { return; } ContextMenu contextMenu = new ContextMenu(); contextMenu.MenuItems.Add(new MenuItem("Renombrar")); //contextMenu.MenuItems.Add(new MenuItem("Lista da Productos Faltantes")); contextMenu.MenuItems.Add(new MenuItem(string.Format("Borrar la bodega \"{0}\"", this.dataGridView1.Columns[e.ColumnIndex].HeaderText))); contextMenu.MenuItems.Add(new MenuItem("¿Mostrar la bodega en la busqueda de productos en la pestaña ventas?")); if (e.ColumnIndex == this.dataGridView1.Columns["1"].Index) { contextMenu.MenuItems[1].Enabled = false; contextMenu.MenuItems[2].Enabled = false; } contextMenu.MenuItems[2].Checked = new Bodega(Convert.ToInt32(this.dataGridView1.Columns[e.ColumnIndex].Name)).showInProductSearches; int num1 = 0; for (int index = 0; index < e.ColumnIndex; ++index) { num1 += this.dataGridView1.Columns[index].Width; } contextMenu.Show((Control)this.dataGridView1, new Point(num1 + e.X, e.Y)); contextMenu.MenuItems[1].Click += (EventHandler)((s, ee) => this.deleteDepot(e.ColumnIndex)); contextMenu.MenuItems[0].Click += (EventHandler)((s, ee) => this.editDepot(e.ColumnIndex)); contextMenu.MenuItems[2].Click += (EventHandler)((s, ee) => { Bodega bodega = new Bodega(Convert.ToInt32(this.dataGridView1.Columns[e.ColumnIndex].Name)); bodega.showInProductSearches = !bodega.showInProductSearches; }); }
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { if (this.receiverDepot != null && this.donatingDepot != null) { this.setDonatingDepotCard(); } this.receiverDepot = new Bodega(this.ReceiverDepotIDs[this.receiverCombo.SelectedIndex]); this.setReceiverDepotCard(); var currentDonatingID = donatingDepot != null ? donatingDepot.ID : 0; this.DonatingCombo.Items.Clear(); this.DonatingComboDepotsIds = new List <int>(); for (int index = 0; index < this.receiverCombo.Items.Count; ++index) { if (index != this.receiverCombo.SelectedIndex) { this.DonatingCombo.Items.Add((object)this.receiverCombo.Items[index].ToString()); this.DonatingComboDepotsIds.Add(this.ReceiverDepotIDs[index]); } } currentDonatingID = DonatingComboDepotsIds.IndexOf(currentDonatingID); this.DonatingCombo.SelectedIndex = currentDonatingID > -1 ? currentDonatingID : 0; simulateTransfer(); }
private void createDepot() { if (this.DepotTxt.Text != "") { foreach (DataRow row in Bodega.GetDepots().Rows) { if (row["Nombre"].ToString().ToLower() == this.DepotTxt.Text.ToLower()) { MessageBox.Show("Ya existe una bodega con este nombre."); this.DepotTxt.Text += " Nuevo"; this.DepotTxt.Select(); return; } } Bodega bodega = new Bodega(Bodega.newDepot(this.DepotTxt.Text)); this.DialogResult = DialogResult.OK; this.Close(); } else if (this.DepotLbl.Visible) { this.errorProvider1.SetError(DepotLbl, "Ingrese el nombre de la bodega"); } else { this.DepotTxt.HintForeColor = Color.Tomato; this.DepotTxt.LineIdleColor = Color.Tomato; } }
public PanelProductos_NuevaBodega(int depotID) { this.InitializeComponent(); this.ShowInTaskbar = false; this.editing = true; this.depot = new Bodega(depotID); this.DepotTxt.Text = this.depot.name; }
public Panel_productos_Faltantes_Bodega(int depotID) { this.InitializeComponent(); this.depot = new Bodega(depotID); this.dataGrid1.RowsDefaultCellStyle.WrapMode = DataGridViewTriState.True; this.dataGrid1.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCellsExceptHeaders; this.printer = new PrinterTicket(); this.printDialog1.PrinterSettings.PrinterName = this.printer.printerName; }
private void ConfirmBtn_Click(object sender, EventArgs e) { dataGridView1.EndEdit(); foreach (DataGridViewRow row in this.dataGridView1.Rows) { if (row.DefaultCellStyle.ForeColor.ToKnownColor() == Color.FromArgb(0, 0, 0, 0).ToKnownColor()) { MessageBox.Show("Aún quedan artículos sin revisar"); dataGridView1.CurrentCell = row.Cells["Cantidad"]; dataGridView1.BeginEdit(true); return; } } Form_Login formLogin = new Form_Login(string.Format("Verificación De\nUsuario")); DarkForm darkForm = new DarkForm(); darkForm.Show(); if (formLogin.ShowDialog() == DialogResult.OK) { foreach (DataGridViewRow row in this.dataGridView1.Rows) { if (row.DefaultCellStyle.ForeColor == Color.LimeGreen || row.DefaultCellStyle.ForeColor == Color.Tomato) { int correspondingIndex = this.getCorrespondingIndex(row.Index); if (correspondingIndex > -1 && row.Cells["Cantidad"].Value != this.PO._products.Rows[correspondingIndex]["Cantidad"]) { Producto producto = new Producto(row.Cells["Código de Barras"].Value.ToString()); double num = (Convert.ToDouble(row.Cells["Cantidad"].Value) - Convert.ToDouble(this.PO._products.Rows[correspondingIndex]["Cantidad"])) * Convert.ToDouble(row.Cells["Piezas por Caja"].Value); if (num != 0.0) { Bodega depot = new Bodega(producto.defaultDepotID); depot.UpdateProductQuantity(depot.getProductQuantity(producto.Barcode) + num, producto.Barcode); this.PO.UpdateProductQunantity(producto.Barcode, Convert.ToDouble(row.Cells["Cantidad"].Value)); } } } } this.PO.delivered = true; this.PO._EmployeeWhoConfirmedThePurchaseID = formLogin.ID; this.PO.updateDeliveryStatus(); this.updateValues(); this.PO = new OrdenCompra(this.PO.ID); if (inASearch) { searchPO(); } else { this.loadPurchases(); } } darkForm.Close(); }
private void deleteDepot(int columnIndex) { if (MessageBox.Show("¿Desea Eliminar la Bodega \"" + this.dataGridView1.Columns[columnIndex].HeaderText + "\"?. \nLos productos almacenados serán transferidos a sus respectivas bodegas por defecto.\n\nNota: En caso de que la bodega por defecto se esté eliminando, los productos se transferiran a la bodega \"" + this.dataGridView1.Columns[3].HeaderText + "\"", "Borrar Bodega", MessageBoxButtons.YesNo) != DialogResult.Yes) { return; } new Bodega(Convert.ToInt32(this.dataGridView1.Columns[columnIndex].Name)).Delete(); this.dataGridView1.DataSource = Bodega.getInventory(); this.FitTableInformation(); this.dataGridView1.CurrentCell = this.dataGridView1.RowCount > 0 ? this.dataGridView1.Rows[this.selectedrow].Cells[0] : (DataGridViewCell)null; }
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { if (this.product == null || this.depot == null) { return; } this.scrapCount = 0.0; this.scrapLbl.Visible = false; this.depot = new Bodega(this.depotList[this.comboBox1.SelectedItem.ToString()]); this.setProduct(); }
private void dataGrid1_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == dataGrid1.Columns["Imprimir"].Index) { var cell = (dataGrid1[e.ColumnIndex, e.RowIndex] as DataGridViewCheckBoxCell); cell.Value = Convert.ToBoolean(dataGrid1[e.ColumnIndex, e.RowIndex].Value) == true ? cell.FalseValue : cell.TrueValue; Bodega.updateProductCheckStatus(depot.ID, dataGrid1.Rows[e.RowIndex].Cells["id_producto"].Value.ToString()); dataGrid1.EndEdit(); } }
private void ToCombo_SelectedIndexChanged(object sender, EventArgs e) { this.donatingDepot = new Bodega(this.DonatingComboDepotsIds[this.DonatingCombo.SelectedIndex]); if (this.donatingDepot == null || this.receiverDepot == null) { return; } addedPiecesLbl.Hide(); setDonatingDepotCard(); simulateTransfer(); }
private void getDepots() { DataTable depots = Bodega.GetDepots(); this.depotID = new int[depots.Rows.Count]; for (int index = 0; index < depots.Rows.Count; ++index) { DataRow row = depots.Rows[index]; this.comboBox1.Items.Add(row["Nombre"]); this.depotID[index] = Convert.ToInt32(row["ID_Bodega"]); } this.comboBox1.SelectedIndex = 0; }
private void editDepot(int columnIndex) { PanelProductos_NuevaBodega productosNuevaBodega = new PanelProductos_NuevaBodega(Convert.ToInt32(this.dataGridView1.Columns[columnIndex].Name)); DarkForm darkForm = new DarkForm(); darkForm.Show(); if (productosNuevaBodega.ShowDialog() == DialogResult.OK) { this.dataGridView1.DataSource = Bodega.getInventory(SearchTxt.Text); this.FitTableInformation(); this.dataGridView1.CurrentCell = this.dataGridView1.RowCount > 0 ? this.dataGridView1.Rows[this.selectedrow].Cells[0] : (DataGridViewCell)null; } darkForm.Close(); }
public static int newDepot(string name) { if (!(name != "")) { return(-1); } foreach (DataRow row in Bodega.GetDepots().Rows) { if (row["Nombre"].ToString().ToLower() == name.ToLower()) { MessageBox.Show("No se creó la bodega."); return(-1); } } return(new Capa_de_Negocio().DepotNewDepot(name)); }
private void OkBtn_Click(object sender, EventArgs e) { if (this.scrapCount == 0.0) { return; } this.depot.RegisterScrap(this.product.Barcode, this.scrapCount, this.employeeID); MessageBox.Show("Se ha dado de baja el material"); textBox1.Text = "0.00"; this.scrapRegistered = true; this.scrapCount = 0.0; this.scrapLbl.Hide(); this.depot = new Bodega(this.depot.ID); this.setProduct(); }
private async void loadtable(string text) { this.Cursor = Cursors.WaitCursor; dataGridView1.DataSource = null; dataGridView1.DataSource = await Task.Run(() => Bodega.getInventory(text)); Cursor = Cursors.Default; if (this.dataGridView1.RowCount <= 0) { return; } this.dataGridView1.FirstDisplayedCell = this.dataGridView1.Rows[0].Cells[0]; CellFormatting(); }
private void editDepot() { foreach (DataRow row in (InternalDataCollectionBase)Bodega.GetDepots().Rows) { if (row["Nombre"].ToString().ToLower() == this.DepotTxt.Text.ToLower() && this.depot.ID != Convert.ToInt32(row["ID_Bodega"])) { MessageBox.Show("Ya existe una bodega con este nombre."); this.DepotTxt.Text += " Nuevo"; this.DepotTxt.Select(); return; } } if (this.DepotTxt.Text.ToLower() != this.depot.name.ToLower()) { this.depot.name = this.DepotTxt.Text; this.depot.Rename(); } }
public PanelProducto_Scrap() { this.InitializeComponent(); this.ShowInTaskbar = false; this.product = (Producto)null; this.depot = (Bodega)null; this.Size = this.minimized; this.scrapCount = 0.0; this.depotList = new Dictionary <string, int>(); foreach (DataRow row in (InternalDataCollectionBase)Bodega.GetDepots().Rows) { this.comboBox1.Items.Add((object)row["Nombre"].ToString()); this.depotList.Add(row["Nombre"].ToString(), Convert.ToInt32(row["ID_Bodega"])); } textBox1.SelectAll(); this.comboBox1.SelectedIndex = 0; this.depot = new Bodega(1); this.Refresh(); }
private void dataGridView1_CellMouseClick_1(object sender, DataGridViewCellMouseEventArgs e) { if (e.Button != MouseButtons.Right || e.RowIndex < 0 || e.ColumnIndex <= 2) { return; } ContextMenu contextMenu = new ContextMenu(); contextMenu.MenuItems.Add(new MenuItem("Modificar Stock")); int num1 = 0; int columnHeadersHeight = this.dataGridView1.ColumnHeadersHeight; for (int index = 0; index < e.ColumnIndex; ++index) { num1 += this.dataGridView1.Columns[index].Width; } for (int rowIndex = this.dataGridView1.FirstDisplayedCell.RowIndex; rowIndex < e.RowIndex; ++rowIndex) { columnHeadersHeight += this.dataGridView1.Rows[rowIndex].Height; } contextMenu.Show((Control)this.dataGridView1, new Point(num1 + e.X, columnHeadersHeight + e.Y)); contextMenu.MenuItems[0].Click += (EventHandler)((s, ee) => { if (new Producto(dataGridView1.Rows[e.RowIndex].Cells["código de barras"].Value.ToString()).mainProductBarcode == "") { this.dataGridView1.ReadOnly = false; this.dataGridView1.CurrentCell = this.dataGridView1[e.ColumnIndex, e.RowIndex]; this.editingCell = false; Bodega depot = new Bodega(Convert.ToInt32(this.dataGridView1.CurrentCell.OwningColumn.Name)); this.dataGridView1.EditingControlShowing += new DataGridViewEditingControlShowingEventHandler(this.dataGridView1_EditingControlShowing); string currentValue = ""; this.dataGridView1.CellBeginEdit += ((sss, eee) => { if (this.editingCell) { return; } this.editingCell = true; currentValue = this.dataGridView1.CurrentCell.Value.ToString(); this.dataGridView1.CurrentCell.Value = new Bodega(Convert.ToInt32(this.dataGridView1.CurrentCell.OwningColumn.Name)). getProductQuantity(this.dataGridView1.Rows[eee.RowIndex].Cells["Código de Barras"].Value.ToString()); var product = new Producto(this.dataGridView1.Rows[eee.RowIndex].Cells["Código de Barras"].Value.ToString()); var ChildTable = product.getDerivedProductsList(); if (ChildTable.Rows.Count > 0) { showHelpPanel(product, ChildTable, Convert.ToInt32(this.dataGridView1.CurrentCell.OwningColumn.Name)); } }); this.dataGridView1.BeginEdit(true); this.dataGridView1.CellEndEdit += (DataGridViewCellEventHandler)((ss, eee) => { if (this.dataGridView1.ReadOnly) { return; } this.dataGridView1.EditingControlShowing -= new DataGridViewEditingControlShowingEventHandler(this.dataGridView1_EditingControlShowing); try { Producto producto1 = new Producto(this.dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells["Código de Barras"].Value.ToString()); double newQuantity = Convert.ToDouble(this.dataGridView1.CurrentCell.Value); this.dataGridView1.CurrentCell.Value = (object)string.Format("{0} {1},\n{2} {3}", (object)Math.Truncate(newQuantity / producto1.PiecesPerCase), Math.Truncate(newQuantity / producto1.PiecesPerCase) == 1.0 ? (object)"caja" : (object)"cajas", (object)(newQuantity % producto1.PiecesPerCase), newQuantity % producto1.PiecesPerCase == 1.0 ? (object)"pieza" : (object)"piezas"); new Bodega(Convert.ToInt32(this.dataGridView1.CurrentCell.OwningColumn.Name)).UpdateProductQuantity(newQuantity, producto1.Barcode); this.editingCell = false; Producto producto2 = new Producto(producto1.Barcode); this.dataGridView1.CurrentCell.OwningRow.DefaultCellStyle.ForeColor = producto2.CurrentStock >= producto2.minStock ? Color.Black : Color.Tomato; } catch (FormatException) { string str = this.dataGridView1.CurrentCell.Value.ToString(); if (str.ToLower().IndexOf("caja") == -1 && str.ToLower().IndexOf("pieza") == -1) { int num2 = (int)MessageBox.Show("El formato no es válido"); } this.dataGridView1.CurrentCell.Value = (object)currentValue; } catch (InvalidCastException) { this.dataGridView1.CurrentCell.Value = (object)currentValue; } this.dataGridView1.ReadOnly = true; }); } else { MessageBox.Show("Este producto no cuenta con inventario. Para modificarlo busca el producto principal y modifica su stock.\n\n\nEl código de barras del" + " producto principal se copio al portapapeles."); Clipboard.SetText(new Producto(dataGridView1.Rows[e.RowIndex].Cells["código de barras"].Value.ToString()).mainProductBarcode); } }); }