Merge remote-tracking branch 'origin/NewDialogChangeAC' into NewDialogChangeAC

This commit is contained in:
ashishandroid
2017-01-20 16:36:50 +05:30
15 changed files with 393 additions and 192 deletions
@@ -3,9 +3,11 @@ package cpm.com.gskmtorange.Database;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
import android.widget.Toast;
import java.util.ArrayList;
import java.util.HashMap;
@@ -55,9 +57,12 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
public static final int DATABASE_VERSION = 13;
TableBean tableBean;
private SQLiteDatabase db;
Context context;
public GSKOrangeDB(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
this.context = context;
}
public void open() {
@@ -71,53 +76,58 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL(TableBean.getJourneyPlan());
try {
db.execSQL(TableBean.getJourneyPlan());
//Gagan Start
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.getNonWorkingReason());
db.execSQL(CommonString.CREATE_TABLE_STORE_GEOTAGGING);
db.execSQL(CommonString.CREATE_TABLE_COVERAGE_DATA);
db.execSQL(TableBean.getDisplayChecklistMaster());
db.execSQL(TableBean.getMappingDisplayChecklist());
db.execSQL(TableBean.getMappingAdditionalPromotion());
db.execSQL(TableBean.getMappingPromotion());
//Gagan Start
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.getNonWorkingReason());
db.execSQL(CommonString.CREATE_TABLE_STORE_GEOTAGGING);
db.execSQL(CommonString.CREATE_TABLE_COVERAGE_DATA);
db.execSQL(TableBean.getDisplayChecklistMaster());
db.execSQL(TableBean.getMappingDisplayChecklist());
db.execSQL(TableBean.getMappingAdditionalPromotion());
db.execSQL(TableBean.getMappingPromotion());
db.execSQL(CommonString.CREATE_TABLE_INSERT_MSL_AVAILABILITY);
db.execSQL(CommonString.CREATE_TABLE_INSERT_STOCK_ADDITIONAL_VISIBILITY);
db.execSQL(CommonString.CREATE_TABLE_INSERT_STOCK_FACING_HEADER);
db.execSQL(CommonString.CREATE_TABLE_INSERT_STOCK_FACING_CHILD);
db.execSQL(CommonString.CREATE_TABLE_STOCK_DIALOG);
db.execSQL(CommonString.CREATE_TABLE_STOCK_ADDITIONAL_STOCK_DATA);
db.execSQL(CommonString.CREATE_TABLE_INSERT_ADDITIONAL_PROMO_COMPLIANCE);
db.execSQL(CommonString.CREATE_TABLE_INSERT_PROMO_SKU);
db.execSQL(CommonString.CREATE_TABLE_INSERT_STOCK_ADDITIONAL_VISIBILITY_MAIN);
db.execSQL(CommonString.CREATE_TABLE_STOCK_DIALOG_MAIN);
db.execSQL(CommonString.CREATE_TABLE_INSERT_MSL_AVAILABILITY);
db.execSQL(CommonString.CREATE_TABLE_INSERT_STOCK_ADDITIONAL_VISIBILITY);
db.execSQL(CommonString.CREATE_TABLE_INSERT_STOCK_FACING_HEADER);
db.execSQL(CommonString.CREATE_TABLE_INSERT_STOCK_FACING_CHILD);
db.execSQL(CommonString.CREATE_TABLE_STOCK_DIALOG);
db.execSQL(CommonString.CREATE_TABLE_STOCK_ADDITIONAL_STOCK_DATA);
db.execSQL(CommonString.CREATE_TABLE_INSERT_ADDITIONAL_PROMO_COMPLIANCE);
db.execSQL(CommonString.CREATE_TABLE_INSERT_PROMO_SKU);
db.execSQL(CommonString.CREATE_TABLE_INSERT_STOCK_ADDITIONAL_VISIBILITY_MAIN);
db.execSQL(CommonString.CREATE_TABLE_STOCK_DIALOG_MAIN);
db.execSQL(TableBean.getStorePerformance());
db.execSQL(TableBean.getStorePerformance());
//Gagan End
//Gagan End
db.execSQL(CommonString.CREATE_TABLE_STORE_GEOTAGGING);
db.execSQL(CommonString.CREATE_TABLE_COVERAGE_DATA);
db.execSQL(CommonString.CREATE_TABLE_STORE_GEOTAGGING);
db.execSQL(CommonString.CREATE_TABLE_COVERAGE_DATA);
db.execSQL(TableBean.getDisplayChecklistMaster());
db.execSQL(TableBean.getMappingDisplayChecklist());
db.execSQL(TableBean.getDisplayChecklistMaster());
db.execSQL(TableBean.getMappingDisplayChecklist());
db.execSQL(TableBean.getNonWorkingReason());
db.execSQL(TableBean.getNonWorkingReason());
db.execSQL(CommonString.CREATE_TABLE_INSERT_T2P_COMPLIANCE);
db.execSQL(CommonString.CREATE_TABLE_INSERT_T2P_GAPS);
db.execSQL(CommonString.CREATE_TABLE_INSERT_T2P_SKU);
db.execSQL(CommonString.CREATE_TABLE_INSERT_T2P_COMPLIANCE);
db.execSQL(CommonString.CREATE_TABLE_INSERT_T2P_GAPS);
db.execSQL(CommonString.CREATE_TABLE_INSERT_T2P_SKU);
db.execSQL(TableBean.getMappingPlanogram());
db.execSQL(TableBean.getAdditionalDisplay());
db.execSQL(TableBean.getMappingPlanogram());
db.execSQL(TableBean.getAdditionalDisplay());
} catch (SQLException e) {
e.printStackTrace();
Toast.makeText(context, "Error -" + e.toString(), Toast.LENGTH_SHORT).show();
}
}
@@ -142,6 +152,7 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
db.delete(CommonString.TABLE_INSERT_PROMO_SKU, "STORE_ID='" + storeid + "'", null);
//Gagan end code
db.delete(CommonString.TABLE_INSERT_T2P_COMPLIANCE, "STORE_ID='" + storeid + "'", null);
}
public void deleteAllTables() {
@@ -161,6 +172,8 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
db.delete(CommonString.TABLE_INSERT_PROMO_SKU, null, null);
//Gagan end code
db.delete(CommonString.TABLE_INSERT_T2P_COMPLIANCE, null, null);
}
public void InsertJCP(JourneyPlanGetterSetter data) {
@@ -310,7 +323,7 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
}
//get Brand data for T2P
public ArrayList<BrandMasterGetterSetter> getBrandT2PData(String store_type_id, String class_id, String key_account_id) {
public ArrayList<BrandMasterGetterSetter> getBrandT2PData(String store_type_id, String class_id, String key_account_id, String category_id) {
ArrayList<BrandMasterGetterSetter> brandList = new ArrayList<>();
Cursor dbcursor = null;
@@ -318,7 +331,7 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
try {
dbcursor = db.rawQuery("SELECT * FROM(SELECT DISTINCT BR.BRAND_ID, SCM.SUB_CATEGORY||'-'||BR.BRAND AS BRAND FROM MAPPING_STOCK MS INNER JOIN SKU_MASTER SM ON MS.SKU_ID = SM.SKU_ID INNER JOIN BRAND_MASTER BR ON SM.BRAND_ID=BR.BRAND_ID INNER JOIN SUB_CATEGORY_MASTER SCM ON BR.SUB_CATEGORY_ID = SCM.SUB_CATEGORY_ID WHERE MS.KEYACCOUNT_ID ='" + key_account_id + "' AND STORETYPE_ID ='" + store_type_id + "' AND CLASS_ID = '" + class_id + "' AND BR.COMPANY_ID ='1' ORDER BY SCM.SUB_CATEGORY_SEQUENCE, BR.BRAND_SEQUENCE) As Brand", null);
dbcursor = db.rawQuery("SELECT * FROM(SELECT DISTINCT BR.BRAND_ID, SCM.SUB_CATEGORY||'-'||BR.BRAND AS BRAND FROM MAPPING_STOCK MS INNER JOIN SKU_MASTER SM ON MS.SKU_ID = SM.SKU_ID INNER JOIN BRAND_MASTER BR ON SM.BRAND_ID=BR.BRAND_ID INNER JOIN SUB_CATEGORY_MASTER SCM ON BR.SUB_CATEGORY_ID = SCM.SUB_CATEGORY_ID WHERE MS.KEYACCOUNT_ID ='" + key_account_id + "' AND STORETYPE_ID ='" + store_type_id + "' AND CLASS_ID = '" + class_id + "' AND BR.COMPANY_ID ='1' AND SCM.CATEGORY_ID = '" + category_id + "' ORDER BY SCM.SUB_CATEGORY_SEQUENCE, BR.BRAND_SEQUENCE ) As Brand", null);
if (dbcursor != null) {
dbcursor.moveToFirst();
@@ -2287,13 +2300,13 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
}
public ArrayList<BrandMasterGetterSetter> getBrandMasterData(String store_id) {
public ArrayList<BrandMasterGetterSetter> getBrandMasterData(String store_id, String category_id) {
Cursor cursordata = null;
ArrayList<BrandMasterGetterSetter> Data = new ArrayList<BrandMasterGetterSetter>();
try {
cursordata = db.rawQuery("SELECT BR.BRAND_ID, BR.BRAND FROM BRAND_MASTER BR 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 COMPANY_ID =1", null);
cursordata = db.rawQuery("SELECT BR.BRAND_ID, SB.SUB_CATEGORY||'-'||BR.BRAND AS BRAND FROM BRAND_MASTER BR 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 COMPANY_ID =1 AND SB.CATEGORY_ID ='" + category_id+ "'", null);
if (cursordata != null) {
cursordata.moveToFirst();
@@ -3222,4 +3235,75 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
return filled;
}
public boolean isMappingPromotionData() {
boolean filled = false;
Cursor dbcursor = null;
try {
dbcursor = db.rawQuery("SELECT * FROM MAPPING_PROMOTION ", 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 isMappingStockData() {
boolean filled = false;
Cursor dbcursor = null;
try {
dbcursor = db.rawQuery("SELECT * FROM MAPPING_STOCK ", 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() {
boolean filled = false;
Cursor dbcursor = null;
try {
dbcursor = db.rawQuery("SELECT * FROM MAPPING_T2P ", 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;
}
}
@@ -166,7 +166,7 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
str = CommonString.FILE_PATH;
///band List
brand_list = db.getBrandMasterData(store_id);
brand_list = db.getBrandMasterData(store_id, categoryId);
BrandMasterGetterSetter brand = new BrandMasterGetterSetter();
String str = getResources().getString(R.string.select);
brand.setBRAND(str);
@@ -1008,7 +1008,9 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
public void showSkuDialog() {
final ArrayList<BrandMasterGetterSetter> brandList = db.getBrandT2PData(store_type_id, class_id, key_account_id);
final ArrayList<BrandMasterGetterSetter> brandList = db.getBrandT2PData(store_type_id, class_id, key_account_id,categoryId);
BrandMasterGetterSetter brand = new BrandMasterGetterSetter();
brand.setBRAND(getResources().getString(R.string.select));
brandList.add(0, brand);
@@ -413,7 +413,7 @@ public class T2PComplianceActivity extends AppCompatActivity {
final SkuGetterSetter[] sku_selected = new SkuGetterSetter[1];
final BrandMasterGetterSetter[] brand_selected = new BrandMasterGetterSetter[1];
final ArrayList<BrandMasterGetterSetter> brandList = db.getBrandT2PData(storeType_id, class_id, keyAccount_id);
final ArrayList<BrandMasterGetterSetter> brandList = db.getBrandT2PData(storeType_id, class_id, keyAccount_id, categoryId);
BrandMasterGetterSetter brand = new BrandMasterGetterSetter();
brand.setBRAND("select");
brandList.add(0, brand);
@@ -35,6 +35,7 @@ import java.net.MalformedURLException;
import java.net.URL;
import java.text.DecimalFormat;
import java.util.Locale;
import cpm.com.gskmtorange.Database.GSKOrangeDB;
import cpm.com.gskmtorange.R;
import cpm.com.gskmtorange.constant.CommonString;
@@ -94,7 +95,7 @@ public class DownloadActivity extends AppCompatActivity {
preferences = PreferenceManager.getDefaultSharedPreferences(this);
updateResources(getApplicationContext(),preferences.getString(CommonString.KEY_LANGUAGE, ""));
updateResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
userId = preferences.getString(CommonString.KEY_USERNAME, null);
culture_id = preferences.getString(CommonString.KEY_CULTURE_ID, "");
@@ -102,7 +103,6 @@ public class DownloadActivity extends AppCompatActivity {
}
class Data {
int value;
String name;
@@ -137,7 +137,7 @@ public class DownloadActivity extends AppCompatActivity {
data = new Data();
data.value = 10;
data.name = "JCP "+getResources().getString(R.string.download_data);
data.name = "JCP " + getResources().getString(R.string.download_data);
publishProgress(data);
XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
@@ -178,7 +178,7 @@ public class DownloadActivity extends AppCompatActivity {
}
data.value = 10;
data.name = "JCP "+getResources().getString(R.string.download_data);
data.name = "JCP " + getResources().getString(R.string.download_data);
}
publishProgress(data);
@@ -214,7 +214,7 @@ public class DownloadActivity extends AppCompatActivity {
}
data.value = 20;
data.name = "SKU_MASTER "+getResources().getString(R.string.download_data);
data.name = "SKU_MASTER " + getResources().getString(R.string.download_data);
}
publishProgress(data);
@@ -250,7 +250,7 @@ public class DownloadActivity extends AppCompatActivity {
}
data.value = 25;
data.name = "BRAND_MASTER "+getResources().getString(R.string.download_data);
data.name = "BRAND_MASTER " + getResources().getString(R.string.download_data);
}
publishProgress(data);
@@ -285,7 +285,7 @@ public class DownloadActivity extends AppCompatActivity {
return "SUB_CATEGORY_MASTER";
}
data.value = 30;
data.name = "SUB_CATEGORY_MASTER "+getResources().getString(R.string.download_data);
data.name = "SUB_CATEGORY_MASTER " + getResources().getString(R.string.download_data);
}
publishProgress(data);
@@ -320,7 +320,7 @@ public class DownloadActivity extends AppCompatActivity {
return "CATEGORY_MASTER";
}
data.value = 35;
data.name = "CATEGORY_MASTER "+getResources().getString(R.string.download_data);
data.name = "CATEGORY_MASTER " + getResources().getString(R.string.download_data);
}
publishProgress(data);
@@ -355,11 +355,10 @@ public class DownloadActivity extends AppCompatActivity {
return "DISPLAY_MASTER";
}
data.value = 40;
data.name = "DISPLAY_MASTER "+getResources().getString(R.string.download_data);
data.name = "DISPLAY_MASTER " + getResources().getString(R.string.download_data);
}
publishProgress(data);
// MAPPING_STOCK
request = new SoapObject(CommonString.NAMESPACE, CommonString.METHOD_NAME_UNIVERSAL_DOWNLOAD);
request.addProperty("UserName", userId);
@@ -380,17 +379,20 @@ public class DownloadActivity extends AppCompatActivity {
xpp.next();
eventType = xpp.getEventType();
mappingStockGetterSetter = XMLHandlers.mappingStockXMLHandler(xpp, eventType);
if (mappingStockGetterSetter.getSKU_ID().size() > 0) {
String stocktable = mappingStockGetterSetter.getTable_MAPPING_STOCK();
if (stocktable != null) {
resultHttp = CommonString.KEY_SUCCESS;
TableBean.setMappingStock(stocktable);
}
} else {
return "MAPPING_STOCK";
String stocktable = mappingStockGetterSetter.getTable_MAPPING_STOCK();
if (stocktable != null) {
resultHttp = CommonString.KEY_SUCCESS;
TableBean.setMappingStock(stocktable);
}
data.value = 45;
data.name = "MAPPING_STOCK "+getResources().getString(R.string.download_data);
if (mappingStockGetterSetter.getSKU_ID().size() > 0) {
data.value = 45;
data.name = "MAPPING_STOCK " + getResources().getString(R.string.download_data);
} else {
// return "MAPPING_STOCK";
}
}
publishProgress(data);
@@ -415,17 +417,21 @@ public class DownloadActivity extends AppCompatActivity {
xpp.next();
eventType = xpp.getEventType();
mappingt2PGetterSetter = XMLHandlers.mappingT2pXMLHandler(xpp, eventType);
String t2ptable = mappingt2PGetterSetter.getTable_MAPPING_T2P();
if (t2ptable != null) {
resultHttp = CommonString.KEY_SUCCESS;
TableBean.setMappingT2p(t2ptable);
}
if (mappingt2PGetterSetter.getSTORE_ID().size() > 0) {
String t2ptable = mappingt2PGetterSetter.getTable_MAPPING_T2P();
if (t2ptable != null) {
resultHttp = CommonString.KEY_SUCCESS;
TableBean.setMappingT2p(t2ptable);
}
data.value = 50;
data.name = "MAPPING_T2P " + getResources().getString(R.string.download_data);
} else {
//return "MAPPING_T2P";
}
data.value = 50;
data.name = "MAPPING_T2P "+getResources().getString(R.string.download_data);
}
publishProgress(data);
@@ -459,7 +465,7 @@ public class DownloadActivity extends AppCompatActivity {
return "DISPLAY_CHECKLIST_MASTER";
}
data.value = 55;
data.name = "DISPLAY_CHECKLIST_MASTER "+getResources().getString(R.string.download_data);
data.name = "DISPLAY_CHECKLIST_MASTER " + getResources().getString(R.string.download_data);
}
publishProgress(data);
@@ -483,17 +489,20 @@ public class DownloadActivity extends AppCompatActivity {
xpp.next();
eventType = xpp.getEventType();
mappingChecklistGetterSetter = XMLHandlers.mappingMappingDisplayChecklistXMLHandler(xpp, eventType);
String mapping_display_checklisttable = mappingChecklistGetterSetter.getTable_MAPPING_DISPLAY_CHECKLIST();
if (mapping_display_checklisttable != null) {
resultHttp = CommonString.KEY_SUCCESS;
TableBean.setMappingDisplayChecklist(mapping_display_checklisttable);
}
if (mappingChecklistGetterSetter.getCHECKLIST_ID().size() > 0) {
String mapping_display_checklisttable = mappingChecklistGetterSetter.getTable_MAPPING_DISPLAY_CHECKLIST();
if (mapping_display_checklisttable != null) {
resultHttp = CommonString.KEY_SUCCESS;
TableBean.setMappingDisplayChecklist(mapping_display_checklisttable);
}
data.value = 60;
data.name = "MAPPING_DISPLAY_CHECKLIST " + getResources().getString(R.string.download_data);
} else {
//return "MAPPING_DISPLAY_CHECKLIST";
}
data.value = 60;
data.name = "MAPPING_DISPLAY_CHECKLIST "+getResources().getString(R.string.download_data);
}
publishProgress(data);
@@ -528,7 +537,7 @@ public class DownloadActivity extends AppCompatActivity {
return "NON_WORKING_REASON";
}
data.value = 65;
data.name = "NON_WORKING_REASON "+getResources().getString(R.string.download_data);
data.name = "NON_WORKING_REASON " + getResources().getString(R.string.download_data);
}
publishProgress(data);
@@ -553,17 +562,19 @@ public class DownloadActivity extends AppCompatActivity {
xpp.next();
eventType = xpp.getEventType();
mappingPromotionGetterSetter = XMLHandlers.mappingPromotionXMLHandler(xpp, eventType);
//if (mappingPromotionGetterSetter.getSTORE_ID().size() > 0) {
String mapping_promotion_table = mappingPromotionGetterSetter.getTable_MAPPING_PROMOTION();
if (mapping_promotion_table != null) {
resultHttp = CommonString.KEY_SUCCESS;
TableBean.setMappingPromotion(mapping_promotion_table);
}
/*} else {
//return "MAPPING_PROMOTION";
}*/
data.value = 70;
data.name = "MAPPING_PROMOTION "+getResources().getString(R.string.download_data);
if (mappingPromotionGetterSetter.getSTORE_ID().size() > 0) {
data.value = 70;
data.name = "MAPPING_PROMOTION " + getResources().getString(R.string.download_data);
}
}
publishProgress(data);
@@ -597,11 +608,13 @@ public class DownloadActivity extends AppCompatActivity {
resultHttp = CommonString.KEY_SUCCESS;
TableBean.setMappingAdditionalPromotion(mapping_additional_promotion_table);
}
/*} else {
//return "MAPPING_ADDITIONAL_PROMOTION";
}*/
data.value = 75;
data.name = "MAPPING_ADDITIONAL_PROMOTION "+getResources().getString(R.string.download_data);
if (mapping_additional_promotion_masterGetterSetter.getSTORE_ID().size() > 0) {
data.value = 75;
data.name = "MAPPING_ADDITIONAL_PROMOTION " + getResources().getString(R.string.download_data);
}
}
publishProgress(data);
@@ -627,22 +640,23 @@ public class DownloadActivity extends AppCompatActivity {
eventType = xpp.getEventType();
store_performance_masterGetterSetter = XMLHandlers.STORE_PERFORMANCEXMLHandler(xpp, eventType);
String table_store_performace = store_performance_masterGetterSetter.getTable_STORE_PERFORMANCE();
if (table_store_performace != null) {
resultHttp = CommonString.KEY_SUCCESS;
TableBean.setStorePerformance(table_store_performace);
}
if (store_performance_masterGetterSetter.getSTORE_ID().size() > 0) {
String table_store_performace = store_performance_masterGetterSetter.getTable_STORE_PERFORMANCE();
if (table_store_performace != null) {
resultHttp = CommonString.KEY_SUCCESS;
TableBean.setStorePerformance(table_store_performace);
}
data.value = 80;
data.name = "STORE_PERFORMANCE Data Download";
} else {
//return "STORE_PERFORMANCE";
}
data.value = 80;
data.name = "STORE_PERFORMANCE Data Download";
}
publishProgress(data);
//ADDITIONAL_DISPLAY_MASTER
request = new SoapObject(CommonString.NAMESPACE, CommonString.METHOD_NAME_UNIVERSAL_DOWNLOAD);
request.addProperty("UserName", userId);
@@ -699,17 +713,18 @@ public class DownloadActivity extends AppCompatActivity {
eventType = xpp.getEventType();
mapping_planogram_masterGetterSetter = XMLHandlers.MAPPING_PLANOGRAM_XMLHandler(xpp, eventType);
String table_mapping_planogram = mapping_planogram_masterGetterSetter.getTable_MAPPING_PLANOGRAM();
if (table_mapping_planogram != null) {
resultHttp = CommonString.KEY_SUCCESS;
TableBean.setMappingPlanogram(table_mapping_planogram);
}
if (mapping_planogram_masterGetterSetter.getKEYACCOUNT_ID().size() > 0) {
String table_mapping_planogram = mapping_planogram_masterGetterSetter.getTable_MAPPING_PLANOGRAM();
if (table_mapping_planogram != null) {
resultHttp = CommonString.KEY_SUCCESS;
TableBean.setMappingPlanogram(table_mapping_planogram);
}
data.value = 85;
data.name = "MAPPING_PLANOGRAM Data Download";
} else {
//return "MAPPING_PLANOGRAM";
}
data.value = 85;
data.name = "MAPPING_PLANOGRAM Data Download";
}
publishProgress(data);
@@ -775,7 +790,7 @@ public class DownloadActivity extends AppCompatActivity {
//Display Master Image save into folder
if (displayMasterGetterSetter != null) {
for (int i = 0; i < displayMasterGetterSetter.getIMAGE_URL().size(); i++) {
for (int i = 0; i < displayMasterGetterSetter.getIMAGE_URL().size(); i++) {
//publishing image download
data.value = data.value + 1;
if (data.value < 100) {
@@ -851,7 +866,6 @@ public class DownloadActivity extends AppCompatActivity {
db.InsertADDITIONAL_DISPLAY(additional_display_getter_setter);
} catch (MalformedURLException e) {
/*final AlertMessage message = new AlertMessage(
CompleteDownloadActivity.this,
@@ -923,21 +937,19 @@ public class DownloadActivity extends AppCompatActivity {
@Override
protected void onResume() {
super.onResume();
updateResources(getApplicationContext(),preferences.getString(CommonString.KEY_LANGUAGE, ""));
updateResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
}
private static boolean updateResources(Context context, String language) {
String lang ;
String lang;
if(language.equalsIgnoreCase("English")){
if (language.equalsIgnoreCase("English")) {
lang = "EN";
}
else if(language.equalsIgnoreCase("UAE")) {
} else if (language.equalsIgnoreCase("UAE")) {
lang = "AR";
}
else {
} else {
lang = "TR";
}
@@ -55,7 +55,7 @@ public class CategoryListActivity extends AppCompatActivity {
preferences = PreferenceManager.getDefaultSharedPreferences(this);
updateResources(getApplicationContext(),preferences.getString(CommonString.KEY_LANGUAGE, ""));
updateResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
store_id = preferences.getString(CommonString.KEY_STORE_ID, null);
visit_date = preferences.getString(CommonString.KEY_DATE, null);
@@ -88,46 +88,63 @@ public class CategoryListActivity extends AppCompatActivity {
protected void onResume() {
super.onResume();
updateResources(getApplicationContext(),preferences.getString(CommonString.KEY_LANGUAGE, ""));
updateResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
recyclerView = (RecyclerView) findViewById(R.id.recyclerView);
categoryList = new ArrayList<>();
categoryList = db.getCategoryListData(keyAccount_id, storeType_id, class_id);
if(categoryList.size()>0){
if (categoryList.size() > 0) {
for(int i=0;i<categoryList.size();i++){
for (int i = 0; i < categoryList.size(); i++) {
boolean flag_filled = false;
String category_id = categoryList.get(i).getCategory_id();
if (db.checkMsl_AvailabilityData(store_id, category_id)
&& db.checkStockAndFacingData(store_id, category_id)
&& db.checkPromoComplianceData(store_id, category_id)
&& db.isFilledT2P(store_id, category_id)
&& db.additionalVisibilitydata(store_id, category_id)) {
flag_filled =true;
if (db.additionalVisibilitydata(store_id, category_id)) {
boolean flag = true;
if (db.isMappingStockData()) {
if (!db.checkMsl_AvailabilityData(store_id, category_id)
&& !db.checkStockAndFacingData(store_id, category_id)) {
flag = false;
}
}
if (flag) {
if (!db.isMappingPromotionData()) {
if (db.checkPromoComplianceData(store_id, category_id)) {
flag = false;
}
}
}
if (flag) {
if (!db.isMappingT2PData()) {
if (db.isFilledT2P(store_id, category_id)) {
flag = false;
}
}
}
flag_filled = flag;
}
if(flag_filled){
if (category_id.equals("1")){
if (flag_filled) {
if (category_id.equals("1")) {
categoryList.get(i).setCategory_img(R.mipmap.nutritionals_tick);
}
else if (category_id.equals("2")){
} else if (category_id.equals("2")) {
categoryList.get(i).setCategory_img(R.mipmap.oralcare_tick);
}else if (category_id.equals("3")){
} else if (category_id.equals("3")) {
categoryList.get(i).setCategory_img(R.mipmap.wellness_tick);
}
}
else {
if (category_id.equals("1")){
} else {
if (category_id.equals("1")) {
categoryList.get(i).setCategory_img(R.mipmap.nutritionals);
}
else if (category_id.equals("2")){
} else if (category_id.equals("2")) {
categoryList.get(i).setCategory_img(R.mipmap.oral_care);
}else if (category_id.equals("3")){
} else if (category_id.equals("3")) {
categoryList.get(i).setCategory_img(R.mipmap.wellness);
}
}
@@ -227,15 +244,13 @@ public class CategoryListActivity extends AppCompatActivity {
private static boolean updateResources(Context context, String language) {
String lang ;
String lang;
if(language.equalsIgnoreCase("English")){
if (language.equalsIgnoreCase("English")) {
lang = "EN";
}
else if(language.equalsIgnoreCase("UAE")) {
} else if (language.equalsIgnoreCase("UAE")) {
lang = "AR";
}
else {
} else {
lang = "TR";
}
@@ -259,12 +274,46 @@ public class CategoryListActivity extends AppCompatActivity {
for (int i = 0; i < categoryList.size(); i++) {
String category_id = categoryList.get(i).getCategory_id();
if (db.checkMsl_AvailabilityData(store_id, category_id)
/* if (db.checkMsl_AvailabilityData(store_id, category_id)
&& db.checkStockAndFacingData(store_id, category_id)
&& db.checkPromoComplianceData(store_id, category_id)
&& db.isFilledT2P(store_id, category_id)
&& db.additionalVisibilitydata(store_id, category_id)) {
flag_filled = true;
} else {
flag_filled = false;
break;
}*/
if (db.additionalVisibilitydata(store_id, category_id)) {
//boolean flag = true;
if (db.isMappingStockData()) {
if (!db.checkMsl_AvailabilityData(store_id, category_id)
&& !db.checkStockAndFacingData(store_id, category_id)) {
flag_filled = false;
break;
}
}
if (!db.isMappingPromotionData()) {
if (db.checkPromoComplianceData(store_id, category_id)) {
flag_filled = false;
break;
}
}
if (!db.isMappingT2PData()) {
if (db.isFilledT2P(store_id, category_id)) {
flag_filled = false;
break;
}
}
flag_filled = true;
} else {
flag_filled = false;
@@ -60,7 +60,7 @@ public class DailyDataMenuActivity extends AppCompatActivity {
//preference data
preferences = PreferenceManager.getDefaultSharedPreferences(this);
updateResources(getApplicationContext(),preferences.getString(CommonString.KEY_LANGUAGE, ""));
updateResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
store_id = preferences.getString(CommonString.KEY_STORE_ID, null);
visit_date = preferences.getString(CommonString.KEY_DATE, null);
@@ -98,7 +98,7 @@ public class DailyDataMenuActivity extends AppCompatActivity {
protected void onResume() {
super.onResume();
updateResources(getApplicationContext(),preferences.getString(CommonString.KEY_LANGUAGE, ""));
updateResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
try {
categoryList = new ArrayList<>();
@@ -106,20 +106,28 @@ public class DailyDataMenuActivity extends AppCompatActivity {
DailyDataMenuGetterSetter data = new DailyDataMenuGetterSetter();
//data.setCategory_name("MSL Availability");
data.setCategory_name(getResources().getString(R.string.daily_data_menu_msl_availability));
if (db.checkMsl_AvailabilityData(store_id, categoryId)) {
data.setCategory_img(R.mipmap.msl_availability_done);
if (db.isMappingStockData()) {
if (db.checkMsl_AvailabilityData(store_id, categoryId)) {
data.setCategory_img(R.mipmap.msl_availability_done);
} else {
data.setCategory_img(R.mipmap.msl_availability);
}
} else {
data.setCategory_img(R.mipmap.msl_availability);
data.setCategory_img(R.mipmap.msl_availability_grey);
}
categoryList.add(data);
data = new DailyDataMenuGetterSetter();
//data.setCategory_name("Stock & Facing");
data.setCategory_name(getResources().getString(R.string.daily_data_menu_stock_facing));
if (db.checkStockAndFacingData(store_id, categoryId)) {
data.setCategory_img(R.mipmap.stock_facing_done);
if (db.isMappingStockData()) {
if (db.checkStockAndFacingData(store_id, categoryId)) {
data.setCategory_img(R.mipmap.stock_facing_done);
} else {
data.setCategory_img(R.mipmap.stock_facing);
}
} else {
data.setCategory_img(R.mipmap.stock_facing);
data.setCategory_img(R.mipmap.stockandfacing_grey);
}
categoryList.add(data);
@@ -127,10 +135,14 @@ public class DailyDataMenuActivity extends AppCompatActivity {
data = new DailyDataMenuGetterSetter();
data.setCategory_name(getResources().getString(R.string.daily_data_menu_t2p));
if (db.isFilledT2P(store_id, categoryId)) {
data.setCategory_img(R.mipmap.t2p_compliance_done);
if (db.isMappingT2PData()) {
if (db.isFilledT2P(store_id, categoryId)) {
data.setCategory_img(R.mipmap.t2p_compliance_done);
} else {
data.setCategory_img(R.mipmap.t2p_compliance);
}
} else {
data.setCategory_img(R.mipmap.t2p_compliance);
data.setCategory_img(R.mipmap.t2pcompliance_grey);
}
categoryList.add(data);
@@ -150,10 +162,15 @@ public class DailyDataMenuActivity extends AppCompatActivity {
data = new DailyDataMenuGetterSetter();
//data.setCategory_name("Promo Compliance");
data.setCategory_name(getResources().getString(R.string.daily_data_menu_promo_compliance));
if (db.checkPromoComplianceData(store_id, categoryId)) {
data.setCategory_img(R.mipmap.promo_compliance_done);
if (db.isMappingPromotionData()) {
if (db.checkPromoComplianceData(store_id, categoryId)) {
data.setCategory_img(R.mipmap.promo_compliance_done);
} else {
data.setCategory_img(R.mipmap.promo_compliance);
}
} else {
data.setCategory_img(R.mipmap.promo_compliance);
data.setCategory_img(R.mipmap.promocompliance_grey);
}
categoryList.add(data);
@@ -223,40 +240,72 @@ public class DailyDataMenuActivity extends AppCompatActivity {
}
@Override
public void onBindViewHolder(DailyDataMenuAdapter.MyViewHolder holder, int position) {
public void onBindViewHolder(final DailyDataMenuAdapter.MyViewHolder holder, int position) {
final DailyDataMenuGetterSetter dailyData = list.get(position);
holder.categoryName.setText(dailyData.getCategory_name());
holder.categoryIcon.setImageResource(dailyData.getCategory_img());
if (dailyData.getCategory_name().equalsIgnoreCase(getResources().getString(R.string.daily_data_menu_msl_availability))) {
if (db.isMappingStockData()) {
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_stock_facing))) {
if (db.isMappingStockData()) {
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_promo_compliance))) {
if (db.isMappingPromotionData()) {
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()) {
holder.categoryName.setTextColor(getResources().getColor(R.color.colorPrimaryDark));
} else {
holder.categoryName.setTextColor(getResources().getColor(R.color.grey_background));
}
}
holder.lay_menu.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
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);
if (db.isMappingStockData()) {
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);
if (db.isMappingStockData()) {
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(getResources().getString(R.string.daily_data_menu_promo_compliance))) {
Intent intent = new Intent(DailyDataMenuActivity.this, PromoComplianceActivity.class);
intent.putExtra("categoryName", dailyData.getCategory_name());
intent.putExtra("categoryId", categoryId);
startActivity(intent);
if (db.isMappingPromotionData()) {
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)))) {
Intent intent = new Intent(DailyDataMenuActivity.this, T2PComplianceActivity.class);
intent.putExtra("categoryName", dailyData.getCategory_name());
intent.putExtra("categoryId", categoryId);
startActivity(intent);
overridePendingTransition(R.anim.activity_in, R.anim.activity_out);
}
else if (dailyData.getCategory_name().equalsIgnoreCase((getResources().getString(R.string.title_activity_Additional_visibility)))) {
if (db.isMappingT2PData()) {
Intent intent = new Intent(DailyDataMenuActivity.this, T2PComplianceActivity.class);
intent.putExtra("categoryName", dailyData.getCategory_name());
intent.putExtra("categoryId", categoryId);
startActivity(intent);
overridePendingTransition(R.anim.activity_in, R.anim.activity_out);
}
} else if (dailyData.getCategory_name().equalsIgnoreCase((getResources().getString(R.string.title_activity_Additional_visibility)))) {
Intent intent = new Intent(DailyDataMenuActivity.this, AdditionalVisibility.class);
intent.putExtra("categoryName", dailyData.getCategory_name());
intent.putExtra("categoryId", categoryId);
@@ -291,15 +340,13 @@ public class DailyDataMenuActivity extends AppCompatActivity {
private static boolean updateResources(Context context, String language) {
String lang ;
String lang;
if(language.equalsIgnoreCase("English")){
if (language.equalsIgnoreCase("English")) {
lang = "EN";
}
else if(language.equalsIgnoreCase("UAE")) {
} else if (language.equalsIgnoreCase("UAE")) {
lang = "AR";
}
else {
} else {
lang = "TR";
}
@@ -1053,7 +1053,9 @@ public class UploadActivity extends AppCompatActivity {
if (result.contains(CommonString.KEY_SUCCESS)) {
db.deleteAllTables();
showAlert(getString(R.string.menu_upload_data));
showAlert(getString(R.string.menu_upload_data));
//showAlert(getString(R.string.menu_upload_data));
} else {
showAlert(getString(R.string.error) + result.toString());
@@ -1062,6 +1064,7 @@ public class UploadActivity extends AppCompatActivity {
}
}
@Override
protected void onResume() {
super.onResume();
@@ -1,11 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:weightSum="1">
<android.support.v7.widget.CardView xmlns:card_view="http://schemas.android.com/apk/res-auto"
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
@@ -54,7 +55,7 @@
android:padding="10dp"
android:text="Category List"
android:textAppearance="?android:textAppearanceSmall"
android:textColor="#f2711f"
android:textColor="@color/colorPrimaryDark"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

@@ -159,9 +159,9 @@
<string name="title_store_list_activity_store_again_uploaded">Please Store data again Uploaded</string>
<string name="title_store_list_checkout_current">Lütfen önce mağazadan çık</string>
<string name="title_store_list_checkout_Already_filled">Doldurulmuş veriler</string>
<string name="NetworkError">Bağlantı kurulamıyor ,</string>
<string name="uploadeddata">Veriler Paylaşılıyor ,</string>
<string name="DataNot">Veriler Paylaşılmadı ,</string>
<string name="NetworkError">Bağlantı kurulamıyor</string>
<string name="uploadeddata">Veriler Paylaşılıyor</string>
<string name="DataNot">Veriler Paylaşılmadı</string>
<string name="delete">Sil</string>
<string name="adddatatoclick">Veri Eklemek İçin Evet tıklayın</string>
<string name="displayname">Teşhir Türü</string>
@@ -224,6 +224,9 @@
<string name="data_downloaded_successfully">Data downloaded successfully</string>
<string name="export_database">Export Database</string>
<string name="data_exported_successfully">Database Exported Successfully</string>
<string name="uploadeddata">Uploaded Data</string>
<string name="previous_data_upload">Please Upload Previous Data First</string>
<string name="error">Error Uploading</string>
</resources>