Warning, /office/skrooge/plugins/skrooge/default/income_vs_expenditure.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.Layouts 1.0 0008 import QtQuick.Controls 2.12 0009 0010 GridLayout { 0011 property var point_size: report==null ? 0 : report.point_size 0012 0013 id: widget 0014 columns: 2 0015 0016 property double maxValue: Math.max(incomes1Bar.value, expenditures1Bar.value, incomes2Bar.value, expenditures2Bar.value) 0017 property double totrigger: 1.0 0018 0019 Connections { 0020 target: report 0021 function onChanged() { 0022 totrigger = 2.0; 0023 totrigger = 1.0; 0024 } 0025 } 0026 0027 Label{ 0028 id: label1 0029 text: (period1Widget ? period1Widget.text : "") 0030 font.bold: true 0031 font.pointSize: point_size 0032 Layout.columnSpan: 2 0033 } 0034 0035 Label{ 0036 text: qsTr("Incomes:") 0037 font.pointSize: point_size 0038 } 0039 0040 SKGValue { 0041 font.pointSize: point_size 0042 id: incomes1Bar 0043 max: parent.maxValue 0044 value: totrigger*(report==null ? 0 : report.getIncomeVsExpenditure(suboperationsWidget.checked, groupedWidget.checked, transferWidget.checked, trackerWidget.checked, period1Widget.whereClause, period2Widget.whereClause)[1][3]) 0045 text: document.formatPrimaryMoney(value) 0046 horizontalAlignment: Text.AlignHCenter 0047 backgroundColor: '#' + color_positivetext 0048 url: "skg://skrooge_operation_plugin/" + (suboperationsWidget && suboperationsWidget.checked ? "SKGOPERATION_CONSOLIDATED_DEFAULT_PARAMETERS/" :"") + "?operationTable=" + 0049 (suboperationsWidget && suboperationsWidget.checked ? "v_suboperation_consolidated": "v_operation_display") + "&title_icon=view-bank-account-savings¤tPage=-1&title=" + 0050 qsTr("Incomes of %1").arg(label1.text) + (filterWidget_txt && filterWidget_txt.length>0 ? qsTr(" and (%1)").arg(filterWidget_txt) : "") + 0051 "&operationWhereClause=" + (filterWidget_sql && filterWidget_sql.length>0 ? "("+filterWidget_sql+")" : "1=1") + " AND "+ (period1Widget ? period1Widget.whereClause : "1=0") + " AND t_TYPEEXPENSE='+'" + 0052 (groupedWidget && groupedWidget.checked ? "" : " AND i_group_id=0") + (transferWidget && transferWidget.checked ? "" : " AND t_TRANSFER='N'") + (trackerWidget && trackerWidget.checked ? "" : (suboperationsWidget && suboperationsWidget.checked ? " AND t_REALREFUND=''" : " AND t_REFUND=''")); 0053 } 0054 0055 Label{ 0056 text: qsTr("Expenditures:") 0057 font.pointSize: point_size 0058 } 0059 0060 SKGValue { 0061 font.pointSize: point_size 0062 id: expenditures1Bar 0063 max: parent.maxValue 0064 value: totrigger*(report==null ? 0 : report.getIncomeVsExpenditure(suboperationsWidget.checked, groupedWidget.checked, transferWidget.checked, trackerWidget.checked, period1Widget.whereClause, period2Widget.whereClause)[2][3]) 0065 text: document.formatPrimaryMoney(value) 0066 horizontalAlignment: Text.AlignHCenter 0067 backgroundColor: '#' + color_negativetext 0068 url: "skg://skrooge_operation_plugin/" + (suboperationsWidget && suboperationsWidget.checked ? "SKGOPERATION_CONSOLIDATED_DEFAULT_PARAMETERS/" :"") + "?operationTable=" + 0069 (suboperationsWidget && suboperationsWidget.checked ? "v_suboperation_consolidated": "v_operation_display") + "&title_icon=view-bank-account-savings¤tPage=-1&title=" + 0070 qsTr("Expenses of %1").arg(label1.text) + (filterWidget_txt && filterWidget_txt.length>0 ? qsTr(" and (%1)").arg(filterWidget_txt) : "") + 0071 "&operationWhereClause=" + (filterWidget_sql && filterWidget_sql.length>0 ? "("+filterWidget_sql+")" : "1=1") + " AND "+ (period1Widget ? period1Widget.whereClause : "1=0") + " AND t_TYPEEXPENSE='-'" + 0072 (groupedWidget && groupedWidget.checked ? "" : " AND i_group_id=0") + (transferWidget && transferWidget.checked ? "" : " AND t_TRANSFER='N'") + (trackerWidget && trackerWidget.checked ? "" : (suboperationsWidget && suboperationsWidget.checked ? " AND t_REALREFUND=''" : " AND t_REFUND=''")); 0073 } 0074 0075 Label{ 0076 text: qsTr("Savings:") 0077 font.pointSize: point_size 0078 } 0079 0080 SKGValue { 0081 font.pointSize: point_size 0082 id: savings1Bar 0083 max: parent.maxValue 0084 value: Math.abs(incomes1Bar.value - expenditures1Bar.value) 0085 text: document.formatPrimaryMoney(incomes1Bar.value - expenditures1Bar.value) 0086 horizontalAlignment: Text.AlignHCenter 0087 backgroundColor: '#' + (incomes1Bar.value - expenditures1Bar.value <0 ? color_negativetext : color_positivetext) 0088 url: "skg://skrooge_operation_plugin/" + (suboperationsWidget && suboperationsWidget.checked ? "SKGOPERATION_CONSOLIDATED_DEFAULT_PARAMETERS/" :"") + "?operationTable=" + 0089 (suboperationsWidget && suboperationsWidget.checked ? "v_suboperation_consolidated": "v_operation_display") + "&title_icon=view-bank-account-savings¤tPage=-1&title=" + 0090 qsTr("Savings of %1").arg(label1.text) + (filterWidget_txt && filterWidget_txt.length>0 ? qsTr(" and (%1)").arg(filterWidget_txt) : "") + 0091 "&operationWhereClause=" + (filterWidget_sql && filterWidget_sql.length>0 ? "("+filterWidget_sql+")" : "1=1") + " AND "+ (period1Widget ? period1Widget.whereClause : "1=0") + 0092 (groupedWidget && groupedWidget.checked ? "" : " AND i_group_id=0") + (transferWidget && transferWidget.checked ? "" : " AND t_TRANSFER='N'") + (trackerWidget && trackerWidget.checked ? "" : (suboperationsWidget && suboperationsWidget.checked ? " AND t_REALREFUND=''" : " AND t_REFUND=''")); 0093 } 0094 0095 0096 Label{ 0097 id: label2 0098 text: period2Widget ? period2Widget.text : "" 0099 font.bold: true 0100 font.pointSize: point_size 0101 Layout.columnSpan: 2 0102 } 0103 0104 Label{ 0105 text: qsTr("Incomes:") 0106 font.pointSize: point_size 0107 } 0108 0109 SKGValue { 0110 font.pointSize: point_size 0111 id: incomes2Bar 0112 max: parent.maxValue 0113 value: totrigger*(report==null ? 0 : report.getIncomeVsExpenditure(suboperationsWidget.checked, groupedWidget.checked, transferWidget.checked, trackerWidget.checked, period1Widget.whereClause, period2Widget.whereClause)[1][2]) 0114 text: document.formatPrimaryMoney(value) 0115 horizontalAlignment: Text.AlignHCenter 0116 backgroundColor: '#' + color_positivetext 0117 url: "skg://skrooge_operation_plugin/" + (suboperationsWidget && suboperationsWidget.checked ? "SKGOPERATION_CONSOLIDATED_DEFAULT_PARAMETERS/" :"") + "?operationTable=" + 0118 (suboperationsWidget && suboperationsWidget.checked ? "v_suboperation_consolidated": "v_operation_display") + "&title_icon=view-bank-account-savings¤tPage=-1&title=" + 0119 qsTr("Incomes of %1").arg(label2.text) + (filterWidget_txt && filterWidget_txt.length>0 ? qsTr(" and (%1)").arg(filterWidget_txt) : "") + 0120 "&operationWhereClause=" + (filterWidget_sql && filterWidget_sql.length>0 ? "("+filterWidget_sql+")" : "1=1") + " AND "+ (period2Widget ? period2Widget.whereClause : "1=0") + " AND t_TYPEEXPENSE='+'" + 0121 (groupedWidget && groupedWidget.checked ? "" : " AND i_group_id=0") + (transferWidget && transferWidget.checked ? "" : " AND t_TRANSFER='N'") + (trackerWidget && trackerWidget.checked ? "" : (suboperationsWidget && suboperationsWidget.checked ? " AND t_REALREFUND=''" : " AND t_REFUND=''")); 0122 } 0123 0124 Label{ 0125 text: qsTr("Expenditures:") 0126 font.pointSize: point_size 0127 } 0128 0129 SKGValue { 0130 font.pointSize: point_size 0131 id: expenditures2Bar 0132 max: parent.maxValue 0133 value: totrigger*(report==null ? 0 : report.getIncomeVsExpenditure(suboperationsWidget.checked, groupedWidget.checked, transferWidget.checked, trackerWidget.checked, period1Widget.whereClause, period2Widget.whereClause)[2][2]) 0134 text: document.formatPrimaryMoney(value) 0135 horizontalAlignment: Text.AlignHCenter 0136 backgroundColor: '#' + color_negativetext 0137 url: "skg://skrooge_operation_plugin/" + (suboperationsWidget && suboperationsWidget.checked ? "SKGOPERATION_CONSOLIDATED_DEFAULT_PARAMETERS/" :"") + "?operationTable=" + 0138 (suboperationsWidget && suboperationsWidget.checked ? "v_suboperation_consolidated": "v_operation_display") + "&title_icon=view-bank-account-savings¤tPage=-1&title=" + 0139 qsTr("Expenses of %1").arg(label2.text) + (filterWidget_txt && filterWidget_txt.length>0 ? qsTr(" and (%1)").arg(filterWidget_txt) : "") + 0140 "&operationWhereClause=" + (filterWidget_sql && filterWidget_sql.length>0 ? "("+filterWidget_sql+")" : "1=1") + " AND "+ (period2Widget ? period2Widget.whereClause : "1=0") + " AND t_TYPEEXPENSE='-'" + 0141 (groupedWidget && groupedWidget.checked ? "" : " AND i_group_id=0") + (transferWidget && transferWidget.checked ? "" : " AND t_TRANSFER='N'") + (trackerWidget && trackerWidget.checked ? "" : (suboperationsWidget && suboperationsWidget.checked ? " AND t_REALREFUND=''" : " AND t_REFUND=''")); 0142 } 0143 0144 Label{ 0145 text: qsTr("Savings:") 0146 font.pointSize: point_size 0147 } 0148 0149 SKGValue { 0150 id: savings2Bar 0151 max: parent.maxValue 0152 value: Math.abs(incomes2Bar.value - expenditures2Bar.value) 0153 text: document.formatPrimaryMoney(incomes2Bar.value - expenditures2Bar.value) 0154 horizontalAlignment: Text.AlignHCenter 0155 backgroundColor: '#' + (incomes2Bar.value - expenditures2Bar.value <0 ? color_negativetext : color_positivetext) 0156 url: "skg://skrooge_operation_plugin/" + (suboperationsWidget && suboperationsWidget.checked ? "SKGOPERATION_CONSOLIDATED_DEFAULT_PARAMETERS/" :"") + "?operationTable=" + 0157 (suboperationsWidget && suboperationsWidget.checked ? "v_suboperation_consolidated": "v_operation_display") + "&title_icon=view-bank-account-savings¤tPage=-1&title=" + 0158 qsTr("Savings of %1").arg(label2.text) + (filterWidget_txt && filterWidget_txt.length>0 ? qsTr(" and (%1)").arg(filterWidget_txt) : "") + 0159 "&operationWhereClause=" + (filterWidget_sql && filterWidget_sql.length>0 ? "("+filterWidget_sql+")" : "1=1") + " AND "+ (period2Widget ? period2Widget.whereClause : "1=0") + 0160 (groupedWidget && groupedWidget.checked ? "" : " AND i_group_id=0") + (transferWidget && transferWidget.checked ? "" : " AND t_TRANSFER='N'") + (trackerWidget && trackerWidget.checked ? "" : (suboperationsWidget && suboperationsWidget.checked ? " AND t_REALREFUND=''" : " AND t_REFUND=''")); 0161 } 0162 }