Skip to content

Commit

Permalink
Rectified the issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Shanu committed Mar 9, 2011
1 parent 18562e6 commit 994ba15
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 4 deletions.
4 changes: 2 additions & 2 deletions grails-app/conf/DataSource.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ environments {
development {
dataSource {
dbCreate = "update"
url = "jdbc:postgresql://localhost:5432/GIFTDB"
url = "jdbc:postgresql://localhost:5432/vmsdb"
username = "app_user"
password = "password"
}
}
test {
dataSource {
dbCreate = "update"
url = "jdbc:postgresql://localhost:5432/GIFTDB"
url = "jdbc:postgresql://localhost:5432/vmsdb"
username = "app_user"
password = "password"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class VoucherController {
def sequenceNumber = params['sequenceNumber'] ? Long.parseLong(params['sequenceNumber']) : null
def voucher = voucherService.getVoucherToValidateAndUpdateStatus(params['clientInitials'], sequenceNumber, params['barcode'])
if (voucher) {
def converter = voucher as JSON
def converter = voucher.getVoucherModel() as JSON
converter.render(response)
} else {
render 'FAILURE'
Expand Down
5 changes: 5 additions & 0 deletions grails-app/domain/com/breigns/vms/Voucher.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,9 @@ class Voucher {
def getDiscountGivenForReport() {
voucherRequest.voucherInvoice.discount
}

def getVoucherModel(){
return new VoucherModel(sequenceNumber:sequenceNumber,barcodeAlpha:barcodeAlpha,value:value,
validThru:validThru,client:voucherRequest.client)
}
}
2 changes: 1 addition & 1 deletion grails-app/views/voucher/invoiceEntry.gsp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ h3 {
if (data != 'FAILURE') {
if ($("#voucherId").length == 0 || !isVoucherAlreadyPresent('voucherId', data.id)) {
$('#voucherTable tr:last').after('<tr><td><input type="hidden" id="voucherId" name="voucherId" value="' + data.id + '"/>' + data.sequenceNumber + '</td><td>' + data.barcodeAlpha + '</td><td>' + data.voucherRequest.client.name + '</td><td>' + data.value + '</td><td><input type="button" value="X"></td></tr>')
$('#voucherTable tr:last').after('<tr><td><input type="hidden" id="voucherId" name="voucherId" value="' + data.id + '"/>' + data.sequenceNumber + '</td><td>' + data.barcodeAlpha + '</td><td>' + data.client.name + '</td><td>' + data.value + '</td><td><input type="button" value="X"></td></tr>')
bindRemoveClickHandlerForTableRow('voucherTable')
$.each(["barcode","clientInitials","voucherSequenceNumber"], function(index, value) {
$('#' + value).val("")
Expand Down
10 changes: 10 additions & 0 deletions src/groovy/com/breigns/vms/VoucherModel.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.breigns.vms

class VoucherModel {
Integer sequenceNumber
String barcodeAlpha
Double value
Shop validatedAt;
Date validThru;
Client client
}

0 comments on commit 994ba15

Please sign in to comment.