Openbravo Issue Tracking System - Java Client POS
View Issue Details
0004499Java Client POS(No Category)public2008-07-24 09:102008-10-07 11:47
jbablittle 
 
normalminorhave not tried
acknowledgedopen 
5
 
 
0004499: New methods suggestion for TicketInfo
Seeing messages in the OpenbravoPOS forum concerning more elaborate ticket printing I wrote a few extra methods which can make things easier in template writing. The three methods return integer values which seem easier to use in Velocity conditional statements.

This should help people that what personalized text on a ticket based on hour of day, day of week or month of year.

One use is printing a discount coupon at the end of a receipt depending upon time of day ( Happy Hour in a bar or restaurant)

The methods just use the present time instance and are not meant to be used when modifying older tickets.

These methods should be able to be dropped into TicketInfo.java with no influence of normal operation.

Jim
public int printHour(){
Calendar now = Calendar.getInstance();
return now.get(Calendar.HOUR);
}
 
public int printDay(){
Calendar now = Calendar.getInstance();
return now.get(Calendar.DAY_OF_WEEK);
}
 
public int printMonth(){
Calendar now = Calendar.getInstance();
return 1+ now.get(Calendar.MONTH); // normally months start with 0 for January. This makes the return value more human freindly January 1, Febuary 2 etc
}
No tags attached.
Issue History
2008-07-24 09:10jbablittleNew Issue
2008-07-24 09:10jbablittlesf_bug_id0 => 2026465
2008-10-07 11:47adrianromeroStatusnew => acknowledged
2012-11-07 09:40priyamCategory01 - General => (No Category)

There are no notes attached to this issue.