Warning, /office/skrooge/plugins/skrooge/default/bank_table_light.qml is written in an unsupported language. File is not indexed.

0001 /***************************************************************************
0002  * SPDX-FileCopyrightText: 2022 S. MANKOWSKI stephane@mankowski.fr
0003  * SPDX-FileCopyrightText: 2022 G. DE BURE support@mankowski.fr
0004  * SPDX-License-Identifier: GPL-3.0-or-later
0005  ***************************************************************************/
0006 import QtQuick 2.12
0007 import QtQuick.Controls 2.12
0008 import QtQuick.Layouts 1.0
0009 
0010 RowLayout {
0011     id: grid
0012     property var m: report==null ? null : report.bank_table
0013     property var point_size: report==null ? 0 : report.point_size
0014     spacing: 2
0015 
0016     function maxValues(m, id) {
0017         var output = 0
0018         for (var i = 1; i < m.length; i++) {
0019             if (!m[i][0] && Math.abs(m[i][id]) > output)
0020                 output = Math.abs(m[i][id])
0021         }
0022         return output
0023     }
0024 
0025     ColumnLayout {
0026         spacing: 0
0027 
0028         // Set titles
0029         Repeater {
0030             model: m
0031             Label {
0032                 Layout.fillWidth: true
0033                 font.bold: index == 0 || modelData[0]
0034                 font.pointSize: point_size
0035                 text: modelData[1]
0036                 horizontalAlignment: index == 0 ? Text.AlignHCenter : Text.AlignLeft
0037             }
0038         }
0039     }
0040 
0041     ColumnLayout {
0042         spacing: 0
0043 
0044         // Set values
0045         Repeater {
0046             model: m
0047             SKGValue {
0048                 font.pointSize: point_size
0049                 Layout.fillWidth: true
0050                 horizontalAlignment: index == 0 ? Text.AlignHCenter : Text.AlignRight
0051                 font.bold: index == 0 || modelData[0]
0052 
0053                 value: index == 0 ? null : modelData[6]
0054                 max: modelData[0] ? null : maxValues(m, 6)
0055                 backgroundColor: '#' + (value == null || value < 0 ? color_negativetext : color_positivetext)
0056                 text: index == 0 ? modelData[6] : document.formatPrimaryMoney(modelData[6])
0057                 url: font.bold ? "" : "skg://Skrooge_operation_plugin/?operationWhereClause=t_BANK='"+ modelData[1] + "'&title="+ modelData[1] + "&title_icon=view-bank-account"
0058             }
0059         }
0060     }
0061 }