diff --git a/WinFormDi/frmPayments.Designer.cs b/WinFormDi/frmPayments.Designer.cs index a910764..17b2761 100644 --- a/WinFormDi/frmPayments.Designer.cs +++ b/WinFormDi/frmPayments.Designer.cs @@ -37,6 +37,8 @@ ch6_Avisering = new ColumnHeader(); btnClose = new Button(); btnRensa = new Button(); + txtSoekSumma = new TextBox(); + lblTotal = new Label(); SuspendLayout(); // // lvPayments @@ -103,11 +105,34 @@ btnRensa.Visible = false; btnRensa.Click += btnRensa_Click; // + // txtSoekSumma + // + txtSoekSumma.BackColor = SystemColors.ButtonHighlight; + txtSoekSumma.Font = new Font("Segoe UI", 14F, FontStyle.Bold, GraphicsUnit.Point); + txtSoekSumma.Location = new Point(493, 472); + txtSoekSumma.Name = "txtSoekSumma"; + txtSoekSumma.ReadOnly = true; + txtSoekSumma.Size = new Size(210, 39); + txtSoekSumma.TabIndex = 12; + txtSoekSumma.Visible = false; + // + // lblTotal + // + lblTotal.AutoSize = true; + lblTotal.Location = new Point(325, 484); + lblTotal.Name = "lblTotal"; + lblTotal.Size = new Size(165, 20); + lblTotal.TabIndex = 11; + lblTotal.Text = "Totalt för visade poster:"; + lblTotal.Visible = false; + // // frmPayments // AutoScaleDimensions = new SizeF(8F, 20F); AutoScaleMode = AutoScaleMode.Font; ClientSize = new Size(978, 604); + Controls.Add(txtSoekSumma); + Controls.Add(lblTotal); Controls.Add(btnRensa); Controls.Add(btnClose); Controls.Add(lvPayments); @@ -118,6 +143,7 @@ Load += frmPayments_Load; Shown += frmPayments_Shown; ResumeLayout(false); + PerformLayout(); } #endregion @@ -131,5 +157,7 @@ private Button btnClose; private ColumnHeader ch5_Förfallodag; private Button btnRensa; + private TextBox txtSoekSumma; + private Label lblTotal; } } \ No newline at end of file diff --git a/WinFormDi/frmPayments.cs b/WinFormDi/frmPayments.cs index 37482f5..cd5ce09 100644 --- a/WinFormDi/frmPayments.cs +++ b/WinFormDi/frmPayments.cs @@ -15,6 +15,7 @@ namespace WinFormDiApp public partial class frmPayments : Form { private bool _enableClearing; + private bool _enableDetailShow; private readonly IAccountRecordRepository _accountRecordRepository; public bool EnableClearing @@ -29,6 +30,18 @@ namespace WinFormDiApp } } + public bool EnableDetailShow + { + get + { + return _enableDetailShow; + } + set + { + _enableDetailShow = value; + } + } + public frmPayments(IAccountRecordRepository accountRecordRepository) { InitializeComponent(); @@ -40,6 +53,9 @@ namespace WinFormDiApp { //MessageBox.Show("Load"); btnRensa.Visible = _enableClearing; + lblTotal.Visible = _enableDetailShow; + txtSoekSumma.Visible = _enableDetailShow; + double totalSum = 0; lvPayments.Items.Clear(); if (CustomPayments != null) @@ -50,10 +66,12 @@ namespace WinFormDiApp lvitem.SubItems.Add(account.Mottagare); lvitem.SubItems.Add(account.Konto); lvitem.SubItems.Add(account.Belopp.ToString()); + totalSum += account.Belopp; lvitem.SubItems.Add(account.BetalDatum.ToShortDateString()); lvitem.SubItems.Add(account.Avisering); } } + txtSoekSumma.Text = totalSum.ToString(); } private void btnClose_Click(object sender, EventArgs e) diff --git a/WinFormDi/frmSearchData.cs b/WinFormDi/frmSearchData.cs index 57e3165..ee0b2fd 100644 --- a/WinFormDi/frmSearchData.cs +++ b/WinFormDi/frmSearchData.cs @@ -113,6 +113,7 @@ namespace WinFormDiApp public void ShowDetails(string mott) { IEnumerable detailRecs = foundRecs.Where(fr => fr.Mottagare == mott); + _showPayments.EnableDetailShow = true; _showPayments.CustomPayments = detailRecs; _showPayments.ShowDialog(); }