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
2 changes: 1 addition & 1 deletion claimManagement/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ android {
minSdkVersion 23
targetSdkVersion 32
versionCode 4
versionName "1.1.7"
versionName "1.1.8"
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
}
buildTypes {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
import android.database.Cursor;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
Expand Down Expand Up @@ -318,13 +319,23 @@ public boolean onOptionsItemSelected(MenuItem item) {
private void addItem() {
Intent addItemsIntent = new Intent(ClaimActivity.this, AddItems.class);
addItemsIntent.putExtra(EXTRA_READONLY, isIntentReadonly());
ClaimActivity.this.startActivity(addItemsIntent);
Cursor c = sqlHandler.getMapping("I");
if(c != null && c.getCount() == 0){
showDialog(getResources().getString(R.string.NoItemsPricelist));
}else {
ClaimActivity.this.startActivity(addItemsIntent);
}
}

private void addService() {
Intent addServicesIntent = new Intent(this, AddServices.class);
addServicesIntent.putExtra(EXTRA_READONLY, isIntentReadonly());
ClaimActivity.this.startActivity(addServicesIntent);
Cursor c = sqlHandler.getMapping("S");
if(c != null && c.getCount() == 0){
showDialog(getResources().getString(R.string.NoServicesPricelist));
}else {
ClaimActivity.this.startActivity(addServicesIntent);
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -553,8 +553,9 @@ public void validateClaimAdminCode(final String claimAdminCode) {
AdminName.setText(global.getOfficeName());
}
Cursor c = sqlHandler.getMapping("I");
if (c != null) {
if (c.getCount() == 0) {
Cursor c1 = sqlHandler.getMapping("S");
if (c != null && c1 != null) {
if (c.getCount() == 0 && c1.getCount() == 0) {
try {
progressDialog.dismiss();
doLoggedIn(() -> CheckHealthFacility(claimAdminCode, HealthFacilityName));
Expand Down Expand Up @@ -710,23 +711,24 @@ private void DownLoadServicesItemsPriceList(@NonNull final String claimAdministr
public void run() {
try {
PaymentList paymentList = new FetchPaymentList().execute(claimAdministratorCode);
String servicesPricelistUuid = paymentList.getServicesPricelistUuid();
Date date = Calendar.getInstance().getTime();
List<Service> services = new FetchServices().execute(servicesPricelistUuid, date);
String itemsPriceListUuid = paymentList.getItemsPricelistUuid();
List<Medication> medications = new FetchMedications().execute(itemsPriceListUuid, date);
sqlHandler.ClearMapping("S");
sqlHandler.ClearMapping("I");

//Insert Services
for (Service service : services) {
sqlHandler.InsertMapping(service.getCode(), service.getName(), "S");
if(paymentList.getServicesPricelistUuid() != null && !paymentList.getServicesPricelistUuid().isEmpty()){
List<Service> services = new FetchServices().execute(paymentList.getServicesPricelistUuid(), date);
for (Service service : services) {
sqlHandler.InsertMapping(service.getCode(), service.getName(), "S");
}
}

//Insert Items
for (Medication medication : medications) {
sqlHandler.InsertMapping(medication.getCode(), medication.getName(), "I");
if(paymentList.getItemsPricelistUuid() != null && !paymentList.getItemsPricelistUuid().isEmpty()){
List<Medication> medications = new FetchMedications().execute(paymentList.getItemsPricelistUuid(), date);
for (Medication medication : medications) {
sqlHandler.InsertMapping(medication.getCode(), medication.getName(), "I");
}
}

runOnUiThread(() -> {
progressDialog.dismiss();
Toast.makeText(MainActivity.this, getResources().getString(R.string.MapSuccessful), Toast.LENGTH_LONG).show();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
import org.openimis.imisclaims.network.util.PaginatedResponseUtils;
import org.openimis.imisclaims.util.DateUtils;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

public class FetchDiagnosesServicesItems {

Expand Down Expand Up @@ -53,17 +55,13 @@ public DiagnosesServicesMedications execute() throws Exception {
// previous code was passing sometimes a `last_updated_date` but it was either empty or
// `new Date(0)`. I'm still returning the last updated date in case it's one day used
// again.¯\_(ツ)_/¯
List<Service> services = new ArrayList<>();
List<Medication> medications = new ArrayList<>();
return new DiagnosesServicesMedications(
/* lastUpdated = */ DateUtils.toDateString(new Date()),
/* diagnoses = */ Mapper.map(getDiagnosesRequest.get(), this::toDiagnosis),
/* services = */ PaginatedResponseUtils.downloadAll(
getActivityDefinitionsRequest::get,
this::toService
),
/* medications = */ PaginatedResponseUtils.downloadAll(
getMedicationsRequest::get,
this::toMedication
)
/* services = */ services,
/* medications = */ medications
);
}

Expand Down
5 changes: 4 additions & 1 deletion claimManagement/src/main/res/values-fr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@
<string name="reports">Rapports</string>
<string name="map_items">Lier des prod. méd.</string>
<string name="map_services">Lier des soins</string>
<string name="quit">Arrêter de fumer</string>
<string name="quit">Quitter</string>
<string name="about">À propos de</string>
<string name="home">Accueil</string>
<string name="Enter_Credentials">Veuillez entrer votre nom d\'utilisateur et votre mot de passe</string>
Expand Down Expand Up @@ -210,4 +210,7 @@
<string name="updateAvailable">Mise à jour disponible</string>
<string name="haveLastVersion">Vous avez la dernière version </string>
<string name="newVersion">Nouvelle version </string>
<string name="NoServicesPricelist">La formation sanitaire n\'a pas de liste de prix pour les services </string>
<string name="NoItemsPricelist">La formation sanitaire n\'a pas de liste de prix pour les produits </string>
<string name="entered">Entrée</string>
</resources>
2 changes: 2 additions & 0 deletions claimManagement/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -256,4 +256,6 @@
<string name="updateAvailable">Update available</string>
<string name="haveLastVersion">You have the last version </string>
<string name="newVersion">New version </string>
<string name="NoServicesPricelist">This healthfacility don\'t have services pricelist</string>
<string name="NoItemsPricelist">This healthfacility don\'t have items pricelist</string>
</resources>
Loading