mirror of
https://github.com/freeedcom/ai-codereviewer.git
synced 2025-07-01 05:14:17 +00:00
add project adins
This commit is contained in:
parent
ad06ac5505
commit
f8f85d679d
5299 changed files with 625430 additions and 0 deletions
|
@ -0,0 +1,138 @@
|
|||
package com.adins.mss.base.networkmonitor;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.net.TrafficStats;
|
||||
import android.preference.PreferenceManager;
|
||||
|
||||
import com.adins.mss.foundation.camerainapp.helper.Logger;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by e5 on 18/08/2017.
|
||||
*/
|
||||
|
||||
public class NetworkMonitorDataUsage {
|
||||
|
||||
/**
|
||||
* Method ini digunakan untuk mengambil tanggal instalasi aplikasi
|
||||
*
|
||||
* @param context Instance activity yang sedang berjalan misal: this
|
||||
* @return mengembalikan String tanggal install aplikasi dengan format yang sudah ditentukan
|
||||
*/
|
||||
private String getInstallDate(Context context) {
|
||||
|
||||
PackageManager packageManager = context.getPackageManager();
|
||||
long installTimeInMilliseconds;
|
||||
|
||||
Date installDate = null;
|
||||
String installDateString = null;
|
||||
|
||||
try {
|
||||
PackageInfo packageInfo = packageManager.getPackageInfo(context.getPackageName(), 0);
|
||||
installTimeInMilliseconds = packageInfo.firstInstallTime;
|
||||
|
||||
//sesuaikan format sdf dengan yang dibutuhkan
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd+HH:mm:ss");
|
||||
Date date = new Date(installTimeInMilliseconds);
|
||||
installDateString = sdf.format(date);
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
//handler untuk error yang tidak terduga
|
||||
installDate = new Date(0);
|
||||
installDateString = installDate.toString();
|
||||
}
|
||||
|
||||
return installDateString;
|
||||
}
|
||||
|
||||
/**
|
||||
* Di bawah ini yang tidak membedakan rx tx
|
||||
*
|
||||
* @param context
|
||||
* @return
|
||||
*/
|
||||
public long getDataUsage(Context context) {
|
||||
long rxtx;
|
||||
final PackageManager pm = context.getPackageManager();
|
||||
//ambil dafter aplikasi yang terinstall
|
||||
List<ApplicationInfo> packages = pm.getInstalledApplications(
|
||||
PackageManager.GET_META_DATA);
|
||||
int UID = 0;
|
||||
//loop daftar aplikasi mencari yang cocok dengan nama aplikasi yang sedang berjalan
|
||||
for (ApplicationInfo packageInfo : packages) {
|
||||
if (packageInfo.packageName.equals(context.getPackageName())) {
|
||||
//mengambil UID aplikasi
|
||||
String appName = packageInfo.packageName;
|
||||
UID = packageInfo.uid;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//mengambil total penggunaan data dalam satuan bytes
|
||||
rxtx = TrafficStats.getUidRxBytes(UID) + TrafficStats.getUidTxBytes(UID);//Tx = Transferred = Upload ;//Rx = Recieved = Download
|
||||
|
||||
//handler apabila API level device terlalu rendah dan tidak support TrafficStats
|
||||
if (rxtx == TrafficStats.UNSUPPORTED) {
|
||||
AlertDialog.Builder alert = new AlertDialog.Builder(context);
|
||||
//masukkan pesan disini
|
||||
alert.setTitle("Uh Oh!");
|
||||
alert.setMessage("Your device does not support traffic stat monitoring.");
|
||||
alert.show();
|
||||
}
|
||||
return rxtx;
|
||||
}
|
||||
|
||||
public void setDataLastDay(Context context, long data) {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
SharedPreferences.Editor editor = prefs.edit();
|
||||
editor.putLong("DataUsageperHari", data);// value rx to store
|
||||
editor.commit();
|
||||
}
|
||||
|
||||
public void setDateLastDay(Context context) {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
SharedPreferences.Editor editor = prefs.edit();
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.set(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DAY_OF_MONTH), 0, 0, 0);
|
||||
Logger.d("NetworkMonitor", "" + cal.getTimeInMillis());
|
||||
editor.putLong("ThisDateForDataUsage", cal.getTimeInMillis());
|
||||
editor.commit();
|
||||
}
|
||||
|
||||
public long getDataLastDay(Context context) {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
return prefs.getLong("DataUsageperHari", 0); // value rx to store
|
||||
}
|
||||
|
||||
public long getLastDate(Context context) {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
return prefs.getLong("ThisDateForDataUsage", Calendar.getInstance().getTimeInMillis());
|
||||
}
|
||||
|
||||
public void update(Context context, long data) {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
SharedPreferences.Editor editor = prefs.edit();
|
||||
editor.putLong("DataUsage", data); // value rx to store
|
||||
editor.commit();
|
||||
}
|
||||
|
||||
public long getDataThisDay(Context context) {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
return prefs.getLong("DataUsage", 0); // value rx to store
|
||||
}
|
||||
|
||||
public void resetDataThisDay(Context context) {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
SharedPreferences.Editor editor = prefs.edit();
|
||||
editor.putLong("DataUsage", 0); // value DU to store
|
||||
editor.commit();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
package com.adins.mss.base.tasklog;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.adins.mss.base.GlobalData;
|
||||
import com.adins.mss.base.log.Log;
|
||||
import com.adins.mss.constant.Global;
|
||||
import com.adins.mss.dao.TaskH;
|
||||
import com.adins.mss.foundation.db.dataaccess.TaskHDataAccess;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class TaskLog {
|
||||
private static Context context;
|
||||
private static List<TaskH> listTask;
|
||||
//private static String uuidUser = GlobalData.getSharedGlobalData().getUser().getUuid_user();
|
||||
|
||||
public TaskLog(Context context){
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
public List<TaskH> getListTaskLog(){
|
||||
Log log = new Log(this.context);
|
||||
//listTask = TaskHDataAccess.getAllSentTask(context, uuidUser);
|
||||
listTask = log.getAllSentTaskWithLimited();
|
||||
Global.listOfSentTask = listTask;
|
||||
return listTask;
|
||||
}
|
||||
|
||||
public static long getCounterLog(Context context){
|
||||
long counter=0;
|
||||
try {
|
||||
String uuidUser = GlobalData.getSharedGlobalData().getUser().getUuid_user();
|
||||
counter = TaskHDataAccess.getSentTaskCounter(context, uuidUser);
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
}
|
||||
int MAXIMUM_DATA_KEEP = GlobalData.getSharedGlobalData().getMaxDataInLog();
|
||||
if(counter>MAXIMUM_DATA_KEEP && MAXIMUM_DATA_KEEP!=0) counter = MAXIMUM_DATA_KEEP;
|
||||
return counter;
|
||||
}
|
||||
|
||||
public static long getCounterLogAllUser(Context context){
|
||||
long counter=0;
|
||||
try {
|
||||
counter = TaskHDataAccess.getSentTaskCounterAllUser(context);
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
}
|
||||
int MAXIMUM_DATA_KEEP = GlobalData.getSharedGlobalData().getMaxDataInLog();
|
||||
if(counter>MAXIMUM_DATA_KEEP && MAXIMUM_DATA_KEEP!=0) counter = MAXIMUM_DATA_KEEP;
|
||||
return counter;
|
||||
}
|
||||
|
||||
public List<TaskH> doRefresh(){
|
||||
return getListTaskLog();
|
||||
}
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 48 KiB |
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,44 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_enabled="false" >
|
||||
<shape>
|
||||
<solid
|
||||
android:color="@android:color/darker_gray" />
|
||||
<corners
|
||||
android:radius="10dp" />
|
||||
<padding
|
||||
android:left="10dp"
|
||||
android:top="10dp"
|
||||
android:right="10dp"
|
||||
android:bottom="10dp" />
|
||||
</shape>
|
||||
</item>
|
||||
<item android:state_pressed="true" >
|
||||
<shape>
|
||||
<solid
|
||||
android:color="@color/gradient_start" />
|
||||
<corners
|
||||
android:radius="10dp" />
|
||||
<padding
|
||||
android:left="10dp"
|
||||
android:top="10dp"
|
||||
android:right="10dp"
|
||||
android:bottom="10dp" />
|
||||
</shape>
|
||||
</item>
|
||||
<item>
|
||||
<shape>
|
||||
<gradient
|
||||
android:startColor="@color/gradient_start"
|
||||
android:endColor="@color/gradient_end"
|
||||
android:angle="270" />
|
||||
<corners
|
||||
android:radius="10dp" />
|
||||
<padding
|
||||
android:left="10dp"
|
||||
android:top="10dp"
|
||||
android:right="10dp"
|
||||
android:bottom="10dp" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
|
@ -0,0 +1,125 @@
|
|||
package com.adins.mss.dao;
|
||||
|
||||
import com.adins.mss.base.util.ExcludeFromGson;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. Enable "keep" sections if you want to edit.
|
||||
/**
|
||||
* Entity mapped to table "MS_ACCOUNT".
|
||||
*/
|
||||
public class Account {
|
||||
|
||||
/** Not-null value. */
|
||||
@SerializedName("uuid_account")
|
||||
private String uuid_account;
|
||||
@SerializedName("account_name")
|
||||
private String account_name;
|
||||
@SerializedName("account_address")
|
||||
private String account_address;
|
||||
@SerializedName("account_phone_1")
|
||||
private String account_phone_1;
|
||||
@SerializedName("account_phone_2")
|
||||
private String account_phone_2;
|
||||
@SerializedName("account_latitude")
|
||||
private String account_latitude;
|
||||
@SerializedName("account_longitude")
|
||||
private String account_longitude;
|
||||
@SerializedName("usr_crt")
|
||||
private String usr_crt;
|
||||
@SerializedName("dtm_crt")
|
||||
private java.util.Date dtm_crt;
|
||||
|
||||
public Account() {
|
||||
}
|
||||
|
||||
public Account(String uuid_account) {
|
||||
this.uuid_account = uuid_account;
|
||||
}
|
||||
|
||||
public Account(String uuid_account, String account_name, String account_address, String account_phone_1, String account_phone_2, String account_latitude, String account_longitude, String usr_crt, java.util.Date dtm_crt) {
|
||||
this.uuid_account = uuid_account;
|
||||
this.account_name = account_name;
|
||||
this.account_address = account_address;
|
||||
this.account_phone_1 = account_phone_1;
|
||||
this.account_phone_2 = account_phone_2;
|
||||
this.account_latitude = account_latitude;
|
||||
this.account_longitude = account_longitude;
|
||||
this.usr_crt = usr_crt;
|
||||
this.dtm_crt = dtm_crt;
|
||||
}
|
||||
|
||||
/** Not-null value. */
|
||||
public String getUuid_account() {
|
||||
return uuid_account;
|
||||
}
|
||||
|
||||
/** Not-null value; ensure this value is available before it is saved to the database. */
|
||||
public void setUuid_account(String uuid_account) {
|
||||
this.uuid_account = uuid_account;
|
||||
}
|
||||
|
||||
public String getAccount_name() {
|
||||
return account_name;
|
||||
}
|
||||
|
||||
public void setAccount_name(String account_name) {
|
||||
this.account_name = account_name;
|
||||
}
|
||||
|
||||
public String getAccount_address() {
|
||||
return account_address;
|
||||
}
|
||||
|
||||
public void setAccount_address(String account_address) {
|
||||
this.account_address = account_address;
|
||||
}
|
||||
|
||||
public String getAccount_phone_1() {
|
||||
return account_phone_1;
|
||||
}
|
||||
|
||||
public void setAccount_phone_1(String account_phone_1) {
|
||||
this.account_phone_1 = account_phone_1;
|
||||
}
|
||||
|
||||
public String getAccount_phone_2() {
|
||||
return account_phone_2;
|
||||
}
|
||||
|
||||
public void setAccount_phone_2(String account_phone_2) {
|
||||
this.account_phone_2 = account_phone_2;
|
||||
}
|
||||
|
||||
public String getAccount_latitude() {
|
||||
return account_latitude;
|
||||
}
|
||||
|
||||
public void setAccount_latitude(String account_latitude) {
|
||||
this.account_latitude = account_latitude;
|
||||
}
|
||||
|
||||
public String getAccount_longitude() {
|
||||
return account_longitude;
|
||||
}
|
||||
|
||||
public void setAccount_longitude(String account_longitude) {
|
||||
this.account_longitude = account_longitude;
|
||||
}
|
||||
|
||||
public String getUsr_crt() {
|
||||
return usr_crt;
|
||||
}
|
||||
|
||||
public void setUsr_crt(String usr_crt) {
|
||||
this.usr_crt = usr_crt;
|
||||
}
|
||||
|
||||
public java.util.Date getDtm_crt() {
|
||||
return dtm_crt;
|
||||
}
|
||||
|
||||
public void setDtm_crt(java.util.Date dtm_crt) {
|
||||
this.dtm_crt = dtm_crt;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,226 @@
|
|||
package com.adins.mss.coll.fragments;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.LinearLayout.LayoutParams;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TableLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.Keep;
|
||||
|
||||
import com.adins.mss.base.PrintActivity;
|
||||
import com.adins.mss.coll.R;
|
||||
import com.adins.mss.constant.Global;
|
||||
import com.adins.mss.dao.DepositReportD;
|
||||
import com.adins.mss.dao.DepositReportH;
|
||||
import com.adins.mss.dao.PaymentChannel;
|
||||
import com.adins.mss.dao.TaskH;
|
||||
import com.adins.mss.foundation.db.dataaccess.PaymentChannelDataAccess;
|
||||
import com.adins.mss.foundation.db.dataaccess.TaskHDataAccess;
|
||||
import com.adins.mss.foundation.formatter.Tool;
|
||||
import com.adins.mss.foundation.image.Utils;
|
||||
import com.adins.mss.foundation.image.ViewImageActivity;
|
||||
import com.androidquery.AQuery;
|
||||
|
||||
import org.acra.ACRA;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class DepositReportPCDetailActivity extends Activity {
|
||||
protected static DepositReportH report;
|
||||
protected int total = 0;
|
||||
List<DepositReportD> reportDs;
|
||||
String cashierName;
|
||||
String bankAccount;
|
||||
String channel;
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState){
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.deposit_report_detail_layout_pc);
|
||||
AQuery query = new AQuery(this);
|
||||
ACRA.getErrorReporter().putCustomData("LAST_CLASS_ACCESSED", getClass().getSimpleName());
|
||||
cashierName = report.getCashier_name();
|
||||
bankAccount = report.getBank_account();
|
||||
PaymentChannel channelDetail = PaymentChannelDataAccess.getOnePaymentChannel(getApplicationContext(), report.getCode_channel());
|
||||
channel = channelDetail.getDescription()+" | "+channelDetail.getCode();
|
||||
|
||||
|
||||
reportDs = report.getDepositReportDList();
|
||||
|
||||
query.id(R.id.txtBatchId).text(report.getBatch_id());
|
||||
query.id(R.id.txtBankName).text(channel);
|
||||
query.id(R.id.txtNoTransaction).text(report.getNo_transaction());
|
||||
query.id(R.id.imgEvidenceTransfer).image(Utils.byteToBitmap(report.getImage())).clicked(this, "ViewImage");
|
||||
|
||||
ImageButton btnPrintDepReport = (ImageButton)findViewById(R.id.btnPrintDepReport);
|
||||
btnPrintDepReport.setOnClickListener(new View.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent intent = new Intent(getApplicationContext(), PrintActivity.class);
|
||||
intent.putExtra("taskId", report.getBatch_id());
|
||||
intent.putExtra("isPrintDeposit", true);
|
||||
startActivity(intent);
|
||||
}
|
||||
});
|
||||
|
||||
int no =1;
|
||||
TableLayout detailTable = (TableLayout)findViewById(R.id.tableLayout1);
|
||||
LayoutParams lp =new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT,0.25f);
|
||||
|
||||
LinearLayout detail = new LinearLayout(this);
|
||||
detail.setOrientation(LinearLayout.HORIZONTAL);
|
||||
detail.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT, 1.0f));
|
||||
detail.setBackgroundResource(R.color.tv_gray_light);
|
||||
|
||||
TextView lblDetail = new TextView(this);
|
||||
lblDetail.setText("Detail");
|
||||
lblDetail.setTextColor(Color.BLACK);
|
||||
lblDetail.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT,0.25f));
|
||||
detail.addView(lblDetail);
|
||||
detailTable.addView(detail);
|
||||
|
||||
|
||||
for (int i = 0; i < reportDs.size(); i++) {
|
||||
try {
|
||||
DepositReportD reportD = reportDs.get(i);
|
||||
LinearLayout row = new LinearLayout(this);
|
||||
row.setOrientation(LinearLayout.HORIZONTAL);
|
||||
row.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT, 1.0f));
|
||||
if (no%2 == 0){ //if even number, set to blue background
|
||||
row.setBackgroundResource(R.color.tv_gray_light);
|
||||
}
|
||||
else {
|
||||
row.setBackgroundResource(R.color.tv_gray);
|
||||
}
|
||||
|
||||
TextView lblNo = new TextView(this);
|
||||
lblNo.setText(no+ ". ");
|
||||
lblNo.setGravity(Gravity.CENTER_HORIZONTAL);
|
||||
lblNo.setTextColor(Color.BLACK);
|
||||
lblNo.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT,0.4f));
|
||||
row.addView(lblNo);
|
||||
|
||||
TaskH taskHs= TaskHDataAccess.getOneHeader(getApplicationContext(), reportD.getUuid_task_h());
|
||||
String agreement_no = "";
|
||||
if(taskHs!=null)
|
||||
agreement_no = taskHs.getAppl_no();
|
||||
|
||||
TextView lblLabel = new TextView(this);
|
||||
lblLabel.setText(agreement_no);
|
||||
lblLabel.setTextColor(Color.BLACK);
|
||||
lblLabel.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT,0.25f));
|
||||
row.addView(lblLabel);
|
||||
|
||||
TextView lblSpace = new TextView(this);
|
||||
lblSpace.setText(" : ");
|
||||
lblSpace.setTextColor(Color.BLACK);
|
||||
lblSpace.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT));
|
||||
row.addView(lblSpace);
|
||||
|
||||
try {
|
||||
TextView lblAnswer = new TextView(this);
|
||||
lblAnswer.setText(Tool.separateThousand(reportD.getDeposit_amt()));
|
||||
lblAnswer.setTextColor(Color.BLACK);
|
||||
lblAnswer.setGravity(Gravity.RIGHT);
|
||||
lblAnswer.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT,0.25f));
|
||||
row.addView(lblAnswer, lp);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
|
||||
detailTable.addView(row);
|
||||
no++;
|
||||
|
||||
}
|
||||
finally {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Keep
|
||||
public void ViewImage(View view){
|
||||
Global.isViewer =true;
|
||||
Bundle extras = new Bundle();
|
||||
extras.putByteArray(Global.BUND_KEY_IMAGE_BYTE, report.getImage());
|
||||
Intent intent = new Intent(this, ViewImageActivity.class);
|
||||
intent.putExtras(extras);
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
@Keep
|
||||
private class RecapitulationListAdapter extends ArrayAdapter<DepositReportD> {
|
||||
|
||||
private final DepositReportD[] originalItems;
|
||||
|
||||
public RecapitulationListAdapter(Context context, DepositReportD[] objects) {
|
||||
super(context, R.layout.deposit_report_list_recap, objects);
|
||||
originalItems = objects;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return super.getCount() + 1;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
View view = null;
|
||||
view = LayoutInflater.from(getContext()).inflate(R.layout.deposit_report_list_recap, parent, false);
|
||||
|
||||
|
||||
TextView label = (TextView) view.findViewById(R.id.itemLabel);
|
||||
TextView value = (TextView) view.findViewById(R.id.itemValue);
|
||||
TextView agreement= (TextView) view.findViewById(R.id.itemValueAgreement);
|
||||
RelativeLayout layout = (RelativeLayout)view.findViewById(R.id.agreementNumber_layout);
|
||||
LinearLayout backLayout = (LinearLayout)view.findViewById(R.id.itemBase);
|
||||
if(position%2==1)
|
||||
backLayout.setBackgroundResource(R.color.tv_gray);
|
||||
if (position == getCount() - 1) {
|
||||
label.setText("Total");
|
||||
value.setText(Tool.separateThousand(String.valueOf(sumOfItems())));
|
||||
layout.setVisibility(View.GONE);
|
||||
} else {
|
||||
DepositReportD item = getItem(position);
|
||||
TaskH taskHs= TaskHDataAccess.getOneHeader(getApplicationContext(), item.getUuid_task_h());
|
||||
String agreement_no = "";
|
||||
if(taskHs!=null)
|
||||
agreement_no = taskHs.getAppl_no();
|
||||
agreement.setText(agreement_no);
|
||||
value.setText(Tool.separateThousand(item.getDeposit_amt()));
|
||||
}
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
private int sumOfItems() {
|
||||
int sum = 0;
|
||||
try {
|
||||
for (DepositReportD item : originalItems) {
|
||||
String value = item.getDeposit_amt();
|
||||
if(value==null || value.equals("")) value = "0";
|
||||
int finalValue = Integer.parseInt(value);
|
||||
sum += finalValue;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
}
|
||||
total = sum;
|
||||
// generatePrintResultDepReport(DepositReportDetailActivity.this, report);
|
||||
return sum;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue