# Conflicts:
#	GSKMTOrange/src/main/AndroidManifest.xml
#	GSKMTOrange/src/main/java/cpm/com/gskmtorange/MainActivity.java
This commit is contained in:
Gagan290
2016-12-30 13:39:07 +05:30
parent 9b1f2d5361
commit fed55552f5
11 changed files with 252 additions and 110 deletions
@@ -17,6 +17,7 @@ import cpm.com.gskmtorange.xmlGetterSetter.CategoryMasterGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.DisplayMasterGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.JourneyPlanGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.MAPPINGT2PGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.MSL_AvailabilityGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.MappingStockGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.SkuMasterGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.SubCategoryMasterGetterSetter;
@@ -119,14 +120,12 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
}
public ArrayList<StoreBean> getStoreData(String date) {
ArrayList<StoreBean> list = new ArrayList<StoreBean>();
Cursor dbcursor = null;
try {
dbcursor = db.rawQuery("SELECT * from JOURNEY_PLAN where VISIT_DATE ='" + date + "'", null);
dbcursor = db.rawQuery("SELECT * from JOURNEY_PLAN " +
"where VISIT_DATE ='" + date + "'", null);
if (dbcursor != null) {
dbcursor.moveToFirst();
@@ -330,4 +329,129 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
Log.d("Exception ", " in MAPPING_T2P " + ex.toString());
}
}
public ArrayList<CategoryGetterSetter> getCategoryListData(String keyAccountId, String storeTypeId, String classId) {
ArrayList<CategoryGetterSetter> list = new ArrayList<>();
Cursor dbcursor = null;
try {
dbcursor = db.rawQuery("Select DISTINCT CA.CATEGORY_ID,CA.CATEGORY " +
"from MAPPING_STOCK M " +
"inner join SKU_MASTER SK " +
"on M.SKU_ID=SK.SKU_ID " +
"inner join BRAND_MASTER BR " +
"on SK.BRAND_ID=BR.BRAND_ID " +
"inner join SUB_CATEGORY_MASTER SB " +
"on BR.SUB_CATEGORY_ID=SB.SUB_CATEGORY_ID " +
"inner join CATEGORY_MASTER CA " +
"on SB.CATEGORY_ID=CA.CATEGORY_ID " +
"where M.KEYACCOUNT_ID='" + keyAccountId + "' AND " +
"M.STORETYPE_ID='" + storeTypeId + "' AND " +
"M.CLASS_ID='" + classId + "'", null);
if (dbcursor != null) {
dbcursor.moveToFirst();
while (!dbcursor.isAfterLast()) {
CategoryGetterSetter cd = new CategoryGetterSetter();
cd.setCategory_id(dbcursor.getString(dbcursor.getColumnIndexOrThrow("CATEGORY_ID")));
cd.setCategory(dbcursor.getString(dbcursor.getColumnIndexOrThrow("CATEGORY")));
cd.setCategory_img("category");
list.add(cd);
dbcursor.moveToNext();
}
dbcursor.close();
return list;
}
} catch (Exception e) {
Log.d("Exception get JCP!", e.toString());
return list;
}
return list;
}
public ArrayList<MSL_AvailabilityGetterSetter> getMSL_AvailabilityHeaderData(String category_id) {
ArrayList<MSL_AvailabilityGetterSetter> list = new ArrayList<>();
Cursor dbcursor = null;
try {
dbcursor = db.rawQuery("Select DISTINCT SB.SUB_CATEGORY_ID,SB.SUB_CATEGORY,BR.BRAND_ID,BR.BRAND " +
"from MAPPING_STOCK M " +
"inner join SKU_MASTER SK " +
"on M.SKU_ID=SK.SKU_ID " +
"inner join BRAND_MASTER BR " +
"on SK.BRAND_ID=BR.BRAND_ID " +
"inner join SUB_CATEGORY_MASTER SB " +
"on BR.SUB_CATEGORY_ID=SB.SUB_CATEGORY_ID " +
"inner join CATEGORY_MASTER CA " +
"on SB.CATEGORY_ID=CA.CATEGORY_ID " +
"where M.MUST_HAVE=1 AND CA.CATEGORY_ID='" + category_id + "' " +
"order by SB.SUB_CATEGORY,BR.BRAND", null);
if (dbcursor != null) {
dbcursor.moveToFirst();
while (!dbcursor.isAfterLast()) {
MSL_AvailabilityGetterSetter cd = new MSL_AvailabilityGetterSetter();
cd.setSub_category_id(dbcursor.getString(dbcursor.getColumnIndexOrThrow("SUB_CATEGORY_ID")));
cd.setSub_category(dbcursor.getString(dbcursor.getColumnIndexOrThrow("SUB_CATEGORY")));
cd.setBrand_id(dbcursor.getString(dbcursor.getColumnIndexOrThrow("BRAND_ID")));
cd.setBrand(dbcursor.getString(dbcursor.getColumnIndexOrThrow("BRAND")));
list.add(cd);
dbcursor.moveToNext();
}
dbcursor.close();
return list;
}
} catch (Exception e) {
Log.d("Exception ", "get MSL_AvailabilityHeader!" + e.toString());
return list;
}
return list;
}
public ArrayList<MSL_AvailabilityGetterSetter> getMSL_AvailabilitySKUData(String category_id, String brand_id) {
ArrayList<MSL_AvailabilityGetterSetter> list = new ArrayList<>();
Cursor dbcursor = null;
try {
dbcursor = db.rawQuery("Select DISTINCT SK.SKU_ID,SK.SKU,SK.MRP,SK.SKU_SEQUENCE " +
"from MAPPING_STOCK M " +
"inner join SKU_MASTER SK " +
"on M.SKU_ID=SK.SKU_ID " +
"inner join BRAND_MASTER BR " +
"on SK.BRAND_ID=BR.BRAND_ID " +
"inner join SUB_CATEGORY_MASTER SB " +
"on BR.SUB_CATEGORY_ID=SB.SUB_CATEGORY_ID " +
"inner join CATEGORY_MASTER CA " +
"on SB.CATEGORY_ID=CA.CATEGORY_ID " +
"where M.MUST_HAVE=1 AND " +
"CA.CATEGORY_ID='" + category_id + "' AND BR.BRAND_ID='" + brand_id + "'", null);
if (dbcursor != null) {
dbcursor.moveToFirst();
while (!dbcursor.isAfterLast()) {
MSL_AvailabilityGetterSetter cd = new MSL_AvailabilityGetterSetter();
cd.setSku_id(dbcursor.getString(dbcursor.getColumnIndexOrThrow("SKU_ID")));
cd.setSku(dbcursor.getString(dbcursor.getColumnIndexOrThrow("SKU")));
cd.setMrp(dbcursor.getString(dbcursor.getColumnIndexOrThrow("MRP")));
cd.setSku_sequence(dbcursor.getString(dbcursor.getColumnIndexOrThrow("SKU_SEQUENCE")));
list.add(cd);
dbcursor.moveToNext();
}
dbcursor.close();
return list;
}
} catch (Exception e) {
Log.d("Exception ", "get MSL_AvailabilityHeader!" + e.toString());
return list;
}
return list;
}
}
@@ -22,14 +22,18 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import cpm.com.gskmtorange.Database.GSKOrangeDB;
import cpm.com.gskmtorange.R;
import cpm.com.gskmtorange.xmlGetterSetter.CategoryGetterSetter;
public class CategoryListActivity extends AppCompatActivity {
RecyclerView recyclerView;
TextView txt_categoryName;
ArrayList<CategoryGetterSetter> categoryList;
CategoryListAdapter adapter;
TextView txt_categoryName;
GSKOrangeDB db;
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -41,6 +45,9 @@ public class CategoryListActivity extends AppCompatActivity {
getSupportActionBar().setHomeButtonEnabled(true);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
db = new GSKOrangeDB(this);
db.open();
txt_categoryName = (TextView) findViewById(R.id.txt_categoryName);
txt_categoryName.setText("Category List");
@@ -61,7 +68,7 @@ public class CategoryListActivity extends AppCompatActivity {
recyclerView = (RecyclerView) findViewById(R.id.recyclerView);
categoryList = new ArrayList<>();
CategoryGetterSetter data = new CategoryGetterSetter();
/*CategoryGetterSetter data = new CategoryGetterSetter();
data.setCategory_name("Oral Health");
data.setCategory_img(R.drawable.category);
categoryList.add(data);
@@ -74,7 +81,9 @@ public class CategoryListActivity extends AppCompatActivity {
data = new CategoryGetterSetter();
data.setCategory_name("Wellness");
data.setCategory_img(R.drawable.category);
categoryList.add(data);
categoryList.add(data);*/
categoryList = db.getCategoryListData("1", "1", "1");
adapter = new CategoryListAdapter(CategoryListActivity.this, categoryList);
recyclerView.setAdapter(adapter);
@@ -103,22 +112,20 @@ public class CategoryListActivity extends AppCompatActivity {
public void onBindViewHolder(MyViewHolder holder, int position) {
final CategoryGetterSetter categoryData = list.get(position);
holder.categoryName.setText(categoryData.getCategory_name());
holder.categoryIcon.setImageResource(categoryData.getCategory_img());
holder.categoryName.setText(categoryData.getCategory());
holder.categoryIcon.setImageResource(R.drawable.category);
holder.lay_menu.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(CategoryListActivity.this, CategoryWisePerformanceActivity.class);
intent.putExtra("categoryName", categoryData.getCategory_name());
intent.putExtra("categoryName", categoryData.getCategory());
intent.putExtra("categoryId", categoryData.getCategory_id());
startActivity(intent);
}
});
}
@Override
public int getItemCount() {
return list.size();
@@ -14,6 +14,7 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -25,7 +26,7 @@ public class CategoryWisePerformanceActivity extends AppCompatActivity {
TextView txt_categoryName;
RecyclerView recyclerView;
String categoryName = "";
String categoryName = "", categoryId;
ArrayList<CategoryWisePerformaceGetterSetter> categoryWisePerformanceList;
CategoryWisePerformaceAdapter adapter;
@@ -44,6 +45,7 @@ public class CategoryWisePerformanceActivity extends AppCompatActivity {
txt_categoryName = (TextView) findViewById(R.id.txt_categoryName);
categoryName = getIntent().getStringExtra("categoryName");
categoryId = getIntent().getStringExtra("categoryId");
txt_categoryName.setText("CategoryWise Performance " + categoryName);
@@ -51,10 +53,9 @@ public class CategoryWisePerformanceActivity extends AppCompatActivity {
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
/* Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();*/
Intent intent = new Intent(CategoryWisePerformanceActivity.this, DailyDataMenuActivity.class);
intent.putExtra("categoryName", categoryName);
intent.putExtra("categoryId", categoryId);
startActivity(intent);
}
});
@@ -30,7 +30,7 @@ public class DailyDataMenuActivity extends AppCompatActivity {
ArrayList<DailyDataMenuGetterSetter> categoryList;
DailyDataMenuAdapter adapter;
TextView txt_categoryName;
String categoryName = "";
String categoryName = "", categoryId;
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -46,17 +46,18 @@ public class DailyDataMenuActivity extends AppCompatActivity {
txt_categoryName = (TextView) findViewById(R.id.txt_categoryName);
categoryName = getIntent().getStringExtra("categoryName");
categoryId = getIntent().getStringExtra("categoryId");
txt_categoryName.setText("Daily Data Menu - " + categoryName);
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
/*FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
});
});*/
}
@Override
@@ -136,11 +137,13 @@ public class DailyDataMenuActivity extends AppCompatActivity {
if (dailyData.getCategory_name().equalsIgnoreCase("MSL Availability")) {
Intent intent = new Intent(DailyDataMenuActivity.this, MSL_AvailabilityActivity.class);
intent.putExtra("categoryName", dailyData.getCategory_name());
intent.putExtra("categoryId", categoryId);
startActivity(intent);
} else if (dailyData.getCategory_name().equalsIgnoreCase("Stock & Facing")) {
Intent intent1 = new Intent(DailyDataMenuActivity.this, Stock_FacingActivity.class);
intent1.putExtra("categoryName", dailyData.getCategory_name());
startActivity(intent1);
Intent intent = new Intent(DailyDataMenuActivity.this, Stock_FacingActivity.class);
intent.putExtra("categoryName", dailyData.getCategory_name());
intent.putExtra("categoryId", categoryId);
startActivity(intent);
}
}
@@ -28,6 +28,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import cpm.com.gskmtorange.Database.GSKOrangeDB;
import cpm.com.gskmtorange.R;
import cpm.com.gskmtorange.xmlGetterSetter.MSL_AvailabilityGetterSetter;
@@ -42,7 +43,9 @@ public class MSL_AvailabilityActivity extends AppCompatActivity {
ExpandableListAdapter adapter;
String title;
GSKOrangeDB db;
String categoryName, categoryId;
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -54,11 +57,16 @@ public class MSL_AvailabilityActivity extends AppCompatActivity {
getSupportActionBar().setHomeButtonEnabled(true);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
db = new GSKOrangeDB(this);
db.open();
expandableListView = (ExpandableListView) findViewById(R.id.expandableListView);
txt_mslAvailabilityName = (TextView) findViewById(R.id.txt_mslAvailabilityName);
title = getIntent().getStringExtra("categoryName");
txt_mslAvailabilityName.setText(title);
categoryName = getIntent().getStringExtra("categoryName");
categoryId = getIntent().getStringExtra("categoryId");
txt_mslAvailabilityName.setText(categoryName);
prepareList();
@@ -135,58 +143,22 @@ public class MSL_AvailabilityActivity extends AppCompatActivity {
}
private void prepareList() {
headerDataList = new ArrayList<>();
MSL_AvailabilityGetterSetter msl = new MSL_AvailabilityGetterSetter();
msl.setBrandName("Parodontax header 1");
msl.setMbq("1");
msl.setAvailable("No");
headerDataList.add(msl);
msl = new MSL_AvailabilityGetterSetter();
msl.setBrandName("Parodontax header 2");
msl.setMbq("2");
msl.setAvailable("Yes");
headerDataList.add(msl);
msl = new MSL_AvailabilityGetterSetter();
msl.setBrandName("Parodontax header 3");
msl.setMbq("3");
msl.setAvailable("Yes");
headerDataList.add(msl);
msl = new MSL_AvailabilityGetterSetter();
msl.setBrandName("Parodontax header 4");
msl.setMbq("4");
msl.setAvailable("No");
headerDataList.add(msl);
hashMapListHeaderData = new ArrayList<>();
hashMapListChildData = new HashMap<>();
if (headerDataList.size() > 0) {
//Header
headerDataList = db.getMSL_AvailabilityHeaderData(categoryId);
if (headerDataList.size() > 0) {
for (int i = 0; i < headerDataList.size(); i++) {
hashMapListHeaderData.add(headerDataList.get(i));
childDataList = new ArrayList<>();
//childDataList = new ArrayList<>();
childDataList = db.getMSL_AvailabilitySKUData(categoryId, headerDataList.get(i).getBrand_id());
MSL_AvailabilityGetterSetter msl1 = new MSL_AvailabilityGetterSetter();
msl.setBrandName("Parodontax 1");
msl.setMbq("1");
msl.setAvailable("No");
childDataList.add(msl1);
msl1 = new MSL_AvailabilityGetterSetter();
msl.setBrandName("Parodontax 2");
msl.setMbq("2");
msl.setAvailable("No");
childDataList.add(msl1);
hashMapListChildData.put(hashMapListHeaderData.get(i), childDataList);
}
}
adapter = new ExpandableListAdapter(this, hashMapListHeaderData, hashMapListChildData);
@@ -234,7 +206,7 @@ public class MSL_AvailabilityActivity extends AppCompatActivity {
ImageView img_camera = (ImageView) convertView.findViewById(R.id.img_camera);
txt_categoryHeader.setTypeface(null, Typeface.BOLD);
txt_categoryHeader.setText(headerTitle.getBrandName());
txt_categoryHeader.setText(headerTitle.getSub_category() + "-" + headerTitle.getBrand());
/*img_camera.setOnClickListener(new View.OnClickListener() {
@Override
@@ -304,15 +276,15 @@ public class MSL_AvailabilityActivity extends AppCompatActivity {
holder.lin_category = (LinearLayout) convertView.findViewById(R.id.lin_category);
holder.txt_skuName = (TextView) convertView.findViewById(R.id.txt_skuName);
holder.ed_mbq = (EditText) convertView.findViewById(R.id.ed_mbq);
holder.txt_mbq = (TextView) convertView.findViewById(R.id.txt_mbq);
holder.toggle_available = (ToggleButton) convertView.findViewById(R.id.toggle_available);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
holder.txt_skuName.setText(childData.getBrandName());
holder.ed_mbq.setText(childData.getMbq());
holder.txt_skuName.setText(childData.getSku());
holder.txt_mbq.setText(childData.getMrp());
holder.toggle_available.setTextOff("No");
holder.toggle_available.setTextOn("Yes");
@@ -332,9 +304,8 @@ public class MSL_AvailabilityActivity extends AppCompatActivity {
}
public class ViewHolder {
EditText ed_mbq;
CardView cardView;
TextView txt_skuName;
TextView txt_skuName, txt_mbq;
ToggleButton toggle_available;
LinearLayout lin_category;
}
@@ -6,22 +6,29 @@ package cpm.com.gskmtorange.xmlGetterSetter;
public class CategoryGetterSetter {
String category_name;
int category_img = -1;
String category_id, category, category_img;
public String getCategory_name() {
return category_name;
public String getCategory_id() {
return category_id;
}
public void setCategory_name(String category_name) {
this.category_name = category_name;
public void setCategory_id(String category_id) {
this.category_id = category_id;
}
public int getCategory_img() {
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
}
public String getCategory_img() {
return category_img;
}
public void setCategory_img(int category_img) {
public void setCategory_img(String category_img) {
this.category_img = category_img;
}
}
@@ -5,29 +5,69 @@ package cpm.com.gskmtorange.xmlGetterSetter;
*/
public class MSL_AvailabilityGetterSetter {
String brandName, mbq, available;
String sub_category_id, sub_category, brand_id, brand, sku_id, sku, mrp, sku_sequence;
public String getBrandName() {
return brandName;
public String getSub_category_id() {
return sub_category_id;
}
public void setBrandName(String brandName) {
this.brandName = brandName;
public void setSub_category_id(String sub_category_id) {
this.sub_category_id = sub_category_id;
}
public String getMbq() {
return mbq;
public String getSub_category() {
return sub_category;
}
public void setMbq(String mbq) {
this.mbq = mbq;
public void setSub_category(String sub_category) {
this.sub_category = sub_category;
}
public String getAvailable() {
return available;
public String getBrand_id() {
return brand_id;
}
public void setAvailable(String available) {
this.available = available;
public void setBrand_id(String brand_id) {
this.brand_id = brand_id;
}
public String getBrand() {
return brand;
}
public void setBrand(String brand) {
this.brand = brand;
}
public String getSku_id() {
return sku_id;
}
public void setSku_id(String sku_id) {
this.sku_id = sku_id;
}
public String getSku() {
return sku;
}
public void setSku(String sku) {
this.sku = sku;
}
public String getMrp() {
return mrp;
}
public void setMrp(String mrp) {
this.mrp = mrp;
}
public String getSku_sequence() {
return sku_sequence;
}
public void setSku_sequence(String sku_sequence) {
this.sku_sequence = sku_sequence;
}
}
@@ -29,6 +29,6 @@
android:layout_gravity="bottom|end"
android:layout_margin="@dimen/fab_margin"
android:backgroundTint="@color/colorPrimary"
app:srcCompat="@drawable/save_icon" />
app:srcCompat="@drawable/right_arrow" />
</android.support.design.widget.CoordinatorLayout>
@@ -29,6 +29,7 @@
android:layout_gravity="bottom|end"
android:layout_margin="@dimen/fab_margin"
android:backgroundTint="@color/colorPrimary"
android:visibility="gone"
app:srcCompat="@drawable/save_icon" />
</android.support.design.widget.CoordinatorLayout>
@@ -21,7 +21,7 @@
android:paddingBottom="10dp"
android:paddingLeft="20dp"
android:paddingTop="10dp"
android:text="Category Performance"
android:text="Daily Data Menu"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="@android:color/black" />
@@ -61,23 +61,11 @@
android:layout_weight="1.25"
android:orientation="vertical">
<!--<TextView
<TextView
android:id="@+id/txt_mbq"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="match_parent"
android:gravity="center"
android:paddingBottom="5dp"
android:paddingTop="5dp"
android:text="MBQ"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#222" />-->
<EditText
android:id="@+id/ed_mbq"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:inputType="number"
android:maxLength="7"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#222"
android:textColorHint="#666" />