Merge branch 'master' into CategoryDownload
This commit is contained in:
@@ -8,6 +8,8 @@ import android.database.sqlite.SQLiteOpenHelper;
|
||||
import android.util.Log;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import cpm.com.gskmtorange.GetterSetter.StoreBean;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.DisplayChecklistMasterGetterSetter;
|
||||
@@ -24,8 +26,10 @@ import cpm.com.gskmtorange.xmlGetterSetter.CategoryMasterGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.DisplayMasterGetterSetter;
|
||||
|
||||
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.Stock_FacingGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.SubCategoryMasterGetterSetter;
|
||||
|
||||
/**
|
||||
@@ -54,17 +58,25 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
||||
public void onCreate(SQLiteDatabase db) {
|
||||
|
||||
db.execSQL(TableBean.getJourneyPlan());
|
||||
|
||||
//Gagan
|
||||
db.execSQL(TableBean.getBrandMaster());
|
||||
db.execSQL(TableBean.getSkuMaster());
|
||||
db.execSQL(TableBean.getCategoryMaster());
|
||||
db.execSQL(TableBean.getSubCategoryMaster());
|
||||
db.execSQL(TableBean.getDisplayMaster());
|
||||
|
||||
db.execSQL(TableBean.getMappingStock());
|
||||
db.execSQL(TableBean.getMappingT2p());
|
||||
|
||||
db.execSQL(TableBean.getDisplayChecklistMaster());
|
||||
db.execSQL(TableBean.getMappingDisplayChecklist());
|
||||
|
||||
|
||||
db.execSQL(CommonString.CREATE_TABLE_INSERT_MSL_AVAILABILITY);
|
||||
|
||||
db.execSQL(CommonString.CREATE_TABLE_INSERT_STOCK_FACING_HEADER);
|
||||
db.execSQL(CommonString.CREATE_TABLE_INSERT_STOCK_FACING_CHILD);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -304,14 +316,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();
|
||||
@@ -551,4 +561,526 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
||||
Log.d("Exception ", " in MAPPING_T2P " + ex.toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Category List
|
||||
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;
|
||||
}
|
||||
|
||||
//MSL_Availability
|
||||
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,M.MBQ " +
|
||||
"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")));
|
||||
cd.setMbq(dbcursor.getString(dbcursor.getColumnIndexOrThrow("MBQ")));
|
||||
cd.setToggleValue("0");
|
||||
|
||||
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 void InsertMSL_Availability(String storeId, String categoryId, List<MSL_AvailabilityGetterSetter> hashMapListHeaderData,
|
||||
HashMap<MSL_AvailabilityGetterSetter, List<MSL_AvailabilityGetterSetter>> hashMapListChildData) {
|
||||
ContentValues values = new ContentValues();
|
||||
|
||||
try {
|
||||
db.beginTransaction();
|
||||
for (int i = 0; i < hashMapListHeaderData.size(); i++) {
|
||||
|
||||
for (int j = 0; j < hashMapListChildData.get(hashMapListHeaderData.get(i)).size(); j++) {
|
||||
MSL_AvailabilityGetterSetter data = hashMapListChildData.get(hashMapListHeaderData.get(i)).get(j);
|
||||
|
||||
values.put("Store_Id", storeId);
|
||||
values.put("Category_Id", categoryId);
|
||||
values.put("Brand_Id", hashMapListHeaderData.get(i).getBrand_id());
|
||||
values.put("SKU_ID", data.getSku_id());
|
||||
values.put("SKU", data.getSku());
|
||||
values.put("SKU_SEQUENCE", data.getSku_sequence());
|
||||
values.put("MBQ", data.getMbq());
|
||||
values.put("TOGGLE_VALUE", data.getToggleValue());
|
||||
|
||||
db.insert(CommonString.TABLE_INSERT_MSL_AVAILABILITY, null, values);
|
||||
}
|
||||
}
|
||||
db.setTransactionSuccessful();
|
||||
db.endTransaction();
|
||||
} catch (Exception ex) {
|
||||
Log.d("Exception ", " in Insert MSL_Availability " + ex.toString());
|
||||
}
|
||||
}
|
||||
|
||||
public ArrayList<MSL_AvailabilityGetterSetter> getMSL_AvailabilitySKU_AfterSaveData(String category_id, String brand_id) {
|
||||
ArrayList<MSL_AvailabilityGetterSetter> list = new ArrayList<>();
|
||||
Cursor dbcursor = null;
|
||||
|
||||
try {
|
||||
dbcursor = db.rawQuery("Select * from Msl_Availability_Data " +
|
||||
"where category_id='" + category_id + "' and 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.setSku_sequence(dbcursor.getString(dbcursor.getColumnIndexOrThrow("SKU_SEQUENCE")));
|
||||
cd.setMbq(dbcursor.getString(dbcursor.getColumnIndexOrThrow("MBQ")));
|
||||
cd.setToggleValue(dbcursor.getString(dbcursor.getColumnIndexOrThrow("TOGGLE_VALUE")));
|
||||
|
||||
list.add(cd);
|
||||
dbcursor.moveToNext();
|
||||
}
|
||||
dbcursor.close();
|
||||
return list;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.d("Exception ", "get MSL_Availability Sku After Save Data!" + e.toString());
|
||||
return list;
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public boolean checkMsl_AvailabilityData(String store_id, String category_id) {
|
||||
Log.d("MSL_Availability ", "Stock data--------------->Start<------------");
|
||||
ArrayList<MSL_AvailabilityGetterSetter> list = new ArrayList<>();
|
||||
Cursor dbcursor = null;
|
||||
|
||||
try {
|
||||
dbcursor = db.rawQuery("Select * from Msl_Availability_Data " +
|
||||
"where category_id='" + category_id + "' and Store_Id='" + store_id + "'", null);
|
||||
|
||||
if (dbcursor != null) {
|
||||
if (dbcursor.moveToFirst()) {
|
||||
do {
|
||||
MSL_AvailabilityGetterSetter sb = new MSL_AvailabilityGetterSetter();
|
||||
|
||||
sb.setSku_id(dbcursor.getString(dbcursor.getColumnIndexOrThrow("SKU_ID")));
|
||||
list.add(sb);
|
||||
} while (dbcursor.moveToNext());
|
||||
}
|
||||
dbcursor.close();
|
||||
|
||||
if (list.size() > 0) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.d("Exception ", "when fetching Records!!!!!!!!!!!!!!!!!!!!!" + e.toString());
|
||||
return false;
|
||||
}
|
||||
|
||||
Log.d("MSL_Availability ", "midday---------------------->Stop<-----------");
|
||||
return false;
|
||||
}
|
||||
|
||||
public void updateMSL_Availability(String storeId, String categoryId, List<MSL_AvailabilityGetterSetter> hashMapListHeaderData,
|
||||
HashMap<MSL_AvailabilityGetterSetter, List<MSL_AvailabilityGetterSetter>> hashMapListChildData) {
|
||||
ContentValues values = new ContentValues();
|
||||
|
||||
try {
|
||||
db.beginTransaction();
|
||||
for (int i = 0; i < hashMapListHeaderData.size(); i++) {
|
||||
|
||||
for (int j = 0; j < hashMapListChildData.get(hashMapListHeaderData.get(i)).size(); j++) {
|
||||
MSL_AvailabilityGetterSetter data = hashMapListChildData.get(hashMapListHeaderData.get(i)).get(j);
|
||||
|
||||
values.put("TOGGLE_VALUE", data.getToggleValue());
|
||||
|
||||
db.update(CommonString.TABLE_INSERT_MSL_AVAILABILITY, values,
|
||||
"Brand_Id ='" + hashMapListHeaderData.get(i).getBrand_id() + "' AND SKU_ID ='" + data.getSku_id() +
|
||||
"' AND Category_Id='" + categoryId + "'", null);
|
||||
}
|
||||
}
|
||||
db.setTransactionSuccessful();
|
||||
db.endTransaction();
|
||||
} catch (Exception ex) {
|
||||
Log.d("Exception ", " in Insert MSL_Availability " + ex.toString());
|
||||
}
|
||||
}
|
||||
|
||||
//Stock_facing
|
||||
public ArrayList<Stock_FacingGetterSetter> getStockAndFacingHeaderData(String category_id) {
|
||||
ArrayList<Stock_FacingGetterSetter> 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 CA.CATEGORY_ID='" + category_id + "' " +
|
||||
"order by SB.SUB_CATEGORY,BR.BRAND", null);
|
||||
|
||||
if (dbcursor != null) {
|
||||
dbcursor.moveToFirst();
|
||||
while (!dbcursor.isAfterLast()) {
|
||||
Stock_FacingGetterSetter cd = new Stock_FacingGetterSetter();
|
||||
|
||||
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")));
|
||||
cd.setImage1("");
|
||||
cd.setImage2("");
|
||||
|
||||
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<Stock_FacingGetterSetter> getStockAndFacingSKUData(String category_id, String brand_id) {
|
||||
ArrayList<Stock_FacingGetterSetter> list = new ArrayList<>();
|
||||
Cursor dbcursor = null;
|
||||
|
||||
try {
|
||||
dbcursor = db.rawQuery("Select DISTINCT SK.SKU_ID,SK.SKU,SK.MRP,SK.SKU_SEQUENCE,M.MBQ,BR.COMPANY_ID " +
|
||||
"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 CA.CATEGORY_ID='" + category_id + "' AND BR.BRAND_ID='" + brand_id + "'", null);
|
||||
|
||||
if (dbcursor != null) {
|
||||
|
||||
dbcursor.moveToFirst();
|
||||
while (!dbcursor.isAfterLast()) {
|
||||
Stock_FacingGetterSetter cd = new Stock_FacingGetterSetter();
|
||||
|
||||
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")));
|
||||
cd.setMbq(dbcursor.getString(dbcursor.getColumnIndexOrThrow("MBQ")));
|
||||
cd.setCompany_id(dbcursor.getString(dbcursor.getColumnIndexOrThrow("COMPANY_ID")));
|
||||
cd.setStock("");
|
||||
cd.setFacing("");
|
||||
|
||||
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 void InsertStock_Facing(String storeId, String categoryId, List<Stock_FacingGetterSetter> hashMapListHeaderData,
|
||||
HashMap<Stock_FacingGetterSetter, List<Stock_FacingGetterSetter>> hashMapListChildData) {
|
||||
ContentValues values = new ContentValues();
|
||||
ContentValues values1 = new ContentValues();
|
||||
|
||||
try {
|
||||
db.beginTransaction();
|
||||
for (int i = 0; i < hashMapListHeaderData.size(); i++) {
|
||||
Stock_FacingGetterSetter data1 = hashMapListHeaderData.get(i);
|
||||
|
||||
values1.put("Store_Id", storeId);
|
||||
values1.put("Category_Id", categoryId);
|
||||
values1.put("SUB_CATEGORY_ID", data1.getSub_category_id());
|
||||
values1.put("SUB_CATEGORY", data1.getSub_category());
|
||||
values1.put("BRAND_ID", data1.getBrand_id());
|
||||
values1.put("BRAND", data1.getBrand());
|
||||
values1.put("IMAGE1", data1.getImage1());
|
||||
values1.put("IMAGE2", data1.getImage2());
|
||||
|
||||
db.insert(CommonString.TABLE_INSERT_STOCK_FACING_HEADER, null, values1);
|
||||
|
||||
for (int j = 0; j < hashMapListChildData.get(hashMapListHeaderData.get(i)).size(); j++) {
|
||||
Stock_FacingGetterSetter data = hashMapListChildData.get(hashMapListHeaderData.get(i)).get(j);
|
||||
|
||||
values.put("Store_Id", storeId);
|
||||
values.put("Category_Id", categoryId);
|
||||
values.put("Brand_Id", hashMapListHeaderData.get(i).getBrand_id());
|
||||
values.put("SKU_ID", data.getSku_id());
|
||||
values.put("SKU", data.getSku());
|
||||
values.put("SKU_SEQUENCE", data.getSku_sequence());
|
||||
values.put("MBQ", data.getMbq());
|
||||
values.put("COMPANY_ID", data.getCompany_id());
|
||||
values.put("STOCK_VALUE", data.getStock());
|
||||
values.put("FACEUP_VALUE", data.getFacing());
|
||||
|
||||
db.insert(CommonString.TABLE_INSERT_STOCK_FACING_CHILD, null, values);
|
||||
}
|
||||
}
|
||||
db.setTransactionSuccessful();
|
||||
db.endTransaction();
|
||||
} catch (Exception ex) {
|
||||
Log.d("Exception ", " in Insert MSL_Availability " + ex.toString());
|
||||
}
|
||||
}
|
||||
|
||||
public ArrayList<Stock_FacingGetterSetter> getStockAndFacingHeader_AfterSaveData(String category_id) {
|
||||
ArrayList<Stock_FacingGetterSetter> list = new ArrayList<>();
|
||||
Cursor dbcursor = null;
|
||||
|
||||
try {
|
||||
dbcursor = db.rawQuery("Select * from Stock_Facing_Header_Data " +
|
||||
"where category_id='" + category_id + "'", null);
|
||||
|
||||
if (dbcursor != null) {
|
||||
dbcursor.moveToFirst();
|
||||
while (!dbcursor.isAfterLast()) {
|
||||
Stock_FacingGetterSetter cd = new Stock_FacingGetterSetter();
|
||||
|
||||
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")));
|
||||
cd.setImage1(dbcursor.getString(dbcursor.getColumnIndexOrThrow("IMAGE1")));
|
||||
cd.setImage2(dbcursor.getString(dbcursor.getColumnIndexOrThrow("IMAGE2")));
|
||||
|
||||
list.add(cd);
|
||||
dbcursor.moveToNext();
|
||||
}
|
||||
dbcursor.close();
|
||||
return list;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.d("Exception ", "get after save Stock_FacingHeader!" + e.toString());
|
||||
return list;
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public ArrayList<Stock_FacingGetterSetter> getStockAndFacingSKU_AfterSaveData(String category_id, String brand_id) {
|
||||
ArrayList<Stock_FacingGetterSetter> list = new ArrayList<>();
|
||||
Cursor dbcursor = null;
|
||||
|
||||
try {
|
||||
dbcursor = db.rawQuery("Select * from Stock_Facing_Child_Data " +
|
||||
"where category_id='" + category_id + "' and Brand_Id='" + brand_id + "'", null);
|
||||
|
||||
if (dbcursor != null) {
|
||||
dbcursor.moveToFirst();
|
||||
while (!dbcursor.isAfterLast()) {
|
||||
Stock_FacingGetterSetter cd = new Stock_FacingGetterSetter();
|
||||
|
||||
cd.setSku_id(dbcursor.getString(dbcursor.getColumnIndexOrThrow("SKU_ID")));
|
||||
cd.setSku(dbcursor.getString(dbcursor.getColumnIndexOrThrow("SKU")));
|
||||
cd.setSku_sequence(dbcursor.getString(dbcursor.getColumnIndexOrThrow("SKU_SEQUENCE")));
|
||||
cd.setMbq(dbcursor.getString(dbcursor.getColumnIndexOrThrow("MBQ")));
|
||||
cd.setCompany_id(dbcursor.getString(dbcursor.getColumnIndexOrThrow("COMPANY_ID")));
|
||||
cd.setStock(dbcursor.getString(dbcursor.getColumnIndexOrThrow("STOCK_VALUE")));
|
||||
cd.setFacing(dbcursor.getString(dbcursor.getColumnIndexOrThrow("FACEUP_VALUE")));
|
||||
|
||||
list.add(cd);
|
||||
dbcursor.moveToNext();
|
||||
}
|
||||
dbcursor.close();
|
||||
return list;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.d("Exception ", "get Stock_Facing Sku After Save Data!" + e.toString());
|
||||
return list;
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public boolean checkStockAndFacingData(String store_id, String category_id) {
|
||||
Log.d("Stock_Facing ", "Stock data--------------->Start<------------");
|
||||
ArrayList<Stock_FacingGetterSetter> list = new ArrayList<>();
|
||||
Cursor dbcursor = null;
|
||||
|
||||
try {
|
||||
dbcursor = db.rawQuery("Select * from Stock_Facing_Child_Data " +
|
||||
"where category_id='" + category_id + "' and Store_Id='" + store_id + "'", null);
|
||||
|
||||
if (dbcursor != null) {
|
||||
if (dbcursor.moveToFirst()) {
|
||||
do {
|
||||
Stock_FacingGetterSetter sb = new Stock_FacingGetterSetter();
|
||||
|
||||
sb.setSku_id(dbcursor.getString(dbcursor.getColumnIndexOrThrow("SKU_ID")));
|
||||
list.add(sb);
|
||||
} while (dbcursor.moveToNext());
|
||||
}
|
||||
dbcursor.close();
|
||||
|
||||
if (list.size() > 0) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.d("Exception ", "when fetching Records!!!!!!!!!!!!!!!!!!!!!" + e.toString());
|
||||
return false;
|
||||
}
|
||||
|
||||
Log.d("Stock_Facing ", "midday---------------------->Stop<-----------");
|
||||
return false;
|
||||
}
|
||||
|
||||
public void updateStockAndFacing(String storeId, String categoryId, List<Stock_FacingGetterSetter> hashMapListHeaderData,
|
||||
HashMap<Stock_FacingGetterSetter, List<Stock_FacingGetterSetter>> hashMapListChildData) {
|
||||
ContentValues values = new ContentValues();
|
||||
ContentValues values1 = new ContentValues();
|
||||
|
||||
try {
|
||||
db.beginTransaction();
|
||||
for (int i = 0; i < hashMapListHeaderData.size(); i++) {
|
||||
Stock_FacingGetterSetter data1 = hashMapListHeaderData.get(i);
|
||||
|
||||
values1.put("IMAGE1", data1.getImage1());
|
||||
values1.put("IMAGE2", data1.getImage2());
|
||||
|
||||
//db.insert(CommonString.TABLE_INSERT_STOCK_FACING_HEADER, null, values1);
|
||||
db.update(CommonString.TABLE_INSERT_STOCK_FACING_HEADER, values1,
|
||||
"Category_Id='" + categoryId + "'", null);
|
||||
|
||||
for (int j = 0; j < hashMapListChildData.get(hashMapListHeaderData.get(i)).size(); j++) {
|
||||
Stock_FacingGetterSetter data = hashMapListChildData.get(hashMapListHeaderData.get(i)).get(j);
|
||||
|
||||
values.put("STOCK_VALUE", data.getStock());
|
||||
values.put("FACEUP_VALUE", data.getFacing());
|
||||
|
||||
//db.insert(CommonString.TABLE_INSERT_STOCK_FACING_CHILD, null, values);
|
||||
db.update(CommonString.TABLE_INSERT_STOCK_FACING_CHILD, values,
|
||||
"Brand_Id ='" + hashMapListHeaderData.get(i).getBrand_id() + "' AND SKU_ID ='" + data.getSku_id() +
|
||||
"' AND Category_Id='" + categoryId + "'", null);
|
||||
}
|
||||
}
|
||||
db.setTransactionSuccessful();
|
||||
db.endTransaction();
|
||||
} catch (Exception ex) {
|
||||
Log.d("Exception ", " in Insert MSL_Availability " + ex.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ import android.webkit.WebView;
|
||||
import android.webkit.WebViewClient;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
@@ -212,6 +213,7 @@ public class MainActivity extends AppCompatActivity
|
||||
File backupDB = new File(path, backupDBPath);
|
||||
|
||||
//Snackbar.make(rec_store_data, "Database Exported Successfully", Snackbar.LENGTH_SHORT).show();
|
||||
Toast.makeText(MainActivity.this, "Database Exported Successfully", Toast.LENGTH_SHORT).show();
|
||||
|
||||
if (currentDB.exists()) {
|
||||
@SuppressWarnings("resource")
|
||||
|
||||
@@ -16,7 +16,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";
|
||||
|
||||
@@ -53,5 +52,113 @@ public class CommonString {
|
||||
public static final String MESSAGE_EXCEPTION = "Problem Occured : Report The Problem To Parinaam ";
|
||||
public static final String MESSAGE_SOCKETEXCEPTION = "Network Communication Failure. Check Your Network Connection";
|
||||
|
||||
public static final String TABLE_INSERT_MSL_AVAILABILITY = "Msl_Availability_Data";
|
||||
|
||||
public static final String CREATE_TABLE_INSERT_MSL_AVAILABILITY = "CREATE TABLE IF NOT EXISTS "
|
||||
+ TABLE_INSERT_MSL_AVAILABILITY
|
||||
+ "("
|
||||
+ "KEY_ID"
|
||||
+ " INTEGER PRIMARY KEY AUTOINCREMENT ,"
|
||||
|
||||
+ "Store_Id"
|
||||
+ " VARCHAR,"
|
||||
|
||||
+ "Category_Id"
|
||||
+ " VARCHAR,"
|
||||
|
||||
+ "Brand_Id"
|
||||
+ " VARCHAR,"
|
||||
|
||||
+ "SKU_ID"
|
||||
+ " VARCHAR,"
|
||||
|
||||
+ "SKU"
|
||||
+ " VARCHAR,"
|
||||
|
||||
+ "SKU_SEQUENCE"
|
||||
+ " VARCHAR,"
|
||||
|
||||
+ "MBQ"
|
||||
+ " VARCHAR,"
|
||||
|
||||
+ "TOGGLE_VALUE"
|
||||
+ " VARCHAR"
|
||||
|
||||
+ ")";
|
||||
|
||||
|
||||
public static final String TABLE_INSERT_STOCK_FACING_HEADER = "Stock_Facing_Header_Data";
|
||||
|
||||
public static final String CREATE_TABLE_INSERT_STOCK_FACING_HEADER = "CREATE TABLE IF NOT EXISTS "
|
||||
+ TABLE_INSERT_STOCK_FACING_HEADER
|
||||
+ "("
|
||||
+ "KEY_ID"
|
||||
+ " INTEGER PRIMARY KEY AUTOINCREMENT ,"
|
||||
|
||||
+ "Store_Id"
|
||||
+ " VARCHAR,"
|
||||
|
||||
+ "Category_Id"
|
||||
+ " VARCHAR,"
|
||||
|
||||
+ "SUB_CATEGORY_ID"
|
||||
+ " VARCHAR,"
|
||||
|
||||
+ "SUB_CATEGORY"
|
||||
+ " VARCHAR,"
|
||||
|
||||
+ "BRAND_ID"
|
||||
+ " VARCHAR,"
|
||||
|
||||
+ "BRAND"
|
||||
+ " VARCHAR,"
|
||||
|
||||
+ "IMAGE1"
|
||||
+ " VARCHAR,"
|
||||
|
||||
+ "IMAGE2"
|
||||
+ " VARCHAR"
|
||||
|
||||
+ ")";
|
||||
|
||||
public static final String TABLE_INSERT_STOCK_FACING_CHILD = "Stock_Facing_Child_Data";
|
||||
|
||||
public static final String CREATE_TABLE_INSERT_STOCK_FACING_CHILD = "CREATE TABLE IF NOT EXISTS "
|
||||
+ TABLE_INSERT_STOCK_FACING_CHILD
|
||||
+ "("
|
||||
+ "KEY_ID"
|
||||
+ " INTEGER PRIMARY KEY AUTOINCREMENT ,"
|
||||
|
||||
+ "Store_Id"
|
||||
+ " VARCHAR,"
|
||||
|
||||
+ "Category_Id"
|
||||
+ " VARCHAR,"
|
||||
|
||||
+ "Brand_Id"
|
||||
+ " VARCHAR,"
|
||||
|
||||
+ "SKU_ID"
|
||||
+ " VARCHAR,"
|
||||
|
||||
+ "SKU"
|
||||
+ " VARCHAR,"
|
||||
|
||||
+ "SKU_SEQUENCE"
|
||||
+ " VARCHAR,"
|
||||
|
||||
+ "MBQ"
|
||||
+ " VARCHAR,"
|
||||
|
||||
+ "COMPANY_ID"
|
||||
+ " VARCHAR,"
|
||||
|
||||
+ "STOCK_VALUE"
|
||||
+ " VARCHAR,"
|
||||
|
||||
+ "FACEUP_VALUE"
|
||||
+ " VARCHAR"
|
||||
|
||||
+ ")";
|
||||
|
||||
}
|
||||
|
||||
+15
-22
@@ -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,8 +45,12 @@ 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");
|
||||
//txt_categoryName.setText("Category List");
|
||||
txt_categoryName.setText(getResources().getString(R.string.title_activity_category_list));
|
||||
|
||||
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
|
||||
fab.setOnClickListener(new View.OnClickListener() {
|
||||
@@ -61,20 +69,7 @@ public class CategoryListActivity extends AppCompatActivity {
|
||||
recyclerView = (RecyclerView) findViewById(R.id.recyclerView);
|
||||
categoryList = new ArrayList<>();
|
||||
|
||||
CategoryGetterSetter data = new CategoryGetterSetter();
|
||||
data.setCategory_name("Oral Health");
|
||||
data.setCategory_img(R.drawable.category);
|
||||
categoryList.add(data);
|
||||
|
||||
data = new CategoryGetterSetter();
|
||||
data.setCategory_name("Nutritionals");
|
||||
data.setCategory_img(R.drawable.category);
|
||||
categoryList.add(data);
|
||||
|
||||
data = new CategoryGetterSetter();
|
||||
data.setCategory_name("Wellness");
|
||||
data.setCategory_img(R.drawable.category);
|
||||
categoryList.add(data);
|
||||
categoryList = db.getCategoryListData("1", "1", "1");
|
||||
|
||||
adapter = new CategoryListAdapter(CategoryListActivity.this, categoryList);
|
||||
recyclerView.setAdapter(adapter);
|
||||
@@ -103,22 +98,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();
|
||||
|
||||
+6
-4
@@ -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,17 +45,18 @@ 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);
|
||||
//txt_categoryName.setText("CategoryWise Performance " + categoryName);
|
||||
txt_categoryName.setText(getResources().getString(R.string.title_activity_category_wise_performance) + " " + categoryName);
|
||||
|
||||
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();*/
|
||||
Intent intent = new Intent(CategoryWisePerformanceActivity.this, DailyDataMenuActivity.class);
|
||||
intent.putExtra("categoryName", categoryName);
|
||||
intent.putExtra("categoryId", categoryId);
|
||||
startActivity(intent);
|
||||
}
|
||||
});
|
||||
|
||||
+27
-17
@@ -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,19 @@ 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);
|
||||
//txt_categoryName.setText("Daily Data Menu - " + categoryName);
|
||||
txt_categoryName.setText(getResources().getString(R.string.title_activity_daily_main_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
|
||||
@@ -66,37 +68,44 @@ public class DailyDataMenuActivity extends AppCompatActivity {
|
||||
categoryList = new ArrayList<>();
|
||||
|
||||
DailyDataMenuGetterSetter data = new DailyDataMenuGetterSetter();
|
||||
data.setCategory_name("MSL Availability");
|
||||
//data.setCategory_name("MSL Availability");
|
||||
data.setCategory_name(getResources().getString(R.string.daily_data_menu_msl_availability));
|
||||
data.setCategory_img(R.drawable.category);
|
||||
categoryList.add(data);
|
||||
|
||||
data = new DailyDataMenuGetterSetter();
|
||||
data.setCategory_name("Stock & Facing");
|
||||
data.setCategory_name(getResources().getString(R.string.daily_data_menu_stock_facing));
|
||||
//data.setCategory_name("Stock & Facing");
|
||||
data.setCategory_img(R.drawable.category);
|
||||
categoryList.add(data);
|
||||
|
||||
data = new DailyDataMenuGetterSetter();
|
||||
data.setCategory_name("T2P Compliance");
|
||||
data.setCategory_name(getResources().getString(R.string.daily_data_menu_t2p));
|
||||
//data.setCategory_name("T2P Compliance");
|
||||
data.setCategory_img(R.drawable.category);
|
||||
categoryList.add(data);
|
||||
|
||||
data = new DailyDataMenuGetterSetter();
|
||||
data.setCategory_name("Additional Visibility");
|
||||
data.setCategory_name(getResources().getString(R.string.daily_data_menu_additional_visibility));
|
||||
//data.setCategory_name("Additional Visibility");
|
||||
data.setCategory_img(R.drawable.category);
|
||||
categoryList.add(data);
|
||||
|
||||
data = new DailyDataMenuGetterSetter();
|
||||
data.setCategory_name("Promo Compliance");
|
||||
data.setCategory_name(getResources().getString(R.string.daily_data_menu_promo_compliance));
|
||||
//data.setCategory_name("Promo Compliance");
|
||||
data.setCategory_img(R.drawable.category);
|
||||
categoryList.add(data);
|
||||
|
||||
data = new DailyDataMenuGetterSetter();
|
||||
data.setCategory_name("Competition Visibility");
|
||||
data.setCategory_name(getResources().getString(R.string.daily_data_menu_competition_tracking));
|
||||
//data.setCategory_name("Competition Tracking");
|
||||
data.setCategory_img(R.drawable.category);
|
||||
categoryList.add(data);
|
||||
|
||||
data = new DailyDataMenuGetterSetter();
|
||||
data.setCategory_name("Competition Promo");
|
||||
data.setCategory_name(getResources().getString(R.string.daily_data_menu_additional_promotions));
|
||||
//data.setCategory_name("Competition Promo");
|
||||
data.setCategory_img(R.drawable.category);
|
||||
categoryList.add(data);
|
||||
|
||||
@@ -133,16 +142,17 @@ public class DailyDataMenuActivity extends AppCompatActivity {
|
||||
holder.lay_menu.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (dailyData.getCategory_name().equalsIgnoreCase("MSL Availability")) {
|
||||
if (dailyData.getCategory_name().equalsIgnoreCase(getResources().getString(R.string.daily_data_menu_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(getResources().getString(R.string.daily_data_menu_stock_facing))) {
|
||||
Intent intent = new Intent(DailyDataMenuActivity.this, Stock_FacingActivity.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);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
+111
-59
@@ -1,6 +1,8 @@
|
||||
package cpm.com.gskmtorange.gsk_dailyentry;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.graphics.Typeface;
|
||||
import android.os.Bundle;
|
||||
import android.support.design.widget.FloatingActionButton;
|
||||
@@ -16,18 +18,21 @@ import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.AbsListView;
|
||||
import android.widget.BaseExpandableListAdapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ExpandableListView;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
import android.widget.ToggleButton;
|
||||
|
||||
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 +47,9 @@ public class MSL_AvailabilityActivity extends AppCompatActivity {
|
||||
|
||||
ExpandableListAdapter adapter;
|
||||
|
||||
String title;
|
||||
GSKOrangeDB db;
|
||||
|
||||
String categoryName, categoryId, storeId;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
@@ -54,26 +61,81 @@ 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");
|
||||
storeId = "";
|
||||
|
||||
//txt_mslAvailabilityName.setText(categoryName);
|
||||
txt_mslAvailabilityName.setText(getResources().getString(R.string.title_activity_msl__availability));
|
||||
|
||||
prepareList();
|
||||
|
||||
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
|
||||
final 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();
|
||||
|
||||
//if (validateData(listDataHeader, listDataChild)) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(MSL_AvailabilityActivity.this);
|
||||
builder.setMessage("Are you sure you want to save")
|
||||
.setCancelable(false)
|
||||
.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
db.open();
|
||||
|
||||
if (db.checkMsl_AvailabilityData(storeId, categoryId)) {
|
||||
db.updateMSL_Availability(storeId, categoryId, hashMapListHeaderData, hashMapListChildData);
|
||||
} else {
|
||||
db.InsertMSL_Availability(storeId, categoryId, hashMapListHeaderData, hashMapListChildData);
|
||||
}
|
||||
|
||||
Toast.makeText(getApplicationContext(), "Data has been saved", Toast.LENGTH_LONG).show();
|
||||
finish();
|
||||
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
|
||||
}
|
||||
})
|
||||
.setNegativeButton("No", new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
dialog.cancel();
|
||||
}
|
||||
});
|
||||
AlertDialog alert = builder.create();
|
||||
alert.show();
|
||||
|
||||
/*} else {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(MSL_AvailabilityActivity.this);
|
||||
builder.setMessage("Fill the value or fill 0 ")
|
||||
.setCancelable(false)
|
||||
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
AlertDialog alert = builder.create();
|
||||
alert.show();
|
||||
}*/
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
expandableListView.setOnScrollListener(new AbsListView.OnScrollListener() {
|
||||
@Override
|
||||
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
|
||||
int lastItem = firstVisibleItem + visibleItemCount;
|
||||
|
||||
if (firstVisibleItem == 0) {
|
||||
fab.setVisibility(View.VISIBLE);
|
||||
} else if (lastItem == totalItemCount) {
|
||||
fab.setVisibility(View.INVISIBLE);
|
||||
} else {
|
||||
fab.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -85,7 +147,7 @@ public class MSL_AvailabilityActivity extends AppCompatActivity {
|
||||
getCurrentFocus().clearFocus();
|
||||
}
|
||||
|
||||
expandableListView.invalidateViews();
|
||||
//expandableListView.invalidateViews();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -131,62 +193,27 @@ public class MSL_AvailabilityActivity extends AppCompatActivity {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
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<>();
|
||||
|
||||
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);
|
||||
//childDataList = new ArrayList<>();
|
||||
childDataList = db.getMSL_AvailabilitySKU_AfterSaveData(categoryId, headerDataList.get(i).getBrand_id());
|
||||
if (!(childDataList.size() > 0)) {
|
||||
childDataList = db.getMSL_AvailabilitySKUData(categoryId, headerDataList.get(i).getBrand_id());
|
||||
}
|
||||
|
||||
hashMapListChildData.put(hashMapListHeaderData.get(i), childDataList);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
adapter = new ExpandableListAdapter(this, hashMapListHeaderData, hashMapListChildData);
|
||||
@@ -234,7 +261,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
|
||||
@@ -292,7 +319,7 @@ public class MSL_AvailabilityActivity extends AppCompatActivity {
|
||||
@Override
|
||||
public View getChildView(final int groupPosition, final int childPosition, boolean isLastChild,
|
||||
View convertView, ViewGroup parent) {
|
||||
MSL_AvailabilityGetterSetter childData = (MSL_AvailabilityGetterSetter) getChild(groupPosition, childPosition);
|
||||
final MSL_AvailabilityGetterSetter childData = (MSL_AvailabilityGetterSetter) getChild(groupPosition, childPosition);
|
||||
ViewHolder holder = null;
|
||||
|
||||
if (convertView == null) {
|
||||
@@ -304,18 +331,44 @@ 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);
|
||||
|
||||
holder.toggle_available.setTextOff("No");
|
||||
holder.toggle_available.setTextOn("Yes");
|
||||
|
||||
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.getMbq());
|
||||
|
||||
holder.toggle_available.setTextOff("No");
|
||||
holder.toggle_available.setTextOn("Yes");
|
||||
/*if (childData.getToggleValue().equals("1")) {
|
||||
holder.toggle_available.setText("Yes");
|
||||
} else {
|
||||
holder.toggle_available.setText("No");
|
||||
}*/
|
||||
|
||||
holder.toggle_available.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
if (isChecked) {
|
||||
childData.setToggleValue("1");
|
||||
} else {
|
||||
childData.setToggleValue("0");
|
||||
}
|
||||
|
||||
expandableListView.invalidateViews();
|
||||
}
|
||||
});
|
||||
|
||||
if (childData.getToggleValue().equals("1")) {
|
||||
holder.toggle_available.setChecked(true);
|
||||
} else {
|
||||
holder.toggle_available.setChecked(false);
|
||||
}
|
||||
|
||||
return convertView;
|
||||
}
|
||||
@@ -332,9 +385,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;
|
||||
}
|
||||
|
||||
+166
-50
@@ -1,6 +1,8 @@
|
||||
package cpm.com.gskmtorange.gsk_dailyentry;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
@@ -28,6 +30,7 @@ import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
import android.widget.ToggleButton;
|
||||
|
||||
import java.io.File;
|
||||
@@ -38,6 +41,7 @@ import java.util.Date;
|
||||
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;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.Stock_FacingGetterSetter;
|
||||
@@ -52,11 +56,13 @@ public class Stock_FacingActivity extends AppCompatActivity {
|
||||
HashMap<Stock_FacingGetterSetter, List<Stock_FacingGetterSetter>> hashMapListChildData;
|
||||
|
||||
ExpandableListAdapter adapter;
|
||||
GSKOrangeDB db;
|
||||
|
||||
String title;
|
||||
String categoryName, categoryId, storeId;
|
||||
|
||||
String path = "", str = "", _pathforcheck = "", img1 = "";
|
||||
static int child_position = -1;
|
||||
boolean isDialogOpen = true;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
@@ -68,11 +74,18 @@ public class Stock_FacingActivity extends AppCompatActivity {
|
||||
getSupportActionBar().setHomeButtonEnabled(true);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
db = new GSKOrangeDB(this);
|
||||
db.open();
|
||||
|
||||
expandableListView = (ExpandableListView) findViewById(R.id.expandableListView);
|
||||
txt_stockFacingName = (TextView) findViewById(R.id.txt_stockFacingName);
|
||||
|
||||
title = getIntent().getStringExtra("categoryName");
|
||||
txt_stockFacingName.setText(title);
|
||||
categoryName = getIntent().getStringExtra("categoryName");
|
||||
categoryId = getIntent().getStringExtra("categoryId");
|
||||
storeId = "";
|
||||
|
||||
//txt_stockFacingName.setText(categoryName);
|
||||
txt_stockFacingName.setText(getResources().getString(R.string.title_activity_stock_facing));
|
||||
|
||||
prepareList();
|
||||
|
||||
@@ -82,8 +95,49 @@ public class Stock_FacingActivity 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();
|
||||
/*Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
|
||||
.setAction("Action", null).show();*/
|
||||
|
||||
//if (validateData(listDataHeader, listDataChild)) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(Stock_FacingActivity.this);
|
||||
builder.setMessage("Are you sure you want to save")
|
||||
.setCancelable(false)
|
||||
.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
db.open();
|
||||
//db.InsertStock_Facing(storeId, categoryId, hashMapListHeaderData, hashMapListChildData);
|
||||
|
||||
if (db.checkStockAndFacingData(storeId, categoryId)) {
|
||||
db.updateStockAndFacing(storeId, categoryId, hashMapListHeaderData, hashMapListChildData);
|
||||
} else {
|
||||
db.InsertStock_Facing(storeId, categoryId, hashMapListHeaderData, hashMapListChildData);
|
||||
}
|
||||
|
||||
Toast.makeText(getApplicationContext(), "Data has been saved", Toast.LENGTH_LONG).show();
|
||||
finish();
|
||||
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
|
||||
}
|
||||
})
|
||||
.setNegativeButton("No", new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
dialog.cancel();
|
||||
}
|
||||
});
|
||||
AlertDialog alert = builder.create();
|
||||
alert.show();
|
||||
|
||||
/*} else {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(MSL_AvailabilityActivity.this);
|
||||
builder.setMessage("Fill the value or fill 0 ")
|
||||
.setCancelable(false)
|
||||
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
AlertDialog alert = builder.create();
|
||||
alert.show();
|
||||
}*/
|
||||
}
|
||||
});
|
||||
|
||||
@@ -150,58 +204,28 @@ public class Stock_FacingActivity extends AppCompatActivity {
|
||||
}
|
||||
|
||||
private void prepareList() {
|
||||
headerDataList = new ArrayList<>();
|
||||
|
||||
Stock_FacingGetterSetter msl = new Stock_FacingGetterSetter();
|
||||
msl.setBrandName("Parodontax header 1");
|
||||
msl.setMbq("1");
|
||||
msl.setAvailable("No");
|
||||
headerDataList.add(msl);
|
||||
|
||||
msl = new Stock_FacingGetterSetter();
|
||||
msl.setBrandName("Parodontax header 2");
|
||||
msl.setMbq("2");
|
||||
msl.setAvailable("Yes");
|
||||
headerDataList.add(msl);
|
||||
|
||||
msl = new Stock_FacingGetterSetter();
|
||||
msl.setBrandName("Parodontax header 3");
|
||||
msl.setMbq("3");
|
||||
msl.setAvailable("Yes");
|
||||
headerDataList.add(msl);
|
||||
|
||||
msl = new Stock_FacingGetterSetter();
|
||||
msl.setBrandName("Parodontax header 4");
|
||||
msl.setMbq("4");
|
||||
msl.setAvailable("No");
|
||||
headerDataList.add(msl);
|
||||
|
||||
|
||||
hashMapListHeaderData = new ArrayList<>();
|
||||
hashMapListChildData = new HashMap<>();
|
||||
|
||||
//Header Data
|
||||
headerDataList = db.getStockAndFacingHeader_AfterSaveData(categoryId);
|
||||
if (!(headerDataList.size() > 0)) {
|
||||
headerDataList = db.getStockAndFacingHeaderData(categoryId);
|
||||
}
|
||||
|
||||
if (headerDataList.size() > 0) {
|
||||
|
||||
for (int i = 0; i < headerDataList.size(); i++) {
|
||||
hashMapListHeaderData.add(headerDataList.get(i));
|
||||
|
||||
childDataList = new ArrayList<>();
|
||||
|
||||
Stock_FacingGetterSetter msl1 = new Stock_FacingGetterSetter();
|
||||
msl.setBrandName("Parodontax 1");
|
||||
msl.setMbq("1");
|
||||
msl.setAvailable("No");
|
||||
childDataList.add(msl1);
|
||||
|
||||
msl1 = new Stock_FacingGetterSetter();
|
||||
msl.setBrandName("Parodontax 2");
|
||||
msl.setMbq("2");
|
||||
msl.setAvailable("No");
|
||||
childDataList.add(msl1);
|
||||
//Child Data
|
||||
childDataList = db.getStockAndFacingSKU_AfterSaveData(categoryId, headerDataList.get(i).getBrand_id());
|
||||
if (!(childDataList.size() > 0)) {
|
||||
childDataList = db.getStockAndFacingSKUData(categoryId, headerDataList.get(i).getBrand_id());
|
||||
}
|
||||
|
||||
hashMapListChildData.put(hashMapListHeaderData.get(i), childDataList);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
adapter = new ExpandableListAdapter(this, hashMapListHeaderData, hashMapListChildData);
|
||||
@@ -252,7 +276,7 @@ public class Stock_FacingActivity extends AppCompatActivity {
|
||||
ImageView img_edit = (ImageView) convertView.findViewById(R.id.img_edit);
|
||||
|
||||
txt_stockFaceupHeader.setTypeface(null, Typeface.BOLD);
|
||||
txt_stockFaceupHeader.setText(headerTitle.getBrandName());
|
||||
txt_stockFaceupHeader.setText(headerTitle.getSub_category() + "-" + headerTitle.getBrand());
|
||||
|
||||
img_camera1.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
@@ -338,7 +362,7 @@ public class Stock_FacingActivity extends AppCompatActivity {
|
||||
@Override
|
||||
public View getChildView(final int groupPosition, final int childPosition, boolean isLastChild,
|
||||
View convertView, ViewGroup parent) {
|
||||
Stock_FacingGetterSetter childData = (Stock_FacingGetterSetter) getChild(groupPosition, childPosition);
|
||||
final Stock_FacingGetterSetter childData = (Stock_FacingGetterSetter) getChild(groupPosition, childPosition);
|
||||
ViewHolder holder = null;
|
||||
|
||||
if (convertView == null) {
|
||||
@@ -357,8 +381,100 @@ public class Stock_FacingActivity extends AppCompatActivity {
|
||||
holder = (ViewHolder) convertView.getTag();
|
||||
}
|
||||
|
||||
holder.txt_skuName.setText(childData.getBrandName());
|
||||
holder.ed_stock.setText(childData.getMbq());
|
||||
holder.txt_skuName.setText(childData.getSku());
|
||||
|
||||
if (childData.getCompany_id().equals("1")) {
|
||||
holder.txt_skuName.setTextColor(getResources().getColor(R.color.colorPrimaryDark));
|
||||
} else {
|
||||
holder.txt_skuName.setTextColor(getResources().getColor(R.color.black));
|
||||
}
|
||||
|
||||
|
||||
if (childData.getStock().equals("0")) {
|
||||
holder.ed_facing.setEnabled(false);
|
||||
} else {
|
||||
holder.ed_facing.setEnabled(true);
|
||||
}
|
||||
|
||||
final ViewHolder finalHolder = holder;
|
||||
holder.ed_stock.setOnFocusChangeListener(new View.OnFocusChangeListener() {
|
||||
@Override
|
||||
public void onFocusChange(View v, boolean hasFocus) {
|
||||
|
||||
final EditText caption = (EditText) v;
|
||||
String edStock = caption.getText().toString();
|
||||
|
||||
if (!edStock.equals("")) {
|
||||
String stock = edStock.replaceFirst("^0+(?!$)", "");
|
||||
childData.setStock(stock);
|
||||
|
||||
if (edStock.equals("0")) {
|
||||
childData.setFacing("0");
|
||||
|
||||
finalHolder.ed_facing.setEnabled(false);
|
||||
} else {
|
||||
childData.setFacing(childData.getFacing());
|
||||
finalHolder.ed_facing.setEnabled(true);
|
||||
}
|
||||
} else {
|
||||
childData.setStock("");
|
||||
finalHolder.ed_facing.setEnabled(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
holder.ed_stock.setText(childData.getStock());
|
||||
|
||||
holder.ed_facing.setOnFocusChangeListener(new View.OnFocusChangeListener() {
|
||||
@Override
|
||||
public void onFocusChange(View v, boolean hasFocus) {
|
||||
final EditText caption = (EditText) v;
|
||||
final String edFaceup = caption.getText().toString().replaceFirst("^0+(?!$)", "");
|
||||
|
||||
if (!childData.getStock().equals("")) {
|
||||
if (!edFaceup.equals("")) {
|
||||
if (Integer.parseInt(edFaceup) <= Integer.parseInt(childData.getStock())) {
|
||||
childData.setFacing(edFaceup);
|
||||
} else {
|
||||
if (isDialogOpen) {
|
||||
isDialogOpen = !isDialogOpen;
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(Stock_FacingActivity.this);
|
||||
builder.setMessage("Faceup can not be greater than stock value")
|
||||
.setCancelable(false)
|
||||
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
dialog.dismiss();
|
||||
isDialogOpen = !isDialogOpen;
|
||||
}
|
||||
});
|
||||
AlertDialog alert = builder.create();
|
||||
alert.show();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
childData.setFacing("");
|
||||
}
|
||||
} else {
|
||||
if (isDialogOpen) {
|
||||
isDialogOpen = !isDialogOpen;
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(Stock_FacingActivity.this);
|
||||
builder.setMessage("First fill the stock value")
|
||||
.setCancelable(false)
|
||||
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
dialog.dismiss();
|
||||
isDialogOpen = !isDialogOpen;
|
||||
}
|
||||
});
|
||||
AlertDialog alert = builder.create();
|
||||
alert.show();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
holder.ed_facing.setText(childData.getFacing());
|
||||
|
||||
|
||||
return convertView;
|
||||
}
|
||||
|
||||
+15
-8
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
+70
-13
@@ -5,14 +5,79 @@ 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, toggleValue,mbq;
|
||||
|
||||
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 getSub_category() {
|
||||
return sub_category;
|
||||
}
|
||||
|
||||
public void setSub_category(String sub_category) {
|
||||
this.sub_category = sub_category;
|
||||
}
|
||||
|
||||
public String getBrand_id() {
|
||||
return brand_id;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
public String getToggleValue() {
|
||||
return toggleValue;
|
||||
}
|
||||
|
||||
public void setToggleValue(String toggleValue) {
|
||||
this.toggleValue = toggleValue;
|
||||
}
|
||||
|
||||
public String getMbq() {
|
||||
@@ -22,12 +87,4 @@ public class MSL_AvailabilityGetterSetter {
|
||||
public void setMbq(String mbq) {
|
||||
this.mbq = mbq;
|
||||
}
|
||||
|
||||
public String getAvailable() {
|
||||
return available;
|
||||
}
|
||||
|
||||
public void setAvailable(String available) {
|
||||
this.available = available;
|
||||
}
|
||||
}
|
||||
|
||||
+98
-9
@@ -5,14 +5,87 @@ package cpm.com.gskmtorange.xmlGetterSetter;
|
||||
*/
|
||||
|
||||
public class Stock_FacingGetterSetter {
|
||||
String brandName, mbq, available;
|
||||
String sub_category_id, sub_category, brand_id, brand,
|
||||
sku_id, sku, mrp, sku_sequence, stock, facing, mbq, company_id, image1, image2;
|
||||
|
||||
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 getSub_category() {
|
||||
return sub_category;
|
||||
}
|
||||
|
||||
public void setSub_category(String sub_category) {
|
||||
this.sub_category = sub_category;
|
||||
}
|
||||
|
||||
public String getBrand_id() {
|
||||
return brand_id;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
public String getStock() {
|
||||
return stock;
|
||||
}
|
||||
|
||||
public void setStock(String stock) {
|
||||
this.stock = stock;
|
||||
}
|
||||
|
||||
public String getFacing() {
|
||||
return facing;
|
||||
}
|
||||
|
||||
public void setFacing(String facing) {
|
||||
this.facing = facing;
|
||||
}
|
||||
|
||||
public String getMbq() {
|
||||
@@ -23,11 +96,27 @@ public class Stock_FacingGetterSetter {
|
||||
this.mbq = mbq;
|
||||
}
|
||||
|
||||
public String getAvailable() {
|
||||
return available;
|
||||
public String getCompany_id() {
|
||||
return company_id;
|
||||
}
|
||||
|
||||
public void setAvailable(String available) {
|
||||
this.available = available;
|
||||
public void setCompany_id(String company_id) {
|
||||
this.company_id = company_id;
|
||||
}
|
||||
|
||||
public String getImage1() {
|
||||
return image1;
|
||||
}
|
||||
|
||||
public void setImage1(String image1) {
|
||||
this.image1 = image1;
|
||||
}
|
||||
|
||||
public String getImage2() {
|
||||
return image2;
|
||||
}
|
||||
|
||||
public void setImage2(String image2) {
|
||||
this.image2 = image2;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="start"
|
||||
android:fitsSystemWindows="true"
|
||||
|
||||
app:menu="@menu/activity_main_drawer" />
|
||||
|
||||
</android.support.v4.widget.DrawerLayout>
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fitsSystemWindows="true"
|
||||
android:id="@+id/coordinate"
|
||||
tools:context="cpm.com.gskmtorange.MainActivity">
|
||||
|
||||
<android.support.design.widget.AppBarLayout
|
||||
|
||||
@@ -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" />
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
android:gravity="center"
|
||||
android:paddingBottom="5dp"
|
||||
android:paddingTop="5dp"
|
||||
android:text="SKU"
|
||||
android:text="@string/msl_availability_sku"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="#222" />
|
||||
</LinearLayout>
|
||||
@@ -63,7 +63,7 @@
|
||||
android:gravity="center"
|
||||
android:paddingBottom="5dp"
|
||||
android:paddingTop="5dp"
|
||||
android:text="MBQ"
|
||||
android:text="@string/msl_availability_mbq"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="#222" />
|
||||
</LinearLayout>
|
||||
@@ -80,7 +80,7 @@
|
||||
android:gravity="center"
|
||||
android:paddingBottom="5dp"
|
||||
android:paddingTop="5dp"
|
||||
android:text="Available"
|
||||
android:text="@string/msl_availability_availability"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="#222" />
|
||||
</LinearLayout>
|
||||
|
||||
@@ -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" />
|
||||
|
||||
@@ -51,9 +51,29 @@
|
||||
<string name="menu_services">Services</string>
|
||||
|
||||
<string name="title_activity_category_list">Category List</string>
|
||||
<string name="title_activity_category_wise_performance">CategoryWise Performance</string>
|
||||
<string name="title_activity_daily_main_menu">DailyMainMenuActivity</string>
|
||||
<string name="title_activity_msl__availability">MSL_AvailabilityActivity</string>
|
||||
<string name="title_activity_t2_pcompliance">T2P Compliance</string>
|
||||
|
||||
<string name="title_activity_category_wise_performance">Categorywise Performance</string>
|
||||
<string name="title_activity_daily_main_menu">Daily Data Menu</string>
|
||||
<string name="title_activity_msl__availability">Must Stock Availability</string>
|
||||
<string name="title_activity_stock_facing">Stock and Facing</string>
|
||||
|
||||
<string name="daily_data_menu_msl_availability">MSL Availability</string>
|
||||
<string name="daily_data_menu_stock_facing">Stock and Facing</string>
|
||||
<string name="daily_data_menu_t2p">T2P Compliance</string>
|
||||
<string name="daily_data_menu_additional_visibility">Additional Visibility</string>
|
||||
<string name="daily_data_menu_promo_compliance">Promo Compliance</string>
|
||||
<string name="daily_data_menu_competition_tracking">Competition Visibility</string>
|
||||
<string name="daily_data_menu_additional_promotions">Competition Promo</string>
|
||||
|
||||
<string name="msl_availability_sku">SKU Name</string>
|
||||
<string name="msl_availability_mbq">MBQ</string>
|
||||
<string name="msl_availability_availability">Availability</string>
|
||||
|
||||
<string name="stock_facing_reference_image">Reference Image</string>
|
||||
<string name="stock_facing_stock">Stock</string>
|
||||
<string name="stock_facing_facing">Facing</string>
|
||||
<string name="stock_facing_sos_target">SOS Target</string>
|
||||
|
||||
|
||||
</resources>
|
||||
|
||||
Reference in New Issue
Block a user