Warning, /office/skrooge/plugins/skrooge/default/budget_table.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.budget_table
0013     property var point_size: report==null ? 0 : report.point_size
0014     spacing: 2
0015 
0016     ColumnLayout {
0017         spacing: 0
0018 
0019         // Set titles
0020         Repeater {
0021             model: m
0022             Label {
0023                 Layout.fillWidth: true
0024                 font.bold: index == 0 || modelData[0]
0025                 font.pointSize: point_size
0026                 text: modelData[1]
0027                 horizontalAlignment: index == 0 ? Text.AlignHCenter : Text.AlignLeft
0028             }
0029         }
0030     }
0031 
0032     Repeater {
0033         model: [2, 3, 4]
0034         ColumnLayout {
0035             spacing: 0
0036             property var modelId: modelData
0037 
0038             // Set values
0039             Repeater {
0040                 model: m
0041                 SKGValue {
0042                     font.pointSize: point_size
0043                     Layout.fillWidth: true
0044                     horizontalAlignment: index == 0 ? Text.AlignHCenter : Text.AlignRight
0045                     font.bold: index == 0 || modelData[0]
0046 
0047                     value: index == 0  ? null : modelData[parent.modelId]
0048                     backgroundColor: '#' + (value == null || value < 0 ? color_negativetext : color_positivetext)
0049                     text: index == 0 ? modelData[parent.modelId] : parent.modelId!=2 ? document.formatPrimaryMoney(modelData[parent.modelId]) : document.formatPrimaryMoney(modelData[5])
0050 
0051                     Timer {
0052                         interval: 2000; running: index != 0 && parent.modelId==2 && document.formatPrimaryMoney(modelData[5])!=document.formatPrimaryMoney(modelData[2]); repeat: true
0053                         onTriggered: {
0054 
0055                             if(parent.text == document.formatPrimaryMoney(modelData[5])) {
0056                                 parent.text = document.formatPrimaryMoney(modelData[2])
0057                                 parent.font.strikeout = true
0058                             }else {
0059                                 parent.text = document.formatPrimaryMoney(modelData[5])
0060                                 parent.font.strikeout = false
0061                             }
0062                         }
0063                     }
0064                 }
0065             }
0066         }
0067     }
0068 }