Merge pull request #97 from CPM-INDIA-SALES-AND-MARKETING-PVT-LTD/GG_Msl_StockFacing_Categorywise
//Stock_FacingActivity Changes today
This commit is contained in:
@@ -3334,12 +3334,25 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
|||||||
return filled;
|
return filled;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isMappingStockData() {
|
public boolean isMappingStockDataMSL_Availability(String category_id, String keyAccount_id, String storeType_id, String class_id) {
|
||||||
boolean filled = false;
|
boolean filled = false;
|
||||||
Cursor dbcursor = null;
|
Cursor dbcursor = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
dbcursor = db.rawQuery("SELECT * FROM MAPPING_STOCK ", null);
|
//dbcursor = db.rawQuery("SELECT * FROM MAPPING_STOCK ", null);
|
||||||
|
dbcursor = db.rawQuery("Select M.* 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 M.KEYACCOUNT_ID = '" + keyAccount_id + "' AND M.STORETYPE_ID = '" + storeType_id + "' " +
|
||||||
|
"AND M.CLASS_ID = '" + class_id + "' " +
|
||||||
|
"order by SB.SUB_CATEGORY,BR.BRAND", null);
|
||||||
|
|
||||||
if (dbcursor != null) {
|
if (dbcursor != null) {
|
||||||
dbcursor.moveToFirst();
|
dbcursor.moveToFirst();
|
||||||
@@ -3358,6 +3371,43 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
|||||||
return filled;
|
return filled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isMappingStockDataStockFacing(String category_id, String keyAccount_id, String storeType_id, String class_id) {
|
||||||
|
boolean filled = false;
|
||||||
|
Cursor dbcursor = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
//dbcursor = db.rawQuery("SELECT * FROM MAPPING_STOCK ", null);
|
||||||
|
dbcursor = db.rawQuery("Select M.* 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 M.KEYACCOUNT_ID = '" + keyAccount_id + "' " +
|
||||||
|
"AND M.STORETYPE_ID = '" + storeType_id + "' AND M.CLASS_ID = '" + class_id + "' " +
|
||||||
|
"order by SB.SUB_CATEGORY,BR.BRAND ", null);
|
||||||
|
|
||||||
|
if (dbcursor != null) {
|
||||||
|
dbcursor.moveToFirst();
|
||||||
|
int icount = dbcursor.getInt(0);
|
||||||
|
dbcursor.close();
|
||||||
|
if (icount > 0) {
|
||||||
|
filled = true;
|
||||||
|
} else {
|
||||||
|
filled = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.d("Exception ", " when fetching Records!!!!!!!!!!!!!!!!!!!!! " + e.toString());
|
||||||
|
return filled;
|
||||||
|
}
|
||||||
|
return filled;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public boolean isMappingT2PData(String store_id, String category_id) {
|
public boolean isMappingT2PData(String store_id, String category_id) {
|
||||||
boolean filled = false;
|
boolean filled = false;
|
||||||
Cursor dbcursor = null;
|
Cursor dbcursor = null;
|
||||||
|
|||||||
+34
-16
@@ -102,16 +102,27 @@ public class CategoryListActivity extends AppCompatActivity {
|
|||||||
boolean flag_filled = false;
|
boolean flag_filled = false;
|
||||||
String category_id = categoryList.get(i).getCategory_id();
|
String category_id = categoryList.get(i).getCategory_id();
|
||||||
|
|
||||||
|
//Additional_Visibility
|
||||||
if (db.additionalVisibilitydata(store_id, category_id)) {
|
if (db.additionalVisibilitydata(store_id, category_id)) {
|
||||||
boolean flag = true;
|
boolean flag = true;
|
||||||
|
|
||||||
if (db.isMappingStockData()) {
|
//MSL_Availability
|
||||||
if (!db.checkMsl_AvailabilityData(store_id, category_id)
|
if (db.isMappingStockDataMSL_Availability(category_id, keyAccount_id, storeType_id, class_id)) {
|
||||||
&& !db.checkStockAndFacingData(store_id, category_id)) {
|
if (!db.checkMsl_AvailabilityData(store_id, category_id)) {
|
||||||
flag = false;
|
flag = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Stock_Facing
|
||||||
|
if (flag) {
|
||||||
|
if (db.isMappingStockDataStockFacing(category_id, keyAccount_id, storeType_id, class_id)) {
|
||||||
|
if (!db.checkStockAndFacingData(store_id, category_id)) {
|
||||||
|
flag = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Promo Compliance
|
||||||
if (flag) {
|
if (flag) {
|
||||||
if (db.isMappingPromotionData(store_id, category_id)) {
|
if (db.isMappingPromotionData(store_id, category_id)) {
|
||||||
if (!db.checkPromoComplianceData(store_id, category_id)) {
|
if (!db.checkPromoComplianceData(store_id, category_id)) {
|
||||||
@@ -120,6 +131,7 @@ public class CategoryListActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//T2P
|
||||||
if (flag) {
|
if (flag) {
|
||||||
if (db.isMappingT2PData(store_id, category_id)) {
|
if (db.isMappingT2PData(store_id, category_id)) {
|
||||||
if (!db.isFilledT2P(store_id, category_id)) {
|
if (!db.isFilledT2P(store_id, category_id)) {
|
||||||
@@ -289,25 +301,31 @@ public class CategoryListActivity extends AppCompatActivity {
|
|||||||
if (db.additionalVisibilitydata(store_id, category_id)) {
|
if (db.additionalVisibilitydata(store_id, category_id)) {
|
||||||
//boolean flag = true;
|
//boolean flag = true;
|
||||||
|
|
||||||
if (db.isMappingStockData()) {
|
if (db.isMappingStockDataMSL_Availability(category_id, keyAccount_id, storeType_id, class_id)) {
|
||||||
if (!db.checkMsl_AvailabilityData(store_id, category_id)
|
if (!db.checkMsl_AvailabilityData(store_id, category_id)) {
|
||||||
&& !db.checkStockAndFacingData(store_id, category_id)) {
|
flag_filled = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Stock_Facing
|
||||||
|
if (db.isMappingStockDataStockFacing(category_id, keyAccount_id, storeType_id, class_id)) {
|
||||||
|
if (!db.checkStockAndFacingData(store_id, category_id)) {
|
||||||
|
flag_filled = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (db.isMappingPromotionData(store_id, category_id)) {
|
||||||
|
if (!db.checkPromoComplianceData(store_id, category_id)) {
|
||||||
flag_filled = false;
|
flag_filled = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!db.isMappingPromotionData(store_id,category_id)) {
|
if (db.isMappingT2PData(store_id, category_id)) {
|
||||||
if (db.checkPromoComplianceData(store_id, category_id)) {
|
if (!db.isFilledT2P(store_id, category_id)) {
|
||||||
flag_filled = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (!db.isMappingT2PData(store_id, category_id)) {
|
|
||||||
if (db.isFilledT2P(store_id, category_id)) {
|
|
||||||
flag_filled = false;
|
flag_filled = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-6
@@ -106,7 +106,7 @@ public class DailyDataMenuActivity extends AppCompatActivity {
|
|||||||
DailyDataMenuGetterSetter data = new DailyDataMenuGetterSetter();
|
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_name(getResources().getString(R.string.daily_data_menu_msl_availability));
|
||||||
if (db.isMappingStockData()) {
|
if (db.isMappingStockDataMSL_Availability(categoryId, keyAccount_id, storeType_id, class_id)) {
|
||||||
if (db.checkMsl_AvailabilityData(store_id, categoryId)) {
|
if (db.checkMsl_AvailabilityData(store_id, categoryId)) {
|
||||||
data.setCategory_img(R.mipmap.msl_availability_done);
|
data.setCategory_img(R.mipmap.msl_availability_done);
|
||||||
} else {
|
} else {
|
||||||
@@ -120,7 +120,7 @@ public class DailyDataMenuActivity extends AppCompatActivity {
|
|||||||
data = new DailyDataMenuGetterSetter();
|
data = new DailyDataMenuGetterSetter();
|
||||||
//data.setCategory_name("Stock & Facing");
|
//data.setCategory_name("Stock & Facing");
|
||||||
data.setCategory_name(getResources().getString(R.string.daily_data_menu_stock_facing));
|
data.setCategory_name(getResources().getString(R.string.daily_data_menu_stock_facing));
|
||||||
if (db.isMappingStockData()) {
|
if (db.isMappingStockDataStockFacing(categoryId, keyAccount_id, storeType_id, class_id)) {
|
||||||
if (db.checkStockAndFacingData(store_id, categoryId)) {
|
if (db.checkStockAndFacingData(store_id, categoryId)) {
|
||||||
data.setCategory_img(R.mipmap.stock_facing_done);
|
data.setCategory_img(R.mipmap.stock_facing_done);
|
||||||
} else {
|
} else {
|
||||||
@@ -248,13 +248,13 @@ public class DailyDataMenuActivity extends AppCompatActivity {
|
|||||||
holder.categoryIcon.setImageResource(dailyData.getCategory_img());
|
holder.categoryIcon.setImageResource(dailyData.getCategory_img());
|
||||||
|
|
||||||
if (dailyData.getCategory_name().equalsIgnoreCase(getResources().getString(R.string.daily_data_menu_msl_availability))) {
|
if (dailyData.getCategory_name().equalsIgnoreCase(getResources().getString(R.string.daily_data_menu_msl_availability))) {
|
||||||
if (db.isMappingStockData()) {
|
if (db.isMappingStockDataMSL_Availability(categoryId, keyAccount_id, storeType_id, class_id)) {
|
||||||
holder.categoryName.setTextColor(getResources().getColor(R.color.colorPrimaryDark));
|
holder.categoryName.setTextColor(getResources().getColor(R.color.colorPrimaryDark));
|
||||||
} else {
|
} else {
|
||||||
holder.categoryName.setTextColor(getResources().getColor(R.color.grey_background));
|
holder.categoryName.setTextColor(getResources().getColor(R.color.grey_background));
|
||||||
}
|
}
|
||||||
} else if (dailyData.getCategory_name().equalsIgnoreCase(getResources().getString(R.string.daily_data_menu_stock_facing))) {
|
} else if (dailyData.getCategory_name().equalsIgnoreCase(getResources().getString(R.string.daily_data_menu_stock_facing))) {
|
||||||
if (db.isMappingStockData()) {
|
if (db.isMappingStockDataStockFacing(categoryId, keyAccount_id, storeType_id, class_id)) {
|
||||||
holder.categoryName.setTextColor(getResources().getColor(R.color.colorPrimaryDark));
|
holder.categoryName.setTextColor(getResources().getColor(R.color.colorPrimaryDark));
|
||||||
} else {
|
} else {
|
||||||
holder.categoryName.setTextColor(getResources().getColor(R.color.grey_background));
|
holder.categoryName.setTextColor(getResources().getColor(R.color.grey_background));
|
||||||
@@ -277,14 +277,14 @@ public class DailyDataMenuActivity extends AppCompatActivity {
|
|||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
if (dailyData.getCategory_name().equalsIgnoreCase(getResources().getString(R.string.daily_data_menu_msl_availability))) {
|
if (dailyData.getCategory_name().equalsIgnoreCase(getResources().getString(R.string.daily_data_menu_msl_availability))) {
|
||||||
if (db.isMappingStockData()) {
|
if (db.isMappingStockDataMSL_Availability(categoryId, keyAccount_id, storeType_id, class_id)) {
|
||||||
Intent intent = new Intent(DailyDataMenuActivity.this, MSL_AvailabilityActivity.class);
|
Intent intent = new Intent(DailyDataMenuActivity.this, MSL_AvailabilityActivity.class);
|
||||||
intent.putExtra("categoryName", dailyData.getCategory_name());
|
intent.putExtra("categoryName", dailyData.getCategory_name());
|
||||||
intent.putExtra("categoryId", categoryId);
|
intent.putExtra("categoryId", categoryId);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
}
|
}
|
||||||
} else if (dailyData.getCategory_name().equalsIgnoreCase(getResources().getString(R.string.daily_data_menu_stock_facing))) {
|
} else if (dailyData.getCategory_name().equalsIgnoreCase(getResources().getString(R.string.daily_data_menu_stock_facing))) {
|
||||||
if (db.isMappingStockData()) {
|
if (db.isMappingStockDataStockFacing(categoryId, keyAccount_id, storeType_id, class_id)) {
|
||||||
Intent intent = new Intent(DailyDataMenuActivity.this, Stock_FacingActivity.class);
|
Intent intent = new Intent(DailyDataMenuActivity.this, Stock_FacingActivity.class);
|
||||||
intent.putExtra("categoryName", dailyData.getCategory_name());
|
intent.putExtra("categoryName", dailyData.getCategory_name());
|
||||||
intent.putExtra("categoryId", categoryId);
|
intent.putExtra("categoryId", categoryId);
|
||||||
|
|||||||
Reference in New Issue
Block a user