Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Copyright (C) 2022 Dirk Unverzagt
- * Dieses Programm ist kostenlose Software: Sie können es weitergeben und/oder modifizieren
- * Es unterliegt den Bedingungen der GNU General Public License, wie veröffentlicht von
- * die Free Software Foundation; Fassung 3.
- *
- * mwst wird in der Hoffnung verteilt, dass es nützlich sein wird,
- * jedoch OHNE JEGLICHE GEWÄHRLEISTUNG; sogar ohne die stillschweigende Garantie von
- * MARKTFÄHIGKEIT oder EIGNUNG FÜR EINEN BESTIMMTEN ZWECK. Siehe die
- * GNU General Public License für weitere Details.
- *
- * Sie sollten eine Kopie der GNU General Public License erhalten haben
- * zusammen mit diesem Programm. Falls nicht, siehe <http://www.gnu.org/licenses/>.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 3.
- *
- * mwst is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
- import QtQuick 2.7
- import Ubuntu.Components 1.3
- import QtQuick.Controls 2.2
- import QtQuick.Layouts 1.3
- import Qt.labs.settings 1.0
- import QtQuick.LocalStorage 2.0
- MainView {
- id: root2
- objectName: 'mainView'
- applicationName: 'mwst.dl8aax'
- automaticOrientation: true
- width: units.gu(45)
- height: units.gu(70)
- Item {
- id : i
- function machmacombob(tv) {
- var satze = window.mw.split('\n' )
- console.log( i18n.tr( "satze 1 =" + satze[1] ))
- }
- Component.onCompleted: {
- machmacombob()
- }
- }
- Page {
- id:page_berechnung
- anchors.fill: parent
- // header: PageHeader {
- // id: header
- // title: i18n.tr('Mehrwertsteuer Rechner')
- // }
- Rectangle {
- id: rectangle
- x: units.gu(2)
- y: units.gu(2)
- width: units.gu(45)-units.gu(5)
- height: units.gu(75)/4
- color: "#ddd9d9"
- radius: 4
- border.color: "#be0cc4"
- border.width: units.gu(0.2)
- Text {
- id: btext
- x: units.gu(2.5) // 20 px Desktop 45 px Phone 25 px Tablet
- y: units.gu(3.25)
- height: units.gu(3)
- anchors.margins: units.gu(1)
- text: i18n.tr('Brutto ')
- font.pixelSize: units.gu(2.5)
- color: "darkorange"
- }
- Text {
- id: ntext
- anchors.left : btext.left
- anchors.top : btext.bottom
- anchors.topMargin: units.gu(1)
- height: units.gu(3)
- text: i18n.tr("Neto ")
- font.pixelSize: units.gu(2.5)
- color: "darkorange"
- }
- Text {
- id: mtext
- anchors.left : ntext.left
- anchors.top : ntext.bottom
- anchors.topMargin: units.gu(1)
- height: units.gu(3)
- text: i18n.tr("MwSt ")
- font.pixelSize: units.gu(2.5)
- color: "darkorange"
- }
- }
- Rectangle {
- id: rectangle2
- x: units.gu(2)
- y: units.gu(4)+rectangle.height
- width: units.gu(45)-units.gu(5)
- height: units.gu(75)/2
- color: "#ddd9d9"
- radius: 4
- border.color: "#be0cc4"
- border.width: units.gu(0.2)
- Text {
- id: nitext
- x: units.gu(2)
- y: units.gu(2)
- // width: units.gu(20)
- height: units.gu(3)
- text: i18n.tr("Der Betrag ist ")
- font.pixelSize: units.gu(2.5)
- color: "darkorange"
- }
- RadioButton {
- id: radioButton
- // x: 126
- // y: nitext.y - units.gu(2)
- anchors.left : nitext.right
- // anchors.top : nitext.top
- anchors.verticalCenter: nitext.verticalCenter
- text: i18n.tr("Brutto")
- }
- RadioButton {
- id: radioButton1
- // x: 210
- // y: 14
- anchors.left : radioButton.right
- anchors.top : radioButton.top
- text: i18n.tr("Netto")
- }
- Text {
- id: ni_text
- // x: 20
- // y: nitext.y+42
- anchors.left : nitext.left
- anchors.top : nitext.bottom
- anchors.topMargin: units.gu(1.8)
- //width: 50
- height: units.gu(2.5)
- text: i18n.tr("Betrag: ")
- font.pixelSize: units.gu(2.5)
- color: "darkorange"
- }
- TextField {
- id: textInput_b
- width: units.gu(10)
- // height: units.gu(3)
- anchors.left : ni_text.right
- anchors.verticalCenter: ni_text.verticalCenter
- // anchors.topMargin: units.gu(3)
- text: qsTr("")
- font.pixelSize: units.gu(1.5 )
- selectionColor: "#b8b8fe"
- cursorVisible: true
- focus: true
- }
- Text {
- id: combotext
- x: 22
- y: nitext.y+80
- // width: 100
- //height: 22
- anchors.left : ni_text.left
- anchors.top : ni_text.bottom
- anchors.topMargin: units.gu(3)
- text: i18n.tr("Mehrwertsteuersatz ")
- font.pixelSize: units.gu(2.5)
- color: "darkorange"
- }
- ComboBox {
- id: comboBox
- // x: rectangle2.width-22-comboBox.width
- // y: rectangle2.width-22-comboBox.width
- width : units.gu(11)
- anchors.left : combotext.right
- // anchors.top : combotext.top
- anchors.verticalCenter: combotext.verticalCenter
- textRole: qsTr("")
- model: ["7 %","9.5 %", "10.7 %", "19 %"]
- }
- /* Rectangle {
- id: rect
- x: 22
- y: comboBox.y+90
- width: units.gu(13)
- height: units.gu(4)
- color: "orange"
- radius: 10
- border.color: "#be0cc4"
- border.width: 1
- Text {
- id: buttontext
- text: i18n.tr("Berechnen")
- font.pixelSize: units.gu(2.5)
- //x: parent.x + 4
- anchors.centerIn:rect
- //font.pointSize: FontUtils.sizeToPixels("medium")
- }
- MouseArea{
- anchors.fill: parent
- onEntered: {
- //var qrg = float
- var betrt = textInput_b.text.replace(',','.')
- var betr = parseFloat ( betrt )
- var steu = comboBox.currentText
- steu = steu.replace(' %','')
- var mwsts = parseFloat( steu)
- var n = 0.00
- var m = 0.00
- if (radioButton.checked){
- // Betrag ist Brutto also Netto berechnen
- n = betr / (100 + mwsts ) * 100
- m = betr / (100 + mwsts ) * mwsts
- ntext.text = i18n.tr("Netto : " + Math.round( n * 100)/100 + " €")
- btext.text = i18n.tr("Brutto : " + Math.round( betrt * 100)/100 + " €")
- mtext.text = i18n.tr("MwSt : " + Math.round( m * 100)/100 + " €")
- }
- if (radioButton1.checked){
- // Betrag ist Netto also Brutto berechnen
- m = betr / 100 * mwsts
- n = betr + m
- console.log("m ="+m)
- ntext.text = i18n.tr("Netto : " + Math.round( betr * 100)/100 + " €")
- btext.text = i18n.tr("Brutto : "+ Math.round( n * 100)/100 + " €")
- mtext.text = i18n.tr("MwSt : "+ Math.round( m * 100)/100 + " €")
- }
- }
- }
- } */
- Item {
- anchors.centerIn:parent
- Action {
- id: action1
- text: "Bereken"
- iconName: "compose"
- onTriggered: {
- }
- }
- }
- Button {
- id : but
- //anchors.horizontalCenter: rectangle2.center
- anchors.top : comboBox.bottom
- anchors.topMargin: units.gu(3)
- anchors.centerIn: parent
- // x : rectangle2.center - but / 2
- text: i18n.tr("Bereken")
- onClicked: {
- console.log( i18n.tr(' button clicked\n' + mw ))
- console.log( i18n.tr( window.mw ))
- //var qrg = float
- var betrt = textInput_b.text.replace(',','.')
- var betr = parseFloat ( betrt )
- var steu = comboBox.currentText
- steu = steu.replace(' %','')
- var mwsts = parseFloat( steu)
- var n = 0.00
- var m = 0.00
- if (radioButton.checked){
- // Betrag ist Brutto also Netto berechnen
- n = betr / (100 + mwsts ) * 100
- m = betr / (100 + mwsts ) * mwsts
- ntext.text = i18n.tr("Netto : " + Math.round( n * 100)/100 + " €")
- btext.text = i18n.tr("Brutto : " + Math.round( betrt * 100)/100 + " €")
- mtext.text = i18n.tr("MwSt : " + Math.round( m * 100)/100 + " €")
- }
- if (radioButton1.checked){
- // Betrag ist Netto also Brutto berechnen
- m = betr / 100 * mwsts
- n = betr + m
- console.log("m ="+m)
- ntext.text = i18n.tr("Netto : " + Math.round( betr * 100)/100 + " €")
- btext.text = i18n.tr("Brutto : "+ Math.round( n * 100)/100 + " €")
- mtext.text = i18n.tr("MwSt : "+ Math.round( m * 100)/100 + " €")
- }
- color: UbuntuColors.warmGrey
- }
- }
- }//ende Rectangle
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement