-
Notifications
You must be signed in to change notification settings - Fork 15
fix print user policy renewals #236
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
vaneck237
wants to merge
1
commit into
openimis:develop
Choose a base branch
from
mngoe:OP-3024
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
app/src/main/graphql/org.openimis.imispolicies/GetPolicyRenewals.graphql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| query GetPolicyRenewals($officerCode: String) { | ||
| policies(stage: "R", officer_Code: $officerCode, orderBy: ["-enrollDate"]){ | ||
| edges { | ||
| node { | ||
| id | ||
| uuid | ||
| startDate | ||
| product { | ||
| id | ||
| code | ||
| name | ||
| } | ||
| officer { | ||
| id | ||
| code | ||
| } | ||
| family { | ||
| headInsuree { | ||
| id | ||
| chfId | ||
| lastName | ||
| otherNames | ||
| phone | ||
| currentVillage { | ||
| name | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -57,16 +57,20 @@ | |
| import org.openimis.imispolicies.network.exception.HttpException; | ||
| import org.openimis.imispolicies.tools.Log; | ||
| import org.openimis.imispolicies.usecase.FetchPolicyRenewals; | ||
| import org.openimis.imispolicies.util.DateUtils; | ||
| import org.openimis.imispolicies.util.FileUtils; | ||
| import org.openimis.imispolicies.util.UriUtils; | ||
|
|
||
| import java.io.File; | ||
| import java.net.HttpURLConnection; | ||
| import java.text.ParseException; | ||
| import java.text.SimpleDateFormat; | ||
| import java.util.ArrayList; | ||
| import java.util.Calendar; | ||
| import java.util.Date; | ||
| import java.util.HashMap; | ||
| import java.util.List; | ||
| import java.util.Locale; | ||
| import java.util.Map; | ||
|
|
||
| public class RenewList extends AppCompatActivity { | ||
|
|
@@ -280,6 +284,7 @@ private void fillRenewals() { | |
|
|
||
| ClientAndroidInterface ca = new ClientAndroidInterface(this); | ||
| String result = ca.OfflineRenewals(OfficerCode); | ||
| Log.e("policy renewals", result); | ||
| JSONObject object; | ||
|
|
||
| try { | ||
|
|
@@ -312,13 +317,16 @@ private void fillRenewals() { | |
| for (int i = 0; i < jsonArray.length(); i++) { | ||
|
|
||
| object = jsonArray.getJSONObject(i); | ||
| SimpleDateFormat inputFormat = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy", Locale.ENGLISH); | ||
| SimpleDateFormat outputFormat = new SimpleDateFormat("dd-MM-yyyy", Locale.ENGLISH); | ||
| Date promptDate = inputFormat.parse(object.getString("RenewalPromptDate")); | ||
| HashMap<String, String> renewal = new HashMap<>(); | ||
| renewal.put("RenewalId", object.getString("RenewalId")); | ||
| renewal.put("CHFID", object.getString("CHFID")); | ||
| renewal.put("FullName", object.getString("LastName") + " " + object.getString("OtherNames")); | ||
| renewal.put("Product", object.getString("ProductCode") + " : " + object.getString("ProductName")); | ||
| renewal.put("VillageName", object.getString("VillageName")); | ||
| renewal.put("RenewalPromptDate", object.getString("RenewalPromptDate")); | ||
| renewal.put("RenewalPromptDate", format.format(promptDate)); | ||
| renewal.put("PolicyId", object.getString("PolicyId")); | ||
| renewal.put("ProductCode", object.getString("ProductCode")); | ||
| renewal.put("LocationId", object.getString("LocationId")); | ||
|
|
@@ -337,6 +345,8 @@ private void fillRenewals() { | |
|
|
||
| } catch (JSONException e) { | ||
| e.printStackTrace(); | ||
| } catch (ParseException e) { | ||
| throw new RuntimeException(e); | ||
| } | ||
|
|
||
| } | ||
|
|
@@ -347,7 +357,8 @@ private void refreshRenewals() { | |
| new Thread(() -> { | ||
|
|
||
| try { | ||
| List<PolicyRenewal> renewals = new FetchPolicyRenewals().execute(); | ||
| List<PolicyRenewal> renewals = new FetchPolicyRenewals().execute(OfficerCode); | ||
| Log.e("renewals", toJson(renewals).toString()); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove log line? |
||
| ca.InsertRenewalsFromApi(toJson(renewals)); | ||
| runOnUiThread(this::fillRenewals); | ||
| } catch (Exception e) { | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove log line