private void setReceiverDepotCard() { this.BarcodeLbl.Text = this.product.Barcode; this.descriptionLbl.Text = this.product.Description; this.brandLbl.Text = this.product.Brand; costLbl.Text = "$" + product.RetailCost.ToString("n2"); piecesPerCaseLbl.Text = product.PiecesPerCase.ToString() + " piezas por caja"; if (this.product.Image != null) { Image image = Image.FromStream((Stream) new MemoryStream(this.product.Image, 0, this.product.Image.Length)); this.productPicture.SizeMode = PictureBoxSizeMode.StretchImage; this.productPicture.Image = image; this.productPicture.BorderStyle = BorderStyle.None; this.label4.Visible = false; panel4.BackColor = Color.Transparent; } else { this.label4.Visible = true; this.productPicture.Image = (Image)null; this.productPicture.BorderStyle = BorderStyle.FixedSingle; panel4.BackColor = Color.FromArgb(196, 196, 196); } var stock = Producto.getCasesAndSingleProducts(product, receiverDepot.getProductQuantity(product.Barcode)); this.quantityLbl.Text = stock.Item1.ToString() + " Cajas"; quantityPcsLbl.Text = stock.Item2.ToString() + " Piezas"; this.addedPiecesLbl.Visible = false; addedPiecesLbl.Text = " 0 piezas"; }
private void setDonatingDepotCard() { var productQuantity = getCasesAndSingleProducts(product.PiecesPerCase, donatingDepot.getProductQuantity(product.Barcode)); boxQuantLbl.Text = productQuantity.Item1 != 1 ? productQuantity.Item1.ToString() + " Cajas" : productQuantity.Item1.ToString() + " Caja"; pieceQuantLbl.Text = productQuantity.Item2 != 1 ? productQuantity.Item2.ToString() + " Piezas" : productQuantity.Item2.ToString() + " Piezas"; label7.Text = "0 piezas"; label7.Visible = false; }
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(); }