Commit 2c5c3a4b authored by Bhavesh Yadav's avatar Bhavesh Yadav

Fixed reprint ticket

parent e86eb612
......@@ -24,6 +24,7 @@ public class checkout extends Activity {
Button checkout;
String slot_number,ticket_number;
LinearLayout innerll;
ArrayList ticketData;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
......@@ -73,7 +74,8 @@ public class checkout extends Activity {
sqlite_ops so=new sqlite_ops(this);
if(so.check_out(slot_number,Long.parseLong(ticket_number))){
Intent i = new Intent(this, ticket.class);
i.putExtra("ticket_no", Long.parseLong(ticket_number));
i.putExtra("ticket_data", ticketData);
i.putExtra("ticket_no",ticket_number);
i.putExtra("checkout",true);
startActivity(i);
Toast.makeText(this,"Successfully,Checked Out",Toast.LENGTH_SHORT).show();
......@@ -108,7 +110,8 @@ public class checkout extends Activity {
}
else {
Intent i = new Intent(this, ticket.class);
i.putExtra("ticket_no", Long.parseLong(ticket_number));
i.putExtra("ticket_data", ticketData);
i.putExtra("ticket_no", ticket_number);
startActivity(i);
}
}
......@@ -154,6 +157,7 @@ public class checkout extends Activity {
Date date = new Date(datetime*1000);
Format format = new SimpleDateFormat("dd/MM/yy HH:mm");
String dateString = format.format(date);
data.add(3,dateString);
date_tv.setText(dateString);
vehicle.setText(data.get(2).toString());
mobile.setText(data.get(5).toString());
......@@ -162,5 +166,6 @@ public class checkout extends Activity {
slot_number=data.get(1).toString();
ticket_number=data.get(0).toString();
innerll.setVisibility(View.VISIBLE);
ticketData = data;
}
}
......@@ -74,7 +74,7 @@ public class login_activity extends Activity {
|| conMgr.getNetworkInfo(ConnectivityManager.TYPE_WIFI).getState() == NetworkInfo.State.CONNECTED) {
// notify user you are not online
Toast.makeText(login_activity.this,"YOU ARE OFFLINE",Toast.LENGTH_SHORT).show();
Toast.makeText(login_activity.this,"YOU ARE ONLINE",Toast.LENGTH_SHORT).show();
logmsg.setText("You are online");
logmsg.setVisibility(View.INVISIBLE);
......
......@@ -345,7 +345,7 @@ public class sqlite_ops extends SQLiteOpenHelper{
public ArrayList fetch_ticket_detail(long ticket){
ArrayList al=new ArrayList();
SQLiteDatabase db=this.getWritableDatabase();
Cursor cr=db.query("records",new 'String []{"name","mobile","tkt_no","slot","vehicle","check_in","isempty"},"tkt_no=?",new String[]{Long.toString(ticket)},null,null,null,null);
Cursor cr=db.query("records",new String []{"name","mobile","tkt_no","slot","vehicle","check_in","isempty"},"tkt_no=?",new String[]{Long.toString(ticket)},null,null,null,null);
if(cr!=null){
cr.moveToFirst();
if(cr.getCount()>0){
......
......@@ -13,6 +13,7 @@ import java.util.ArrayList;
public class ticket extends Activity {
TextView slot,tkt,time_tv,date_tv,vehicle,ticket_title,checkout_label,checkout_time;
TextView checkout_date_label,checkout_date;
ArrayList ticketData;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
......@@ -30,16 +31,17 @@ public class ticket extends Activity {
checkout_date_label=findViewById(R.id.checkout_date_label);
Intent i=getIntent();
long ticket_no;
if(i.hasExtra("ticket_no")){
Bundle b=i.getExtras();
ticket_no=b.getLong("ticket_no");
if(i.hasExtra("ticket_data")){
// Bundle b=i.getExtras();
// ticket_no=b.getLong("ticket_no");
ticketData = (ArrayList<String>) i.getSerializableExtra("ticket_data");
}
else{
ticket_no=10000;
}
sqlite_ops so=new sqlite_ops(this);
ArrayList data=so.getTicketDetails(ticket_no);
//sqlite_ops so=new sqlite_ops(this);
//ArrayList data=so.getTicketDetails(ticket_no);
if(i.hasExtra("checkout")){
Log.d("CHECKOUT","successfully checkout out");
ticket_title.setText("Checkout Receipt");
......@@ -47,7 +49,7 @@ public class ticket extends Activity {
checkout_time.setVisibility(View.VISIBLE);
checkout_date.setVisibility(View.VISIBLE);
checkout_date_label.setVisibility(View.VISIBLE);
String checkout_date_data=data.get(4).toString();
String checkout_date_data=ticketData.get(4).toString();
String[] checkoutdateandtime=checkout_date_data.split(" ");
checkout_date.setText(checkoutdateandtime[0]);
checkout_time.setText(checkoutdateandtime[1]);
......@@ -58,13 +60,13 @@ public class ticket extends Activity {
checkout_date.setVisibility(View.INVISIBLE);
checkout_date_label.setVisibility(View.INVISIBLE);
}
slot.setText(data.get(1).toString());
tkt.setText(data.get(0).toString());
String date_data=data.get(3).toString();
slot.setText(ticketData.get(1).toString());
tkt.setText(ticketData.get(0).toString().substring(0,4).toUpperCase());
String date_data=ticketData.get(3).toString();
String[] dateandtime=date_data.split(" ");
date_tv.setText(dateandtime[0]);
time_tv.setText(dateandtime[1]);
vehicle.setText(data.get(2).toString());
vehicle.setText(ticketData.get(2).toString());
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment