CreditNote: Add member modifier display
This commit is contained in:
@ -4,14 +4,14 @@ using System;
|
||||
namespace Elwig.Helpers {
|
||||
public static class AppDbUpdater {
|
||||
|
||||
public static readonly int RequiredSchemaVersion = 11;
|
||||
public static readonly int RequiredSchemaVersion = 12;
|
||||
|
||||
private static int _versionOffset = 0;
|
||||
private static readonly Action<SqliteConnection>[] _updaters = new[] {
|
||||
private static readonly Action<SqliteConnection>[] _updaters = [
|
||||
UpdateDbSchema_1_To_2, UpdateDbSchema_2_To_3, UpdateDbSchema_3_To_4, UpdateDbSchema_4_To_5,
|
||||
UpdateDbSchema_5_To_6, UpdateDBSchema_6_To_7, UpdateDbSchema_7_To_8, UpdateDbSchema_8_To_9,
|
||||
UpdateDbSchema_9_To_10, UpdateDbSchema_10_To_11
|
||||
};
|
||||
UpdateDbSchema_9_To_10, UpdateDbSchema_10_To_11, UpdateDbSchema_11_To_12,
|
||||
];
|
||||
|
||||
private static void ExecuteNonQuery(SqliteConnection cnx, string sql) {
|
||||
using var cmd = cnx.CreateCommand();
|
||||
@ -800,5 +800,19 @@ namespace Elwig.Helpers {
|
||||
ExecuteNonQuery(cnx, "ALTER TABLE payment_member DROP COLUMN amount");
|
||||
ExecuteNonQuery(cnx, "ALTER TABLE payment_member ADD COLUMN amount INTEGER NOT NULL GENERATED ALWAYS AS (ROUND(net_amount * (1 + mod_rel) + mod_abs)) VIRTUAL");
|
||||
}
|
||||
|
||||
private static void UpdateDbSchema_11_To_12(SqliteConnection cnx) {
|
||||
ExecuteNonQuery(cnx, """
|
||||
CREATE VIEW v_stat_member AS
|
||||
SELECT year, mgnr,
|
||||
SUM(weight) AS sum,
|
||||
ROUND(SUM(kmw * weight) / SUM(weight), 2) AS kmw,
|
||||
ROUND(SUM(oe * weight) / SUM(weight), 1) AS oe,
|
||||
COUNT(DISTINCT did) AS lieferungen
|
||||
FROM v_delivery
|
||||
GROUP BY year, mgnr
|
||||
ORDER BY year, mgnr;
|
||||
""");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user