new download branch
This commit is contained in:
@@ -229,7 +229,7 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
||||
|
||||
try {
|
||||
|
||||
dbcursor = db.rawQuery("SELECT DISTINCT BR.BRAND_ID, SCM.SUB_CATEGORY||'-'||BR.BRAND AS BRAND FROM MAPPING_STOCK MS INNER JOIN SKU_MASTER SM ON MS.SKU_ID = SM.SKU_ID INNER JOIN BRAND_MASTER BR ON SM.BRAND_ID=BR.BRAND_ID INNER JOIN SUB_CATEGORY_MASTER SCM ON BR.SUB_CATEGORY_ID = SCM.SUB_CATEGORY_ID WHERE MS.KEYACCOUNT_ID ='"+key_account_id +"' AND STORETYPE_ID ='" + store_type_id + "' AND CLASS_ID = "+ class_id +"'",null);
|
||||
dbcursor = db.rawQuery("SELECT * FROM(SELECT DISTINCT BR.BRAND_ID, SCM.SUB_CATEGORY||'-'||BR.BRAND AS BRAND FROM MAPPING_STOCK MS INNER JOIN SKU_MASTER SM ON MS.SKU_ID = SM.SKU_ID INNER JOIN BRAND_MASTER BR ON SM.BRAND_ID=BR.BRAND_ID INNER JOIN SUB_CATEGORY_MASTER SCM ON BR.SUB_CATEGORY_ID = SCM.SUB_CATEGORY_ID WHERE MS.KEYACCOUNT_ID ='"+key_account_id +"' AND STORETYPE_ID ='" + store_type_id + "' AND CLASS_ID = '"+ class_id +"') As Brand",null);
|
||||
if(dbcursor != null){
|
||||
dbcursor.moveToFirst();
|
||||
while(!dbcursor.isAfterLast()){
|
||||
@@ -269,7 +269,7 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
||||
|
||||
try {
|
||||
|
||||
dbcursor = db.rawQuery("SELECT DISTINCT SM.SKU, SM.SKU_ID, BR.BRAND_ID FROM MAPPING_STOCK MS INNER JOIN SKU_MASTER SM ON MS.SKU_ID = SM.SKU_ID INNER JOIN BRAND_MASTER BR ON SM.BRAND_ID=BR.BRAND_ID INNER JOIN SUB_CATEGORY_MASTER SCM ON BR.SUB_CATEGORY_ID = SCM.SUB_CATEGORY_ID WHERE MS.KEYACCOUNT_ID ='"+key_account_id +"' AND STORETYPE_ID ='" + store_type_id + "' AND CLASS_ID = "+ class_id +"' AND SM.BRAND_ID='"+ brand_id + "'",null);
|
||||
dbcursor = db.rawQuery("SELECT DISTINCT SM.SKU, SM.SKU_ID, BR.BRAND_ID FROM MAPPING_STOCK MS INNER JOIN SKU_MASTER SM ON MS.SKU_ID = SM.SKU_ID INNER JOIN BRAND_MASTER BR ON SM.BRAND_ID=BR.BRAND_ID INNER JOIN SUB_CATEGORY_MASTER SCM ON BR.SUB_CATEGORY_ID = SCM.SUB_CATEGORY_ID WHERE MS.KEYACCOUNT_ID ='"+key_account_id +"' AND STORETYPE_ID ='" + store_type_id + "' AND CLASS_ID = '"+ class_id +"' AND SM.BRAND_ID='"+ brand_id + "'",null);
|
||||
if(dbcursor != null){
|
||||
dbcursor.moveToFirst();
|
||||
while(!dbcursor.isAfterLast()){
|
||||
|
||||
@@ -127,10 +127,10 @@ public class SelectLanguageActivity extends AppCompatActivity implements View.On
|
||||
|
||||
String lang ;
|
||||
|
||||
if(language.equals("English")){
|
||||
if(language.equalsIgnoreCase("English")){
|
||||
lang = "EN";
|
||||
}
|
||||
else if(language.equals("UAE")) {
|
||||
else if(language.equalsIgnoreCase("UAE")) {
|
||||
lang = "AR";
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -6,8 +6,7 @@ package cpm.com.gskmtorange.constant;
|
||||
|
||||
public class CommonString {
|
||||
|
||||
// webservice constants
|
||||
|
||||
// webservice constants
|
||||
|
||||
// preferenec keys
|
||||
public static final String KEY_USERNAME = "username";
|
||||
@@ -16,7 +15,6 @@ public class CommonString {
|
||||
public static final String KEY_STOREVISITED_STATUS = "STOREVISITED_STATUS";
|
||||
|
||||
|
||||
|
||||
public static final String KEY_PATH = "path";
|
||||
public static final String KEY_VERSION = "APP_VERSION";
|
||||
|
||||
|
||||
@@ -80,7 +80,6 @@ public class StoreListActivity extends AppCompatActivity {
|
||||
public void onItemClick(AdapterView<?> parent, View view,
|
||||
int position, long id) {
|
||||
|
||||
|
||||
Toast.makeText(getApplicationContext(), "Click", Toast.LENGTH_LONG).show();
|
||||
|
||||
}
|
||||
|
||||
+207
-11
@@ -1,6 +1,8 @@
|
||||
package cpm.com.gskmtorange.dailyentry;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.os.Bundle;
|
||||
import android.support.design.widget.FloatingActionButton;
|
||||
@@ -13,19 +15,24 @@ import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
import android.widget.ToggleButton;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import cpm.com.gskmtorange.Database.GSKOrangeDB;
|
||||
import cpm.com.gskmtorange.R;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.BrandMasterGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.GapsChecklistGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.SkuGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.SkuMasterGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.T2PGetterSetter;
|
||||
|
||||
@@ -64,7 +71,7 @@ public class T2PComplianceActivity extends AppCompatActivity {
|
||||
|
||||
t2PGetterSetters = db.getT2PDefaultData("1");
|
||||
|
||||
if(t2PGetterSetters.size()>0){
|
||||
if (t2PGetterSetters.size() > 0) {
|
||||
rec_t2p.setLayoutManager(new LinearLayoutManager(getApplicationContext()));
|
||||
t2PAdapter = new T2PAdapter(t2PGetterSetters);
|
||||
rec_t2p.setAdapter(t2PAdapter);
|
||||
@@ -98,8 +105,8 @@ public class T2PComplianceActivity extends AppCompatActivity {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
ArrayList<GapsChecklistGetterSetter> gapsChecklist = showGapsDialog(mItem.getDisplay_id());
|
||||
if(gapsChecklist.size()>0){
|
||||
ArrayList<GapsChecklistGetterSetter> gapsChecklist = showGapsDialog(mItem.getDisplay_id());
|
||||
if (gapsChecklist.size() > 0) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -146,10 +153,10 @@ public class T2PComplianceActivity extends AppCompatActivity {
|
||||
}
|
||||
}
|
||||
|
||||
public ArrayList<GapsChecklistGetterSetter> showGapsDialog(String display_id){
|
||||
public ArrayList<GapsChecklistGetterSetter> showGapsDialog(String display_id) {
|
||||
ArrayList<GapsChecklistGetterSetter> gapsChecklist = db.getGapsDefaultData(display_id);
|
||||
|
||||
Dialog dialog = new Dialog(T2PComplianceActivity.this);
|
||||
final Dialog dialog = new Dialog(T2PComplianceActivity.this);
|
||||
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
dialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
|
||||
dialog.setContentView(R.layout.gaps_dialog_layout);
|
||||
@@ -159,23 +166,87 @@ public class T2PComplianceActivity extends AppCompatActivity {
|
||||
GapsAdapter gapAdapter = new GapsAdapter(gapsChecklist);
|
||||
rec_gap_checklist.setAdapter(gapAdapter);
|
||||
|
||||
//dialog.setCancelable(false);
|
||||
Button btn_save = (Button) dialog.findViewById(R.id.btn_save);
|
||||
btn_save.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
dialog.cancel();
|
||||
}
|
||||
});
|
||||
|
||||
dialog.setCancelable(false);
|
||||
dialog.show();
|
||||
|
||||
return gapsChecklist;
|
||||
}
|
||||
|
||||
public void showSkuDialog(){
|
||||
public void showSkuDialog() {
|
||||
|
||||
ArrayList<BrandMasterGetterSetter> brandList = db.getBrandT2PData("1", "1", "1");
|
||||
// ArrayList<SkuMasterGetterSetter> skuMasterGetterSetterArrayList = db.getSkuT2PData("1", "1", "1",)
|
||||
final ArrayList<BrandMasterGetterSetter> brandList = db.getBrandT2PData("1", "1", "1");
|
||||
BrandMasterGetterSetter brand = new BrandMasterGetterSetter();
|
||||
brand.setBRAND("select");
|
||||
brandList.add(0,brand);
|
||||
// ArrayList<SkuMasterGetterSetter> skuMasterGetterSetterArrayList = db.getSkuT2PData("1", "1", "1",)
|
||||
|
||||
Dialog dialog = new Dialog(T2PComplianceActivity.this);
|
||||
final Dialog dialog = new Dialog(T2PComplianceActivity.this);
|
||||
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
dialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
|
||||
dialog.setContentView(R.layout.t2p_sku_dialog_layout);
|
||||
//pb = (ProgressBar) dialog.findViewById(R.id.progressBar1);
|
||||
//dialog.setCancelable(false);
|
||||
//dialog.setCancelable(false);
|
||||
Spinner spinner_brand = (Spinner) dialog.findViewById(R.id.spinner_brand);
|
||||
final Spinner spinner_sku = (Spinner) dialog.findViewById(R.id.spinner_sku);
|
||||
Button btn_add = (Button) dialog.findViewById(R.id.btn_add);
|
||||
btn_add.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
dialog.cancel();
|
||||
}
|
||||
});
|
||||
|
||||
// Create custom adapter object ( see below CustomAdapter.java )
|
||||
CustomAdapter adapter = new CustomAdapter(T2PComplianceActivity.this, R.layout.custom_spinner_item, brandList);
|
||||
// Set adapter to spinner
|
||||
spinner_brand.setAdapter(adapter);
|
||||
|
||||
ArrayList<SkuGetterSetter> empty_list = new ArrayList<>();
|
||||
SkuGetterSetter select = new SkuGetterSetter();
|
||||
select.setSKU("Select");
|
||||
empty_list.add(select);
|
||||
CustomSkuAdapter skuadapter = new CustomSkuAdapter(T2PComplianceActivity.this, R.layout.custom_spinner_item, empty_list);
|
||||
spinner_sku.setAdapter(skuadapter);
|
||||
|
||||
|
||||
spinner_brand.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||
|
||||
if(position!=0){
|
||||
|
||||
String brand_id = brandList.get(position).getBRAND_ID().get(0);
|
||||
|
||||
ArrayList<SkuGetterSetter> sku_list = db.getSkuT2PData("1", "1", "1", brand_id);
|
||||
SkuGetterSetter select = new SkuGetterSetter();
|
||||
select.setSKU("Select");
|
||||
sku_list.add(0,select);
|
||||
// Create custom adapter object ( see below CustomSkuAdapter.java )
|
||||
CustomSkuAdapter skuadapter = new CustomSkuAdapter(T2PComplianceActivity.this, R.layout.custom_spinner_item, sku_list);
|
||||
// Set adapter to spinner
|
||||
spinner_sku.setAdapter(skuadapter);
|
||||
|
||||
spinner_sku.setSelection(0);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> parent) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
dialog.show();
|
||||
|
||||
}
|
||||
@@ -236,4 +307,129 @@ public class T2PComplianceActivity extends AppCompatActivity {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class CustomAdapter extends ArrayAdapter<String> {
|
||||
|
||||
private Activity activity;
|
||||
private ArrayList data;
|
||||
BrandMasterGetterSetter tempValues = null;
|
||||
LayoutInflater inflater;
|
||||
|
||||
/*************
|
||||
* CustomAdapter Constructor
|
||||
*****************/
|
||||
public CustomAdapter(
|
||||
T2PComplianceActivity activitySpinner,
|
||||
int textViewResourceId,
|
||||
ArrayList objects
|
||||
|
||||
) {
|
||||
super(activitySpinner, textViewResourceId, objects);
|
||||
|
||||
/********** Take passed values **********/
|
||||
activity = activitySpinner;
|
||||
data = objects;
|
||||
/*********** Layout inflator to call external xml layout () **********************/
|
||||
inflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getDropDownView(int position, View convertView, ViewGroup parent) {
|
||||
return getCustomView(position, convertView, parent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
return getCustomView(position, convertView, parent);
|
||||
}
|
||||
|
||||
// This funtion called for each row ( Called data.size() times )
|
||||
public View getCustomView(int position, View convertView, ViewGroup parent) {
|
||||
|
||||
/********** Inflate spinner_rows.xml file for each row ( Defined below ) ************/
|
||||
View row = inflater.inflate(R.layout.custom_spinner_item, parent, false);
|
||||
|
||||
/***** Get each Model object from Arraylist ********/
|
||||
tempValues = null;
|
||||
tempValues = (BrandMasterGetterSetter) data.get(position);
|
||||
|
||||
TextView label = (TextView) row.findViewById(R.id.tv_text);
|
||||
|
||||
if (position == 0) {
|
||||
|
||||
// Default selected Spinner item
|
||||
label.setText("Select");
|
||||
//sub.setText("");
|
||||
} else {
|
||||
// Set values for spinner each row
|
||||
label.setText(tempValues.getBRAND().get(0));
|
||||
}
|
||||
|
||||
return row;
|
||||
}
|
||||
}
|
||||
|
||||
public class CustomSkuAdapter extends ArrayAdapter<String> {
|
||||
|
||||
private Activity activity;
|
||||
private ArrayList data;
|
||||
SkuGetterSetter tempValues = null;
|
||||
LayoutInflater inflater;
|
||||
|
||||
/*************
|
||||
* CustomAdapter Constructor
|
||||
*****************/
|
||||
public CustomSkuAdapter(
|
||||
T2PComplianceActivity activitySpinner,
|
||||
int textViewResourceId,
|
||||
ArrayList objects
|
||||
|
||||
) {
|
||||
super(activitySpinner, textViewResourceId, objects);
|
||||
|
||||
/********** Take passed values **********/
|
||||
activity = activitySpinner;
|
||||
data = objects;
|
||||
/*********** Layout inflator to call external xml layout () **********************/
|
||||
inflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getDropDownView(int position, View convertView, ViewGroup parent) {
|
||||
return getCustomView(position, convertView, parent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
return getCustomView(position, convertView, parent);
|
||||
}
|
||||
|
||||
// This funtion called for each row ( Called data.size() times )
|
||||
public View getCustomView(int position, View convertView, ViewGroup parent) {
|
||||
|
||||
/********** Inflate spinner_rows.xml file for each row ( Defined below ) ************/
|
||||
View row = inflater.inflate(R.layout.custom_spinner_item, parent, false);
|
||||
|
||||
/***** Get each Model object from Arraylist ********/
|
||||
tempValues = null;
|
||||
tempValues = (SkuGetterSetter) data.get(position);
|
||||
|
||||
TextView label = (TextView) row.findViewById(R.id.tv_text);
|
||||
|
||||
if (position == 0) {
|
||||
|
||||
// Default selected Spinner item
|
||||
label.setText("Select");
|
||||
//sub.setText("");
|
||||
} else {
|
||||
// Set values for spinner each row
|
||||
label.setText(tempValues.getSKU());
|
||||
}
|
||||
|
||||
return row;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
xmlns:card_view="http://schemas.android.com/apk/res-auto"
|
||||
android:orientation="horizontal"
|
||||
>
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
card_view:cardBackgroundColor="@color/white"
|
||||
card_view:cardCornerRadius="10dp"
|
||||
>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/parent_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Checklist"
|
||||
android:textColor="@color/black"
|
||||
android:textStyle="bold"
|
||||
android:gravity="center_vertical"
|
||||
android:padding="10dp"
|
||||
android:textSize="@dimen/text_size_xsmall"
|
||||
android:paddingLeft="@dimen/custom_margin"/>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</android.support.v7.widget.CardView>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -17,6 +17,7 @@
|
||||
>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/parent_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
|
||||
@@ -48,6 +48,7 @@
|
||||
android:background="@color/grey_background">
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_save"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:weightSum="2"
|
||||
android:weightSum="3"
|
||||
android:background="@color/grey_background"
|
||||
android:padding="5dp">
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
android:id="@+id/spinner_brand"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"/>
|
||||
android:layout_weight="2"/>
|
||||
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:weightSum="2"
|
||||
android:weightSum="3"
|
||||
android:background="@color/grey_background"
|
||||
android:padding="5dp">
|
||||
|
||||
@@ -81,7 +81,7 @@
|
||||
android:id="@+id/spinner_sku"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"/>
|
||||
android:layout_weight="2"/>
|
||||
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:weightSum="2"
|
||||
android:weightSum="3"
|
||||
android:background="@color/grey_background"
|
||||
android:padding="5dp">
|
||||
|
||||
@@ -107,7 +107,8 @@
|
||||
android:id="@+id/et_stock"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"/>
|
||||
android:layout_weight="2"
|
||||
android:inputType="number"/>
|
||||
|
||||
|
||||
|
||||
@@ -120,6 +121,7 @@
|
||||
android:background="@color/grey_background">
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_add"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
|
||||
Reference in New Issue
Block a user