正在查看: St.John's v1.0.9 应用的 OfferFeeDueDetailsActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: St.John's v1.0.9 应用的 OfferFeeDueDetailsActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.mcb.stjohnsemschool.activity;
import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Typeface;
import android.net.ConnectivityManager;
import android.os.Bundle;
import android.text.Html;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.ListView;
import android.widget.TableRow;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import com.mcb.stjohnsemschool.adapter.OfferFeeDuesAdapter;
import com.mcb.stjohnsemschool.model.FeeDueDetailsModelClass;
import com.mcb.stjohnsemschool.model.MakePaymentBranchSettingsModel;
import com.mcb.stjohnsemschool.model.OfferFeeDueDetailsModelClass;
import com.mcb.stjohnsemschool.services.ApiClient;
import com.mcb.stjohnsemschool.services.ApiInterface;
import com.mcb.stjohnsemschool.utils.Constants;
import com.mcb.stjohnsemschool.utils.TransparentProgressDialog;
import com.mcb.stjohnsemschool.utils.Utility;
import java.util.ArrayList;
import java.util.Iterator;
import org.json.JSONArray;
import org.json.JSONObject;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
public class OfferFeeDueDetailsActivity extends AppCompatActivity {
private static final String TAG = "com.mcb.stjohnsemschool.activity.OfferFeeDueDetailsActivity";
public static Typeface mMuseoSlab500;
Activity activity;
String branchId;
Context context;
int mAcademicYearId;
TextView mAccept;
CheckBox mAcceptChk;
TextView mCancel;
int mClassId;
TextView mContinue;
ListView mFeePaidDetails;
TableRow mOfferFeeDuesHeader;
TextView mPay;
private TransparentProgressDialog mProgressbar;
SharedPreferences mSharedPref;
TextView mShowNodataText;
String mStudentEnrollmentID;
Dialog mTermsConditionsDialog;
String mUserId;
String organisationId;
TextView payingTotalAmount_tv;
Button proceedToPay;
String studentEnrollmentCode;
String taxName = "";
ArrayList<FeeDueDetailsModelClass> offerFeeDuesList = new ArrayList<>();
String payingAmount = "0";
String url = "";
JSONArray jsonarray = new JSONArray();
JSONArray array = new JSONArray();
private int themeId = 0;
private int concessionSettingId = 0;
protected void onCreate(Bundle bundle) {
super.onCreate(bundle);
setContentView(R.layout.activity_offer_fee_due_details);
Constants.setAppTheme(getApplicationContext(), getWindow(), getSupportActionBar());
this.activity = this;
this.context = getApplicationContext();
getSupportActionBar().setTitle("Offer Fee Due Details");
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
SharedPreferences sharedPreferences = this.context.getSharedPreferences("", 0);
this.mSharedPref = sharedPreferences;
this.mUserId = sharedPreferences.getString("UseridKey", this.mUserId);
this.mStudentEnrollmentID = this.mSharedPref.getString("studentEnrollmentIdKey", this.mStudentEnrollmentID);
this.studentEnrollmentCode = this.mSharedPref.getString("EnrollmentCode", this.studentEnrollmentCode);
this.branchId = this.mSharedPref.getString("BranchIdKey", this.branchId);
this.organisationId = this.mSharedPref.getString("orgnizationIdKey", this.organisationId);
this.mAcademicYearId = this.mSharedPref.getInt("AcademicYearId", this.mAcademicYearId);
this.mClassId = this.mSharedPref.getInt("AcademicClassId", this.mClassId);
this.concessionSettingId = getIntent().getIntExtra("ConcessionSettingId", this.concessionSettingId);
this.themeId = this.mSharedPref.getInt("ThemeIdKey", this.themeId);
mMuseoSlab500 = Typeface.createFromAsset(this.context.getAssets(), "Roboto-Regular.ttf");
setUpIds();
}
public boolean onOptionsItemSelected(MenuItem menuItem) {
if (menuItem.getItemId() == 16908332) {
onBackPressed();
return true;
}
return super.onOptionsItemSelected(menuItem);
}
private void setUpIds() {
this.mProgressbar = new TransparentProgressDialog(this.activity, R.drawable.spinner_loading_imag);
Dialog dialog = new Dialog(this);
this.mTermsConditionsDialog = dialog;
dialog.requestWindowFeature(1);
this.mTermsConditionsDialog.setContentView(R.layout.dialog_fee_terms_conditions);
this.mTermsConditionsDialog.setCancelable(false);
this.mAcceptChk = (CheckBox) this.mTermsConditionsDialog.findViewById(R.id.chk_accept_terms_conditions);
this.mAccept = (TextView) this.mTermsConditionsDialog.findViewById(R.id.txv_accept_terms_conditions);
this.mCancel = (TextView) this.mTermsConditionsDialog.findViewById(R.id.btn_cancel);
this.mContinue = (TextView) this.mTermsConditionsDialog.findViewById(R.id.btn_continue);
this.mAcceptChk.setChecked(false);
this.mContinue.setBackgroundResource(R.drawable.grey_button);
this.mAcceptChk.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean z) {
if (z) {
OfferFeeDueDetailsActivity.this.mContinue.setBackgroundResource(R.drawable.theme_button);
} else {
OfferFeeDueDetailsActivity.this.mContinue.setBackgroundResource(R.drawable.grey_button);
}
}
});
this.mAccept.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (OfferFeeDueDetailsActivity.this.url == null || OfferFeeDueDetailsActivity.this.url.length() <= 0 || OfferFeeDueDetailsActivity.this.url.equalsIgnoreCase("null")) {
return;
}
Intent intent = new Intent(OfferFeeDueDetailsActivity.this.getApplicationContext(), (Class<?>) WebViewActivity.class);
intent.putExtra("URL", OfferFeeDueDetailsActivity.this.url);
intent.putExtra("Title", "Fee");
OfferFeeDueDetailsActivity.this.startActivity(intent);
}
});
this.mCancel.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (OfferFeeDueDetailsActivity.this.mTermsConditionsDialog == null || !OfferFeeDueDetailsActivity.this.mTermsConditionsDialog.isShowing()) {
return;
}
OfferFeeDueDetailsActivity.this.mTermsConditionsDialog.dismiss();
}
});
this.mContinue.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (OfferFeeDueDetailsActivity.this.mAcceptChk.isChecked()) {
if (OfferFeeDueDetailsActivity.this.mTermsConditionsDialog != null && OfferFeeDueDetailsActivity.this.mTermsConditionsDialog.isShowing()) {
OfferFeeDueDetailsActivity.this.mTermsConditionsDialog.dismiss();
}
OfferFeeDueDetailsActivity.this.payOfferFee();
return;
}
Toast.makeText(OfferFeeDueDetailsActivity.this.context, "Please accept terms and conditions", 0).show();
}
});
this.mPay = (TextView) findViewById(R.id.txv_pay);
this.payingTotalAmount_tv = (TextView) findViewById(R.id.payingTotalAmount_tv);
this.mFeePaidDetails = (ListView) findViewById(R.id.list_feepaiddetails);
this.proceedToPay = (Button) findViewById(R.id.proceed_pay_tv);
this.mShowNodataText = (TextView) findViewById(R.id.alert_message_text);
this.mShowNodataText.setText("No Data Available");
this.mPay.setTypeface(mMuseoSlab500);
this.payingTotalAmount_tv.setTypeface(mMuseoSlab500);
this.mOfferFeeDuesHeader = (TableRow) findViewById(R.id.table_headers_offer);
this.mShowNodataText.setVisibility(8);
this.mFeePaidDetails.setVisibility(8);
this.proceedToPay.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (OfferFeeDueDetailsActivity.this.offerFeeDuesList != null && OfferFeeDueDetailsActivity.this.offerFeeDuesList.size() > 0) {
OfferFeeDueDetailsActivity.this.getBranchSettings();
} else {
Constants.showAlertDialog(OfferFeeDueDetailsActivity.this.activity, "Payment", "No dues are there");
}
}
});
}
public void payOfferFee() {
JSONArray jSONArray;
JSONArray jSONArray2;
int i;
JSONObject jSONObject;
ArrayList<FeeDueDetailsModelClass> arrayList = this.offerFeeDuesList;
if (arrayList != null && arrayList.size() > 0) {
JSONArray jSONArray3 = new JSONArray();
JSONArray jSONArray4 = new JSONArray();
int i2 = 0;
int i3 = 0;
while (i3 < this.offerFeeDuesList.size()) {
try {
JSONObject jSONObject2 = new JSONObject();
jSONObject2.put("FeeAccountID", this.offerFeeDuesList.get(i3).getFeeAccountId());
jSONObject2.put("FineAmount", this.offerFeeDuesList.get(i3).getFineAmount());
jSONObject2.put("PaymentTypeID", this.offerFeeDuesList.get(i3).getPaymentTypeId());
jSONObject2.put("AssignFeeTypeID", this.offerFeeDuesList.get(i3).getAssignFeeTypeId());
jSONObject2.put("FeeInstallmentID", this.offerFeeDuesList.get(i3).getFeeInstallmentStudentID());
jSONObject2.put("PaidAmount", String.valueOf(Double.parseDouble(this.offerFeeDuesList.get(i3).getBalance()) - Double.parseDouble(this.offerFeeDuesList.get(i3).getConcession())));
jSONObject2.put("Quantity", i2);
jSONObject2.put("IsGroupWise", i2);
jSONObject2.put("StudentMiscFeeDetailsID", this.offerFeeDuesList.get(i3).getFeePlanFeeTypeID());
jSONArray3.put(jSONObject2);
int i4 = i3;
double parseDouble = (Double.parseDouble(this.offerFeeDuesList.get(i3).getBalance()) - Double.parseDouble(this.offerFeeDuesList.get(i3).getConcession())) * (this.offerFeeDuesList.get(i3).getGstPercentage() / 100.0d);
if (parseDouble > 0.0d) {
try {
jSONObject = new JSONObject();
jSONArray2 = jSONArray4;
i = i4;
} catch (Exception e) {
e = e;
jSONArray2 = jSONArray4;
i = i4;
}
try {
jSONObject.put("FeeAccountID", this.offerFeeDuesList.get(i).getFeeAccountId());
jSONObject.put("FineAmount", 0);
jSONObject.put("PaymentTypeID", 10);
jSONObject.put("AssignFeeTypeID", this.offerFeeDuesList.get(i).getFeeTypeId());
jSONObject.put("FeeInstallmentID", this.offerFeeDuesList.get(i).getFeeInstallmentStudentID());
jSONObject.put("PaidAmount", parseDouble);
jSONObject.put("Quantity", this.offerFeeDuesList.get(i).getpType());
i2 = 0;
} catch (Exception e2) {
e = e2;
i2 = 0;
e.printStackTrace();
i3 = i + 1;
jSONArray4 = jSONArray2;
}
try {
jSONObject.put("IsGroupWise", 0);
jSONObject.put("StudentMiscFeeDetailsID", this.offerFeeDuesList.get(i).getFeePlanFeeTypeID());
jSONArray3.put(jSONObject);
} catch (Exception e3) {
e = e3;
e.printStackTrace();
i3 = i + 1;
jSONArray4 = jSONArray2;
}
} else {
jSONArray2 = jSONArray4;
i = i4;
i2 = 0;
}
} catch (Exception e4) {
e = e4;
jSONArray2 = jSONArray4;
i = i3;
}
i3 = i + 1;
jSONArray4 = jSONArray2;
}
JSONArray jSONArray5 = jSONArray4;
while (i2 < this.offerFeeDuesList.size()) {
try {
double parseDouble2 = (Double.parseDouble(this.offerFeeDuesList.get(i2).getBalance()) - Double.parseDouble(this.offerFeeDuesList.get(i2).getConcession())) + Double.parseDouble(this.offerFeeDuesList.get(i2).getFineAmount());
JSONObject jSONObject3 = new JSONObject();
jSONObject3.put("FeeType", this.offerFeeDuesList.get(i2).getFeeType());
jSONObject3.put("InstallmentName", this.offerFeeDuesList.get(i2).getInstallmentName());
jSONObject3.put("Balance", String.valueOf(parseDouble2));
jSONObject3.put("FeeInstallmentID", this.offerFeeDuesList.get(i2).getFeeInstallmentStudentID());
jSONObject3.put("Concession", this.offerFeeDuesList.get(i2).getConcession());
try {
jSONObject3.put("GST", parseDouble2 * (this.offerFeeDuesList.get(i2).getGstPercentage() / 100.0d));
jSONObject3.put("TaxName", this.offerFeeDuesList.get(i2).getTaxName());
jSONArray = jSONArray5;
} catch (Exception e5) {
e = e5;
jSONArray = jSONArray5;
}
try {
jSONArray.put(jSONObject3);
} catch (Exception e6) {
e = e6;
e.printStackTrace();
i2++;
jSONArray5 = jSONArray;
}
} catch (Exception e7) {
e = e7;
jSONArray = jSONArray5;
}
i2++;
jSONArray5 = jSONArray;
}
Intent intent = new Intent(this.activity, (Class<?>) SelectPaymentGateWayActivity.class);
intent.putExtra("AcademicYearId", String.valueOf(this.mAcademicYearId));
intent.putExtra("jsonarray", jSONArray3.toString());
intent.putExtra("array", jSONArray5.toString());
intent.putExtra("payingAmount", this.payingAmount);
intent.putExtra("AvailOffer", true);
startActivity(intent);
return;
}
Constants.showAlertDialog(this.activity, "Payment", "No dues are there");
}
private void getStudentFeeTypeOfferDetails() {
ConnectivityManager connectivityManager = (ConnectivityManager) this.context.getSystemService("connectivity");
if (connectivityManager.getActiveNetworkInfo() != null && connectivityManager.getActiveNetworkInfo().isAvailable() && connectivityManager.getActiveNetworkInfo().isConnected()) {
getFeeTypeOfferDetails();
} else {
Toast.makeText(this.context, "Check your Network Connection", 0).show();
}
}
private void getFeeTypeOfferDetails() {
TransparentProgressDialog transparentProgressDialog = this.mProgressbar;
if (transparentProgressDialog != null && !transparentProgressDialog.isShowing()) {
this.mProgressbar.show();
}
((ApiInterface) ApiClient.getClient1(this.context).create(ApiInterface.class)).GetStudentFeeTypeOfferDetails(Integer.parseInt(this.mStudentEnrollmentID), this.mAcademicYearId, this.mClassId, this.concessionSettingId, Utility.getSchoolApiKey(this.context)).enqueue(new Callback<ArrayList<OfferFeeDueDetailsModelClass>>() {
public void onResponse(Call<ArrayList<OfferFeeDueDetailsModelClass>> call, Response<ArrayList<OfferFeeDueDetailsModelClass>> response) {
if (OfferFeeDueDetailsActivity.this.mProgressbar != null && OfferFeeDueDetailsActivity.this.mProgressbar.isShowing()) {
OfferFeeDueDetailsActivity.this.mProgressbar.dismiss();
}
if (response != null && response.body() != null) {
ArrayList arrayList = (ArrayList) response.body();
OfferFeeDueDetailsActivity.this.offerFeeDuesList.clear();
Iterator it = arrayList.iterator();
double d = 0.0d;
while (it.hasNext()) {
OfferFeeDueDetailsModelClass offerFeeDueDetailsModelClass = (OfferFeeDueDetailsModelClass) it.next();
String feeAccountName = offerFeeDueDetailsModelClass.getFeeAccountName();
int feeAccountId = offerFeeDueDetailsModelClass.getFeeAccountId();
String assignFeeTypeId = offerFeeDueDetailsModelClass.getAssignFeeTypeId();
String balance = offerFeeDueDetailsModelClass.getBalance();
String concession = offerFeeDueDetailsModelClass.getConcession();
String dueDate = offerFeeDueDetailsModelClass.getDueDate();
String feeInstallmentStudentID = offerFeeDueDetailsModelClass.getFeeInstallmentStudentID();
String feeType = offerFeeDueDetailsModelClass.getFeeType();
String feeTypeId = offerFeeDueDetailsModelClass.getFeeTypeId();
String fineAmount = offerFeeDueDetailsModelClass.getFineAmount();
String installmentName = offerFeeDueDetailsModelClass.getInstallmentName();
Iterator it2 = it;
String amountPaid = offerFeeDueDetailsModelClass.getAmountPaid();
int i = offerFeeDueDetailsModelClass.getpType();
double d2 = d;
String feePlanFeeTypeID = offerFeeDueDetailsModelClass.getFeePlanFeeTypeID();
double gstPercentage = offerFeeDueDetailsModelClass.getGstPercentage();
OfferFeeDueDetailsActivity.this.taxName = offerFeeDueDetailsModelClass.getTaxName();
FeeDueDetailsModelClass feeDueDetailsModelClass = new FeeDueDetailsModelClass();
feeDueDetailsModelClass.setFeeAccountId(String.valueOf(feeAccountId));
feeDueDetailsModelClass.setFeeAccountName(feeAccountName);
feeDueDetailsModelClass.setAssignFeeTypeId(assignFeeTypeId);
feeDueDetailsModelClass.setBalance(balance);
feeDueDetailsModelClass.setConcession(concession);
feeDueDetailsModelClass.setDueDate(dueDate);
feeDueDetailsModelClass.setFeeInstallmentStudentID(feeInstallmentStudentID);
feeDueDetailsModelClass.setPaymentTypeId(String.valueOf(i));
feeDueDetailsModelClass.setFeeType(feeType);
feeDueDetailsModelClass.setFeeTypeId(Integer.parseInt(feeTypeId));
feeDueDetailsModelClass.setFineAmount(fineAmount);
feeDueDetailsModelClass.setInstallmentName(installmentName);
feeDueDetailsModelClass.setAmountPaid(amountPaid);
feeDueDetailsModelClass.setGstPercentage(gstPercentage);
feeDueDetailsModelClass.setFeePlanFeeTypeID(feePlanFeeTypeID);
feeDueDetailsModelClass.setTaxName(OfferFeeDueDetailsActivity.this.taxName);
OfferFeeDueDetailsActivity.this.offerFeeDuesList.add(feeDueDetailsModelClass);
d = d2 + (Double.parseDouble(balance) - Double.parseDouble(concession)) + Double.parseDouble(fineAmount);
it = it2;
}
OfferFeeDueDetailsActivity.this.setPayAmount(Double.valueOf(d), 0.0d);
OfferFeeDueDetailsActivity.this.mFeePaidDetails.setAdapter(new OfferFeeDuesAdapter(OfferFeeDueDetailsActivity.this.context, OfferFeeDueDetailsActivity.this.offerFeeDuesList));
if (OfferFeeDueDetailsActivity.this.offerFeeDuesList.size() > 0) {
OfferFeeDueDetailsActivity.this.mFeePaidDetails.setVisibility(0);
OfferFeeDueDetailsActivity.this.mShowNodataText.setVisibility(8);
return;
} else {
OfferFeeDueDetailsActivity.this.mFeePaidDetails.setVisibility(8);
OfferFeeDueDetailsActivity.this.mShowNodataText.setVisibility(0);
return;
}
}
Utility.showAlertDialog(OfferFeeDueDetailsActivity.this.activity);
}
public void onFailure(Call<ArrayList<OfferFeeDueDetailsModelClass>> call, Throwable th) {
if (OfferFeeDueDetailsActivity.this.mProgressbar != null && OfferFeeDueDetailsActivity.this.mProgressbar.isShowing()) {
OfferFeeDueDetailsActivity.this.mProgressbar.dismiss();
}
Utility.showAlertDialog(OfferFeeDueDetailsActivity.this.activity);
}
});
}
public void setPayAmount(Double d, double d2) {
this.payingAmount = String.valueOf(d.doubleValue() + d2);
if (d.doubleValue() == 0.0d) {
this.payingTotalAmount_tv.setText("");
this.mPay.setText("");
return;
}
this.mPay.setText("Pay");
this.payingTotalAmount_tv.setText(Utility.currencyFormat(this.context, d.doubleValue()));
if (d2 > 0.0d) {
StringBuilder sb = new StringBuilder("Pay <br>(");
sb.append(Utility.currencyFormat(this.context, d.doubleValue()));
sb.append("+");
sb.append(Utility.isStringHasValue(this.taxName) ? this.taxName : "GST");
sb.append("(");
sb.append(Utility.currencyFormat(this.context, d2));
sb.append("))");
this.mPay.setText(Html.fromHtml(sb.toString()));
this.payingTotalAmount_tv.setText(Utility.currencyFormat(this.context, d.doubleValue() + d2));
}
}
public void onResume() {
super.onResume();
this.payingTotalAmount_tv.setText(" ");
getStudentFeeTypeOfferDetails();
}
public void getBranchSettings() {
ConnectivityManager connectivityManager = (ConnectivityManager) this.context.getSystemService("connectivity");
if (connectivityManager.getActiveNetworkInfo() != null && connectivityManager.getActiveNetworkInfo().isAvailable() && connectivityManager.getActiveNetworkInfo().isConnected()) {
getTermsAndConditionsFromBranchSettings();
} else {
Toast.makeText(this.context, "Check your Network Connection", 0).show();
}
}
private void getTermsAndConditionsFromBranchSettings() {
TransparentProgressDialog transparentProgressDialog = this.mProgressbar;
if (transparentProgressDialog != null && !transparentProgressDialog.isShowing()) {
this.mProgressbar.show();
}
((ApiInterface) ApiClient.getClient1(this.context).create(ApiInterface.class)).getTermsAndConditions(Integer.parseInt(this.branchId), Utility.getSchoolApiKey(this.context)).enqueue(new Callback<ArrayList<MakePaymentBranchSettingsModel>>() {
public void onResponse(Call<ArrayList<MakePaymentBranchSettingsModel>> call, Response<ArrayList<MakePaymentBranchSettingsModel>> response) {
if (OfferFeeDueDetailsActivity.this.mProgressbar != null && OfferFeeDueDetailsActivity.this.mProgressbar.isShowing()) {
OfferFeeDueDetailsActivity.this.mProgressbar.dismiss();
}
if (response != null && response.body() != null) {
ArrayList arrayList = (ArrayList) response.body();
if (arrayList.size() > 0) {
MakePaymentBranchSettingsModel makePaymentBranchSettingsModel = (MakePaymentBranchSettingsModel) arrayList.get(0);
OfferFeeDueDetailsActivity.this.url = makePaymentBranchSettingsModel.getTermsAndConditionsURL();
OfferFeeDueDetailsActivity.this.mAcceptChk.setChecked(false);
OfferFeeDueDetailsActivity.this.mContinue.setBackgroundResource(R.drawable.grey_button);
if (OfferFeeDueDetailsActivity.this.mTermsConditionsDialog == null || OfferFeeDueDetailsActivity.this.mTermsConditionsDialog.isShowing()) {
return;
}
OfferFeeDueDetailsActivity.this.mTermsConditionsDialog.show();
return;
}
Constants.showAlertDialog(OfferFeeDueDetailsActivity.this.activity);
return;
}
Utility.showAlertDialog(OfferFeeDueDetailsActivity.this.activity);
}
public void onFailure(Call<ArrayList<MakePaymentBranchSettingsModel>> call, Throwable th) {
if (OfferFeeDueDetailsActivity.this.mProgressbar != null && OfferFeeDueDetailsActivity.this.mProgressbar.isShowing()) {
OfferFeeDueDetailsActivity.this.mProgressbar.dismiss();
}
Utility.showAlertDialog(OfferFeeDueDetailsActivity.this.activity);
}
});
}
}