add project adins

This commit is contained in:
Alfrid Sanjaya Leo Putra 2024-07-25 14:44:22 +07:00
commit f8f85d679d
5299 changed files with 625430 additions and 0 deletions

View file

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid
android:color="@color/gradient_start" />
<corners
android:radius="10dp" />
<padding
android:left="5dp"
android:top="5dp"
android:right="5dp"
android:bottom="5dp" />
</shape>

Binary file not shown.

After

Width:  |  Height:  |  Size: 875 B

View file

@ -0,0 +1,60 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/bgColor"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.cardview.widget.CardView
android:id="@+id/recapitulationListContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginLeft="@dimen/card_margin"
android:layout_marginTop="@dimen/card_margin"
android:layout_marginRight="@dimen/card_margin"
android:layout_marginBottom="60dp"
app:cardBackgroundColor="@color/fontColorWhite"
app:cardCornerRadius="10dp"
app:cardElevation="@dimen/card_shadow"
app:contentPadding="7dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="10dp"
android:text="@string/label_recapitulation_list"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/colorMC"
android:textStyle="bold" />
<ListView
android:id="@+id/recapitulationList"
android:layout_width="match_parent"
android:layout_height="match_parent"></ListView>
</LinearLayout>
</androidx.cardview.widget.CardView>
<Button
android:id="@+id/recapitulateButton"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_alignParentBottom="true"
android:layout_margin="5dp"
android:layout_weight="1"
android:background="@drawable/button_background"
android:text="@string/label_recapitulate"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/fontColorWhite" />
</RelativeLayout>
</LinearLayout>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

View file

@ -0,0 +1,148 @@
package com.adins.mss.coll.interfaces;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.os.AsyncTask;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TableLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.adins.mss.base.GlobalData;
import com.adins.mss.base.commons.CommonImpl;
import com.adins.mss.base.commons.TaskListener;
import com.adins.mss.base.crashlytics.FireCrash;
import com.adins.mss.coll.R;
import com.adins.mss.coll.api.InstallmentScheduleApi;
import com.adins.mss.coll.interfaces.callback.SaveDataInstallmentCallback;
import com.adins.mss.coll.interfaces.callback.TaskReportCallback;
import com.adins.mss.coll.models.InstallmentScheduleResponse;
import com.adins.mss.constant.Global;
import com.adins.mss.dao.InstallmentSchedule;
import com.adins.mss.dao.TaskH;
import com.adins.mss.foundation.db.dataaccess.InstallmentScheduleDataAccess;
import com.adins.mss.foundation.db.dataaccess.TaskHDataAccess;
import com.adins.mss.foundation.dialog.NiftyDialogBuilder;
import com.adins.mss.foundation.formatter.Formatter;
import com.adins.mss.foundation.formatter.Tool;
import java.io.IOException;
import java.util.List;
/**
* Created by kusnendi.muhamad on 31/07/2017.
*/
public class TasksImpl extends CommonImpl implements TasksInterface {
private Activity activity;
private Context context;
public TasksImpl(Activity activity) {
this.activity= activity;
this.context = activity.getApplicationContext();
}
@Override
public void saveDataInstallmentSchedule(Context context, InstallmentScheduleResponse installmentSchedResp, String taskId, SaveDataInstallmentCallback callback) {
if(installmentSchedResp!=null && installmentSchedResp.getStatus().getCode()==0){
List<InstallmentSchedule> installmentScheduleList = installmentSchedResp.getInstallmentScheduleList();
if(installmentScheduleList!=null && installmentScheduleList.size()>0){
TaskH taskH = TaskHDataAccess.getOneTaskHeader(context, taskId);
InstallmentScheduleDataAccess.delete(context, taskH.getUuid_task_h());
for(InstallmentSchedule installmentSchedule : installmentScheduleList){
if (installmentSchedule.getUuid_installment_schedule() == null){
installmentSchedule.setUuid_installment_schedule(Tool.getUUID());
}
installmentSchedule.setUuid_task_h(taskH.getUuid_task_h());
}
InstallmentScheduleDataAccess.addOrReplace(context, installmentScheduleList);
}
callback.onSaveFinished(true);
}else{
callback.onSaveFinished(false);
}
}
@Override
public void getDataInstallmentSchedule(final String taskId, final TaskListener listener) {
new AsyncTask<Void, Void, InstallmentScheduleResponse>() {
private ProgressDialog progressDialog;
@Override
protected void onPreExecute() {
progressDialog = ProgressDialog.show(activity,
"", context.getString(R.string.progressWait), true);
}
@Override
protected InstallmentScheduleResponse doInBackground(Void... params) {
InstallmentScheduleApi api = new InstallmentScheduleApi(activity);
try {
if(isInternetConnected(context)){
return api.request(taskId);
}
return null;
} catch (IOException e) {
e.printStackTrace();
return null;
}
}
@Override
protected void onPostExecute(InstallmentScheduleResponse installmentScheduleResponse) {
super.onPostExecute(installmentScheduleResponse);
if (progressDialog!=null&&progressDialog.isShowing()){
try {
progressDialog.dismiss();
} catch (Exception e) {
FireCrash.log(e);
}
}
if(!GlobalData.isRequireRelogin()) {
if (installmentScheduleResponse == null) {
//bong 25 mei 15 - display local data
TaskH taskH = TaskHDataAccess.getOneTaskHeader(context, taskId);
if (taskH != null) {
List<InstallmentSchedule> installmentScheduleList = InstallmentScheduleDataAccess.getAllByTask(context, taskH.getUuid_task_h());
if (installmentScheduleList != null && !installmentScheduleList.isEmpty()) {
listener.onLocalData(installmentScheduleList);
} else {
NiftyDialogBuilder.getInstance(activity)
.withMessage(activity.getString(R.string.no_data_found_offline))
.withTitle(activity.getString(R.string.warning_capital))
.isCancelableOnTouchOutside(false)
.withButton1Text(activity.getString(R.string.btnClose))
.setButton1Click(new View.OnClickListener() {
@Override
public void onClick(View v) {
NiftyDialogBuilder.getInstance(activity).dismiss();
}
})
.show();
}
}
} else if (installmentScheduleResponse.getStatus().getCode() != 0) {
NiftyDialogBuilder.getInstance(activity)
.withMessage(installmentScheduleResponse.getStatus().getMessage())
.withTitle(activity.getString(R.string.server_error))
.isCancelableOnTouchOutside(false)
.withButton1Text(activity.getString(R.string.btnClose))
.setButton1Click(new View.OnClickListener() {
@Override
public void onClick(View v) {
activity.finish();
}
})
.show();
return;
} else {
listener.onCompleteTask(installmentScheduleResponse);
}
}
}
}.execute();
}
}

View file

@ -0,0 +1,46 @@
package com.adins.mss.odr.model;
import com.adins.mss.foundation.http.KeyValue;
import com.adins.mss.foundation.http.MssResponseType;
import com.google.gson.annotations.SerializedName;
import java.util.List;
public class JsonResponseServer extends MssResponseType{
@SerializedName("listResponseServer")
List<ResponseServer> listResponseServer;
public List<ResponseServer> getListResponseServer() {
return listResponseServer;
}
public void setListResponseServer(List<ResponseServer> listResponseServer) {
this.listResponseServer = listResponseServer;
}
public class ResponseServer extends KeyValue {
@SerializedName("flag")
String flag;
@SerializedName("subListResponseServer")
List<ResponseServer> subListResponseServer;
public ResponseServer(String key, String value) {
super(key, value);
}
public String getFlag() {
return flag;
}
public void setFlag(String flag) {
this.flag = flag;
}
public List<ResponseServer> getSubListResponseServer() {
return subListResponseServer;
}
public void setSubListResponseServer(List<ResponseServer> subListResponseServer) {
this.subListResponseServer = subListResponseServer;
}
}
}

View file

@ -0,0 +1,24 @@
package com.adins.mss.base.depositreport;
import com.adins.mss.dao.TaskD;
import com.adins.mss.foundation.http.MssResponseType;
import com.google.gson.annotations.SerializedName;
import java.util.List;
/**
* Created by angga.permadi on 8/30/2016.
*/
public class DetailTaskHResponse extends MssResponseType {
@SerializedName("detailTaskH")
private List<TaskD> taskDs;
public List<TaskD> getTaskDs() {
return taskDs;
}
public void setTaskDs(List<TaskD> taskDs) {
this.taskDs = taskDs;
}
}

View file

@ -0,0 +1,173 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/bg_grayscale"
android:padding="8dp" >
<ScrollView
android:id="@+id/scrollView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/btnPrintDepReport"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true" >
<TableLayout
android:id="@+id/tableLayout1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true" >
<TableRow
android:id="@+id/rowBatchId"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@color/tv_gray"
android:paddingBottom="4dp"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingTop="4dp" >
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.25"
android:text="@string/label_batch_id"/>
<TextView
android:id="@+id/divider2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.1"
android:text="@string/divider_colon"/>
<TextView
android:id="@+id/txtBatchId"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.25"
android:text="@string/label_batch_id"/>
</TableRow>
<TableRow
android:id="@+id/rowNoTransaction"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@color/tv_gray_light"
android:paddingBottom="4dp"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingTop="4dp" >
<TextView
android:id="@+id/textViewTransaction"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.25"
android:text="@string/label_no_trasaction"/>
<TextView
android:id="@+id/divider7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.1"
android:text="@string/divider_colon"/>
<TextView
android:id="@+id/txtNoTransaction"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.25"
android:text="@string/label_no_trasaction"/>
</TableRow>
<TableRow
android:id="@+id/rowBankName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@color/tv_gray"
android:paddingBottom="8dp"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingTop="8dp" >
<TextView
android:id="@+id/textView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.25"
android:text="@string/label_channel_name"/>
<TextView
android:id="@+id/divider6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.1"
android:text="@string/divider_colon"/>
<TextView
android:id="@+id/txtBankName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.25"
android:text="@string/label_bank_name"/>
</TableRow>
<TableRow
android:id="@+id/rowEvidenceTransfer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@color/tv_gray_light"
android:paddingBottom="8dp"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingTop="8dp" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.25"
android:text="@string/label_transfer_evidence_pc"/>
<TextView
android:id="@+id/divider"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.1"
android:text="@string/divider_colon"/>
<ImageView
android:id="@+id/imgEvidenceTransfer"
android:layout_width="120dp"
android:layout_height="120dp"
android:layout_weight="0.25"
android:scaleType="fitStart"
android:src="@drawable/profile_image" />
</TableRow>
</TableLayout>
</ScrollView>
<!-- <ListView -->
<!-- android:id="@+id/recapitulationList" -->
<!-- android:layout_width="match_parent" -->
<!-- android:layout_height="fill_parent" -->
<!-- android:layout_below="@+id/textView2" -->
<!-- android:layout_weight="1" > -->
<!-- </ListView> -->
<ImageButton
android:id="@+id/btnPrintDepReport"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:background="@android:color/transparent"
android:scaleType="fitXY"
android:src="@drawable/btn_print" />
</RelativeLayout>

View file

@ -0,0 +1,39 @@
package com.adins.mss.base.dynamicform;
import com.adins.mss.foundation.http.MssResponseType;
import com.google.gson.annotations.SerializedName;
public class JsonResponsePdfReceiptHistory extends MssResponseType {
@SerializedName("statusCode")
private String statusCode;
@SerializedName("message")
private String message;
@SerializedName("pdf")
private String pdf;
public String getStatusCode() {
return statusCode;
}
public void setStatusCode(String statusCode) {
this.statusCode = statusCode;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public String getPdf() {
return pdf;
}
public void setPdf(String pdf) {
this.pdf = pdf;
}
}

View file

@ -0,0 +1,120 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="8dp" >
<RelativeLayout
android:id="@+id/actionCommentLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true">
<EditText
android:id="@+id/editComment"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_toLeftOf="@+id/btnSendComment"
android:hint="@string/comment_hint" >
</EditText>
<ImageButton
android:id="@+id/btnSendComment"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:background="@android:color/transparent"
android:src="@drawable/ic_send_comment" />
</RelativeLayout>
<LinearLayout
android:id="@+id/dataTimeline"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<RelativeLayout
android:id="@+id/timelineItemLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#dfdfdf" >
<TextView
android:id="@+id/txtTitleC"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/txtDescC"
android:layout_toLeftOf="@+id/txtTimeC"
android:gravity="center_vertical"
android:minHeight="?android:attr/listPreferredItemHeightSmall"
android:paddingLeft="8dp"
android:text="@string/title"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="@+id/txtDescC"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/timelineImageC"
android:layout_below="@+id/txtTitleC"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp"
android:paddingLeft="8dp"
android:text="@string/description"
android:textAppearance="?android:attr/textAppearanceSmall" />
<ImageView
android:id="@+id/timelineImageC"
android:layout_width="fill_parent"
android:layout_height="96dp"
android:layout_below="@+id/txtDescC"
android:paddingLeft="8dp"
android:scaleType="centerCrop"
android:src="@drawable/img_notavailable" />
<TextView
android:id="@+id/txtTimeC"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/txtTitleC"
android:layout_alignBottom="@+id/txtTitleC"
android:layout_alignParentRight="true"
android:layout_marginRight="8dp"
android:text="@string/defaultTime"
android:textAppearance="?android:attr/textAppearanceSmall" />
</RelativeLayout>
</LinearLayout>
<TextView
android:id="@+id/jmlComments"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/dataTimeline"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp"
android:text="@string/defaultComment"
android:textStyle="bold"
android:textAppearance="?android:attr/textAppearanceSmall" />
<LinearLayout
android:id="@+id/commentLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/actionCommentLayout"
android:layout_below="@+id/jmlComments"
android:orientation="vertical" >
<ListView
android:id="@+id/commentList"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:divider="@android:color/transparent"
android:dividerHeight="5dp" >
</ListView>
</LinearLayout>
</RelativeLayout>

View file

@ -0,0 +1,141 @@
package com.adins.mss.base.authentication;
import com.adins.mss.dao.GeneralParameter;
import com.adins.mss.dao.Menu;
import com.adins.mss.dao.User;
import java.util.List;
public class AuthenticationResultBean {
private String message;
private String otaLink;
private String lastUpdateVersion;
// private String job;
private int loginResult;
private boolean isActiveUser;
private boolean forceUpdate;
private boolean needUpdatePassword;
private User userInfo;
private List<GeneralParameter> generalParameters;
private List<Menu> listMenu;
public AuthenticationResultBean() {
// TODO Auto-generated constructor stub
}
public List<Menu> getListMenu() {
return listMenu;
}
public void setListMenu(List<Menu> listMenu) {
this.listMenu = listMenu;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public String getOtaLink() {
return otaLink;
}
public void setOtaLink(String otaLink) {
this.otaLink = otaLink;
}
public String getLastUpdateVersion() {
return lastUpdateVersion;
}
public void setLastUpdateVersion(String lastUpdateVersion) {
this.lastUpdateVersion = lastUpdateVersion;
}
// public String getJob() {
// return job;
// }
//
//
//
// public void setJob(String job) {
// this.job = job;
// }
public int getLoginResult() {
return loginResult;
}
public void setLoginResult(int loginResult) {
this.loginResult = loginResult;
}
public boolean isActiveUser() {
return isActiveUser;
}
public void setActiveUser(boolean isActiveUser) {
this.isActiveUser = isActiveUser;
}
public boolean isForceUpdate() {
return forceUpdate;
}
public void setForceUpdate(boolean forceUpdate) {
this.forceUpdate = forceUpdate;
}
public boolean needUpdatePassword() {
return needUpdatePassword;
}
public void setNeedUpdatePassword(boolean needUpdatePassword) {
this.needUpdatePassword = needUpdatePassword;
}
public List<GeneralParameter> getGeneralParameters() {
return generalParameters;
}
public void setGeneralParameters(List<GeneralParameter> generalParameters) {
this.generalParameters = generalParameters;
}
public User getUserInfo() {
return userInfo;
}
public void setUserInfo(User userInfo) {
this.userInfo = userInfo;
}
}

View file

@ -0,0 +1,619 @@
package com.adins.mss.coll.fragments;
import android.bluetooth.BluetoothAdapter;
import android.content.Context;
import android.os.Bundle;
import android.os.Handler;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentTransaction;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;
import com.adins.mss.base.GlobalData;
import com.adins.mss.base.NewMainActivity;
import com.adins.mss.base.crashlytics.FireCrash;
import com.adins.mss.base.util.Utility;
import com.adins.mss.coll.R;
import com.adins.mss.coll.commons.Generator;
import com.adins.mss.coll.commons.Toaster;
import com.adins.mss.coll.dummy.UserHelpCOLDummy;
import com.adins.mss.coll.fragments.view.DepositReportRecapitulateView;
import com.adins.mss.coll.tool.Constants;
import com.adins.mss.constant.Global;
import com.adins.mss.dao.DepositReportD;
import com.adins.mss.dao.DepositReportH;
import com.adins.mss.dao.GeneralParameter;
import com.adins.mss.dao.PrintItem;
import com.adins.mss.dao.PrintResult;
import com.adins.mss.dao.Scheme;
import com.adins.mss.dao.TaskD;
import com.adins.mss.dao.TaskH;
import com.adins.mss.foundation.UserHelp.UserHelp;
import com.adins.mss.foundation.db.dataaccess.DepositReportDDataAccess;
import com.adins.mss.foundation.db.dataaccess.DepositReportHDataAccess;
import com.adins.mss.foundation.db.dataaccess.GeneralParameterDataAccess;
import com.adins.mss.foundation.db.dataaccess.PrintItemDataAccess;
import com.adins.mss.foundation.db.dataaccess.PrintResultDataAccess;
import com.adins.mss.foundation.db.dataaccess.SchemeDataAccess;
import com.adins.mss.foundation.db.dataaccess.TaskDDataAccess;
import com.adins.mss.foundation.db.dataaccess.TaskHDataAccess;
import com.adins.mss.foundation.formatter.Tool;
import org.acra.ACRA;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import static com.adins.mss.constant.Global.SHOW_USERHELP_DELAY_DEFAULT;
/**
* Created by Aditya Purwa on 2/13/2015.
*/
public class DepositReportRecapitulateFragment extends Fragment {
protected double total = 0;
String batchId;
private DepositReportRecapitulateView view;
List<TaskD> reportsReconcile = new ArrayList<TaskD>();
private int totalNeedPrint;
private DepositReportH header;
ListView list;
public void setBatchId(String batchId) {
this.batchId = batchId;
}
@Override
public void onAttach(Context context) {
super.onAttach(context);
view = new DepositReportRecapitulateView(getActivity());
setHasOptionsMenu(true);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
return view.layoutInflater(inflater, container);
// return inflater.inflate(R.layout.new_fragment_deposit_report_recapitulate, container, false);
}
@Override
public void onViewCreated(View mView, Bundle savedInstanceState) {
super.onViewCreated(mView, savedInstanceState);
ACRA.getErrorReporter().putCustomData("LAST_CLASS_ACCESSED", getClass().getSimpleName());
initialize();
view.onCreate();
view.publish();
// Button transferButton = (Button) mView.findViewById(R.id.btnTransfer);
// transferButton.setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View v) {
// if (total != 0)
// transfer();
// else
// Toast.makeText(getActivity(), getString(R.string.transfer_failed), Toast.LENGTH_SHORT).show();
// }
// });
Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
UserHelpCOLDummy.showDummyDepositReport(
DepositReportRecapitulateFragment.this.getActivity(),
DepositReportRecapitulateFragment.this.getClass().getSimpleName(),
view);
}
}, SHOW_USERHELP_DELAY_DEFAULT);
}
@Override
public void onDestroyView() {
super.onDestroyView();
Utility.freeMemory();
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if(item.getItemId() == R.id.mnGuide){
if(!Global.BACKPRESS_RESTRICTION) {
Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
UserHelpCOLDummy.showDummyDepositReport(
DepositReportRecapitulateFragment.this.getActivity(),
DepositReportRecapitulateFragment.this.getClass().getSimpleName(),
view);
}
}, SHOW_USERHELP_DELAY_DEFAULT);
}
}
return super.onOptionsItemSelected(item);
}
public void generatePrintResultDepReport(Context activity, String cashierName, DepositReportH report) {
List<PrintItem> printItemList = PrintItemDataAccess.getAll(activity, "DUMYUUIDSCHEMEFORDEPOSITREPORT");
List<PrintResult> printResultList = new ArrayList<PrintResult>();
//delete dulu yang ada di database, karena generate printResult dengan jawaban yang baru
try {
List<PrintResult> printResultByTaskH = PrintResultDataAccess.getAll(activity, report.getBatch_id());
if (printResultByTaskH != null && printResultByTaskH.size() > 0) {
PrintResultDataAccess.delete(activity, report.getBatch_id());
}
} catch (Exception ex) {
ex.printStackTrace();
}
PrintResult PRtransferBy = new PrintResult(Tool.getUUID());
PRtransferBy.setPrint_type_id(Global.PRINT_ANSWER);
PRtransferBy.setUser(GlobalData.getSharedGlobalData().getUser());
PRtransferBy.setUuid_task_h(report.getBatch_id());
for (PrintItem bean : printItemList) {
PrintResult printResult = new PrintResult(Tool.getUUID());
printResult.setPrint_type_id(bean.getPrint_type_id());
printResult.setUser(GlobalData.getSharedGlobalData().getUser());
printResult.setUuid_task_h(report.getBatch_id());
if (bean.getPrint_type_id().equals(Global.PRINT_ANSWER)) {
String label = bean.getPrint_item_label();
if (label.equals("Batch ID")) {
printResult.setLabel(label);
printResult.setValue(report.getBatch_id());
} else if (label.equals("Transfer By")) {
if (!report.getBatch_id().equalsIgnoreCase("-")) {
printResult.setLabel(label);
if (cashierName != null && cashierName.length() > 0) {
printResult.setValue("Cashier");
PRtransferBy.setLabel(label);
PRtransferBy.setValue("Cashier");
} else {
printResult.setValue("Bank");
PRtransferBy.setLabel(label);
PRtransferBy.setValue("Bank");
}
}
} else if (label.equals("Cashier Name")) {
if (PRtransferBy.getValue() != null && PRtransferBy.getValue().equals("Cashier")) {
printResult.setLabel(label);
printResult.setValue(report.getCashier_name());
}
} else if (label.equals("Account No")) {
if (PRtransferBy.getValue() != null && PRtransferBy.getValue().equals("Bank")) {
printResult.setLabel(label);
printResult.setValue(report.getBank_account());
}
} else if (label.equals("Bank Name")) {
if (PRtransferBy.getValue() != null && PRtransferBy.getValue().equals("Bank")) {
printResult.setLabel(label);
printResult.setValue(report.getBank_name());
}
} else if (label.contains("Agreement No")) {
int no = Integer.valueOf(label.replace("Agreement No", ""));
printResult.setLabel("Agreement No");
List<DepositReportD> reportDs = report
.getDepositReportDList();
try {
TaskH taskHs = TaskHDataAccess.getOneHeader(activity,
reportDs.get(no).getUuid_task_h());
String agreement_no = "";
if (taskHs != null)
agreement_no = taskHs.getAppl_no();
if (agreement_no == null)
agreement_no = "-";
printResult.setValue(agreement_no);
} catch (Exception e) {
FireCrash.log(e);
// TODO: handle exception
}
} else if (label.contains("Deposit Amount")) {
int no = Integer.valueOf(label
.replace("Deposit Amount", ""));
printResult.setLabel("Deposit Amt");
List<DepositReportD> reportDs = report
.getDepositReportDList();
try {
printResult.setValue(Tool.separateThousand(reportDs
.get(no).getDeposit_amt(), false));
} catch (Exception e) {
FireCrash.log(e);
// TODO: handle exception
}
} else if (label.equals("Total")) {
printResult.setLabel(label);
printResult.setValue(String.valueOf(Tool
.separateThousand(total, false)));
}
} else if (bean.getPrint_type_id().equals(
Global.PRINT_BRANCH_ADDRESS)) {
printResult.setLabel(GlobalData.getSharedGlobalData().getUser()
.getBranch_address());
printResult.setValue("");
} else if (bean.getPrint_type_id().equals(Global.PRINT_BRANCH_NAME)) {
printResult.setLabel(GlobalData.getSharedGlobalData().getUser()
.getBranch_name());
printResult.setValue("");
} else if (bean.getPrint_type_id().equals(Global.PRINT_BT_ID)) {
String btAddr = "?";
try {
btAddr = BluetoothAdapter.getDefaultAdapter().getAddress();
} catch (Exception e) {
FireCrash.log(e);
}
printResult.setLabel(bean.getPrint_item_label());
printResult.setValue(btAddr);
} else if (bean.getPrint_type_id().equals(Global.PRINT_LABEL)) {
printResult.setLabel(bean.getPrint_item_label());
printResult.setValue("");
} else if (bean.getPrint_type_id().equals(Global.PRINT_LABEL_BOLD)) {
printResult.setLabel(bean.getPrint_item_label());
printResult.setValue("");
} else if (bean.getPrint_type_id()
.equals(Global.PRINT_LABEL_CENTER)) {
printResult.setLabel(bean.getPrint_item_label());
printResult.setValue("");
} else if (bean.getPrint_type_id().equals(
Global.PRINT_LABEL_CENTER_BOLD)) {
printResult.setLabel(bean.getPrint_item_label());
printResult.setValue("");
} else if (bean.getPrint_type_id().equals(Global.PRINT_LOGO)) {
printResult.setLabel("");
printResult.setValue("");
} else if (bean.getPrint_type_id().equals(Global.PRINT_NEW_LINE)) {
String label = bean.getPrint_item_label();
int no = Integer.valueOf(label.replace("New Line", ""));
List<DepositReportD> reportDs = DepositReportDDataAccess.getAll(getContext(), report.getUuid_deposit_report_h());
int size = reportDs.size();
if (no < size) {
printResult.setLabel("------------------------------");
printResult.setValue("\n");
}
if (no == 999) {
printResult.setLabel("==============================");
printResult.setValue("\n");
}
if (no == 998) {
printResult.setLabel("\n");
printResult.setValue("\n");
}
} else if (bean.getPrint_type_id().equals(Global.PRINT_TIMESTAMP)) {
printResult.setLabel(bean.getPrint_item_label());
printResult.setValue("");
} else if (bean.getPrint_type_id().equals(Global.PRINT_USER_NAME)) {
printResult.setLabel(bean.getPrint_item_label());
printResult.setValue(GlobalData.getSharedGlobalData().getUser()
.getFullname());
} else if (bean.getPrint_type_id().equals(Global.PRINT_LOGIN_ID)) {
printResult.setLabel(bean.getPrint_item_label());
printResult.setValue(GlobalData.getSharedGlobalData().getUser().getLogin_id());
}
if (printResult.getLabel() != null) {
PrintResultDataAccess.add(activity, printResult);
}
}
}
private void initialize() {
loadData();
}
private void loadData() {
reportsReconcile.clear();
String uuidUser = GlobalData.getSharedGlobalData().getUser().getUuid_user();
List<TaskD> reports = TaskDDataAccess.getTaskDTagTotal(getActivity(), uuidUser);
for (TaskD taskD : reports) {
TaskH taskH = TaskHDataAccess.getOneHeader(getActivity(), taskD.getUuid_task_h());
if (taskH != null && taskH.getIs_reconciled() != null) {
if (taskH.getIs_reconciled().equals("0")) {
reportsReconcile.add(taskD);
}
}
if (taskH != null) {
int printCount = taskH.getPrint_count() != null ? taskH.getPrint_count() : 0;
String rvNumber = taskH.getRv_number();
boolean isRVinFront = GeneralParameterDataAccess.isRvInFrontEnable(getActivity(), GlobalData.getSharedGlobalData().getUser().getUuid_user());
if (printCount > 0 || (rvNumber != null && !rvNumber.isEmpty()) || isRVinFront) {
// do nothing
} else {
try {
String uuidScheme = taskH.getUuid_scheme();
Scheme scheme = SchemeDataAccess.getOne(getActivity(), uuidScheme);
if (scheme != null) {
if (scheme.getIs_printable().equals(Global.TRUE_STRING))
totalNeedPrint++;
}
} catch (Exception e) {
FireCrash.log(e);
{
totalNeedPrint++;
}
}
}
}
list = (ListView) getView().findViewById(R.id.listRecapitulationDetail);
list.setAdapter(new RecapitulationListAdapter(
getActivity(),
R.layout.item_recapitulation_detail,
reportsReconcile.toArray(new TaskD[reportsReconcile.size()])
)
);
}
total = sumOfItems(reportsReconcile);
// ListView list = (ListView) getView().findViewById(R.id.listRecapitulationDetail);
// list.setAdapter(new RecapitulationListAdapter(
// getActivity(),
// R.layout.item_recapitulation_detail,
// reportsReconcile.toArray(new TaskD[reportsReconcile.size()])
// )
// );
// void transfer() {
// ListView list = (ListView) getView().findViewById(R.id.recapitulationList);
// if (list.getAdapter().getCount() <= 2) {
// Toaster.warning(getActivity(), getString(R.string.nothing_to_report));
// return;
// }else if (totalNeedPrint > 0) {
// Toaster.warning(getActivity(), getActivity().getString(R.string.prompt_printRV));
// return;
// }
//
// BigDecimal totalValue = new BigDecimal(total);
// Bundle bundle = new Bundle();
// bundle.putString(Constants.KEY_BUND_BATCHID, batchId);
// bundle.putString("TOTAL_DEPOSIT", totalValue.toString());
//
// DepositReportTransferFragment fragment = new DepositReportTransferFragment();
// fragment.setArguments(bundle);
// FragmentTransaction transaction = MainMenuActivity.fragmentManager.beginTransaction();
// transaction.setCustomAnimations(R.anim.activity_open_translate,R.anim.activity_close_scale,R.anim.activity_open_scale,R.anim.activity_close_translate);
// transaction.replace(R.id.content_frame, fragment);
// transaction.addToBackStack(null);
// transaction.commit();
// }
// private class RecapitulationListAdapter extends ArrayAdapter<TaskD> {
//
// private final TaskD[] originalItems;
//
// public RecapitulationListAdapter(Context context, int resource, TaskD[] objects) {
// super(context, resource, objects);
// originalItems = objects;
// }
//
// @Override
// public int getCount() {
// return super.getCount() + 2;
// }
//
//
// @Override
// public View getView(int position, View convertView, ViewGroup parent) {
// View view = null;
// if (position == 0) {
// view = LayoutInflater.from(getContext()).inflate(R.layout.item_recapitulation_detail_black, parent, false);
//
// TextView label = (TextView) view.findViewById(R.id.itemLabel);
// TextView value = (TextView) view.findViewById(R.id.itemValue);
// label.setText("Batch ID");
// value.setText(Generator.generateBatchId(getContext()));
// batchId=value.getText().toString().trim();
// } else {
// view = LayoutInflater.from(getContext()).inflate(R.layout.item_recapitulation_detail, parent, false);
//
//
// TextView label = (TextView) view.findViewById(R.id.itemLabel);
// TextView value = (TextView) view.findViewById(R.id.itemValue);
//
// if (position == getCount() - 1) {
// label.setText("Total");
// value.setText(Tool.separateThousand(String.valueOf(sumOfItems(new ArrayList<TaskD>(Arrays.asList(originalItems))))));
// } else {
// TaskD item = getItem(position-1);
//// label.setText(item.getTaskH().getTask_id());
// label.setText(item.getTaskH().getAppl_no());
// value.setText(Tool.separateThousand(item.getText_answer()));
// }
// }
//
// return view;
// }
// }
//
// private double sumOfItems(List<TaskD> items) {
// double sum = 0;
// try {
// for (TaskD item : items) {
// String value = item.getText_answer();
// if(value==null || value.equals("")) value = "0";
// String tempAnswer = Tool.deleteAll(value, ",");
// String[] intAnswer = Tool.split(tempAnswer, ".");
// if(intAnswer.length>1){
// if(intAnswer[1].equals("00"))
// value = intAnswer[0];
// else {
// value=tempAnswer;
// }
// }else{
// value=tempAnswer;
// }
// double finalValue = Double.parseDouble(value);
// sum += finalValue;
// }
// } catch (Exception e) { FireCrash.log(e);
// // TODO: handle exception
// }
// return sum;
// }
}
void transfer() {
String uuidUser = GlobalData.getSharedGlobalData().getUser().getUuid_user();
//NEW GS_PRINT_LOCK_MC
GeneralParameter GSPrintLock = GeneralParameterDataAccess.getOne(getContext(), uuidUser, Global.GS_PRINT_LOCK_MC);
// ListView list = (ListView) getView().findViewById(R.id.listRecapitulationDetail);
if (list.getAdapter().getCount() <= 0) {
Toaster.warning(getActivity(), getString(R.string.nothing_to_report));
return;
} else if (totalNeedPrint > 0) {
//2018-10-30 | Add Bypass Print Lock
if (GSPrintLock != null && GSPrintLock.getGs_value().equals("1")) {
Toaster.warning(getActivity(), getActivity().getString(R.string.prompt_printRV));
return;
}
}
BigDecimal totalValue = new BigDecimal(total);
Bundle bundle = new Bundle();
bundle.putString(Constants.KEY_BUND_BATCHID, batchId);
bundle.putString("TOTAL_DEPOSIT", totalValue.toString());
DepositReportTransferFragment fragment = new DepositReportTransferFragment();
fragment.setArguments(bundle);
// AuthCashierFragment fragment = AuthCashierFragment.newInstance(bundle);
FragmentTransaction transaction = NewMainActivity.fragmentManager.beginTransaction();
transaction.setCustomAnimations(R.anim.activity_open_translate, R.anim.activity_close_scale, R.anim.activity_open_scale, R.anim.activity_close_translate);
transaction.replace(R.id.content_frame, fragment);
transaction.commit();
}
private double sumOfItems(List<TaskD> items) {
double sum = 0;
try {
for (TaskD item : items) {
String value = item.getText_answer();
if (value == null || value.equals("")) value = "0";
String tempAnswer = Tool.deleteAll(value, ",");
String[] intAnswer = Tool.split(tempAnswer, ".");
if (intAnswer.length > 1) {
if (intAnswer[1].equals("00"))
value = intAnswer[0];
else {
value = tempAnswer;
}
} else {
value = tempAnswer;
}
double finalValue = Double.parseDouble(value);
sum += finalValue;
}
} catch (Exception e) {
FireCrash.log(e);
// TODO: handle exception
}
return sum;
}
private DepositReportH prepareDummyDepositRHeader() {
final DepositReportH header = new DepositReportH();
header.setCashier_name("-");
// header.setUser_id("");
// header.setUser_pass("");
header.setUuid_deposit_report_h(Tool.getUUID());
header.setBatch_id("-");
header.setTransfered_date(Tool.getSystemDateTime());
header.setDtm_crt(Tool.getSystemDateTime());
header.setUuid_user(GlobalData.getSharedGlobalData().getUser().getUuid_user());
header.setUser(GlobalData.getSharedGlobalData().getUser());
ArrayList<DepositReportD> details = new ArrayList<DepositReportD>();
String uuidUser = GlobalData.getSharedGlobalData().getUser().getUuid_user();
for (TaskD task : reportsReconcile) {
DepositReportD detail = new DepositReportD();
detail.setUuid_task_h(task.getUuid_task_h());
detail.setDtm_crt(Tool.getSystemDateTime());
detail.setUsr_crt(uuidUser);
detail.setUuid_deposit_report_d(Tool.getUUID());
String value = task.getText_answer();
if (value == null || value.equals(""))
value = "0";
String tempAnswer = Tool.deleteAll(value, ",");
String[] intAnswer = Tool.split(tempAnswer, ".");
if (intAnswer.length > 1) {
if (intAnswer[1].equals("00"))
value = intAnswer[0];
else {
value = tempAnswer;
}
} else {
value = tempAnswer;
}
detail.setDeposit_amt(value);
detail.setUuid_deposit_report_h(header.getUuid_deposit_report_h());
details.add(detail);
}
DepositReportHDataAccess.add(getActivity(), header);
for (DepositReportD reportD : details) {
reportD.setIs_sent("10");
reportD.setDepositReportH(header);
DepositReportDDataAccess.add(getActivity(), reportD);
}
generatePrintResultDepReport(getContext(), "-", header);
return header;
}
private class RecapitulationListAdapter extends ArrayAdapter<TaskD> {
private final TaskD[] originalItems;
public RecapitulationListAdapter(Context context, int resource, TaskD[] objects) {
super(context, resource, objects);
originalItems = objects;
}
@Override
public int getCount() {
return super.getCount() + 2;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View view = null;
if (position == 0) {
view = LayoutInflater.from(getContext()).inflate(R.layout.item_recapitulation_detail_black, parent, false);
TextView label = (TextView) view.findViewById(R.id.itemLabel);
TextView value = (TextView) view.findViewById(R.id.itemValue);
label.setText("Batch ID");
value.setText(Generator.generateBatchId(getContext()));
batchId = value.getText().toString().trim();
} else {
view = LayoutInflater.from(getContext()).inflate(R.layout.item_recapitulation_detail, parent, false);
TextView label = (TextView) view.findViewById(R.id.itemLabel);
TextView value = (TextView) view.findViewById(R.id.itemValue);
if (position == getCount() - 1) {
label.setText("Total");
value.setText(Tool.separateThousand(String.valueOf(sumOfItems(new ArrayList<TaskD>(Arrays.asList(originalItems))))));
} else {
TaskD item = getItem(position - 1);
// label.setText(item.getTaskH().getTask_id());
label.setText(item.getTaskH().getAppl_no());
value.setText(Tool.separateThousand(item.getText_answer()));
}
}
return view;
}
}
}