Skip to content

Commit

Permalink
WD| Fix Count at each of the registers #4
Browse files Browse the repository at this point in the history
  • Loading branch information
baksosapi committed Nov 17, 2017
1 parent e2f5bb9 commit 5be349b
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -430,32 +430,32 @@ private void updateRegisterCounts(HomeContext homeContext) {
// kicount = 10;
kicountcursor.close();

// Cursor kbcountcursor = context().commonrepository("ec_kartu_ibu").rawCustomQueryForAdapter(
// sqb.queryForCountOnRegisters(
// "ec_kartu_ibu_search",
// "ec_kartu_ibu_search.is_closed=0 and jenisKontrasepsi !='0'" ));
// kbcountcursor.moveToFirst();
// int kbcount = kbcountcursor.getInt(0);
// kbcountcursor.close();
Cursor kbcountcursor = context().commonrepository("ec_kartu_ibu").rawCustomQueryForAdapter(
sqb.queryForCountOnRegisters(
"ec_kartu_ibu_search",
"ec_kartu_ibu_search.is_closed=0 and jenisKontrasepsi !='0'" ));
kbcountcursor.moveToFirst();
int kbcount = kbcountcursor.getInt(0);
kbcountcursor.close();


// ec_ibu_search no table
// Cursor anccountcursor = context().commonrepository("ec_ibu").rawCustomQueryForAdapter(
// sqb.queryForCountOnRegisters(
// "ec_ibu_search",
// "ec_ibu_search.is_closed=0 "));
// anccountcursor.moveToFirst();
// int anccount = anccountcursor.getInt(0);
// anccountcursor.close();

Cursor anccountcursor = context().commonrepository("ec_ibu").rawCustomQueryForAdapter(
sqb.queryForCountOnRegisters(
"ec_ibu_search",
"ec_ibu_search.is_closed=0 "));
anccountcursor.moveToFirst();
int anccount = anccountcursor.getInt(0);
anccountcursor.close();
//
// No pnc_search
// Cursor pnccountcursor = context().commonrepository("ec_pnc").rawCustomQueryForAdapter(
// sqb.queryForCountOnRegisters(
// "ec_pnc_search",
// "ec_pnc_search.is_closed=0 AND (ec_pnc_search.keadaanIbu ='hidup' OR ec_pnc_search.keadaanIbu IS NULL) ")); // and ec_pnc_search.keadaanIbu LIKE '%hidup%'
// pnccountcursor.moveToFirst();
// int pnccount = pnccountcursor.getInt(0);
// pnccountcursor.close();
Cursor pnccountcursor = context().commonrepository("ec_pnc").rawCustomQueryForAdapter(
sqb.queryForCountOnRegisters(
"ec_pnc_search",
"ec_pnc_search.is_closed=0 AND (ec_pnc_search.keadaanIbu ='hidup' OR ec_pnc_search.keadaanIbu IS NULL) ")); // and ec_pnc_search.keadaanIbu LIKE '%hidup%'
pnccountcursor.moveToFirst();
int pnccount = pnccountcursor.getInt(0);
pnccountcursor.close();

Cursor childcountcursor = context().commonrepository("anak").rawCustomQueryForAdapter(
sqb.queryForCountOnRegisters(
Expand All @@ -466,9 +466,9 @@ private void updateRegisterCounts(HomeContext homeContext) {
childcountcursor.close();

ecRegisterClientCountView.setText(valueOf(kicount));
// kartuIbuANCRegisterClientCountView.setText(valueOf(anccount));
// kartuIbuPNCRegisterClientCountView.setText(valueOf(pnccount));
kartuIbuANCRegisterClientCountView.setText(valueOf(anccount));
kartuIbuPNCRegisterClientCountView.setText(valueOf(pnccount));
anakRegisterClientCountView.setText(valueOf(childcount));
// kohortKbCountView.setText(valueOf(kbcount));
kohortKbCountView.setText(valueOf(kbcount));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -116,45 +116,62 @@ private void updateConfiguration(Configuration config) {
}

private static String[] getFtsSearchFields(String tableName){
if(tableName.equals("ec_anak")){
return new String[]{ "namaBayi","tanggalLahirAnak" };
// return ftsSearchFields;
} else if (tableName.equals("ec_kartu_ibu")){
return new String[]{ "namalengkap", "namaSuami" };
// return ftsSearchFields;
if(tableName.equals("ec_kartu_ibu")){
String[] ftsSearchFields = { "namalengkap", "namaSuami" };
return ftsSearchFields;
} else if(tableName.equals("ec_anak")){
String[] ftsSearchFields = { "namaBayi" };
return ftsSearchFields;
} else if (tableName.equals("ec_ibu")){
String[] ftsSearchFields = { "namalengkap", "namaSuami"};
return ftsSearchFields;
}
else if (tableName.equals("ec_pnc")) {
String[] ftsSearchFields = {"namalengkap", "namaSuami"};
return ftsSearchFields;
}
return null;
}

private static String[] getFtsSortFields(String tableName){
if(tableName.equals("ec_anak")){
String[] sortFields = { "namaBayi","tanggalLahirAnak"};
if(tableName.equals("ec_kartu_ibu")) {
String[] sortFields = { "namalengkap", "umur", "noIbu", "htp"};
return sortFields;
} else if(tableName.equals("ec_anak")){
String[] sortFields = { "namaBayi", "tanggalLahirAnak" };
return sortFields;
} else if(tableName.equals("ec_kartu_ibu")){
String[] sortFields = { "namalengkap", "namaSuami"};
} else if(tableName.equals("ec_ibu")){
String[] sortFields = { "namalengkap", "umur", "noIbu", "pptest" , "htp" };
return sortFields;
} else if(tableName.equals("ec_pnc")){
String[] sortFields = { "namalengkap", "umur", "noIbu", "keadaanIbu"};
return sortFields;
}
return null;
}

private static String[] getFtsMainConditions(String tableName){
if(tableName.equals("ec_anak")){
String[] mainConditions = {"is_closed", "details" , "namaBayi"};
if(tableName.equals("ec_kartu_ibu")) {
String[] mainConditions = { "is_closed", "jenisKontrasepsi" };
return mainConditions;
} else if(tableName.equals("ec_anak")){
String[] mainConditions = { "is_closed", "relational_id" };
return mainConditions;
} else if(tableName.equals("ec_kartu_ibu")){
String[] mainConditions = { "is_closed", "namalengkap"};
} else if(tableName.equals("ec_ibu")){
String[] mainConditions = { "is_closed", "type", "pptest" , "kartuIbuId" };
return mainConditions;
} else if(tableName.equals("ec_pnc")){
String[] mainConditions = { "is_closed","keadaanIbu" , "type"};
return mainConditions;
}
return null;
}

/* private String[] getFtsTables(){
String[] ftsTables = { "ec_anak", "ec_kartu_ibu" };
return ftsTables;
}*/

private static String[] getFtsTables() {
return new String[]{"ec_anak", "ec_kartu_ibu" };
String[] ftsTables = { "ec_kartu_ibu", "ec_anak", "ec_ibu", "ec_pnc" };

return ftsTables;
}
public static CommonFtsObject createCommonFtsObject(){
CommonFtsObject commonFtsObject = new CommonFtsObject(getFtsTables());
Expand Down

0 comments on commit 5be349b

Please sign in to comment.