mirror of
https://github.com/brmlab/brmbar.git
synced 2025-06-08 05:14:00 +02:00
brmbarv3 Receipt: New view for entering and paying receipts
This commit is contained in:
parent
9c1c8d381b
commit
b315a8359c
4 changed files with 206 additions and 4 deletions
|
@ -30,7 +30,7 @@ Item {
|
|||
x: 65
|
||||
y: 430
|
||||
width: 360
|
||||
text: "Withdrawal"
|
||||
text: "Select Item"
|
||||
fontSize: 44
|
||||
btnColor: "#666666"
|
||||
}
|
||||
|
@ -50,8 +50,10 @@ Item {
|
|||
x: 65
|
||||
y: 582
|
||||
width: 360
|
||||
text: "Select Item"
|
||||
btnColor: "#666666"
|
||||
text: "Receipt"
|
||||
onButtonClick: {
|
||||
loadPage("Receipt")
|
||||
}
|
||||
}
|
||||
|
||||
BarButton {
|
||||
|
|
192
brmbar3/brmbar-gui-qt4/Receipt.qml
Normal file
192
brmbar3/brmbar-gui-qt4/Receipt.qml
Normal file
|
@ -0,0 +1,192 @@
|
|||
// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
|
||||
import QtQuick 1.1
|
||||
import QtQuick 1.0
|
||||
|
||||
Item {
|
||||
id: page
|
||||
anchors.fill: parent
|
||||
|
||||
property variant user
|
||||
property variant description: ""
|
||||
property variant amount: ""
|
||||
|
||||
state: "normal"
|
||||
|
||||
BarcodeInput {
|
||||
color: "#00ff00" /* just for debugging */
|
||||
onAccepted: {
|
||||
var acct = shop.barcodeInput(text)
|
||||
text = ""
|
||||
if (typeof(acct) == "undefined" || acct.acctype != "debt") {
|
||||
status_text.setStatus("Unknown barcode", "#ff4444")
|
||||
return
|
||||
}
|
||||
user = acct
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
id: description_row
|
||||
visible: page.state == "normal" || page.state == "description_edit"
|
||||
x: 65
|
||||
y: 166
|
||||
width: 890
|
||||
height: 60
|
||||
|
||||
Text {
|
||||
id: description_input
|
||||
x: 0
|
||||
y: 0
|
||||
width: 640
|
||||
height: 60
|
||||
color: "#ffff7c"
|
||||
text: page.description
|
||||
wrapMode: Text.WordWrap
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
font.pointSize: 34
|
||||
}
|
||||
|
||||
BarButton {
|
||||
id: description_edit
|
||||
x: 591
|
||||
y: 0
|
||||
width: 300
|
||||
height: 60
|
||||
fontSize: 34
|
||||
text: page.state == "description_edit" ? "Assign" : "Description"
|
||||
onButtonClick: { if (page.state == "description_edit") page.state = "normal"; else page.state = "description_edit"; }
|
||||
}
|
||||
}
|
||||
|
||||
BarKeyPad {
|
||||
id: item_name_pad
|
||||
x: 65
|
||||
y: 239
|
||||
visible: page.state == "description_edit"
|
||||
onLetterEntered: { page.description = page.description + letter; }
|
||||
onLetterBackspace: { page.description = page.description.replace(/.$/, ''); }
|
||||
}
|
||||
|
||||
Item {
|
||||
id: amount_row
|
||||
visible: page.state == "normal" || page.state == "amount_edit"
|
||||
x: 65
|
||||
y: page.state == "amount_edit" ? 166 : 239;
|
||||
width: 890
|
||||
height: 60
|
||||
|
||||
Text {
|
||||
id: item_sellprice_label
|
||||
x: 0
|
||||
y: 0
|
||||
height: 60
|
||||
width: 200
|
||||
color: "#ffffff"
|
||||
text: "Money Amount:"
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
font.pointSize: 34
|
||||
}
|
||||
|
||||
Text {
|
||||
id: amount_input
|
||||
x: 320
|
||||
y: 0
|
||||
height: 60
|
||||
width: 269
|
||||
color: "#ffff7c"
|
||||
text: amount
|
||||
horizontalAlignment: Text.AlignRight
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
font.pointSize: 34
|
||||
}
|
||||
|
||||
BarButton {
|
||||
id: amount_edit
|
||||
x: 650
|
||||
y: 0
|
||||
width: 240
|
||||
height: 60
|
||||
fontSize: 34
|
||||
text: page.state == "amount_edit" ? "Assign" : "Edit"
|
||||
onButtonClick: { if (page.state == "amount_edit") page.state = "normal"; else page.state = "amount_edit"; }
|
||||
}
|
||||
}
|
||||
|
||||
BarNumPad {
|
||||
id: amount_pad
|
||||
x: 65
|
||||
y: 239
|
||||
visible: page.state == "amount_edit"
|
||||
onLetterEntered: { amount = amount.toString() + letter }
|
||||
onLetterBackspace: { amount = amount.toString().replace(/.$/, '') }
|
||||
}
|
||||
|
||||
BarTextHint {
|
||||
id: barcode_row
|
||||
visible: page.state == "normal"
|
||||
x: 65
|
||||
y: 314
|
||||
hint_goal: "Receipt owner:"
|
||||
hint_action: typeof(user) != "undefined" ? user.name : "Scan user now"
|
||||
}
|
||||
|
||||
Text {
|
||||
id: legend
|
||||
visible: page.state == "normal"
|
||||
x: 65
|
||||
y: 410
|
||||
height: 154
|
||||
width: 894
|
||||
color: "#71cccc"
|
||||
text: "This is for cashing in small brmlab expenses.\nWrite the current date on the receipt and put it to the money box.\nDo not forget to announce this on a meetup and add it to the [[newz]].\nFor restocking brmbar items, please go to the Management view instead."
|
||||
wrapMode: Text.WordWrap
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
font.pointSize: 20
|
||||
}
|
||||
|
||||
BarButton {
|
||||
id: save
|
||||
x: 65
|
||||
y: 582
|
||||
width: 360
|
||||
text: "Create"
|
||||
onButtonClick: {
|
||||
if (typeof(user) == "undefined") {
|
||||
status_text.setStatus("Someone must be responsible for each receipt.", "#ff4444")
|
||||
return
|
||||
}
|
||||
var balance = shop.newReceipt(user.id, description, amount)
|
||||
if (typeof(balance) == "undefined") {
|
||||
status_text.setStatus("Please fill all values first.", "#ff4444")
|
||||
return
|
||||
}
|
||||
|
||||
status_text.setStatus("Added to "+user.name+"'s credit, now "+balance+".", "#ffff7c")
|
||||
loadPage("MainPage")
|
||||
}
|
||||
}
|
||||
|
||||
BarButton {
|
||||
id: cancel
|
||||
x: 599
|
||||
y: 582
|
||||
width: 360
|
||||
text: "Cancel"
|
||||
onButtonClick: {
|
||||
status_text.setStatus("Receipt cancelled", "#ff4444")
|
||||
loadPage("MainPage")
|
||||
}
|
||||
}
|
||||
|
||||
states: [
|
||||
State {
|
||||
name: "normal"
|
||||
},
|
||||
State {
|
||||
name: "amount_edit"
|
||||
},
|
||||
State {
|
||||
name: "description_edit"
|
||||
}
|
||||
]
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue