//Stock_FacingActivity Changes today

This commit is contained in:
Gagan290
2017-01-24 11:49:43 +05:30
parent 7d6b772fa8
commit 4edb3666df
5 changed files with 82 additions and 27 deletions
@@ -1495,13 +1495,26 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
}
//Promo Compliance
public ArrayList<Promo_Compliance_DataGetterSetter> getPromoComplianceSkuData(String store_id) {
public ArrayList<Promo_Compliance_DataGetterSetter> getPromoComplianceSkuData(String store_id, String category_id) {
ArrayList<Promo_Compliance_DataGetterSetter> list = new ArrayList<>();
Cursor dbcursor = null;
try {
dbcursor = db.rawQuery("Select * from MAPPING_PROMOTION " +
"where STORE_ID='" + store_id + "'", null);
dbcursor = db.rawQuery("Select M.* " +
"from MAPPING_PROMOTION 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.STORE_ID = '" + store_id + "' " +
"order by SB.SUB_CATEGORY,BR.BRAND", null);
/*dbcursor = db.rawQuery("Select * from MAPPING_PROMOTION " +
"where STORE_ID='" + store_id + "'", null);*/
if (dbcursor != null) {
dbcursor.moveToFirst();
@@ -1530,7 +1543,7 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
return list;
}
public ArrayList<Promo_Compliance_DataGetterSetter> getPromoSpinnerData(String store_id) {
public ArrayList<Promo_Compliance_DataGetterSetter> getPromoSpinnerData(String store_id, String category_id) {
ArrayList<Promo_Compliance_DataGetterSetter> list = new ArrayList<>();
Cursor dbcursor = null;
@@ -1541,8 +1554,21 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
list.add(promo);
dbcursor = db.rawQuery("Select * from MAPPING_ADDITIONAL_PROMOTION " +
"where STORE_ID='" + store_id + "'", null);
dbcursor = db.rawQuery("Select M.* " +
"from MAPPING_ADDITIONAL_PROMOTION 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.STORE_ID = '" + store_id + "' " +
"order by SB.SUB_CATEGORY,BR.BRAND", null);
/*dbcursor = db.rawQuery("Select * from MAPPING_ADDITIONAL_PROMOTION " +
"where STORE_ID='" + store_id + "'", null);*/
if (dbcursor != null) {
dbcursor.moveToFirst();
@@ -3271,12 +3297,25 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
return filled;
}
public boolean isMappingPromotionData() {
public boolean isMappingPromotionData(String store_id, String category_id) {
boolean filled = false;
Cursor dbcursor = null;
try {
dbcursor = db.rawQuery("SELECT * FROM MAPPING_PROMOTION ", null);
dbcursor = db.rawQuery("Select M.* " +
"from MAPPING_PROMOTION 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.STORE_ID = '" + store_id + "' " +
"order by SB.SUB_CATEGORY,BR.BRAND ", null);
//dbcursor = db.rawQuery("SELECT * FROM MAPPING_PROMOTION ", null);
if (dbcursor != null) {
dbcursor.moveToFirst();
@@ -3319,12 +3358,15 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
return filled;
}
public boolean isMappingT2PData() {
public boolean isMappingT2PData(String store_id, String category_id) {
boolean filled = false;
Cursor dbcursor = null;
try {
dbcursor = db.rawQuery("SELECT * FROM MAPPING_T2P ", null);
dbcursor = db.rawQuery("SELECT * FROM MAPPING_T2P M INNER JOIN BRAND_MASTER BR ON M.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.STORE_ID = '"+ store_id +"' AND CA.CATEGORY_ID= '" + category_id + "'", null);
if (dbcursor != null) {
dbcursor.moveToFirst();
@@ -3343,12 +3385,25 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
return filled;
}
public boolean isMappingAdditionalPromotionData() {
public boolean isMappingAdditionalPromotionData(String store_id, String category_id) {
boolean filled = false;
Cursor dbcursor = null;
try {
dbcursor = db.rawQuery("SELECT * FROM MAPPING_ADDITIONAL_PROMOTION ", null);
dbcursor = db.rawQuery("Select M.* " +
"from MAPPING_ADDITIONAL_PROMOTION 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.STORE_ID = '" + store_id + "' " +
"order by SB.SUB_CATEGORY,BR.BRAND ", null);
//dbcursor = db.rawQuery("SELECT * FROM MAPPING_ADDITIONAL_PROMOTION ", null);
if (dbcursor != null) {
dbcursor.moveToFirst();
@@ -113,16 +113,16 @@ public class CategoryListActivity extends AppCompatActivity {
}
if (flag) {
if (!db.isMappingPromotionData()) {
if (db.checkPromoComplianceData(store_id, category_id)) {
if (db.isMappingPromotionData(store_id, category_id)) {
if (!db.checkPromoComplianceData(store_id, category_id)) {
flag = false;
}
}
}
if (flag) {
if (!db.isMappingT2PData()) {
if (db.isFilledT2P(store_id, category_id)) {
if (db.isMappingT2PData(store_id, category_id)) {
if (!db.isFilledT2P(store_id, category_id)) {
flag = false;
}
}
@@ -298,7 +298,7 @@ public class CategoryListActivity extends AppCompatActivity {
}
if (!db.isMappingPromotionData()) {
if (!db.isMappingPromotionData(store_id,category_id)) {
if (db.checkPromoComplianceData(store_id, category_id)) {
flag_filled = false;
break;
@@ -306,7 +306,7 @@ public class CategoryListActivity extends AppCompatActivity {
}
if (!db.isMappingT2PData()) {
if (!db.isMappingT2PData(store_id, category_id)) {
if (db.isFilledT2P(store_id, category_id)) {
flag_filled = false;
break;
@@ -135,7 +135,7 @@ public class DailyDataMenuActivity extends AppCompatActivity {
data = new DailyDataMenuGetterSetter();
data.setCategory_name(getResources().getString(R.string.daily_data_menu_t2p));
if (db.isMappingT2PData()) {
if (db.isMappingT2PData(store_id, categoryId)) {
if (db.isFilledT2P(store_id, categoryId)) {
data.setCategory_img(R.mipmap.t2p_compliance_done);
} else {
@@ -163,7 +163,7 @@ public class DailyDataMenuActivity extends AppCompatActivity {
//data.setCategory_name("Promo Compliance");
data.setCategory_name(getResources().getString(R.string.daily_data_menu_promo_compliance));
if (db.isMappingPromotionData() || db.isMappingAdditionalPromotionData()) {
if (db.isMappingPromotionData(store_id, categoryId) || db.isMappingAdditionalPromotionData(store_id, categoryId)) {
if (db.checkPromoComplianceData(store_id, categoryId) ||
db.checkAdditionalPromoComplianceData(store_id, categoryId)) {
data.setCategory_img(R.mipmap.promo_compliance_done);
@@ -260,13 +260,13 @@ public class DailyDataMenuActivity extends AppCompatActivity {
holder.categoryName.setTextColor(getResources().getColor(R.color.grey_background));
}
} else if (dailyData.getCategory_name().equalsIgnoreCase(getResources().getString(R.string.daily_data_menu_promo_compliance))) {
if (db.isMappingPromotionData() || db.isMappingAdditionalPromotionData()) {
if (db.isMappingPromotionData(store_id, categoryId) || db.isMappingAdditionalPromotionData(store_id, categoryId)) {
holder.categoryName.setTextColor(getResources().getColor(R.color.colorPrimaryDark));
} else {
holder.categoryName.setTextColor(getResources().getColor(R.color.grey_background));
}
} else if (dailyData.getCategory_name().equalsIgnoreCase((getResources().getString(R.string.daily_data_menu_t2p)))) {
if (db.isMappingT2PData()) {
if (db.isMappingT2PData(store_id, categoryId)) {
holder.categoryName.setTextColor(getResources().getColor(R.color.colorPrimaryDark));
} else {
holder.categoryName.setTextColor(getResources().getColor(R.color.grey_background));
@@ -292,14 +292,14 @@ public class DailyDataMenuActivity extends AppCompatActivity {
}
} else if (dailyData.getCategory_name().equalsIgnoreCase(getResources().getString(R.string.daily_data_menu_promo_compliance))) {
if (db.isMappingPromotionData() || db.isMappingAdditionalPromotionData()) {
if (db.isMappingPromotionData(store_id, categoryId) || db.isMappingAdditionalPromotionData(store_id, categoryId)) {
Intent intent = new Intent(DailyDataMenuActivity.this, PromoComplianceActivity.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_t2p)))) {
if (db.isMappingT2PData()) {
if (db.isMappingT2PData(store_id, categoryId)) {
Intent intent = new Intent(DailyDataMenuActivity.this, T2PComplianceActivity.class);
intent.putExtra("categoryName", dailyData.getCategory_name());
intent.putExtra("categoryId", categoryId);
@@ -317,11 +317,11 @@ public class PromoComplianceActivity extends AppCompatActivity {
//Promo SKU List
promoSkuListData = db.getPromoComplianceSkuAfterData(store_id, categoryId);
if (!(promoSkuListData.size() > 0)) {
promoSkuListData = db.getPromoComplianceSkuData(store_id);
promoSkuListData = db.getPromoComplianceSkuData(store_id, categoryId);
}
//Promo Spinner List
promoSpinnerListData = db.getPromoSpinnerData(store_id);
promoSpinnerListData = db.getPromoSpinnerData(store_id, categoryId);
ArrayAdapter<String> sp_promo_adapter = new ArrayAdapter<>(PromoComplianceActivity.this, android.R.layout.simple_list_item_1);
for (int i = 0; i < promoSpinnerListData.size(); i++) {
@@ -208,7 +208,7 @@
<string name="cancel">İptal etmek</string>
<string name="empty">Boş</string>
<string name="check_faceup">Raf Payı, stoktan daha az veya eşit olmalıdır</string>
<string name="check_faceup">Önyüz sayısı stoktan daha az veya eşit olmalıdır</string>
<string name="fill_stock_value">Önce stok değerini doldurun</string>
<string name="want_add">Verileri eklemek istiyor musunuz?</string>
<string name="promo_add">Promosyon eklendi</string>