public override void setTableLayoutSizes(TableLayoutPanel tableLayout) { ProductStyles product = Overcuts.product; int columnIndex = 0; tableLayout.Controls.Add(new Label() { Text = product.getStyleCode(), Dock = DockStyle.Fill, Anchor = AnchorStyles.None, TextAlign = ContentAlignment.MiddleCenter }, columnIndex++, row); tableLayout.Controls.Add(new Label() { Text = product.getColorCode(), Dock = DockStyle.Fill, Anchor = AnchorStyles.None, TextAlign = ContentAlignment.MiddleCenter }, columnIndex++, row); foreach (KeyValuePair <string, string> productSize in product.getStyleSizes()) { int sizeQty = 0; this.qtySoldPerSize.TryGetValue(productSize.Value.ToUpper(), out sizeQty); tableLayout.Controls.Add(new Label() { Text = sizeQty.ToString(), Dock = DockStyle.Fill, Anchor = AnchorStyles.None, TextAlign = ContentAlignment.MiddleCenter }, columnIndex++, row); } tableLayout.Controls.Add(new Label() { Text = this.totalUnits.ToString(), Dock = DockStyle.Fill, Anchor = AnchorStyles.None, TextAlign = ContentAlignment.MiddleCenter }, columnIndex, row); }
public override void setTableLayoutEstimateSizes(TableLayoutPanel tableLayout) { int desiredQuantity = Overcuts.product.getDesiredQuantity(); ProductStyles product = Overcuts.product; int columnIndex = 0; tableLayout.Controls.Add(new Label() { Text = "Estimation", Dock = DockStyle.Fill, Anchor = AnchorStyles.None, TextAlign = ContentAlignment.MiddleCenter }, columnIndex++, row); tableLayout.Controls.Add(new Label() { Text = "" }, columnIndex++, row); foreach (KeyValuePair <string, string> productSize in product.getStyleSizes()) { int sizeQty = 0; this.qtySoldPerSize.TryGetValue(productSize.Value.ToUpper(), out sizeQty); double percentage = 0; if (this.totalUnits > 0) { percentage = (double)sizeQty / (double)this.totalUnits; } int estimatedSizeQuantity = (int)(percentage * (double)desiredQuantity); tableLayout.Controls.Add(new Label() { Text = estimatedSizeQuantity.ToString(), Dock = DockStyle.Fill, Anchor = AnchorStyles.None, TextAlign = ContentAlignment.MiddleCenter }, columnIndex++, row); } tableLayout.Controls.Add(new Label() { Text = desiredQuantity.ToString(), Dock = DockStyle.Fill, Anchor = AnchorStyles.None, TextAlign = ContentAlignment.MiddleCenter }, columnIndex, row); }
public void combineTotals() { ProductStyles product = Overcuts.product; overcutvalues["PRODUCTCODE"] = product.getStyleCode(); overcutvalues["COLORCODE"] = product.getColorCode(); foreach (KeyValuePair <string, string> productSize in product.getStyleSizes()) { int sizeQtyRetail = 0; retail.qtySoldPerSize.TryGetValue(productSize.Value.ToUpper(), out sizeQtyRetail); int sizeQtyEcomm = 0; ecomm.unitsBySize.TryGetValue(productSize.Key.ToUpper(), out sizeQtyEcomm); int sizeQtyTotal = sizeQtyEcomm + sizeQtyRetail; this.unitsBySize[productSize.Key.ToUpper()] = sizeQtyTotal; overcutvalues[productSize.Key.ToUpper()] = sizeQtyTotal.ToString(); } this.totalUnits = retail.getTotalUnits() + ecomm.getTotalUnits(); overcutvalues["UNITSTOTAL"] = this.totalUnits.ToString(); }