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
1 change: 0 additions & 1 deletion app/src/main/assets/pages/Policy.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ $(document).ready(function () {
$('#txtExpiryDate').val(ExpiryDate);

if(Android.IsBulkCNUsed()) {
console.log(typeof $Policy[0]["ControlNumber"]);
if($Policy[0]["ControlNumber"]) {
$('#AssignedControlNumber').val($Policy[0]["ControlNumber"]).prop('readonly', true);
} else {
Expand Down
143 changes: 0 additions & 143 deletions app/src/main/java/org/openimis/imispolicies/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -426,29 +426,6 @@ public void onClick(DialogInterface dialog, int id) {
}
});

// Showing Alert Dialog
alertDialog2.show();
}

public void openDialogMsg(String msg) {
AlertDialog.Builder alertDialog2 = new AlertDialog.Builder(
MainActivity.this);

// Setting Dialog Title
alertDialog2.setTitle(getResources().getString(R.string.Incomplete));
alertDialog2.setMessage(msg);

// Setting Icon to Dialog
// alertDialog2.setIcon(R.drawable.delete);

// Setting Positive "Yes" Btn
alertDialog2.setPositiveButton(getResources().getString(R.string.Ok),
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
// Write your code here to execute after dialog
}
});

// Showing Alert Dialog
alertDialog2.show();
}
Expand Down Expand Up @@ -619,44 +596,6 @@ public String getMasterDataText2(String fileName, String password) {
return aBuffer;
}

public String getMasterDataText(String filename) {
ca.unZip(filename);
String fname = "MasterData.txt";
try {
String dir = global.getSubdirectory("Database");
File myFile = new File(dir, fname);//"/"+dir+"/MasterData.txt"
// BufferedReader myReader = new BufferedReader(
// new InputStreamReader(
// new FileInputStream(myFile), "UTF32"));
FileInputStream fIn = new FileInputStream(myFile);
BufferedReader myReader = new BufferedReader(new InputStreamReader(fIn));
aBuffer = myReader.readLine();

myReader.close();
/* Scanner in = new Scanner(new FileReader("/"+dir+"/MasterData.txt"));
StringBuilder sb = new StringBuilder();
while(in.hasNext()) {
sb.append(in.next());
}
in.close();
aBuffer = sb.toString();*/
} catch (IOException e) {
e.printStackTrace();
}
return aBuffer;
}

private int getCheckedMenuItem() {
Menu menu = navigationView.getMenu();
for (int i = 0; i < menu.size(); i++) {
MenuItem menuItem = menu.getItem(i);
if (menuItem.isChecked())
return menuItem.getItemId();
}
return -1;
}


private boolean copyDatabase(Context context) {
try {
InputStream inputStream = getApplicationContext().getAssets().open("database/" + SQLHandler.DBNAME);
Expand Down Expand Up @@ -985,88 +924,6 @@ public static boolean hasPermissions(Context context, String... permissions) {
return true;
}

public void LoginDialogBox(final String page) {
if (!ca.CheckInternetAvailable())
return;

global = (Global) MainActivity.this.getApplicationContext();
// get prompts.xml view
LayoutInflater li = LayoutInflater.from(this);
View promptsView = li.inflate(R.layout.login_dialog, null);

AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this);

// set prompts.xml to alertdialog builder
alertDialogBuilder.setView(promptsView);

final TextView username = (TextView) promptsView.findViewById(R.id.UserName);
final TextView password = (TextView) promptsView.findViewById(R.id.Password);

username.setText(global.getOfficerCode());

// set dialog message
alertDialogBuilder
.setCancelable(false)
.setPositiveButton(MainActivity.this.getResources().getString(R.string.button_ok),
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
if (!username.getText().toString().equals("") && !password.getText().toString().equals("")) {

new Thread() {
public void run() {
ClientAndroidInterface cai = new ClientAndroidInterface(context);
isUserLogged = cai.LoginToken(username.getText().toString(), password.getText().toString());

runOnUiThread(new Runnable() {
@Override
public void run() {
SetLoggedIn(MainActivity.this.getResources().getString(R.string.Login), MainActivity.this.getResources().getString(R.string.Logout));
}
});

runOnUiThread(new Runnable() {
@Override
public void run() {
if (isUserLogged) {
if (page.equals("Enquire")) {
Intent intent = new Intent(MainActivity.this, Enquire.class);
startActivity(intent);
Toast.makeText(MainActivity.this, MainActivity.this.getResources().getString(R.string.Login_Successful), Toast.LENGTH_LONG).show();
}
if (page.equals("Reports")) {
Intent intent = new Intent(MainActivity.this, Reports.class);
startActivity(intent);
Toast.makeText(MainActivity.this, MainActivity.this.getResources().getString(R.string.Login_Successful), Toast.LENGTH_LONG).show();
}

} else {
ca.ShowDialog(MainActivity.this.getResources().getString(R.string.LoginFail));
}
}
});

}
}.start();


} else {
Toast.makeText(MainActivity.this, MainActivity.this.getResources().getString(R.string.Enter_Credentials), Toast.LENGTH_LONG).show();
}
}
}).setNegativeButton(MainActivity.this.getResources().getString(R.string.button_cancel),
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
});

// create alert dialog
AlertDialog alertDialog = alertDialogBuilder.create();

// show it
alertDialog.show();
}

public String getSelectedLanguage() {
return selectedLanguage;
}
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/java/org/openimis/imispolicies/SQLHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -863,13 +863,13 @@ public int getFreeCNCount(String officerCode, String productCode) {

public int getAssignedCNCount(String officerCode) {
return getCount(tblBulkControlNumbers,
"PolicyId IS NOT NULL AND OfficerCode = ?",
"PolicyId IS NOT NULL AND UPPER(OfficerCode) = UPPER(?)",
new String[]{officerCode});
}

public int getFreeCNCount(String officerCode) {
return getCount(tblBulkControlNumbers,
"PolicyId IS NULL AND OfficerCode = ?",
"PolicyId IS NULL AND UPPER(OfficerCode) = UPPER(?)",
new String[]{officerCode});
}

Expand Down Expand Up @@ -957,7 +957,7 @@ public boolean assignCnToPolicy(int policyId, String controlNumber) {
} else {
openDatabase();
JSONArray policyData = cursorToJsonArray(mDatabase.rawQuery(
"SELECT po.PolicyValue, UPPER(pr.ProductCode) FROM tblPolicy po INNER JOIN tblProduct pr on pr.ProdId=po.ProdIdgit s WHERE PolicyId = ?",
"SELECT po.PolicyValue, UPPER(pr.ProductCode) as ProductCode FROM tblPolicy po INNER JOIN tblProduct pr on pr.ProdId=po.ProdId WHERE PolicyId = ?",
new String[]{String.valueOf(policyId)}));

if (policyData.length() == 0) {
Expand Down