Direct summing
This commit is contained in:
37
StockInfoCore/frmMyStocks.Designer.cs
generated
37
StockInfoCore/frmMyStocks.Designer.cs
generated
@ -59,6 +59,9 @@ namespace StockInfoCore
|
||||
this.label7 = new System.Windows.Forms.Label();
|
||||
this.txtTotalPlus = new System.Windows.Forms.TextBox();
|
||||
this.lblOwnerName = new System.Windows.Forms.Label();
|
||||
this.txtSummaValue = new System.Windows.Forms.TextBox();
|
||||
this.label8 = new System.Windows.Forms.Label();
|
||||
this.label9 = new System.Windows.Forms.Label();
|
||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
@ -332,11 +335,42 @@ namespace StockInfoCore
|
||||
this.lblOwnerName.TabIndex = 16;
|
||||
this.lblOwnerName.Text = "Portfölj Ägare Namn";
|
||||
//
|
||||
// txtSummaValue
|
||||
//
|
||||
this.txtSummaValue.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.txtSummaValue.Location = new System.Drawing.Point(862, 428);
|
||||
this.txtSummaValue.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.txtSummaValue.Name = "txtSummaValue";
|
||||
this.txtSummaValue.ReadOnly = true;
|
||||
this.txtSummaValue.Size = new System.Drawing.Size(114, 27);
|
||||
this.txtSummaValue.TabIndex = 17;
|
||||
//
|
||||
// label8
|
||||
//
|
||||
this.label8.AutoSize = true;
|
||||
this.label8.Location = new System.Drawing.Point(842, 429);
|
||||
this.label8.Name = "label8";
|
||||
this.label8.Size = new System.Drawing.Size(14, 20);
|
||||
this.label8.TabIndex = 18;
|
||||
this.label8.Text = "(";
|
||||
//
|
||||
// label9
|
||||
//
|
||||
this.label9.AutoSize = true;
|
||||
this.label9.Location = new System.Drawing.Point(982, 431);
|
||||
this.label9.Name = "label9";
|
||||
this.label9.Size = new System.Drawing.Size(14, 20);
|
||||
this.label9.TabIndex = 19;
|
||||
this.label9.Text = ")";
|
||||
//
|
||||
// frmMyStocks
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(1217, 651);
|
||||
this.Controls.Add(this.label9);
|
||||
this.Controls.Add(this.label8);
|
||||
this.Controls.Add(this.txtSummaValue);
|
||||
this.Controls.Add(this.lblOwnerName);
|
||||
this.Controls.Add(this.label7);
|
||||
this.Controls.Add(this.txtTotalPlus);
|
||||
@ -396,5 +430,8 @@ namespace StockInfoCore
|
||||
private System.Windows.Forms.Label label7;
|
||||
private System.Windows.Forms.TextBox txtTotalPlus;
|
||||
private Label lblOwnerName;
|
||||
private TextBox txtSummaValue;
|
||||
private Label label8;
|
||||
private Label label9;
|
||||
}
|
||||
}
|
||||
@ -27,6 +27,8 @@ namespace StockInfoCore
|
||||
public decimal TotalPlus { get; set; }
|
||||
public decimal TotalMinus { get; set; }
|
||||
|
||||
public decimal ExtraValueSum { get; set; }
|
||||
|
||||
public Dictionary<string, DiTraderStockRow> Stocks { get; set; }
|
||||
public IEnumerable<StockMember> CurrentStocks { get; set; }
|
||||
public Person ConnectedPerson { get; set; }
|
||||
@ -54,6 +56,7 @@ namespace StockInfoCore
|
||||
CurrentSum = 0m;
|
||||
TotalMinus = 0m;
|
||||
TotalPlus = 0m;
|
||||
ExtraValueSum = 0m;
|
||||
var tmpStocks = new List<StockMember>();
|
||||
var personStocks = new List<StockMember>();
|
||||
//Update all handled shares
|
||||
@ -96,7 +99,8 @@ namespace StockInfoCore
|
||||
txtTotalMinus.Refresh();
|
||||
txtTotalPlus.Text = TotalPlus.ToString();
|
||||
txtTotalPlus.Refresh();
|
||||
|
||||
txtSummaValue.Text = ExtraValueSum.ToString();
|
||||
txtSummaValue.Refresh();
|
||||
lbUpdateTimes.Items.Add($"{DateTime.Now.ToLongTimeString()} - {txtTotDiff.Text.Substring(0, txtTotDiff.Text.Length - 2)}");
|
||||
|
||||
}
|
||||
@ -134,9 +138,11 @@ namespace StockInfoCore
|
||||
var actValue = currStock.PostAmount * currStock.ActValue;
|
||||
var diffValue = actValue - buyValue;
|
||||
var diffproc = diffValue / buyValue * 100;
|
||||
var extraVal = currStock.ActAmount * currStock.ActValue;
|
||||
BoughtSum += buyValue;
|
||||
TotalDiff += diffValue;
|
||||
CurrentSum += actValue;
|
||||
ExtraValueSum += extraVal;
|
||||
if (diffValue < 0)
|
||||
{
|
||||
TotalMinus += diffValue;
|
||||
|
||||
Reference in New Issue
Block a user