88 lines
2.4 KiB
C#
88 lines
2.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Runtime.InteropServices;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
using BrightIdeasSoftware;
|
|
using DatenDB;
|
|
|
|
namespace Deckungsbeitrag
|
|
{
|
|
public partial class FormArtikelVW : Form
|
|
{
|
|
public FormArtikelVW()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void FormArtikelVW_Load(object sender, EventArgs e)
|
|
{
|
|
OLV_Load();
|
|
|
|
}
|
|
|
|
private void OLV_GroupCount()
|
|
{
|
|
foreach (OLVGroup group in this.objectListViewArtikel.OLVGroups)
|
|
{
|
|
int sum = 0;
|
|
|
|
foreach (OLVListItem item in group.Items)
|
|
{
|
|
Artikel art = (Artikel)item.RowObject;
|
|
sum += art.Nachwaesche;
|
|
}
|
|
group.Header = $"{group.Header} (Anzahl: {sum.ToString()})";
|
|
}
|
|
|
|
}
|
|
|
|
private void OLV_Load()
|
|
{
|
|
Generator.GenerateColumns(this.objectListViewArtikel, typeof(Artikel), true);
|
|
this.objectListViewArtikel.SetObjects(Artikel.GetArtikelList());
|
|
OLVColumn sortColumn = new OLVColumn();
|
|
sortColumn = (OLVColumn)this.objectListViewArtikel.Columns[6];
|
|
this.objectListViewArtikel.Sort(sortColumn);
|
|
OLV_GroupCount();
|
|
OLVColumn buttonColumn = new OLVColumn();
|
|
buttonColumn = (OLVColumn)this.objectListViewArtikel.Columns[7];
|
|
buttonColumn.IsButton = true;
|
|
buttonColumn.ButtonSizing = OLVColumn.ButtonSizingMode.CellBounds;
|
|
Funktionen.Columns_Resize(this.objectListViewArtikel);
|
|
|
|
this.objectListViewArtikel.FilterMenuBuildStrategy = new MeinFilterMenu();
|
|
|
|
}
|
|
|
|
private void objectListViewArtikel_ButtonClick(object sender, CellClickEventArgs e)
|
|
{
|
|
Artikel artikel = (Artikel)e.Model;
|
|
artikel.Nachwaesche = 0;
|
|
artikel.LastReset = DateTime.Now;
|
|
if(artikel.Save() == 1) this.objectListViewArtikel.RefreshObject(e.Model);
|
|
}
|
|
|
|
private void objectListViewArtikel_AfterCreatingGroups(object sender, CreateGroupsEventArgs e)
|
|
{
|
|
foreach (OLVGroup group in this.objectListViewArtikel.OLVGroups)
|
|
{
|
|
int sum = 0;
|
|
|
|
foreach (OLVListItem item in group.Items)
|
|
{
|
|
Artikel art = (Artikel)item.RowObject;
|
|
sum += art.Nachwaesche;
|
|
}
|
|
group.Header = $"{group.Header} (Anzahl: {sum.ToString()})";
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|