Summa i detaljvy av sökta betalningsmottagare

This commit is contained in:
2024-02-11 09:34:38 +01:00
parent a16137072b
commit 6510913daa
3 changed files with 47 additions and 0 deletions

View File

@ -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;
}
}

View File

@ -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)

View File

@ -113,6 +113,7 @@ namespace WinFormDiApp
public void ShowDetails(string mott)
{
IEnumerable<AccountRecord> detailRecs = foundRecs.Where(fr => fr.Mottagare == mott);
_showPayments.EnableDetailShow = true;
_showPayments.CustomPayments = detailRecs;
_showPayments.ShowDialog();
}