Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.Locale;

public class ClaimActivity extends AppCompatActivity {

Expand Down Expand Up @@ -317,8 +318,8 @@ public void onDateSet(DatePicker view, int Selectedyear, int SelectedMonth, int
year = Selectedyear;
month = SelectedMonth;
day = SelectedDay;

etStartDate.setText(new StringBuilder().append(day).append("/").append(month + 1).append("/").append(year));
Date date = new Date(year-1900,month,day);
etStartDate.setText(new SimpleDateFormat("yyyy-MM-dd", Locale.US).format(date));

if(etEndDate.getText().length()==0){
etEndDate.setText(etStartDate.getText().toString());
Expand All @@ -333,8 +334,8 @@ public void onDateSet(DatePicker view, int SelectedYear, int SelectedMonth, int
year = SelectedYear;
month = SelectedMonth;
day = SelectedDay;

etEndDate.setText(new StringBuilder().append(day).append("/").append(month + 1).append("/").append(year));
Date date = new Date(year-1900,month,day);
etEndDate.setText(new SimpleDateFormat("yyyy-MM-dd", Locale.US).format(date));
}
};

Expand Down Expand Up @@ -538,18 +539,18 @@ private boolean isValidData(){
String StartDate;
String EndDate;
String CurrentDate1;
String pattern = "dd/MM/yyyy";
String pattern = "yyyy-MM-dd";

Date Current_date = null;
Date Start_date = null;
Date End_date = null;

SimpleDateFormat format = new SimpleDateFormat(pattern);
SimpleDateFormat format = new SimpleDateFormat(pattern, Locale.US);

//CurrentDate = Date.parse(CurrentDate1);
//StartDate = Date.parse(etStartDate.getText().toString());
//EndDate = Date.parse(etEndDate.getText().toString());
CurrentDate1 = new SimpleDateFormat("dd/MM/yyyy").format(new Date());
CurrentDate1 = format.format(new Date());
StartDate = etStartDate.getText().toString();
EndDate = etEndDate.getText().toString();

Expand Down Expand Up @@ -589,7 +590,7 @@ private boolean isValidData(){
return false;
}
//if(tvTotal.getText().length() == 0) tvTotal.setText("0");
if (Float.valueOf(tvItemTotal.getText().toString()) + Float.valueOf(tvServiceTotal.getText().toString()) == 0) {
if (Float.parseFloat(tvItemTotal.getText().toString()) + Float.parseFloat(tvServiceTotal.getText().toString()) == 0) {
ShowDialog(tvItemTotal, getResources().getString(R.string.MissingClaim));
return false;
}
Expand Down Expand Up @@ -660,7 +661,7 @@ private void WriteXML(){
File MyDir = new File(Path);

//Create a file name
SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd", Locale.US);
Calendar cal = Calendar.getInstance();
String d = format.format(cal.getTime());

Expand All @@ -682,7 +683,7 @@ private void WriteXML(){

serializer.setOutput(fos, "UTF-8");

serializer.startDocument(null, Boolean.valueOf(true));
serializer.startDocument(null, true);

serializer.setFeature("http://xmlpull.org/v1/doc/features.html#indent-output", true);

Expand All @@ -694,7 +695,7 @@ private void WriteXML(){

//ClaimDate
serializer.startTag(null, "ClaimDate");
format = new SimpleDateFormat("dd/MM/yyyy");
format = new SimpleDateFormat("dd-MM-yyyy", Locale.US);
d = format.format(cal.getTime());
serializer.text(d);
serializer.endTag(null, "ClaimDate");
Expand Down Expand Up @@ -873,7 +874,7 @@ private void WriteJSON(){
sql.onOpen(db);

//Create a file name
SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd", Locale.US);
Calendar cal = Calendar.getInstance();
String d = format.format(cal.getTime());

Expand All @@ -892,8 +893,6 @@ private void WriteJSON(){
JSONObject FullObject = new JSONObject();
JSONObject ClaimObject = new JSONObject();


format = new SimpleDateFormat("dd/MM/yyyy");
d = format.format(cal.getTime());
//ClaimDate
ClaimObject.put("ClaimDate", d);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,18 +68,6 @@ public ClaimsAdapter(Context rContext, JSONArray _claims){
_context = rContext;
claims = _claims;
global = (Global)rContext.getApplicationContext();

try {
for (int i = 0; i < _claims.length(); i++) {
JSONObject claim = claims.getJSONObject(i);
claim.put("date_claimed", parseDate(claims.getJSONObject(i).getString("date_claimed")));
claim.put("visit_date_from", parseDate(claims.getJSONObject(i).getString("visit_date_from")));
claim.put("visit_date_to", parseDate(claims.getJSONObject(i).getString("visit_date_to")));
}
} catch ( JSONException e )
{
e.printStackTrace();
}
}


Expand Down Expand Up @@ -224,19 +212,16 @@ public Reportmsg(final View itemView) {
super(itemView);


itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
try {
obj = claims.getJSONObject(getAdapterPosition());
} catch (JSONException e) {
e.printStackTrace();
}
Intent intent = new Intent(_context, ClaimReview.class);
intent.putExtra("claims", String.valueOf(obj));
_context.startActivity(intent);

itemView.setOnClickListener(view -> {
try {
obj = claims.getJSONObject(getAdapterPosition());
} catch (JSONException e) {
e.printStackTrace();
}
Intent intent = new Intent(_context, ClaimReview.class);
intent.putExtra("claims", String.valueOf(obj));
_context.startActivity(intent);

});

claimNo = (TextView) itemView.findViewById(R.id.claimNo);
Expand All @@ -254,28 +239,9 @@ protected AlertDialog ShowDialog(String msg){
return new AlertDialog.Builder(_context)
.setMessage(msg)
.setCancelable(false)
.setPositiveButton(_context.getResources().getString(R.string.Ok), new DialogInterface.OnClickListener() {

@Override
public void onClick(DialogInterface dialog, int which) {
//et.requestFocus();
return;
}
.setPositiveButton(_context.getResources().getString(R.string.Ok), (dialog, which) -> {
//et.requestFocus();
return;
}).show();
}

private String parseDate(String date)
{
SimpleDateFormat fromApiFormat = new SimpleDateFormat("yyyy/MM/dd");
SimpleDateFormat databaseFormat = new SimpleDateFormat("dd/MM/yyyy");
String parsedDate = null;

try {
parsedDate = databaseFormat.format(fromApiFormat.parse(date));
} catch ( ParseException e ) {
e.printStackTrace();
parsedDate = date;
}
return parsedDate;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ public AlertDialog confirmRefreshMap() {
(dialog, i) -> {
try {
JSONObject object1 = new JSONObject();
object1.put("last_update_date", new SimpleDateFormat("yyyy/MM/dd", Locale.US).format(new Date(0)));
object1.put("last_update_date", new SimpleDateFormat("yyyy-MM-dd", Locale.US).format(new Date(0)));
DownLoadDiagnosesServicesItemsAgain(object1, sql);
} catch (Exception e) {
e.printStackTrace();
Expand Down Expand Up @@ -584,7 +584,7 @@ public void validateClaimAdminCode(final String ClaimCode) {

pd.dismiss();
JSONObject object = new JSONObject();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy/MM/dd");
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd", Locale.US);
String dateS = formatter.format(new Date(0));
object.put("last_update_date", dateS);
try {
Expand All @@ -608,7 +608,7 @@ public void validateClaimAdminCode(final String ClaimCode) {

pd.dismiss();
JSONObject object = new JSONObject();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy/MM/dd");
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd", Locale.US);
String dateS = formatter.format(new Date(0));
object.put("last_update_date", dateS);
try {
Expand Down