Skip to content

Commit

Permalink
Shanu: Added print functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
shanu committed Oct 29, 2011
1 parent 5658f7a commit bcc099b
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 29 deletions.
4 changes: 2 additions & 2 deletions application.properties
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#Grails Metadata file
#Mon Oct 10 21:26:48 BRT 2011
#Sat Oct 29 10:58:59 BRST 2011
app.grails.version=1.3.4
app.name=VMS
app.servlet.version=2.4
app.version=0.1
plugins.hibernate=1.3.4
plugins.jasper=1.1.6.3
plugins.jasper=1.2.2
plugins.spring-security-core=1.0.1
plugins.tomcat=1.3.4
28 changes: 10 additions & 18 deletions grails-app/conf/Config.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -46,23 +46,6 @@ grails.logging.jul.usebridge = true
// packages to include in Spring bean scanning
grails.spring.bean.packages = []

// set per-environment serverURL stem for creating absolute links
environments {
production {
grails.serverURL = "http://www.changeme.com"
jasper.dir.reports = 'WEB-INF/reports'
}
development {
grails.serverURL = "http://localhost:8080/${appName}"
jasper.dir.reports = 'WEB-INF/reports'

}
test {
grails.serverURL = "http://localhost:8080/${appName}"
jasper.dir.reports = '/WEB-INF/reports'
}

}

// log4j configuration
log4j = {
Expand Down Expand Up @@ -103,4 +86,13 @@ grails.plugins.springsecurity.interceptUrlMap = [
'/user/**': ['ROLE_USER', 'IS_AUTHENTICATED_FULLY'],
'/**': ['IS_AUTHENTICATED_FULLY']
]
grails.converters.json.default.deep = true
grails.converters.json.default.deep = true
environments {
development {
jasper.dir.reports = 'WEB-INF/reports'
}
production {
// relative to web-app
jasper.dir.reports = 'WEB-INF/reports'
}
}
2 changes: 1 addition & 1 deletion grails-app/views/voucher/invoiceEntry.gsp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ h3 {
}
function printInvoice(invoiceNumber){
var url = $("#printInvoiceLink").attr("href") + "?invoiceId="+invoiceNumber
window.open($("#printInvoiceLink").attr('href'),'Print Link',"menubar=1,resizable=1,width=350,height=250");
window.open(url,'Print Link',"menubar=1,resizable=1,width=750,height=450");
}
</script>
<form style="margin:0px;padding:0px;">
Expand Down
66 changes: 58 additions & 8 deletions grails-app/views/voucher/printInvoice.gsp
Original file line number Diff line number Diff line change
@@ -1,33 +1,83 @@
<html>
<body>
<table>
<head>
<style type="text/css">
#invoicePrintBlock{
padding:10px;
border-width: 2px;
border-style: solid;
border-color: #900;
}
#invoicePrintHeader{
font-style:italic;
font-size: 25px;
padding:5px;
border-bottom: 2px solid;
border-color: #900;
}
#invoicePrintTable {
width: 600px;
margin:20px;
}
#invoicePrintTable tbody tr td{
border-bottom:1px solid;
padding:3px;
}
#invoicePrintVoucher{
width:600px;
text-align:center;
}
</style>
<script>
function printInvoice(){
window.print();
}
</script>
</head>
<body onload="printInvoice()">
<div id="invoicePrintBlock">
<div id="invoicePrintHeader">Invoice Report</div>
<table id="invoicePrintTable" cellspacing="0">
<tbody>
<tr>
<td>Invoice Number</td>
<td>${invoice.invoiceNumber}</td>
<td>Invoice Date</td>
<td>${invoice.invoiceDate}</td>
<td><g:formatDate format="dd/MM/yyyy" date="${invoice.invoiceDate}"/> </td>
</tr>
<tr>
<td>Total</td>
<td>${invoice.totalAmount}</td>
<td><g:formatNumber number="${invoice.totalAmount}" format="###.00" /></td>
<td>Discount</td>
<td>${invoice.discount}</td>
<td><g:formatNumber number="${invoice.discount}" format="###.00" /></td>
</tr>
<tr>
<td>Net total</td>
<td>${invoice.netTotal}</td>
<td><g:formatNumber number="${invoice.netTotal}" format="###.00" /></td>
<td>Item</td>
<td>${invoice.item.name}</td>
</tr>
</tbody>
</table>
<table>
<table id="invoicePrintVoucher">
<thead>
<tr>
<th>Voucher Seq#</th>
<th>Barcode</th>
<th>Company Name</th>
<th>Value</th>
</tr>
</thead>
<tbody>
<g:each in="${invoice.vouchers}">
<tr>
<td></td>
<td>${it.sequenceNumber}</td>
<td>${it.barcodeAlpha}</td>
<td>${it.voucherRequest.client.name}</td>
<td><g:formatNumber number="${it.value}" format="###.##" /></td>
</tr>
</g:each>
</tbody>
</table>
</div>
</body>
</html>

0 comments on commit bcc099b

Please sign in to comment.