Merge pull request #82 from CPM-INDIA-SALES-AND-MARKETING-PVT-LTD/GG_Promo_Tick

//Stock_FacingActivity Changes today
This commit is contained in:
YadavendraSinghYaduvanshi
2017-01-20 18:01:17 +05:30
committed by GitHub
4 changed files with 73 additions and 15 deletions
@@ -2306,7 +2306,7 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
try { try {
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); 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) { if (cursordata != null) {
cursordata.moveToFirst(); cursordata.moveToFirst();
@@ -3306,4 +3306,59 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
} }
return filled; return filled;
} }
public boolean isMappingAdditionalPromotionData() {
boolean filled = false;
Cursor dbcursor = null;
try {
dbcursor = db.rawQuery("SELECT * FROM MAPPING_ADDITIONAL_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 checkAdditionalPromoComplianceData(String store_id, String category_id) {
Log.d("PromoCompliance ", "AdditionalPromoCompliance data--------------->Start<------------");
ArrayList<Promo_Compliance_DataGetterSetter> list = new ArrayList<>();
Cursor dbcursor = null;
try {
dbcursor = db.rawQuery("Select * from Additional_Promo_Compliance_Data " +
"where CATEGORY_ID='" + category_id + "' and STORE_ID='" + store_id + "'", null);
if (dbcursor != null) {
if (dbcursor.moveToFirst()) {
do {
Promo_Compliance_DataGetterSetter sb = new Promo_Compliance_DataGetterSetter();
sb.setSku_id(dbcursor.getString(dbcursor.getColumnIndexOrThrow("SKU_ID")));
list.add(sb);
} while (dbcursor.moveToNext());
}
dbcursor.close();
return list.size() > 0;
}
} catch (Exception e) {
Log.d("Exception ", "when fetching Records!!!!!!!!!!!!!!!!!!!!!" + e.toString());
return false;
}
Log.d("Stock_Facing ", "midday---------------------->Stop<-----------");
return false;
}
} }
@@ -268,11 +268,11 @@ public class LoginActivity extends AppCompatActivity {
// There was an error; don't attempt login and focus the first // There was an error; don't attempt login and focus the first
// form field with an error. // form field with an error.
focusView.requestFocus(); focusView.requestFocus();
} else if(isuseridValid(userid)){ } else if (!isuseridValid(userid)) {
Snackbar.make(museridView,getString(R.string.error_incorrect_username),Snackbar.LENGTH_SHORT).show(); Snackbar.make(museridView, getString(R.string.error_incorrect_username), Snackbar.LENGTH_SHORT).show();
}else if(isPasswordValid(password)){ } else if (!isPasswordValid(password)) {
Snackbar.make(museridView,getString(R.string.error_incorrect_password),Snackbar.LENGTH_SHORT).show(); Snackbar.make(museridView, getString(R.string.error_incorrect_password), Snackbar.LENGTH_SHORT).show();
}else{ } else {
// Show a progress spinner, and kick off a background task to // Show a progress spinner, and kick off a background task to
// perform the user login attempt. // perform the user login attempt.
@@ -285,11 +285,11 @@ public class LoginActivity extends AppCompatActivity {
private boolean isuseridValid(String userid) { private boolean isuseridValid(String userid) {
//TODO: Replace this with your own logic //TODO: Replace this with your own logic
boolean flag =true; boolean flag = true;
String u_id = preferences.getString(CommonString.KEY_USERNAME, ""); String u_id = preferences.getString(CommonString.KEY_USERNAME, "");
if(!u_id.equals("") && !userid.equals(u_id)){ if (!u_id.equals("") && !userid.equals(u_id)) {
flag = false; flag = false;
} }
@@ -298,11 +298,11 @@ public class LoginActivity extends AppCompatActivity {
private boolean isPasswordValid(String password) { private boolean isPasswordValid(String password) {
//TODO: Replace this with your own logic //TODO: Replace this with your own logic
boolean flag =true; boolean flag = true;
String pw = preferences.getString(CommonString.KEY_PASSWORD, ""); String pw = preferences.getString(CommonString.KEY_PASSWORD, "");
if(!password.equals(pw)){ if (!pw.equals("") && !password.equals(pw)) {
flag = false; flag = false;
} }
@@ -163,8 +163,9 @@ public class DailyDataMenuActivity extends AppCompatActivity {
//data.setCategory_name("Promo Compliance"); //data.setCategory_name("Promo Compliance");
data.setCategory_name(getResources().getString(R.string.daily_data_menu_promo_compliance)); data.setCategory_name(getResources().getString(R.string.daily_data_menu_promo_compliance));
if (db.isMappingPromotionData()) { if (db.isMappingPromotionData() || db.isMappingAdditionalPromotionData()) {
if (db.checkPromoComplianceData(store_id, categoryId)) { if (db.checkPromoComplianceData(store_id, categoryId) ||
db.checkAdditionalPromoComplianceData(store_id, categoryId)) {
data.setCategory_img(R.mipmap.promo_compliance_done); data.setCategory_img(R.mipmap.promo_compliance_done);
} else { } else {
data.setCategory_img(R.mipmap.promo_compliance); data.setCategory_img(R.mipmap.promo_compliance);
@@ -259,7 +260,7 @@ public class DailyDataMenuActivity extends AppCompatActivity {
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_promo_compliance))) { } else if (dailyData.getCategory_name().equalsIgnoreCase(getResources().getString(R.string.daily_data_menu_promo_compliance))) {
if (db.isMappingPromotionData()) { if (db.isMappingPromotionData() || db.isMappingAdditionalPromotionData()) {
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));
@@ -291,7 +292,7 @@ public class DailyDataMenuActivity extends AppCompatActivity {
} }
} else if (dailyData.getCategory_name().equalsIgnoreCase(getResources().getString(R.string.daily_data_menu_promo_compliance))) { } else if (dailyData.getCategory_name().equalsIgnoreCase(getResources().getString(R.string.daily_data_menu_promo_compliance))) {
if (db.isMappingPromotionData()) { if (db.isMappingPromotionData() || db.isMappingAdditionalPromotionData()) {
Intent intent = new Intent(DailyDataMenuActivity.this, PromoComplianceActivity.class); Intent intent = new Intent(DailyDataMenuActivity.this, PromoComplianceActivity.class);
intent.putExtra("categoryName", dailyData.getCategory_name()); intent.putExtra("categoryName", dailyData.getCategory_name());
intent.putExtra("categoryId", categoryId); intent.putExtra("categoryId", categoryId);
@@ -9,7 +9,9 @@
android:id="@+id/card_view" android:id="@+id/card_view"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_margin="5dp" android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
card_view:cardCornerRadius="10dp"> card_view:cardCornerRadius="10dp">
<LinearLayout <LinearLayout